function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}ApproximateTerrainHeights.initialize=function(){var e=ApproximateTerrainHeights._initPromise;return defined(e)||(e=Resource.fetchJson(buildModuleUrl("Assets/approximateTerrainHeights.json")).then((function(e){ApproximateTerrainHeights._terrainHeights=e})),ApproximateTerrainHeights._initPromise=e),e},ApproximateTerrainHeights.getMinimumMaximumHeights=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);var i=getTileXYLevel(e),r=ApproximateTerrainHeights._defaultMinTerrainHeight,n=ApproximateTerrainHeights._defaultMaxTerrainHeight;if(defined(i)){var a=i.level+"-"+i.x+"-"+i.y,o=ApproximateTerrainHeights._terrainHeights[a];defined(o)&&(r=o[0],n=o[1]),t.cartographicToCartesian(Rectangle.northeast(e,scratchDiagonalCartographic),scratchDiagonalCartesianNE),t.cartographicToCartesian(Rectangle.southwest(e,scratchDiagonalCartographic),scratchDiagonalCartesianSW),Cartesian3.midpoint(scratchDiagonalCartesianSW,scratchDiagonalCartesianNE,scratchCenterCartesian);var s=t.scaleToGeodeticSurface(scratchCenterCartesian,scratchSurfaceCartesian);if(defined(s)){var l=Cartesian3.distance(scratchCenterCartesian,s);r=Math.min(r,-l)}else r=ApproximateTerrainHeights._defaultMinTerrainHeight}return{minimumTerrainHeight:r=Math.max(ApproximateTerrainHeights._defaultMinTerrainHeight,r),maximumTerrainHeight:n}},ApproximateTerrainHeights.getBoundingSphere=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);var i=getTileXYLevel(e),r=ApproximateTerrainHeights._defaultMaxTerrainHeight;if(defined(i)){var n=i.level+"-"+i.x+"-"+i.y,a=ApproximateTerrainHeights._terrainHeights[n];defined(a)&&(r=a[1])}var o=BoundingSphere.fromRectangle3D(e,t,0);return BoundingSphere.fromRectangle3D(e,t,r,scratchBoundingSphere$4),BoundingSphere.union(o,scratchBoundingSphere$4,o)},ApproximateTerrainHeights._terrainHeightsMaxLevel=6,ApproximateTerrainHeights._defaultMaxTerrainHeight=9e3,ApproximateTerrainHeights._defaultMinTerrainHeight=-1e5,ApproximateTerrainHeights._terrainHeights=void 0,ApproximateTerrainHeights._initPromise=void 0,Object.defineProperties(ApproximateTerrainHeights,{initialized:{get:function(){return defined(ApproximateTerrainHeights._terrainHeights)}}});var hasOwnProperty=Object.hasOwnProperty,setPrototypeOf=Object.setPrototypeOf,isFrozen=Object.isFrozen,getPrototypeOf=Object.getPrototypeOf,getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,freeze=Object.freeze,seal=Object.seal,create=Object.create,_ref="undefined"!=typeof Reflect&&Reflect,apply=_ref.apply,construct=_ref.construct;apply||(apply=function(e,t,i){return e.apply(t,i)}),freeze||(freeze=function(e){return e}),seal||(seal=function(e){return e}),construct||(construct=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(_toConsumableArray(t))))});var arrayForEach=unapply(Array.prototype.forEach),arrayPop=unapply(Array.prototype.pop),arrayPush=unapply(Array.prototype.push),stringToLowerCase=unapply(String.prototype.toLowerCase),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=unconstruct(TypeError);function unapply(e){return function(t){for(var i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];return apply(e,t,r)}}function unconstruct(e){return function(){for(var t=arguments.length,i=Array(t),r=0;r<t;r++)i[r]=arguments[r];return construct(e,i)}}function addToSet(e,t){setPrototypeOf&&setPrototypeOf(e,null);for(var i=t.length;i--;){var r=t[i];if("string"==typeof r){var n=stringToLowerCase(r);n!==r&&(isFrozen(t)||(t[i]=n),r=n)}e[r]=!0}return e}function clone(e){var t=create(null),i=void 0;for(i in e)apply(hasOwnProperty,e,[i])&&(t[i]=e[i]);return t}function lookupGetter(e,t){for(;null!==e;){var i=getOwnPropertyDescriptor(e,t);if(i){if(i.get)return unapply(i.get);if("function"==typeof i.value)return unapply(i.value)}e=getPrototypeOf(e)}return function(e){return console.warn("fallback value for",e),null}}var html=freeze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),svg=freeze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),svgFilters=freeze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),svgDisallowed=freeze(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mathMl=freeze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),mathMlDisallowed=freeze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),text=freeze(["#text"]),html$1=freeze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),svg$1=freeze(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mathMl$1=freeze(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xml=freeze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MUSTACHE_EXPR=seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm),ERB_EXPR=seal(/<%[\s\S]*|[\s\S]*%>/gm),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function _toConsumableArray$1(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}var getGlobal=function(){return"undefined"==typeof window?null:window},_createTrustedTypesPolicy=function(e,t){if("object"!==(void 0===e?"undefined":_typeof(e))||"function"!=typeof e.createPolicy)return null;var i=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(i=t.currentScript.getAttribute(r));var n="dompurify"+(i?"#"+i:"");try{return e.createPolicy(n,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+n+" could not be created."),null}};function createDOMPurify(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:getGlobal(),t=function(e){return createDOMPurify(e)};if(t.version="2.3.4",t.removed=[],!e||!e.document||9!==e.document.nodeType)return t.isSupported=!1,t;var i=e.document,r=e.document,n=e.DocumentFragment,a=e.HTMLTemplateElement,o=e.Node,s=e.Element,l=e.NodeFilter,c=e.NamedNodeMap,u=void 0===c?e.NamedNodeMap||e.MozNamedAttrMap:c,d=e.HTMLFormElement,h=e.DOMParser,p=e.trustedTypes,f=s.prototype,m=lookupGetter(f,"cloneNode"),g=lookupGetter(f,"nextSibling"),_=lookupGetter(f,"childNodes"),y=lookupGetter(f,"parentNode");if("function"==typeof a){var v=r.createElement("template");v.content&&v.content.ownerDocument&&(r=v.content.ownerDocument)}var C=_createTrustedTypesPolicy(p,i),T=C&&Z?C.createHTML(""):"",S=r,A=S.implementation,x=S.createNodeIterator,E=S.createDocumentFragment,b=S.getElementsByTagName,P=i.importNode,D={};try{D=clone(r).documentMode?r.documentMode:{}}catch(e){}var w={};t.isSupported="function"==typeof y&&A&&void 0!==A.createHTMLDocument&&9!==D;var M=MUSTACHE_EXPR,I=ERB_EXPR,R=DATA_ATTR,O=ARIA_ATTR,B=IS_SCRIPT_OR_DATA,L=ATTR_WHITESPACE,F=IS_ALLOWED_URI,N=null,V=addToSet({},[].concat(_toConsumableArray$1(html),_toConsumableArray$1(svg),_toConsumableArray$1(svgFilters),_toConsumableArray$1(mathMl),_toConsumableArray$1(text))),k=null,U=addToSet({},[].concat(_toConsumableArray$1(html$1),_toConsumableArray$1(svg$1),_toConsumableArray$1(mathMl$1),_toConsumableArray$1(xml))),G=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$=null,z=null,H=!0,W=!0,j=!1,q=!1,X=!1,Y=!1,K=!1,J=!1,Q=!1,Z=!1,ee=!0,te=!0,ie=!1,re={},ne=null,ae=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),oe=null,se=addToSet({},["audio","video","img","source","image","track"]),le=null,ce=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ue="http://www.w3.org/1998/Math/MathML",de="http://www.w3.org/2000/svg",he="http://www.w3.org/1999/xhtml",pe=he,fe=!1,me=void 0,ge=["application/xhtml+xml","text/html"],_e="text/html",ye=void 0,ve=null,Ce=r.createElement("form"),Te=function(e){return e instanceof RegExp||e instanceof Function},Se=function(e){ve&&ve===e||(e&&"object"===(void 0===e?"undefined":_typeof(e))||(e={}),e=clone(e),N="ALLOWED_TAGS"in e?addToSet({},e.ALLOWED_TAGS):V,k="ALLOWED_ATTR"in e?addToSet({},e.ALLOWED_ATTR):U,le="ADD_URI_SAFE_ATTR"in e?addToSet(clone(ce),e.ADD_URI_SAFE_ATTR):ce,oe="ADD_DATA_URI_TAGS"in e?addToSet(clone(se),e.ADD_DATA_URI_TAGS):se,ne="FORBID_CONTENTS"in e?addToSet({},e.FORBID_CONTENTS):ae,$="FORBID_TAGS"in e?addToSet({},e.FORBID_TAGS):{},z="FORBID_ATTR"in e?addToSet({},e.FORBID_ATTR):{},re="USE_PROFILES"in e&&e.USE_PROFILES,H=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,j=e.ALLOW_UNKNOWN_PROTOCOLS||!1,q=e.SAFE_FOR_TEMPLATES||!1,X=e.WHOLE_DOCUMENT||!1,J=e.RETURN_DOM||!1,Q=e.RETURN_DOM_FRAGMENT||!1,Z=e.RETURN_TRUSTED_TYPE||!1,K=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=!1!==e.KEEP_CONTENT,ie=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||F,pe=e.NAMESPACE||he,e.CUSTOM_ELEMENT_HANDLING&&Te(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(G.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Te(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(G.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(G.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),me=me=-1===ge.indexOf(e.PARSER_MEDIA_TYPE)?_e:e.PARSER_MEDIA_TYPE,ye="application/xhtml+xml"===me?function(e){return e}:stringToLowerCase,q&&(W=!1),Q&&(J=!0),re&&(N=addToSet({},[].concat(_toConsumableArray$1(text))),k=[],!0===re.html&&(addToSet(N,html),addToSet(k,html$1)),!0===re.svg&&(addToSet(N,svg),addToSet(k,svg$1),addToSet(k,xml)),!0===re.svgFilters&&(addToSet(N,svgFilters),addToSet(k,svg$1),addToSet(k,xml)),!0===re.mathMl&&(addToSet(N,mathMl),addToSet(k,mathMl$1),addToSet(k,xml))),e.ADD_TAGS&&(N===V&&(N=clone(N)),addToSet(N,e.ADD_TAGS)),e.ADD_ATTR&&(k===U&&(k=clone(k)),addToSet(k,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&addToSet(le,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(ne===ae&&(ne=clone(ne)),addToSet(ne,e.FORBID_CONTENTS)),te&&(N["#text"]=!0),X&&addToSet(N,["html","head","body"]),N.table&&(addToSet(N,["tbody"]),delete $.tbody),freeze&&freeze(e),ve=e)},Ae=addToSet({},["mi","mo","mn","ms","mtext"]),xe=addToSet({},["foreignobject","desc","title","annotation-xml"]),Ee=addToSet({},svg);addToSet(Ee,svgFilters),addToSet(Ee,svgDisallowed);var be=addToSet({},mathMl);addToSet(be,mathMlDisallowed);var Pe=function(e){var t=y(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});var i=stringToLowerCase(e.tagName),r=stringToLowerCase(t.tagName);if(e.namespaceURI===de)return t.namespaceURI===he?"svg"===i:t.namespaceURI===ue?"svg"===i&&("annotation-xml"===r||Ae[r]):Boolean(Ee[i]);if(e.namespaceURI===ue)return t.namespaceURI===he?"math"===i:t.namespaceURI===de?"math"===i&&xe[r]:Boolean(be[i]);if(e.namespaceURI===he){if(t.namespaceURI===de&&!xe[r])return!1;if(t.namespaceURI===ue&&!Ae[r])return!1;var n=addToSet({},["title","style","font","a","script"]);return!be[i]&&(n[i]||!Ee[i])}return!1},De=function(e){arrayPush(t.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=T}catch(t){e.remove()}}},we=function(e,i){try{arrayPush(t.removed,{attribute:i.getAttributeNode(e),from:i})}catch(e){arrayPush(t.removed,{attribute:null,from:i})}if(i.removeAttribute(e),"is"===e&&!k[e])if(J||Q)try{De(i)}catch(e){}else try{i.setAttribute(e,"")}catch(e){}},Me=function(e){var t=void 0,i=void 0;if(K)e="<remove></remove>"+e;else{var n=stringMatch(e,/^[\r\n\t ]+/);i=n&&n[0]}"application/xhtml+xml"===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var a=C?C.createHTML(e):e;if(pe===he)try{t=(new h).parseFromString(a,me)}catch(e){}if(!t||!t.documentElement){t=A.createDocument(pe,"template",null);try{t.documentElement.innerHTML=fe?"":a}catch(e){}}var o=t.body||t.documentElement;return e&&i&&o.insertBefore(r.createTextNode(i),o.childNodes[0]||null),pe===he?b.call(t,X?"html":"body")[0]:X?t.documentElement:o},Ie=function(e){return x.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT,null,!1)},Re=function(e){return e instanceof d&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},Oe=function(e){return"object"===(void 0===o?"undefined":_typeof(o))?e instanceof o:e&&"object"===(void 0===e?"undefined":_typeof(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Be=function(e,i,r){w[e]&&arrayForEach(w[e],(function(e){e.call(t,i,r,ve)}))},Le=function(e){var i=void 0;if(Be("beforeSanitizeElements",e,null),Re(e))return De(e),!0;if(stringMatch(e.nodeName,/[\u0080-\uFFFF]/))return De(e),!0;var r=ye(e.nodeName);if(Be("uponSanitizeElement",e,{tagName:r,allowedTags:N}),!Oe(e.firstElementChild)&&(!Oe(e.content)||!Oe(e.content.firstElementChild))&®ExpTest(/<[/\w]/g,e.innerHTML)&®ExpTest(/<[/\w]/g,e.textContent))return De(e),!0;if("select"===r&®ExpTest(/<template/i,e.innerHTML))return De(e),!0;if(!N[r]||$[r]){if(te&&!ne[r]){var n=y(e)||e.parentNode,a=_(e)||e.childNodes;if(a&&n)for(var o=a.length-1;o>=0;--o)n.insertBefore(m(a[o],!0),g(e))}if(!$[r]&&Ne(r)){if(G.tagNameCheck instanceof RegExp&®ExpTest(G.tagNameCheck,r))return!1;if(G.tagNameCheck instanceof Function&&G.tagNameCheck(r))return!1}return De(e),!0}return e instanceof s&&!Pe(e)?(De(e),!0):"noscript"!==r&&"noembed"!==r||!regExpTest(/<\/no(script|embed)/i,e.innerHTML)?(q&&3===e.nodeType&&(i=e.textContent,i=stringReplace(i,M," "),i=stringReplace(i,I," "),e.textContent!==i&&(arrayPush(t.removed,{element:e.cloneNode()}),e.textContent=i)),Be("afterSanitizeElements",e,null),!1):(De(e),!0)},Fe=function(e,t,i){if(ee&&("id"===t||"name"===t)&&(i in r||i in Ce))return!1;if(W&&!z[t]&®ExpTest(R,t));else if(H&®ExpTest(O,t));else if(!k[t]||z[t]){if(!(Ne(e)&&(G.tagNameCheck instanceof RegExp&®ExpTest(G.tagNameCheck,e)||G.tagNameCheck instanceof Function&&G.tagNameCheck(e))&&(G.attributeNameCheck instanceof RegExp&®ExpTest(G.attributeNameCheck,t)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(t))||"is"===t&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&®ExpTest(G.tagNameCheck,i)||G.tagNameCheck instanceof Function&&G.tagNameCheck(i))))return!1}else if(le[t]);else if(regExpTest(F,stringReplace(i,L,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==stringIndexOf(i,"data:")||!oe[e]){if(j&&!regExpTest(B,stringReplace(i,L,"")));else if(i)return!1}else;return!0},Ne=function(e){return e.indexOf("-")>0},Ve=function(e){var i=void 0,r=void 0,n=void 0,a=void 0;Be("beforeSanitizeAttributes",e,null);var o=e.attributes;if(o){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:k};for(a=o.length;a--;){var l=i=o[a],c=l.name,u=l.namespaceURI;if(r=stringTrim(i.value),n=ye(c),s.attrName=n,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,Be("uponSanitizeAttribute",e,s),r=s.attrValue,!s.forceKeepAttr&&(we(c,e),s.keepAttr))if(regExpTest(/\/>/i,r))we(c,e);else{q&&(r=stringReplace(r,M," "),r=stringReplace(r,I," "));var d=ye(e.nodeName);if(Fe(d,n,r))try{u?e.setAttributeNS(u,c,r):e.setAttribute(c,r),arrayPop(t.removed)}catch(e){}}}Be("afterSanitizeAttributes",e,null)}},ke=function e(t){var i=void 0,r=Ie(t);for(Be("beforeSanitizeShadowDOM",t,null);i=r.nextNode();)Be("uponSanitizeShadowNode",i,null),Le(i)||(i.content instanceof n&&e(i.content),Ve(i));Be("afterSanitizeShadowDOM",t,null)};return t.sanitize=function(r,a){var s=void 0,l=void 0,c=void 0,u=void 0,d=void 0;if((fe=!r)&&(r="\x3c!--\x3e"),"string"!=typeof r&&!Oe(r)){if("function"!=typeof r.toString)throw typeErrorCreate("toString is not a function");if("string"!=typeof(r=r.toString()))throw typeErrorCreate("dirty is not a string, aborting")}if(!t.isSupported){if("object"===_typeof(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof r)return e.toStaticHTML(r);if(Oe(r))return e.toStaticHTML(r.outerHTML)}return r}if(Y||Se(a),t.removed=[],"string"==typeof r&&(ie=!1),ie);else if(r instanceof o)1===(l=(s=Me("\x3c!----\x3e")).ownerDocument.importNode(r,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?s=l:s.appendChild(l);else{if(!J&&!q&&!X&&-1===r.indexOf("<"))return C&&Z?C.createHTML(r):r;if(!(s=Me(r)))return J?null:T}s&&K&&De(s.firstChild);for(var h=Ie(ie?r:s);c=h.nextNode();)3===c.nodeType&&c===u||Le(c)||(c.content instanceof n&&ke(c.content),Ve(c),u=c);if(u=null,ie)return r;if(J){if(Q)for(d=E.call(s.ownerDocument);s.firstChild;)d.appendChild(s.firstChild);else d=s;return k.shadowroot&&(d=P.call(i,d,!0)),d}var p=X?s.outerHTML:s.innerHTML;return q&&(p=stringReplace(p,M," "),p=stringReplace(p,I," ")),C&&Z?C.createHTML(p):p},t.setConfig=function(e){Se(e),Y=!0},t.clearConfig=function(){ve=null,Y=!1},t.isValidAttribute=function(e,t,i){ve||Se({});var r=ye(e),n=ye(t);return Fe(r,n,i)},t.addHook=function(e,t){"function"==typeof t&&(w[e]=w[e]||[],arrayPush(w[e],t))},t.removeHook=function(e){w[e]&&arrayPop(w[e])},t.removeHooks=function(e){w[e]&&(w[e]=[])},t.removeAllHooks=function(){w={}},t}var purify=createDOMPurify(),nextCreditId=0,creditToId={};function Credit(e,t){var i,r=e;defined(creditToId[r])?i=creditToId[r]:(i=nextCreditId++,creditToId[r]=i),t=defaultValue(t,!1),this._id=i,this._html=e,this._showOnScreen=t,this._element=void 0}Object.defineProperties(Credit.prototype,{html:{get:function(){return this._html}},id:{get:function(){return this._id}},showOnScreen:{get:function(){return this._showOnScreen}},element:{get:function(){if(!defined(this._element)){var e=purify.sanitize(this._html),t=document.createElement("div");t._creditId=this._id,t.style.display="inline",t.innerHTML=e;for(var i=t.querySelectorAll("a"),r=0;r<i.length;r++)i[r].setAttribute("target","_blank");this._element=t}return this._element}}}),Credit.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e._id===t._id},Credit.prototype.equals=function(e){return Credit.equals(this,e)},Credit.getIonCredit=function(e){var t=defined(e.collapsible)&&!e.collapsible,i=new Credit(e.html,t);return i._isIon=-1!==i.html.indexOf("ion-credit.png"),i},Credit.clone=function(e){if(defined(e))return new Credit(e.html,e.showOnScreen)};var HeightmapEncoding={NONE:0,LERC:1},HeightmapEncoding$1=Object.freeze(HeightmapEncoding);function AxisAlignedBoundingBox(e,t,i){this.minimum=Cartesian3.clone(defaultValue(e,Cartesian3.ZERO)),this.maximum=Cartesian3.clone(defaultValue(t,Cartesian3.ZERO)),i=defined(i)?Cartesian3.clone(i):Cartesian3.midpoint(this.minimum,this.maximum,new Cartesian3),this.center=i}AxisAlignedBoundingBox.fromPoints=function(e,t){if(defined(t)||(t=new AxisAlignedBoundingBox),!defined(e)||0===e.length)return t.minimum=Cartesian3.clone(Cartesian3.ZERO,t.minimum),t.maximum=Cartesian3.clone(Cartesian3.ZERO,t.maximum),t.center=Cartesian3.clone(Cartesian3.ZERO,t.center),t;for(var i=e[0].x,r=e[0].y,n=e[0].z,a=e[0].x,o=e[0].y,s=e[0].z,l=e.length,c=1;c<l;c++){var u=e[c],d=u.x,h=u.y,p=u.z;i=Math.min(d,i),a=Math.max(d,a),r=Math.min(h,r),o=Math.max(h,o),n=Math.min(p,n),s=Math.max(p,s)}var f=t.minimum;f.x=i,f.y=r,f.z=n;var m=t.maximum;return m.x=a,m.y=o,m.z=s,t.center=Cartesian3.midpoint(f,m,t.center),t},AxisAlignedBoundingBox.clone=function(e,t){if(defined(e))return defined(t)?(t.minimum=Cartesian3.clone(e.minimum,t.minimum),t.maximum=Cartesian3.clone(e.maximum,t.maximum),t.center=Cartesian3.clone(e.center,t.center),t):new AxisAlignedBoundingBox(e.minimum,e.maximum,e.center)},AxisAlignedBoundingBox.equals=function(e,t){return e===t||defined(e)&&defined(t)&&Cartesian3.equals(e.center,t.center)&&Cartesian3.equals(e.minimum,t.minimum)&&Cartesian3.equals(e.maximum,t.maximum)};var intersectScratch=new Cartesian3;function EllipsoidalOccluder(e,t){this._ellipsoid=e,this._cameraPosition=new Cartesian3,this._cameraPositionInScaledSpace=new Cartesian3,this._distanceToLimbInScaledSpaceSquared=0,defined(t)&&(this.cameraPosition=t)}AxisAlignedBoundingBox.intersectPlane=function(e,t){intersectScratch=Cartesian3.subtract(e.maximum,e.minimum,intersectScratch);var i=Cartesian3.multiplyByScalar(intersectScratch,.5,intersectScratch),r=t.normal,n=i.x*Math.abs(r.x)+i.y*Math.abs(r.y)+i.z*Math.abs(r.z),a=Cartesian3.dot(e.center,r)+t.distance;return a-n>0?Intersect$1.INSIDE:a+n<0?Intersect$1.OUTSIDE:Intersect$1.INTERSECTING},AxisAlignedBoundingBox.prototype.clone=function(e){return AxisAlignedBoundingBox.clone(this,e)},AxisAlignedBoundingBox.prototype.intersectPlane=function(e){return AxisAlignedBoundingBox.intersectPlane(this,e)},AxisAlignedBoundingBox.prototype.equals=function(e){return AxisAlignedBoundingBox.equals(this,e)},Object.defineProperties(EllipsoidalOccluder.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(e){var t=this._ellipsoid.transformPositionToScaledSpace(e,this._cameraPositionInScaledSpace),i=Cartesian3.magnitudeSquared(t)-1;Cartesian3.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=t,this._distanceToLimbInScaledSpaceSquared=i}}});var scratchCartesian$9=new Cartesian3;EllipsoidalOccluder.prototype.isPointVisible=function(e){return isScaledSpacePointVisible(this._ellipsoid.transformPositionToScaledSpace(e,scratchCartesian$9),this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)},EllipsoidalOccluder.prototype.isScaledSpacePointVisible=function(e){return isScaledSpacePointVisible(e,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};var scratchCameraPositionInScaledSpaceShrunk=new Cartesian3;EllipsoidalOccluder.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(e,t){var i,r,n=this._ellipsoid;return defined(t)&&t<0&&n.minimumRadius>-t?((r=scratchCameraPositionInScaledSpaceShrunk).x=this._cameraPosition.x/(n.radii.x+t),r.y=this._cameraPosition.y/(n.radii.y+t),r.z=this._cameraPosition.z/(n.radii.z+t),i=r.x*r.x+r.y*r.y+r.z*r.z-1):(r=this._cameraPositionInScaledSpace,i=this._distanceToLimbInScaledSpaceSquared),isScaledSpacePointVisible(e,r,i)},EllipsoidalOccluder.prototype.computeHorizonCullingPoint=function(e,t,i){return computeHorizonCullingPointFromPositions(this._ellipsoid,e,t,i)};var scratchEllipsoidShrunk=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE);EllipsoidalOccluder.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(e,t,i,r){return computeHorizonCullingPointFromPositions(getPossiblyShrunkEllipsoid(this._ellipsoid,i,scratchEllipsoidShrunk),e,t,r)},EllipsoidalOccluder.prototype.computeHorizonCullingPointFromVertices=function(e,t,i,r,n){return computeHorizonCullingPointFromVertices(this._ellipsoid,e,t,i,r,n)},EllipsoidalOccluder.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(e,t,i,r,n,a){return computeHorizonCullingPointFromVertices(getPossiblyShrunkEllipsoid(this._ellipsoid,n,scratchEllipsoidShrunk),e,t,i,r,a)};var subsampleScratch=[];EllipsoidalOccluder.prototype.computeHorizonCullingPointFromRectangle=function(e,t,i){var r=Rectangle.subsample(e,t,0,subsampleScratch),n=BoundingSphere.fromPoints(r);if(!(Cartesian3.magnitude(n.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(n.center,r,i)};var scratchEllipsoidShrunkRadii=new Cartesian3;function getPossiblyShrunkEllipsoid(e,t,i){if(defined(t)&&t<0&&e.minimumRadius>-t){var r=Cartesian3.fromElements(e.radii.x+t,e.radii.y+t,e.radii.z+t,scratchEllipsoidShrunkRadii);e=Ellipsoid.fromCartesian3(r,i)}return e}function computeHorizonCullingPointFromPositions(e,t,i,r){defined(r)||(r=new Cartesian3);for(var n=computeScaledSpaceDirectionToPoint(e,t),a=0,o=0,s=i.length;o<s;++o){var l=computeMagnitude(e,i[o],n);if(l<0)return;a=Math.max(a,l)}return magnitudeToPoint(n,a,r)}var positionScratch$b=new Cartesian3;function computeHorizonCullingPointFromVertices(e,t,i,r,n,a){defined(a)||(a=new Cartesian3),r=defaultValue(r,3),n=defaultValue(n,Cartesian3.ZERO);for(var o=computeScaledSpaceDirectionToPoint(e,t),s=0,l=0,c=i.length;l<c;l+=r){positionScratch$b.x=i[l]+n.x,positionScratch$b.y=i[l+1]+n.y,positionScratch$b.z=i[l+2]+n.z;var u=computeMagnitude(e,positionScratch$b,o);if(u<0)return;s=Math.max(s,u)}return magnitudeToPoint(o,s,a)}function isScaledSpacePointVisible(e,t,i){var r=t,n=i,a=Cartesian3.subtract(e,r,scratchCartesian$9),o=-Cartesian3.dot(a,r);return!(n<0?o>0:o>n&&o*o/Cartesian3.magnitudeSquared(a)>n)}var scaledSpaceScratch=new Cartesian3,directionScratch=new Cartesian3;function computeMagnitude(e,t,i){var r=e.transformPositionToScaledSpace(t,scaledSpaceScratch),n=Cartesian3.magnitudeSquared(r),a=Math.sqrt(n),o=Cartesian3.divideByScalar(r,a,directionScratch);n=Math.max(1,n);var s=1/(a=Math.max(1,a));return 1/(Cartesian3.dot(o,i)*s-Cartesian3.magnitude(Cartesian3.cross(o,i,o))*(Math.sqrt(n-1)*s))}function magnitudeToPoint(e,t,i){if(!(t<=0||t===1/0||t!=t))return Cartesian3.multiplyByScalar(e,t,i)}var directionToPointScratch=new Cartesian3;function computeScaledSpaceDirectionToPoint(e,t){return Cartesian3.equals(t,Cartesian3.ZERO)?t:(e.transformPositionToScaledSpace(t,directionToPointScratch),Cartesian3.normalize(directionToPointScratch,directionToPointScratch))}var QuadraticRealPolynomial={};function addWithCancellationCheck$1(e,t,i){var r=e+t;return CesiumMath.sign(e)!==CesiumMath.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<i?0:r}QuadraticRealPolynomial.computeDiscriminant=function(e,t,i){return t*t-4*e*i},QuadraticRealPolynomial.computeRealRoots=function(e,t,i){var r;if(0===e)return 0===t?[]:[-i/t];if(0===t){if(0===i)return[0,0];var n=Math.abs(i),a=Math.abs(e);if(n<a&&n/a<CesiumMath.EPSILON14)return[0,0];if(n>a&&a/n<CesiumMath.EPSILON14)return[];if((r=-i/e)<0)return[];var o=Math.sqrt(r);return[-o,o]}if(0===i)return(r=-t/e)<0?[r,0]:[0,r];var s=addWithCancellationCheck$1(t*t,-(4*e*i),CesiumMath.EPSILON14);if(s<0)return[];var l=-.5*addWithCancellationCheck$1(t,CesiumMath.sign(t)*Math.sqrt(s),CesiumMath.EPSILON14);return t>0?[l/e,i/l]:[i/l,l/e]};var CubicRealPolynomial={};function computeRealRoots(e,t,i,r){var n,a,o=e,s=t/3,l=i/3,c=r,u=o*l,d=s*c,h=s*s,p=l*l,f=o*l-h,m=o*c-s*l,g=s*c-p,_=4*f*g-m*m;if(_<0){var y,v,C;h*d>=u*p?(y=o,v=f,C=-2*s*f+o*m):(y=c,v=g,C=-c*m+2*l*g);var T=-(C<0?-1:1)*Math.abs(y)*Math.sqrt(-_),S=(a=-C+T)/2,A=S<0?-Math.pow(-S,1/3):Math.pow(S,1/3),x=a===T?-A:-v/A;return n=v<=0?A+x:-C/(A*A+x*x+v),h*d>=u*p?[(n-s)/o]:[-c/(n+l)]}var E=f,b=-2*s*f+o*m,P=g,D=-c*m+2*l*g,w=Math.sqrt(_),M=Math.sqrt(3)/2,I=Math.abs(Math.atan2(o*w,-b)/3);n=2*Math.sqrt(-E);var R=Math.cos(I);a=n*R;var O=n*(-R/2-M*Math.sin(I)),B=a+O>2*s?a-s:O-s,L=o,F=B/L;I=Math.abs(Math.atan2(c*w,-D)/3);var N=-c,V=(a=(n=2*Math.sqrt(-P))*(R=Math.cos(I)))+(O=n*(-R/2-M*Math.sin(I)))<2*l?a+l:O+l,k=N/V,U=-B*V-L*N,G=(l*U-s*(B*N))/(-s*U+l*(L*V));return F<=G?F<=k?G<=k?[F,G,k]:[F,k,G]:[k,F,G]:F<=k?[G,F,k]:G<=k?[G,k,F]:[k,G,F]}CubicRealPolynomial.computeDiscriminant=function(e,t,i,r){var n=t*t,a=i*i;return 18*e*t*i*r+n*a-27*(e*e)*(r*r)-4*(e*a*i+n*t*r)},CubicRealPolynomial.computeRealRoots=function(e,t,i,r){var n,a;if(0===e)return QuadraticRealPolynomial.computeRealRoots(t,i,r);if(0===t){if(0===i){if(0===r)return[0,0,0];var o=(a=-r/e)<0?-Math.pow(-a,1/3):Math.pow(a,1/3);return[o,o,o]}return 0===r?0===(n=QuadraticRealPolynomial.computeRealRoots(e,0,i)).Length?[0]:[n[0],0,n[1]]:computeRealRoots(e,0,i,r)}return 0===i?0===r?(a=-t/e)<0?[a,0,0]:[0,0,a]:computeRealRoots(e,t,0,r):0===r?0===(n=QuadraticRealPolynomial.computeRealRoots(e,t,i)).length?[0]:n[1]<=0?[n[0],n[1],0]:n[0]>=0?[0,n[0],n[1]]:[n[0],0,n[1]]:computeRealRoots(e,t,i,r)};var QuarticRealPolynomial={};function original(e,t,i,r){var n=e*e,a=t-3*n/8,o=i-t*e/2+n*e/8,s=r-i*e/4+t*n/16-3*n*n/256,l=CubicRealPolynomial.computeRealRoots(1,2*a,a*a-4*s,-o*o);if(l.length>0){var c=-e/4,u=l[l.length-1];if(Math.abs(u)<CesiumMath.EPSILON14){var d=QuadraticRealPolynomial.computeRealRoots(1,a,s);if(2===d.length){var h,p=d[0],f=d[1];if(p>=0&&f>=0){var m=Math.sqrt(p),g=Math.sqrt(f);return[c-g,c-m,c+m,c+g]}if(p>=0&&f<0)return[c-(h=Math.sqrt(p)),c+h];if(p<0&&f>=0)return[c-(h=Math.sqrt(f)),c+h]}return[]}if(u>0){var _=Math.sqrt(u),y=(a+u-o/_)/2,v=(a+u+o/_)/2,C=QuadraticRealPolynomial.computeRealRoots(1,_,y),T=QuadraticRealPolynomial.computeRealRoots(1,-_,v);return 0!==C.length?(C[0]+=c,C[1]+=c,0!==T.length?(T[0]+=c,T[1]+=c,C[1]<=T[0]?[C[0],C[1],T[0],T[1]]:T[1]<=C[0]?[T[0],T[1],C[0],C[1]]:C[0]>=T[0]&&C[1]<=T[1]?[T[0],C[0],C[1],T[1]]:T[0]>=C[0]&&T[1]<=C[1]?[C[0],T[0],T[1],C[1]]:C[0]>T[0]&&C[0]<T[1]?[T[0],C[0],T[1],C[1]]:[C[0],T[0],C[1],T[1]]):C):0!==T.length?(T[0]+=c,T[1]+=c,T):[]}}return[]}function neumark(e,t,i,r){var n=e*e,a=-2*t,o=i*e+t*t-4*r,s=n*r-i*t*e+i*i,l=CubicRealPolynomial.computeRealRoots(1,a,o,s);if(l.length>0){var c,u,d,h,p,f,m=l[0],g=t-m,_=g*g,y=e/2,v=g/2,C=_-4*r,T=_+4*Math.abs(r),S=n-4*m,A=n+4*Math.abs(m);if(m<0||C*A<S*T){var x=Math.sqrt(S);c=x/2,u=0===x?0:(e*v-i)/x}else{var E=Math.sqrt(C);c=0===E?0:(e*v-i)/E,u=E/2}0===y&&0===c?(d=0,h=0):CesiumMath.sign(y)===CesiumMath.sign(c)?h=m/(d=y+c):d=m/(h=y-c),0===v&&0===u?(p=0,f=0):CesiumMath.sign(v)===CesiumMath.sign(u)?f=r/(p=v+u):p=r/(f=v-u);var b=QuadraticRealPolynomial.computeRealRoots(1,d,p),P=QuadraticRealPolynomial.computeRealRoots(1,h,f);if(0!==b.length)return 0!==P.length?b[1]<=P[0]?[b[0],b[1],P[0],P[1]]:P[1]<=b[0]?[P[0],P[1],b[0],b[1]]:b[0]>=P[0]&&b[1]<=P[1]?[P[0],b[0],b[1],P[1]]:P[0]>=b[0]&&P[1]<=b[1]?[b[0],P[0],P[1],b[1]]:b[0]>P[0]&&b[0]<P[1]?[P[0],b[0],P[1],b[1]]:[b[0],P[0],b[1],P[1]]:b;if(0!==P.length)return P}return[]}function Ray(e,t){t=Cartesian3.clone(defaultValue(t,Cartesian3.ZERO)),Cartesian3.equals(t,Cartesian3.ZERO)||Cartesian3.normalize(t,t),this.origin=Cartesian3.clone(defaultValue(e,Cartesian3.ZERO)),this.direction=t}QuarticRealPolynomial.computeDiscriminant=function(e,t,i,r,n){var a=e*e,o=t*t,s=o*t,l=i*i,c=l*i,u=r*r,d=u*r,h=n*n;return o*l*u-4*s*d-4*e*c*u+18*e*t*i*d-27*a*u*u+256*(a*e)*(h*n)+n*(18*s*i*r-4*o*c+16*e*l*l-80*e*t*l*r-6*e*o*u+144*a*i*u)+h*(144*e*o*i-27*o*o-128*a*l-192*a*t*r)},QuarticRealPolynomial.computeRealRoots=function(e,t,i,r,n){if(Math.abs(e)<CesiumMath.EPSILON15)return CubicRealPolynomial.computeRealRoots(t,i,r,n);var a=t/e,o=i/e,s=r/e,l=n/e,c=a<0?1:0;switch(c+=o<0?c+1:c,c+=s<0?c+1:c,c+=l<0?c+1:c){case 0:case 3:case 4:case 6:case 7:case 9:case 10:case 12:case 13:case 14:case 15:return original(a,o,s,l);case 1:case 2:case 5:case 8:case 11:return neumark(a,o,s,l);default:return}},Ray.clone=function(e,t){if(defined(e))return defined(t)?(t.origin=Cartesian3.clone(e.origin),t.direction=Cartesian3.clone(e.direction),t):new Ray(e.origin,e.direction)},Ray.getPoint=function(e,t,i){return defined(i)||(i=new Cartesian3),i=Cartesian3.multiplyByScalar(e.direction,t,i),Cartesian3.add(e.origin,i,i)};var IntersectionTests={rayPlane:function(e,t,i){defined(i)||(i=new Cartesian3);var r=e.origin,n=e.direction,a=t.normal,o=Cartesian3.dot(a,n);if(!(Math.abs(o)<CesiumMath.EPSILON15)){var s=(-t.distance-Cartesian3.dot(a,r))/o;if(!(s<0))return i=Cartesian3.multiplyByScalar(n,s,i),Cartesian3.add(r,i,i)}}},scratchEdge0=new Cartesian3,scratchEdge1=new Cartesian3,scratchPVec=new Cartesian3,scratchTVec=new Cartesian3,scratchQVec=new Cartesian3;IntersectionTests.rayTriangleParametric=function(e,t,i,r,n){n=defaultValue(n,!1);var a,o,s,l,c,u=e.origin,d=e.direction,h=Cartesian3.subtract(i,t,scratchEdge0),p=Cartesian3.subtract(r,t,scratchEdge1),f=Cartesian3.cross(d,p,scratchPVec),m=Cartesian3.dot(h,f);if(n){if(m<CesiumMath.EPSILON6)return;if(a=Cartesian3.subtract(u,t,scratchTVec),(s=Cartesian3.dot(a,f))<0||s>m)return;if(o=Cartesian3.cross(a,h,scratchQVec),(l=Cartesian3.dot(d,o))<0||s+l>m)return;c=Cartesian3.dot(p,o)/m}else{if(Math.abs(m)<CesiumMath.EPSILON6)return;var g=1/m;if(a=Cartesian3.subtract(u,t,scratchTVec),(s=Cartesian3.dot(a,f)*g)<0||s>1)return;if(o=Cartesian3.cross(a,h,scratchQVec),(l=Cartesian3.dot(d,o)*g)<0||s+l>1)return;c=Cartesian3.dot(p,o)*g}return c},IntersectionTests.rayTriangle=function(e,t,i,r,n,a){var o=IntersectionTests.rayTriangleParametric(e,t,i,r,n);if(defined(o)&&!(o<0))return defined(a)||(a=new Cartesian3),Cartesian3.multiplyByScalar(e.direction,o,a),Cartesian3.add(e.origin,a,a)};var scratchLineSegmentTriangleRay=new Ray;function solveQuadratic(e,t,i,r){var n=t*t-4*e*i;if(!(n<0)){if(n>0){var a=1/(2*e),o=Math.sqrt(n),s=(-t+o)*a,l=(-t-o)*a;return s<l?(r.root0=s,r.root1=l):(r.root0=l,r.root1=s),r}var c=-t/(2*e);if(0!==c)return r.root0=r.root1=c,r}}IntersectionTests.lineSegmentTriangle=function(e,t,i,r,n,a,o){var s=scratchLineSegmentTriangleRay;Cartesian3.clone(e,s.origin),Cartesian3.subtract(t,e,s.direction),Cartesian3.normalize(s.direction,s.direction);var l=IntersectionTests.rayTriangleParametric(s,i,r,n,a);if(!(!defined(l)||l<0||l>Cartesian3.distance(e,t)))return defined(o)||(o=new Cartesian3),Cartesian3.multiplyByScalar(s.direction,l,o),Cartesian3.add(s.origin,o,o)};var raySphereRoots={root0:0,root1:0};function raySphere(e,t,i){defined(i)||(i=new Interval);var r=e.origin,n=e.direction,a=t.center,o=t.radius*t.radius,s=Cartesian3.subtract(r,a,scratchPVec),l=solveQuadratic(Cartesian3.dot(n,n),2*Cartesian3.dot(n,s),Cartesian3.magnitudeSquared(s)-o,raySphereRoots);if(defined(l))return i.start=l.root0,i.stop=l.root1,i}IntersectionTests.raySphere=function(e,t,i){if(defined(i=raySphere(e,t,i))&&!(i.stop<0))return i.start=Math.max(i.start,0),i};var scratchLineSegmentRay=new Ray;IntersectionTests.lineSegmentSphere=function(e,t,i,r){var n=scratchLineSegmentRay;Cartesian3.clone(e,n.origin);var a=Cartesian3.subtract(t,e,n.direction),o=Cartesian3.magnitude(a);if(Cartesian3.normalize(a,a),!(!defined(r=raySphere(n,i,r))||r.stop<0||r.start>o))return r.start=Math.max(r.start,0),r.stop=Math.min(r.stop,o),r};var scratchQ=new Cartesian3,scratchW$1=new Cartesian3;function addWithCancellationCheck(e,t,i){var r=e+t;return CesiumMath.sign(e)!==CesiumMath.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<i?0:r}function quadraticVectorExpression(e,t,i,r,n){var a,o=r*r,s=n*n,l=(e[Matrix3.COLUMN1ROW1]-e[Matrix3.COLUMN2ROW2])*s,c=n*(r*addWithCancellationCheck(e[Matrix3.COLUMN1ROW0],e[Matrix3.COLUMN0ROW1],CesiumMath.EPSILON15)+t.y),u=e[Matrix3.COLUMN0ROW0]*o+e[Matrix3.COLUMN2ROW2]*s+r*t.x+i,d=s*addWithCancellationCheck(e[Matrix3.COLUMN2ROW1],e[Matrix3.COLUMN1ROW2],CesiumMath.EPSILON15),h=n*(r*addWithCancellationCheck(e[Matrix3.COLUMN2ROW0],e[Matrix3.COLUMN0ROW2])+t.z),p=[];if(0===h&&0===d){if(0===(a=QuadraticRealPolynomial.computeRealRoots(l,c,u)).length)return p;var f=a[0],m=Math.sqrt(Math.max(1-f*f,0));if(p.push(new Cartesian3(r,n*f,n*-m)),p.push(new Cartesian3(r,n*f,n*m)),2===a.length){var g=a[1],_=Math.sqrt(Math.max(1-g*g,0));p.push(new Cartesian3(r,n*g,n*-_)),p.push(new Cartesian3(r,n*g,n*_))}return p}var y=h*h,v=d*d,C=h*d,T=l*l+v,S=2*(c*l+C),A=2*u*l+c*c-v+y,x=2*(u*c-C),E=u*u-y;if(0===T&&0===S&&0===A&&0===x)return p;var b=(a=QuarticRealPolynomial.computeRealRoots(T,S,A,x,E)).length;if(0===b)return p;for(var P=0;P<b;++P){var D=a[P],w=D*D,M=Math.max(1-w,0),I=Math.sqrt(M),R=(CesiumMath.sign(l)===CesiumMath.sign(u)?addWithCancellationCheck(l*w+u,c*D,CesiumMath.EPSILON12):CesiumMath.sign(u)===CesiumMath.sign(c*D)?addWithCancellationCheck(l*w,c*D+u,CesiumMath.EPSILON12):addWithCancellationCheck(l*w+c*D,u,CesiumMath.EPSILON12))*addWithCancellationCheck(d*D,h,CesiumMath.EPSILON15);R<0?p.push(new Cartesian3(r,n*D,n*I)):R>0?p.push(new Cartesian3(r,n*D,n*-I)):0!==I?(p.push(new Cartesian3(r,n*D,n*-I)),p.push(new Cartesian3(r,n*D,n*I)),++P):p.push(new Cartesian3(r,n*D,n*I))}return p}IntersectionTests.rayEllipsoid=function(e,t){var i,r,n,a,o,s=t.oneOverRadii,l=Cartesian3.multiplyComponents(s,e.origin,scratchQ),c=Cartesian3.multiplyComponents(s,e.direction,scratchW$1),u=Cartesian3.magnitudeSquared(l),d=Cartesian3.dot(l,c);if(u>1){if(d>=0)return;var h=d*d;if(i=u-1,h<(n=(r=Cartesian3.magnitudeSquared(c))*i))return;if(h>n){a=d*d-n;var p=(o=-d+Math.sqrt(a))/r,f=i/o;return p<f?new Interval(p,f):{start:f,stop:p}}var m=Math.sqrt(i/r);return new Interval(m,m)}return u<1?(i=u-1,a=d*d-(n=(r=Cartesian3.magnitudeSquared(c))*i),new Interval(0,(o=-d+Math.sqrt(a))/r)):d<0?new Interval(0,-d/(r=Cartesian3.magnitudeSquared(c))):void 0};var firstAxisScratch=new Cartesian3,secondAxisScratch=new Cartesian3,thirdAxisScratch=new Cartesian3,referenceScratch=new Cartesian3,bCart=new Cartesian3,bScratch=new Matrix3,btScratch=new Matrix3,diScratch=new Matrix3,dScratch$1=new Matrix3,cScratch=new Matrix3,tempMatrix=new Matrix3,aScratch=new Matrix3,sScratch$1=new Cartesian3,closestScratch=new Cartesian3,surfPointScratch=new Cartographic;IntersectionTests.grazingAltitudeLocation=function(e,t){var i=e.origin,r=e.direction;if(!Cartesian3.equals(i,Cartesian3.ZERO)){var n=t.geodeticSurfaceNormal(i,firstAxisScratch);if(Cartesian3.dot(r,n)>=0)return i}var a=defined(this.rayEllipsoid(e,t)),o=t.transformPositionToScaledSpace(r,firstAxisScratch),s=Cartesian3.normalize(o,o),l=Cartesian3.mostOrthogonalAxis(o,referenceScratch),c=Cartesian3.normalize(Cartesian3.cross(l,s,secondAxisScratch),secondAxisScratch),u=Cartesian3.normalize(Cartesian3.cross(s,c,thirdAxisScratch),thirdAxisScratch),d=bScratch;d[0]=s.x,d[1]=s.y,d[2]=s.z,d[3]=c.x,d[4]=c.y,d[5]=c.z,d[6]=u.x,d[7]=u.y,d[8]=u.z;var h=Matrix3.transpose(d,btScratch),p=Matrix3.fromScale(t.radii,diScratch),f=Matrix3.fromScale(t.oneOverRadii,dScratch$1),m=cScratch;m[0]=0,m[1]=-r.z,m[2]=r.y,m[3]=r.z,m[4]=0,m[5]=-r.x,m[6]=-r.y,m[7]=r.x,m[8]=0;var g,_,y=Matrix3.multiply(Matrix3.multiply(h,f,tempMatrix),m,tempMatrix),v=Matrix3.multiply(Matrix3.multiply(y,p,aScratch),d,aScratch),C=Matrix3.multiplyByVector(y,i,bCart),T=quadraticVectorExpression(v,Cartesian3.negate(C,firstAxisScratch),0,0,1),S=T.length;if(S>0){for(var A=Cartesian3.clone(Cartesian3.ZERO,closestScratch),x=Number.NEGATIVE_INFINITY,E=0;E<S;++E){g=Matrix3.multiplyByVector(p,Matrix3.multiplyByVector(d,T[E],sScratch$1),sScratch$1);var b=Cartesian3.normalize(Cartesian3.subtract(g,i,referenceScratch),referenceScratch),P=Cartesian3.dot(b,r);P>x&&(x=P,A=Cartesian3.clone(g,A))}var D=t.cartesianToCartographic(A,surfPointScratch);return x=CesiumMath.clamp(x,0,1),_=Cartesian3.magnitude(Cartesian3.subtract(A,i,referenceScratch))*Math.sqrt(1-x*x),_=a?-_:_,D.height=_,t.cartographicToCartesian(D,new Cartesian3)}};var lineSegmentPlaneDifference=new Cartesian3;function Plane(e,t){this.normal=Cartesian3.clone(e),this.distance=t}IntersectionTests.lineSegmentPlane=function(e,t,i,r){defined(r)||(r=new Cartesian3);var n=Cartesian3.subtract(t,e,lineSegmentPlaneDifference),a=i.normal,o=Cartesian3.dot(a,n);if(!(Math.abs(o)<CesiumMath.EPSILON6)){var s=Cartesian3.dot(a,e),l=-(i.distance+s)/o;if(!(l<0||l>1))return Cartesian3.multiplyByScalar(n,l,r),Cartesian3.add(e,r,r),r}},IntersectionTests.trianglePlaneIntersection=function(e,t,i,r){var n,a,o=r.normal,s=r.distance,l=Cartesian3.dot(o,e)+s<0,c=Cartesian3.dot(o,t)+s<0,u=Cartesian3.dot(o,i)+s<0,d=0;if(d+=l?1:0,d+=c?1:0,1!==(d+=u?1:0)&&2!==d||(n=new Cartesian3,a=new Cartesian3),1===d){if(l)return IntersectionTests.lineSegmentPlane(e,t,r,n),IntersectionTests.lineSegmentPlane(e,i,r,a),{positions:[e,t,i,n,a],indices:[0,3,4,1,2,4,1,4,3]};if(c)return IntersectionTests.lineSegmentPlane(t,i,r,n),IntersectionTests.lineSegmentPlane(t,e,r,a),{positions:[e,t,i,n,a],indices:[1,3,4,2,0,4,2,4,3]};if(u)return IntersectionTests.lineSegmentPlane(i,e,r,n),IntersectionTests.lineSegmentPlane(i,t,r,a),{positions:[e,t,i,n,a],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===d){if(!l)return IntersectionTests.lineSegmentPlane(t,e,r,n),IntersectionTests.lineSegmentPlane(i,e,r,a),{positions:[e,t,i,n,a],indices:[1,2,4,1,4,3,0,3,4]};if(!c)return IntersectionTests.lineSegmentPlane(i,t,r,n),IntersectionTests.lineSegmentPlane(e,t,r,a),{positions:[e,t,i,n,a],indices:[2,0,4,2,4,3,1,3,4]};if(!u)return IntersectionTests.lineSegmentPlane(e,i,r,n),IntersectionTests.lineSegmentPlane(t,i,r,a),{positions:[e,t,i,n,a],indices:[0,1,4,0,4,3,2,3,4]}}},Plane.fromPointNormal=function(e,t,i){var r=-Cartesian3.dot(t,e);return defined(i)?(Cartesian3.clone(t,i.normal),i.distance=r,i):new Plane(t,r)};var scratchNormal$7=new Cartesian3;Plane.fromCartesian4=function(e,t){var i=Cartesian3.fromCartesian4(e,scratchNormal$7),r=e.w;return defined(t)?(Cartesian3.clone(i,t.normal),t.distance=r,t):new Plane(i,r)},Plane.getPointDistance=function(e,t){return Cartesian3.dot(e.normal,t)+e.distance};var scratchCartesian$8=new Cartesian3;Plane.projectPointOntoPlane=function(e,t,i){defined(i)||(i=new Cartesian3);var r=Plane.getPointDistance(e,t),n=Cartesian3.multiplyByScalar(e.normal,r,scratchCartesian$8);return Cartesian3.subtract(t,n,i)};var scratchInverseTranspose=new Matrix4,scratchPlaneCartesian4=new Cartesian4,scratchTransformNormal=new Cartesian3;function binarySearch(e,t,i){for(var r,n,a=0,o=e.length-1;a<=o;)if((n=i(e[r=~~((a+o)/2)],t))<0)a=r+1;else{if(!(n>0))return r;o=r-1}return~(o+1)}function EarthOrientationParametersSample(e,t,i,r,n){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=i,this.yPoleOffset=r,this.ut1MinusUtc=n}function GregorianDate(e,t,i,r,n,a,o,s){this.year=e,this.month=t,this.day=i,this.hour=r,this.minute=n,this.second=a,this.millisecond=o,this.isLeapSecond=s}function isLeapYear(e){return e%4==0&&e%100!=0||e%400==0}function LeapSecond(e,t){this.julianDate=e,this.offset=t}Plane.transform=function(e,t,i){var r=e.normal,n=e.distance,a=Matrix4.inverseTranspose(t,scratchInverseTranspose),o=Cartesian4.fromElements(r.x,r.y,r.z,n,scratchPlaneCartesian4);o=Matrix4.multiplyByVector(a,o,o);var s=Cartesian3.fromCartesian4(o,scratchTransformNormal);return o=Cartesian4.divideByScalar(o,Cartesian3.magnitude(s),o),Plane.fromCartesian4(o,i)},Plane.clone=function(e,t){return defined(t)?(Cartesian3.clone(e.normal,t.normal),t.distance=e.distance,t):new Plane(e.normal,e.distance)},Plane.equals=function(e,t){return e.distance===t.distance&&Cartesian3.equals(e.normal,t.normal)},Plane.ORIGIN_XY_PLANE=Object.freeze(new Plane(Cartesian3.UNIT_Z,0)),Plane.ORIGIN_YZ_PLANE=Object.freeze(new Plane(Cartesian3.UNIT_X,0)),Plane.ORIGIN_ZX_PLANE=Object.freeze(new Plane(Cartesian3.UNIT_Y,0));var TimeConstants={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5},TimeConstants$1=Object.freeze(TimeConstants),TimeStandard={UTC:0,TAI:1},TimeStandard$1=Object.freeze(TimeStandard),gregorianDateScratch=new GregorianDate,daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31],daysInLeapFeburary=29;function compareLeapSecondDates$1(e,t){return JulianDate.compare(e.julianDate,t.julianDate)}var binarySearchScratchLeapSecond=new LeapSecond;function convertUtcToTai(e){binarySearchScratchLeapSecond.julianDate=e;var t=JulianDate.leapSeconds,i=binarySearch(t,binarySearchScratchLeapSecond,compareLeapSecondDates$1);i<0&&(i=~i),i>=t.length&&(i=t.length-1);var r=t[i].offset;i>0&&(JulianDate.secondsDifference(t[i].julianDate,e)>r&&(r=t[--i].offset));JulianDate.addSeconds(e,r,e)}function convertTaiToUtc(e,t){binarySearchScratchLeapSecond.julianDate=e;var i=JulianDate.leapSeconds,r=binarySearch(i,binarySearchScratchLeapSecond,compareLeapSecondDates$1);if(r<0&&(r=~r),0===r)return JulianDate.addSeconds(e,-i[0].offset,t);if(r>=i.length)return JulianDate.addSeconds(e,-i[r-1].offset,t);var n=JulianDate.secondsDifference(i[r].julianDate,e);return 0===n?JulianDate.addSeconds(e,-i[r].offset,t):n<=1?void 0:JulianDate.addSeconds(e,-i[--r].offset,t)}function setComponents(e,t,i){var r=t/TimeConstants$1.SECONDS_PER_DAY|0;return e+=r,(t-=TimeConstants$1.SECONDS_PER_DAY*r)<0&&(e--,t+=TimeConstants$1.SECONDS_PER_DAY),i.dayNumber=e,i.secondsOfDay=t,i}function computeJulianDateComponents(e,t,i,r,n,a,o){var s=(t-14)/12|0,l=e+4800+s,c=(1461*l/4|0)+(367*(t-2-12*s)/12|0)-(3*((l+100)/100|0)/4|0)+i-32075;(r-=12)<0&&(r+=24);var u=a+(r*TimeConstants$1.SECONDS_PER_HOUR+n*TimeConstants$1.SECONDS_PER_MINUTE+o*TimeConstants$1.SECONDS_PER_MILLISECOND);return u>=43200&&(c-=1),[c,u]}var matchCalendarYear=/^(\d{4})$/,matchCalendarMonth=/^(\d{4})-(\d{2})$/,matchOrdinalDate=/^(\d{4})-?(\d{3})$/,matchWeekDate=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,matchCalendarDate=/^(\d{4})-?(\d{2})-?(\d{2})$/,utcOffset=/([Z+\-])?(\d{2})?:?(\d{2})?$/,matchHours=/^(\d{2})(\.\d+)?/.source+utcOffset.source,matchHoursMinutes=/^(\d{2}):?(\d{2})(\.\d+)?/.source+utcOffset.source,matchHoursMinutesSeconds=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+utcOffset.source;function JulianDate(e,t,i){this.dayNumber=void 0,this.secondsOfDay=void 0,e=defaultValue(e,0),t=defaultValue(t,0),i=defaultValue(i,TimeStandard$1.UTC);var r=0|e;setComponents(r,t+=(e-r)*TimeConstants$1.SECONDS_PER_DAY,this),i===TimeStandard$1.UTC&&convertUtcToTai(this)}JulianDate.fromGregorianDate=function(e,t){var i=computeJulianDateComponents(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return defined(t)?(setComponents(i[0],i[1],t),convertUtcToTai(t),t):new JulianDate(i[0],i[1],TimeStandard$1.UTC)},JulianDate.fromDate=function(e,t){var i=computeJulianDateComponents(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return defined(t)?(setComponents(i[0],i[1],t),convertUtcToTai(t),t):new JulianDate(i[0],i[1],TimeStandard$1.UTC)},JulianDate.fromIso8601=function(e,t){var i,r,n,a,o=(e=e.replace(",",".")).split("T"),s=1,l=1,c=0,u=0,d=0,h=0,p=o[0],f=o[1];if(null!==(o=p.match(matchCalendarDate)))i=+o[1],s=+o[2],l=+o[3];else if(null!==(o=p.match(matchCalendarMonth)))i=+o[1],s=+o[2];else if(null!==(o=p.match(matchCalendarYear)))i=+o[1];else{var m;if(null!==(o=p.match(matchOrdinalDate)))i=+o[1],m=+o[2],n=isLeapYear(i);else if(null!==(o=p.match(matchWeekDate)))i=+o[1],m=7*+o[2]+(+o[3]||0)-new Date(Date.UTC(i,0,4)).getUTCDay()-3;(r=new Date(Date.UTC(i,0,1))).setUTCDate(m),s=r.getUTCMonth()+1,l=r.getUTCDate()}if(n=isLeapYear(i),defined(f)){null!==(o=f.match(matchHoursMinutesSeconds))?(c=+o[1],u=+o[2],d=+o[3],h=1e3*+(o[4]||0),a=5):null!==(o=f.match(matchHoursMinutes))?(c=+o[1],u=+o[2],d=60*+(o[3]||0),a=4):null!==(o=f.match(matchHours))&&(c=+o[1],u=60*+(o[2]||0),a=3);var g=o[a],_=+o[a+1],y=+(o[a+2]||0);switch(g){case"+":c-=_,u-=y;break;case"-":c+=_,u+=y;break;case"Z":break;default:u+=new Date(Date.UTC(i,s-1,l,c,u)).getTimezoneOffset()}}var v=60===d;for(v&&d--;u>=60;)u-=60,c++;for(;c>=24;)c-=24,l++;for(r=n&&2===s?daysInLeapFeburary:daysInMonth[s-1];l>r;)l-=r,++s>12&&(s-=12,i++),r=n&&2===s?daysInLeapFeburary:daysInMonth[s-1];for(;u<0;)u+=60,c--;for(;c<0;)c+=24,l--;for(;l<1;)--s<1&&(s+=12,i--),l+=r=n&&2===s?daysInLeapFeburary:daysInMonth[s-1];var C=computeJulianDateComponents(i,s,l,c,u,d,h);return defined(t)?(setComponents(C[0],C[1],t),convertUtcToTai(t)):t=new JulianDate(C[0],C[1],TimeStandard$1.UTC),v&&JulianDate.addSeconds(t,1,t),t},JulianDate.now=function(e){return JulianDate.fromDate(new Date,e)};var toGregorianDateScratch=new JulianDate(0,0,TimeStandard$1.TAI);function EarthOrientationParameters(e){if(e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=defaultValue(e.addNewLeapSeconds,!0),defined(e.data))onDataReady(this,e.data);else if(defined(e.url)){var t=Resource.createIfNeeded(e.url),i=this;this._downloadPromise=t.fetchJson().then((function(e){onDataReady(i,e)})).otherwise((function(){i._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."}))}else onDataReady(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}function compareLeapSecondDates(e,t){return JulianDate.compare(e.julianDate,t)}function onDataReady(e,t){if(defined(t.columnNames))if(defined(t.samples)){var i=t.columnNames.indexOf("modifiedJulianDateUtc"),r=t.columnNames.indexOf("xPoleWanderRadians"),n=t.columnNames.indexOf("yPoleWanderRadians"),a=t.columnNames.indexOf("ut1MinusUtcSeconds"),o=t.columnNames.indexOf("xCelestialPoleOffsetRadians"),s=t.columnNames.indexOf("yCelestialPoleOffsetRadians"),l=t.columnNames.indexOf("taiMinusUtcSeconds");if(i<0||r<0||n<0||a<0||o<0||s<0||l<0)e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns";else{var c,u=e._samples=t.samples,d=e._dates=[];e._dateColumn=i,e._xPoleWanderRadiansColumn=r,e._yPoleWanderRadiansColumn=n,e._ut1MinusUtcSecondsColumn=a,e._xCelestialPoleOffsetRadiansColumn=o,e._yCelestialPoleOffsetRadiansColumn=s,e._taiMinusUtcSecondsColumn=l,e._columnCount=t.columnNames.length,e._lastIndex=void 0;for(var h=e._addNewLeapSeconds,p=0,f=u.length;p<f;p+=e._columnCount){var m=u[p+i],g=u[p+l],_=new JulianDate(m+TimeConstants$1.MODIFIED_JULIAN_DATE_DIFFERENCE,g,TimeStandard$1.TAI);if(d.push(_),h){if(g!==c&&defined(c)){var y=JulianDate.leapSeconds,v=binarySearch(y,_,compareLeapSecondDates);if(v<0){var C=new LeapSecond(_,g);y.splice(~v,0,C)}}c=g}}}}else e._dataError="Error in loaded EOP data: The samples property is required.";else e._dataError="Error in loaded EOP data: The columnNames property is required."}function fillResultFromIndex(e,t,i,r,n){var a=i*r;n.xPoleWander=t[a+e._xPoleWanderRadiansColumn],n.yPoleWander=t[a+e._yPoleWanderRadiansColumn],n.xPoleOffset=t[a+e._xCelestialPoleOffsetRadiansColumn],n.yPoleOffset=t[a+e._yCelestialPoleOffsetRadiansColumn],n.ut1MinusUtc=t[a+e._ut1MinusUtcSecondsColumn]}function linearInterp(e,t,i){return t+e*(i-t)}function interpolate(e,t,i,r,n,a,o){var s=e._columnCount;if(a>t.length-1)return o.xPoleWander=0,o.yPoleWander=0,o.xPoleOffset=0,o.yPoleOffset=0,o.ut1MinusUtc=0,o;var l=t[n],c=t[a];if(l.equals(c)||r.equals(l))return fillResultFromIndex(e,i,n,s,o),o;if(r.equals(c))return fillResultFromIndex(e,i,a,s,o),o;var u=JulianDate.secondsDifference(r,l)/JulianDate.secondsDifference(c,l),d=n*s,h=a*s,p=i[d+e._ut1MinusUtcSecondsColumn],f=i[h+e._ut1MinusUtcSecondsColumn],m=f-p;if(m>.5||m<-.5){var g=i[d+e._taiMinusUtcSecondsColumn],_=i[h+e._taiMinusUtcSecondsColumn];g!==_&&(c.equals(r)?p=f:f-=_-g)}return o.xPoleWander=linearInterp(u,i[d+e._xPoleWanderRadiansColumn],i[h+e._xPoleWanderRadiansColumn]),o.yPoleWander=linearInterp(u,i[d+e._yPoleWanderRadiansColumn],i[h+e._yPoleWanderRadiansColumn]),o.xPoleOffset=linearInterp(u,i[d+e._xCelestialPoleOffsetRadiansColumn],i[h+e._xCelestialPoleOffsetRadiansColumn]),o.yPoleOffset=linearInterp(u,i[d+e._yCelestialPoleOffsetRadiansColumn],i[h+e._yCelestialPoleOffsetRadiansColumn]),o.ut1MinusUtc=linearInterp(u,p,f),o}function HeadingPitchRoll(e,t,i){this.heading=defaultValue(e,0),this.pitch=defaultValue(t,0),this.roll=defaultValue(i,0)}function Iau2006XysSample(e,t,i){this.x=e,this.y=t,this.s=i}function Iau2006XysData(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._xysFileUrlTemplate=Resource.createIfNeeded(e.xysFileUrlTemplate),this._interpolationOrder=defaultValue(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=defaultValue(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new JulianDate(this._sampleZeroJulianEphemerisDate,0,TimeStandard$1.TAI),this._stepSizeDays=defaultValue(e.stepSizeDays,1),this._samplesPerXysFile=defaultValue(e.samplesPerXysFile,1e3),this._totalSamples=defaultValue(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,i=this._denominators=new Array(t+1),r=this._xTable=new Array(t+1),n=Math.pow(this._stepSizeDays,t),a=0;a<=t;++a){i[a]=n,r[a]=a*this._stepSizeDays;for(var o=0;o<=t;++o)o!==a&&(i[a]*=a-o);i[a]=1/i[a]}this._work=new Array(t+1),this._coef=new Array(t+1)}JulianDate.toGregorianDate=function(e,t){var i=!1,r=convertTaiToUtc(e,toGregorianDateScratch);defined(r)||(JulianDate.addSeconds(e,-1,toGregorianDateScratch),r=convertTaiToUtc(toGregorianDateScratch,toGregorianDateScratch),i=!0);var n=r.dayNumber,a=r.secondsOfDay;a>=43200&&(n+=1);var o=n+68569|0,s=4*o/146097|0,l=4e3*((o=o-((146097*s+3)/4|0)|0)+1)/1461001|0,c=80*(o=o-(1461*l/4|0)+31|0)/2447|0,u=o-(2447*c/80|0)|0,d=c+2-12*(o=c/11|0)|0,h=100*(s-49)+l+o|0,p=a/TimeConstants$1.SECONDS_PER_HOUR|0,f=a-p*TimeConstants$1.SECONDS_PER_HOUR,m=f/TimeConstants$1.SECONDS_PER_MINUTE|0,g=0|(f-=m*TimeConstants$1.SECONDS_PER_MINUTE),_=(f-g)/TimeConstants$1.SECONDS_PER_MILLISECOND;return(p+=12)>23&&(p-=24),i&&(g+=1),defined(t)?(t.year=h,t.month=d,t.day=u,t.hour=p,t.minute=m,t.second=g,t.millisecond=_,t.isLeapSecond=i,t):new GregorianDate(h,d,u,p,m,g,_,i)},JulianDate.toDate=function(e){var t=JulianDate.toGregorianDate(e,gregorianDateScratch),i=t.second;return t.isLeapSecond&&(i-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,i,t.millisecond))},JulianDate.toIso8601=function(e,t){var i,r=JulianDate.toGregorianDate(e,gregorianDateScratch),n=r.year,a=r.month,o=r.day,s=r.hour,l=r.minute,c=r.second,u=r.millisecond;return 1e4===n&&1===a&&1===o&&0===s&&0===l&&0===c&&0===u&&(n=9999,a=12,o=31,s=24),defined(t)||0===u?defined(t)&&0!==t?(i=(.01*u).toFixed(t).replace(".","").slice(0,t),n.toString().padStart(4,"0")+"-"+a.toString().padStart(2,"0")+"-"+o.toString().padStart(2,"0")+"T"+s.toString().padStart(2,"0")+":"+l.toString().padStart(2,"0")+":"+c.toString().padStart(2,"0")+"."+i+"Z"):n.toString().padStart(4,"0")+"-"+a.toString().padStart(2,"0")+"-"+o.toString().padStart(2,"0")+"T"+s.toString().padStart(2,"0")+":"+l.toString().padStart(2,"0")+":"+c.toString().padStart(2,"0")+"Z":(i=(.01*u).toString().replace(".",""),n.toString().padStart(4,"0")+"-"+a.toString().padStart(2,"0")+"-"+o.toString().padStart(2,"0")+"T"+s.toString().padStart(2,"0")+":"+l.toString().padStart(2,"0")+":"+c.toString().padStart(2,"0")+"."+i+"Z")},JulianDate.clone=function(e,t){if(defined(e))return defined(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new JulianDate(e.dayNumber,e.secondsOfDay,TimeStandard$1.TAI)},JulianDate.compare=function(e,t){var i=e.dayNumber-t.dayNumber;return 0!==i?i:e.secondsOfDay-t.secondsOfDay},JulianDate.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},JulianDate.equalsEpsilon=function(e,t,i){return i=defaultValue(i,0),e===t||defined(e)&&defined(t)&&Math.abs(JulianDate.secondsDifference(e,t))<=i},JulianDate.totalDays=function(e){return e.dayNumber+e.secondsOfDay/TimeConstants$1.SECONDS_PER_DAY},JulianDate.secondsDifference=function(e,t){return(e.dayNumber-t.dayNumber)*TimeConstants$1.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)},JulianDate.daysDifference=function(e,t){return e.dayNumber-t.dayNumber+(e.secondsOfDay-t.secondsOfDay)/TimeConstants$1.SECONDS_PER_DAY},JulianDate.computeTaiMinusUtc=function(e){binarySearchScratchLeapSecond.julianDate=e;var t=JulianDate.leapSeconds,i=binarySearch(t,binarySearchScratchLeapSecond,compareLeapSecondDates$1);return i<0&&(i=~i,--i<0&&(i=0)),t[i].offset},JulianDate.addSeconds=function(e,t,i){return setComponents(e.dayNumber,e.secondsOfDay+t,i)},JulianDate.addMinutes=function(e,t,i){var r=e.secondsOfDay+t*TimeConstants$1.SECONDS_PER_MINUTE;return setComponents(e.dayNumber,r,i)},JulianDate.addHours=function(e,t,i){var r=e.secondsOfDay+t*TimeConstants$1.SECONDS_PER_HOUR;return setComponents(e.dayNumber,r,i)},JulianDate.addDays=function(e,t,i){return setComponents(e.dayNumber+t,e.secondsOfDay,i)},JulianDate.lessThan=function(e,t){return JulianDate.compare(e,t)<0},JulianDate.lessThanOrEquals=function(e,t){return JulianDate.compare(e,t)<=0},JulianDate.greaterThan=function(e,t){return JulianDate.compare(e,t)>0},JulianDate.greaterThanOrEquals=function(e,t){return JulianDate.compare(e,t)>=0},JulianDate.prototype.clone=function(e){return JulianDate.clone(this,e)},JulianDate.prototype.equals=function(e){return JulianDate.equals(this,e)},JulianDate.prototype.equalsEpsilon=function(e,t){return JulianDate.equalsEpsilon(this,e,t)},JulianDate.prototype.toString=function(){return JulianDate.toIso8601(this)},JulianDate.leapSeconds=[new LeapSecond(new JulianDate(2441317,43210,TimeStandard$1.TAI),10),new LeapSecond(new JulianDate(2441499,43211,TimeStandard$1.TAI),11),new LeapSecond(new JulianDate(2441683,43212,TimeStandard$1.TAI),12),new LeapSecond(new JulianDate(2442048,43213,TimeStandard$1.TAI),13),new LeapSecond(new JulianDate(2442413,43214,TimeStandard$1.TAI),14),new LeapSecond(new JulianDate(2442778,43215,TimeStandard$1.TAI),15),new LeapSecond(new JulianDate(2443144,43216,TimeStandard$1.TAI),16),new LeapSecond(new JulianDate(2443509,43217,TimeStandard$1.TAI),17),new LeapSecond(new JulianDate(2443874,43218,TimeStandard$1.TAI),18),new LeapSecond(new JulianDate(2444239,43219,TimeStandard$1.TAI),19),new LeapSecond(new JulianDate(2444786,43220,TimeStandard$1.TAI),20),new LeapSecond(new JulianDate(2445151,43221,TimeStandard$1.TAI),21),new LeapSecond(new JulianDate(2445516,43222,TimeStandard$1.TAI),22),new LeapSecond(new JulianDate(2446247,43223,TimeStandard$1.TAI),23),new LeapSecond(new JulianDate(2447161,43224,TimeStandard$1.TAI),24),new LeapSecond(new JulianDate(2447892,43225,TimeStandard$1.TAI),25),new LeapSecond(new JulianDate(2448257,43226,TimeStandard$1.TAI),26),new LeapSecond(new JulianDate(2448804,43227,TimeStandard$1.TAI),27),new LeapSecond(new JulianDate(2449169,43228,TimeStandard$1.TAI),28),new LeapSecond(new JulianDate(2449534,43229,TimeStandard$1.TAI),29),new LeapSecond(new JulianDate(2450083,43230,TimeStandard$1.TAI),30),new LeapSecond(new JulianDate(2450630,43231,TimeStandard$1.TAI),31),new LeapSecond(new JulianDate(2451179,43232,TimeStandard$1.TAI),32),new LeapSecond(new JulianDate(2453736,43233,TimeStandard$1.TAI),33),new LeapSecond(new JulianDate(2454832,43234,TimeStandard$1.TAI),34),new LeapSecond(new JulianDate(2456109,43235,TimeStandard$1.TAI),35),new LeapSecond(new JulianDate(2457204,43236,TimeStandard$1.TAI),36),new LeapSecond(new JulianDate(2457754,43237,TimeStandard$1.TAI),37)],EarthOrientationParameters.NONE=Object.freeze({getPromiseToLoad:function(){return when.resolve()},compute:function(e,t){return defined(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new EarthOrientationParametersSample(0,0,0,0,0),t}}),EarthOrientationParameters.prototype.getPromiseToLoad=function(){return when(this._downloadPromise)},EarthOrientationParameters.prototype.compute=function(e,t){if(defined(this._samples)){if(defined(t)||(t=new EarthOrientationParametersSample(0,0,0,0,0)),0===this._samples.length)return t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0,t;var i=this._dates,r=this._lastIndex,n=0,a=0;if(defined(r)){var o=i[r],s=i[r+1],l=JulianDate.lessThanOrEquals(o,e),c=!defined(s),u=c||JulianDate.greaterThanOrEquals(s,e);if(l&&u)return n=r,!c&&s.equals(e)&&++n,a=n+1,interpolate(this,i,this._samples,e,n,a,t),t}var d=binarySearch(i,e,JulianDate.compare,this._dateColumn);return d>=0?(d<i.length-1&&i[d+1].equals(e)&&++d,n=d,a=d):(n=(a=~d)-1)<0&&(n=0),this._lastIndex=n,interpolate(this,i,this._samples,e,n,a,t),t}if(defined(this._dataError))throw new RuntimeError(this._dataError)},HeadingPitchRoll.fromQuaternion=function(e,t){defined(t)||(t=new HeadingPitchRoll);var i=2*(e.w*e.y-e.z*e.x),r=1-2*(e.x*e.x+e.y*e.y),n=2*(e.w*e.x+e.y*e.z),a=1-2*(e.y*e.y+e.z*e.z),o=2*(e.w*e.z+e.x*e.y);return t.heading=-Math.atan2(o,a),t.roll=Math.atan2(n,r),t.pitch=-CesiumMath.asinClamped(i),t},HeadingPitchRoll.fromDegrees=function(e,t,i,r){return defined(r)||(r=new HeadingPitchRoll),r.heading=e*CesiumMath.RADIANS_PER_DEGREE,r.pitch=t*CesiumMath.RADIANS_PER_DEGREE,r.roll=i*CesiumMath.RADIANS_PER_DEGREE,r},HeadingPitchRoll.clone=function(e,t){if(defined(e))return defined(t)?(t.heading=e.heading,t.pitch=e.pitch,t.roll=e.roll,t):new HeadingPitchRoll(e.heading,e.pitch,e.roll)},HeadingPitchRoll.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.heading===t.heading&&e.pitch===t.pitch&&e.roll===t.roll},HeadingPitchRoll.equalsEpsilon=function(e,t,i,r){return e===t||defined(e)&&defined(t)&&CesiumMath.equalsEpsilon(e.heading,t.heading,i,r)&&CesiumMath.equalsEpsilon(e.pitch,t.pitch,i,r)&&CesiumMath.equalsEpsilon(e.roll,t.roll,i,r)},HeadingPitchRoll.prototype.clone=function(e){return HeadingPitchRoll.clone(this,e)},HeadingPitchRoll.prototype.equals=function(e){return HeadingPitchRoll.equals(this,e)},HeadingPitchRoll.prototype.equalsEpsilon=function(e,t,i){return HeadingPitchRoll.equalsEpsilon(this,e,t,i)},HeadingPitchRoll.prototype.toString=function(){return"("+this.heading+", "+this.pitch+", "+this.roll+")"};var julianDateScratch$1=new JulianDate(0,0,TimeStandard$1.TAI),_supportsFullscreen;function getDaysSinceEpoch(e,t,i){var r=julianDateScratch$1;return r.dayNumber=t,r.secondsOfDay=i,JulianDate.daysDifference(r,e._sampleZeroDateTT)}function requestXysChunk(e,t){if(e._chunkDownloadsInProgress[t])return e._chunkDownloadsInProgress[t];var i,r=when.defer();e._chunkDownloadsInProgress[t]=r;var n=e._xysFileUrlTemplate;return i=defined(n)?n.getDerivedResource({templateValues:{0:t}}):new Resource({url:buildModuleUrl("Assets/IAU2006_XYS/IAU2006_XYS_"+t+".json")}),when(i.fetchJson(),(function(i){e._chunkDownloadsInProgress[t]=!1;for(var n=e._samples,a=i.samples,o=t*e._samplesPerXysFile*3,s=0,l=a.length;s<l;++s)n[o+s]=a[s];r.resolve()})),r.promise}Iau2006XysData.prototype.preload=function(e,t,i,r){var n=getDaysSinceEpoch(this,e,t),a=getDaysSinceEpoch(this,i,r),o=n/this._stepSizeDays-this._interpolationOrder/2|0;o<0&&(o=0);var s=a/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;s>=this._totalSamples&&(s=this._totalSamples-1);for(var l=o/this._samplesPerXysFile|0,c=s/this._samplesPerXysFile|0,u=[],d=l;d<=c;++d)u.push(requestXysChunk(this,d));return when.all(u)},Iau2006XysData.prototype.computeXysRadians=function(e,t,i){var r=getDaysSinceEpoch(this,e,t);if(!(r<0)){var n=r/this._stepSizeDays|0;if(!(n>=this._totalSamples)){var a=this._interpolationOrder,o=n-(a/2|0);o<0&&(o=0);var s=o+a;s>=this._totalSamples&&(o=(s=this._totalSamples-1)-a)<0&&(o=0);var l=!1,c=this._samples;if(defined(c[3*o])||(requestXysChunk(this,o/this._samplesPerXysFile|0),l=!0),defined(c[3*s])||(requestXysChunk(this,s/this._samplesPerXysFile|0),l=!0),!l){defined(i)?(i.x=0,i.y=0,i.s=0):i=new Iau2006XysSample(0,0,0);var u,d,h=r-o*this._stepSizeDays,p=this._work,f=this._denominators,m=this._coef,g=this._xTable;for(u=0;u<=a;++u)p[u]=h-g[u];for(u=0;u<=a;++u){for(m[u]=1,d=0;d<=a;++d)d!==u&&(m[u]*=p[d]);m[u]*=f[u];var _=3*(o+u);i.x+=m[u]*c[_++],i.y+=m[u]*c[_++],i.s+=m[u]*c[_]}return i}}}};var _names={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},Fullscreen={},theNavigator,isChromeResult,chromeVersionResult,isSafariResult,safariVersionResult,isWebkitResult,webkitVersionResult,isInternetExplorerResult,internetExplorerVersionResult,isEdgeResult,edgeVersionResult,isFirefoxResult,firefoxVersionResult,isWindowsResult,hasPointerEvents,imageRenderingValueResult,supportsImageRenderingPixelatedResult;function extractVersion(e){for(var t=e.split("."),i=0,r=t.length;i<r;++i)t[i]=parseInt(t[i],10);return t}function isChrome(){if(!defined(isChromeResult)&&(isChromeResult=!1,!isEdge())){var e=/ Chrome\/([\.0-9]+)/.exec(theNavigator.userAgent);null!==e&&(isChromeResult=!0,chromeVersionResult=extractVersion(e[1]))}return isChromeResult}function chromeVersion(){return isChrome()&&chromeVersionResult}function isSafari(){if(!defined(isSafariResult)&&(isSafariResult=!1,!isChrome()&&!isEdge()&&/ Safari\/[\.0-9]+/.test(theNavigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(theNavigator.userAgent);null!==e&&(isSafariResult=!0,safariVersionResult=extractVersion(e[1]))}return isSafariResult}function safariVersion(){return isSafari()&&safariVersionResult}function isWebkit(){if(!defined(isWebkitResult)){isWebkitResult=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(theNavigator.userAgent);null!==e&&(isWebkitResult=!0,(webkitVersionResult=extractVersion(e[1])).isNightly=!!e[2])}return isWebkitResult}function webkitVersion(){return isWebkit()&&webkitVersionResult}function isInternetExplorer(){var e;defined(isInternetExplorerResult)||(isInternetExplorerResult=!1,"Microsoft Internet Explorer"===theNavigator.appName?null!==(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(theNavigator.userAgent))&&(isInternetExplorerResult=!0,internetExplorerVersionResult=extractVersion(e[1])):"Netscape"===theNavigator.appName&&null!==(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(theNavigator.userAgent))&&(isInternetExplorerResult=!0,internetExplorerVersionResult=extractVersion(e[1])));return isInternetExplorerResult}function internetExplorerVersion(){return isInternetExplorer()&&internetExplorerVersionResult}function isEdge(){if(!defined(isEdgeResult)){isEdgeResult=!1;var e=/ Edge\/([\.0-9]+)/.exec(theNavigator.userAgent);null!==e&&(isEdgeResult=!0,edgeVersionResult=extractVersion(e[1]))}return isEdgeResult}function edgeVersion(){return isEdge()&&edgeVersionResult}function isFirefox(){if(!defined(isFirefoxResult)){isFirefoxResult=!1;var e=/Firefox\/([\.0-9]+)/.exec(theNavigator.userAgent);null!==e&&(isFirefoxResult=!0,firefoxVersionResult=extractVersion(e[1]))}return isFirefoxResult}function isWindows(){return defined(isWindowsResult)||(isWindowsResult=/Windows/i.test(theNavigator.appVersion)),isWindowsResult}function firefoxVersion(){return isFirefox()&&firefoxVersionResult}function supportsPointerEvents(){return defined(hasPointerEvents)||(hasPointerEvents=!isFirefox()&&"undefined"!=typeof PointerEvent&&(!defined(theNavigator.pointerEnabled)||theNavigator.pointerEnabled)),hasPointerEvents}function supportsImageRenderingPixelated(){if(!defined(supportsImageRenderingPixelatedResult)){var e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");var t=e.style.imageRendering;(supportsImageRenderingPixelatedResult=defined(t)&&""!==t)&&(imageRenderingValueResult=t)}return supportsImageRenderingPixelatedResult}function imageRenderingValue(){return supportsImageRenderingPixelated()?imageRenderingValueResult:void 0}function supportsWebP(){return supportsWebP._result}Object.defineProperties(Fullscreen,{element:{get:function(){if(Fullscreen.supportsFullscreen())return document[_names.fullscreenElement]}},changeEventName:{get:function(){if(Fullscreen.supportsFullscreen())return _names.fullscreenchange}},errorEventName:{get:function(){if(Fullscreen.supportsFullscreen())return _names.fullscreenerror}},enabled:{get:function(){if(Fullscreen.supportsFullscreen())return document[_names.fullscreenEnabled]}},fullscreen:{get:function(){if(Fullscreen.supportsFullscreen())return null!==Fullscreen.element}}}),Fullscreen.supportsFullscreen=function(){if(defined(_supportsFullscreen))return _supportsFullscreen;_supportsFullscreen=!1;var e=document.body;if("function"==typeof e.requestFullscreen)return _names.requestFullscreen="requestFullscreen",_names.exitFullscreen="exitFullscreen",_names.fullscreenEnabled="fullscreenEnabled",_names.fullscreenElement="fullscreenElement",_names.fullscreenchange="fullscreenchange",_names.fullscreenerror="fullscreenerror",_supportsFullscreen=!0;for(var t,i=["webkit","moz","o","ms","khtml"],r=0,n=i.length;r<n;++r){var a=i[r];("function"==typeof e[t=a+"RequestFullscreen"]||"function"==typeof e[t=a+"RequestFullScreen"])&&(_names.requestFullscreen=t,_supportsFullscreen=!0),t=a+"ExitFullscreen","function"==typeof document[t]?_names.exitFullscreen=t:(t=a+"CancelFullScreen","function"==typeof document[t]&&(_names.exitFullscreen=t)),t=a+"FullscreenEnabled",void 0!==document[t]?_names.fullscreenEnabled=t:(t=a+"FullScreenEnabled",void 0!==document[t]&&(_names.fullscreenEnabled=t)),t=a+"FullscreenElement",void 0!==document[t]?_names.fullscreenElement=t:(t=a+"FullScreenElement",void 0!==document[t]&&(_names.fullscreenElement=t)),t=a+"fullscreenchange",void 0!==document["on"+t]&&("ms"===a&&(t="MSFullscreenChange"),_names.fullscreenchange=t),t=a+"fullscreenerror",void 0!==document["on"+t]&&("ms"===a&&(t="MSFullscreenError"),_names.fullscreenerror=t)}return _supportsFullscreen},Fullscreen.requestFullscreen=function(e,t){Fullscreen.supportsFullscreen()&&e[_names.requestFullscreen]({vrDisplay:t})},Fullscreen.exitFullscreen=function(){Fullscreen.supportsFullscreen()&&document[_names.exitFullscreen]()},Fullscreen._names=_names,theNavigator="undefined"!=typeof navigator?navigator:{},supportsWebP._promise=void 0,supportsWebP._result=void 0,supportsWebP.initialize=function(){if(defined(supportsWebP._promise))return supportsWebP._promise;var e=when.defer();if(supportsWebP._promise=e.promise,isEdge())return supportsWebP._result=!1,e.resolve(supportsWebP._result),e.promise;var t=new Image;return t.onload=function(){supportsWebP._result=t.width>0&&t.height>0,e.resolve(supportsWebP._result)},t.onerror=function(){supportsWebP._result=!1,e.resolve(supportsWebP._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.promise},Object.defineProperties(supportsWebP,{initialized:{get:function(){return defined(supportsWebP._result)}}});var typedArrayTypes=[];"undefined"!=typeof ArrayBuffer&&(typedArrayTypes.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),"undefined"!=typeof Uint8ClampedArray&&typedArrayTypes.push(Uint8ClampedArray),"undefined"!=typeof Uint8ClampedArray&&typedArrayTypes.push(Uint8ClampedArray),"undefined"!=typeof BigInt64Array&&typedArrayTypes.push(BigInt64Array),"undefined"!=typeof BigUint64Array&&typedArrayTypes.push(BigUint64Array));var FeatureDetection={isChrome:isChrome,chromeVersion:chromeVersion,isSafari:isSafari,safariVersion:safariVersion,isWebkit:isWebkit,webkitVersion:webkitVersion,isInternetExplorer:isInternetExplorer,internetExplorerVersion:internetExplorerVersion,isEdge:isEdge,edgeVersion:edgeVersion,isFirefox:isFirefox,firefoxVersion:firefoxVersion,isWindows:isWindows,hardwareConcurrency:defaultValue(theNavigator.hardwareConcurrency,3),supportsPointerEvents:supportsPointerEvents,supportsImageRenderingPixelated:supportsImageRenderingPixelated,supportsWebP:supportsWebP,imageRenderingValue:imageRenderingValue,typedArrayTypes:typedArrayTypes};function Quaternion(e,t,i,r){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.z=defaultValue(i,0),this.w=defaultValue(r,0)}FeatureDetection.supportsBasis=function(e){return FeatureDetection.supportsWebAssembly()&&e.context.supportsBasis},FeatureDetection.supportsFullscreen=function(){return Fullscreen.supportsFullscreen()},FeatureDetection.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},FeatureDetection.supportsBigInt64Array=function(){return"undefined"!=typeof BigInt64Array},FeatureDetection.supportsBigUint64Array=function(){return"undefined"!=typeof BigUint64Array},FeatureDetection.supportsBigInt=function(){return"undefined"!=typeof BigInt},FeatureDetection.supportsWebWorkers=function(){return"undefined"!=typeof Worker},FeatureDetection.supportsWebAssembly=function(){return"undefined"!=typeof WebAssembly&&!FeatureDetection.isEdge()};var fromAxisAngleScratch=new Cartesian3;Quaternion.fromAxisAngle=function(e,t,i){var r=t/2,n=Math.sin(r),a=(fromAxisAngleScratch=Cartesian3.normalize(e,fromAxisAngleScratch)).x*n,o=fromAxisAngleScratch.y*n,s=fromAxisAngleScratch.z*n,l=Math.cos(r);return defined(i)?(i.x=a,i.y=o,i.z=s,i.w=l,i):new Quaternion(a,o,s,l)};var fromRotationMatrixNext=[1,2,0],fromRotationMatrixQuat=new Array(3);Quaternion.fromRotationMatrix=function(e,t){var i,r,n,a,o,s=e[Matrix3.COLUMN0ROW0],l=e[Matrix3.COLUMN1ROW1],c=e[Matrix3.COLUMN2ROW2],u=s+l+c;if(u>0)o=.5*(i=Math.sqrt(u+1)),i=.5/i,r=(e[Matrix3.COLUMN1ROW2]-e[Matrix3.COLUMN2ROW1])*i,n=(e[Matrix3.COLUMN2ROW0]-e[Matrix3.COLUMN0ROW2])*i,a=(e[Matrix3.COLUMN0ROW1]-e[Matrix3.COLUMN1ROW0])*i;else{var d=fromRotationMatrixNext,h=0;l>s&&(h=1),c>s&&c>l&&(h=2);var p=d[h],f=d[p];i=Math.sqrt(e[Matrix3.getElementIndex(h,h)]-e[Matrix3.getElementIndex(p,p)]-e[Matrix3.getElementIndex(f,f)]+1);var m=fromRotationMatrixQuat;m[h]=.5*i,i=.5/i,o=(e[Matrix3.getElementIndex(f,p)]-e[Matrix3.getElementIndex(p,f)])*i,m[p]=(e[Matrix3.getElementIndex(p,h)]+e[Matrix3.getElementIndex(h,p)])*i,m[f]=(e[Matrix3.getElementIndex(f,h)]+e[Matrix3.getElementIndex(h,f)])*i,r=-m[0],n=-m[1],a=-m[2]}return defined(t)?(t.x=r,t.y=n,t.z=a,t.w=o,t):new Quaternion(r,n,a,o)};var scratchHPRQuaternion$1=new Quaternion,scratchHeadingQuaternion=new Quaternion,scratchPitchQuaternion=new Quaternion,scratchRollQuaternion=new Quaternion;Quaternion.fromHeadingPitchRoll=function(e,t){return scratchRollQuaternion=Quaternion.fromAxisAngle(Cartesian3.UNIT_X,e.roll,scratchHPRQuaternion$1),scratchPitchQuaternion=Quaternion.fromAxisAngle(Cartesian3.UNIT_Y,-e.pitch,t),t=Quaternion.multiply(scratchPitchQuaternion,scratchRollQuaternion,scratchPitchQuaternion),scratchHeadingQuaternion=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,-e.heading,scratchHPRQuaternion$1),Quaternion.multiply(scratchHeadingQuaternion,t,t)};var sampledQuaternionAxis=new Cartesian3,sampledQuaternionRotation=new Cartesian3,sampledQuaternionTempQuaternion=new Quaternion,sampledQuaternionQuaternion0=new Quaternion,sampledQuaternionQuaternion0Conjugate=new Quaternion;Quaternion.packedLength=4,Quaternion.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.x,t[i++]=e.y,t[i++]=e.z,t[i]=e.w,t},Quaternion.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Quaternion),i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3],i},Quaternion.packedInterpolationLength=3,Quaternion.convertPackedArrayForInterpolation=function(e,t,i,r){Quaternion.unpack(e,4*i,sampledQuaternionQuaternion0Conjugate),Quaternion.conjugate(sampledQuaternionQuaternion0Conjugate,sampledQuaternionQuaternion0Conjugate);for(var n=0,a=i-t+1;n<a;n++){var o=3*n;Quaternion.unpack(e,4*(t+n),sampledQuaternionTempQuaternion),Quaternion.multiply(sampledQuaternionTempQuaternion,sampledQuaternionQuaternion0Conjugate,sampledQuaternionTempQuaternion),sampledQuaternionTempQuaternion.w<0&&Quaternion.negate(sampledQuaternionTempQuaternion,sampledQuaternionTempQuaternion),Quaternion.computeAxis(sampledQuaternionTempQuaternion,sampledQuaternionAxis);var s=Quaternion.computeAngle(sampledQuaternionTempQuaternion);defined(r)||(r=[]),r[o]=sampledQuaternionAxis.x*s,r[o+1]=sampledQuaternionAxis.y*s,r[o+2]=sampledQuaternionAxis.z*s}},Quaternion.unpackInterpolationResult=function(e,t,i,r,n){defined(n)||(n=new Quaternion),Cartesian3.fromArray(e,0,sampledQuaternionRotation);var a=Cartesian3.magnitude(sampledQuaternionRotation);return Quaternion.unpack(t,4*r,sampledQuaternionQuaternion0),0===a?Quaternion.clone(Quaternion.IDENTITY,sampledQuaternionTempQuaternion):Quaternion.fromAxisAngle(sampledQuaternionRotation,a,sampledQuaternionTempQuaternion),Quaternion.multiply(sampledQuaternionTempQuaternion,sampledQuaternionQuaternion0,n)},Quaternion.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new Quaternion(e.x,e.y,e.z,e.w)},Quaternion.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},Quaternion.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},Quaternion.magnitude=function(e){return Math.sqrt(Quaternion.magnitudeSquared(e))},Quaternion.normalize=function(e,t){var i=1/Quaternion.magnitude(e),r=e.x*i,n=e.y*i,a=e.z*i,o=e.w*i;return t.x=r,t.y=n,t.z=a,t.w=o,t},Quaternion.inverse=function(e,t){var i=Quaternion.magnitudeSquared(e);return t=Quaternion.conjugate(e,t),Quaternion.multiplyByScalar(t,1/i,t)},Quaternion.add=function(e,t,i){return i.x=e.x+t.x,i.y=e.y+t.y,i.z=e.z+t.z,i.w=e.w+t.w,i},Quaternion.subtract=function(e,t,i){return i.x=e.x-t.x,i.y=e.y-t.y,i.z=e.z-t.z,i.w=e.w-t.w,i},Quaternion.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},Quaternion.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},Quaternion.multiply=function(e,t,i){var r=e.x,n=e.y,a=e.z,o=e.w,s=t.x,l=t.y,c=t.z,u=t.w,d=o*s+r*u+n*c-a*l,h=o*l-r*c+n*u+a*s,p=o*c+r*l-n*s+a*u,f=o*u-r*s-n*l-a*c;return i.x=d,i.y=h,i.z=p,i.w=f,i},Quaternion.multiplyByScalar=function(e,t,i){return i.x=e.x*t,i.y=e.y*t,i.z=e.z*t,i.w=e.w*t,i},Quaternion.divideByScalar=function(e,t,i){return i.x=e.x/t,i.y=e.y/t,i.z=e.z/t,i.w=e.w/t,i},Quaternion.computeAxis=function(e,t){var i=e.w;if(Math.abs(i-1)<CesiumMath.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-i*i);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},Quaternion.computeAngle=function(e){return Math.abs(e.w-1)<CesiumMath.EPSILON6?0:2*Math.acos(e.w)};var lerpScratch=new Quaternion;Quaternion.lerp=function(e,t,i,r){return lerpScratch=Quaternion.multiplyByScalar(t,i,lerpScratch),r=Quaternion.multiplyByScalar(e,1-i,r),Quaternion.add(lerpScratch,r,r)};var slerpEndNegated=new Quaternion,slerpScaledP=new Quaternion,slerpScaledR=new Quaternion;Quaternion.slerp=function(e,t,i,r){var n=Quaternion.dot(e,t),a=t;if(n<0&&(n=-n,a=slerpEndNegated=Quaternion.negate(t,slerpEndNegated)),1-n<CesiumMath.EPSILON6)return Quaternion.lerp(e,a,i,r);var o=Math.acos(n);return slerpScaledP=Quaternion.multiplyByScalar(e,Math.sin((1-i)*o),slerpScaledP),slerpScaledR=Quaternion.multiplyByScalar(a,Math.sin(i*o),slerpScaledR),r=Quaternion.add(slerpScaledP,slerpScaledR,r),Quaternion.multiplyByScalar(r,1/Math.sin(o),r)},Quaternion.log=function(e,t){var i=CesiumMath.acosClamped(e.w),r=0;return 0!==i&&(r=i/Math.sin(i)),Cartesian3.multiplyByScalar(e,r,t)},Quaternion.exp=function(e,t){var i=Cartesian3.magnitude(e),r=0;return 0!==i&&(r=Math.sin(i)/i),t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t.w=Math.cos(i),t};var squadScratchCartesian0=new Cartesian3,squadScratchCartesian1=new Cartesian3,squadScratchQuaternion0=new Quaternion,squadScratchQuaternion1=new Quaternion;Quaternion.computeInnerQuadrangle=function(e,t,i,r){var n=Quaternion.conjugate(t,squadScratchQuaternion0);Quaternion.multiply(n,i,squadScratchQuaternion1);var a=Quaternion.log(squadScratchQuaternion1,squadScratchCartesian0);Quaternion.multiply(n,e,squadScratchQuaternion1);var o=Quaternion.log(squadScratchQuaternion1,squadScratchCartesian1);return Cartesian3.add(a,o,a),Cartesian3.multiplyByScalar(a,.25,a),Cartesian3.negate(a,a),Quaternion.exp(a,squadScratchQuaternion0),Quaternion.multiply(t,squadScratchQuaternion0,r)},Quaternion.squad=function(e,t,i,r,n,a){var o=Quaternion.slerp(e,t,n,squadScratchQuaternion0),s=Quaternion.slerp(i,r,n,squadScratchQuaternion1);return Quaternion.slerp(o,s,2*n*(1-n),a)};for(var fastSlerpScratchQuaternion=new Quaternion,opmu=1.9011074535173003,u=FeatureDetection.supportsTypedArrays()?new Float32Array(8):[],v=FeatureDetection.supportsTypedArrays()?new Float32Array(8):[],bT=FeatureDetection.supportsTypedArrays()?new Float32Array(8):[],bD=FeatureDetection.supportsTypedArrays()?new Float32Array(8):[],i$7=0;i$7<7;++i$7){var s$1=i$7+1,t=2*s$1+1;u[i$7]=1/(s$1*t),v[i$7]=s$1/t}u[7]=opmu/136,v[7]=8*opmu/17,Quaternion.fastSlerp=function(e,t,i,r){var n,a=Quaternion.dot(e,t);a>=0?n=1:(n=-1,a=-a);for(var o=a-1,s=1-i,l=i*i,c=s*s,d=7;d>=0;--d)bT[d]=(u[d]*l-v[d])*o,bD[d]=(u[d]*c-v[d])*o;var h=n*i*(1+bT[0]*(1+bT[1]*(1+bT[2]*(1+bT[3]*(1+bT[4]*(1+bT[5]*(1+bT[6]*(1+bT[7])))))))),p=s*(1+bD[0]*(1+bD[1]*(1+bD[2]*(1+bD[3]*(1+bD[4]*(1+bD[5]*(1+bD[6]*(1+bD[7])))))))),f=Quaternion.multiplyByScalar(e,p,fastSlerpScratchQuaternion);return Quaternion.multiplyByScalar(t,h,r),Quaternion.add(f,r,r)},Quaternion.fastSquad=function(e,t,i,r,n,a){var o=Quaternion.fastSlerp(e,t,n,squadScratchQuaternion0),s=Quaternion.fastSlerp(i,r,n,squadScratchQuaternion1);return Quaternion.fastSlerp(o,s,2*n*(1-n),a)},Quaternion.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},Quaternion.equalsEpsilon=function(e,t,i){return i=defaultValue(i,0),e===t||defined(e)&&defined(t)&&Math.abs(e.x-t.x)<=i&&Math.abs(e.y-t.y)<=i&&Math.abs(e.z-t.z)<=i&&Math.abs(e.w-t.w)<=i},Quaternion.ZERO=Object.freeze(new Quaternion(0,0,0,0)),Quaternion.IDENTITY=Object.freeze(new Quaternion(0,0,0,1)),Quaternion.prototype.clone=function(e){return Quaternion.clone(this,e)},Quaternion.prototype.equals=function(e){return Quaternion.equals(this,e)},Quaternion.prototype.equalsEpsilon=function(e,t){return Quaternion.equalsEpsilon(this,e,t)},Quaternion.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"};var Transforms={},vectorProductLocalFrame={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},degeneratePositionLocalFrame={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},localFrameToFixedFrameCache={},scratchCalculateCartesian={east:new Cartesian3,north:new Cartesian3,up:new Cartesian3,west:new Cartesian3,south:new Cartesian3,down:new Cartesian3},scratchFirstCartesian=new Cartesian3,scratchSecondCartesian=new Cartesian3,scratchThirdCartesian=new Cartesian3;Transforms.localFrameToFixedFrameGenerator=function(e,t){if(!vectorProductLocalFrame.hasOwnProperty(e)||!vectorProductLocalFrame[e].hasOwnProperty(t))throw new DeveloperError("firstAxis and secondAxis must be east, north, up, west, south or down.");var i,r=vectorProductLocalFrame[e][t],n=e+t;return defined(localFrameToFixedFrameCache[n])?i=localFrameToFixedFrameCache[n]:(i=function(i,n,a){if(defined(a)||(a=new Matrix4),Cartesian3.equalsEpsilon(i,Cartesian3.ZERO,CesiumMath.EPSILON14))Cartesian3.unpack(degeneratePositionLocalFrame[e],0,scratchFirstCartesian),Cartesian3.unpack(degeneratePositionLocalFrame[t],0,scratchSecondCartesian),Cartesian3.unpack(degeneratePositionLocalFrame[r],0,scratchThirdCartesian);else if(CesiumMath.equalsEpsilon(i.x,0,CesiumMath.EPSILON14)&&CesiumMath.equalsEpsilon(i.y,0,CesiumMath.EPSILON14)){var o=CesiumMath.sign(i.z);Cartesian3.unpack(degeneratePositionLocalFrame[e],0,scratchFirstCartesian),"east"!==e&&"west"!==e&&Cartesian3.multiplyByScalar(scratchFirstCartesian,o,scratchFirstCartesian),Cartesian3.unpack(degeneratePositionLocalFrame[t],0,scratchSecondCartesian),"east"!==t&&"west"!==t&&Cartesian3.multiplyByScalar(scratchSecondCartesian,o,scratchSecondCartesian),Cartesian3.unpack(degeneratePositionLocalFrame[r],0,scratchThirdCartesian),"east"!==r&&"west"!==r&&Cartesian3.multiplyByScalar(scratchThirdCartesian,o,scratchThirdCartesian)}else{(n=defaultValue(n,Ellipsoid.WGS84)).geodeticSurfaceNormal(i,scratchCalculateCartesian.up);var s=scratchCalculateCartesian.up,l=scratchCalculateCartesian.east;l.x=-i.y,l.y=i.x,l.z=0,Cartesian3.normalize(l,scratchCalculateCartesian.east),Cartesian3.cross(s,l,scratchCalculateCartesian.north),Cartesian3.multiplyByScalar(scratchCalculateCartesian.up,-1,scratchCalculateCartesian.down),Cartesian3.multiplyByScalar(scratchCalculateCartesian.east,-1,scratchCalculateCartesian.west),Cartesian3.multiplyByScalar(scratchCalculateCartesian.north,-1,scratchCalculateCartesian.south),scratchFirstCartesian=scratchCalculateCartesian[e],scratchSecondCartesian=scratchCalculateCartesian[t],scratchThirdCartesian=scratchCalculateCartesian[r]}return a[0]=scratchFirstCartesian.x,a[1]=scratchFirstCartesian.y,a[2]=scratchFirstCartesian.z,a[3]=0,a[4]=scratchSecondCartesian.x,a[5]=scratchSecondCartesian.y,a[6]=scratchSecondCartesian.z,a[7]=0,a[8]=scratchThirdCartesian.x,a[9]=scratchThirdCartesian.y,a[10]=scratchThirdCartesian.z,a[11]=0,a[12]=i.x,a[13]=i.y,a[14]=i.z,a[15]=1,a},localFrameToFixedFrameCache[n]=i),i},Transforms.eastNorthUpToFixedFrame=Transforms.localFrameToFixedFrameGenerator("east","north"),Transforms.northEastDownToFixedFrame=Transforms.localFrameToFixedFrameGenerator("north","east"),Transforms.northUpEastToFixedFrame=Transforms.localFrameToFixedFrameGenerator("north","up"),Transforms.northWestUpToFixedFrame=Transforms.localFrameToFixedFrameGenerator("north","west");var scratchHPRQuaternion=new Quaternion,scratchScale$6=new Cartesian3(1,1,1),scratchHPRMatrix4=new Matrix4;Transforms.headingPitchRollToFixedFrame=function(e,t,i,r,n){r=defaultValue(r,Transforms.eastNorthUpToFixedFrame);var a=Quaternion.fromHeadingPitchRoll(t,scratchHPRQuaternion),o=Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.ZERO,a,scratchScale$6,scratchHPRMatrix4);return n=r(e,i,n),Matrix4.multiply(n,o,n)};var scratchENUMatrix4=new Matrix4,scratchHPRMatrix3=new Matrix3;Transforms.headingPitchRollQuaternion=function(e,t,i,r,n){var a=Transforms.headingPitchRollToFixedFrame(e,t,i,r,scratchENUMatrix4),o=Matrix4.getMatrix3(a,scratchHPRMatrix3);return Quaternion.fromRotationMatrix(o,n)};var noScale=new Cartesian3(1,1,1),hprCenterScratch=new Cartesian3,ffScratch=new Matrix4,hprTransformScratch=new Matrix4,hprRotationScratch=new Matrix3,hprQuaternionScratch=new Quaternion;Transforms.fixedFrameToHeadingPitchRoll=function(e,t,i,r){t=defaultValue(t,Ellipsoid.WGS84),i=defaultValue(i,Transforms.eastNorthUpToFixedFrame),defined(r)||(r=new HeadingPitchRoll);var n=Matrix4.getTranslation(e,hprCenterScratch);if(Cartesian3.equals(n,Cartesian3.ZERO))return r.heading=0,r.pitch=0,r.roll=0,r;var a=Matrix4.inverseTransformation(i(n,t,ffScratch),ffScratch),o=Matrix4.setScale(e,noScale,hprTransformScratch);o=Matrix4.setTranslation(o,Cartesian3.ZERO,o),a=Matrix4.multiply(a,o,a);var s=Quaternion.fromRotationMatrix(Matrix4.getMatrix3(a,hprRotationScratch),hprQuaternionScratch);return s=Quaternion.normalize(s,s),HeadingPitchRoll.fromQuaternion(s,r)};var gmstConstant0=24110.54841,gmstConstant1=8640184.812866,gmstConstant2=.093104,gmstConstant3=-62e-7,rateCoef=11772758384668e-32,wgs84WRPrecessing=72921158553e-15,twoPiOverSecondsInDay=CesiumMath.TWO_PI/86400,dateInUtc=new JulianDate;Transforms.computeTemeToPseudoFixedMatrix=function(e,t){var i,r=(dateInUtc=JulianDate.addSeconds(e,-JulianDate.computeTaiMinusUtc(e),dateInUtc)).dayNumber,n=dateInUtc.secondsOfDay,a=r-2451545;i=n>=43200?(a+.5)/TimeConstants$1.DAYS_PER_JULIAN_CENTURY:(a-.5)/TimeConstants$1.DAYS_PER_JULIAN_CENTURY;var o=(gmstConstant0+i*(gmstConstant1+i*(gmstConstant2+i*gmstConstant3)))*twoPiOverSecondsInDay%CesiumMath.TWO_PI+(wgs84WRPrecessing+rateCoef*(r-2451545.5))*((n+.5*TimeConstants$1.SECONDS_PER_DAY)%TimeConstants$1.SECONDS_PER_DAY),s=Math.cos(o),l=Math.sin(o);return defined(t)?(t[0]=s,t[1]=-l,t[2]=0,t[3]=l,t[4]=s,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new Matrix3(s,l,0,-l,s,0,0,0,1)},Transforms.iau2006XysData=new Iau2006XysData,Transforms.earthOrientationParameters=EarthOrientationParameters.NONE;var ttMinusTai=32.184,j2000ttDays=2451545;Transforms.preloadIcrfFixed=function(e){var t=e.start.dayNumber,i=e.start.secondsOfDay+ttMinusTai,r=e.stop.dayNumber,n=e.stop.secondsOfDay+ttMinusTai,a=Transforms.iau2006XysData.preload(t,i,r,n),o=Transforms.earthOrientationParameters.getPromiseToLoad();return when.all([a,o])},Transforms.computeIcrfToFixedMatrix=function(e,t){defined(t)||(t=new Matrix3);var i=Transforms.computeFixedToIcrfMatrix(e,t);if(defined(i))return Matrix3.transpose(i,t)};var xysScratch=new Iau2006XysSample(0,0,0),eopScratch=new EarthOrientationParametersSample(0,0,0,0,0,0),rotation1Scratch=new Matrix3,rotation2Scratch=new Matrix3;Transforms.computeFixedToIcrfMatrix=function(e,t){defined(t)||(t=new Matrix3);var i=Transforms.earthOrientationParameters.compute(e,eopScratch);if(defined(i)){var r=e.dayNumber,n=e.secondsOfDay+ttMinusTai,a=Transforms.iau2006XysData.computeXysRadians(r,n,xysScratch);if(defined(a)){var o=a.x+i.xPoleOffset,s=a.y+i.yPoleOffset,l=1/(1+Math.sqrt(1-o*o-s*s)),c=rotation1Scratch;c[0]=1-l*o*o,c[3]=-l*o*s,c[6]=o,c[1]=-l*o*s,c[4]=1-l*s*s,c[7]=s,c[2]=-o,c[5]=-s,c[8]=1-l*(o*o+s*s);var u=Matrix3.fromRotationZ(-a.s,rotation2Scratch),d=Matrix3.multiply(c,u,rotation1Scratch),h=e.dayNumber-2451545,p=(e.secondsOfDay-JulianDate.computeTaiMinusUtc(e)+i.ut1MinusUtc)/TimeConstants$1.SECONDS_PER_DAY,f=.779057273264+p+.00273781191135448*(h+p);f=f%1*CesiumMath.TWO_PI;var m=Matrix3.fromRotationZ(f,rotation2Scratch),g=Matrix3.multiply(d,m,rotation1Scratch),_=Math.cos(i.xPoleWander),y=Math.cos(i.yPoleWander),v=Math.sin(i.xPoleWander),C=Math.sin(i.yPoleWander),T=r-j2000ttDays+n/TimeConstants$1.SECONDS_PER_DAY,S=-47e-6*(T/=36525)*CesiumMath.RADIANS_PER_DEGREE/3600,A=Math.cos(S),x=Math.sin(S),E=rotation2Scratch;return E[0]=_*A,E[1]=_*x,E[2]=v,E[3]=-y*x+C*v*A,E[4]=y*A+C*v*x,E[5]=-C*_,E[6]=-C*x-y*v*A,E[7]=C*A-y*v*x,E[8]=y*_,Matrix3.multiply(g,E,t)}}};var pointToWindowCoordinatesTemp=new Cartesian4;Transforms.pointToWindowCoordinates=function(e,t,i,r){return(r=Transforms.pointToGLWindowCoordinates(e,t,i,r)).y=2*t[5]-r.y,r},Transforms.pointToGLWindowCoordinates=function(e,t,i,r){defined(r)||(r=new Cartesian2);var n=pointToWindowCoordinatesTemp;return Matrix4.multiplyByVector(e,Cartesian4.fromElements(i.x,i.y,i.z,1,n),n),Cartesian4.multiplyByScalar(n,1/n.w,n),Matrix4.multiplyByVector(t,n,n),Cartesian2.fromCartesian4(n,r)};var normalScratch$5=new Cartesian3,rightScratch$1=new Cartesian3,upScratch=new Cartesian3;Transforms.rotationMatrixFromPositionVelocity=function(e,t,i,r){var n=defaultValue(i,Ellipsoid.WGS84).geodeticSurfaceNormal(e,normalScratch$5),a=Cartesian3.cross(t,n,rightScratch$1);Cartesian3.equalsEpsilon(a,Cartesian3.ZERO,CesiumMath.EPSILON6)&&(a=Cartesian3.clone(Cartesian3.UNIT_X,a));var o=Cartesian3.cross(a,t,upScratch);return Cartesian3.normalize(o,o),Cartesian3.cross(t,o,a),Cartesian3.negate(a,a),Cartesian3.normalize(a,a),defined(r)||(r=new Matrix3),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=a.x,r[4]=a.y,r[5]=a.z,r[6]=o.x,r[7]=o.y,r[8]=o.z,r};var swizzleMatrix=new Matrix4(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),scratchCartographic$i=new Cartographic,scratchCartesian3Projection$1=new Cartesian3,scratchCenter$8=new Cartesian3,scratchRotation$2=new Matrix3,scratchFromENU=new Matrix4,scratchToENU=new Matrix4;Transforms.basisTo2D=function(e,t,i){var r=Matrix4.getTranslation(t,scratchCenter$8),n=e.ellipsoid,a=n.cartesianToCartographic(r,scratchCartographic$i),o=e.project(a,scratchCartesian3Projection$1);Cartesian3.fromElements(o.z,o.x,o.y,o);var s=Transforms.eastNorthUpToFixedFrame(r,n,scratchFromENU),l=Matrix4.inverseTransformation(s,scratchToENU),c=Matrix4.getMatrix3(t,scratchRotation$2),u=Matrix4.multiplyByMatrix3(l,c,i);return Matrix4.multiply(swizzleMatrix,u,i),Matrix4.setTranslation(i,o,i),i},Transforms.wgs84To2DModelMatrix=function(e,t,i){var r=e.ellipsoid,n=Transforms.eastNorthUpToFixedFrame(t,r,scratchFromENU),a=Matrix4.inverseTransformation(n,scratchToENU),o=r.cartesianToCartographic(t,scratchCartographic$i),s=e.project(o,scratchCartesian3Projection$1);Cartesian3.fromElements(s.z,s.x,s.y,s);var l=Matrix4.fromTranslation(s,scratchFromENU);return Matrix4.multiply(swizzleMatrix,a,i),Matrix4.multiply(l,i,i),i};var scratchCart4=new Cartesian4;function EllipsoidTangentPlane(e,t){e=(t=defaultValue(t,Ellipsoid.WGS84)).scaleToGeodeticSurface(e);var i=Transforms.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=Cartesian3.fromCartesian4(Matrix4.getColumn(i,0,scratchCart4)),this._yAxis=Cartesian3.fromCartesian4(Matrix4.getColumn(i,1,scratchCart4));var r=Cartesian3.fromCartesian4(Matrix4.getColumn(i,2,scratchCart4));this._plane=Plane.fromPointNormal(e,r)}Object.defineProperties(EllipsoidTangentPlane.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var tmp=new AxisAlignedBoundingBox;EllipsoidTangentPlane.fromPoints=function(e,t){return new EllipsoidTangentPlane(AxisAlignedBoundingBox.fromPoints(e,tmp).center,t)};var scratchProjectPointOntoPlaneRay=new Ray,scratchProjectPointOntoPlaneCartesian3=new Cartesian3;EllipsoidTangentPlane.prototype.projectPointOntoPlane=function(e,t){var i=scratchProjectPointOntoPlaneRay;i.origin=e,Cartesian3.normalize(e,i.direction);var r=IntersectionTests.rayPlane(i,this._plane,scratchProjectPointOntoPlaneCartesian3);if(defined(r)||(Cartesian3.negate(i.direction,i.direction),r=IntersectionTests.rayPlane(i,this._plane,scratchProjectPointOntoPlaneCartesian3)),defined(r)){var n=Cartesian3.subtract(r,this._origin,r),a=Cartesian3.dot(this._xAxis,n),o=Cartesian3.dot(this._yAxis,n);return defined(t)?(t.x=a,t.y=o,t):new Cartesian2(a,o)}},EllipsoidTangentPlane.prototype.projectPointsOntoPlane=function(e,t){defined(t)||(t=[]);for(var i=0,r=e.length,n=0;n<r;n++){var a=this.projectPointOntoPlane(e[n],t[i]);defined(a)&&(t[i]=a,i++)}return t.length=i,t},EllipsoidTangentPlane.prototype.projectPointToNearestOnPlane=function(e,t){defined(t)||(t=new Cartesian2);var i=scratchProjectPointOntoPlaneRay;i.origin=e,Cartesian3.clone(this._plane.normal,i.direction);var r=IntersectionTests.rayPlane(i,this._plane,scratchProjectPointOntoPlaneCartesian3);defined(r)||(Cartesian3.negate(i.direction,i.direction),r=IntersectionTests.rayPlane(i,this._plane,scratchProjectPointOntoPlaneCartesian3));var n=Cartesian3.subtract(r,this._origin,r),a=Cartesian3.dot(this._xAxis,n),o=Cartesian3.dot(this._yAxis,n);return t.x=a,t.y=o,t},EllipsoidTangentPlane.prototype.projectPointsToNearestOnPlane=function(e,t){defined(t)||(t=[]);var i=e.length;t.length=i;for(var r=0;r<i;r++)t[r]=this.projectPointToNearestOnPlane(e[r],t[r]);return t};var projectPointsOntoEllipsoidScratch=new Cartesian3;function OrientedBoundingBox(e,t){this.center=Cartesian3.clone(defaultValue(e,Cartesian3.ZERO)),this.halfAxes=Matrix3.clone(defaultValue(t,Matrix3.ZERO))}EllipsoidTangentPlane.prototype.projectPointOntoEllipsoid=function(e,t){defined(t)||(t=new Cartesian3);var i=this._ellipsoid,r=this._origin,n=this._xAxis,a=this._yAxis,o=projectPointsOntoEllipsoidScratch;return Cartesian3.multiplyByScalar(n,e.x,o),t=Cartesian3.add(r,o,t),Cartesian3.multiplyByScalar(a,e.y,o),Cartesian3.add(t,o,t),i.scaleToGeocentricSurface(t,t),t},EllipsoidTangentPlane.prototype.projectPointsOntoEllipsoid=function(e,t){var i=e.length;defined(t)?t.length=i:t=new Array(i);for(var r=0;r<i;++r)t[r]=this.projectPointOntoEllipsoid(e[r],t[r]);return t},OrientedBoundingBox.packedLength=Cartesian3.packedLength+Matrix3.packedLength,OrientedBoundingBox.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e.center,t,i),Matrix3.pack(e.halfAxes,t,i+Cartesian3.packedLength),t},OrientedBoundingBox.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new OrientedBoundingBox),Cartesian3.unpack(e,t,i.center),Matrix3.unpack(e,t+Cartesian3.packedLength,i.halfAxes),i};var scratchCartesian1$8=new Cartesian3,scratchCartesian2$b=new Cartesian3,scratchCartesian3$c=new Cartesian3,scratchCartesian4$6=new Cartesian3,scratchCartesian5$2=new Cartesian3,scratchCartesian6$1=new Cartesian3,scratchCovarianceResult=new Matrix3,scratchEigenResult={unitary:new Matrix3,diagonal:new Matrix3};OrientedBoundingBox.fromPoints=function(e,t){if(defined(t)||(t=new OrientedBoundingBox),!defined(e)||0===e.length)return t.halfAxes=Matrix3.ZERO,t.center=Cartesian3.ZERO,t;var i,r=e.length,n=Cartesian3.clone(e[0],scratchCartesian1$8);for(i=1;i<r;i++)Cartesian3.add(n,e[i],n);var a=1/r;Cartesian3.multiplyByScalar(n,a,n);var o,s=0,l=0,c=0,u=0,d=0,h=0;for(i=0;i<r;i++)s+=(o=Cartesian3.subtract(e[i],n,scratchCartesian2$b)).x*o.x,l+=o.x*o.y,c+=o.x*o.z,u+=o.y*o.y,d+=o.y*o.z,h+=o.z*o.z;s*=a,l*=a,c*=a,u*=a,d*=a,h*=a;var p=scratchCovarianceResult;p[0]=s,p[1]=l,p[2]=c,p[3]=l,p[4]=u,p[5]=d,p[6]=c,p[7]=d,p[8]=h;var f=Matrix3.computeEigenDecomposition(p,scratchEigenResult),m=Matrix3.clone(f.unitary,t.halfAxes),g=Matrix3.getColumn(m,0,scratchCartesian4$6),_=Matrix3.getColumn(m,1,scratchCartesian5$2),y=Matrix3.getColumn(m,2,scratchCartesian6$1),v=-Number.MAX_VALUE,C=-Number.MAX_VALUE,T=-Number.MAX_VALUE,S=Number.MAX_VALUE,A=Number.MAX_VALUE,x=Number.MAX_VALUE;for(i=0;i<r;i++)o=e[i],v=Math.max(Cartesian3.dot(g,o),v),C=Math.max(Cartesian3.dot(_,o),C),T=Math.max(Cartesian3.dot(y,o),T),S=Math.min(Cartesian3.dot(g,o),S),A=Math.min(Cartesian3.dot(_,o),A),x=Math.min(Cartesian3.dot(y,o),x);g=Cartesian3.multiplyByScalar(g,.5*(S+v),g),_=Cartesian3.multiplyByScalar(_,.5*(A+C),_),y=Cartesian3.multiplyByScalar(y,.5*(x+T),y);var E=Cartesian3.add(g,_,t.center);Cartesian3.add(E,y,E);var b=scratchCartesian3$c;return b.x=v-S,b.y=C-A,b.z=T-x,Cartesian3.multiplyByScalar(b,.5,b),Matrix3.multiplyByScale(t.halfAxes,b,t.halfAxes),t};var scratchOffset=new Cartesian3,scratchScale$5=new Cartesian3;function fromPlaneExtents(e,t,i,r,n,a,o,s,l,c,u){defined(u)||(u=new OrientedBoundingBox);var d=u.halfAxes;Matrix3.setColumn(d,0,t,d),Matrix3.setColumn(d,1,i,d),Matrix3.setColumn(d,2,r,d);var h=scratchOffset;h.x=(n+a)/2,h.y=(o+s)/2,h.z=(l+c)/2;var p=scratchScale$5;p.x=(a-n)/2,p.y=(s-o)/2,p.z=(c-l)/2;var f=u.center;return h=Matrix3.multiplyByVector(d,h,h),Cartesian3.add(e,h,f),Matrix3.multiplyByScale(d,p,d),u}var scratchRectangleCenterCartographic=new Cartographic,scratchRectangleCenter=new Cartesian3,scratchPerimeterCartographicNC=new Cartographic,scratchPerimeterCartographicNW=new Cartographic,scratchPerimeterCartographicCW=new Cartographic,scratchPerimeterCartographicSW=new Cartographic,scratchPerimeterCartographicSC=new Cartographic,scratchPerimeterCartesianNC=new Cartesian3,scratchPerimeterCartesianNW=new Cartesian3,scratchPerimeterCartesianCW=new Cartesian3,scratchPerimeterCartesianSW=new Cartesian3,scratchPerimeterCartesianSC=new Cartesian3,scratchPerimeterProjectedNC=new Cartesian2,scratchPerimeterProjectedNW=new Cartesian2,scratchPerimeterProjectedCW=new Cartesian2,scratchPerimeterProjectedSW=new Cartesian2,scratchPerimeterProjectedSC=new Cartesian2,scratchPlaneOrigin=new Cartesian3,scratchPlaneNormal$1=new Cartesian3,scratchPlaneXAxis=new Cartesian3,scratchHorizonCartesian=new Cartesian3,scratchHorizonProjected=new Cartesian2,scratchMaxY=new Cartesian3,scratchMinY=new Cartesian3,scratchZ=new Cartesian3,scratchPlane$2=new Plane(Cartesian3.UNIT_X,0);OrientedBoundingBox.fromRectangle=function(e,t,i,r,n){var a,o,s,l,c,u,d;if(t=defaultValue(t,0),i=defaultValue(i,0),r=defaultValue(r,Ellipsoid.WGS84),e.width<=CesiumMath.PI){var h=Rectangle.center(e,scratchRectangleCenterCartographic),p=new EllipsoidTangentPlane(r.cartographicToCartesian(h,scratchRectangleCenter),r);d=p.plane;var f=h.longitude,m=e.south<0&&e.north>0?0:h.latitude,g=Cartographic.fromRadians(f,e.north,i,scratchPerimeterCartographicNC),_=Cartographic.fromRadians(e.west,e.north,i,scratchPerimeterCartographicNW),y=Cartographic.fromRadians(e.west,m,i,scratchPerimeterCartographicCW),v=Cartographic.fromRadians(e.west,e.south,i,scratchPerimeterCartographicSW),C=Cartographic.fromRadians(f,e.south,i,scratchPerimeterCartographicSC),T=r.cartographicToCartesian(g,scratchPerimeterCartesianNC),S=r.cartographicToCartesian(_,scratchPerimeterCartesianNW),A=r.cartographicToCartesian(y,scratchPerimeterCartesianCW),x=r.cartographicToCartesian(v,scratchPerimeterCartesianSW),E=r.cartographicToCartesian(C,scratchPerimeterCartesianSC),b=p.projectPointToNearestOnPlane(T,scratchPerimeterProjectedNC),P=p.projectPointToNearestOnPlane(S,scratchPerimeterProjectedNW),D=p.projectPointToNearestOnPlane(A,scratchPerimeterProjectedCW),w=p.projectPointToNearestOnPlane(x,scratchPerimeterProjectedSW),M=p.projectPointToNearestOnPlane(E,scratchPerimeterProjectedSC);return o=-(a=Math.min(P.x,D.x,w.x)),l=Math.max(P.y,b.y),s=Math.min(w.y,M.y),_.height=v.height=t,S=r.cartographicToCartesian(_,scratchPerimeterCartesianNW),x=r.cartographicToCartesian(v,scratchPerimeterCartesianSW),c=Math.min(Plane.getPointDistance(d,S),Plane.getPointDistance(d,x)),u=i,fromPlaneExtents(p.origin,p.xAxis,p.yAxis,p.zAxis,a,o,s,l,c,u,n)}var I=e.south>0,R=e.north<0,O=I?e.south:R?e.north:0,B=Rectangle.center(e,scratchRectangleCenterCartographic).longitude,L=Cartesian3.fromRadians(B,O,i,r,scratchPlaneOrigin);L.z=0;var F=Math.abs(L.x)<CesiumMath.EPSILON10&&Math.abs(L.y)<CesiumMath.EPSILON10?Cartesian3.UNIT_X:Cartesian3.normalize(L,scratchPlaneNormal$1),N=Cartesian3.UNIT_Z,V=Cartesian3.cross(F,N,scratchPlaneXAxis);d=Plane.fromPointNormal(L,F,scratchPlane$2);var k=Cartesian3.fromRadians(B+CesiumMath.PI_OVER_TWO,O,i,r,scratchHorizonCartesian);a=-(o=Cartesian3.dot(Plane.projectPointOntoPlane(d,k,scratchHorizonProjected),V)),l=Cartesian3.fromRadians(0,e.north,R?t:i,r,scratchMaxY).z,s=Cartesian3.fromRadians(0,e.south,I?t:i,r,scratchMinY).z;var U=Cartesian3.fromRadians(e.east,O,i,r,scratchZ);return fromPlaneExtents(L,V,N,F,a,o,s,l,c=Plane.getPointDistance(d,U),u=0,n)},OrientedBoundingBox.clone=function(e,t){if(defined(e))return defined(t)?(Cartesian3.clone(e.center,t.center),Matrix3.clone(e.halfAxes,t.halfAxes),t):new OrientedBoundingBox(e.center,e.halfAxes)},OrientedBoundingBox.intersectPlane=function(e,t){var i=e.center,r=t.normal,n=e.halfAxes,a=r.x,o=r.y,s=r.z,l=Math.abs(a*n[Matrix3.COLUMN0ROW0]+o*n[Matrix3.COLUMN0ROW1]+s*n[Matrix3.COLUMN0ROW2])+Math.abs(a*n[Matrix3.COLUMN1ROW0]+o*n[Matrix3.COLUMN1ROW1]+s*n[Matrix3.COLUMN1ROW2])+Math.abs(a*n[Matrix3.COLUMN2ROW0]+o*n[Matrix3.COLUMN2ROW1]+s*n[Matrix3.COLUMN2ROW2]),c=Cartesian3.dot(r,i)+t.distance;return c<=-l?Intersect$1.OUTSIDE:c>=l?Intersect$1.INSIDE:Intersect$1.INTERSECTING};var scratchCartesianU=new Cartesian3,scratchCartesianV=new Cartesian3,scratchCartesianW=new Cartesian3,scratchValidAxis2=new Cartesian3,scratchValidAxis3=new Cartesian3,scratchPPrime=new Cartesian3;OrientedBoundingBox.distanceSquaredTo=function(e,t){var i=Cartesian3.subtract(t,e.center,scratchOffset),r=e.halfAxes,n=Matrix3.getColumn(r,0,scratchCartesianU),a=Matrix3.getColumn(r,1,scratchCartesianV),o=Matrix3.getColumn(r,2,scratchCartesianW),s=Cartesian3.magnitude(n),l=Cartesian3.magnitude(a),c=Cartesian3.magnitude(o),u=!0,d=!0,h=!0;s>0?Cartesian3.divideByScalar(n,s,n):u=!1,l>0?Cartesian3.divideByScalar(a,l,a):d=!1,c>0?Cartesian3.divideByScalar(o,c,o):h=!1;var p,f,m,g=!u+!d+!h;if(1===g){var _=n;p=a,f=o,d?h||(_=o,f=n):(_=a,p=n),m=Cartesian3.cross(p,f,scratchValidAxis3),_===n?n=m:_===a?a=m:_===o&&(o=m)}else if(2===g){p=n,d?p=a:h&&(p=o);var y=Cartesian3.UNIT_Y;y.equalsEpsilon(p,CesiumMath.EPSILON3)&&(y=Cartesian3.UNIT_X),f=Cartesian3.cross(p,y,scratchValidAxis2),Cartesian3.normalize(f,f),m=Cartesian3.cross(p,f,scratchValidAxis3),Cartesian3.normalize(m,m),p===n?(a=f,o=m):p===a?(o=f,n=m):p===o&&(n=f,a=m)}else 3===g&&(n=Cartesian3.UNIT_X,a=Cartesian3.UNIT_Y,o=Cartesian3.UNIT_Z);var v=scratchPPrime;v.x=Cartesian3.dot(i,n),v.y=Cartesian3.dot(i,a),v.z=Cartesian3.dot(i,o);var C,T=0;return v.x<-s?T+=(C=v.x+s)*C:v.x>s&&(T+=(C=v.x-s)*C),v.y<-l?T+=(C=v.y+l)*C:v.y>l&&(T+=(C=v.y-l)*C),v.z<-c?T+=(C=v.z+c)*C:v.z>c&&(T+=(C=v.z-c)*C),T};var scratchCorner=new Cartesian3,scratchToCenter$1=new Cartesian3;OrientedBoundingBox.computePlaneDistances=function(e,t,i,r){defined(r)||(r=new Interval);var n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=e.center,s=e.halfAxes,l=Matrix3.getColumn(s,0,scratchCartesianU),c=Matrix3.getColumn(s,1,scratchCartesianV),u=Matrix3.getColumn(s,2,scratchCartesianW),d=Cartesian3.add(l,c,scratchCorner);Cartesian3.add(d,u,d),Cartesian3.add(d,o,d);var h=Cartesian3.subtract(d,t,scratchToCenter$1),p=Cartesian3.dot(i,h);return n=Math.min(p,n),a=Math.max(p,a),Cartesian3.add(o,l,d),Cartesian3.add(d,c,d),Cartesian3.subtract(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),Cartesian3.add(o,l,d),Cartesian3.subtract(d,c,d),Cartesian3.add(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),Cartesian3.add(o,l,d),Cartesian3.subtract(d,c,d),Cartesian3.subtract(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),Cartesian3.subtract(o,l,d),Cartesian3.add(d,c,d),Cartesian3.add(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),Cartesian3.subtract(o,l,d),Cartesian3.add(d,c,d),Cartesian3.subtract(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),Cartesian3.subtract(o,l,d),Cartesian3.subtract(d,c,d),Cartesian3.add(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),Cartesian3.subtract(o,l,d),Cartesian3.subtract(d,c,d),Cartesian3.subtract(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),r.start=n,r.stop=a,r};var scratchBoundingSphere$3=new BoundingSphere;OrientedBoundingBox.isOccluded=function(e,t){var i=BoundingSphere.fromOrientedBoundingBox(e,scratchBoundingSphere$3);return!t.isBoundingSphereVisible(i)},OrientedBoundingBox.prototype.intersectPlane=function(e){return OrientedBoundingBox.intersectPlane(this,e)},OrientedBoundingBox.prototype.distanceSquaredTo=function(e){return OrientedBoundingBox.distanceSquaredTo(this,e)},OrientedBoundingBox.prototype.computePlaneDistances=function(e,t,i){return OrientedBoundingBox.computePlaneDistances(this,e,t,i)},OrientedBoundingBox.prototype.isOccluded=function(e){return OrientedBoundingBox.isOccluded(this,e)},OrientedBoundingBox.equals=function(e,t){return e===t||defined(e)&&defined(t)&&Cartesian3.equals(e.center,t.center)&&Matrix3.equals(e.halfAxes,t.halfAxes)},OrientedBoundingBox.prototype.clone=function(e){return OrientedBoundingBox.clone(this,e)},OrientedBoundingBox.prototype.equals=function(e){return OrientedBoundingBox.equals(this,e)};var ComponentDatatype={BYTE:WebGLConstants$1.BYTE,UNSIGNED_BYTE:WebGLConstants$1.UNSIGNED_BYTE,SHORT:WebGLConstants$1.SHORT,UNSIGNED_SHORT:WebGLConstants$1.UNSIGNED_SHORT,INT:WebGLConstants$1.INT,UNSIGNED_INT:WebGLConstants$1.UNSIGNED_INT,FLOAT:WebGLConstants$1.FLOAT,DOUBLE:WebGLConstants$1.DOUBLE,getSizeInBytes:function(e){switch(e){case ComponentDatatype.BYTE:return Int8Array.BYTES_PER_ELEMENT;case ComponentDatatype.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case ComponentDatatype.SHORT:return Int16Array.BYTES_PER_ELEMENT;case ComponentDatatype.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case ComponentDatatype.INT:return Int32Array.BYTES_PER_ELEMENT;case ComponentDatatype.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case ComponentDatatype.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case ComponentDatatype.DOUBLE:return Float64Array.BYTES_PER_ELEMENT}},fromTypedArray:function(e){return e instanceof Int8Array?ComponentDatatype.BYTE:e instanceof Uint8Array?ComponentDatatype.UNSIGNED_BYTE:e instanceof Int16Array?ComponentDatatype.SHORT:e instanceof Uint16Array?ComponentDatatype.UNSIGNED_SHORT:e instanceof Int32Array?ComponentDatatype.INT:e instanceof Uint32Array?ComponentDatatype.UNSIGNED_INT:e instanceof Float32Array?ComponentDatatype.FLOAT:e instanceof Float64Array?ComponentDatatype.DOUBLE:void 0},validate:function(e){return defined(e)&&(e===ComponentDatatype.BYTE||e===ComponentDatatype.UNSIGNED_BYTE||e===ComponentDatatype.SHORT||e===ComponentDatatype.UNSIGNED_SHORT||e===ComponentDatatype.INT||e===ComponentDatatype.UNSIGNED_INT||e===ComponentDatatype.FLOAT||e===ComponentDatatype.DOUBLE)},createTypedArray:function(e,t){switch(e){case ComponentDatatype.BYTE:return new Int8Array(t);case ComponentDatatype.UNSIGNED_BYTE:return new Uint8Array(t);case ComponentDatatype.SHORT:return new Int16Array(t);case ComponentDatatype.UNSIGNED_SHORT:return new Uint16Array(t);case ComponentDatatype.INT:return new Int32Array(t);case ComponentDatatype.UNSIGNED_INT:return new Uint32Array(t);case ComponentDatatype.FLOAT:return new Float32Array(t);case ComponentDatatype.DOUBLE:return new Float64Array(t)}},createArrayBufferView:function(e,t,i,r){switch(i=defaultValue(i,0),r=defaultValue(r,(t.byteLength-i)/ComponentDatatype.getSizeInBytes(e)),e){case ComponentDatatype.BYTE:return new Int8Array(t,i,r);case ComponentDatatype.UNSIGNED_BYTE:return new Uint8Array(t,i,r);case ComponentDatatype.SHORT:return new Int16Array(t,i,r);case ComponentDatatype.UNSIGNED_SHORT:return new Uint16Array(t,i,r);case ComponentDatatype.INT:return new Int32Array(t,i,r);case ComponentDatatype.UNSIGNED_INT:return new Uint32Array(t,i,r);case ComponentDatatype.FLOAT:return new Float32Array(t,i,r);case ComponentDatatype.DOUBLE:return new Float64Array(t,i,r)}},fromName:function(e){switch(e){case"BYTE":return ComponentDatatype.BYTE;case"UNSIGNED_BYTE":return ComponentDatatype.UNSIGNED_BYTE;case"SHORT":return ComponentDatatype.SHORT;case"UNSIGNED_SHORT":return ComponentDatatype.UNSIGNED_SHORT;case"INT":return ComponentDatatype.INT;case"UNSIGNED_INT":return ComponentDatatype.UNSIGNED_INT;case"FLOAT":return ComponentDatatype.FLOAT;case"DOUBLE":return ComponentDatatype.DOUBLE}}},ComponentDatatype$1=Object.freeze(ComponentDatatype);function Matrix2(e,t,i,r){this[0]=defaultValue(e,0),this[1]=defaultValue(i,0),this[2]=defaultValue(t,0),this[3]=defaultValue(r,0)}Matrix2.packedLength=4,Matrix2.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e[0],t[i++]=e[1],t[i++]=e[2],t[i++]=e[3],t},Matrix2.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Matrix2),i[0]=e[t++],i[1]=e[t++],i[2]=e[t++],i[3]=e[t++],i},Matrix2.clone=function(e,t){if(defined(e))return defined(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new Matrix2(e[0],e[2],e[1],e[3])},Matrix2.fromArray=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Matrix2),i[0]=e[t],i[1]=e[t+1],i[2]=e[t+2],i[3]=e[t+3],i},Matrix2.fromColumnMajorArray=function(e,t){return Matrix2.clone(e,t)},Matrix2.fromRowMajorArray=function(e,t){return defined(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new Matrix2(e[0],e[1],e[2],e[3])},Matrix2.fromScale=function(e,t){return defined(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new Matrix2(e.x,0,0,e.y)},Matrix2.fromUniformScale=function(e,t){return defined(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new Matrix2(e,0,0,e)},Matrix2.fromRotation=function(e,t){var i=Math.cos(e),r=Math.sin(e);return defined(t)?(t[0]=i,t[1]=r,t[2]=-r,t[3]=i,t):new Matrix2(i,-r,r,i)},Matrix2.toArray=function(e,t){return defined(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):[e[0],e[1],e[2],e[3]]},Matrix2.getElementIndex=function(e,t){return 2*e+t},Matrix2.getColumn=function(e,t,i){var r=2*t,n=e[r],a=e[r+1];return i.x=n,i.y=a,i},Matrix2.setColumn=function(e,t,i,r){var n=2*t;return(r=Matrix2.clone(e,r))[n]=i.x,r[n+1]=i.y,r},Matrix2.getRow=function(e,t,i){var r=e[t],n=e[t+2];return i.x=r,i.y=n,i},Matrix2.setRow=function(e,t,i,r){return(r=Matrix2.clone(e,r))[t]=i.x,r[t+2]=i.y,r};var scratchColumn=new Cartesian2;Matrix2.getScale=function(e,t){return t.x=Cartesian2.magnitude(Cartesian2.fromElements(e[0],e[1],scratchColumn)),t.y=Cartesian2.magnitude(Cartesian2.fromElements(e[2],e[3],scratchColumn)),t};var scratchScale$4=new Cartesian2;Matrix2.getMaximumScale=function(e){return Matrix2.getScale(e,scratchScale$4),Cartesian2.maximumComponent(scratchScale$4)},Matrix2.multiply=function(e,t,i){var r=e[0]*t[0]+e[2]*t[1],n=e[0]*t[2]+e[2]*t[3],a=e[1]*t[0]+e[3]*t[1],o=e[1]*t[2]+e[3]*t[3];return i[0]=r,i[1]=a,i[2]=n,i[3]=o,i},Matrix2.add=function(e,t,i){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i},Matrix2.subtract=function(e,t,i){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i},Matrix2.multiplyByVector=function(e,t,i){var r=e[0]*t.x+e[2]*t.y,n=e[1]*t.x+e[3]*t.y;return i.x=r,i.y=n,i},Matrix2.multiplyByScalar=function(e,t,i){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i},Matrix2.multiplyByScale=function(e,t,i){return i[0]=e[0]*t.x,i[1]=e[1]*t.x,i[2]=e[2]*t.y,i[3]=e[3]*t.y,i},Matrix2.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},Matrix2.transpose=function(e,t){var i=e[0],r=e[2],n=e[1],a=e[3];return t[0]=i,t[1]=r,t[2]=n,t[3]=a,t},Matrix2.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t},Matrix2.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},Matrix2.equalsArray=function(e,t,i){return e[0]===t[i]&&e[1]===t[i+1]&&e[2]===t[i+2]&&e[3]===t[i+3]},Matrix2.equalsEpsilon=function(e,t,i){return i=defaultValue(i,0),e===t||defined(e)&&defined(t)&&Math.abs(e[0]-t[0])<=i&&Math.abs(e[1]-t[1])<=i&&Math.abs(e[2]-t[2])<=i&&Math.abs(e[3]-t[3])<=i},Matrix2.IDENTITY=Object.freeze(new Matrix2(1,0,0,1)),Matrix2.ZERO=Object.freeze(new Matrix2(0,0,0,0)),Matrix2.COLUMN0ROW0=0,Matrix2.COLUMN0ROW1=1,Matrix2.COLUMN1ROW0=2,Matrix2.COLUMN1ROW1=3,Object.defineProperties(Matrix2.prototype,{length:{get:function(){return Matrix2.packedLength}}}),Matrix2.prototype.clone=function(e){return Matrix2.clone(this,e)},Matrix2.prototype.equals=function(e){return Matrix2.equals(this,e)},Matrix2.prototype.equalsEpsilon=function(e,t){return Matrix2.equalsEpsilon(this,e,t)},Matrix2.prototype.toString=function(){return"("+this[0]+", "+this[2]+")\n("+this[1]+", "+this[3]+")"};var AttributeType={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",getMathType:function(e){switch(e){case AttributeType.SCALAR:return Number;case AttributeType.VEC2:return Cartesian2;case AttributeType.VEC3:return Cartesian3;case AttributeType.VEC4:return Cartesian4;case AttributeType.MAT2:return Matrix2;case AttributeType.MAT3:return Matrix3;case AttributeType.MAT4:return Matrix4}},getNumberOfComponents:function(e){switch(e){case AttributeType.SCALAR:return 1;case AttributeType.VEC2:return 2;case AttributeType.VEC3:return 3;case AttributeType.VEC4:case AttributeType.MAT2:return 4;case AttributeType.MAT3:return 9;case AttributeType.MAT4:return 16}},getGlslType:function(e){switch(e){case AttributeType.SCALAR:return"float";case AttributeType.VEC2:return"vec2";case AttributeType.VEC3:return"vec3";case AttributeType.VEC4:return"vec4";case AttributeType.MAT2:return"mat2";case AttributeType.MAT3:return"mat3";case AttributeType.MAT4:return"mat4"}}},AttributeType$1=Object.freeze(AttributeType),RIGHT_SHIFT=1/256,LEFT_SHIFT=256,AttributeCompression={octEncodeInRange:function(e,t,i){if(i.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),i.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var r=i.x,n=i.y;i.x=(1-Math.abs(n))*CesiumMath.signNotZero(r),i.y=(1-Math.abs(r))*CesiumMath.signNotZero(n)}return i.x=CesiumMath.toSNorm(i.x,t),i.y=CesiumMath.toSNorm(i.y,t),i},octEncode:function(e,t){return AttributeCompression.octEncodeInRange(e,255,t)}},octEncodeScratch=new Cartesian2,uint8ForceArray=new Uint8Array(1);function forceUint8(e){return uint8ForceArray[0]=e,uint8ForceArray[0]}AttributeCompression.octEncodeToCartesian4=function(e,t){return AttributeCompression.octEncodeInRange(e,65535,octEncodeScratch),t.x=forceUint8(octEncodeScratch.x*RIGHT_SHIFT),t.y=forceUint8(octEncodeScratch.x),t.z=forceUint8(octEncodeScratch.y*RIGHT_SHIFT),t.w=forceUint8(octEncodeScratch.y),t},AttributeCompression.octDecodeInRange=function(e,t,i,r){if(r.x=CesiumMath.fromSNorm(e,i),r.y=CesiumMath.fromSNorm(t,i),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){var n=r.x;r.x=(1-Math.abs(r.y))*CesiumMath.signNotZero(n),r.y=(1-Math.abs(n))*CesiumMath.signNotZero(r.y)}return Cartesian3.normalize(r,r)},AttributeCompression.octDecode=function(e,t,i){return AttributeCompression.octDecodeInRange(e,t,255,i)},AttributeCompression.octDecodeFromCartesian4=function(e,t){var i=e.x,r=e.y,n=e.z,a=e.w,o=i*LEFT_SHIFT+r,s=n*LEFT_SHIFT+a;return AttributeCompression.octDecodeInRange(o,s,65535,t)},AttributeCompression.octPackFloat=function(e){return 256*e.x+e.y};var scratchEncodeCart2=new Cartesian2;function zigZagDecode(e){return e>>1^-(1&e)}AttributeCompression.octEncodeFloat=function(e){return AttributeCompression.octEncode(e,scratchEncodeCart2),AttributeCompression.octPackFloat(scratchEncodeCart2)},AttributeCompression.octDecodeFloat=function(e,t){var i=e/256,r=Math.floor(i),n=256*(i-r);return AttributeCompression.octDecode(r,n,t)},AttributeCompression.octPack=function(e,t,i,r){var n=AttributeCompression.octEncodeFloat(e),a=AttributeCompression.octEncodeFloat(t),o=AttributeCompression.octEncode(i,scratchEncodeCart2);return r.x=65536*o.x+n,r.y=65536*o.y+a,r},AttributeCompression.octUnpack=function(e,t,i,r){var n=e.x/65536,a=Math.floor(n),o=65536*(n-a);n=e.y/65536;var s=Math.floor(n),l=65536*(n-s);AttributeCompression.octDecodeFloat(o,t),AttributeCompression.octDecodeFloat(l,i),AttributeCompression.octDecode(a,s,r)},AttributeCompression.compressTextureCoordinates=function(e){return 4096*(4095*e.x|0)+(4095*e.y|0)},AttributeCompression.decompressTextureCoordinates=function(e,t){var i=e/4096,r=Math.floor(i);return t.x=r/4095,t.y=(e-4096*r)/4095,t},AttributeCompression.zigZagDeltaDecode=function(e,t,i){for(var r=e.length,n=0,a=0,o=0,s=0;s<r;++s)n+=zigZagDecode(e[s]),a+=zigZagDecode(t[s]),e[s]=n,t[s]=a,defined(i)&&(o+=zigZagDecode(i[s]),i[s]=o)},AttributeCompression.dequantize=function(e,t,i,r){var n,a=AttributeType$1.getNumberOfComponents(i);switch(t){case ComponentDatatype$1.BYTE:n=127;break;case ComponentDatatype$1.UNSIGNED_BYTE:n=255;break;case ComponentDatatype$1.SHORT:n=32767;break;case ComponentDatatype$1.UNSIGNED_SHORT:n=65535;break;case ComponentDatatype$1.INT:n=2147483647;break;case ComponentDatatype$1.UNSIGNED_INT:n=4294967295}for(var o=new Float32Array(r*a),s=0;s<r;s++)for(var l=0;l<a;l++){var c=s*a+l;o[c]=Math.max(e[c]/n,-1)}return o};var TerrainExaggeration={getHeight:function(e,t,i){return(e-i)*t+i}},scratchCartographic$h=new Cartesian3;TerrainExaggeration.getPosition=function(e,t,i,r,n){var a=t.cartesianToCartographic(e,scratchCartographic$h),o=TerrainExaggeration.getHeight(a.height,i,r);return Cartesian3.fromRadians(a.longitude,a.latitude,o,t,n)};var TerrainQuantization={NONE:0,BITS12:1},TerrainQuantization$1=Object.freeze(TerrainQuantization),cartesian3Scratch$3=new Cartesian3,cartesian3DimScratch=new Cartesian3,cartesian2Scratch=new Cartesian2,matrix4Scratch$1=new Matrix4,matrix4Scratch2=new Matrix4,SHIFT_LEFT_12=Math.pow(2,12);function TerrainEncoding(e,t,i,r,n,a,o,s,l,c){var u,d,h=TerrainQuantization$1.NONE;if(defined(t)&&defined(i)&&defined(r)&&defined(n)){var p=t.minimum,f=t.maximum,m=Cartesian3.subtract(f,p,cartesian3DimScratch),g=r-i;h=Math.max(Cartesian3.maximumComponent(m),g)<SHIFT_LEFT_12-1?TerrainQuantization$1.BITS12:TerrainQuantization$1.NONE,u=Matrix4.inverseTransformation(n,new Matrix4);var _=Cartesian3.negate(p,cartesian3Scratch$3);Matrix4.multiply(Matrix4.fromTranslation(_,matrix4Scratch$1),u,u);var y=cartesian3Scratch$3;y.x=1/m.x,y.y=1/m.y,y.z=1/m.z,Matrix4.multiply(Matrix4.fromScale(y,matrix4Scratch$1),u,u),d=Matrix4.clone(n),Matrix4.setTranslation(d,Cartesian3.ZERO,d),n=Matrix4.clone(n,new Matrix4);var v=Matrix4.fromTranslation(p,matrix4Scratch$1),C=Matrix4.fromScale(m,matrix4Scratch2),T=Matrix4.multiply(v,C,matrix4Scratch$1);Matrix4.multiply(n,T,n),Matrix4.multiply(d,T,d)}this.quantization=h,this.minimumHeight=i,this.maximumHeight=r,this.center=Cartesian3.clone(e),this.toScaledENU=u,this.fromScaledENU=n,this.matrix=d,this.hasVertexNormals=a,this.hasWebMercatorT=defaultValue(o,!1),this.hasGeodeticSurfaceNormals=defaultValue(s,!1),this.exaggeration=defaultValue(l,1),this.exaggerationRelativeHeight=defaultValue(c,0),this.stride=0,this._offsetGeodeticSurfaceNormal=0,this._offsetVertexNormal=0,this._calculateStrideAndOffsets()}TerrainEncoding.prototype.encode=function(e,t,i,r,n,a,o,s,l,c){var u=r.x,d=r.y;if(this.quantization===TerrainQuantization$1.BITS12){(i=Matrix4.multiplyByPoint(this.toScaledENU,i,cartesian3Scratch$3)).x=CesiumMath.clamp(i.x,0,1),i.y=CesiumMath.clamp(i.y,0,1),i.z=CesiumMath.clamp(i.z,0,1);var h=this.maximumHeight-this.minimumHeight,p=CesiumMath.clamp((n-this.minimumHeight)/h,0,1);Cartesian2.fromElements(i.x,i.y,cartesian2Scratch);var f=AttributeCompression.compressTextureCoordinates(cartesian2Scratch);Cartesian2.fromElements(i.z,p,cartesian2Scratch);var m=AttributeCompression.compressTextureCoordinates(cartesian2Scratch);Cartesian2.fromElements(u,d,cartesian2Scratch);var g=AttributeCompression.compressTextureCoordinates(cartesian2Scratch);if(e[t++]=f,e[t++]=m,e[t++]=g,this.hasWebMercatorT){Cartesian2.fromElements(o,0,cartesian2Scratch);var _=AttributeCompression.compressTextureCoordinates(cartesian2Scratch);e[t++]=_}}else Cartesian3.subtract(i,this.center,cartesian3Scratch$3),e[t++]=cartesian3Scratch$3.x,e[t++]=cartesian3Scratch$3.y,e[t++]=cartesian3Scratch$3.z,e[t++]=n,e[t++]=u,e[t++]=d,this.hasWebMercatorT&&(e[t++]=o);return this.hasVertexNormals&&(l?e[t++]=a:(c&&(a.x=123.456,a.y=123.456),e[t++]=AttributeCompression.octPackFloat(a))),this.hasGeodeticSurfaceNormals&&(e[t++]=s.x,e[t++]=s.y,e[t++]=s.z),t};var scratchPosition$d=new Cartesian3,scratchGeodeticSurfaceNormal=new Cartesian3;TerrainEncoding.prototype.addGeodeticSurfaceNormals=function(e,t,i){if(!this.hasGeodeticSurfaceNormals){var r=this.stride,n=e.length/r;this.hasGeodeticSurfaceNormals=!0,this._calculateStrideAndOffsets();for(var a=this.stride,o=0;o<n;o++){for(var s=0;s<r;s++){var l=o*r+s;t[o*a+s]=e[l]}var c=this.decodePosition(t,o,scratchPosition$d),u=i.geodeticSurfaceNormal(c,scratchGeodeticSurfaceNormal),d=o*a+this._offsetGeodeticSurfaceNormal;t[d]=u.x,t[d+1]=u.y,t[d+2]=u.z}}},TerrainEncoding.prototype.removeGeodeticSurfaceNormals=function(e,t){if(this.hasGeodeticSurfaceNormals){var i=this.stride,r=e.length/i;this.hasGeodeticSurfaceNormals=!1,this._calculateStrideAndOffsets();for(var n=this.stride,a=0;a<r;a++)for(var o=0;o<n;o++){var s=a*i+o;t[a*n+o]=e[s]}}},TerrainEncoding.prototype.decodePosition=function(e,t,i){if(defined(i)||(i=new Cartesian3),t*=this.stride,this.quantization===TerrainQuantization$1.BITS12){var r=AttributeCompression.decompressTextureCoordinates(e[t],cartesian2Scratch);i.x=r.x,i.y=r.y;var n=AttributeCompression.decompressTextureCoordinates(e[t+1],cartesian2Scratch);return i.z=n.x,Matrix4.multiplyByPoint(this.fromScaledENU,i,i)}return i.x=e[t],i.y=e[t+1],i.z=e[t+2],Cartesian3.add(i,this.center,i)},TerrainEncoding.prototype.getExaggeratedPosition=function(e,t,i){i=this.decodePosition(e,t,i);var r=this.exaggeration,n=this.exaggerationRelativeHeight;if(1!==r&&this.hasGeodeticSurfaceNormals){var a=this.decodeGeodeticSurfaceNormal(e,t,scratchGeodeticSurfaceNormal),o=this.decodeHeight(e,t),s=TerrainExaggeration.getHeight(o,r,n)-o;i.x+=a.x*s,i.y+=a.y*s,i.z+=a.z*s}return i},TerrainEncoding.prototype.decodeTextureCoordinates=function(e,t,i){return defined(i)||(i=new Cartesian2),t*=this.stride,this.quantization===TerrainQuantization$1.BITS12?AttributeCompression.decompressTextureCoordinates(e[t+2],i):Cartesian2.fromElements(e[t+4],e[t+5],i)},TerrainEncoding.prototype.decodeHeight=function(e,t){return t*=this.stride,this.quantization===TerrainQuantization$1.BITS12?AttributeCompression.decompressTextureCoordinates(e[t+1],cartesian2Scratch).y*(this.maximumHeight-this.minimumHeight)+this.minimumHeight:e[t+3]},TerrainEncoding.prototype.decodeWebMercatorT=function(e,t){return t*=this.stride,this.quantization===TerrainQuantization$1.BITS12?AttributeCompression.decompressTextureCoordinates(e[t+3],cartesian2Scratch).x:e[t+6]},TerrainEncoding.prototype.getOctEncodedNormal=function(e,t,i){var r=e[t=t*this.stride+this._offsetVertexNormal]/256,n=Math.floor(r),a=256*(r-n);return Cartesian2.fromElements(n,a,i)},TerrainEncoding.prototype.decodeGeodeticSurfaceNormal=function(e,t,i){return t=t*this.stride+this._offsetGeodeticSurfaceNormal,i.x=e[t],i.y=e[t+1],i.z=e[t+2],i},TerrainEncoding.prototype._calculateStrideAndOffsets=function(){var e=0;if(this.quantization===TerrainQuantization$1.BITS12)e+=3;else e+=6;this.hasWebMercatorT&&(e+=1),this.hasVertexNormals&&(this._offsetVertexNormal=e,e+=1),this.hasGeodeticSurfaceNormals&&(this._offsetGeodeticSurfaceNormal=e,e+=3),this.stride=e};var attributesIndicesNone={position3DAndHeight:0,textureCoordAndEncodedNormals:1,geodeticSurfaceNormal:2},attributesIndicesBits12={compressed0:0,compressed1:1,geodeticSurfaceNormal:2};function WebMercatorProjection(e){this._ellipsoid=defaultValue(e,Ellipsoid.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}TerrainEncoding.prototype.getAttributes=function(e){var t=ComponentDatatype$1.FLOAT,i=ComponentDatatype$1.getSizeInBytes(t),r=this.stride*i,n=0,a=[];function o(o,s){a.push({index:o,vertexBuffer:e,componentDatatype:t,componentsPerAttribute:s,offsetInBytes:n,strideInBytes:r}),n+=s*i}if(this.quantization===TerrainQuantization$1.NONE){o(attributesIndicesNone.position3DAndHeight,4);var s=2;s+=this.hasWebMercatorT?1:0,s+=this.hasVertexNormals?1:0,o(attributesIndicesNone.textureCoordAndEncodedNormals,s),this.hasGeodeticSurfaceNormals&&o(attributesIndicesNone.geodeticSurfaceNormal,3)}else{var l=this.hasWebMercatorT||this.hasVertexNormals,c=this.hasWebMercatorT&&this.hasVertexNormals;o(attributesIndicesBits12.compressed0,l?4:3),c&&o(attributesIndicesBits12.compressed1,1),this.hasGeodeticSurfaceNormals&&o(attributesIndicesBits12.geodeticSurfaceNormal,3)}return a},TerrainEncoding.prototype.getAttributeLocations=function(){return this.quantization===TerrainQuantization$1.NONE?attributesIndicesNone:attributesIndicesBits12},TerrainEncoding.clone=function(e,t){if(defined(e))return defined(t)||(t=new TerrainEncoding),t.quantization=e.quantization,t.minimumHeight=e.minimumHeight,t.maximumHeight=e.maximumHeight,t.center=Cartesian3.clone(e.center),t.toScaledENU=Matrix4.clone(e.toScaledENU),t.fromScaledENU=Matrix4.clone(e.fromScaledENU),t.matrix=Matrix4.clone(e.matrix),t.hasVertexNormals=e.hasVertexNormals,t.hasWebMercatorT=e.hasWebMercatorT,t.hasGeodeticSurfaceNormals=e.hasGeodeticSurfaceNormals,t.exaggeration=e.exaggeration,t.exaggerationRelativeHeight=e.exaggerationRelativeHeight,t._calculateStrideAndOffsets(),t},Object.defineProperties(WebMercatorProjection.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),WebMercatorProjection.mercatorAngleToGeodeticLatitude=function(e){return CesiumMath.PI_OVER_TWO-2*Math.atan(Math.exp(-e))},WebMercatorProjection.geodeticLatitudeToMercatorAngle=function(e){e>WebMercatorProjection.MaximumLatitude?e=WebMercatorProjection.MaximumLatitude:e<-WebMercatorProjection.MaximumLatitude&&(e=-WebMercatorProjection.MaximumLatitude);var t=Math.sin(e);return.5*Math.log((1+t)/(1-t))},WebMercatorProjection.MaximumLatitude=WebMercatorProjection.mercatorAngleToGeodeticLatitude(Math.PI),WebMercatorProjection.prototype.project=function(e,t){var i=this._semimajorAxis,r=e.longitude*i,n=WebMercatorProjection.geodeticLatitudeToMercatorAngle(e.latitude)*i,a=e.height;return defined(t)?(t.x=r,t.y=n,t.z=a,t):new Cartesian3(r,n,a)},WebMercatorProjection.prototype.unproject=function(e,t){var i=this._oneOverSemimajorAxis,r=e.x*i,n=WebMercatorProjection.mercatorAngleToGeodeticLatitude(e.y*i),a=e.z;return defined(t)?(t.longitude=r,t.latitude=n,t.height=a,t):new Cartographic(r,n,a)};var HeightmapTessellator={};HeightmapTessellator.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});var cartesian3Scratch$2=new Cartesian3,matrix4Scratch=new Matrix4,minimumScratch=new Cartesian3,maximumScratch=new Cartesian3;function canTransferArrayBuffer(){if(!defined(TaskProcessor._canTransferArrayBuffer)){var e=new Worker(getWorkerUrl("Workers/transferTypedArrayTest.js"));e.postMessage=defaultValue(e.webkitPostMessage,e.postMessage);var t=new Int8Array([99]);try{e.postMessage({array:t},[t.buffer])}catch(e){return TaskProcessor._canTransferArrayBuffer=!1,TaskProcessor._canTransferArrayBuffer}var i=when.defer();e.onmessage=function(t){var r=t.data.array,n=defined(r)&&99===r[0];i.resolve(n),e.terminate(),TaskProcessor._canTransferArrayBuffer=n},TaskProcessor._canTransferArrayBuffer=i.promise}return TaskProcessor._canTransferArrayBuffer}HeightmapTessellator.computeVertices=function(e){var t,i,r,n,a=Math.cos,o=Math.sin,s=Math.sqrt,l=Math.atan,c=Math.exp,u=CesiumMath.PI_OVER_TWO,d=CesiumMath.toRadians,h=e.heightmap,p=e.width,f=e.height,m=e.skirtHeight,g=m>0,_=defaultValue(e.isGeographic,!0),y=defaultValue(e.ellipsoid,Ellipsoid.WGS84),v=1/y.maximumRadius,C=Rectangle.clone(e.nativeRectangle),T=Rectangle.clone(e.rectangle);defined(T)?(t=T.west,i=T.south,r=T.east,n=T.north):_?(t=d(C.west),i=d(C.south),r=d(C.east),n=d(C.north)):(t=C.west*v,i=u-2*l(c(-C.south*v)),r=C.east*v,n=u-2*l(c(-C.north*v)));var S=e.relativeToCenter,A=defined(S);S=A?S:Cartesian3.ZERO;var x=defaultValue(e.includeWebMercatorT,!1),E=defaultValue(e.exaggeration,1),b=defaultValue(e.exaggerationRelativeHeight,0),P=1!==E,D=defaultValue(e.structure,HeightmapTessellator.DEFAULT_STRUCTURE),w=defaultValue(D.heightScale,HeightmapTessellator.DEFAULT_STRUCTURE.heightScale),M=defaultValue(D.heightOffset,HeightmapTessellator.DEFAULT_STRUCTURE.heightOffset),I=defaultValue(D.elementsPerHeight,HeightmapTessellator.DEFAULT_STRUCTURE.elementsPerHeight),R=defaultValue(D.stride,HeightmapTessellator.DEFAULT_STRUCTURE.stride),O=defaultValue(D.elementMultiplier,HeightmapTessellator.DEFAULT_STRUCTURE.elementMultiplier),B=defaultValue(D.isBigEndian,HeightmapTessellator.DEFAULT_STRUCTURE.isBigEndian),L=Rectangle.computeWidth(C),F=Rectangle.computeHeight(C),N=L/(p-1),V=F/(f-1);_||(L*=v,F*=v);var k,U,G=y.radiiSquared,$=G.x,z=G.y,H=G.z,W=65536,j=-65536,q=Transforms.eastNorthUpToFixedFrame(S,y),X=Matrix4.inverseTransformation(q,matrix4Scratch);x&&(k=WebMercatorProjection.geodeticLatitudeToMercatorAngle(i),U=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(n)-k));var Y=minimumScratch;Y.x=Number.POSITIVE_INFINITY,Y.y=Number.POSITIVE_INFINITY,Y.z=Number.POSITIVE_INFINITY;var K=maximumScratch;K.x=Number.NEGATIVE_INFINITY,K.y=Number.NEGATIVE_INFINITY,K.z=Number.NEGATIVE_INFINITY;var J=Number.POSITIVE_INFINITY,Q=p*f,Z=Q+(m>0?2*p+2*f:0),ee=new Array(Z),te=new Array(Z),ie=new Array(Z),re=x?new Array(Z):[],ne=P?new Array(Z):[],ae=0,oe=f,se=0,le=p;g&&(--ae,++oe,--se,++le);for(var ce=1e-5,ue=ae;ue<oe;++ue){var de=ue;de<0&&(de=0),de>=f&&(de=f-1);var he=C.north-V*de,pe=((he=_?d(he):u-2*l(c(-he*v)))-i)/(n-i);pe=CesiumMath.clamp(pe,0,1);var fe=ue===ae,me=ue===oe-1;m>0&&(fe?he+=ce*F:me&&(he-=ce*F));var ge,_e=a(he),ye=o(he),ve=H*ye;x&&(ge=(WebMercatorProjection.geodeticLatitudeToMercatorAngle(he)-k)*U);for(var Ce=se;Ce<le;++Ce){var Te=Ce;Te<0&&(Te=0),Te>=p&&(Te=p-1);var Se,Ae,xe=de*(p*R)+Te*R;if(1===I)Se=h[xe];else if(Se=0,B)for(Ae=0;Ae<I;++Ae)Se=Se*O+h[xe+Ae];else for(Ae=I-1;Ae>=0;--Ae)Se=Se*O+h[xe+Ae];Se=Se*w+M,j=Math.max(j,Se),W=Math.min(W,Se);var Ee=C.west+N*Te;_?Ee=d(Ee):Ee*=v;var be=(Ee-t)/(r-t);be=CesiumMath.clamp(be,0,1);var Pe=de*p+Te;if(m>0){var De=Ce===se,we=Ce===le-1,Me=fe||me||De||we;if((fe||me)&&(De||we))continue;Me&&(Se-=m,De?(Pe=Q+(f-de-1),Ee-=ce*L):me?Pe=Q+f+(p-Te-1):we?(Pe=Q+f+p+de,Ee+=ce*L):fe&&(Pe=Q+f+p+f+Te))}var Ie=_e*a(Ee),Re=_e*o(Ee),Oe=$*Ie,Be=z*Re,Le=1/s(Oe*Ie+Be*Re+ve*ye),Fe=Oe*Le,Ne=Be*Le,Ve=ve*Le,ke=new Cartesian3;ke.x=Fe+Ie*Se,ke.y=Ne+Re*Se,ke.z=Ve+ye*Se,Matrix4.multiplyByPoint(X,ke,cartesian3Scratch$2),Cartesian3.minimumByComponent(cartesian3Scratch$2,Y,Y),Cartesian3.maximumByComponent(cartesian3Scratch$2,K,K),J=Math.min(J,Se),ee[Pe]=ke,ie[Pe]=new Cartesian2(be,pe),te[Pe]=Se,x&&(re[Pe]=ge),P&&(ne[Pe]=y.geodeticSurfaceNormal(ke))}}var Ue=new Array(Z);if(m>0)for(var Ge=0,$e=0;$e<f;++$e){var ze=-1,He=1;$e<2&&(ze=0),$e>=f-1&&(He=0);for(var We=0;We<p;++We){var je=-1,qe=1;We<2&&(je=0),We>=p-1&&(qe=0),Ge=$e*p+We;try{var Xe=ee[($e+ze)*p+We],Ye=ee[($e+He)*p+We],Ke=ee[$e*p+(We+je)],Je=ee[$e*p+(We+qe)],Qe=Cartesian3.subtract(Ke,Je,new Cartesian3),Ze=Cartesian3.subtract(Xe,Ye,new Cartesian3),et=Cartesian3.cross(Qe,Ze,new Cartesian3),tt=Cartesian3.normalize(et,new Cartesian3);Ue[Ge]=AttributeCompression.octEncodeFloat(tt)}catch(e){Ue[Ge]=0}}}var it,rt,nt=BoundingSphere.fromPoints(ee);(defined(T)&&(it=OrientedBoundingBox.fromRectangle(T,W,j,y)),A)&&(rt=new EllipsoidalOccluder(y).computeHorizonCullingPointPossiblyUnderEllipsoid(S,ee,W));var at=new TerrainEncoding(S,new AxisAlignedBoundingBox(Y,K,S),J,j,q,m>0,x,P,E,b),ot=new Float32Array(Z*at.stride),st=0;for(We=0;We<Z;++We)st=at.encode(ot,st,ee[We],ie[We],te[We],m>0?Ue[We]:void 0,re[We],ne[We],m>0||void 0);return{vertices:ot,maximumHeight:j,minimumHeight:W,encoding:at,boundingSphere3D:nt,orientedBoundingBox:it,occludeePointInScaledSpace:rt}};var taskCompletedEvent=new Event,bootstrapperUrlResult;function completeTask(e,t){--e._activeTasks;var i=t.id;if(defined(i)){var r=e._deferreds,n=r[i];if(defined(t.error)){var a=t.error;"RuntimeError"===a.name?(a=new RuntimeError(t.error.message)).stack=t.error.stack:"DeveloperError"===a.name&&((a=new DeveloperError(t.error.message)).stack=t.error.stack),taskCompletedEvent.raiseEvent(a),n.reject(a)}else taskCompletedEvent.raiseEvent(),n.resolve(t.result);delete r[i]}}function getWorkerUrl(e){var t=buildModuleUrl(e);if(isCrossOriginUrl(t)){var i,r='importScripts("'+t+'");';try{i=new Blob([r],{type:"application/javascript"})}catch(e){var n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder);n.append(r),i=n.getBlob("application/javascript")}t=(window.URL||window.webkitURL).createObjectURL(i)}return t}function getBootstrapperUrl(){return defined(bootstrapperUrlResult)||(bootstrapperUrlResult=getWorkerUrl("Workers/cesiumWorkerBootstrapper.js")),bootstrapperUrlResult}function createWorker(e){var t=new Worker(getBootstrapperUrl());t.postMessage=defaultValue(t.webkitPostMessage,t.postMessage);var i={loaderConfig:{paths:{Workers:buildModuleUrl("Workers")},baseUrl:buildModuleUrl.getCesiumBaseUrl().url},workerModule:e._workerPath};return t.postMessage(i),t.onmessage=function(t){completeTask(e,t.data)},t}function getWebAssemblyLoaderConfig(e,t){var i={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!FeatureDetection.supportsWebAssembly()){if(!defined(t.fallbackModulePath))throw new RuntimeError("This browser does not support Web Assembly, and no backup module was provided for "+e._workerPath);return i.modulePath=buildModuleUrl(t.fallbackModulePath),when.resolve(i)}return i.modulePath=buildModuleUrl(t.modulePath),i.wasmBinaryFile=buildModuleUrl(t.wasmBinaryFile),Resource.fetchArrayBuffer({url:i.wasmBinaryFile}).then((function(e){return i.wasmBinary=e,i}))}function TaskProcessor(e,t){var i=new URI(e);this._workerPath=0!==i.scheme().length&&0===i.fragment().length?e:TaskProcessor._workerModulePrefix+e,this._maximumActiveTasks=defaultValue(t,Number.POSITIVE_INFINITY),this._activeTasks=0,this._deferreds={},this._nextID=0}var emptyTransferableObjectArray=[];function TerrainData(){DeveloperError.throwInstantiationError()}function TerrainMesh(e,t,i,r,n,a,o,s,l,c,u,d,h,p,f,m){this.center=e,this.vertices=t,this.stride=defaultValue(c,6),this.indices=i,this.indexCountWithoutSkirts=r,this.vertexCountWithoutSkirts=n,this.minimumHeight=a,this.maximumHeight=o,this.boundingSphere3D=s,this.occludeePointInScaledSpace=l,this.orientedBoundingBox=u,this.encoding=d,this.westIndicesSouthToNorth=h,this.southIndicesEastToWest=p,this.eastIndicesNorthToSouth=f,this.northIndicesWestToEast=m}TaskProcessor.prototype.scheduleTask=function(e,t){if(defined(this._worker)||(this._worker=createWorker(this)),!(this._activeTasks>=this._maximumActiveTasks)){++this._activeTasks;var i=this;return when(canTransferArrayBuffer(),(function(r){defined(t)?r||(t.length=0):t=emptyTransferableObjectArray;var n=i._nextID++,a=when.defer();return i._deferreds[n]=a,i._worker.postMessage({id:n,parameters:e,canTransferArrayBuffer:r},t),a.promise}))}},TaskProcessor.prototype.initWebAssemblyModule=function(e){defined(this._worker)||(this._worker=createWorker(this));var t=when.defer(),i=this,r=this._worker;return getWebAssemblyLoaderConfig(this,e).then((function(e){return when(canTransferArrayBuffer(),(function(n){var a,o=e.wasmBinary;defined(o)&&n&&(a=[o]),r.onmessage=function(e){r.onmessage=function(e){completeTask(i,e.data)},t.resolve(e.data)},r.postMessage({webAssemblyConfig:e},a)}))})),t},TaskProcessor.prototype.isDestroyed=function(){return!1},TaskProcessor.prototype.destroy=function(){return defined(this._worker)&&this._worker.terminate(),destroyObject(this)},TaskProcessor.taskCompletedEvent=taskCompletedEvent,TaskProcessor._defaultWorkerModulePrefix="Workers/",TaskProcessor._workerModulePrefix=TaskProcessor._defaultWorkerModulePrefix,TaskProcessor._canTransferArrayBuffer=void 0,Object.defineProperties(TerrainData.prototype,{credits:{get:DeveloperError.throwInstantiationError},waterMask:{get:DeveloperError.throwInstantiationError}}),TerrainData.prototype.interpolateHeight=DeveloperError.throwInstantiationError,TerrainData.prototype.isChildAvailable=DeveloperError.throwInstantiationError,TerrainData.prototype.createMesh=DeveloperError.throwInstantiationError,TerrainData.prototype.upsample=DeveloperError.throwInstantiationError,TerrainData.prototype.wasCreatedByUpsampling=DeveloperError.throwInstantiationError,TerrainData.maximumAsynchronousTasks=5;var IndexDatatype={UNSIGNED_BYTE:WebGLConstants$1.UNSIGNED_BYTE,UNSIGNED_SHORT:WebGLConstants$1.UNSIGNED_SHORT,UNSIGNED_INT:WebGLConstants$1.UNSIGNED_INT,getSizeInBytes:function(e){switch(e){case IndexDatatype.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case IndexDatatype.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case IndexDatatype.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},fromSizeInBytes:function(e){switch(e){case 2:return IndexDatatype.UNSIGNED_SHORT;case 4:return IndexDatatype.UNSIGNED_INT;case 1:return IndexDatatype.UNSIGNED_BYTE}},validate:function(e){return defined(e)&&(e===IndexDatatype.UNSIGNED_BYTE||e===IndexDatatype.UNSIGNED_SHORT||e===IndexDatatype.UNSIGNED_INT)},createTypedArray:function(e,t){return e>=CesiumMath.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},createTypedArrayFromArrayBuffer:function(e,t,i,r){return e>=CesiumMath.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,i,r):new Uint16Array(t,i,r)}},IndexDatatype$1=Object.freeze(IndexDatatype);function TerrainProvider(){DeveloperError.throwInstantiationError()}Object.defineProperties(TerrainProvider.prototype,{errorEvent:{get:DeveloperError.throwInstantiationError},credit:{get:DeveloperError.throwInstantiationError},tilingScheme:{get:DeveloperError.throwInstantiationError},ready:{get:DeveloperError.throwInstantiationError},readyPromise:{get:DeveloperError.throwInstantiationError},hasWaterMask:{get:DeveloperError.throwInstantiationError},hasVertexNormals:{get:DeveloperError.throwInstantiationError},availability:{get:DeveloperError.throwInstantiationError}});var regularGridIndicesCache=[];TerrainProvider.getRegularGridIndices=function(e,t){var i=regularGridIndicesCache[e];defined(i)||(regularGridIndicesCache[e]=i=[]);var r=i[t];return defined(r)||addRegularGridIndices(e,t,r=e*t<CesiumMath.SIXTY_FOUR_KILOBYTES?i[t]=new Uint16Array((e-1)*(t-1)*6):i[t]=new Uint32Array((e-1)*(t-1)*6),0),r};var regularGridAndEdgeIndicesCache=[];TerrainProvider.getRegularGridIndicesAndEdgeIndices=function(e,t){var i=regularGridAndEdgeIndicesCache[e];defined(i)||(regularGridAndEdgeIndicesCache[e]=i=[]);var r=i[t];if(!defined(r)){var n=TerrainProvider.getRegularGridIndices(e,t),a=getEdgeIndices(e,t),o=a.westIndicesSouthToNorth,s=a.southIndicesEastToWest,l=a.eastIndicesNorthToSouth,c=a.northIndicesWestToEast;r=i[t]={indices:n,westIndicesSouthToNorth:o,southIndicesEastToWest:s,eastIndicesNorthToSouth:l,northIndicesWestToEast:c}}return r};var regularGridAndSkirtAndEdgeIndicesCache=[];function getEdgeIndices(e,t){var i,r=new Array(t),n=new Array(e),a=new Array(t),o=new Array(e);for(i=0;i<e;++i)o[i]=i,n[i]=e*t-1-i;for(i=0;i<t;++i)a[i]=(i+1)*e-1,r[i]=(t-i-1)*e;return{westIndicesSouthToNorth:r,southIndicesEastToWest:n,eastIndicesNorthToSouth:a,northIndicesWestToEast:o}}function addRegularGridIndices(e,t,i,r){for(var n=0,a=0;a<t-1;++a){for(var o=0;o<e-1;++o){var s=n,l=s+e,c=l+1,u=s+1;i[r++]=s,i[r++]=l,i[r++]=u,i[r++]=u,i[r++]=l,i[r++]=c,++n}++n}}function addSkirtIndices(e,t,i,r){for(var n=e[0],a=e.length,o=1;o<a;++o){var s=e[o];i[r++]=n,i[r++]=s,i[r++]=t,i[r++]=t,i[r++]=s,i[r++]=t+1,n=s,++t}return r}function HeightmapTerrainData(e){this._buffer=e.buffer,this._width=e.width,this._height=e.height,this._childTileMask=defaultValue(e.childTileMask,15),this._encoding=defaultValue(e.encoding,HeightmapEncoding$1.NONE);var t=HeightmapTessellator.DEFAULT_STRUCTURE,i=e.structure;defined(i)?i!==t&&(i.heightScale=defaultValue(i.heightScale,t.heightScale),i.heightOffset=defaultValue(i.heightOffset,t.heightOffset),i.elementsPerHeight=defaultValue(i.elementsPerHeight,t.elementsPerHeight),i.stride=defaultValue(i.stride,t.stride),i.elementMultiplier=defaultValue(i.elementMultiplier,t.elementMultiplier),i.isBigEndian=defaultValue(i.isBigEndian,t.isBigEndian)):i=t,this._structure=i,this._createdByUpsampling=defaultValue(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._skirtHeight=void 0,this._bufferType=this._encoding===HeightmapEncoding$1.LERC?Float32Array:this._buffer.constructor,this._mesh=void 0}TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){var i=regularGridAndSkirtAndEdgeIndicesCache[e];defined(i)||(regularGridAndSkirtAndEdgeIndicesCache[e]=i=[]);var r=i[t];if(!defined(r)){var n=e*t,a=(e-1)*(t-1)*6,o=2*e+2*t,s=n+o,l=a+6*Math.max(0,o-4),c=getEdgeIndices(e,t),u=c.westIndicesSouthToNorth,d=c.southIndicesEastToWest,h=c.eastIndicesNorthToSouth,p=c.northIndicesWestToEast,f=IndexDatatype$1.createTypedArray(s,l);addRegularGridIndices(e,t,f,0),TerrainProvider.addSkirtIndices(u,d,h,p,n,f,a),r=i[t]={indices:f,westIndicesSouthToNorth:u,southIndicesEastToWest:d,eastIndicesNorthToSouth:h,northIndicesWestToEast:p,indexCountWithoutSkirts:a}}return r},TerrainProvider.addSkirtIndices=function(e,t,i,r,n,a,o){var s=n;o=addSkirtIndices(e,s,a,o),o=addSkirtIndices(t,s+=e.length,a,o),o=addSkirtIndices(i,s+=t.length,a,o),addSkirtIndices(r,s+=i.length,a,o)},TerrainProvider.heightmapTerrainQuality=.25,TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,i){return 2*e.maximumRadius*Math.PI*TerrainProvider.heightmapTerrainQuality/(t*i)},TerrainProvider.prototype.requestTileGeometry=DeveloperError.throwInstantiationError,TerrainProvider.prototype.getLevelMaximumGeometricError=DeveloperError.throwInstantiationError,TerrainProvider.prototype.getTileDataAvailable=DeveloperError.throwInstantiationError,TerrainProvider.prototype.loadTileDataAvailability=DeveloperError.throwInstantiationError,Object.defineProperties(HeightmapTerrainData.prototype,{credits:{get:function(){}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}}});var createMeshTaskName$2="createVerticesFromHeightmap",createMeshTaskProcessorNoThrottle$2=new TaskProcessor(createMeshTaskName$2),createMeshTaskProcessorThrottle$2=new TaskProcessor(createMeshTaskName$2,TerrainData.maximumAsynchronousTasks);function interpolateHeight$2(e,t,i,r,n,a,o,s,l,c){var u=(l-a.west)*(o-1)/(a.east-a.west),d=(c-a.south)*(s-1)/(a.north-a.south),h=0|u,p=h+1;p>=o&&(p=o-1,h=o-2);var f=0|d,m=f+1;return m>=s&&(m=s-1,f=s-2),m=s-1-m,triangleInterpolateHeight(u-h,d-f,getHeight(e,t,i,r,n,(f=s-1-f)*o+h),getHeight(e,t,i,r,n,f*o+p),getHeight(e,t,i,r,n,m*o+h),getHeight(e,t,i,r,n,m*o+p))}function interpolateMeshHeight$2(e,t,i,r,n,a,o,s,l){var c=(s-n.west)*(a-1)/(n.east-n.west),u=(l-n.south)*(o-1)/(n.north-n.south),d=0|c,h=d+1;h>=a&&(h=a-1,d=a-2);var p=0|u,f=p+1;f>=o&&(f=o-1,p=o-2);var m=u-p;return p=o-1-p,f=o-1-f,triangleInterpolateHeight(c-d,m,(t.decodeHeight(e,p*a+d)-i)/r,(t.decodeHeight(e,p*a+h)-i)/r,(t.decodeHeight(e,f*a+d)-i)/r,(t.decodeHeight(e,f*a+h)-i)/r)}function triangleInterpolateHeight(e,t,i,r,n,a){return t<e?i+e*(r-i)+t*(a-r):i+e*(a-n)+t*(n-i)}function getHeight(e,t,i,r,n,a){a*=r;var o,s=0;if(n)for(o=0;o<t;++o)s=s*i+e[a+o];else for(o=t-1;o>=0;--o)s=s*i+e[a+o];return s}function setHeight(e,t,i,r,n,a,o,s){var l;if(o*=n,a)for(l=0;l<t-1;++l)e[o+l]=s/r|0,s-=e[o+l]*r,r/=i;else for(l=t-1;l>0;--l)e[o+l]=s/r|0,s-=e[o+l]*r,r/=i;e[o+l]=s}function TileAvailability(e,t){this._tilingScheme=e,this._maximumLevel=t,this._rootNodes=[]}HeightmapTerrainData.prototype.createMesh=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).tilingScheme,i=e.x,r=e.y,n=e.level,a=defaultValue(e.exaggeration,1),o=defaultValue(e.exaggerationRelativeHeight,0),s=defaultValue(e.throttle,!0),l=t.ellipsoid,c=t.tileXYToNativeRectangle(i,r,n),u=t.tileXYToRectangle(i,r,n),d=l.cartographicToCartesian(Rectangle.center(u)),h=this._structure,p=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(l,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<n);this._skirtHeight=Math.min(4*p,1e3);var f=(s?createMeshTaskProcessorThrottle$2:createMeshTaskProcessorNoThrottle$2).scheduleTask({heightmap:this._buffer,structure:h,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:c,rectangle:u,relativeToCenter:d,ellipsoid:l,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof GeographicProjection,exaggeration:a,exaggerationRelativeHeight:o,encoding:this._encoding});if(defined(f)){var m=this;return when(f,(function(e){var t;t=m._skirtHeight>0?TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices(e.gridWidth,e.gridHeight):TerrainProvider.getRegularGridIndicesAndEdgeIndices(e.gridWidth,e.gridHeight);var i=e.gridWidth*e.gridHeight;return m._mesh=new TerrainMesh(d,new Float32Array(e.vertices),t.indices,t.indexCountWithoutSkirts,i,e.minimumHeight,e.maximumHeight,BoundingSphere.clone(e.boundingSphere3D),Cartesian3.clone(e.occludeePointInScaledSpace),e.numberOfAttributes,OrientedBoundingBox.clone(e.orientedBoundingBox),TerrainEncoding.clone(e.encoding),t.westIndicesSouthToNorth,t.southIndicesEastToWest,t.eastIndicesNorthToSouth,t.northIndicesWestToEast),m._buffer=void 0,m._mesh}))}},HeightmapTerrainData.prototype._createMeshSync=function(e){var t=e.tilingScheme,i=e.x,r=e.y,n=e.level,a=defaultValue(e.exaggeration,1),o=defaultValue(e.exaggerationRelativeHeight,0),s=t.ellipsoid,l=t.tileXYToNativeRectangle(i,r,n),c=t.tileXYToRectangle(i,r,n),u=s.cartographicToCartesian(Rectangle.center(c)),d=this._structure,h=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(s,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<n);this._skirtHeight=Math.min(4*h,1e3);var p,f=HeightmapTessellator.computeVertices({heightmap:this._buffer,structure:d,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:l,rectangle:c,relativeToCenter:u,ellipsoid:s,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof GeographicProjection,exaggeration:a,exaggerationRelativeHeight:o});this._buffer=void 0,p=this._skirtHeight>0?TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices(this._width,this._height):TerrainProvider.getRegularGridIndicesAndEdgeIndices(this._width,this._height);var m=f.gridWidth*f.gridHeight;return this._mesh=new TerrainMesh(u,f.vertices,p.indices,p.indexCountWithoutSkirts,m,f.minimumHeight,f.maximumHeight,f.boundingSphere3D,f.occludeePointInScaledSpace,f.encoding.stride,f.orientedBoundingBox,f.encoding,p.westIndicesSouthToNorth,p.southIndicesEastToWest,p.eastIndicesNorthToSouth,p.northIndicesWestToEast),this._mesh},HeightmapTerrainData.prototype.interpolateHeight=function(e,t,i){var r=this._width,n=this._height,a=this._structure,o=a.stride,s=a.elementsPerHeight,l=a.elementMultiplier,c=a.isBigEndian,u=a.heightOffset,d=a.heightScale,h=defined(this._mesh),p=this._encoding===HeightmapEncoding$1.LERC;if(!(!h&&p)){var f;if(h)f=interpolateMeshHeight$2(this._mesh.vertices,this._mesh.encoding,u,d,e,r,n,t,i);else f=(f=interpolateHeight$2(this._buffer,s,l,o,c,e,r,n,t,i))*d+u;return f}},HeightmapTerrainData.prototype.upsample=function(e,t,i,r,n,a,o){var s=this._mesh;if(defined(s)){for(var l=this._width,c=this._height,u=this._structure,d=u.stride,h=new this._bufferType(l*c*d),p=s.vertices,f=s.encoding,m=e.tileXYToRectangle(t,i,r),g=e.tileXYToRectangle(n,a,o),_=u.heightOffset,y=u.heightScale,v=u.elementsPerHeight,C=u.elementMultiplier,T=u.isBigEndian,S=Math.pow(C,v-1),A=0;A<c;++A)for(var x=CesiumMath.lerp(g.north,g.south,A/(c-1)),E=0;E<l;++E){var b=interpolateMeshHeight$2(p,f,_,y,m,l,c,CesiumMath.lerp(g.west,g.east,E/(l-1)),x);setHeight(h,v,C,S,d,T,A*l+E,b=(b=b<u.lowestEncodedHeight?u.lowestEncodedHeight:b)>u.highestEncodedHeight?u.highestEncodedHeight:b)}return new HeightmapTerrainData({buffer:h,width:l,height:c,childTileMask:0,structure:this._structure,createdByUpsampling:!0})}},HeightmapTerrainData.prototype.isChildAvailable=function(e,t,i,r){var n=2;return i!==2*e&&++n,r!==2*t&&(n-=2),0!=(this._childTileMask&1<<n)},HeightmapTerrainData.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};var rectangleScratch$7=new Rectangle;function findNode$1(e,t,i,r){for(var n=r.length,a=0;a<n;++a){var o=r[a];if(o.x===t&&o.y===i&&o.level===e)return!0}return!1}TileAvailability.prototype.addAvailableTileRange=function(e,t,i,r,n){var a=this._tilingScheme,o=this._rootNodes;if(0===e)for(var s=i;s<=n;++s)for(var l=t;l<=r;++l)findNode$1(e,l,s,o)||o.push(new QuadtreeNode(a,void 0,0,l,s));a.tileXYToRectangle(t,i,e,rectangleScratch$7);var c=rectangleScratch$7.west,u=rectangleScratch$7.north;a.tileXYToRectangle(r,n,e,rectangleScratch$7);for(var d=rectangleScratch$7.east,h=new RectangleWithLevel(e,c,rectangleScratch$7.south,d,u),p=0;p<o.length;++p){var f=o[p];rectanglesOverlap(f.extent,h)&&putRectangleInQuadtree(this._maximumLevel,f,h)}},TileAvailability.prototype.computeMaximumLevelAtPosition=function(e){for(var t,i=0;i<this._rootNodes.length;++i){var r=this._rootNodes[i];if(rectangleContainsPosition(r.extent,e)){t=r;break}}return defined(t)?findMaxLevelFromNode(void 0,t,e):-1};var rectanglesScratch=[],remainingToCoverByLevelScratch=[],westScratch$1=new Rectangle,eastScratch=new Rectangle;TileAvailability.prototype.computeBestAvailableLevelOverRectangle=function(e){var t=rectanglesScratch;t.length=0,e.east<e.west?(t.push(Rectangle.fromRadians(-Math.PI,e.south,e.east,e.north,westScratch$1)),t.push(Rectangle.fromRadians(e.west,e.south,Math.PI,e.north,eastScratch))):t.push(e);var i,r=remainingToCoverByLevelScratch;for(r.length=0,i=0;i<this._rootNodes.length;++i)updateCoverageWithNode(r,this._rootNodes[i],t);for(i=r.length-1;i>=0;--i)if(defined(r[i])&&0===r[i].length)return i;return 0};var cartographicScratch$5=new Cartographic;function QuadtreeNode(e,t,i,r,n){this.tilingScheme=e,this.parent=t,this.level=i,this.x=r,this.y=n,this.extent=e.tileXYToRectangle(r,n,i),this.rectangles=[],this._sw=void 0,this._se=void 0,this._nw=void 0,this._ne=void 0}function RectangleWithLevel(e,t,i,r,n){this.level=e,this.west=t,this.south=i,this.east=r,this.north=n}function rectanglesOverlap(e,t){var i=Math.max(e.west,t.west),r=Math.max(e.south,t.south),n=Math.min(e.east,t.east);return r<Math.min(e.north,t.north)&&i<n}function putRectangleInQuadtree(e,t,i){for(;t.level<e;)if(rectangleFullyContainsRectangle(t.nw.extent,i))t=t.nw;else if(rectangleFullyContainsRectangle(t.ne.extent,i))t=t.ne;else if(rectangleFullyContainsRectangle(t.sw.extent,i))t=t.sw;else{if(!rectangleFullyContainsRectangle(t.se.extent,i))break;t=t.se}if(0===t.rectangles.length||t.rectangles[t.rectangles.length-1].level<=i.level)t.rectangles.push(i);else{var r=binarySearch(t.rectangles,i.level,rectangleLevelComparator);r<0&&(r=~r),t.rectangles.splice(r,0,i)}}function rectangleLevelComparator(e,t){return e.level-t}function rectangleFullyContainsRectangle(e,t){return t.west>=e.west&&t.east<=e.east&&t.south>=e.south&&t.north<=e.north}function rectangleContainsPosition(e,t){return t.longitude>=e.west&&t.longitude<=e.east&&t.latitude>=e.south&&t.latitude<=e.north}function findMaxLevelFromNode(e,t,i){for(var r=0,n=!1;!n;){var a=t._nw&&rectangleContainsPosition(t._nw.extent,i),o=t._ne&&rectangleContainsPosition(t._ne.extent,i),s=t._sw&&rectangleContainsPosition(t._sw.extent,i),l=t._se&&rectangleContainsPosition(t._se.extent,i);if(a+o+s+l>1){a&&(r=Math.max(r,findMaxLevelFromNode(t,t._nw,i))),o&&(r=Math.max(r,findMaxLevelFromNode(t,t._ne,i))),s&&(r=Math.max(r,findMaxLevelFromNode(t,t._sw,i))),l&&(r=Math.max(r,findMaxLevelFromNode(t,t._se,i)));break}a?t=t._nw:o?t=t._ne:s?t=t._sw:l?t=t._se:n=!0}for(;t!==e;){for(var c=t.rectangles,u=c.length-1;u>=0&&c[u].level>r;--u){var d=c[u];rectangleContainsPosition(d,i)&&(r=d.level)}t=t.parent}return r}function updateCoverageWithNode(e,t,i){if(t){var r,n=!1;for(r=0;r<i.length;++r)n=n||rectanglesOverlap(t.extent,i[r]);if(n){var a=t.rectangles;for(r=0;r<a.length;++r){var o=a[r];e[o.level]||(e[o.level]=i),e[o.level]=subtractRectangle(e[o.level],o)}updateCoverageWithNode(e,t._nw,i),updateCoverageWithNode(e,t._ne,i),updateCoverageWithNode(e,t._sw,i),updateCoverageWithNode(e,t._se,i)}}}function subtractRectangle(e,t){for(var i=[],r=0;r<e.length;++r){var n=e[r];rectanglesOverlap(n,t)?(n.west<t.west&&i.push(new Rectangle(n.west,n.south,t.west,n.north)),n.east>t.east&&i.push(new Rectangle(t.east,n.south,n.east,n.north)),n.south<t.south&&i.push(new Rectangle(Math.max(t.west,n.west),n.south,Math.min(t.east,n.east),t.south)),n.north>t.north&&i.push(new Rectangle(Math.max(t.west,n.west),t.north,Math.min(t.east,n.east),n.north))):i.push(n)}return i}function formatError(e){var t,i=e.name,r=e.message;t=defined(i)&&defined(r)?i+": "+r:e.toString();var n=e.stack;return defined(n)&&(t+="\n"+n),t}function TileProviderError(e,t,i,r,n,a,o){this.provider=e,this.message=t,this.x=i,this.y=r,this.level=n,this.timesRetried=defaultValue(a,0),this.retry=!1,this.error=o}function WebMercatorTilingScheme(e){if(e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._numberOfLevelZeroTilesX=defaultValue(e.numberOfLevelZeroTilesX,1),this._numberOfLevelZeroTilesY=defaultValue(e.numberOfLevelZeroTilesY,1),this._projection=new WebMercatorProjection(this._ellipsoid),defined(e.rectangleSouthwestInMeters)&&defined(e.rectangleNortheastInMeters))this._rectangleSouthwestInMeters=e.rectangleSouthwestInMeters,this._rectangleNortheastInMeters=e.rectangleNortheastInMeters;else{var t=this._ellipsoid.maximumRadius*Math.PI;this._rectangleSouthwestInMeters=new Cartesian2(-t,-t),this._rectangleNortheastInMeters=new Cartesian2(t,t)}var i=this._projection.unproject(this._rectangleSouthwestInMeters),r=this._projection.unproject(this._rectangleNortheastInMeters);this._rectangle=new Rectangle(i.longitude,i.latitude,r.longitude,r.latitude)}TileAvailability.prototype.isTileAvailable=function(e,t,i){var r=this._tilingScheme.tileXYToRectangle(t,i,e,rectangleScratch$7);return Rectangle.center(r,cartographicScratch$5),this.computeMaximumLevelAtPosition(cartographicScratch$5)>=e},TileAvailability.prototype.computeChildMaskForTile=function(e,t,i){var r=e+1;if(r>=this._maximumLevel)return 0;var n=0;return n|=this.isTileAvailable(r,2*t,2*i+1)?1:0,n|=this.isTileAvailable(r,2*t+1,2*i+1)?2:0,n|=this.isTileAvailable(r,2*t,2*i)?4:0,n|=this.isTileAvailable(r,2*t+1,2*i)?8:0},Object.defineProperties(QuadtreeNode.prototype,{nw:{get:function(){return this._nw||(this._nw=new QuadtreeNode(this.tilingScheme,this,this.level+1,2*this.x,2*this.y)),this._nw}},ne:{get:function(){return this._ne||(this._ne=new QuadtreeNode(this.tilingScheme,this,this.level+1,2*this.x+1,2*this.y)),this._ne}},sw:{get:function(){return this._sw||(this._sw=new QuadtreeNode(this.tilingScheme,this,this.level+1,2*this.x,2*this.y+1)),this._sw}},se:{get:function(){return this._se||(this._se=new QuadtreeNode(this.tilingScheme,this,this.level+1,2*this.x+1,2*this.y+1)),this._se}}}),TileProviderError.handleError=function(e,t,i,r,n,a,o,s,l){var c=e;return defined(e)?(c.provider=t,c.message=r,c.x=n,c.y=a,c.level=o,c.retry=!1,c.error=l,++c.timesRetried):c=new TileProviderError(t,r,n,a,o,0,l),i.numberOfListeners>0?i.raiseEvent(c):console.log('An error occurred in "'+t.constructor.name+'": '+formatError(r)),c.retry&&defined(s)&&s(),c},TileProviderError.handleSuccess=function(e){defined(e)&&(e.timesRetried=-1)},Object.defineProperties(WebMercatorTilingScheme.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),WebMercatorTilingScheme.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},WebMercatorTilingScheme.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},WebMercatorTilingScheme.prototype.rectangleToNativeRectangle=function(e,t){var i=this._projection,r=i.project(Rectangle.southwest(e)),n=i.project(Rectangle.northeast(e));return defined(t)?(t.west=r.x,t.south=r.y,t.east=n.x,t.north=n.y,t):new Rectangle(r.x,r.y,n.x,n.y)},WebMercatorTilingScheme.prototype.tileXYToNativeRectangle=function(e,t,i,r){var n=this.getNumberOfXTilesAtLevel(i),a=this.getNumberOfYTilesAtLevel(i),o=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/n,s=this._rectangleSouthwestInMeters.x+e*o,l=this._rectangleSouthwestInMeters.x+(e+1)*o,c=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/a,u=this._rectangleNortheastInMeters.y-t*c,d=this._rectangleNortheastInMeters.y-(t+1)*c;return defined(r)?(r.west=s,r.south=d,r.east=l,r.north=u,r):new Rectangle(s,d,l,u)},WebMercatorTilingScheme.prototype.tileXYToRectangle=function(e,t,i,r){var n=this.tileXYToNativeRectangle(e,t,i,r),a=this._projection,o=a.unproject(new Cartesian2(n.west,n.south)),s=a.unproject(new Cartesian2(n.east,n.north));return n.west=o.longitude,n.south=o.latitude,n.east=s.longitude,n.north=s.latitude,n},WebMercatorTilingScheme.prototype.positionToTileXY=function(e,t,i){var r=this._rectangle;if(Rectangle.contains(r,e)){var n=this.getNumberOfXTilesAtLevel(t),a=this.getNumberOfYTilesAtLevel(t),o=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/n,s=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/a,l=this._projection.project(e),c=(l.x-this._rectangleSouthwestInMeters.x)/o|0;c>=n&&(c=n-1);var u=(this._rectangleNortheastInMeters.y-l.y)/s|0;return u>=a&&(u=a-1),defined(i)?(i.x=c,i.y=u,i):new Cartesian2(c,u)}};var ALL_CHILDREN=15;function ArcGISTiledElevationTerrainProvider(e){this._resource=void 0,this._credit=void 0,this._tilingScheme=void 0,this._levelZeroMaximumGeometricError=void 0,this._maxLevel=void 0,this._terrainDataStructure=void 0,this._ready=!1,this._width=void 0,this._height=void 0,this._encoding=void 0;var t=e.token;this._hasAvailability=!1,this._tilesAvailable=void 0,this._tilesAvailablityLoaded=void 0,this._availableCache={};var i=this,r=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this._readyPromise=when(e.url).then((function(e){var r=Resource.createIfNeeded(e);return r.appendForwardSlash(),defined(t)&&(r=r.getDerivedResource({queryParameters:{token:t}})),i._resource=r,r.getDerivedResource({queryParameters:{f:"pjson"}}).fetchJson()})).then((function(e){var t=e.copyrightText;defined(t)&&(i._credit=new Credit(t));var n=e.spatialReference,a=defaultValue(n.latestWkid,n.wkid),o=e.extent,s={ellipsoid:r};if(4326===a)s.rectangle=Rectangle.fromDegrees(o.xmin,o.ymin,o.xmax,o.ymax),i._tilingScheme=new GeographicTilingScheme(s);else{if(3857!==a)return when.reject(new RuntimeError("Invalid spatial reference"));s.rectangleSouthwestInMeters=new Cartesian2(o.xmin,o.ymin),s.rectangleNortheastInMeters=new Cartesian2(o.xmax,o.ymax),i._tilingScheme=new WebMercatorTilingScheme(s)}var l=e.tileInfo;return defined(l)?(i._width=l.rows+1,i._height=l.cols+1,i._encoding="LERC"===l.format?HeightmapEncoding$1.LERC:HeightmapEncoding$1.NONE,i._lodCount=l.lods.length-1,(i._hasAvailability=-1!==e.capabilities.indexOf("Tilemap"))&&(i._tilesAvailable=new TileAvailability(i._tilingScheme,i._lodCount),i._tilesAvailable.addAvailableTileRange(0,0,0,i._tilingScheme.getNumberOfXTilesAtLevel(0),i._tilingScheme.getNumberOfYTilesAtLevel(0)),i._tilesAvailablityLoaded=new TileAvailability(i._tilingScheme,i._lodCount)),i._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(i._tilingScheme.ellipsoid,i._width,i._tilingScheme.getNumberOfXTilesAtLevel(0)),e.bandCount>1&&console.log("ArcGISTiledElevationTerrainProvider: Terrain data has more than 1 band. Using the first one."),i._terrainDataStructure={elementMultiplier:1,lowestEncodedHeight:e.minValues[0],highestEncodedHeight:e.maxValues[0]},i._ready=!0,!0):when.reject(new RuntimeError("tileInfo is required"))})).otherwise((function(e){var t="An error occurred while accessing "+i._resource.url+".";return TileProviderError.handleError(void 0,i,i._errorEvent,t),when.reject(e)})),this._errorEvent=new Event}function isTileAvailable(e,t,i,r){if(e._hasAvailability){var n=e._tilesAvailablityLoaded,a=e._tilesAvailable;return!(t>e._lodCount)&&(!!a.isTileAvailable(t,i,r)||!n.isTileAvailable(t,i,r)&&void 0)}}function findRange(e,t,i,r){for(var n=t-1,a=i-1,o=r[e.y*t+e.x],s=[],l={startX:e.x,startY:e.y,endX:0,endY:0},c=new Cartesian2(e.x+1,e.y+1),u=!1,d=!1;!u||!d;){var h=c.x,p=d?c.y+1:c.y;if(!u){for(var f=e.y;f<p;++f)if(r[f*t+c.x]!==o){u=!0;break}u?(s.push(new Cartesian2(c.x,e.y)),--c.x,--h,l.endX=c.x):c.x===n?(l.endX=c.x,u=!0):++c.x}if(!d){for(var m=c.y*t,g=e.x;g<=h;++g)if(r[m+g]!==o){d=!0;break}d?(s.push(new Cartesian2(e.x,c.y)),--c.y,l.endY=c.y):c.y===a?(l.endY=c.y,d=!0):++c.y}}return{endingIndices:s,range:l,value:o}}function computeAvailability(e,t,i,r,n){var a=[];if(n.every((function(e){return e===n[0]})))return 1===n[0]&&a.push({startX:e,startY:t,endX:e+i-1,endY:t+r-1}),a;for(var o=[new Cartesian2(0,0)];o.length>0;){var s=findRange(o.pop(),i,r,n);if(1===s.value){var l=s.range;l.startX+=e,l.endX+=e,l.startY+=t,l.endY+=t,a.push(l)}var c=s.endingIndices;c.length>0&&(o=o.concat(c))}return a}function requestAvailability(e,t,i,r){if(!e._hasAvailability)return{};var n=128*Math.floor(i/128),a=128*Math.floor(r/128),o=Math.min(1<<t,128),s="tilemap/"+t+"/"+a+"/"+n+"/"+o+"/"+o,l=e._availableCache;if(defined(l[s]))return l[s];var c=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.TERRAIN}),u=e._resource.getDerivedResource({url:s,request:c}).fetchJson();return defined(u)?(u=u.then((function(s){var l=computeAvailability(n,a,o,o,s.data);e._tilesAvailablityLoaded.addAvailableTileRange(t,n,a,n+o,a+o);for(var c=e._tilesAvailable,u=0;u<l.length;++u){var d=l[u];c.addAvailableTileRange(t,d.startX,d.startY,d.endX,d.endY)}return isTileAvailable(e,t,i,r)})),l[s]={promise:u,request:c},{promise:u=u.always((function(e){return delete l[s],e})),request:c}):{}}Object.defineProperties(ArcGISTiledElevationTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){return this._tilesAvailable}}}),ArcGISTiledElevationTerrainProvider.prototype.requestTileGeometry=function(e,t,i,r){var n,a=this._resource.getDerivedResource({url:"tile/"+i+"/"+t+"/"+e,request:r}),o=this._hasAvailability,s=when.resolve(!0);if(o&&!defined(isTileAvailable(this,i+1,2*e,2*t))){var l=requestAvailability(this,i+1,2*e,2*t);s=l.promise,n=l.request}var c=a.fetchArrayBuffer();if(defined(c)&&defined(s)){var u=this,d=this._tilesAvailable;return when.join(c,s).then((function(r){return new HeightmapTerrainData({buffer:r[0],width:u._width,height:u._height,childTileMask:o?d.computeChildMaskForTile(i,e,t):ALL_CHILDREN,structure:u._terrainDataStructure,encoding:u._encoding})})).otherwise((function(e){return defined(n)&&n.state===RequestState$1.CANCELLED?(r.cancel(),r.deferred.promise.always((function(){return r.state=RequestState$1.CANCELLED,when.reject(e)}))):when.reject(e)}))}},ArcGISTiledElevationTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},ArcGISTiledElevationTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){if(this._hasAvailability){var r=isTileAvailable(this,i,e,t);if(defined(r))return r;requestAvailability(this,i,e,t)}},ArcGISTiledElevationTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){};var ArcType={NONE:0,GEODESIC:1,RHUMB:2},ArcType$1=Object.freeze(ArcType);function arrayFill(e,t,i,r){if("function"==typeof e.fill)return e.fill(t,i,r);for(var n=e.length>>>0,a=defaultValue(i,0),o=a<0?Math.max(n+a,0):Math.min(a,n),s=defaultValue(r,n),l=s<0?Math.max(n+s,0):Math.min(s,n);o<l;)e[o]=t,o++;return e}var removeDuplicatesEpsilon=CesiumMath.EPSILON10;function arrayRemoveDuplicates(e,t,i,r){if(defined(e)){i=defaultValue(i,!1);var n,a=defined(r),o=e.length;if(o<2)return e;var s,l,c=e[0],u=0,d=-1;for(n=1;n<o;++n)t(c,s=e[n],removeDuplicatesEpsilon)?(defined(l)||(l=e.slice(0,n),u=n-1,d=0),a&&r.push(n)):(defined(l)&&(l.push(s),u=n,a&&(d=r.length)),c=s);return i&&t(e[0],e[o-1],removeDuplicatesEpsilon)&&(a&&(defined(l)?r.splice(d,0,u):r.push(o-1)),defined(l)?l.length-=1:l=e.slice(0,-1)),defined(l)?l:e}}function arraySlice(e,t,i){if("function"==typeof e.slice)return e.slice(t,i);for(var r=Array.prototype.slice.call(e,t,i),n=FeatureDetection.typedArrayTypes,a=n.length,o=0;o<a;++o)if(e instanceof n[o]){r=new n[o](r);break}return r}function AssociativeArray(){this._array=[],this._hash={}}Object.defineProperties(AssociativeArray.prototype,{length:{get:function(){return this._array.length}},values:{get:function(){return this._array}}}),AssociativeArray.prototype.contains=function(e){return defined(this._hash[e])},AssociativeArray.prototype.set=function(e,t){t!==this._hash[e]&&(this.remove(e),this._hash[e]=t,this._array.push(t))},AssociativeArray.prototype.get=function(e){return this._hash[e]},AssociativeArray.prototype.remove=function(e){var t=this._hash[e],i=defined(t);if(i){var r=this._array;r.splice(r.indexOf(t),1),delete this._hash[e]}return i},AssociativeArray.prototype.removeAll=function(){var e=this._array;e.length>0&&(this._hash={},e.length=0)};var scratchCartesian1$7=new Cartesian3,scratchCartesian2$a=new Cartesian3,scratchCartesian3$b=new Cartesian3;function barycentricCoordinates(e,t,i,r,n){var a,o,s,l,c,u,d,h;if(defined(n)||(n=new Cartesian3),defined(t.z)){if(Cartesian3.equalsEpsilon(e,t,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_X,n);if(Cartesian3.equalsEpsilon(e,i,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_Y,n);if(Cartesian3.equalsEpsilon(e,r,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_Z,n);a=Cartesian3.subtract(i,t,scratchCartesian1$7),o=Cartesian3.subtract(r,t,scratchCartesian2$a),s=Cartesian3.subtract(e,t,scratchCartesian3$b),l=Cartesian3.dot(a,a),c=Cartesian3.dot(a,o),u=Cartesian3.dot(a,s),d=Cartesian3.dot(o,o),h=Cartesian3.dot(o,s)}else{if(Cartesian2.equalsEpsilon(e,t,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_X,n);if(Cartesian2.equalsEpsilon(e,i,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_Y,n);if(Cartesian2.equalsEpsilon(e,r,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_Z,n);a=Cartesian2.subtract(i,t,scratchCartesian1$7),o=Cartesian2.subtract(r,t,scratchCartesian2$a),s=Cartesian2.subtract(e,t,scratchCartesian3$b),l=Cartesian2.dot(a,a),c=Cartesian2.dot(a,o),u=Cartesian2.dot(a,s),d=Cartesian2.dot(o,o),h=Cartesian2.dot(o,s)}n.y=d*u-c*h,n.z=l*h-c*u;var p=l*d-c*c;return 0!==n.y&&(n.y/=p),0!==n.z&&(n.z/=p),n.x=1-n.y-n.z,n}var url="https://dev.virtualearth.net/REST/v1/Locations";function BingMapsGeocoderService(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).key;this._key=t;var i={key:t};defined(e.culture)&&(i.culture=e.culture),this._resource=new Resource({url:url,queryParameters:i})}function BoundingRectangle(e,t,i,r){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.width=defaultValue(i,0),this.height=defaultValue(r,0)}Object.defineProperties(BingMapsGeocoderService.prototype,{url:{get:function(){return url}},key:{get:function(){return this._key}}}),BingMapsGeocoderService.prototype.geocode=function(e){return this._resource.getDerivedResource({queryParameters:{query:e}}).fetchJsonp("jsonp").then((function(e){return 0===e.resourceSets.length?[]:e.resourceSets[0].resources.map((function(e){var t=e.bbox,i=t[0],r=t[1],n=t[2],a=t[3];return{displayName:e.name,destination:Rectangle.fromDegrees(r,i,a,n)}}))}))},BoundingRectangle.packedLength=4,BoundingRectangle.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.x,t[i++]=e.y,t[i++]=e.width,t[i]=e.height,t},BoundingRectangle.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new BoundingRectangle),i.x=e[t++],i.y=e[t++],i.width=e[t++],i.height=e[t],i},BoundingRectangle.fromPoints=function(e,t){if(defined(t)||(t=new BoundingRectangle),!defined(e)||0===e.length)return t.x=0,t.y=0,t.width=0,t.height=0,t;for(var i=e.length,r=e[0].x,n=e[0].y,a=e[0].x,o=e[0].y,s=1;s<i;s++){var l=e[s],c=l.x,u=l.y;r=Math.min(c,r),a=Math.max(c,a),n=Math.min(u,n),o=Math.max(u,o)}return t.x=r,t.y=n,t.width=a-r,t.height=o-n,t};var defaultProjection=new GeographicProjection,fromRectangleLowerLeft=new Cartographic,fromRectangleUpperRight=new Cartographic;BoundingRectangle.fromRectangle=function(e,t,i){if(defined(i)||(i=new BoundingRectangle),!defined(e))return i.x=0,i.y=0,i.width=0,i.height=0,i;var r=(t=defaultValue(t,defaultProjection)).project(Rectangle.southwest(e,fromRectangleLowerLeft)),n=t.project(Rectangle.northeast(e,fromRectangleUpperRight));return Cartesian2.subtract(n,r,n),i.x=r.x,i.y=r.y,i.width=n.x,i.height=n.y,i},BoundingRectangle.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new BoundingRectangle(e.x,e.y,e.width,e.height)},BoundingRectangle.union=function(e,t,i){defined(i)||(i=new BoundingRectangle);var r=Math.min(e.x,t.x),n=Math.min(e.y,t.y),a=Math.max(e.x+e.width,t.x+t.width),o=Math.max(e.y+e.height,t.y+t.height);return i.x=r,i.y=n,i.width=a-r,i.height=o-n,i},BoundingRectangle.expand=function(e,t,i){i=BoundingRectangle.clone(e,i);var r=t.x-i.x,n=t.y-i.y;return r>i.width?i.width=r:r<0&&(i.width-=r,i.x=t.x),n>i.height?i.height=n:n<0&&(i.height-=n,i.y=t.y),i},BoundingRectangle.intersect=function(e,t){var i=e.x,r=e.y,n=t.x,a=t.y;return i>n+t.width||i+e.width<n||r+e.height<a||r>a+t.height?Intersect$1.OUTSIDE:Intersect$1.INTERSECTING},BoundingRectangle.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height},BoundingRectangle.prototype.clone=function(e){return BoundingRectangle.clone(this,e)},BoundingRectangle.prototype.intersect=function(e){return BoundingRectangle.intersect(this,e)},BoundingRectangle.prototype.equals=function(e){return BoundingRectangle.equals(this,e)};var GeometryType={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3},GeometryType$1=Object.freeze(GeometryType),PrimitiveType={POINTS:WebGLConstants$1.POINTS,LINES:WebGLConstants$1.LINES,LINE_LOOP:WebGLConstants$1.LINE_LOOP,LINE_STRIP:WebGLConstants$1.LINE_STRIP,TRIANGLES:WebGLConstants$1.TRIANGLES,TRIANGLE_STRIP:WebGLConstants$1.TRIANGLE_STRIP,TRIANGLE_FAN:WebGLConstants$1.TRIANGLE_FAN,validate:function(e){return e===PrimitiveType.POINTS||e===PrimitiveType.LINES||e===PrimitiveType.LINE_LOOP||e===PrimitiveType.LINE_STRIP||e===PrimitiveType.TRIANGLES||e===PrimitiveType.TRIANGLE_STRIP||e===PrimitiveType.TRIANGLE_FAN}},PrimitiveType$1=Object.freeze(PrimitiveType);function Geometry(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=defaultValue(e.primitiveType,PrimitiveType$1.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=defaultValue(e.geometryType,GeometryType$1.NONE),this.boundingSphereCV=e.boundingSphereCV,this.offsetAttribute=e.offsetAttribute}Geometry.computeNumberOfVertices=function(e){var t=-1;for(var i in e.attributes)if(e.attributes.hasOwnProperty(i)&&defined(e.attributes[i])&&defined(e.attributes[i].values)){var r=e.attributes[i];t=r.values.length/r.componentsPerAttribute}return t};var rectangleCenterScratch$3=new Cartographic,enuCenterScratch=new Cartesian3,fixedFrameToEnuScratch=new Matrix4,boundingRectanglePointsCartographicScratch=[new Cartographic,new Cartographic,new Cartographic],boundingRectanglePointsEnuScratch=[new Cartesian2,new Cartesian2,new Cartesian2],points2DScratch$2=[new Cartesian2,new Cartesian2,new Cartesian2],pointEnuScratch=new Cartesian3,enuRotationScratch=new Quaternion,enuRotationMatrixScratch=new Matrix4,rotation2DScratch$1=new Matrix2;function GeometryAttribute(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=defaultValue(e.normalize,!1),this.values=e.values}function GeometryAttributes(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.bitangent=e.bitangent,this.tangent=e.tangent,this.color=e.color}Geometry._textureCoordinateRotationPoints=function(e,t,i,r){var n,a=Rectangle.center(r,rectangleCenterScratch$3),o=Cartographic.toCartesian(a,i,enuCenterScratch),s=Transforms.eastNorthUpToFixedFrame(o,i,fixedFrameToEnuScratch),l=Matrix4.inverse(s,fixedFrameToEnuScratch),c=boundingRectanglePointsEnuScratch,u=boundingRectanglePointsCartographicScratch;u[0].longitude=r.west,u[0].latitude=r.south,u[1].longitude=r.west,u[1].latitude=r.north,u[2].longitude=r.east,u[2].latitude=r.south;var d=pointEnuScratch;for(n=0;n<3;n++)Cartographic.toCartesian(u[n],i,d),d=Matrix4.multiplyByPointAsVector(l,d,d),c[n].x=d.x,c[n].y=d.y;var h=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,-t,enuRotationScratch),p=Matrix3.fromQuaternion(h,enuRotationMatrixScratch),f=e.length,m=Number.POSITIVE_INFINITY,g=Number.POSITIVE_INFINITY,_=Number.NEGATIVE_INFINITY,y=Number.NEGATIVE_INFINITY;for(n=0;n<f;n++)d=Matrix4.multiplyByPointAsVector(l,e[n],d),d=Matrix3.multiplyByVector(p,d,d),m=Math.min(m,d.x),g=Math.min(g,d.y),_=Math.max(_,d.x),y=Math.max(y,d.y);var v=Matrix2.fromRotation(t,rotation2DScratch$1),C=points2DScratch$2;C[0].x=m,C[0].y=g,C[1].x=m,C[1].y=y,C[2].x=_,C[2].y=g;var T=c[0],S=c[2].x-T.x,A=c[1].y-T.y;for(n=0;n<3;n++){var x=C[n];Matrix2.multiplyByVector(v,x,x),x.x=(x.x-T.x)/S,x.y=(x.y-T.y)/A}var E=C[0],b=C[1],P=C[2],D=new Array(6);return Cartesian2.pack(E,D),Cartesian2.pack(b,D,2),Cartesian2.pack(P,D,4),D};var GeometryOffsetAttribute={NONE:0,TOP:1,ALL:2},GeometryOffsetAttribute$1=Object.freeze(GeometryOffsetAttribute);function VertexFormat(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.position=defaultValue(e.position,!1),this.normal=defaultValue(e.normal,!1),this.st=defaultValue(e.st,!1),this.bitangent=defaultValue(e.bitangent,!1),this.tangent=defaultValue(e.tangent,!1),this.color=defaultValue(e.color,!1)}VertexFormat.POSITION_ONLY=Object.freeze(new VertexFormat({position:!0})),VertexFormat.POSITION_AND_NORMAL=Object.freeze(new VertexFormat({position:!0,normal:!0})),VertexFormat.POSITION_NORMAL_AND_ST=Object.freeze(new VertexFormat({position:!0,normal:!0,st:!0})),VertexFormat.POSITION_AND_ST=Object.freeze(new VertexFormat({position:!0,st:!0})),VertexFormat.POSITION_AND_COLOR=Object.freeze(new VertexFormat({position:!0,color:!0})),VertexFormat.ALL=Object.freeze(new VertexFormat({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0})),VertexFormat.DEFAULT=VertexFormat.POSITION_NORMAL_AND_ST,VertexFormat.packedLength=6,VertexFormat.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.position?1:0,t[i++]=e.normal?1:0,t[i++]=e.st?1:0,t[i++]=e.tangent?1:0,t[i++]=e.bitangent?1:0,t[i]=e.color?1:0,t},VertexFormat.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new VertexFormat),i.position=1===e[t++],i.normal=1===e[t++],i.st=1===e[t++],i.tangent=1===e[t++],i.bitangent=1===e[t++],i.color=1===e[t],i},VertexFormat.clone=function(e,t){if(defined(e))return defined(t)||(t=new VertexFormat),t.position=e.position,t.normal=e.normal,t.st=e.st,t.tangent=e.tangent,t.bitangent=e.bitangent,t.color=e.color,t};var diffScratch$1=new Cartesian3;function BoxGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).minimum,i=e.maximum,r=defaultValue(e.vertexFormat,VertexFormat.DEFAULT);this._minimum=Cartesian3.clone(t),this._maximum=Cartesian3.clone(i),this._vertexFormat=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxGeometry"}BoxGeometry.fromDimensions=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).dimensions,i=Cartesian3.multiplyByScalar(t,.5,new Cartesian3);return new BoxGeometry({minimum:Cartesian3.negate(i,new Cartesian3),maximum:i,vertexFormat:e.vertexFormat,offsetAttribute:e.offsetAttribute})},BoxGeometry.fromAxisAlignedBoundingBox=function(e){return new BoxGeometry({minimum:e.minimum,maximum:e.maximum})},BoxGeometry.packedLength=2*Cartesian3.packedLength+VertexFormat.packedLength+1,BoxGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._minimum,t,i),Cartesian3.pack(e._maximum,t,i+Cartesian3.packedLength),VertexFormat.pack(e._vertexFormat,t,i+2*Cartesian3.packedLength),t[i+2*Cartesian3.packedLength+VertexFormat.packedLength]=defaultValue(e._offsetAttribute,-1),t};var scratchMin$3=new Cartesian3,scratchMax$3=new Cartesian3,scratchVertexFormat$c=new VertexFormat,scratchOptions$n={minimum:scratchMin$3,maximum:scratchMax$3,vertexFormat:scratchVertexFormat$c,offsetAttribute:void 0},unitBoxGeometry;BoxGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t,scratchMin$3),n=Cartesian3.unpack(e,t+Cartesian3.packedLength,scratchMax$3),a=VertexFormat.unpack(e,t+2*Cartesian3.packedLength,scratchVertexFormat$c),o=e[t+2*Cartesian3.packedLength+VertexFormat.packedLength];return defined(i)?(i._minimum=Cartesian3.clone(r,i._minimum),i._maximum=Cartesian3.clone(n,i._maximum),i._vertexFormat=VertexFormat.clone(a,i._vertexFormat),i._offsetAttribute=-1===o?void 0:o,i):(scratchOptions$n.offsetAttribute=-1===o?void 0:o,new BoxGeometry(scratchOptions$n))},BoxGeometry.createGeometry=function(e){var t=e._minimum,i=e._maximum,r=e._vertexFormat;if(!Cartesian3.equals(t,i)){var n,a,o=new GeometryAttributes;if(r.position&&(r.st||r.normal||r.tangent||r.bitangent)){if(r.position&&((a=new Float64Array(72))[0]=t.x,a[1]=t.y,a[2]=i.z,a[3]=i.x,a[4]=t.y,a[5]=i.z,a[6]=i.x,a[7]=i.y,a[8]=i.z,a[9]=t.x,a[10]=i.y,a[11]=i.z,a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=i.x,a[16]=t.y,a[17]=t.z,a[18]=i.x,a[19]=i.y,a[20]=t.z,a[21]=t.x,a[22]=i.y,a[23]=t.z,a[24]=i.x,a[25]=t.y,a[26]=t.z,a[27]=i.x,a[28]=i.y,a[29]=t.z,a[30]=i.x,a[31]=i.y,a[32]=i.z,a[33]=i.x,a[34]=t.y,a[35]=i.z,a[36]=t.x,a[37]=t.y,a[38]=t.z,a[39]=t.x,a[40]=i.y,a[41]=t.z,a[42]=t.x,a[43]=i.y,a[44]=i.z,a[45]=t.x,a[46]=t.y,a[47]=i.z,a[48]=t.x,a[49]=i.y,a[50]=t.z,a[51]=i.x,a[52]=i.y,a[53]=t.z,a[54]=i.x,a[55]=i.y,a[56]=i.z,a[57]=t.x,a[58]=i.y,a[59]=i.z,a[60]=t.x,a[61]=t.y,a[62]=t.z,a[63]=i.x,a[64]=t.y,a[65]=t.z,a[66]=i.x,a[67]=t.y,a[68]=i.z,a[69]=t.x,a[70]=t.y,a[71]=i.z,o.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})),r.normal){var s=new Float32Array(72);s[0]=0,s[1]=0,s[2]=1,s[3]=0,s[4]=0,s[5]=1,s[6]=0,s[7]=0,s[8]=1,s[9]=0,s[10]=0,s[11]=1,s[12]=0,s[13]=0,s[14]=-1,s[15]=0,s[16]=0,s[17]=-1,s[18]=0,s[19]=0,s[20]=-1,s[21]=0,s[22]=0,s[23]=-1,s[24]=1,s[25]=0,s[26]=0,s[27]=1,s[28]=0,s[29]=0,s[30]=1,s[31]=0,s[32]=0,s[33]=1,s[34]=0,s[35]=0,s[36]=-1,s[37]=0,s[38]=0,s[39]=-1,s[40]=0,s[41]=0,s[42]=-1,s[43]=0,s[44]=0,s[45]=-1,s[46]=0,s[47]=0,s[48]=0,s[49]=1,s[50]=0,s[51]=0,s[52]=1,s[53]=0,s[54]=0,s[55]=1,s[56]=0,s[57]=0,s[58]=1,s[59]=0,s[60]=0,s[61]=-1,s[62]=0,s[63]=0,s[64]=-1,s[65]=0,s[66]=0,s[67]=-1,s[68]=0,s[69]=0,s[70]=-1,s[71]=0,o.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:s})}if(r.st){var l=new Float32Array(48);l[0]=0,l[1]=0,l[2]=1,l[3]=0,l[4]=1,l[5]=1,l[6]=0,l[7]=1,l[8]=1,l[9]=0,l[10]=0,l[11]=0,l[12]=0,l[13]=1,l[14]=1,l[15]=1,l[16]=0,l[17]=0,l[18]=1,l[19]=0,l[20]=1,l[21]=1,l[22]=0,l[23]=1,l[24]=1,l[25]=0,l[26]=0,l[27]=0,l[28]=0,l[29]=1,l[30]=1,l[31]=1,l[32]=1,l[33]=0,l[34]=0,l[35]=0,l[36]=0,l[37]=1,l[38]=1,l[39]=1,l[40]=0,l[41]=0,l[42]=1,l[43]=0,l[44]=1,l[45]=1,l[46]=0,l[47]=1,o.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:l})}if(r.tangent){var c=new Float32Array(72);c[0]=1,c[1]=0,c[2]=0,c[3]=1,c[4]=0,c[5]=0,c[6]=1,c[7]=0,c[8]=0,c[9]=1,c[10]=0,c[11]=0,c[12]=-1,c[13]=0,c[14]=0,c[15]=-1,c[16]=0,c[17]=0,c[18]=-1,c[19]=0,c[20]=0,c[21]=-1,c[22]=0,c[23]=0,c[24]=0,c[25]=1,c[26]=0,c[27]=0,c[28]=1,c[29]=0,c[30]=0,c[31]=1,c[32]=0,c[33]=0,c[34]=1,c[35]=0,c[36]=0,c[37]=-1,c[38]=0,c[39]=0,c[40]=-1,c[41]=0,c[42]=0,c[43]=-1,c[44]=0,c[45]=0,c[46]=-1,c[47]=0,c[48]=-1,c[49]=0,c[50]=0,c[51]=-1,c[52]=0,c[53]=0,c[54]=-1,c[55]=0,c[56]=0,c[57]=-1,c[58]=0,c[59]=0,c[60]=1,c[61]=0,c[62]=0,c[63]=1,c[64]=0,c[65]=0,c[66]=1,c[67]=0,c[68]=0,c[69]=1,c[70]=0,c[71]=0,o.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:c})}if(r.bitangent){var u=new Float32Array(72);u[0]=0,u[1]=1,u[2]=0,u[3]=0,u[4]=1,u[5]=0,u[6]=0,u[7]=1,u[8]=0,u[9]=0,u[10]=1,u[11]=0,u[12]=0,u[13]=1,u[14]=0,u[15]=0,u[16]=1,u[17]=0,u[18]=0,u[19]=1,u[20]=0,u[21]=0,u[22]=1,u[23]=0,u[24]=0,u[25]=0,u[26]=1,u[27]=0,u[28]=0,u[29]=1,u[30]=0,u[31]=0,u[32]=1,u[33]=0,u[34]=0,u[35]=1,u[36]=0,u[37]=0,u[38]=1,u[39]=0,u[40]=0,u[41]=1,u[42]=0,u[43]=0,u[44]=1,u[45]=0,u[46]=0,u[47]=1,u[48]=0,u[49]=0,u[50]=1,u[51]=0,u[52]=0,u[53]=1,u[54]=0,u[55]=0,u[56]=1,u[57]=0,u[58]=0,u[59]=1,u[60]=0,u[61]=0,u[62]=1,u[63]=0,u[64]=0,u[65]=1,u[66]=0,u[67]=0,u[68]=1,u[69]=0,u[70]=0,u[71]=1,o.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:u})}(n=new Uint16Array(36))[0]=0,n[1]=1,n[2]=2,n[3]=0,n[4]=2,n[5]=3,n[6]=6,n[7]=5,n[8]=4,n[9]=7,n[10]=6,n[11]=4,n[12]=8,n[13]=9,n[14]=10,n[15]=8,n[16]=10,n[17]=11,n[18]=14,n[19]=13,n[20]=12,n[21]=15,n[22]=14,n[23]=12,n[24]=18,n[25]=17,n[26]=16,n[27]=19,n[28]=18,n[29]=16,n[30]=20,n[31]=21,n[32]=22,n[33]=20,n[34]=22,n[35]=23}else(a=new Float64Array(24))[0]=t.x,a[1]=t.y,a[2]=t.z,a[3]=i.x,a[4]=t.y,a[5]=t.z,a[6]=i.x,a[7]=i.y,a[8]=t.z,a[9]=t.x,a[10]=i.y,a[11]=t.z,a[12]=t.x,a[13]=t.y,a[14]=i.z,a[15]=i.x,a[16]=t.y,a[17]=i.z,a[18]=i.x,a[19]=i.y,a[20]=i.z,a[21]=t.x,a[22]=i.y,a[23]=i.z,o.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a}),(n=new Uint16Array(36))[0]=4,n[1]=5,n[2]=6,n[3]=4,n[4]=6,n[5]=7,n[6]=1,n[7]=0,n[8]=3,n[9]=1,n[10]=3,n[11]=2,n[12]=1,n[13]=6,n[14]=5,n[15]=1,n[16]=2,n[17]=6,n[18]=2,n[19]=3,n[20]=7,n[21]=2,n[22]=7,n[23]=6,n[24]=3,n[25]=0,n[26]=4,n[27]=3,n[28]=4,n[29]=7,n[30]=0,n[31]=1,n[32]=5,n[33]=0,n[34]=5,n[35]=4;var d=Cartesian3.subtract(i,t,diffScratch$1),h=.5*Cartesian3.magnitude(d);if(defined(e._offsetAttribute)){var p=a.length,f=new Uint8Array(p/3);arrayFill(f,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),o.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:f})}return new Geometry({attributes:o,indices:n,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,h),offsetAttribute:e._offsetAttribute})}},BoxGeometry.getUnitBox=function(){return defined(unitBoxGeometry)||(unitBoxGeometry=BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(1,1,1),vertexFormat:VertexFormat.POSITION_ONLY}))),unitBoxGeometry};var diffScratch=new Cartesian3;function BoxOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).minimum,i=e.maximum;this._min=Cartesian3.clone(t),this._max=Cartesian3.clone(i),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}BoxOutlineGeometry.fromDimensions=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).dimensions,i=Cartesian3.multiplyByScalar(t,.5,new Cartesian3);return new BoxOutlineGeometry({minimum:Cartesian3.negate(i,new Cartesian3),maximum:i,offsetAttribute:e.offsetAttribute})},BoxOutlineGeometry.fromAxisAlignedBoundingBox=function(e){return new BoxOutlineGeometry({minimum:e.minimum,maximum:e.maximum})},BoxOutlineGeometry.packedLength=2*Cartesian3.packedLength+1,BoxOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._min,t,i),Cartesian3.pack(e._max,t,i+Cartesian3.packedLength),t[i+2*Cartesian3.packedLength]=defaultValue(e._offsetAttribute,-1),t};var scratchMin$2=new Cartesian3,scratchMax$2=new Cartesian3,scratchOptions$m={minimum:scratchMin$2,maximum:scratchMax$2,offsetAttribute:void 0},implementation$1;function cancelAnimationFramePolyfill(e){implementation$1(e)}function CartographicGeocoderService(){}function Spline(){this.times=void 0,this.points=void 0,DeveloperError.throwInstantiationError()}function LinearSpline(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,i=e.times;this._times=i,this._points=t,this._lastTimeIndex=0}BoxOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t,scratchMin$2),n=Cartesian3.unpack(e,t+Cartesian3.packedLength,scratchMax$2),a=e[t+2*Cartesian3.packedLength];return defined(i)?(i._min=Cartesian3.clone(r,i._min),i._max=Cartesian3.clone(n,i._max),i._offsetAttribute=-1===a?void 0:a,i):(scratchOptions$m.offsetAttribute=-1===a?void 0:a,new BoxOutlineGeometry(scratchOptions$m))},BoxOutlineGeometry.createGeometry=function(e){var t=e._min,i=e._max;if(!Cartesian3.equals(t,i)){var r=new GeometryAttributes,n=new Uint16Array(24),a=new Float64Array(24);a[0]=t.x,a[1]=t.y,a[2]=t.z,a[3]=i.x,a[4]=t.y,a[5]=t.z,a[6]=i.x,a[7]=i.y,a[8]=t.z,a[9]=t.x,a[10]=i.y,a[11]=t.z,a[12]=t.x,a[13]=t.y,a[14]=i.z,a[15]=i.x,a[16]=t.y,a[17]=i.z,a[18]=i.x,a[19]=i.y,a[20]=i.z,a[21]=t.x,a[22]=i.y,a[23]=i.z,r.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a}),n[0]=4,n[1]=5,n[2]=5,n[3]=6,n[4]=6,n[5]=7,n[6]=7,n[7]=4,n[8]=0,n[9]=1,n[10]=1,n[11]=2,n[12]=2,n[13]=3,n[14]=3,n[15]=0,n[16]=0,n[17]=4,n[18]=1,n[19]=5,n[20]=2,n[21]=6,n[22]=3,n[23]=7;var o=Cartesian3.subtract(i,t,diffScratch),s=.5*Cartesian3.magnitude(o);if(defined(e._offsetAttribute)){var l=a.length,c=new Uint8Array(l/3);arrayFill(c,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),r.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}return new Geometry({attributes:r,indices:n,primitiveType:PrimitiveType$1.LINES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,s),offsetAttribute:e._offsetAttribute})}},"undefined"!=typeof cancelAnimationFrame&&(implementation$1=cancelAnimationFrame),function(){if(!defined(implementation$1)&&"undefined"!=typeof window)for(var e=["webkit","moz","ms","o"],t=0,i=e.length;t<i&&!defined(implementation$1);)defined(implementation$1=window[e[t]+"CancelAnimationFrame"])||(implementation$1=window[e[t]+"CancelRequestAnimationFrame"]),++t;defined(implementation$1)||(implementation$1=clearTimeout)}(),CartographicGeocoderService.prototype.geocode=function(e){var t=e.match(/[^\s,\n]+/g);if(2===t.length||3===t.length){var i=+t[0],r=+t[1],n=3===t.length?+t[2]:300;if(isNaN(i)&&isNaN(r))for(var a=/^(\d+.?\d*)([nsew])/i,o=0;o<t.length;++o){var s=t[o].match(a);a.test(t[o])&&3===s.length&&(/^[ns]/i.test(s[2])?r=/^[n]/i.test(s[2])?+s[1]:-s[1]:/^[ew]/i.test(s[2])&&(i=/^[e]/i.test(s[2])?+s[1]:-s[1]))}if(!isNaN(i)&&!isNaN(r)&&!isNaN(n)){var l={displayName:e,destination:Cartesian3.fromDegrees(i,r,n)};return when.resolve([l])}}return when.resolve([])},Spline.prototype.evaluate=DeveloperError.throwInstantiationError,Spline.prototype.findTimeInterval=function(e,t){var i,r=this.times,n=r.length;if(e>=r[t=defaultValue(t,0)]){if(t+1<n&&e<r[t+1])return t;if(t+2<n&&e<r[t+2])return t+1}else if(t-1>=0&&e>=r[t-1])return t-1;if(e>r[t])for(i=t;i<n-1&&!(e>=r[i]&&e<r[i+1]);++i);else for(i=t-1;i>=0&&!(e>=r[i]&&e<r[i+1]);--i);return i===n-1&&(i=n-2),i},Spline.prototype.wrapTime=function(e){var t=this.times,i=t[t.length-1],r=t[0],n=i-r;return e<r&&(e+=(Math.floor((r-e)/n)+1)*n),e>i&&(e-=(Math.floor((e-i)/n)+1)*n),e},Spline.prototype.clampTime=function(e){var t=this.times;return CesiumMath.clamp(e,t[0],t[t.length-1])},Object.defineProperties(LinearSpline.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}}),LinearSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,LinearSpline.prototype.wrapTime=Spline.prototype.wrapTime,LinearSpline.prototype.clampTime=Spline.prototype.clampTime,LinearSpline.prototype.evaluate=function(e,t){var i=this.points,r=this.times,n=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),a=(e-r[n])/(r[n+1]-r[n]);return defined(t)||(t=new Cartesian3),Cartesian3.lerp(i[n],i[n+1],a,t)};var TridiagonalSystemSolver={solve:function(e,t,i,r){var n,a,o=new Array(i.length),s=new Array(r.length),l=new Array(r.length);for(n=0;n<s.length;n++)s[n]=new Cartesian3,l[n]=new Cartesian3;for(o[0]=i[0]/t[0],s[0]=Cartesian3.multiplyByScalar(r[0],1/t[0],s[0]),n=1;n<o.length;++n)a=1/(t[n]-o[n-1]*e[n-1]),o[n]=i[n]*a,s[n]=Cartesian3.subtract(r[n],Cartesian3.multiplyByScalar(s[n-1],e[n-1],s[n]),s[n]),s[n]=Cartesian3.multiplyByScalar(s[n],a,s[n]);for(a=1/(t[n]-o[n-1]*e[n-1]),s[n]=Cartesian3.subtract(r[n],Cartesian3.multiplyByScalar(s[n-1],e[n-1],s[n]),s[n]),s[n]=Cartesian3.multiplyByScalar(s[n],a,s[n]),l[l.length-1]=s[s.length-1],n=l.length-2;n>=0;--n)l[n]=Cartesian3.subtract(s[n],Cartesian3.multiplyByScalar(l[n+1],o[n],l[n]),l[n]);return l}},scratchLower=[],scratchDiagonal=[],scratchUpper=[],scratchRight$3=[];function generateClamped(e,t,i){var r,n=scratchLower,a=scratchUpper,o=scratchDiagonal,s=scratchRight$3;n.length=a.length=e.length-1,o.length=s.length=e.length,n[0]=o[0]=1,a[0]=0;var l=s[0];for(defined(l)||(l=s[0]=new Cartesian3),Cartesian3.clone(t,l),r=1;r<n.length-1;++r)n[r]=a[r]=1,o[r]=4,defined(l=s[r])||(l=s[r]=new Cartesian3),Cartesian3.subtract(e[r+1],e[r-1],l),Cartesian3.multiplyByScalar(l,3,l);return n[r]=0,a[r]=1,o[r]=4,defined(l=s[r])||(l=s[r]=new Cartesian3),Cartesian3.subtract(e[r+1],e[r-1],l),Cartesian3.multiplyByScalar(l,3,l),o[r+1]=1,defined(l=s[r+1])||(l=s[r+1]=new Cartesian3),Cartesian3.clone(i,l),TridiagonalSystemSolver.solve(n,o,a,s)}function generateNatural(e){var t,i=scratchLower,r=scratchUpper,n=scratchDiagonal,a=scratchRight$3;i.length=r.length=e.length-1,n.length=a.length=e.length,i[0]=r[0]=1,n[0]=2;var o=a[0];for(defined(o)||(o=a[0]=new Cartesian3),Cartesian3.subtract(e[1],e[0],o),Cartesian3.multiplyByScalar(o,3,o),t=1;t<i.length;++t)i[t]=r[t]=1,n[t]=4,defined(o=a[t])||(o=a[t]=new Cartesian3),Cartesian3.subtract(e[t+1],e[t-1],o),Cartesian3.multiplyByScalar(o,3,o);return n[t]=2,defined(o=a[t])||(o=a[t]=new Cartesian3),Cartesian3.subtract(e[t],e[t-1],o),Cartesian3.multiplyByScalar(o,3,o),TridiagonalSystemSolver.solve(i,n,r,a)}function HermiteSpline(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,i=e.times,r=e.inTangents,n=e.outTangents;this._times=i,this._points=t,this._inTangents=r,this._outTangents=n,this._lastTimeIndex=0}Object.defineProperties(HermiteSpline.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}},inTangents:{get:function(){return this._inTangents}},outTangents:{get:function(){return this._outTangents}}}),HermiteSpline.createC1=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times,i=e.points,r=e.tangents,n=r.slice(0,r.length-1);return new HermiteSpline({times:t,points:i,inTangents:r.slice(1,r.length),outTangents:n})},HermiteSpline.createNaturalCubic=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times,i=e.points;if(i.length<3)return new LinearSpline({points:i,times:t});var r=generateNatural(i),n=r.slice(0,r.length-1);return new HermiteSpline({times:t,points:i,inTangents:r.slice(1,r.length),outTangents:n})},HermiteSpline.createClampedCubic=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times,i=e.points,r=e.firstTangent,n=e.lastTangent;if(i.length<3)return new LinearSpline({points:i,times:t});var a=generateClamped(i,r,n),o=a.slice(0,a.length-1);return new HermiteSpline({times:t,points:i,inTangents:a.slice(1,a.length),outTangents:o})},HermiteSpline.hermiteCoefficientMatrix=new Matrix4(2,-3,0,1,-2,3,0,0,1,-2,1,0,1,-1,0,0),HermiteSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval;var scratchTimeVec$1=new Cartesian4,scratchTemp=new Cartesian3;HermiteSpline.prototype.wrapTime=Spline.prototype.wrapTime,HermiteSpline.prototype.clampTime=Spline.prototype.clampTime,HermiteSpline.prototype.evaluate=function(e,t){defined(t)||(t=new Cartesian3);var i=this.points,r=this.times,n=this.inTangents,a=this.outTangents,o=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),s=(e-r[o])/(r[o+1]-r[o]),l=scratchTimeVec$1;l.z=s,l.y=s*s,l.x=l.y*s,l.w=1;var c=Matrix4.multiplyByVector(HermiteSpline.hermiteCoefficientMatrix,l,l);return t=Cartesian3.multiplyByScalar(i[o],c.x,t),Cartesian3.multiplyByScalar(i[o+1],c.y,scratchTemp),Cartesian3.add(t,scratchTemp,t),Cartesian3.multiplyByScalar(a[o],c.z,scratchTemp),Cartesian3.add(t,scratchTemp,t),Cartesian3.multiplyByScalar(n[o],c.w,scratchTemp),Cartesian3.add(t,scratchTemp,t)};var scratchTimeVec=new Cartesian4,scratchTemp0=new Cartesian3,scratchTemp1=new Cartesian3;function createEvaluateFunction$1(e){var t=e.points,i=e.times;if(t.length<3){var r=i[0],n=1/(i[1]-r),a=t[0],o=t[1];return function(e,t){defined(t)||(t=new Cartesian3);var i=(e-r)*n;return Cartesian3.lerp(a,o,i,t)}}return function(r,n){defined(n)||(n=new Cartesian3);var a,o,s,l,c,u=e._lastTimeIndex=e.findTimeInterval(r,e._lastTimeIndex),d=(r-i[u])/(i[u+1]-i[u]),h=scratchTimeVec;return h.z=d,h.y=d*d,h.x=h.y*d,h.w=1,0===u?(a=t[0],o=t[1],s=e.firstTangent,l=Cartesian3.subtract(t[2],a,scratchTemp0),Cartesian3.multiplyByScalar(l,.5,l),c=Matrix4.multiplyByVector(HermiteSpline.hermiteCoefficientMatrix,h,h)):u===t.length-2?(a=t[u],o=t[u+1],l=e.lastTangent,s=Cartesian3.subtract(o,t[u-1],scratchTemp0),Cartesian3.multiplyByScalar(s,.5,s),c=Matrix4.multiplyByVector(HermiteSpline.hermiteCoefficientMatrix,h,h)):(a=t[u-1],o=t[u],s=t[u+1],l=t[u+2],c=Matrix4.multiplyByVector(CatmullRomSpline.catmullRomCoefficientMatrix,h,h)),n=Cartesian3.multiplyByScalar(a,c.x,n),Cartesian3.multiplyByScalar(o,c.y,scratchTemp1),Cartesian3.add(n,scratchTemp1,n),Cartesian3.multiplyByScalar(s,c.z,scratchTemp1),Cartesian3.add(n,scratchTemp1,n),Cartesian3.multiplyByScalar(l,c.w,scratchTemp1),Cartesian3.add(n,scratchTemp1,n)}}var firstTangentScratch=new Cartesian3,lastTangentScratch=new Cartesian3;function CatmullRomSpline(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,i=e.times,r=e.firstTangent,n=e.lastTangent;if(t.length>2&&(defined(r)||(r=firstTangentScratch,Cartesian3.multiplyByScalar(t[1],2,r),Cartesian3.subtract(r,t[2],r),Cartesian3.subtract(r,t[0],r),Cartesian3.multiplyByScalar(r,.5,r)),!defined(n))){var a=t.length-1;n=lastTangentScratch,Cartesian3.multiplyByScalar(t[a-1],2,n),Cartesian3.subtract(t[a],n,n),Cartesian3.add(n,t[a-2],n),Cartesian3.multiplyByScalar(n,.5,n)}this._times=i,this._points=t,this._firstTangent=Cartesian3.clone(r),this._lastTangent=Cartesian3.clone(n),this._evaluateFunction=createEvaluateFunction$1(this),this._lastTimeIndex=0}function getStringFromTypedArray(e,t,i){return t=defaultValue(t,0),i=defaultValue(i,e.byteLength-t),e=e.subarray(t,t+i),getStringFromTypedArray.decode(e)}function inRange(e,t,i){return t<=e&&e<=i}function utf8Handler(e){for(var t=0,i=0,r=0,n=128,a=191,o=[],s=e.length,l=0;l<s;++l){var c=e[l];if(0===r){if(inRange(c,0,127)){o.push(c);continue}if(inRange(c,194,223)){r=1,t=31&c;continue}if(inRange(c,224,239)){224===c&&(n=160),237===c&&(a=159),r=2,t=15&c;continue}if(inRange(c,240,244)){240===c&&(n=144),244===c&&(a=143),r=3,t=7&c;continue}throw new RuntimeError("String decoding failed.")}inRange(c,n,a)?(n=128,a=191,t=t<<6|63&c,++i===r&&(o.push(t),t=r=i=0)):(t=r=i=0,n=128,a=191,--l)}return o}function getJsonFromTypedArray(e,t,i){return JSON.parse(getStringFromTypedArray(e,t,i))}Object.defineProperties(CatmullRomSpline.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}},firstTangent:{get:function(){return this._firstTangent}},lastTangent:{get:function(){return this._lastTangent}}}),CatmullRomSpline.catmullRomCoefficientMatrix=new Matrix4(-.5,1,-.5,0,1.5,-2.5,0,1,-1.5,2,.5,0,.5,-.5,0,0),CatmullRomSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,CatmullRomSpline.prototype.wrapTime=Spline.prototype.wrapTime,CatmullRomSpline.prototype.clampTime=Spline.prototype.clampTime,CatmullRomSpline.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)},getStringFromTypedArray.decodeWithTextDecoder=function(e){return new TextDecoder("utf-8").decode(e)},getStringFromTypedArray.decodeWithFromCharCode=function(e){for(var t="",i=utf8Handler(e),r=i.length,n=0;n<r;++n){var a=i[n];a<=65535?t+=String.fromCharCode(a):(a-=65536,t+=String.fromCharCode(55296+(a>>10),56320+(1023&a)))}return t},"undefined"!=typeof TextDecoder?getStringFromTypedArray.decode=getStringFromTypedArray.decodeWithTextDecoder:getStringFromTypedArray.decode=getStringFromTypedArray.decodeWithFromCharCode;var Intersections2D={};function QuantizedMeshTerrainData(e){this._quantizedVertices=e.quantizedVertices,this._encodedNormals=e.encodedNormals,this._indices=e.indices,this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._boundingSphere=e.boundingSphere,this._orientedBoundingBox=e.orientedBoundingBox,this._horizonOcclusionPoint=e.horizonOcclusionPoint,this._credits=e.credits;var t=this._quantizedVertices.length/3,i=this._uValues=this._quantizedVertices.subarray(0,t),r=this._vValues=this._quantizedVertices.subarray(t,2*t);function n(e,t){return r[e]-r[t]}function a(e,t){return i[e]-i[t]}this._heightValues=this._quantizedVertices.subarray(2*t,3*t),this._westIndices=sortIndicesIfNecessary(e.westIndices,n,t),this._southIndices=sortIndicesIfNecessary(e.southIndices,a,t),this._eastIndices=sortIndicesIfNecessary(e.eastIndices,n,t),this._northIndices=sortIndicesIfNecessary(e.northIndices,a,t),this._westSkirtHeight=e.westSkirtHeight,this._southSkirtHeight=e.southSkirtHeight,this._eastSkirtHeight=e.eastSkirtHeight,this._northSkirtHeight=e.northSkirtHeight,this._childTileMask=defaultValue(e.childTileMask,15),this._createdByUpsampling=defaultValue(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._mesh=void 0}Intersections2D.clipTriangleAtAxisAlignedThreshold=function(e,t,i,r,n,a){var o,s,l;defined(a)?a.length=0:a=[],t?(o=i<e,s=r<e,l=n<e):(o=i>e,s=r>e,l=n>e);var c,u,d,h,p,f,m=o+s+l;return 1===m?o?(c=(e-i)/(r-i),u=(e-i)/(n-i),a.push(1),a.push(2),1!==u&&(a.push(-1),a.push(0),a.push(2),a.push(u)),1!==c&&(a.push(-1),a.push(0),a.push(1),a.push(c))):s?(d=(e-r)/(n-r),h=(e-r)/(i-r),a.push(2),a.push(0),1!==h&&(a.push(-1),a.push(1),a.push(0),a.push(h)),1!==d&&(a.push(-1),a.push(1),a.push(2),a.push(d))):l&&(p=(e-n)/(i-n),f=(e-n)/(r-n),a.push(0),a.push(1),1!==f&&(a.push(-1),a.push(2),a.push(1),a.push(f)),1!==p&&(a.push(-1),a.push(2),a.push(0),a.push(p))):2===m?o||i===e?s||r===e?l||n===e||(u=(e-i)/(n-i),d=(e-r)/(n-r),a.push(2),a.push(-1),a.push(0),a.push(2),a.push(u),a.push(-1),a.push(1),a.push(2),a.push(d)):(f=(e-n)/(r-n),c=(e-i)/(r-i),a.push(1),a.push(-1),a.push(2),a.push(1),a.push(f),a.push(-1),a.push(0),a.push(1),a.push(c)):(h=(e-r)/(i-r),p=(e-n)/(i-n),a.push(0),a.push(-1),a.push(1),a.push(0),a.push(h),a.push(-1),a.push(2),a.push(0),a.push(p)):3!==m&&(a.push(0),a.push(1),a.push(2)),a},Intersections2D.computeBarycentricCoordinates=function(e,t,i,r,n,a,o,s,l){var c=i-o,u=o-n,d=a-s,h=r-s,p=1/(d*c+u*h),f=t-s,m=e-o,g=(d*m+u*f)*p,_=(-h*m+c*f)*p,y=1-g-_;return defined(l)?(l.x=g,l.y=_,l.z=y,l):new Cartesian3(g,_,y)},Intersections2D.computeLineSegmentLineSegmentIntersection=function(e,t,i,r,n,a,o,s,l){var c=(s-a)*(i-e)-(o-n)*(r-t);if(0!==c){var u=((o-n)*(t-a)-(s-a)*(e-n))/c,d=((i-e)*(t-a)-(r-t)*(e-n))/c;return u>=0&&u<=1&&d>=0&&d<=1?(defined(l)||(l=new Cartesian2),l.x=e+u*(i-e),l.y=t+u*(r-t),l):void 0}},Object.defineProperties(QuantizedMeshTerrainData.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}},canUpsample:{get:function(){return defined(this._mesh)}}});var arrayScratch$1=[];function sortIndicesIfNecessary(e,t,i){arrayScratch$1.length=e.length;for(var r=!1,n=0,a=e.length;n<a;++n)arrayScratch$1[n]=e[n],r=r||n>0&&t(e[n-1],e[n])>0;return r?(arrayScratch$1.sort(t),IndexDatatype$1.createTypedArray(i,arrayScratch$1)):e}var createMeshTaskName$1="createVerticesFromQuantizedTerrainMesh",createMeshTaskProcessorNoThrottle$1=new TaskProcessor(createMeshTaskName$1),createMeshTaskProcessorThrottle$1=new TaskProcessor(createMeshTaskName$1,TerrainData.maximumAsynchronousTasks);QuantizedMeshTerrainData.prototype.createMesh=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).tilingScheme,i=e.x,r=e.y,n=e.level,a=defaultValue(e.exaggeration,1),o=defaultValue(e.exaggerationRelativeHeight,0),s=defaultValue(e.throttle,!0),l=t.ellipsoid,c=t.tileXYToRectangle(i,r,n),u=(s?createMeshTaskProcessorThrottle$1:createMeshTaskProcessorNoThrottle$1).scheduleTask({minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,quantizedVertices:this._quantizedVertices,octEncodedNormals:this._encodedNormals,includeWebMercatorT:!0,indices:this._indices,westIndices:this._westIndices,southIndices:this._southIndices,eastIndices:this._eastIndices,northIndices:this._northIndices,westSkirtHeight:this._westSkirtHeight,southSkirtHeight:this._southSkirtHeight,eastSkirtHeight:this._eastSkirtHeight,northSkirtHeight:this._northSkirtHeight,rectangle:c,relativeToCenter:this._boundingSphere.center,ellipsoid:l,exaggeration:a,exaggerationRelativeHeight:o});if(defined(u)){var d=this;return when(u,(function(e){var t=d._quantizedVertices.length/3,i=t+d._westIndices.length+d._southIndices.length+d._eastIndices.length+d._northIndices.length,r=IndexDatatype$1.createTypedArray(i,e.indices),n=new Float32Array(e.vertices),a=e.center,o=e.minimumHeight,s=e.maximumHeight,l=d._boundingSphere,c=d._orientedBoundingBox,u=defaultValue(Cartesian3.clone(e.occludeePointInScaledSpace),d._horizonOcclusionPoint),h=e.vertexStride,p=TerrainEncoding.clone(e.encoding);return d._mesh=new TerrainMesh(a,n,r,e.indexCountWithoutSkirts,t,o,s,l,u,h,c,p,e.westIndicesSouthToNorth,e.southIndicesEastToWest,e.eastIndicesNorthToSouth,e.northIndicesWestToEast),d._quantizedVertices=void 0,d._encodedNormals=void 0,d._indices=void 0,d._uValues=void 0,d._vValues=void 0,d._heightValues=void 0,d._westIndices=void 0,d._southIndices=void 0,d._eastIndices=void 0,d._northIndices=void 0,d._mesh}))}};var upsampleTaskProcessor$1=new TaskProcessor("upsampleQuantizedTerrainMesh",TerrainData.maximumAsynchronousTasks);QuantizedMeshTerrainData.prototype.upsample=function(e,t,i,r,n,a,o){var s=this._mesh;if(defined(this._mesh)){var l=2*t!==n,c=2*i===a,u=e.ellipsoid,d=e.tileXYToRectangle(n,a,o),h=upsampleTaskProcessor$1.scheduleTask({vertices:s.vertices,vertexCountWithoutSkirts:s.vertexCountWithoutSkirts,indices:s.indices,indexCountWithoutSkirts:s.indexCountWithoutSkirts,encoding:s.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:l,isNorthChild:c,childRectangle:d,ellipsoid:u});if(defined(h)){var p=Math.min(this._westSkirtHeight,this._eastSkirtHeight);p=Math.min(p,this._southSkirtHeight),p=Math.min(p,this._northSkirtHeight);var f=l?.5*p:this._westSkirtHeight,m=c?.5*p:this._southSkirtHeight,g=l?this._eastSkirtHeight:.5*p,_=c?this._northSkirtHeight:.5*p,y=this._credits;return when(h).then((function(e){var t,i=new Uint16Array(e.vertices),r=IndexDatatype$1.createTypedArray(i.length/3,e.indices);return defined(e.encodedNormals)&&(t=new Uint8Array(e.encodedNormals)),new QuantizedMeshTerrainData({quantizedVertices:i,indices:r,encodedNormals:t,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,boundingSphere:BoundingSphere.clone(e.boundingSphere),orientedBoundingBox:OrientedBoundingBox.clone(e.orientedBoundingBox),horizonOcclusionPoint:Cartesian3.clone(e.horizonOcclusionPoint),westIndices:e.westIndices,southIndices:e.southIndices,eastIndices:e.eastIndices,northIndices:e.northIndices,westSkirtHeight:f,southSkirtHeight:m,eastSkirtHeight:g,northSkirtHeight:_,childTileMask:0,credits:y,createdByUpsampling:!0})}))}}};var maxShort$1=32767,barycentricCoordinateScratch$1=new Cartesian3;function pointInBoundingBox(e,t,i,r,n,a,o,s){var l=Math.min(i,n,o),c=Math.max(i,n,o),u=Math.min(r,a,s),d=Math.max(r,a,s);return e>=l&&e<=c&&t>=u&&t<=d}QuantizedMeshTerrainData.prototype.interpolateHeight=function(e,t,i){var r=CesiumMath.clamp((t-e.west)/e.width,0,1);r*=maxShort$1;var n=CesiumMath.clamp((i-e.south)/e.height,0,1);return n*=maxShort$1,defined(this._mesh)?interpolateMeshHeight$1(this,r,n):interpolateHeight$1(this,r,n)};var texCoordScratch0$1=new Cartesian2,texCoordScratch1$1=new Cartesian2,texCoordScratch2$1=new Cartesian2;function interpolateMeshHeight$1(e,t,i){for(var r=e._mesh,n=r.vertices,a=r.encoding,o=r.indices,s=0,l=o.length;s<l;s+=3){var c=o[s],u=o[s+1],d=o[s+2],h=a.decodeTextureCoordinates(n,c,texCoordScratch0$1),p=a.decodeTextureCoordinates(n,u,texCoordScratch1$1),f=a.decodeTextureCoordinates(n,d,texCoordScratch2$1);if(pointInBoundingBox(t,i,h.x,h.y,p.x,p.y,f.x,f.y)){var m=Intersections2D.computeBarycentricCoordinates(t,i,h.x,h.y,p.x,p.y,f.x,f.y,barycentricCoordinateScratch$1);if(m.x>=-1e-15&&m.y>=-1e-15&&m.z>=-1e-15){var g=a.decodeHeight(n,c),_=a.decodeHeight(n,u),y=a.decodeHeight(n,d);return m.x*g+m.y*_+m.z*y}}}}function interpolateHeight$1(e,t,i){for(var r=e._uValues,n=e._vValues,a=e._heightValues,o=e._indices,s=0,l=o.length;s<l;s+=3){var c=o[s],u=o[s+1],d=o[s+2],h=r[c],p=r[u],f=r[d],m=n[c],g=n[u],_=n[d];if(pointInBoundingBox(t,i,h,m,p,g,f,_)){var y=Intersections2D.computeBarycentricCoordinates(t,i,h,m,p,g,f,_,barycentricCoordinateScratch$1);if(y.x>=-1e-15&&y.y>=-1e-15&&y.z>=-1e-15){var v=y.x*a[c]+y.y*a[u]+y.z*a[d];return CesiumMath.lerp(e._minimumHeight,e._maximumHeight,v/maxShort$1)}}}}function LayerInformation(e){this.resource=e.resource,this.version=e.version,this.isHeightmap=e.isHeightmap,this.tileUrlTemplates=e.tileUrlTemplates,this.availability=e.availability,this.hasVertexNormals=e.hasVertexNormals,this.hasWaterMask=e.hasWaterMask,this.hasMetadata=e.hasMetadata,this.availabilityLevels=e.availabilityLevels,this.availabilityTilesLoaded=e.availabilityTilesLoaded,this.littleEndianExtensionSize=e.littleEndianExtensionSize,this.availabilityPromiseCache={}}function CesiumTerrainProvider(e){this._heightmapWidth=65,this._heightmapStructure=void 0,this._hasWaterMask=!1,this._hasVertexNormals=!1,this._ellipsoid=e.ellipsoid,this._requestVertexNormals=defaultValue(e.requestVertexNormals,!1),this._requestWaterMask=defaultValue(e.requestWaterMask,!1),this._requestMetadata=defaultValue(e.requestMetadata,!0),this._errorEvent=new Event;var t=e.credit;"string"==typeof t&&(t=new Credit(t)),this._credit=t,this._availability=void 0;var i=when.defer();this._ready=!1,this._readyPromise=i,this._tileCredits=void 0;var r,n,a,o=this,s=this._layers=[],l="",c=[],u=0;function d(e){var t;if(!e.format)return t="The tile format is not specified in the layer.json file.",void(a=TileProviderError.handleError(a,o,o._errorEvent,t,void 0,void 0,void 0,m));if(!e.tiles||0===e.tiles.length)return t="The layer.json file does not specify any tile URL templates.",void(a=TileProviderError.handleError(a,o,o._errorEvent,t,void 0,void 0,void 0,m));var i=!1,p=!1,f=!1,g=!0,_=!1;if("heightmap-1.0"===e.format)_=!0,defined(o._heightmapStructure)||(o._heightmapStructure={heightScale:.2,heightOffset:-1e3,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1,lowestEncodedHeight:0,highestEncodedHeight:65535}),p=!0,o._requestWaterMask=!0;else if(0!==e.format.indexOf("quantized-mesh-1."))return t='The tile format "'+e.format+'" is invalid or not supported.',void(a=TileProviderError.handleError(a,o,o._errorEvent,t,void 0,void 0,void 0,m));var y,v=e.tiles,C=e.maxzoom;if(u=Math.max(u,C),e.projection&&"EPSG:4326"!==e.projection){if("EPSG:3857"!==e.projection)return t='The projection "'+e.projection+'" is invalid or not supported.',void(a=TileProviderError.handleError(a,o,o._errorEvent,t,void 0,void 0,void 0,m));o._tilingScheme=new WebMercatorTilingScheme({numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:o._ellipsoid})}else o._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:1,ellipsoid:o._ellipsoid});if(o._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(o._tilingScheme.ellipsoid,o._heightmapWidth,o._tilingScheme.getNumberOfXTilesAtLevel(0)),e.scheme&&"tms"!==e.scheme&&"slippyMap"!==e.scheme)return t='The scheme "'+e.scheme+'" is invalid or not supported.',void(a=TileProviderError.handleError(a,o,o._errorEvent,t,void 0,void 0,void 0,m));o._scheme=e.scheme,defined(e.extensions)&&-1!==e.extensions.indexOf("octvertexnormals")?i=!0:defined(e.extensions)&&-1!==e.extensions.indexOf("vertexnormals")&&(i=!0,g=!1),defined(e.extensions)&&-1!==e.extensions.indexOf("watermask")&&(p=!0),defined(e.extensions)&&-1!==e.extensions.indexOf("metadata")&&(f=!0);var T,S=e.metadataAvailability,A=e.available;if(defined(A)&&!defined(S)){T=new TileAvailability(o._tilingScheme,A.length);for(var x=0;x<A.length;++x){var E=A[x],b=o._tilingScheme.getNumberOfYTilesAtLevel(x);defined(c[x])||(c[x]=[]);for(var P=0;P<E.length;++P){var D=E[P],w=b-D.endY-1,M=b-D.startY-1;c[x].push([D.startX,w,D.endX,M]),T.addAvailableTileRange(x,D.startX,w,D.endX,M)}}}else defined(S)&&(y=new TileAvailability(o._tilingScheme,C),T=new TileAvailability(o._tilingScheme,C),c[0]=[[0,0,1,0]],T.addAvailableTileRange(0,0,0,1,0));o._hasWaterMask=o._hasWaterMask||p,o._hasVertexNormals=o._hasVertexNormals||i,o._hasMetadata=o._hasMetadata||f,defined(e.attribution)&&(l.length>0&&(l+=" "),l+=e.attribution),s.push(new LayerInformation({resource:r,version:e.version,isHeightmap:_,tileUrlTemplates:v,availability:T,hasVertexNormals:i,hasWaterMask:p,hasMetadata:f,availabilityLevels:S,availabilityTilesLoaded:y,littleEndianExtensionSize:g}));var I=e.parentUrl;if(defined(I)){if(!defined(T))return console.log("A layer.json can't have a parentUrl if it does't have an available array."),when.resolve();(r=r.getDerivedResource({url:I})).appendForwardSlash();var R=(n=r.getDerivedResource({url:"layer.json"})).fetchJson();return when(R,d,h)}return when.resolve()}function h(e){var t="An error occurred while accessing "+n.url+".";a=TileProviderError.handleError(a,o,o._errorEvent,t,void 0,void 0,void 0,m)}function p(e){d(e).then((function(){if(!defined(a)){var e=c.length;if(e>0)for(var t=o._availability=new TileAvailability(o._tilingScheme,u),i=0;i<e;++i)for(var r=c[i],n=0;n<r.length;++n){var s=r[n];t.addAvailableTileRange(i,s[0],s[1],s[2],s[3])}if(l.length>0){var d=new Credit(l);defined(o._tileCredits)?o._tileCredits.push(d):o._tileCredits=[d]}o._ready=!0,o._readyPromise.resolve(!0)}}))}function f(e){defined(e)&&404===e.statusCode?p({tilejson:"2.1.0",format:"heightmap-1.0",version:"1.0.0",scheme:"tms",tiles:["{z}/{x}/{y}.terrain?v={version}"]}):h()}function m(){when(n.fetchJson()).then(p).otherwise(f)}when(e.url).then((function(e){var t=Resource.createIfNeeded(e);t.appendForwardSlash(),n=(r=t).getDerivedResource({url:"layer.json"}),o._tileCredits=t.credits,m()})).otherwise((function(e){i.reject(e)}))}QuantizedMeshTerrainData.prototype.isChildAvailable=function(e,t,i,r){var n=2;return i!==2*e&&++n,r!==2*t&&(n-=2),0!=(this._childTileMask&1<<n)},QuantizedMeshTerrainData.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};var QuantizedMeshExtensionIds={OCT_VERTEX_NORMALS:1,WATER_MASK:2,METADATA:4};function getRequestHeader(e){return defined(e)&&0!==e.length?{Accept:"application/vnd.quantized-mesh;extensions="+e.join("-")+",application/octet-stream;q=0.9,*/*;q=0.01"}:{Accept:"application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01"}}function createHeightmapTerrainData(e,t,i,r,n){var a=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new HeightmapTerrainData({buffer:a,childTileMask:new Uint8Array(t,a.byteLength,1)[0],waterMask:new Uint8Array(t,a.byteLength+1,t.byteLength-a.byteLength-1),width:e._heightmapWidth,height:e._heightmapWidth,structure:e._heightmapStructure,credits:e._tileCredits})}function createQuantizedMeshTerrainData(e,t,i,r,n,a){var o=a.littleEndianExtensionSize,s=0,l=3*Float64Array.BYTES_PER_ELEMENT,c=4*Float64Array.BYTES_PER_ELEMENT,u=3*Uint16Array.BYTES_PER_ELEMENT,d=Uint16Array.BYTES_PER_ELEMENT,h=3*d,p=new DataView(t),f=new Cartesian3(p.getFloat64(s,!0),p.getFloat64(s+8,!0),p.getFloat64(s+16,!0));s+=l;var m=p.getFloat32(s,!0);s+=Float32Array.BYTES_PER_ELEMENT;var g=p.getFloat32(s,!0);s+=Float32Array.BYTES_PER_ELEMENT;var _=new BoundingSphere(new Cartesian3(p.getFloat64(s,!0),p.getFloat64(s+8,!0),p.getFloat64(s+16,!0)),p.getFloat64(s+l,!0));s+=c;var y=new Cartesian3(p.getFloat64(s,!0),p.getFloat64(s+8,!0),p.getFloat64(s+16,!0));s+=l;var v=p.getUint32(s,!0);s+=Uint32Array.BYTES_PER_ELEMENT;var C=new Uint16Array(t,s,3*v);s+=v*u,v>65536&&(h=3*(d=Uint32Array.BYTES_PER_ELEMENT));var T=C.subarray(0,v),S=C.subarray(v,2*v),A=C.subarray(2*v,3*v);AttributeCompression.zigZagDeltaDecode(T,S,A),s%d!=0&&(s+=d-s%d);var x=p.getUint32(s,!0);s+=Uint32Array.BYTES_PER_ELEMENT;var E=IndexDatatype$1.createTypedArrayFromArrayBuffer(v,t,s,3*x);s+=x*h;for(var b=0,P=E.length,D=0;D<P;++D){var w=E[D];E[D]=b-w,0===w&&++b}var M=p.getUint32(s,!0);s+=Uint32Array.BYTES_PER_ELEMENT;var I=IndexDatatype$1.createTypedArrayFromArrayBuffer(v,t,s,M);s+=M*d;var R=p.getUint32(s,!0);s+=Uint32Array.BYTES_PER_ELEMENT;var O=IndexDatatype$1.createTypedArrayFromArrayBuffer(v,t,s,R);s+=R*d;var B=p.getUint32(s,!0);s+=Uint32Array.BYTES_PER_ELEMENT;var L=IndexDatatype$1.createTypedArrayFromArrayBuffer(v,t,s,B);s+=B*d;var F=p.getUint32(s,!0);s+=Uint32Array.BYTES_PER_ELEMENT;var N,V,k=IndexDatatype$1.createTypedArrayFromArrayBuffer(v,t,s,F);for(s+=F*d;s<p.byteLength;){var U=p.getUint8(s,!0);s+=Uint8Array.BYTES_PER_ELEMENT;var G=p.getUint32(s,o);if(s+=Uint32Array.BYTES_PER_ELEMENT,U===QuantizedMeshExtensionIds.OCT_VERTEX_NORMALS&&e._requestVertexNormals)N=new Uint8Array(t,s,2*v);else if(U===QuantizedMeshExtensionIds.WATER_MASK&&e._requestWaterMask)V=new Uint8Array(t,s,G);else if(U===QuantizedMeshExtensionIds.METADATA&&e._requestMetadata){var $=p.getUint32(s,!0);if($>0){var z=getJsonFromTypedArray(new Uint8Array(t),s+Uint32Array.BYTES_PER_ELEMENT,$).available;if(defined(z))for(var H=0;H<z.length;++H)for(var W=i+H+1,j=z[H],q=e._tilingScheme.getNumberOfYTilesAtLevel(W),X=0;X<j.length;++X){var Y=j[X],K=q-Y.endY-1,J=q-Y.startY-1;e.availability.addAvailableTileRange(W,Y.startX,K,Y.endX,J),a.availability.addAvailableTileRange(W,Y.startX,K,Y.endX,J)}}a.availabilityTilesLoaded.addAvailableTileRange(i,r,n,r,n)}s+=G}var Q=5*e.getLevelMaximumGeometricError(i),Z=e._tilingScheme.tileXYToRectangle(r,n,i);return new QuantizedMeshTerrainData({center:f,minimumHeight:m,maximumHeight:g,boundingSphere:_,orientedBoundingBox:OrientedBoundingBox.fromRectangle(Z,m,g,e._tilingScheme.ellipsoid),horizonOcclusionPoint:y,quantizedVertices:C,encodedNormals:N,indices:E,westIndices:I,southIndices:O,eastIndices:L,northIndices:k,westSkirtHeight:Q,southSkirtHeight:Q,eastSkirtHeight:Q,northSkirtHeight:Q,childTileMask:e.availability.computeChildMaskForTile(i,r,n),waterMask:V,credits:e._tileCredits})}function requestTileGeometry$1(e,t,i,r,n,a){if(!defined(n))return when.reject(new RuntimeError("Terrain tile doesn't exist"));var o=n.tileUrlTemplates;if(0!==o.length){var s;if(e._scheme&&"tms"!==e._scheme)s=i;else s=e._tilingScheme.getNumberOfYTilesAtLevel(r)-i-1;var l,c,u=[];e._requestVertexNormals&&n.hasVertexNormals&&u.push(n.littleEndianExtensionSize?"octvertexnormals":"vertexnormals"),e._requestWaterMask&&n.hasWaterMask&&u.push("watermask"),e._requestMetadata&&n.hasMetadata&&u.push("metadata");var d=o[(t+s+r)%o.length],h=n.resource;defined(h._ionEndpoint)&&!defined(h._ionEndpoint.externalType)?(0!==u.length&&(c={extensions:u.join("-")}),l=getRequestHeader(void 0)):l=getRequestHeader(u);var p=h.getDerivedResource({url:d,templateValues:{version:n.version,z:r,x:t,y:s},queryParameters:c,headers:l,request:a}).fetchArrayBuffer();if(defined(p))return p.then((function(a){return defined(e._heightmapStructure)?createHeightmapTerrainData(e,a):createQuantizedMeshTerrainData(e,a,r,t,i,n)}))}}function getAvailabilityTile(e,t,i,r){if(0!==r){var n=e.availabilityLevels,a=r%n==0?r-n:(r/n|0)*n,o=1<<r-a;return{level:a,x:t/o|0,y:i/o|0}}}function checkLayer(e,t,i,r,n,a){if(!defined(n.availabilityLevels))return{result:!1};for(var o,s=function(){delete n.availabilityPromiseCache[o]},l=n.availabilityTilesLoaded,c=n.availability,u=getAvailabilityTile(n,t,i,r);defined(u);){if(c.isTileAvailable(u.level,u.x,u.y)&&!l.isTileAvailable(u.level,u.x,u.y)){var d;if(!a&&(o=u.level+"-"+u.x+"-"+u.y,!defined(d=n.availabilityPromiseCache[o]))){var h=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.TERRAIN});defined(d=requestTileGeometry$1(e,u.x,u.y,u.level,n,h))&&(n.availabilityPromiseCache[o]=d,d.then(s))}return{result:!0,promise:d}}u=getAvailabilityTile(n,u.x,u.y,u.level)}return{result:!1}}CesiumTerrainProvider.prototype.requestTileGeometry=function(e,t,i,r){var n,a=this._layers,o=a.length;if(1===o)n=a[0];else for(var s=0;s<o;++s){var l=a[s];if(!defined(l.availability)||l.availability.isTileAvailable(i,e,t)){n=l;break}}return requestTileGeometry$1(this,e,t,i,n,r)},Object.defineProperties(CesiumTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},hasWaterMask:{get:function(){return this._hasWaterMask&&this._requestWaterMask}},hasVertexNormals:{get:function(){return this._hasVertexNormals&&this._requestVertexNormals}},hasMetadata:{get:function(){return this._hasMetadata&&this._requestMetadata}},requestVertexNormals:{get:function(){return this._requestVertexNormals}},requestWaterMask:{get:function(){return this._requestWaterMask}},requestMetadata:{get:function(){return this._requestMetadata}},availability:{get:function(){return this._availability}}}),CesiumTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},CesiumTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){if(defined(this._availability)){if(i>this._availability._maximumLevel)return!1;if(this._availability.isTileAvailable(i,e,t))return!0;if(!this._hasMetadata)return!1;for(var r=this._layers,n=r.length,a=0;a<n;++a){if(checkLayer(this,e,t,i,r[a],0===a).result)return}return!1}},CesiumTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){if(!(!defined(this._availability)||i>this._availability._maximumLevel||this._availability.isTileAvailable(i,e,t))&&this._hasMetadata)for(var r=this._layers,n=r.length,a=0;a<n;++a){var o=checkLayer(this,e,t,i,r[a],0===a);if(defined(o.promise))return o.promise}},CesiumTerrainProvider._getAvailabilityTile=getAvailabilityTile;var EllipseGeometryLibrary={},rotAxis=new Cartesian3,tempVec=new Cartesian3,unitQuat=new Quaternion,rotMtx=new Matrix3;function pointOnEllipsoid(e,t,i,r,n,a,o,s,l,c){var u=e+t;Cartesian3.multiplyByScalar(r,Math.cos(u),rotAxis),Cartesian3.multiplyByScalar(i,Math.sin(u),tempVec),Cartesian3.add(rotAxis,tempVec,rotAxis);var d=Math.cos(e);d*=d;var h=Math.sin(e);h*=h;var p=a/Math.sqrt(o*d+n*h)/s;return Quaternion.fromAxisAngle(rotAxis,p,unitQuat),Matrix3.fromQuaternion(unitQuat,rotMtx),Matrix3.multiplyByVector(rotMtx,l,c),Cartesian3.normalize(c,c),Cartesian3.multiplyByScalar(c,s,c),c}var scratchCartesian1$6=new Cartesian3,scratchCartesian2$9=new Cartesian3,scratchCartesian3$a=new Cartesian3,scratchNormal$6=new Cartesian3;EllipseGeometryLibrary.raisePositionsToHeight=function(e,t,i){for(var r=t.ellipsoid,n=t.height,a=t.extrudedHeight,o=i?e.length/3*2:e.length/3,s=new Float64Array(3*o),l=e.length,c=i?l:0,u=0;u<l;u+=3){var d=u+1,h=u+2,p=Cartesian3.fromArray(e,u,scratchCartesian1$6);r.scaleToGeodeticSurface(p,p);var f=Cartesian3.clone(p,scratchCartesian2$9),m=r.geodeticSurfaceNormal(p,scratchNormal$6),g=Cartesian3.multiplyByScalar(m,n,scratchCartesian3$a);Cartesian3.add(p,g,p),i&&(Cartesian3.multiplyByScalar(m,a,g),Cartesian3.add(f,g,f),s[u+c]=f.x,s[d+c]=f.y,s[h+c]=f.z),s[u]=p.x,s[d]=p.y,s[h]=p.z}return s};var unitPosScratch=new Cartesian3,eastVecScratch=new Cartesian3,northVecScratch=new Cartesian3;function GeometryInstance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.geometry=e.geometry,this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.id=e.id,this.pickPrimitive=e.pickPrimitive,this.attributes=defaultValue(e.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0}function EncodedCartesian3(){this.high=Cartesian3.clone(Cartesian3.ZERO),this.low=Cartesian3.clone(Cartesian3.ZERO)}EllipseGeometryLibrary.computeEllipsePositions=function(e,t,i){var r=e.semiMinorAxis,n=e.semiMajorAxis,a=e.rotation,o=e.center,s=8*e.granularity,l=r*r,c=n*n,u=n*r,d=Cartesian3.magnitude(o),h=Cartesian3.normalize(o,unitPosScratch),p=Cartesian3.cross(Cartesian3.UNIT_Z,o,eastVecScratch);p=Cartesian3.normalize(p,p);var f=Cartesian3.cross(h,p,northVecScratch),m=1+Math.ceil(CesiumMath.PI_OVER_TWO/s),g=CesiumMath.PI_OVER_TWO/(m-1),_=CesiumMath.PI_OVER_TWO-m*g;_<0&&(m-=Math.ceil(Math.abs(_)/g));var y,v,C,T,S,A=t?new Array(3*(m*(m+2)*2)):void 0,x=0,E=scratchCartesian1$6,b=scratchCartesian2$9,P=4*m*3,D=P-1,w=0,M=i?new Array(P):void 0;for(E=pointOnEllipsoid(_=CesiumMath.PI_OVER_TWO,a,f,p,l,u,c,d,h,E),t&&(A[x++]=E.x,A[x++]=E.y,A[x++]=E.z),i&&(M[D--]=E.z,M[D--]=E.y,M[D--]=E.x),_=CesiumMath.PI_OVER_TWO-g,y=1;y<m+1;++y){if(E=pointOnEllipsoid(_,a,f,p,l,u,c,d,h,E),b=pointOnEllipsoid(Math.PI-_,a,f,p,l,u,c,d,h,b),t){for(A[x++]=E.x,A[x++]=E.y,A[x++]=E.z,C=2*y+2,v=1;v<C-1;++v)T=v/(C-1),S=Cartesian3.lerp(E,b,T,scratchCartesian3$a),A[x++]=S.x,A[x++]=S.y,A[x++]=S.z;A[x++]=b.x,A[x++]=b.y,A[x++]=b.z}i&&(M[D--]=E.z,M[D--]=E.y,M[D--]=E.x,M[w++]=b.x,M[w++]=b.y,M[w++]=b.z),_=CesiumMath.PI_OVER_TWO-(y+1)*g}for(y=m;y>1;--y){if(E=pointOnEllipsoid(-(_=CesiumMath.PI_OVER_TWO-(y-1)*g),a,f,p,l,u,c,d,h,E),b=pointOnEllipsoid(_+Math.PI,a,f,p,l,u,c,d,h,b),t){for(A[x++]=E.x,A[x++]=E.y,A[x++]=E.z,C=2*(y-1)+2,v=1;v<C-1;++v)T=v/(C-1),S=Cartesian3.lerp(E,b,T,scratchCartesian3$a),A[x++]=S.x,A[x++]=S.y,A[x++]=S.z;A[x++]=b.x,A[x++]=b.y,A[x++]=b.z}i&&(M[D--]=E.z,M[D--]=E.y,M[D--]=E.x,M[w++]=b.x,M[w++]=b.y,M[w++]=b.z)}E=pointOnEllipsoid(-(_=CesiumMath.PI_OVER_TWO),a,f,p,l,u,c,d,h,E);var I={};return t&&(A[x++]=E.x,A[x++]=E.y,A[x++]=E.z,I.positions=A,I.numPts=m),i&&(M[D--]=E.z,M[D--]=E.y,M[D--]=E.x,I.outerPositions=M),I},EncodedCartesian3.encode=function(e,t){var i;return defined(t)||(t={high:0,low:0}),e>=0?(i=65536*Math.floor(e/65536),t.high=i,t.low=e-i):(i=65536*Math.floor(-e/65536),t.high=-i,t.low=e+i),t};var scratchEncode={high:0,low:0};EncodedCartesian3.fromCartesian=function(e,t){defined(t)||(t=new EncodedCartesian3);var i=t.high,r=t.low;return EncodedCartesian3.encode(e.x,scratchEncode),i.x=scratchEncode.high,r.x=scratchEncode.low,EncodedCartesian3.encode(e.y,scratchEncode),i.y=scratchEncode.high,r.y=scratchEncode.low,EncodedCartesian3.encode(e.z,scratchEncode),i.z=scratchEncode.high,r.z=scratchEncode.low,t};var encodedP=new EncodedCartesian3;EncodedCartesian3.writeElements=function(e,t,i){EncodedCartesian3.fromCartesian(e,encodedP);var r=encodedP.high,n=encodedP.low;t[i]=r.x,t[i+1]=r.y,t[i+2]=r.z,t[i+3]=n.x,t[i+4]=n.y,t[i+5]=n.z};var Tipsify={calculateACMR:function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).indices,i=e.maximumIndex,r=defaultValue(e.cacheSize,24),n=t.length;if(!defined(i)){i=0;for(var a=0,o=t[a];a<n;)o>i&&(i=o),o=t[++a]}for(var s=[],l=0;l<i+1;l++)s[l]=0;for(var c=r+1,u=0;u<n;++u)c-s[t[u]]>r&&(s[t[u]]=c,++c);return(c-r+1)/(n/3)}};Tipsify.tipsify=function(e){var t,i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).indices,r=e.maximumIndex,n=defaultValue(e.cacheSize,24);function a(e,i,r,n,a,o,s){for(var l,c=-1,u=-1,d=0;d<r.length;){var h=r[d];n[h].numLiveTriangles&&(l=0,a-n[h].timeStamp+2*n[h].numLiveTriangles<=i&&(l=a-n[h].timeStamp),(l>u||-1===u)&&(u=l,c=h)),++d}return-1===c?function(e,i,r,n){for(;i.length>=1;){var a=i[i.length-1];if(i.splice(i.length-1,1),e[a].numLiveTriangles>0)return a}for(;t<n;){if(e[t].numLiveTriangles>0)return++t-1;++t}return-1}(n,o,0,s):c}var o=i.length,s=0,l=0,c=i[l],u=o;if(defined(r))s=r+1;else{for(;l<u;)c>s&&(s=c),c=i[++l];if(-1===s)return 0;++s}var d,h=[];for(d=0;d<s;d++)h[d]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};l=0;for(var p=0;l<u;)h[i[l]].vertexTriangles.push(p),++h[i[l]].numLiveTriangles,h[i[l+1]].vertexTriangles.push(p),++h[i[l+1]].numLiveTriangles,h[i[l+2]].vertexTriangles.push(p),++h[i[l+2]].numLiveTriangles,++p,l+=3;var f=0,m=n+1;t=1;var g,_,y,v,C=[],T=[],S=0,A=[],x=o/3,E=[];for(d=0;d<x;d++)E[d]=!1;for(;-1!==f;){C=[],v=(_=h[f]).vertexTriangles.length;for(var b=0;b<v;++b)if(!E[p=_.vertexTriangles[b]]){E[p]=!0,l=p+p+p;for(var P=0;P<3;++P)y=i[l],C.push(y),T.push(y),A[S]=y,++S,--(g=h[y]).numLiveTriangles,m-g.timeStamp>n&&(g.timeStamp=m,++m),++l}f=a(0,n,C,h,m,T,s)}return A};var GeometryPipeline={};function addTriangle(e,t,i,r,n){e[t++]=i,e[t++]=r,e[t++]=r,e[t++]=n,e[t++]=n,e[t]=i}function trianglesToLines(e){for(var t=e.length,i=t/3*6,r=IndexDatatype$1.createTypedArray(t,i),n=0,a=0;a<t;a+=3,n+=6)addTriangle(r,n,e[a],e[a+1],e[a+2]);return r}function triangleStripToLines(e){var t=e.length;if(t>=3){var i=6*(t-2),r=IndexDatatype$1.createTypedArray(t,i);addTriangle(r,0,e[0],e[1],e[2]);for(var n=6,a=3;a<t;++a,n+=6)addTriangle(r,n,e[a-1],e[a],e[a-2]);return r}return new Uint16Array}function triangleFanToLines(e){if(e.length>0){for(var t=e.length-1,i=6*(t-1),r=IndexDatatype$1.createTypedArray(t,i),n=e[0],a=0,o=1;o<t;++o,a+=6)addTriangle(r,a,n,e[o],e[o+1]);return r}return new Uint16Array}function copyAttributesDescriptions(e){var t={};for(var i in e)if(e.hasOwnProperty(i)&&defined(e[i])&&defined(e[i].values)){var r=e[i];t[i]=new GeometryAttribute({componentDatatype:r.componentDatatype,componentsPerAttribute:r.componentsPerAttribute,normalize:r.normalize,values:[]})}return t}function copyVertex(e,t,i){for(var r in t)if(t.hasOwnProperty(r)&&defined(t[r])&&defined(t[r].values))for(var n=t[r],a=0;a<n.componentsPerAttribute;++a)e[r].values.push(n.values[i*n.componentsPerAttribute+a])}GeometryPipeline.toWireframe=function(e){var t=e.indices;if(defined(t)){switch(e.primitiveType){case PrimitiveType$1.TRIANGLES:e.indices=trianglesToLines(t);break;case PrimitiveType$1.TRIANGLE_STRIP:e.indices=triangleStripToLines(t);break;case PrimitiveType$1.TRIANGLE_FAN:e.indices=triangleFanToLines(t)}e.primitiveType=PrimitiveType$1.LINES}return e},GeometryPipeline.createLineSegmentsForVectors=function(e,t,i){t=defaultValue(t,"normal"),i=defaultValue(i,1e4);for(var r,n=e.attributes.position.values,a=e.attributes[t].values,o=n.length,s=new Float64Array(2*o),l=0,c=0;c<o;c+=3)s[l++]=n[c],s[l++]=n[c+1],s[l++]=n[c+2],s[l++]=n[c]+a[c]*i,s[l++]=n[c+1]+a[c+1]*i,s[l++]=n[c+2]+a[c+2]*i;var u=e.boundingSphere;return defined(u)&&(r=new BoundingSphere(u.center,u.radius+i)),new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:s})},primitiveType:PrimitiveType$1.LINES,boundingSphere:r})},GeometryPipeline.createAttributeLocations=function(e){var t,i=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","tangent","bitangent","extrudeDirection","compressedAttributes"],r=e.attributes,n={},a=0,o=i.length;for(t=0;t<o;++t){var s=i[t];defined(r[s])&&(n[s]=a++)}for(var l in r)r.hasOwnProperty(l)&&!defined(n[l])&&(n[l]=a++);return n},GeometryPipeline.reorderForPreVertexCache=function(e){var t=Geometry.computeNumberOfVertices(e),i=e.indices;if(defined(i)){for(var r=new Int32Array(t),n=0;n<t;n++)r[n]=-1;for(var a,o=i,s=o.length,l=IndexDatatype$1.createTypedArray(t,s),c=0,u=0,d=0;c<s;)-1!==(a=r[o[c]])?l[u]=a:(r[a=o[c]]=d,l[u]=d,++d),++c,++u;e.indices=l;var h=e.attributes;for(var p in h)if(h.hasOwnProperty(p)&&defined(h[p])&&defined(h[p].values)){for(var f=h[p],m=f.values,g=0,_=f.componentsPerAttribute,y=ComponentDatatype$1.createTypedArray(f.componentDatatype,d*_);g<t;){var v=r[g];if(-1!==v)for(var C=0;C<_;C++)y[_*v+C]=m[_*g+C];++g}f.values=y}}return e},GeometryPipeline.reorderForPostVertexCache=function(e,t){var i=e.indices;if(e.primitiveType===PrimitiveType$1.TRIANGLES&&defined(i)){for(var r=i.length,n=0,a=0;a<r;a++)i[a]>n&&(n=i[a]);e.indices=Tipsify.tipsify({indices:i,maximumIndex:n,cacheSize:t})}return e},GeometryPipeline.fitToUnsignedShortIndices=function(e){var t=[],i=Geometry.computeNumberOfVertices(e);if(defined(e.indices)&&i>=CesiumMath.SIXTY_FOUR_KILOBYTES){var r,n=[],a=[],o=0,s=copyAttributesDescriptions(e.attributes),l=e.indices,c=l.length;e.primitiveType===PrimitiveType$1.TRIANGLES?r=3:e.primitiveType===PrimitiveType$1.LINES?r=2:e.primitiveType===PrimitiveType$1.POINTS&&(r=1);for(var u=0;u<c;u+=r){for(var d=0;d<r;++d){var h=l[u+d],p=n[h];defined(p)||(p=o++,n[h]=p,copyVertex(s,e.attributes,h)),a.push(p)}o+r>=CesiumMath.SIXTY_FOUR_KILOBYTES&&(t.push(new Geometry({attributes:s,indices:a,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),n=[],a=[],o=0,s=copyAttributesDescriptions(e.attributes))}0!==a.length&&t.push(new Geometry({attributes:s,indices:a,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var scratchProjectTo2DCartesian3=new Cartesian3,scratchProjectTo2DCartographic=new Cartographic;GeometryPipeline.projectTo2D=function(e,t,i,r,n){for(var a=e.attributes[t],o=(n=defined(n)?n:new GeographicProjection).ellipsoid,s=a.values,l=new Float64Array(s.length),c=0,u=0;u<s.length;u+=3){var d=Cartesian3.fromArray(s,u,scratchProjectTo2DCartesian3),h=o.cartesianToCartographic(d,scratchProjectTo2DCartographic),p=n.project(h,scratchProjectTo2DCartesian3);l[c++]=p.x,l[c++]=p.y,l[c++]=p.z}return e.attributes[i]=a,e.attributes[r]=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:l}),delete e.attributes[t],e};var encodedResult={high:0,low:0};GeometryPipeline.encodeAttribute=function(e,t,i,r){for(var n=e.attributes[t],a=n.values,o=a.length,s=new Float32Array(o),l=new Float32Array(o),c=0;c<o;++c)EncodedCartesian3.encode(a[c],encodedResult),s[c]=encodedResult.high,l[c]=encodedResult.low;var u=n.componentsPerAttribute;return e.attributes[i]=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:u,values:s}),e.attributes[r]=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:u,values:l}),delete e.attributes[t],e};var scratchCartesian3$9=new Cartesian3;function transformPoint(e,t){if(defined(t))for(var i=t.values,r=i.length,n=0;n<r;n+=3)Cartesian3.unpack(i,n,scratchCartesian3$9),Matrix4.multiplyByPoint(e,scratchCartesian3$9,scratchCartesian3$9),Cartesian3.pack(scratchCartesian3$9,i,n)}function transformVector(e,t){if(defined(t))for(var i=t.values,r=i.length,n=0;n<r;n+=3)Cartesian3.unpack(i,n,scratchCartesian3$9),Matrix3.multiplyByVector(e,scratchCartesian3$9,scratchCartesian3$9),scratchCartesian3$9=Cartesian3.normalize(scratchCartesian3$9,scratchCartesian3$9),Cartesian3.pack(scratchCartesian3$9,i,n)}var inverseTranspose=new Matrix4,normalMatrix=new Matrix3;function findAttributesInAllGeometries(e,t){var i,r=e.length,n={},a=e[0][t].attributes;for(i in a)if(a.hasOwnProperty(i)&&defined(a[i])&&defined(a[i].values)){for(var o=a[i],s=o.values.length,l=!0,c=1;c<r;++c){var u=e[c][t].attributes[i];if(!defined(u)||o.componentDatatype!==u.componentDatatype||o.componentsPerAttribute!==u.componentsPerAttribute||o.normalize!==u.normalize){l=!1;break}s+=u.values.length}l&&(n[i]=new GeometryAttribute({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:ComponentDatatype$1.createTypedArray(o.componentDatatype,s)}))}return n}GeometryPipeline.transformToWorldCoordinates=function(e){var t=e.modelMatrix;if(Matrix4.equals(t,Matrix4.IDENTITY))return e;var i=e.geometry.attributes;transformPoint(t,i.position),transformPoint(t,i.prevPosition),transformPoint(t,i.nextPosition),(defined(i.normal)||defined(i.tangent)||defined(i.bitangent))&&(Matrix4.inverse(t,inverseTranspose),Matrix4.transpose(inverseTranspose,inverseTranspose),Matrix4.getMatrix3(inverseTranspose,normalMatrix),transformVector(normalMatrix,i.normal),transformVector(normalMatrix,i.tangent),transformVector(normalMatrix,i.bitangent));var r=e.geometry.boundingSphere;return defined(r)&&(e.geometry.boundingSphere=BoundingSphere.transform(r,t,r)),e.modelMatrix=Matrix4.clone(Matrix4.IDENTITY),e};var tempScratch$1=new Cartesian3;function combineGeometries(e,t){var i,r,n,a,o=e.length;e[0].modelMatrix;var s,l,c,u,d=defined(e[0][t].indices),h=e[0][t].primitiveType,p=findAttributesInAllGeometries(e,t);for(i in p)if(p.hasOwnProperty(i))for(s=p[i].values,a=0,r=0;r<o;++r)for(c=(l=e[r][t].attributes[i].values).length,n=0;n<c;++n)s[a++]=l[n];if(d){var f=0;for(r=0;r<o;++r)f+=e[r][t].indices.length;var m=Geometry.computeNumberOfVertices(new Geometry({attributes:p,primitiveType:PrimitiveType$1.POINTS})),g=IndexDatatype$1.createTypedArray(m,f),_=0,y=0;for(r=0;r<o;++r){var v=e[r][t].indices,C=v.length;for(a=0;a<C;++a)g[_++]=y+v[a];y+=Geometry.computeNumberOfVertices(e[r][t])}u=g}var T,S=new Cartesian3,A=0;for(r=0;r<o;++r){if(!defined(T=e[r][t].boundingSphere)){S=void 0;break}Cartesian3.add(T.center,S,S)}if(defined(S))for(Cartesian3.divideByScalar(S,o,S),r=0;r<o;++r){T=e[r][t].boundingSphere;var x=Cartesian3.magnitude(Cartesian3.subtract(T.center,S,tempScratch$1))+T.radius;x>A&&(A=x)}return new Geometry({attributes:p,indices:u,primitiveType:h,boundingSphere:defined(S)?new BoundingSphere(S,A):void 0})}GeometryPipeline.combineInstances=function(e){for(var t=[],i=[],r=e.length,n=0;n<r;++n){var a=e[n];defined(a.geometry)?t.push(a):defined(a.westHemisphereGeometry)&&defined(a.eastHemisphereGeometry)&&i.push(a)}var o=[];return t.length>0&&o.push(combineGeometries(t,"geometry")),i.length>0&&(o.push(combineGeometries(i,"westHemisphereGeometry")),o.push(combineGeometries(i,"eastHemisphereGeometry"))),o};var normal=new Cartesian3,v0=new Cartesian3,v1$1=new Cartesian3,v2$1=new Cartesian3;GeometryPipeline.computeNormal=function(e){var t,i=e.indices,r=e.attributes,n=r.position.values,a=r.position.values.length/3,o=i.length,s=new Array(a),l=new Array(o/3),c=new Array(o);for(t=0;t<a;t++)s[t]={indexOffset:0,count:0,currentCount:0};var u=0;for(t=0;t<o;t+=3){var d=i[t],h=i[t+1],p=i[t+2],f=3*d,m=3*h,g=3*p;v0.x=n[f],v0.y=n[f+1],v0.z=n[f+2],v1$1.x=n[m],v1$1.y=n[m+1],v1$1.z=n[m+2],v2$1.x=n[g],v2$1.y=n[g+1],v2$1.z=n[g+2],s[d].count++,s[h].count++,s[p].count++,Cartesian3.subtract(v1$1,v0,v1$1),Cartesian3.subtract(v2$1,v0,v2$1),l[u]=Cartesian3.cross(v1$1,v2$1,new Cartesian3),u++}var _,y=0;for(t=0;t<a;t++)s[t].indexOffset+=y,y+=s[t].count;for(u=0,t=0;t<o;t+=3){var v=(_=s[i[t]]).indexOffset+_.currentCount;c[v]=u,_.currentCount++,c[v=(_=s[i[t+1]]).indexOffset+_.currentCount]=u,_.currentCount++,c[v=(_=s[i[t+2]]).indexOffset+_.currentCount]=u,_.currentCount++,u++}var C=new Float32Array(3*a);for(t=0;t<a;t++){var T=3*t;if(_=s[t],Cartesian3.clone(Cartesian3.ZERO,normal),_.count>0){for(u=0;u<_.count;u++)Cartesian3.add(normal,l[c[_.indexOffset+u]],normal);Cartesian3.equalsEpsilon(Cartesian3.ZERO,normal,CesiumMath.EPSILON10)&&Cartesian3.clone(l[c[_.indexOffset]],normal)}Cartesian3.equalsEpsilon(Cartesian3.ZERO,normal,CesiumMath.EPSILON10)&&(normal.z=1),Cartesian3.normalize(normal,normal),C[T]=normal.x,C[T+1]=normal.y,C[T+2]=normal.z}return e.attributes.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:C}),e};var normalScratch$4=new Cartesian3,normalScale=new Cartesian3,tScratch=new Cartesian3;GeometryPipeline.computeTangentAndBitangent=function(e){e.attributes;var t,i,r,n,a=e.indices,o=e.attributes.position.values,s=e.attributes.normal.values,l=e.attributes.st.values,c=e.attributes.position.values.length/3,u=a.length,d=new Array(3*c);for(t=0;t<d.length;t++)d[t]=0;for(t=0;t<u;t+=3){var h=a[t],p=a[t+1],f=a[t+2];r=3*p,n=3*f;var m=2*h,g=2*p,_=2*f,y=o[i=3*h],v=o[i+1],C=o[i+2],T=l[m],S=l[m+1],A=l[g+1]-S,x=l[_+1]-S,E=1/((l[g]-T)*x-(l[_]-T)*A),b=(x*(o[r]-y)-A*(o[n]-y))*E,P=(x*(o[r+1]-v)-A*(o[n+1]-v))*E,D=(x*(o[r+2]-C)-A*(o[n+2]-C))*E;d[i]+=b,d[i+1]+=P,d[i+2]+=D,d[r]+=b,d[r+1]+=P,d[r+2]+=D,d[n]+=b,d[n+1]+=P,d[n+2]+=D}var w=new Float32Array(3*c),M=new Float32Array(3*c);for(t=0;t<c;t++){r=(i=3*t)+1,n=i+2;var I=Cartesian3.fromArray(s,i,normalScratch$4),R=Cartesian3.fromArray(d,i,tScratch),O=Cartesian3.dot(I,R);Cartesian3.multiplyByScalar(I,O,normalScale),Cartesian3.normalize(Cartesian3.subtract(R,normalScale,R),R),w[i]=R.x,w[r]=R.y,w[n]=R.z,Cartesian3.normalize(Cartesian3.cross(I,R,R),R),M[i]=R.x,M[r]=R.y,M[n]=R.z}return e.attributes.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:w}),e.attributes.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:M}),e};var scratchCartesian2$8=new Cartesian2,toEncode1=new Cartesian3,toEncode2=new Cartesian3,toEncode3=new Cartesian3,encodeResult2=new Cartesian2;function indexTriangles(e){if(defined(e.indices))return e;for(var t=Geometry.computeNumberOfVertices(e),i=IndexDatatype$1.createTypedArray(t,t),r=0;r<t;++r)i[r]=r;return e.indices=i,e}function indexTriangleFan(e){var t=Geometry.computeNumberOfVertices(e),i=IndexDatatype$1.createTypedArray(t,3*(t-2));i[0]=1,i[1]=0,i[2]=2;for(var r=3,n=3;n<t;++n)i[r++]=n-1,i[r++]=0,i[r++]=n;return e.indices=i,e.primitiveType=PrimitiveType$1.TRIANGLES,e}function indexTriangleStrip(e){var t=Geometry.computeNumberOfVertices(e),i=IndexDatatype$1.createTypedArray(t,3*(t-2));i[0]=0,i[1]=1,i[2]=2,t>3&&(i[3]=0,i[4]=2,i[5]=3);for(var r=6,n=3;n<t-1;n+=2)i[r++]=n,i[r++]=n-1,i[r++]=n+1,n+2<t&&(i[r++]=n,i[r++]=n+1,i[r++]=n+2);return e.indices=i,e.primitiveType=PrimitiveType$1.TRIANGLES,e}function indexLines(e){if(defined(e.indices))return e;for(var t=Geometry.computeNumberOfVertices(e),i=IndexDatatype$1.createTypedArray(t,t),r=0;r<t;++r)i[r]=r;return e.indices=i,e}function indexLineStrip(e){var t=Geometry.computeNumberOfVertices(e),i=IndexDatatype$1.createTypedArray(t,2*(t-1));i[0]=0,i[1]=1;for(var r=2,n=2;n<t;++n)i[r++]=n-1,i[r++]=n;return e.indices=i,e.primitiveType=PrimitiveType$1.LINES,e}function indexLineLoop(e){var t=Geometry.computeNumberOfVertices(e),i=IndexDatatype$1.createTypedArray(t,2*t);i[0]=0,i[1]=1;for(var r=2,n=2;n<t;++n)i[r++]=n-1,i[r++]=n;return i[r++]=t-1,i[r]=0,e.indices=i,e.primitiveType=PrimitiveType$1.LINES,e}function indexPrimitive(e){switch(e.primitiveType){case PrimitiveType$1.TRIANGLE_FAN:return indexTriangleFan(e);case PrimitiveType$1.TRIANGLE_STRIP:return indexTriangleStrip(e);case PrimitiveType$1.TRIANGLES:return indexTriangles(e);case PrimitiveType$1.LINE_STRIP:return indexLineStrip(e);case PrimitiveType$1.LINE_LOOP:return indexLineLoop(e);case PrimitiveType$1.LINES:return indexLines(e)}return e}function offsetPointFromXZPlane(e,t){Math.abs(e.y)<CesiumMath.EPSILON6&&(e.y=t?-CesiumMath.EPSILON6:CesiumMath.EPSILON6)}function offsetTriangleFromXZPlane(e,t,i){if(0!==e.y&&0!==t.y&&0!==i.y)return offsetPointFromXZPlane(e,e.y<0),offsetPointFromXZPlane(t,t.y<0),void offsetPointFromXZPlane(i,i.y<0);var r=Math.abs(e.y),n=Math.abs(t.y),a=Math.abs(i.y),o=(r>n?r>a?CesiumMath.sign(e.y):CesiumMath.sign(i.y):n>a?CesiumMath.sign(t.y):CesiumMath.sign(i.y))<0;offsetPointFromXZPlane(e,o),offsetPointFromXZPlane(t,o),offsetPointFromXZPlane(i,o)}GeometryPipeline.compressVertices=function(e){var t,i,r=e.attributes.extrudeDirection;if(defined(r)){var n=r.values;i=n.length/3;var a=new Float32Array(2*i),o=0;for(t=0;t<i;++t)Cartesian3.fromArray(n,3*t,toEncode1),Cartesian3.equals(toEncode1,Cartesian3.ZERO)?o+=2:(encodeResult2=AttributeCompression.octEncodeInRange(toEncode1,65535,encodeResult2),a[o++]=encodeResult2.x,a[o++]=encodeResult2.y);return e.attributes.compressedAttributes=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:a}),delete e.attributes.extrudeDirection,e}var s=e.attributes.normal,l=e.attributes.st,c=defined(s),u=defined(l);if(!c&&!u)return e;var d,h,p,f,m=e.attributes.tangent,g=e.attributes.bitangent,_=defined(m),y=defined(g);c&&(d=s.values),u&&(h=l.values),_&&(p=m.values),y&&(f=g.values);var v=i=(c?d.length:h.length)/(c?3:2),C=u&&c?2:1;C+=_||y?1:0;var T=new Float32Array(v*=C),S=0;for(t=0;t<i;++t){u&&(Cartesian2.fromArray(h,2*t,scratchCartesian2$8),T[S++]=AttributeCompression.compressTextureCoordinates(scratchCartesian2$8));var A=3*t;c&&defined(p)&&defined(f)?(Cartesian3.fromArray(d,A,toEncode1),Cartesian3.fromArray(p,A,toEncode2),Cartesian3.fromArray(f,A,toEncode3),AttributeCompression.octPack(toEncode1,toEncode2,toEncode3,scratchCartesian2$8),T[S++]=scratchCartesian2$8.x,T[S++]=scratchCartesian2$8.y):(c&&(Cartesian3.fromArray(d,A,toEncode1),T[S++]=AttributeCompression.octEncodeFloat(toEncode1)),_&&(Cartesian3.fromArray(p,A,toEncode1),T[S++]=AttributeCompression.octEncodeFloat(toEncode1)),y&&(Cartesian3.fromArray(f,A,toEncode1),T[S++]=AttributeCompression.octEncodeFloat(toEncode1)))}return e.attributes.compressedAttributes=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:C,values:T}),c&&delete e.attributes.normal,u&&delete e.attributes.st,y&&delete e.attributes.bitangent,_&&delete e.attributes.tangent,e};var c3$1=new Cartesian3;function getXZIntersectionOffsetPoints(e,t,i,r){Cartesian3.add(e,Cartesian3.multiplyByScalar(Cartesian3.subtract(t,e,c3$1),e.y/(e.y-t.y),c3$1),i),Cartesian3.clone(i,r),offsetPointFromXZPlane(i,!0),offsetPointFromXZPlane(r,!1)}var u1=new Cartesian3,u2=new Cartesian3,q1=new Cartesian3,q2=new Cartesian3,splitTriangleResult={positions:new Array(7),indices:new Array(9)};function splitTriangle(e,t,i){if(!(e.x>=0||t.x>=0||i.x>=0)){offsetTriangleFromXZPlane(e,t,i);var r=e.y<0,n=t.y<0,a=i.y<0,o=0;o+=r?1:0,o+=n?1:0,o+=a?1:0;var s=splitTriangleResult.indices;1===o?(s[1]=3,s[2]=4,s[5]=6,s[7]=6,s[8]=5,r?(getXZIntersectionOffsetPoints(e,t,u1,q1),getXZIntersectionOffsetPoints(e,i,u2,q2),s[0]=0,s[3]=1,s[4]=2,s[6]=1):n?(getXZIntersectionOffsetPoints(t,i,u1,q1),getXZIntersectionOffsetPoints(t,e,u2,q2),s[0]=1,s[3]=2,s[4]=0,s[6]=2):a&&(getXZIntersectionOffsetPoints(i,e,u1,q1),getXZIntersectionOffsetPoints(i,t,u2,q2),s[0]=2,s[3]=0,s[4]=1,s[6]=0)):2===o&&(s[2]=4,s[4]=4,s[5]=3,s[7]=5,s[8]=6,r?n?a||(getXZIntersectionOffsetPoints(i,e,u1,q1),getXZIntersectionOffsetPoints(i,t,u2,q2),s[0]=0,s[1]=1,s[3]=0,s[6]=2):(getXZIntersectionOffsetPoints(t,i,u1,q1),getXZIntersectionOffsetPoints(t,e,u2,q2),s[0]=2,s[1]=0,s[3]=2,s[6]=1):(getXZIntersectionOffsetPoints(e,t,u1,q1),getXZIntersectionOffsetPoints(e,i,u2,q2),s[0]=1,s[1]=2,s[3]=1,s[6]=0));var l=splitTriangleResult.positions;return l[0]=e,l[1]=t,l[2]=i,l.length=3,1!==o&&2!==o||(l[3]=u1,l[4]=u2,l[5]=q1,l[6]=q2,l.length=7),splitTriangleResult}}function updateGeometryAfterSplit(e,t){var i=e.attributes;if(0!==i.position.values.length){for(var r in i)if(i.hasOwnProperty(r)&&defined(i[r])&&defined(i[r].values)){var n=i[r];n.values=ComponentDatatype$1.createTypedArray(n.componentDatatype,n.values)}var a=Geometry.computeNumberOfVertices(e);return e.indices=IndexDatatype$1.createTypedArray(a,e.indices),t&&(e.boundingSphere=BoundingSphere.fromVertices(i.position.values)),e}}function copyGeometryForSplit(e){var t=e.attributes,i={};for(var r in t)if(t.hasOwnProperty(r)&&defined(t[r])&&defined(t[r].values)){var n=t[r];i[r]=new GeometryAttribute({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return new Geometry({attributes:i,indices:[],primitiveType:e.primitiveType})}function updateInstanceAfterSplit(e,t,i){var r=defined(e.geometry.boundingSphere);t=updateGeometryAfterSplit(t,r),defined(i=updateGeometryAfterSplit(i,r))&&!defined(t)?e.geometry=i:!defined(i)&&defined(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=i,e.geometry=void 0)}function generateBarycentricInterpolateFunction(e,t){var i=new e,r=new e,n=new e;return function(a,o,s,l,c,u,d,h){var p=e.fromArray(c,a*t,i),f=e.fromArray(c,o*t,r),m=e.fromArray(c,s*t,n);e.multiplyByScalar(p,l.x,p),e.multiplyByScalar(f,l.y,f),e.multiplyByScalar(m,l.z,m);var g=e.add(p,f,p);e.add(g,m,g),h&&e.normalize(g,g),e.pack(g,u,d*t)}}var interpolateAndPackCartesian4=generateBarycentricInterpolateFunction(Cartesian4,4),interpolateAndPackCartesian3=generateBarycentricInterpolateFunction(Cartesian3,3),interpolateAndPackCartesian2=generateBarycentricInterpolateFunction(Cartesian2,2),interpolateAndPackBoolean=function(e,t,i,r,n,a,o){var s=n[e]*r.x,l=n[t]*r.y,c=n[i]*r.z;a[o]=s+l+c>CesiumMath.EPSILON6?1:0},p0Scratch=new Cartesian3,p1Scratch$2=new Cartesian3,p2Scratch$2=new Cartesian3,barycentricScratch=new Cartesian3;function computeTriangleAttributes(e,t,i,r,n,a,o,s,l,c,u,d,h,p,f,m){if(defined(a)||defined(o)||defined(s)||defined(l)||defined(c)||0!==p){var g=barycentricCoordinates(r,Cartesian3.fromArray(n,3*e,p0Scratch),Cartesian3.fromArray(n,3*t,p1Scratch$2),Cartesian3.fromArray(n,3*i,p2Scratch$2),barycentricScratch);if(defined(a)&&interpolateAndPackCartesian3(e,t,i,g,a,d.normal.values,m,!0),defined(c)){var _,y=Cartesian3.fromArray(c,3*e,p0Scratch),v=Cartesian3.fromArray(c,3*t,p1Scratch$2),C=Cartesian3.fromArray(c,3*i,p2Scratch$2);Cartesian3.multiplyByScalar(y,g.x,y),Cartesian3.multiplyByScalar(v,g.y,v),Cartesian3.multiplyByScalar(C,g.z,C),Cartesian3.equals(y,Cartesian3.ZERO)&&Cartesian3.equals(v,Cartesian3.ZERO)&&Cartesian3.equals(C,Cartesian3.ZERO)?((_=p0Scratch).x=0,_.y=0,_.z=0):(_=Cartesian3.add(y,v,y),Cartesian3.add(_,C,_),Cartesian3.normalize(_,_)),Cartesian3.pack(_,d.extrudeDirection.values,3*m)}if(defined(u)&&interpolateAndPackBoolean(e,t,i,g,u,d.applyOffset.values,m),defined(o)&&interpolateAndPackCartesian3(e,t,i,g,o,d.tangent.values,m,!0),defined(s)&&interpolateAndPackCartesian3(e,t,i,g,s,d.bitangent.values,m,!0),defined(l)&&interpolateAndPackCartesian2(e,t,i,g,l,d.st.values,m),p>0)for(var T=0;T<p;T++){var S=h[T];genericInterpolate(e,t,i,g,m,f[S],d[S])}}}function genericInterpolate(e,t,i,r,n,a,o){var s=a.componentsPerAttribute,l=a.values,c=o.values;switch(s){case 4:interpolateAndPackCartesian4(e,t,i,r,l,c,n,!1);break;case 3:interpolateAndPackCartesian3(e,t,i,r,l,c,n,!1);break;case 2:interpolateAndPackCartesian2(e,t,i,r,l,c,n,!1);break;default:c[n]=l[e]*r.x+l[t]*r.y+l[i]*r.z}}function insertSplitPoint(e,t,i,r,n,a){var o=e.position.values.length/3;if(-1!==n){var s=r[n],l=i[s];return-1===l?(i[s]=o,e.position.values.push(a.x,a.y,a.z),t.push(o),o):(t.push(l),l)}return e.position.values.push(a.x,a.y,a.z),t.push(o),o}var NAMED_ATTRIBUTES={position:!0,normal:!0,bitangent:!0,tangent:!0,st:!0,extrudeDirection:!0,applyOffset:!0};function splitLongitudeTriangles(e){var t=e.geometry,i=t.attributes,r=i.position.values,n=defined(i.normal)?i.normal.values:void 0,a=defined(i.bitangent)?i.bitangent.values:void 0,o=defined(i.tangent)?i.tangent.values:void 0,s=defined(i.st)?i.st.values:void 0,l=defined(i.extrudeDirection)?i.extrudeDirection.values:void 0,c=defined(i.applyOffset)?i.applyOffset.values:void 0,u=t.indices,d=[];for(var h in i)i.hasOwnProperty(h)&&!NAMED_ATTRIBUTES[h]&&defined(i[h])&&d.push(h);var p,f,m,g,_=d.length,y=copyGeometryForSplit(t),v=copyGeometryForSplit(t),C=[];C.length=r.length/3;var T=[];for(T.length=r.length/3,g=0;g<C.length;++g)C[g]=-1,T[g]=-1;var S=u.length;for(g=0;g<S;g+=3){var A=u[g],x=u[g+1],E=u[g+2],b=Cartesian3.fromArray(r,3*A),P=Cartesian3.fromArray(r,3*x),D=Cartesian3.fromArray(r,3*E),w=splitTriangle(b,P,D);if(defined(w)&&w.positions.length>3)for(var M=w.positions,I=w.indices,R=I.length,O=0;O<R;++O){var B=I[O],L=M[B];L.y<0?(p=v.attributes,f=v.indices,m=C):(p=y.attributes,f=y.indices,m=T),computeTriangleAttributes(A,x,E,L,r,n,o,a,s,l,c,p,d,_,i,insertSplitPoint(p,f,m,u,B<3?g+B:-1,L))}else defined(w)&&(b=w.positions[0],P=w.positions[1],D=w.positions[2]),b.y<0?(p=v.attributes,f=v.indices,m=C):(p=y.attributes,f=y.indices,m=T),computeTriangleAttributes(A,x,E,b,r,n,o,a,s,l,c,p,d,_,i,insertSplitPoint(p,f,m,u,g,b)),computeTriangleAttributes(A,x,E,P,r,n,o,a,s,l,c,p,d,_,i,insertSplitPoint(p,f,m,u,g+1,P)),computeTriangleAttributes(A,x,E,D,r,n,o,a,s,l,c,p,d,_,i,insertSplitPoint(p,f,m,u,g+2,D))}updateInstanceAfterSplit(e,v,y)}var xzPlane=Plane.fromPointNormal(Cartesian3.ZERO,Cartesian3.UNIT_Y),offsetScratch$c=new Cartesian3,offsetPointScratch=new Cartesian3;function computeLineAttributes(e,t,i,r,n,a,o){if(defined(o)){var s=Cartesian3.fromArray(r,3*e,p0Scratch);Cartesian3.equalsEpsilon(s,i,CesiumMath.EPSILON10)?a.applyOffset.values[n]=o[e]:a.applyOffset.values[n]=o[t]}}function splitLongitudeLines(e){var t,i=e.geometry,r=i.attributes,n=r.position.values,a=defined(r.applyOffset)?r.applyOffset.values:void 0,o=i.indices,s=copyGeometryForSplit(i),l=copyGeometryForSplit(i),c=o.length,u=[];u.length=n.length/3;var d=[];for(d.length=n.length/3,t=0;t<u.length;++t)u[t]=-1,d[t]=-1;for(t=0;t<c;t+=2){var h=o[t],p=o[t+1],f=Cartesian3.fromArray(n,3*h,p0Scratch),m=Cartesian3.fromArray(n,3*p,p1Scratch$2);Math.abs(f.y)<CesiumMath.EPSILON6&&(f.y<0?f.y=-CesiumMath.EPSILON6:f.y=CesiumMath.EPSILON6),Math.abs(m.y)<CesiumMath.EPSILON6&&(m.y<0?m.y=-CesiumMath.EPSILON6:m.y=CesiumMath.EPSILON6);var g=s.attributes,_=s.indices,y=d,v=l.attributes,C=l.indices,T=u,S=IntersectionTests.lineSegmentPlane(f,m,xzPlane,p2Scratch$2);if(defined(S)){var A=Cartesian3.multiplyByScalar(Cartesian3.UNIT_Y,5*CesiumMath.EPSILON9,offsetScratch$c);f.y<0&&(Cartesian3.negate(A,A),g=l.attributes,_=l.indices,y=u,v=s.attributes,C=s.indices,T=d);var x=Cartesian3.add(S,A,offsetPointScratch);computeLineAttributes(h,p,f,n,insertSplitPoint(g,_,y,o,t,f),g,a),computeLineAttributes(h,p,x,n,insertSplitPoint(g,_,y,o,-1,x),g,a),Cartesian3.negate(A,A),Cartesian3.add(S,A,x),computeLineAttributes(h,p,x,n,insertSplitPoint(v,C,T,o,-1,x),v,a),computeLineAttributes(h,p,m,n,insertSplitPoint(v,C,T,o,t+1,m),v,a)}else{var E,b,P;f.y<0?(E=l.attributes,b=l.indices,P=u):(E=s.attributes,b=s.indices,P=d),computeLineAttributes(h,p,f,n,insertSplitPoint(E,b,P,o,t,f),E,a),computeLineAttributes(h,p,m,n,insertSplitPoint(E,b,P,o,t+1,m),E,a)}}updateInstanceAfterSplit(e,l,s)}var cartesian2Scratch0=new Cartesian2,cartesian2Scratch1=new Cartesian2,cartesian3Scratch0=new Cartesian3,cartesian3Scratch2$1=new Cartesian3,cartesian3Scratch3$1=new Cartesian3,cartesian3Scratch4=new Cartesian3,cartesian3Scratch5=new Cartesian3,cartesian3Scratch6=new Cartesian3,cartesian4Scratch0=new Cartesian4;function updateAdjacencyAfterSplit(e){for(var t=e.attributes,i=t.position.values,r=t.prevPosition.values,n=t.nextPosition.values,a=i.length,o=0;o<a;o+=3){var s=Cartesian3.unpack(i,o,cartesian3Scratch0);if(!(s.x>0)){var l=Cartesian3.unpack(r,o,cartesian3Scratch2$1);(s.y<0&&l.y>0||s.y>0&&l.y<0)&&(o-3>0?(r[o]=i[o-3],r[o+1]=i[o-2],r[o+2]=i[o-1]):Cartesian3.pack(s,r,o));var c=Cartesian3.unpack(n,o,cartesian3Scratch3$1);(s.y<0&&c.y>0||s.y>0&&c.y<0)&&(o+3<a?(n[o]=i[o+3],n[o+1]=i[o+4],n[o+2]=i[o+5]):Cartesian3.pack(s,n,o))}}}var offsetScalar=5*CesiumMath.EPSILON9,coplanarOffset=CesiumMath.EPSILON6;function splitLongitudePolyline(e){var t,i,r,n=e.geometry,a=n.attributes,o=a.position.values,s=a.prevPosition.values,l=a.nextPosition.values,c=a.expandAndWidth.values,u=defined(a.st)?a.st.values:void 0,d=defined(a.color)?a.color.values:void 0,h=copyGeometryForSplit(n),p=copyGeometryForSplit(n),f=!1,m=o.length/3;for(t=0;t<m;t+=4){var g=t,_=t+2,y=Cartesian3.fromArray(o,3*g,cartesian3Scratch0),v=Cartesian3.fromArray(o,3*_,cartesian3Scratch2$1);if(Math.abs(y.y)<coplanarOffset)for(y.y=coplanarOffset*(v.y<0?-1:1),o[3*t+1]=y.y,o[3*(t+1)+1]=y.y,i=3*g;i<3*g+12;i+=3)s[i]=o[3*t],s[i+1]=o[3*t+1],s[i+2]=o[3*t+2];if(Math.abs(v.y)<coplanarOffset)for(v.y=coplanarOffset*(y.y<0?-1:1),o[3*(t+2)+1]=v.y,o[3*(t+3)+1]=v.y,i=3*g;i<3*g+12;i+=3)l[i]=o[3*(t+2)],l[i+1]=o[3*(t+2)+1],l[i+2]=o[3*(t+2)+2];var C=h.attributes,T=h.indices,S=p.attributes,A=p.indices,x=IntersectionTests.lineSegmentPlane(y,v,xzPlane,cartesian3Scratch4);if(defined(x)){f=!0;var E=Cartesian3.multiplyByScalar(Cartesian3.UNIT_Y,offsetScalar,cartesian3Scratch5);y.y<0&&(Cartesian3.negate(E,E),C=p.attributes,T=p.indices,S=h.attributes,A=h.indices);var b=Cartesian3.add(x,E,cartesian3Scratch6);C.position.values.push(y.x,y.y,y.z,y.x,y.y,y.z),C.position.values.push(b.x,b.y,b.z),C.position.values.push(b.x,b.y,b.z),C.prevPosition.values.push(s[3*g],s[3*g+1],s[3*g+2]),C.prevPosition.values.push(s[3*g+3],s[3*g+4],s[3*g+5]),C.prevPosition.values.push(y.x,y.y,y.z,y.x,y.y,y.z),C.nextPosition.values.push(b.x,b.y,b.z),C.nextPosition.values.push(b.x,b.y,b.z),C.nextPosition.values.push(b.x,b.y,b.z),C.nextPosition.values.push(b.x,b.y,b.z),Cartesian3.negate(E,E),Cartesian3.add(x,E,b),S.position.values.push(b.x,b.y,b.z),S.position.values.push(b.x,b.y,b.z),S.position.values.push(v.x,v.y,v.z,v.x,v.y,v.z),S.prevPosition.values.push(b.x,b.y,b.z),S.prevPosition.values.push(b.x,b.y,b.z),S.prevPosition.values.push(b.x,b.y,b.z),S.prevPosition.values.push(b.x,b.y,b.z),S.nextPosition.values.push(v.x,v.y,v.z,v.x,v.y,v.z),S.nextPosition.values.push(l[3*_],l[3*_+1],l[3*_+2]),S.nextPosition.values.push(l[3*_+3],l[3*_+4],l[3*_+5]);var P=Cartesian2.fromArray(c,2*g,cartesian2Scratch0),D=Math.abs(P.y);C.expandAndWidth.values.push(-1,D,1,D),C.expandAndWidth.values.push(-1,-D,1,-D),S.expandAndWidth.values.push(-1,D,1,D),S.expandAndWidth.values.push(-1,-D,1,-D);var w=Cartesian3.magnitudeSquared(Cartesian3.subtract(x,y,cartesian3Scratch3$1));if(w/=Cartesian3.magnitudeSquared(Cartesian3.subtract(v,y,cartesian3Scratch3$1)),defined(d)){var M=Cartesian4.fromArray(d,4*g,cartesian4Scratch0),I=Cartesian4.fromArray(d,4*_,cartesian4Scratch0),R=CesiumMath.lerp(M.x,I.x,w),O=CesiumMath.lerp(M.y,I.y,w),B=CesiumMath.lerp(M.z,I.z,w),L=CesiumMath.lerp(M.w,I.w,w);for(i=4*g;i<4*g+8;++i)C.color.values.push(d[i]);for(C.color.values.push(R,O,B,L),C.color.values.push(R,O,B,L),S.color.values.push(R,O,B,L),S.color.values.push(R,O,B,L),i=4*_;i<4*_+8;++i)S.color.values.push(d[i])}if(defined(u)){var F=Cartesian2.fromArray(u,2*g,cartesian2Scratch0),N=Cartesian2.fromArray(u,2*(t+3),cartesian2Scratch1),V=CesiumMath.lerp(F.x,N.x,w);for(i=2*g;i<2*g+4;++i)C.st.values.push(u[i]);for(C.st.values.push(V,F.y),C.st.values.push(V,N.y),S.st.values.push(V,F.y),S.st.values.push(V,N.y),i=2*_;i<2*_+4;++i)S.st.values.push(u[i])}r=C.position.values.length/3-4,T.push(r,r+2,r+1),T.push(r+1,r+2,r+3),r=S.position.values.length/3-4,A.push(r,r+2,r+1),A.push(r+1,r+2,r+3)}else{var k,U;for(y.y<0?(k=p.attributes,U=p.indices):(k=h.attributes,U=h.indices),k.position.values.push(y.x,y.y,y.z),k.position.values.push(y.x,y.y,y.z),k.position.values.push(v.x,v.y,v.z),k.position.values.push(v.x,v.y,v.z),i=3*t;i<3*t+12;++i)k.prevPosition.values.push(s[i]),k.nextPosition.values.push(l[i]);for(i=2*t;i<2*t+8;++i)k.expandAndWidth.values.push(c[i]),defined(u)&&k.st.values.push(u[i]);if(defined(d))for(i=4*t;i<4*t+16;++i)k.color.values.push(d[i]);r=k.position.values.length/3-4,U.push(r,r+2,r+1),U.push(r+1,r+2,r+3)}}f&&(updateAdjacencyAfterSplit(p),updateAdjacencyAfterSplit(h)),updateInstanceAfterSplit(e,p,h)}GeometryPipeline.splitLongitude=function(e){var t=e.geometry,i=t.boundingSphere;if(defined(i)&&(i.center.x-i.radius>0||BoundingSphere.intersectPlane(i,Plane.ORIGIN_ZX_PLANE)!==Intersect$1.INTERSECTING))return e;if(t.geometryType!==GeometryType$1.NONE)switch(t.geometryType){case GeometryType$1.POLYLINES:splitLongitudePolyline(e);break;case GeometryType$1.TRIANGLES:splitLongitudeTriangles(e);break;case GeometryType$1.LINES:splitLongitudeLines(e)}else indexPrimitive(t),t.primitiveType===PrimitiveType$1.TRIANGLES?splitLongitudeTriangles(e):t.primitiveType===PrimitiveType$1.LINES&&splitLongitudeLines(e);return e};var scratchCartesian1$5=new Cartesian3,scratchCartesian2$7=new Cartesian3,scratchCartesian3$8=new Cartesian3,scratchCartesian4$5=new Cartesian3,texCoordScratch=new Cartesian2,textureMatrixScratch$1=new Matrix3,tangentMatrixScratch$1=new Matrix3,quaternionScratch$3=new Quaternion,scratchNormal$5=new Cartesian3,scratchTangent$4=new Cartesian3,scratchBitangent$4=new Cartesian3,scratchCartographic$g=new Cartographic,projectedCenterScratch=new Cartesian3,scratchMinTexCoord=new Cartesian2,scratchMaxTexCoord=new Cartesian2;function computeTopBottomAttributes(e,t,i){var r=t.vertexFormat,n=t.center,a=t.semiMajorAxis,o=t.semiMinorAxis,s=t.ellipsoid,l=t.stRotation,c=i?e.length/3*2:e.length/3,u=t.shadowVolume,d=r.st?new Float32Array(2*c):void 0,h=r.normal?new Float32Array(3*c):void 0,p=r.tangent?new Float32Array(3*c):void 0,f=r.bitangent?new Float32Array(3*c):void 0,m=u?new Float32Array(3*c):void 0,g=0,_=scratchNormal$5,y=scratchTangent$4,v=scratchBitangent$4,C=new GeographicProjection(s),T=C.project(s.cartesianToCartographic(n,scratchCartographic$g),projectedCenterScratch),S=s.scaleToGeodeticSurface(n,scratchCartesian1$5);s.geodeticSurfaceNormal(S,S);var A=textureMatrixScratch$1,x=tangentMatrixScratch$1;if(0!==l){var E=Quaternion.fromAxisAngle(S,l,quaternionScratch$3);A=Matrix3.fromQuaternion(E,A),E=Quaternion.fromAxisAngle(S,-l,quaternionScratch$3),x=Matrix3.fromQuaternion(E,x)}else A=Matrix3.clone(Matrix3.IDENTITY,A),x=Matrix3.clone(Matrix3.IDENTITY,x);for(var b=Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,scratchMinTexCoord),P=Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,scratchMaxTexCoord),D=e.length,w=i?D:0,M=w/3*2,I=0;I<D;I+=3){var R=I+1,O=I+2,B=Cartesian3.fromArray(e,I,scratchCartesian1$5);if(r.st){var L=Matrix3.multiplyByVector(A,B,scratchCartesian2$7),F=C.project(s.cartesianToCartographic(L,scratchCartographic$g),scratchCartesian3$8);Cartesian3.subtract(F,T,F),texCoordScratch.x=(F.x+a)/(2*a),texCoordScratch.y=(F.y+o)/(2*o),b.x=Math.min(texCoordScratch.x,b.x),b.y=Math.min(texCoordScratch.y,b.y),P.x=Math.max(texCoordScratch.x,P.x),P.y=Math.max(texCoordScratch.y,P.y),i&&(d[g+M]=texCoordScratch.x,d[g+1+M]=texCoordScratch.y),d[g++]=texCoordScratch.x,d[g++]=texCoordScratch.y}(r.normal||r.tangent||r.bitangent||u)&&(_=s.geodeticSurfaceNormal(B,_),u&&(m[I+w]=-_.x,m[R+w]=-_.y,m[O+w]=-_.z),(r.normal||r.tangent||r.bitangent)&&((r.tangent||r.bitangent)&&(y=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,_,y),y),Matrix3.multiplyByVector(x,y,y)),r.normal&&(h[I]=_.x,h[R]=_.y,h[O]=_.z,i&&(h[I+w]=-_.x,h[R+w]=-_.y,h[O+w]=-_.z)),r.tangent&&(p[I]=y.x,p[R]=y.y,p[O]=y.z,i&&(p[I+w]=-y.x,p[R+w]=-y.y,p[O+w]=-y.z)),r.bitangent&&(v=Cartesian3.normalize(Cartesian3.cross(_,y,v),v),f[I]=v.x,f[R]=v.y,f[O]=v.z,i&&(f[I+w]=v.x,f[R+w]=v.y,f[O+w]=v.z))))}if(r.st){D=d.length;for(var N=0;N<D;N+=2)d[N]=(d[N]-b.x)/(P.x-b.x),d[N+1]=(d[N+1]-b.y)/(P.y-b.y)}var V=new GeometryAttributes;if(r.position){var k=EllipseGeometryLibrary.raisePositionsToHeight(e,t,i);V.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:k})}if(r.st&&(V.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:d})),r.normal&&(V.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:h})),r.tangent&&(V.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p})),r.bitangent&&(V.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:f})),u&&(V.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:m})),i&&defined(t.offsetAttribute)){var U=new Uint8Array(c);if(t.offsetAttribute===GeometryOffsetAttribute$1.TOP)U=arrayFill(U,1,0,c/2);else U=arrayFill(U,t.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1);V.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:U})}return V}function topIndices(e){var t,i,r,n,a,o=new Array(e*(e+1)*12-6),s=0;for(t=0,r=1,n=0;n<3;n++)o[s++]=r++,o[s++]=t,o[s++]=r;for(n=2;n<e+1;++n){for(r=n*(n+1)-1,t=(n-1)*n-1,o[s++]=r++,o[s++]=t,o[s++]=r,i=2*n,a=0;a<i-1;++a)o[s++]=r,o[s++]=t++,o[s++]=t,o[s++]=r++,o[s++]=t,o[s++]=r;o[s++]=r++,o[s++]=t,o[s++]=r}for(i=2*e,++r,++t,n=0;n<i-1;++n)o[s++]=r,o[s++]=t++,o[s++]=t,o[s++]=r++,o[s++]=t,o[s++]=r;for(o[s++]=r,o[s++]=t++,o[s++]=t,o[s++]=r++,o[s++]=t++,o[s++]=t,++t,n=e-1;n>1;--n){for(o[s++]=t++,o[s++]=t,o[s++]=r,i=2*n,a=0;a<i-1;++a)o[s++]=r,o[s++]=t++,o[s++]=t,o[s++]=r++,o[s++]=t,o[s++]=r;o[s++]=t++,o[s++]=t++,o[s++]=r++}for(n=0;n<3;n++)o[s++]=t++,o[s++]=t,o[s++]=r;return o}var boundingSphereCenter$1=new Cartesian3;function computeEllipse$1(e){var t=e.center;boundingSphereCenter$1=Cartesian3.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,boundingSphereCenter$1),e.height,boundingSphereCenter$1);var i=new BoundingSphere(boundingSphereCenter$1=Cartesian3.add(t,boundingSphereCenter$1,boundingSphereCenter$1),e.semiMajorAxis),r=EllipseGeometryLibrary.computeEllipsePositions(e,!0,!1),n=r.positions,a=r.numPts,o=computeTopBottomAttributes(n,e,!1),s=topIndices(a);return{boundingSphere:i,attributes:o,indices:s=IndexDatatype$1.createTypedArray(n.length/3,s)}}function computeWallAttributes(e,t){var i=t.vertexFormat,r=t.center,n=t.semiMajorAxis,a=t.semiMinorAxis,o=t.ellipsoid,s=t.height,l=t.extrudedHeight,c=t.stRotation,u=e.length/3*2,d=new Float64Array(3*u),h=i.st?new Float32Array(2*u):void 0,p=i.normal?new Float32Array(3*u):void 0,f=i.tangent?new Float32Array(3*u):void 0,m=i.bitangent?new Float32Array(3*u):void 0,g=t.shadowVolume,_=g?new Float32Array(3*u):void 0,y=0,v=scratchNormal$5,C=scratchTangent$4,T=scratchBitangent$4,S=new GeographicProjection(o),A=S.project(o.cartesianToCartographic(r,scratchCartographic$g),projectedCenterScratch),x=o.scaleToGeodeticSurface(r,scratchCartesian1$5);o.geodeticSurfaceNormal(x,x);for(var E=Quaternion.fromAxisAngle(x,c,quaternionScratch$3),b=Matrix3.fromQuaternion(E,textureMatrixScratch$1),P=Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,scratchMinTexCoord),D=Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,scratchMaxTexCoord),w=e.length,M=w/3*2,I=0;I<w;I+=3){var R,O=I+1,B=I+2,L=Cartesian3.fromArray(e,I,scratchCartesian1$5);if(i.st){var F=Matrix3.multiplyByVector(b,L,scratchCartesian2$7),N=S.project(o.cartesianToCartographic(F,scratchCartographic$g),scratchCartesian3$8);Cartesian3.subtract(N,A,N),texCoordScratch.x=(N.x+n)/(2*n),texCoordScratch.y=(N.y+a)/(2*a),P.x=Math.min(texCoordScratch.x,P.x),P.y=Math.min(texCoordScratch.y,P.y),D.x=Math.max(texCoordScratch.x,D.x),D.y=Math.max(texCoordScratch.y,D.y),h[y+M]=texCoordScratch.x,h[y+1+M]=texCoordScratch.y,h[y++]=texCoordScratch.x,h[y++]=texCoordScratch.y}L=o.scaleToGeodeticSurface(L,L),R=Cartesian3.clone(L,scratchCartesian2$7),v=o.geodeticSurfaceNormal(L,v),g&&(_[I+w]=-v.x,_[O+w]=-v.y,_[B+w]=-v.z);var V=Cartesian3.multiplyByScalar(v,s,scratchCartesian4$5);if(L=Cartesian3.add(L,V,L),V=Cartesian3.multiplyByScalar(v,l,V),R=Cartesian3.add(R,V,R),i.position&&(d[I+w]=R.x,d[O+w]=R.y,d[B+w]=R.z,d[I]=L.x,d[O]=L.y,d[B]=L.z),i.normal||i.tangent||i.bitangent){T=Cartesian3.clone(v,T);var k=Cartesian3.fromArray(e,(I+3)%w,scratchCartesian4$5);Cartesian3.subtract(k,L,k);var U=Cartesian3.subtract(R,L,scratchCartesian3$8);v=Cartesian3.normalize(Cartesian3.cross(U,k,v),v),i.normal&&(p[I]=v.x,p[O]=v.y,p[B]=v.z,p[I+w]=v.x,p[O+w]=v.y,p[B+w]=v.z),i.tangent&&(C=Cartesian3.normalize(Cartesian3.cross(T,v,C),C),f[I]=C.x,f[O]=C.y,f[B]=C.z,f[I+w]=C.x,f[I+1+w]=C.y,f[I+2+w]=C.z),i.bitangent&&(m[I]=T.x,m[O]=T.y,m[B]=T.z,m[I+w]=T.x,m[O+w]=T.y,m[B+w]=T.z)}}if(i.st){w=h.length;for(var G=0;G<w;G+=2)h[G]=(h[G]-P.x)/(D.x-P.x),h[G+1]=(h[G+1]-P.y)/(D.y-P.y)}var $=new GeometryAttributes;if(i.position&&($.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:d})),i.st&&($.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:h})),i.normal&&($.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p})),i.tangent&&($.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:f})),i.bitangent&&($.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:m})),g&&($.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:_})),defined(t.offsetAttribute)){var z=new Uint8Array(u);if(t.offsetAttribute===GeometryOffsetAttribute$1.TOP)z=arrayFill(z,1,0,u/2);else z=arrayFill(z,t.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1);$.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:z})}return $}function computeWallIndices(e){for(var t=e.length/3,i=IndexDatatype$1.createTypedArray(t,6*t),r=0,n=0;n<t;n++){var a=n,o=n+t,s=(a+1)%t,l=s+t;i[r++]=a,i[r++]=o,i[r++]=s,i[r++]=s,i[r++]=o,i[r++]=l}return i}var topBoundingSphere$3=new BoundingSphere,bottomBoundingSphere$3=new BoundingSphere;function computeExtrudedEllipse$1(e){var t=e.center,i=e.ellipsoid,r=e.semiMajorAxis,n=Cartesian3.multiplyByScalar(i.geodeticSurfaceNormal(t,scratchCartesian1$5),e.height,scratchCartesian1$5);topBoundingSphere$3.center=Cartesian3.add(t,n,topBoundingSphere$3.center),topBoundingSphere$3.radius=r,n=Cartesian3.multiplyByScalar(i.geodeticSurfaceNormal(t,n),e.extrudedHeight,n),bottomBoundingSphere$3.center=Cartesian3.add(t,n,bottomBoundingSphere$3.center),bottomBoundingSphere$3.radius=r;var a=EllipseGeometryLibrary.computeEllipsePositions(e,!0,!0),o=a.positions,s=a.numPts,l=a.outerPositions,c=BoundingSphere.union(topBoundingSphere$3,bottomBoundingSphere$3),u=computeTopBottomAttributes(o,e,!0),d=topIndices(s),h=d.length;d.length=2*h;for(var p=o.length/3,f=0;f<h;f+=3)d[f+h]=d[f+2]+p,d[f+1+h]=d[f+1]+p,d[f+2+h]=d[f]+p;var m=new Geometry({attributes:u,indices:IndexDatatype$1.createTypedArray(2*p/3,d),primitiveType:PrimitiveType$1.TRIANGLES}),g=computeWallAttributes(l,e);d=computeWallIndices(l);var _=new Geometry({attributes:g,indices:IndexDatatype$1.createTypedArray(2*l.length/3,d),primitiveType:PrimitiveType$1.TRIANGLES}),y=GeometryPipeline.combineInstances([new GeometryInstance({geometry:m}),new GeometryInstance({geometry:_})]);return{boundingSphere:c,attributes:y[0].attributes,indices:y[0].indices}}function computeRectangle$3(e,t,i,r,n,a,o){for(var s=EllipseGeometryLibrary.computeEllipsePositions({center:e,semiMajorAxis:t,semiMinorAxis:i,rotation:r,granularity:n},!1,!0).outerPositions,l=s.length/3,c=new Array(l),u=0;u<l;++u)c[u]=Cartesian3.fromArray(s,3*u);var d=Rectangle.fromCartesianArray(c,a,o);return d.width>CesiumMath.PI&&(d.north=d.north>0?CesiumMath.PI_OVER_TWO-CesiumMath.EPSILON7:d.north,d.south=d.south<0?CesiumMath.EPSILON7-CesiumMath.PI_OVER_TWO:d.south,d.east=CesiumMath.PI,d.west=-CesiumMath.PI),d}function EllipseGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).center,i=defaultValue(e.ellipsoid,Ellipsoid.WGS84),r=e.semiMajorAxis,n=e.semiMinorAxis,a=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),o=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),s=defaultValue(e.height,0),l=defaultValue(e.extrudedHeight,s);this._center=Cartesian3.clone(t),this._semiMajorAxis=r,this._semiMinorAxis=n,this._ellipsoid=Ellipsoid.clone(i),this._rotation=defaultValue(e.rotation,0),this._stRotation=defaultValue(e.stRotation,0),this._height=Math.max(l,s),this._granularity=a,this._vertexFormat=VertexFormat.clone(o),this._extrudedHeight=Math.min(l,s),this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}EllipseGeometry.packedLength=Cartesian3.packedLength+Ellipsoid.packedLength+VertexFormat.packedLength+9,EllipseGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._center,t,i),i+=Cartesian3.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._semiMajorAxis,t[i++]=e._semiMinorAxis,t[i++]=e._rotation,t[i++]=e._stRotation,t[i++]=e._height,t[i++]=e._granularity,t[i++]=e._extrudedHeight,t[i++]=e._shadowVolume?1:0,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchCenter$7=new Cartesian3,scratchEllipsoid$e=new Ellipsoid,scratchVertexFormat$b=new VertexFormat,scratchOptions$l={center:scratchCenter$7,ellipsoid:scratchEllipsoid$e,vertexFormat:scratchVertexFormat$b,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,stRotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};function textureCoordinateRotationPoints$2(e){var t=-e._stRotation;if(0===t)return[0,0,0,1,1,0];for(var i=EllipseGeometryLibrary.computeEllipsePositions({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,rotation:e._rotation,granularity:e._granularity},!1,!0).outerPositions,r=i.length/3,n=new Array(r),a=0;a<r;++a)n[a]=Cartesian3.fromArray(i,3*a);var o=e._ellipsoid,s=e.rectangle;return Geometry._textureCoordinateRotationPoints(n,t,o,s)}function CircleGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).radius,i={center:e.center,semiMajorAxis:t,semiMinorAxis:t,ellipsoid:e.ellipsoid,height:e.height,extrudedHeight:e.extrudedHeight,granularity:e.granularity,vertexFormat:e.vertexFormat,stRotation:e.stRotation,shadowVolume:e.shadowVolume};this._ellipseGeometry=new EllipseGeometry(i),this._workerName="createCircleGeometry"}EllipseGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t,scratchCenter$7);t+=Cartesian3.packedLength;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$e);t+=Ellipsoid.packedLength;var a=VertexFormat.unpack(e,t,scratchVertexFormat$b);t+=VertexFormat.packedLength;var o=e[t++],s=e[t++],l=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t++],p=1===e[t++],f=e[t];return defined(i)?(i._center=Cartesian3.clone(r,i._center),i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._vertexFormat=VertexFormat.clone(a,i._vertexFormat),i._semiMajorAxis=o,i._semiMinorAxis=s,i._rotation=l,i._stRotation=c,i._height=u,i._granularity=d,i._extrudedHeight=h,i._shadowVolume=p,i._offsetAttribute=-1===f?void 0:f,i):(scratchOptions$l.height=u,scratchOptions$l.extrudedHeight=h,scratchOptions$l.granularity=d,scratchOptions$l.stRotation=c,scratchOptions$l.rotation=l,scratchOptions$l.semiMajorAxis=o,scratchOptions$l.semiMinorAxis=s,scratchOptions$l.shadowVolume=p,scratchOptions$l.offsetAttribute=-1===f?void 0:f,new EllipseGeometry(scratchOptions$l))},EllipseGeometry.computeRectangle=function(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).center,r=defaultValue(e.ellipsoid,Ellipsoid.WGS84),n=e.semiMajorAxis,a=e.semiMinorAxis,o=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE);return computeRectangle$3(i,n,a,defaultValue(e.rotation,0),o,r,t)},EllipseGeometry.createGeometry=function(e){if(!(e._semiMajorAxis<=0||e._semiMinorAxis<=0)){var t=e._height,i=e._extrudedHeight,r=!CesiumMath.equalsEpsilon(t,i,0,CesiumMath.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var n,a={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,vertexFormat:e._vertexFormat,stRotation:e._stRotation};if(r)a.extrudedHeight=i,a.shadowVolume=e._shadowVolume,a.offsetAttribute=e._offsetAttribute,n=computeExtrudedEllipse$1(a);else if(n=computeEllipse$1(a),defined(e._offsetAttribute)){var o=n.attributes.position.values.length,s=new Uint8Array(o/3);arrayFill(s,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),n.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:s})}return new Geometry({attributes:n.attributes,indices:n.indices,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:n.boundingSphere,offsetAttribute:e._offsetAttribute})}},EllipseGeometry.createShadowVolume=function(e,t,i){var r=e._granularity,n=e._ellipsoid,a=t(r,n),o=i(r,n);return new EllipseGeometry({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:n,rotation:e._rotation,stRotation:e._stRotation,granularity:r,extrudedHeight:a,height:o,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(EllipseGeometry.prototype,{rectangle:{get:function(){return defined(this._rectangle)||(this._rectangle=computeRectangle$3(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=textureCoordinateRotationPoints$2(this)),this._textureCoordinateRotationPoints}}}),CircleGeometry.packedLength=EllipseGeometry.packedLength,CircleGeometry.pack=function(e,t,i){return EllipseGeometry.pack(e._ellipseGeometry,t,i)};var scratchEllipseGeometry$1=new EllipseGeometry({center:new Cartesian3,semiMajorAxis:1,semiMinorAxis:1}),scratchOptions$k={center:new Cartesian3,radius:void 0,ellipsoid:Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),height:void 0,extrudedHeight:void 0,granularity:void 0,vertexFormat:new VertexFormat,stRotation:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0,shadowVolume:void 0};CircleGeometry.unpack=function(e,t,i){var r=EllipseGeometry.unpack(e,t,scratchEllipseGeometry$1);return scratchOptions$k.center=Cartesian3.clone(r._center,scratchOptions$k.center),scratchOptions$k.ellipsoid=Ellipsoid.clone(r._ellipsoid,scratchOptions$k.ellipsoid),scratchOptions$k.height=r._height,scratchOptions$k.extrudedHeight=r._extrudedHeight,scratchOptions$k.granularity=r._granularity,scratchOptions$k.vertexFormat=VertexFormat.clone(r._vertexFormat,scratchOptions$k.vertexFormat),scratchOptions$k.stRotation=r._stRotation,scratchOptions$k.shadowVolume=r._shadowVolume,defined(i)?(scratchOptions$k.semiMajorAxis=r._semiMajorAxis,scratchOptions$k.semiMinorAxis=r._semiMinorAxis,i._ellipseGeometry=new EllipseGeometry(scratchOptions$k),i):(scratchOptions$k.radius=r._semiMajorAxis,new CircleGeometry(scratchOptions$k))},CircleGeometry.createGeometry=function(e){return EllipseGeometry.createGeometry(e._ellipseGeometry)},CircleGeometry.createShadowVolume=function(e,t,i){var r=e._ellipseGeometry._granularity,n=e._ellipseGeometry._ellipsoid,a=t(r,n),o=i(r,n);return new CircleGeometry({center:e._ellipseGeometry._center,radius:e._ellipseGeometry._semiMajorAxis,ellipsoid:n,stRotation:e._ellipseGeometry._stRotation,granularity:r,extrudedHeight:a,height:o,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(CircleGeometry.prototype,{rectangle:{get:function(){return this._ellipseGeometry.rectangle}},textureCoordinateRotationPoints:{get:function(){return this._ellipseGeometry.textureCoordinateRotationPoints}}});var scratchCartesian1$4=new Cartesian3,boundingSphereCenter=new Cartesian3;function computeEllipse(e){var t=e.center;boundingSphereCenter=Cartesian3.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,boundingSphereCenter),e.height,boundingSphereCenter);for(var i=new BoundingSphere(boundingSphereCenter=Cartesian3.add(t,boundingSphereCenter,boundingSphereCenter),e.semiMajorAxis),r=EllipseGeometryLibrary.computeEllipsePositions(e,!1,!0).outerPositions,n=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:EllipseGeometryLibrary.raisePositionsToHeight(r,e,!1)})}),a=r.length/3,o=IndexDatatype$1.createTypedArray(a,2*a),s=0,l=0;l<a;++l)o[s++]=l,o[s++]=(l+1)%a;return{boundingSphere:i,attributes:n,indices:o}}var topBoundingSphere$2=new BoundingSphere,bottomBoundingSphere$2=new BoundingSphere;function computeExtrudedEllipse(e){var t=e.center,i=e.ellipsoid,r=e.semiMajorAxis,n=Cartesian3.multiplyByScalar(i.geodeticSurfaceNormal(t,scratchCartesian1$4),e.height,scratchCartesian1$4);topBoundingSphere$2.center=Cartesian3.add(t,n,topBoundingSphere$2.center),topBoundingSphere$2.radius=r,n=Cartesian3.multiplyByScalar(i.geodeticSurfaceNormal(t,n),e.extrudedHeight,n),bottomBoundingSphere$2.center=Cartesian3.add(t,n,bottomBoundingSphere$2.center),bottomBoundingSphere$2.radius=r;var a=EllipseGeometryLibrary.computeEllipsePositions(e,!1,!0).outerPositions,o=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:EllipseGeometryLibrary.raisePositionsToHeight(a,e,!0)})});a=o.position.values;var s=BoundingSphere.union(topBoundingSphere$2,bottomBoundingSphere$2),l=a.length/3;if(defined(e.offsetAttribute)){var c=new Uint8Array(l);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)c=arrayFill(c,1,0,l/2);else c=arrayFill(c,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1);o.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}var u=defaultValue(e.numberOfVerticalLines,16);u=CesiumMath.clamp(u,0,l/2);var d=IndexDatatype$1.createTypedArray(l,2*l+2*u);l/=2;var h,p,f=0;for(h=0;h<l;++h)d[f++]=h,d[f++]=(h+1)%l,d[f++]=h+l,d[f++]=(h+1)%l+l;if(u>0){var m=Math.min(u,l);p=Math.round(l/m);var g=Math.min(p*u,l);for(h=0;h<g;h+=p)d[f++]=h,d[f++]=h+l}return{boundingSphere:s,attributes:o,indices:d}}function EllipseOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).center,i=defaultValue(e.ellipsoid,Ellipsoid.WGS84),r=e.semiMajorAxis,n=e.semiMinorAxis,a=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),o=defaultValue(e.height,0),s=defaultValue(e.extrudedHeight,o);this._center=Cartesian3.clone(t),this._semiMajorAxis=r,this._semiMinorAxis=n,this._ellipsoid=Ellipsoid.clone(i),this._rotation=defaultValue(e.rotation,0),this._height=Math.max(s,o),this._granularity=a,this._extrudedHeight=Math.min(s,o),this._numberOfVerticalLines=Math.max(defaultValue(e.numberOfVerticalLines,16),0),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipseOutlineGeometry"}EllipseOutlineGeometry.packedLength=Cartesian3.packedLength+Ellipsoid.packedLength+8,EllipseOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._center,t,i),i+=Cartesian3.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._semiMajorAxis,t[i++]=e._semiMinorAxis,t[i++]=e._rotation,t[i++]=e._height,t[i++]=e._granularity,t[i++]=e._extrudedHeight,t[i++]=e._numberOfVerticalLines,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchCenter$6=new Cartesian3,scratchEllipsoid$d=new Ellipsoid,scratchOptions$j={center:scratchCenter$6,ellipsoid:scratchEllipsoid$d,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};function CircleOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).radius,i={center:e.center,semiMajorAxis:t,semiMinorAxis:t,ellipsoid:e.ellipsoid,height:e.height,extrudedHeight:e.extrudedHeight,granularity:e.granularity,numberOfVerticalLines:e.numberOfVerticalLines};this._ellipseGeometry=new EllipseOutlineGeometry(i),this._workerName="createCircleOutlineGeometry"}EllipseOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t,scratchCenter$6);t+=Cartesian3.packedLength;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$d);t+=Ellipsoid.packedLength;var a=e[t++],o=e[t++],s=e[t++],l=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t];return defined(i)?(i._center=Cartesian3.clone(r,i._center),i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._semiMajorAxis=a,i._semiMinorAxis=o,i._rotation=s,i._height=l,i._granularity=c,i._extrudedHeight=u,i._numberOfVerticalLines=d,i._offsetAttribute=-1===h?void 0:h,i):(scratchOptions$j.height=l,scratchOptions$j.extrudedHeight=u,scratchOptions$j.granularity=c,scratchOptions$j.rotation=s,scratchOptions$j.semiMajorAxis=a,scratchOptions$j.semiMinorAxis=o,scratchOptions$j.numberOfVerticalLines=d,scratchOptions$j.offsetAttribute=-1===h?void 0:h,new EllipseOutlineGeometry(scratchOptions$j))},EllipseOutlineGeometry.createGeometry=function(e){if(!(e._semiMajorAxis<=0||e._semiMinorAxis<=0)){var t=e._height,i=e._extrudedHeight,r=!CesiumMath.equalsEpsilon(t,i,0,CesiumMath.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var n,a={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines};if(r)a.extrudedHeight=i,a.offsetAttribute=e._offsetAttribute,n=computeExtrudedEllipse(a);else if(n=computeEllipse(a),defined(e._offsetAttribute)){var o=n.attributes.position.values.length,s=new Uint8Array(o/3);arrayFill(s,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),n.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:s})}return new Geometry({attributes:n.attributes,indices:n.indices,primitiveType:PrimitiveType$1.LINES,boundingSphere:n.boundingSphere,offsetAttribute:e._offsetAttribute})}},CircleOutlineGeometry.packedLength=EllipseOutlineGeometry.packedLength,CircleOutlineGeometry.pack=function(e,t,i){return EllipseOutlineGeometry.pack(e._ellipseGeometry,t,i)};var scratchEllipseGeometry=new EllipseOutlineGeometry({center:new Cartesian3,semiMajorAxis:1,semiMinorAxis:1}),scratchOptions$i={center:new Cartesian3,radius:void 0,ellipsoid:Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),height:void 0,extrudedHeight:void 0,granularity:void 0,numberOfVerticalLines:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0};CircleOutlineGeometry.unpack=function(e,t,i){var r=EllipseOutlineGeometry.unpack(e,t,scratchEllipseGeometry);return scratchOptions$i.center=Cartesian3.clone(r._center,scratchOptions$i.center),scratchOptions$i.ellipsoid=Ellipsoid.clone(r._ellipsoid,scratchOptions$i.ellipsoid),scratchOptions$i.height=r._height,scratchOptions$i.extrudedHeight=r._extrudedHeight,scratchOptions$i.granularity=r._granularity,scratchOptions$i.numberOfVerticalLines=r._numberOfVerticalLines,defined(i)?(scratchOptions$i.semiMajorAxis=r._semiMajorAxis,scratchOptions$i.semiMinorAxis=r._semiMinorAxis,i._ellipseGeometry=new EllipseOutlineGeometry(scratchOptions$i),i):(scratchOptions$i.radius=r._semiMajorAxis,new CircleOutlineGeometry(scratchOptions$i))},CircleOutlineGeometry.createGeometry=function(e){return EllipseOutlineGeometry.createGeometry(e._ellipseGeometry)};var ClockRange={UNBOUNDED:0,CLAMPED:1,LOOP_STOP:2},ClockRange$1=Object.freeze(ClockRange),ClockStep={TICK_DEPENDENT:0,SYSTEM_CLOCK_MULTIPLIER:1,SYSTEM_CLOCK:2},ClockStep$1=Object.freeze(ClockStep),getTimestamp;getTimestamp="undefined"!=typeof performance&&"function"==typeof performance.now&&isFinite(performance.now())?function(){return performance.now()}:function(){return Date.now()};var getTimestamp$1=getTimestamp,scratchArrayBuffer,scratchUint32Array,scratchUint8Array;function Clock(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).currentTime,i=e.startTime,r=e.stopTime;t=defined(t)?JulianDate.clone(t):defined(i)?JulianDate.clone(i):defined(r)?JulianDate.addDays(r,-1,new JulianDate):JulianDate.now(),i=defined(i)?JulianDate.clone(i):JulianDate.clone(t),r=defined(r)?JulianDate.clone(r):JulianDate.addDays(i,1,new JulianDate),this.startTime=i,this.stopTime=r,this.clockRange=defaultValue(e.clockRange,ClockRange$1.UNBOUNDED),this.canAnimate=defaultValue(e.canAnimate,!0),this.onTick=new Event,this.onStop=new Event,this._currentTime=void 0,this._multiplier=void 0,this._clockStep=void 0,this._shouldAnimate=void 0,this._lastSystemTime=getTimestamp$1(),this.currentTime=t,this.multiplier=defaultValue(e.multiplier,1),this.shouldAnimate=defaultValue(e.shouldAnimate,!1),this.clockStep=defaultValue(e.clockStep,ClockStep$1.SYSTEM_CLOCK_MULTIPLIER)}function hue2rgb(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),6*i<1?e+6*(t-e)*i:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}function Color(e,t,i,r){this.red=defaultValue(e,1),this.green=defaultValue(t,1),this.blue=defaultValue(i,1),this.alpha=defaultValue(r,1)}Object.defineProperties(Clock.prototype,{currentTime:{get:function(){return this._currentTime},set:function(e){JulianDate.equals(this._currentTime,e)||(this._clockStep===ClockStep$1.SYSTEM_CLOCK&&(this._clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER),this._currentTime=e)}},multiplier:{get:function(){return this._multiplier},set:function(e){this._multiplier!==e&&(this._clockStep===ClockStep$1.SYSTEM_CLOCK&&(this._clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER),this._multiplier=e)}},clockStep:{get:function(){return this._clockStep},set:function(e){e===ClockStep$1.SYSTEM_CLOCK&&(this._multiplier=1,this._shouldAnimate=!0,this._currentTime=JulianDate.now()),this._clockStep=e}},shouldAnimate:{get:function(){return this._shouldAnimate},set:function(e){this._shouldAnimate!==e&&(this._clockStep===ClockStep$1.SYSTEM_CLOCK&&(this._clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER),this._shouldAnimate=e)}}}),Clock.prototype.tick=function(){var e=getTimestamp$1(),t=JulianDate.clone(this._currentTime);if(this.canAnimate&&this._shouldAnimate){var i=this._clockStep;if(i===ClockStep$1.SYSTEM_CLOCK)t=JulianDate.now(t);else{var r=this._multiplier;if(i===ClockStep$1.TICK_DEPENDENT)t=JulianDate.addSeconds(t,r,t);else{var n=e-this._lastSystemTime;t=JulianDate.addSeconds(t,r*(n/1e3),t)}var a=this.clockRange,o=this.startTime,s=this.stopTime;if(a===ClockRange$1.CLAMPED)JulianDate.lessThan(t,o)?t=JulianDate.clone(o,t):JulianDate.greaterThan(t,s)&&(t=JulianDate.clone(s,t),this.onStop.raiseEvent(this));else if(a===ClockRange$1.LOOP_STOP)for(JulianDate.lessThan(t,o)&&(t=JulianDate.clone(o,t));JulianDate.greaterThan(t,s);)t=JulianDate.addSeconds(o,JulianDate.secondsDifference(t,s),t),this.onStop.raiseEvent(this)}}return this._currentTime=t,this._lastSystemTime=e,this.onTick.raiseEvent(this),t},Color.fromCartesian4=function(e,t){return defined(t)?(t.red=e.x,t.green=e.y,t.blue=e.z,t.alpha=e.w,t):new Color(e.x,e.y,e.z,e.w)},Color.fromBytes=function(e,t,i,r,n){return e=Color.byteToFloat(defaultValue(e,255)),t=Color.byteToFloat(defaultValue(t,255)),i=Color.byteToFloat(defaultValue(i,255)),r=Color.byteToFloat(defaultValue(r,255)),defined(n)?(n.red=e,n.green=t,n.blue=i,n.alpha=r,n):new Color(e,t,i,r)},Color.fromAlpha=function(e,t,i){return defined(i)?(i.red=e.red,i.green=e.green,i.blue=e.blue,i.alpha=t,i):new Color(e.red,e.green,e.blue,t)},FeatureDetection.supportsTypedArrays()&&(scratchArrayBuffer=new ArrayBuffer(4),scratchUint32Array=new Uint32Array(scratchArrayBuffer),scratchUint8Array=new Uint8Array(scratchArrayBuffer)),Color.fromRgba=function(e,t){return scratchUint32Array[0]=e,Color.fromBytes(scratchUint8Array[0],scratchUint8Array[1],scratchUint8Array[2],scratchUint8Array[3],t)},Color.fromHsl=function(e,t,i,r,n){e=defaultValue(e,0)%1,t=defaultValue(t,0),i=defaultValue(i,0),r=defaultValue(r,1);var a=i,o=i,s=i;if(0!==t){var l,c=2*i-(l=i<.5?i*(1+t):i+t-i*t);a=hue2rgb(c,l,e+1/3),o=hue2rgb(c,l,e),s=hue2rgb(c,l,e-1/3)}return defined(n)?(n.red=a,n.green=o,n.blue=s,n.alpha=r,n):new Color(a,o,s,r)},Color.fromRandom=function(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).red;if(!defined(i)){var r=defaultValue(e.minimumRed,0),n=defaultValue(e.maximumRed,1);i=r+CesiumMath.nextRandomNumber()*(n-r)}var a=e.green;if(!defined(a)){var o=defaultValue(e.minimumGreen,0),s=defaultValue(e.maximumGreen,1);a=o+CesiumMath.nextRandomNumber()*(s-o)}var l=e.blue;if(!defined(l)){var c=defaultValue(e.minimumBlue,0),u=defaultValue(e.maximumBlue,1);l=c+CesiumMath.nextRandomNumber()*(u-c)}var d=e.alpha;if(!defined(d)){var h=defaultValue(e.minimumAlpha,0),p=defaultValue(e.maximumAlpha,1);d=h+CesiumMath.nextRandomNumber()*(p-h)}return defined(t)?(t.red=i,t.green=a,t.blue=l,t.alpha=d,t):new Color(i,a,l,d)};var rgbaMatcher=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,rrggbbaaMatcher=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,rgbParenthesesMatcher=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,hslParenthesesMatcher=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;function ColorGeometryInstanceAttribute(e,t,i,r){e=defaultValue(e,1),t=defaultValue(t,1),i=defaultValue(i,1),r=defaultValue(r,1),this.value=new Uint8Array([Color.floatToByte(e),Color.floatToByte(t),Color.floatToByte(i),Color.floatToByte(r)])}function CompressedTextureBuffer(e,t,i,r,n){this._format=e,this._datatype=t,this._width=i,this._height=r,this._buffer=n}Color.fromCssColorString=function(e,t){defined(t)||(t=new Color);var i=Color[(e=e.replace(/\s/g,"")).toUpperCase()];if(defined(i))return Color.clone(i,t),t;var r=rgbaMatcher.exec(e);return null!==r?(t.red=parseInt(r[1],16)/15,t.green=parseInt(r[2],16)/15,t.blue=parseInt(r[3],16)/15,t.alpha=parseInt(defaultValue(r[4],"f"),16)/15,t):null!==(r=rrggbbaaMatcher.exec(e))?(t.red=parseInt(r[1],16)/255,t.green=parseInt(r[2],16)/255,t.blue=parseInt(r[3],16)/255,t.alpha=parseInt(defaultValue(r[4],"ff"),16)/255,t):null!==(r=rgbParenthesesMatcher.exec(e))?(t.red=parseFloat(r[1])/("%"===r[1].substr(-1)?100:255),t.green=parseFloat(r[2])/("%"===r[2].substr(-1)?100:255),t.blue=parseFloat(r[3])/("%"===r[3].substr(-1)?100:255),t.alpha=parseFloat(defaultValue(r[4],"1.0")),t):null!==(r=hslParenthesesMatcher.exec(e))?Color.fromHsl(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,parseFloat(defaultValue(r[4],"1.0")),t):t=void 0},Color.packedLength=4,Color.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.red,t[i++]=e.green,t[i++]=e.blue,t[i]=e.alpha,t},Color.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Color),i.red=e[t++],i.green=e[t++],i.blue=e[t++],i.alpha=e[t],i},Color.byteToFloat=function(e){return e/255},Color.floatToByte=function(e){return 1===e?255:256*e|0},Color.clone=function(e,t){if(defined(e))return defined(t)?(t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha,t):new Color(e.red,e.green,e.blue,e.alpha)},Color.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha},Color.equalsArray=function(e,t,i){return e.red===t[i]&&e.green===t[i+1]&&e.blue===t[i+2]&&e.alpha===t[i+3]},Color.prototype.clone=function(e){return Color.clone(this,e)},Color.prototype.equals=function(e){return Color.equals(this,e)},Color.prototype.equalsEpsilon=function(e,t){return this===e||defined(e)&&Math.abs(this.red-e.red)<=t&&Math.abs(this.green-e.green)<=t&&Math.abs(this.blue-e.blue)<=t&&Math.abs(this.alpha-e.alpha)<=t},Color.prototype.toString=function(){return"("+this.red+", "+this.green+", "+this.blue+", "+this.alpha+")"},Color.prototype.toCssColorString=function(){var e=Color.floatToByte(this.red),t=Color.floatToByte(this.green),i=Color.floatToByte(this.blue);return 1===this.alpha?"rgb("+e+","+t+","+i+")":"rgba("+e+","+t+","+i+","+this.alpha+")"},Color.prototype.toCssHexString=function(){var e=Color.floatToByte(this.red).toString(16);e.length<2&&(e="0"+e);var t=Color.floatToByte(this.green).toString(16);t.length<2&&(t="0"+t);var i=Color.floatToByte(this.blue).toString(16);if(i.length<2&&(i="0"+i),this.alpha<1){var r=Color.floatToByte(this.alpha).toString(16);return r.length<2&&(r="0"+r),"#"+e+t+i+r}return"#"+e+t+i},Color.prototype.toBytes=function(e){var t=Color.floatToByte(this.red),i=Color.floatToByte(this.green),r=Color.floatToByte(this.blue),n=Color.floatToByte(this.alpha);return defined(e)?(e[0]=t,e[1]=i,e[2]=r,e[3]=n,e):[t,i,r,n]},Color.prototype.toRgba=function(){return scratchUint8Array[0]=Color.floatToByte(this.red),scratchUint8Array[1]=Color.floatToByte(this.green),scratchUint8Array[2]=Color.floatToByte(this.blue),scratchUint8Array[3]=Color.floatToByte(this.alpha),scratchUint32Array[0]},Color.prototype.brighten=function(e,t){return e=1-e,t.red=1-(1-this.red)*e,t.green=1-(1-this.green)*e,t.blue=1-(1-this.blue)*e,t.alpha=this.alpha,t},Color.prototype.darken=function(e,t){return e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t},Color.prototype.withAlpha=function(e,t){return Color.fromAlpha(this,e,t)},Color.add=function(e,t,i){return i.red=e.red+t.red,i.green=e.green+t.green,i.blue=e.blue+t.blue,i.alpha=e.alpha+t.alpha,i},Color.subtract=function(e,t,i){return i.red=e.red-t.red,i.green=e.green-t.green,i.blue=e.blue-t.blue,i.alpha=e.alpha-t.alpha,i},Color.multiply=function(e,t,i){return i.red=e.red*t.red,i.green=e.green*t.green,i.blue=e.blue*t.blue,i.alpha=e.alpha*t.alpha,i},Color.divide=function(e,t,i){return i.red=e.red/t.red,i.green=e.green/t.green,i.blue=e.blue/t.blue,i.alpha=e.alpha/t.alpha,i},Color.mod=function(e,t,i){return i.red=e.red%t.red,i.green=e.green%t.green,i.blue=e.blue%t.blue,i.alpha=e.alpha%t.alpha,i},Color.lerp=function(e,t,i,r){return r.red=CesiumMath.lerp(e.red,t.red,i),r.green=CesiumMath.lerp(e.green,t.green,i),r.blue=CesiumMath.lerp(e.blue,t.blue,i),r.alpha=CesiumMath.lerp(e.alpha,t.alpha,i),r},Color.multiplyByScalar=function(e,t,i){return i.red=e.red*t,i.green=e.green*t,i.blue=e.blue*t,i.alpha=e.alpha*t,i},Color.divideByScalar=function(e,t,i){return i.red=e.red/t,i.green=e.green/t,i.blue=e.blue/t,i.alpha=e.alpha/t,i},Color.ALICEBLUE=Object.freeze(Color.fromCssColorString("#F0F8FF")),Color.ANTIQUEWHITE=Object.freeze(Color.fromCssColorString("#FAEBD7")),Color.AQUA=Object.freeze(Color.fromCssColorString("#00FFFF")),Color.AQUAMARINE=Object.freeze(Color.fromCssColorString("#7FFFD4")),Color.AZURE=Object.freeze(Color.fromCssColorString("#F0FFFF")),Color.BEIGE=Object.freeze(Color.fromCssColorString("#F5F5DC")),Color.BISQUE=Object.freeze(Color.fromCssColorString("#FFE4C4")),Color.BLACK=Object.freeze(Color.fromCssColorString("#000000")),Color.BLANCHEDALMOND=Object.freeze(Color.fromCssColorString("#FFEBCD")),Color.BLUE=Object.freeze(Color.fromCssColorString("#0000FF")),Color.BLUEVIOLET=Object.freeze(Color.fromCssColorString("#8A2BE2")),Color.BROWN=Object.freeze(Color.fromCssColorString("#A52A2A")),Color.BURLYWOOD=Object.freeze(Color.fromCssColorString("#DEB887")),Color.CADETBLUE=Object.freeze(Color.fromCssColorString("#5F9EA0")),Color.CHARTREUSE=Object.freeze(Color.fromCssColorString("#7FFF00")),Color.CHOCOLATE=Object.freeze(Color.fromCssColorString("#D2691E")),Color.CORAL=Object.freeze(Color.fromCssColorString("#FF7F50")),Color.CORNFLOWERBLUE=Object.freeze(Color.fromCssColorString("#6495ED")),Color.CORNSILK=Object.freeze(Color.fromCssColorString("#FFF8DC")),Color.CRIMSON=Object.freeze(Color.fromCssColorString("#DC143C")),Color.CYAN=Object.freeze(Color.fromCssColorString("#00FFFF")),Color.DARKBLUE=Object.freeze(Color.fromCssColorString("#00008B")),Color.DARKCYAN=Object.freeze(Color.fromCssColorString("#008B8B")),Color.DARKGOLDENROD=Object.freeze(Color.fromCssColorString("#B8860B")),Color.DARKGRAY=Object.freeze(Color.fromCssColorString("#A9A9A9")),Color.DARKGREEN=Object.freeze(Color.fromCssColorString("#006400")),Color.DARKGREY=Color.DARKGRAY,Color.DARKKHAKI=Object.freeze(Color.fromCssColorString("#BDB76B")),Color.DARKMAGENTA=Object.freeze(Color.fromCssColorString("#8B008B")),Color.DARKOLIVEGREEN=Object.freeze(Color.fromCssColorString("#556B2F")),Color.DARKORANGE=Object.freeze(Color.fromCssColorString("#FF8C00")),Color.DARKORCHID=Object.freeze(Color.fromCssColorString("#9932CC")),Color.DARKRED=Object.freeze(Color.fromCssColorString("#8B0000")),Color.DARKSALMON=Object.freeze(Color.fromCssColorString("#E9967A")),Color.DARKSEAGREEN=Object.freeze(Color.fromCssColorString("#8FBC8F")),Color.DARKSLATEBLUE=Object.freeze(Color.fromCssColorString("#483D8B")),Color.DARKSLATEGRAY=Object.freeze(Color.fromCssColorString("#2F4F4F")),Color.DARKSLATEGREY=Color.DARKSLATEGRAY,Color.DARKTURQUOISE=Object.freeze(Color.fromCssColorString("#00CED1")),Color.DARKVIOLET=Object.freeze(Color.fromCssColorString("#9400D3")),Color.DEEPPINK=Object.freeze(Color.fromCssColorString("#FF1493")),Color.DEEPSKYBLUE=Object.freeze(Color.fromCssColorString("#00BFFF")),Color.DIMGRAY=Object.freeze(Color.fromCssColorString("#696969")),Color.DIMGREY=Color.DIMGRAY,Color.DODGERBLUE=Object.freeze(Color.fromCssColorString("#1E90FF")),Color.FIREBRICK=Object.freeze(Color.fromCssColorString("#B22222")),Color.FLORALWHITE=Object.freeze(Color.fromCssColorString("#FFFAF0")),Color.FORESTGREEN=Object.freeze(Color.fromCssColorString("#228B22")),Color.FUCHSIA=Object.freeze(Color.fromCssColorString("#FF00FF")),Color.GAINSBORO=Object.freeze(Color.fromCssColorString("#DCDCDC")),Color.GHOSTWHITE=Object.freeze(Color.fromCssColorString("#F8F8FF")),Color.GOLD=Object.freeze(Color.fromCssColorString("#FFD700")),Color.GOLDENROD=Object.freeze(Color.fromCssColorString("#DAA520")),Color.GRAY=Object.freeze(Color.fromCssColorString("#808080")),Color.GREEN=Object.freeze(Color.fromCssColorString("#008000")),Color.GREENYELLOW=Object.freeze(Color.fromCssColorString("#ADFF2F")),Color.GREY=Color.GRAY,Color.HONEYDEW=Object.freeze(Color.fromCssColorString("#F0FFF0")),Color.HOTPINK=Object.freeze(Color.fromCssColorString("#FF69B4")),Color.INDIANRED=Object.freeze(Color.fromCssColorString("#CD5C5C")),Color.INDIGO=Object.freeze(Color.fromCssColorString("#4B0082")),Color.IVORY=Object.freeze(Color.fromCssColorString("#FFFFF0")),Color.KHAKI=Object.freeze(Color.fromCssColorString("#F0E68C")),Color.LAVENDER=Object.freeze(Color.fromCssColorString("#E6E6FA")),Color.LAVENDAR_BLUSH=Object.freeze(Color.fromCssColorString("#FFF0F5")),Color.LAWNGREEN=Object.freeze(Color.fromCssColorString("#7CFC00")),Color.LEMONCHIFFON=Object.freeze(Color.fromCssColorString("#FFFACD")),Color.LIGHTBLUE=Object.freeze(Color.fromCssColorString("#ADD8E6")),Color.LIGHTCORAL=Object.freeze(Color.fromCssColorString("#F08080")),Color.LIGHTCYAN=Object.freeze(Color.fromCssColorString("#E0FFFF")),Color.LIGHTGOLDENRODYELLOW=Object.freeze(Color.fromCssColorString("#FAFAD2")),Color.LIGHTGRAY=Object.freeze(Color.fromCssColorString("#D3D3D3")),Color.LIGHTGREEN=Object.freeze(Color.fromCssColorString("#90EE90")),Color.LIGHTGREY=Color.LIGHTGRAY,Color.LIGHTPINK=Object.freeze(Color.fromCssColorString("#FFB6C1")),Color.LIGHTSEAGREEN=Object.freeze(Color.fromCssColorString("#20B2AA")),Color.LIGHTSKYBLUE=Object.freeze(Color.fromCssColorString("#87CEFA")),Color.LIGHTSLATEGRAY=Object.freeze(Color.fromCssColorString("#778899")),Color.LIGHTSLATEGREY=Color.LIGHTSLATEGRAY,Color.LIGHTSTEELBLUE=Object.freeze(Color.fromCssColorString("#B0C4DE")),Color.LIGHTYELLOW=Object.freeze(Color.fromCssColorString("#FFFFE0")),Color.LIME=Object.freeze(Color.fromCssColorString("#00FF00")),Color.LIMEGREEN=Object.freeze(Color.fromCssColorString("#32CD32")),Color.LINEN=Object.freeze(Color.fromCssColorString("#FAF0E6")),Color.MAGENTA=Object.freeze(Color.fromCssColorString("#FF00FF")),Color.MAROON=Object.freeze(Color.fromCssColorString("#800000")),Color.MEDIUMAQUAMARINE=Object.freeze(Color.fromCssColorString("#66CDAA")),Color.MEDIUMBLUE=Object.freeze(Color.fromCssColorString("#0000CD")),Color.MEDIUMORCHID=Object.freeze(Color.fromCssColorString("#BA55D3")),Color.MEDIUMPURPLE=Object.freeze(Color.fromCssColorString("#9370DB")),Color.MEDIUMSEAGREEN=Object.freeze(Color.fromCssColorString("#3CB371")),Color.MEDIUMSLATEBLUE=Object.freeze(Color.fromCssColorString("#7B68EE")),Color.MEDIUMSPRINGGREEN=Object.freeze(Color.fromCssColorString("#00FA9A")),Color.MEDIUMTURQUOISE=Object.freeze(Color.fromCssColorString("#48D1CC")),Color.MEDIUMVIOLETRED=Object.freeze(Color.fromCssColorString("#C71585")),Color.MIDNIGHTBLUE=Object.freeze(Color.fromCssColorString("#191970")),Color.MINTCREAM=Object.freeze(Color.fromCssColorString("#F5FFFA")),Color.MISTYROSE=Object.freeze(Color.fromCssColorString("#FFE4E1")),Color.MOCCASIN=Object.freeze(Color.fromCssColorString("#FFE4B5")),Color.NAVAJOWHITE=Object.freeze(Color.fromCssColorString("#FFDEAD")),Color.NAVY=Object.freeze(Color.fromCssColorString("#000080")),Color.OLDLACE=Object.freeze(Color.fromCssColorString("#FDF5E6")),Color.OLIVE=Object.freeze(Color.fromCssColorString("#808000")),Color.OLIVEDRAB=Object.freeze(Color.fromCssColorString("#6B8E23")),Color.ORANGE=Object.freeze(Color.fromCssColorString("#FFA500")),Color.ORANGERED=Object.freeze(Color.fromCssColorString("#FF4500")),Color.ORCHID=Object.freeze(Color.fromCssColorString("#DA70D6")),Color.PALEGOLDENROD=Object.freeze(Color.fromCssColorString("#EEE8AA")),Color.PALEGREEN=Object.freeze(Color.fromCssColorString("#98FB98")),Color.PALETURQUOISE=Object.freeze(Color.fromCssColorString("#AFEEEE")),Color.PALEVIOLETRED=Object.freeze(Color.fromCssColorString("#DB7093")),Color.PAPAYAWHIP=Object.freeze(Color.fromCssColorString("#FFEFD5")),Color.PEACHPUFF=Object.freeze(Color.fromCssColorString("#FFDAB9")),Color.PERU=Object.freeze(Color.fromCssColorString("#CD853F")),Color.PINK=Object.freeze(Color.fromCssColorString("#FFC0CB")),Color.PLUM=Object.freeze(Color.fromCssColorString("#DDA0DD")),Color.POWDERBLUE=Object.freeze(Color.fromCssColorString("#B0E0E6")),Color.PURPLE=Object.freeze(Color.fromCssColorString("#800080")),Color.RED=Object.freeze(Color.fromCssColorString("#FF0000")),Color.ROSYBROWN=Object.freeze(Color.fromCssColorString("#BC8F8F")),Color.ROYALBLUE=Object.freeze(Color.fromCssColorString("#4169E1")),Color.SADDLEBROWN=Object.freeze(Color.fromCssColorString("#8B4513")),Color.SALMON=Object.freeze(Color.fromCssColorString("#FA8072")),Color.SANDYBROWN=Object.freeze(Color.fromCssColorString("#F4A460")),Color.SEAGREEN=Object.freeze(Color.fromCssColorString("#2E8B57")),Color.SEASHELL=Object.freeze(Color.fromCssColorString("#FFF5EE")),Color.SIENNA=Object.freeze(Color.fromCssColorString("#A0522D")),Color.SILVER=Object.freeze(Color.fromCssColorString("#C0C0C0")),Color.SKYBLUE=Object.freeze(Color.fromCssColorString("#87CEEB")),Color.SLATEBLUE=Object.freeze(Color.fromCssColorString("#6A5ACD")),Color.SLATEGRAY=Object.freeze(Color.fromCssColorString("#708090")),Color.SLATEGREY=Color.SLATEGRAY,Color.SNOW=Object.freeze(Color.fromCssColorString("#FFFAFA")),Color.SPRINGGREEN=Object.freeze(Color.fromCssColorString("#00FF7F")),Color.STEELBLUE=Object.freeze(Color.fromCssColorString("#4682B4")),Color.TAN=Object.freeze(Color.fromCssColorString("#D2B48C")),Color.TEAL=Object.freeze(Color.fromCssColorString("#008080")),Color.THISTLE=Object.freeze(Color.fromCssColorString("#D8BFD8")),Color.TOMATO=Object.freeze(Color.fromCssColorString("#FF6347")),Color.TURQUOISE=Object.freeze(Color.fromCssColorString("#40E0D0")),Color.VIOLET=Object.freeze(Color.fromCssColorString("#EE82EE")),Color.WHEAT=Object.freeze(Color.fromCssColorString("#F5DEB3")),Color.WHITE=Object.freeze(Color.fromCssColorString("#FFFFFF")),Color.WHITESMOKE=Object.freeze(Color.fromCssColorString("#F5F5F5")),Color.YELLOW=Object.freeze(Color.fromCssColorString("#FFFF00")),Color.YELLOWGREEN=Object.freeze(Color.fromCssColorString("#9ACD32")),Color.TRANSPARENT=Object.freeze(new Color(0,0,0,0)),Object.defineProperties(ColorGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 4}},normalize:{get:function(){return!0}}}),ColorGeometryInstanceAttribute.fromColor=function(e){return new ColorGeometryInstanceAttribute(e.red,e.green,e.blue,e.alpha)},ColorGeometryInstanceAttribute.toValue=function(e,t){return defined(t)?e.toBytes(t):new Uint8Array(e.toBytes())},ColorGeometryInstanceAttribute.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.value[0]===t.value[0]&&e.value[1]===t.value[1]&&e.value[2]===t.value[2]&&e.value[3]===t.value[3]},Object.defineProperties(CompressedTextureBuffer.prototype,{internalFormat:{get:function(){return this._format}},pixelDatatype:{get:function(){return this._datatype}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},bufferView:{get:function(){return this._buffer}}}),CompressedTextureBuffer.clone=function(e){if(defined(e))return new CompressedTextureBuffer(e._format,e._datatype,e._width,e._height,e._buffer)},CompressedTextureBuffer.prototype.clone=function(){return CompressedTextureBuffer.clone(this)};var CoplanarPolygonGeometryLibrary={},scratchIntersectionPoint=new Cartesian3,scratchXAxis=new Cartesian3,scratchYAxis=new Cartesian3,scratchZAxis=new Cartesian3,obbScratch=new OrientedBoundingBox;function projectTo2D(e,t,i,r,n){var a=Cartesian3.subtract(e,t,scratchIntersectionPoint),o=Cartesian3.dot(i,a),s=Cartesian3.dot(r,a);return Cartesian2.fromElements(o,s,n)}function calculateM(e,t,i){if(0===e)return t*i;var r=e*e,n=r*r,a=n*r,o=a*r,s=o*r,l=s*r,c=i;return t*((1-r/4-3*n/64-5*a/256-175*o/16384-441*s/65536-4851*l/1048576)*c-(3*r/8+3*n/32+45*a/1024+105*o/4096+2205*s/131072+6237*l/524288)*Math.sin(2*c)+(15*n/256+45*a/1024+525*o/16384+1575*s/65536+155925*l/8388608)*Math.sin(4*c)-(35*a/3072+175*o/12288+3675*s/262144+13475*l/1048576)*Math.sin(6*c)+(315*o/131072+2205*s/524288+43659*l/8388608)*Math.sin(8*c)-(693*s/1310720+6237*l/5242880)*Math.sin(10*c)+1001*l/8388608*Math.sin(12*c))}function calculateInverseM(e,t,i){var r=e/i;if(0===t)return r;var n=r*r,a=n*r,o=a*r,s=t*t,l=s*s,c=l*s,u=c*s,d=u*s,h=d*s,p=Math.sin(2*r),f=Math.cos(2*r),m=Math.sin(4*r),g=Math.cos(4*r),_=Math.sin(6*r),y=Math.cos(6*r),v=Math.sin(8*r),C=Math.cos(8*r),T=Math.sin(10*r);return r+r*s/4+7*r*l/64+15*r*c/256+579*r*u/16384+1515*r*d/65536+16837*r*h/1048576+(3*r*l/16+45*r*c/256-r*(32*n-561)*u/4096-r*(232*n-1677)*d/16384+r*(399985-90560*n+512*o)*h/5242880)*f+(21*r*c/256+483*r*u/4096-r*(224*n-1969)*d/16384-r*(33152*n-112599)*h/1048576)*g+(151*r*u/4096+4681*r*d/65536+1479*r*h/16384-453*a*h/32768)*y+(1097*r*d/65536+42783*r*h/1048576)*C+8011*r*h/1048576*Math.cos(10*r)+(3*s/8+3*l/16+213*c/2048-3*n*c/64+255*u/4096-33*n*u/512+20861*d/524288-33*n*d/512+o*d/1024+28273*h/1048576-471*n*h/8192+9*o*h/4096)*p+(21*l/256+21*c/256+533*u/8192-21*n*u/512+197*d/4096-315*n*d/4096+584039*h/16777216-12517*n*h/131072+7*o*h/2048)*m+(151*c/6144+151*u/4096+5019*d/131072-453*n*d/16384+26965*h/786432-8607*n*h/131072)*_+(1097*u/131072+1097*d/65536+225797*h/10485760-1097*n*h/65536)*v+(8011*d/2621440+8011*h/1048576)*T+293393*h/251658240*Math.sin(12*r)}function calculateSigma(e,t){if(0===e)return Math.log(Math.tan(.5*(CesiumMath.PI_OVER_TWO+t)));var i=e*Math.sin(t);return Math.log(Math.tan(.5*(CesiumMath.PI_OVER_TWO+t)))-e/2*Math.log((1+i)/(1-i))}function calculateHeading(e,t,i,r,n){var a=calculateSigma(e._ellipticity,i),o=calculateSigma(e._ellipticity,n);return Math.atan2(CesiumMath.negativePiToPi(r-t),o-a)}function calculateArcLength(e,t,i,r,n,a,o){var s=e._heading,l=a-r,c=0;if(CesiumMath.equalsEpsilon(Math.abs(s),CesiumMath.PI_OVER_TWO,CesiumMath.EPSILON8))if(t===i)c=t*Math.cos(n)*CesiumMath.negativePiToPi(l);else{var u=Math.sin(n);c=t*Math.cos(n)*CesiumMath.negativePiToPi(l)/Math.sqrt(1-e._ellipticitySquared*u*u)}else{var d=calculateM(e._ellipticity,t,n);c=(calculateM(e._ellipticity,t,o)-d)/Math.cos(s)}return Math.abs(c)}CoplanarPolygonGeometryLibrary.validOutline=function(e){var t=OrientedBoundingBox.fromPoints(e,obbScratch).halfAxes,i=Matrix3.getColumn(t,0,scratchXAxis),r=Matrix3.getColumn(t,1,scratchYAxis),n=Matrix3.getColumn(t,2,scratchZAxis),a=Cartesian3.magnitude(i),o=Cartesian3.magnitude(r),s=Cartesian3.magnitude(n);return!(0===a&&(0===o||0===s)||0===o&&0===s)},CoplanarPolygonGeometryLibrary.computeProjectTo2DArguments=function(e,t,i,r){var n,a,o=OrientedBoundingBox.fromPoints(e,obbScratch),s=o.halfAxes,l=Matrix3.getColumn(s,0,scratchXAxis),c=Matrix3.getColumn(s,1,scratchYAxis),u=Matrix3.getColumn(s,2,scratchZAxis),d=Cartesian3.magnitude(l),h=Cartesian3.magnitude(c),p=Cartesian3.magnitude(u),f=Math.min(d,h,p);return(0!==d||0!==h&&0!==p)&&(0!==h||0!==p)&&(f!==h&&f!==p||(n=l),f===d?n=c:f===p&&(a=c),f!==d&&f!==h||(a=u),Cartesian3.normalize(n,i),Cartesian3.normalize(a,r),Cartesian3.clone(o.center,t),!0)},CoplanarPolygonGeometryLibrary.createProjectPointsTo2DFunction=function(e,t,i){return function(r){for(var n=new Array(r.length),a=0;a<r.length;a++)n[a]=projectTo2D(r[a],e,t,i);return n}},CoplanarPolygonGeometryLibrary.createProjectPointTo2DFunction=function(e,t,i){return function(r,n){return projectTo2D(r,e,t,i,n)}};var scratchCart1$1=new Cartesian3,scratchCart2$2=new Cartesian3;function computeProperties$1(e,t,i,r){Cartesian3.normalize(r.cartographicToCartesian(t,scratchCart2$2),scratchCart1$1),Cartesian3.normalize(r.cartographicToCartesian(i,scratchCart2$2),scratchCart2$2);var n=r.maximumRadius,a=r.minimumRadius,o=n*n,s=a*a;e._ellipticitySquared=(o-s)/o,e._ellipticity=Math.sqrt(e._ellipticitySquared),e._start=Cartographic.clone(t,e._start),e._start.height=0,e._end=Cartographic.clone(i,e._end),e._end.height=0,e._heading=calculateHeading(e,t.longitude,t.latitude,i.longitude,i.latitude),e._distance=calculateArcLength(e,r.maximumRadius,r.minimumRadius,t.longitude,t.latitude,i.longitude,i.latitude)}function interpolateUsingSurfaceDistance(e,t,i,r,n,a){if(0===i)return Cartographic.clone(e,a);var o,s,l,c=n*n;if(Math.abs(CesiumMath.PI_OVER_TWO-Math.abs(t))>CesiumMath.EPSILON8){s=calculateInverseM(calculateM(n,r,e.latitude)+i*Math.cos(t),n,r);var u=calculateSigma(n,e.latitude),d=calculateSigma(n,s);l=Math.tan(t)*(d-u),o=CesiumMath.negativePiToPi(e.longitude+l)}else{var h;if(s=e.latitude,0===n)h=r*Math.cos(e.latitude);else{var p=Math.sin(e.latitude);h=r*Math.cos(e.latitude)/Math.sqrt(1-c*p*p)}l=i/h,o=t>0?CesiumMath.negativePiToPi(e.longitude+l):CesiumMath.negativePiToPi(e.longitude-l)}return defined(a)?(a.longitude=o,a.latitude=s,a.height=0,a):new Cartographic(o,s,0)}function EllipsoidRhumbLine(e,t,i){var r=defaultValue(i,Ellipsoid.WGS84);this._ellipsoid=r,this._start=new Cartographic,this._end=new Cartographic,this._heading=void 0,this._distance=void 0,this._ellipticity=void 0,this._ellipticitySquared=void 0,defined(e)&&defined(t)&&computeProperties$1(this,e,t,r)}Object.defineProperties(EllipsoidRhumbLine.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},heading:{get:function(){return this._heading}}}),EllipsoidRhumbLine.fromStartHeadingDistance=function(e,t,i,r,n){var a=defaultValue(r,Ellipsoid.WGS84),o=a.maximumRadius,s=a.minimumRadius,l=o*o,c=s*s,u=Math.sqrt((l-c)/l),d=interpolateUsingSurfaceDistance(e,t=CesiumMath.negativePiToPi(t),i,a.maximumRadius,u);return!defined(n)||defined(r)&&!r.equals(n.ellipsoid)?new EllipsoidRhumbLine(e,d,a):(n.setEndPoints(e,d),n)},EllipsoidRhumbLine.prototype.setEndPoints=function(e,t){computeProperties$1(this,e,t,this._ellipsoid)},EllipsoidRhumbLine.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(e*this._distance,t)},EllipsoidRhumbLine.prototype.interpolateUsingSurfaceDistance=function(e,t){return interpolateUsingSurfaceDistance(this._start,this._heading,e,this._ellipsoid.maximumRadius,this._ellipticity,t)},EllipsoidRhumbLine.prototype.findIntersectionWithLongitude=function(e,t){var i=this._ellipticity,r=this._heading,n=Math.abs(r),a=this._start;if(e=CesiumMath.negativePiToPi(e),CesiumMath.equalsEpsilon(Math.abs(e),Math.PI,CesiumMath.EPSILON14)&&(e=CesiumMath.sign(a.longitude)*Math.PI),defined(t)||(t=new Cartographic),Math.abs(CesiumMath.PI_OVER_TWO-n)<=CesiumMath.EPSILON8)return t.longitude=e,t.latitude=a.latitude,t.height=0,t;if(CesiumMath.equalsEpsilon(Math.abs(CesiumMath.PI_OVER_TWO-n),CesiumMath.PI_OVER_TWO,CesiumMath.EPSILON8)){if(CesiumMath.equalsEpsilon(e,a.longitude,CesiumMath.EPSILON12))return;return t.longitude=e,t.latitude=CesiumMath.PI_OVER_TWO*CesiumMath.sign(CesiumMath.PI_OVER_TWO-r),t.height=0,t}var o,s=a.latitude,l=i*Math.sin(s),c=Math.tan(.5*(CesiumMath.PI_OVER_TWO+s))*Math.exp((e-a.longitude)/Math.tan(r)),u=(1+l)/(1-l),d=a.latitude;do{o=d;var h=i*Math.sin(o),p=(1+h)/(1-h);d=2*Math.atan(c*Math.pow(p/u,i/2))-CesiumMath.PI_OVER_TWO}while(!CesiumMath.equalsEpsilon(d,o,CesiumMath.EPSILON12));return t.longitude=e,t.latitude=d,t.height=0,t},EllipsoidRhumbLine.prototype.findIntersectionWithLatitude=function(e,t){var i=this._ellipticity,r=this._heading,n=this._start;if(!CesiumMath.equalsEpsilon(Math.abs(r),CesiumMath.PI_OVER_TWO,CesiumMath.EPSILON8)){var a=calculateSigma(i,n.latitude),o=calculateSigma(i,e),s=Math.tan(r)*(o-a),l=CesiumMath.negativePiToPi(n.longitude+s);return defined(t)?(t.longitude=l,t.latitude=e,t.height=0,t):new Cartographic(l,e,0)}};var earcut_1=earcut,_default=earcut;function earcut(e,t,i){i=i||2;var r,n,a,o,s,l,c,u=t&&t.length,d=u?t[0]*i:e.length,h=linkedList(e,0,d,i,!0),p=[];if(!h||h.next===h.prev)return p;if(u&&(h=eliminateHoles(e,t,h,i)),e.length>80*i){r=a=e[0],n=o=e[1];for(var f=i;f<d;f+=i)(s=e[f])<r&&(r=s),(l=e[f+1])<n&&(n=l),s>a&&(a=s),l>o&&(o=l);c=0!==(c=Math.max(a-r,o-n))?1/c:0}return earcutLinked(h,p,i,r,n,c),p}function linkedList(e,t,i,r,n){var a,o;if(n===signedArea(e,t,i,r)>0)for(a=t;a<i;a+=r)o=insertNode(a,e[a],e[a+1],o);else for(a=i-r;a>=t;a-=r)o=insertNode(a,e[a],e[a+1],o);return o&&equals(o,o.next)&&(removeNode(o),o=o.next),o}function filterPoints(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!equals(r,r.next)&&0!==area(r.prev,r,r.next))r=r.next;else{if(removeNode(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function earcutLinked(e,t,i,r,n,a,o){if(e){!o&&a&&indexCurve(e,r,n,a);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?isEarHashed(e,r,n,a):isEar(e))t.push(s.i/i),t.push(e.i/i),t.push(l.i/i),removeNode(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?earcutLinked(e=cureLocalIntersections(filterPoints(e),t,i),t,i,r,n,a,2):2===o&&splitEarcut(e,t,i,r,n,a):earcutLinked(filterPoints(e),t,i,r,n,a,1);break}}}function isEar(e){var t=e.prev,i=e,r=e.next;if(area(t,i,r)>=0)return!1;for(var n=e.next.next;n!==e.prev;){if(pointInTriangle(t.x,t.y,i.x,i.y,r.x,r.y,n.x,n.y)&&area(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function isEarHashed(e,t,i,r){var n=e.prev,a=e,o=e.next;if(area(n,a,o)>=0)return!1;for(var s=n.x<a.x?n.x<o.x?n.x:o.x:a.x<o.x?a.x:o.x,l=n.y<a.y?n.y<o.y?n.y:o.y:a.y<o.y?a.y:o.y,c=n.x>a.x?n.x>o.x?n.x:o.x:a.x>o.x?a.x:o.x,u=n.y>a.y?n.y>o.y?n.y:o.y:a.y>o.y?a.y:o.y,d=zOrder(s,l,t,i,r),h=zOrder(c,u,t,i,r),p=e.prevZ,f=e.nextZ;p&&p.z>=d&&f&&f.z<=h;){if(p!==e.prev&&p!==e.next&&pointInTriangle(n.x,n.y,a.x,a.y,o.x,o.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&pointInTriangle(n.x,n.y,a.x,a.y,o.x,o.y,f.x,f.y)&&area(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=d;){if(p!==e.prev&&p!==e.next&&pointInTriangle(n.x,n.y,a.x,a.y,o.x,o.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=h;){if(f!==e.prev&&f!==e.next&&pointInTriangle(n.x,n.y,a.x,a.y,o.x,o.y,f.x,f.y)&&area(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function cureLocalIntersections(e,t,i){var r=e;do{var n=r.prev,a=r.next.next;!equals(n,a)&&intersects$1(n,r,r.next,a)&&locallyInside(n,a)&&locallyInside(a,n)&&(t.push(n.i/i),t.push(r.i/i),t.push(a.i/i),removeNode(r),removeNode(r.next),r=e=a),r=r.next}while(r!==e);return filterPoints(r)}function splitEarcut(e,t,i,r,n,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&isValidDiagonal(o,s)){var l=splitPolygon(o,s);return o=filterPoints(o,o.next),l=filterPoints(l,l.next),earcutLinked(o,t,i,r,n,a),void earcutLinked(l,t,i,r,n,a)}s=s.next}o=o.next}while(o!==e)}function eliminateHoles(e,t,i,r){var n,a,o,s=[];for(n=0,a=t.length;n<a;n++)(o=linkedList(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(getLeftmost(o));for(s.sort(compareX),n=0;n<s.length;n++)i=filterPoints(i=eliminateHole(s[n],i),i.next);return i}function compareX(e,t){return e.x-t.x}function eliminateHole(e,t){var i=findHoleBridge(e,t);if(!i)return t;var r=splitPolygon(i,e),n=filterPoints(i,i.next);return filterPoints(r,r.next),t===i?n:t}function findHoleBridge(e,t){var i,r=t,n=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o){if(o=s,s===n){if(a===r.y)return r;if(a===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!i)return null;if(n===o)return i;var l,c=i,u=i.x,d=i.y,h=1/0;r=i;do{n>=r.x&&r.x>=u&&n!==r.x&&pointInTriangle(a<d?n:o,a,u,d,a<d?o:n,a,r.x,r.y)&&(l=Math.abs(a-r.y)/(n-r.x),locallyInside(r,e)&&(l<h||l===h&&(r.x>i.x||r.x===i.x&§orContainsSector(i,r)))&&(i=r,h=l)),r=r.next}while(r!==c);return i}function sectorContainsSector(e,t){return area(e.prev,e,t.prev)<0&&area(t.next,e,e.next)<0}function indexCurve(e,t,i,r){var n=e;do{null===n.z&&(n.z=zOrder(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,sortLinked(n)}function sortLinked(e){var t,i,r,n,a,o,s,l,c=1;do{for(i=e,e=null,a=null,o=0;i;){for(o++,r=i,s=0,t=0;t<c&&(s++,r=r.nextZ);t++);for(l=c;s>0||l>0&&r;)0!==s&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;i=r}a.nextZ=null,c*=2}while(o>1);return e}function zOrder(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function getLeftmost(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function pointInTriangle(e,t,i,r,n,a,o,s){return(n-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(r-s)-(i-o)*(t-s)>=0&&(i-o)*(a-s)-(n-o)*(r-s)>=0}function isValidDiagonal(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!intersectsPolygon(e,t)&&(locallyInside(e,t)&&locallyInside(t,e)&&middleInside(e,t)&&(area(e.prev,e,t.prev)||area(e,t.prev,t))||equals(e,t)&&area(e.prev,e,e.next)>0&&area(t.prev,t,t.next)>0)}function area(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function equals(e,t){return e.x===t.x&&e.y===t.y}function intersects$1(e,t,i,r){var n=sign(area(e,t,i)),a=sign(area(e,t,r)),o=sign(area(i,r,e)),s=sign(area(i,r,t));return n!==a&&o!==s||(!(0!==n||!onSegment(e,i,t))||(!(0!==a||!onSegment(e,r,t))||(!(0!==o||!onSegment(i,e,r))||!(0!==s||!onSegment(i,t,r)))))}function onSegment(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function sign(e){return e>0?1:e<0?-1:0}function intersectsPolygon(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&intersects$1(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}function locallyInside(e,t){return area(e.prev,e,e.next)<0?area(e,t,e.next)>=0&&area(e,e.prev,t)>=0:area(e,t,e.prev)<0||area(e,e.next,t)<0}function middleInside(e,t){var i=e,r=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}function splitPolygon(e,t){var i=new Node$4(e.i,e.x,e.y),r=new Node$4(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function insertNode(e,t,i,r){var n=new Node$4(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function removeNode(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Node$4(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(e,t,i,r){for(var n=0,a=t,o=i-r;a<i;a+=r)n+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return n}earcut.deviation=function(e,t,i,r){var n=t&&t.length,a=n?t[0]*i:e.length,o=Math.abs(signedArea(e,0,a,i));if(n)for(var s=0,l=t.length;s<l;s++){var c=t[s]*i,u=s<l-1?t[s+1]*i:e.length;o-=Math.abs(signedArea(e,c,u,i))}var d=0;for(s=0;s<r.length;s+=3){var h=r[s]*i,p=r[s+1]*i,f=r[s+2]*i;d+=Math.abs((e[h]-e[f])*(e[p+1]-e[h+1])-(e[h]-e[p])*(e[f+1]-e[h+1]))}return 0===o&&0===d?0:Math.abs((d-o)/o)},earcut.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,n=0;n<e.length;n++){for(var a=0;a<e[n].length;a++)for(var o=0;o<t;o++)i.vertices.push(e[n][a][o]);n>0&&(r+=e[n-1].length,i.holes.push(r))}return i},earcut_1.default=_default;var WindingOrder={CLOCKWISE:WebGLConstants$1.CW,COUNTER_CLOCKWISE:WebGLConstants$1.CCW,validate:function(e){return e===WindingOrder.CLOCKWISE||e===WindingOrder.COUNTER_CLOCKWISE}},WindingOrder$1=Object.freeze(WindingOrder),scaleToGeodeticHeightN=new Cartesian3,scaleToGeodeticHeightP=new Cartesian3,PolygonPipeline={computeArea2D:function(e){for(var t=e.length,i=0,r=t-1,n=0;n<t;r=n++){var a=e[r],o=e[n];i+=a.x*o.y-o.x*a.y}return.5*i},computeWindingOrder2D:function(e){return PolygonPipeline.computeArea2D(e)>0?WindingOrder$1.COUNTER_CLOCKWISE:WindingOrder$1.CLOCKWISE},triangulate:function(e,t){var i=Cartesian2.packArray(e);return earcut_1(i,t,2)}},subdivisionV0Scratch=new Cartesian3,subdivisionV1Scratch=new Cartesian3,subdivisionV2Scratch=new Cartesian3,subdivisionS0Scratch=new Cartesian3,subdivisionS1Scratch=new Cartesian3,subdivisionS2Scratch=new Cartesian3,subdivisionMidScratch=new Cartesian3;PolygonPipeline.computeSubdivision=function(e,t,i,r){r=defaultValue(r,CesiumMath.RADIANS_PER_DEGREE);var n,a=i.slice(0),o=t.length,s=new Array(3*o),l=0;for(n=0;n<o;n++){var c=t[n];s[l++]=c.x,s[l++]=c.y,s[l++]=c.z}for(var u=[],d={},h=e.maximumRadius,p=CesiumMath.chordLength(r,h),f=p*p;a.length>0;){var m,g,_=a.pop(),y=a.pop(),v=a.pop(),C=Cartesian3.fromArray(s,3*v,subdivisionV0Scratch),T=Cartesian3.fromArray(s,3*y,subdivisionV1Scratch),S=Cartesian3.fromArray(s,3*_,subdivisionV2Scratch),A=Cartesian3.multiplyByScalar(Cartesian3.normalize(C,subdivisionS0Scratch),h,subdivisionS0Scratch),x=Cartesian3.multiplyByScalar(Cartesian3.normalize(T,subdivisionS1Scratch),h,subdivisionS1Scratch),E=Cartesian3.multiplyByScalar(Cartesian3.normalize(S,subdivisionS2Scratch),h,subdivisionS2Scratch),b=Cartesian3.magnitudeSquared(Cartesian3.subtract(A,x,subdivisionMidScratch)),P=Cartesian3.magnitudeSquared(Cartesian3.subtract(x,E,subdivisionMidScratch)),D=Cartesian3.magnitudeSquared(Cartesian3.subtract(E,A,subdivisionMidScratch)),w=Math.max(b,P,D);w>f?b===w?(defined(n=d[m=Math.min(v,y)+" "+Math.max(v,y)])||(g=Cartesian3.add(C,T,subdivisionMidScratch),Cartesian3.multiplyByScalar(g,.5,g),s.push(g.x,g.y,g.z),n=s.length/3-1,d[m]=n),a.push(v,n,_),a.push(n,y,_)):P===w?(defined(n=d[m=Math.min(y,_)+" "+Math.max(y,_)])||(g=Cartesian3.add(T,S,subdivisionMidScratch),Cartesian3.multiplyByScalar(g,.5,g),s.push(g.x,g.y,g.z),n=s.length/3-1,d[m]=n),a.push(y,n,v),a.push(n,_,v)):D===w&&(defined(n=d[m=Math.min(_,v)+" "+Math.max(_,v)])||(g=Cartesian3.add(S,C,subdivisionMidScratch),Cartesian3.multiplyByScalar(g,.5,g),s.push(g.x,g.y,g.z),n=s.length/3-1,d[m]=n),a.push(_,n,y),a.push(n,v,y)):(u.push(v),u.push(y),u.push(_))}return new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:s})},indices:u,primitiveType:PrimitiveType$1.TRIANGLES})};var subdivisionC0Scratch=new Cartographic,subdivisionC1Scratch=new Cartographic,subdivisionC2Scratch=new Cartographic,subdivisionCartographicScratch=new Cartographic;function Queue(){this._array=[],this._offset=0,this._length=0}PolygonPipeline.computeRhumbLineSubdivision=function(e,t,i,r){r=defaultValue(r,CesiumMath.RADIANS_PER_DEGREE);var n,a=i.slice(0),o=t.length,s=new Array(3*o),l=0;for(n=0;n<o;n++){var c=t[n];s[l++]=c.x,s[l++]=c.y,s[l++]=c.z}for(var u=[],d={},h=e.maximumRadius,p=CesiumMath.chordLength(r,h),f=new EllipsoidRhumbLine(void 0,void 0,e),m=new EllipsoidRhumbLine(void 0,void 0,e),g=new EllipsoidRhumbLine(void 0,void 0,e);a.length>0;){var _=a.pop(),y=a.pop(),v=a.pop(),C=Cartesian3.fromArray(s,3*v,subdivisionV0Scratch),T=Cartesian3.fromArray(s,3*y,subdivisionV1Scratch),S=Cartesian3.fromArray(s,3*_,subdivisionV2Scratch),A=e.cartesianToCartographic(C,subdivisionC0Scratch),x=e.cartesianToCartographic(T,subdivisionC1Scratch),E=e.cartesianToCartographic(S,subdivisionC2Scratch);f.setEndPoints(A,x);var b=f.surfaceDistance;m.setEndPoints(x,E);var P=m.surfaceDistance;g.setEndPoints(E,A);var D,w,M,I,R=g.surfaceDistance,O=Math.max(b,P,R);O>p?b===O?(defined(n=d[D=Math.min(v,y)+" "+Math.max(v,y)])||(w=f.interpolateUsingFraction(.5,subdivisionCartographicScratch),M=.5*(A.height+x.height),I=Cartesian3.fromRadians(w.longitude,w.latitude,M,e,subdivisionMidScratch),s.push(I.x,I.y,I.z),n=s.length/3-1,d[D]=n),a.push(v,n,_),a.push(n,y,_)):P===O?(defined(n=d[D=Math.min(y,_)+" "+Math.max(y,_)])||(w=m.interpolateUsingFraction(.5,subdivisionCartographicScratch),M=.5*(x.height+E.height),I=Cartesian3.fromRadians(w.longitude,w.latitude,M,e,subdivisionMidScratch),s.push(I.x,I.y,I.z),n=s.length/3-1,d[D]=n),a.push(y,n,v),a.push(n,_,v)):R===O&&(defined(n=d[D=Math.min(_,v)+" "+Math.max(_,v)])||(w=g.interpolateUsingFraction(.5,subdivisionCartographicScratch),M=.5*(E.height+A.height),I=Cartesian3.fromRadians(w.longitude,w.latitude,M,e,subdivisionMidScratch),s.push(I.x,I.y,I.z),n=s.length/3-1,d[D]=n),a.push(_,n,y),a.push(n,v,y)):(u.push(v),u.push(y),u.push(_))}return new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:s})},indices:u,primitiveType:PrimitiveType$1.TRIANGLES})},PolygonPipeline.scaleToGeodeticHeight=function(e,t,i,r){i=defaultValue(i,Ellipsoid.WGS84);var n=scaleToGeodeticHeightN,a=scaleToGeodeticHeightP;if(t=defaultValue(t,0),r=defaultValue(r,!0),defined(e))for(var o=e.length,s=0;s<o;s+=3)Cartesian3.fromArray(e,s,a),r&&(a=i.scaleToGeodeticSurface(a,a)),0!==t&&(n=i.geodeticSurfaceNormal(a,n),Cartesian3.multiplyByScalar(n,t,n),Cartesian3.add(a,n,a)),e[s]=a.x,e[s+1]=a.y,e[s+2]=a.z;return e},Object.defineProperties(Queue.prototype,{length:{get:function(){return this._length}}}),Queue.prototype.enqueue=function(e){this._array.push(e),this._length++},Queue.prototype.dequeue=function(){if(0!==this._length){var e=this._array,t=this._offset,i=e[t];return e[t]=void 0,++t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this._length--,i}},Queue.prototype.peek=function(){if(0!==this._length)return this._array[this._offset]},Queue.prototype.contains=function(e){return-1!==this._array.indexOf(e)},Queue.prototype.clear=function(){this._array.length=this._offset=this._length=0},Queue.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};var PolygonGeometryLibrary={computeHierarchyPackedLength:function(e){for(var t=0,i=[e];i.length>0;){var r=i.pop();if(defined(r)){t+=2;var n=r.positions,a=r.holes;if(defined(n)&&(t+=n.length*Cartesian3.packedLength),defined(a))for(var o=a.length,s=0;s<o;++s)i.push(a[s])}}return t},packPolygonHierarchy:function(e,t,i){for(var r=[e];r.length>0;){var n=r.pop();if(defined(n)){var a=n.positions,o=n.holes;if(t[i++]=defined(a)?a.length:0,t[i++]=defined(o)?o.length:0,defined(a))for(var s=a.length,l=0;l<s;++l,i+=3)Cartesian3.pack(a[l],t,i);if(defined(o))for(var c=o.length,u=0;u<c;++u)r.push(o[u])}}return i},unpackPolygonHierarchy:function(e,t){for(var i=e[t++],r=e[t++],n=new Array(i),a=r>0?new Array(r):void 0,o=0;o<i;++o,t+=Cartesian3.packedLength)n[o]=Cartesian3.unpack(e,t);for(var s=0;s<r;++s)a[s]=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t),t=a[s].startingIndex,delete a[s].startingIndex;return{positions:n,holes:a,startingIndex:t}}},distanceScratch=new Cartesian3;function getPointAtDistance(e,t,i,r){return Cartesian3.subtract(t,e,distanceScratch),Cartesian3.multiplyByScalar(distanceScratch,i/r,distanceScratch),Cartesian3.add(e,distanceScratch,distanceScratch),[distanceScratch.x,distanceScratch.y,distanceScratch.z]}PolygonGeometryLibrary.subdivideLineCount=function(e,t,i){var r=Cartesian3.distance(e,t)/i,n=Math.max(0,Math.ceil(CesiumMath.log2(r)));return Math.pow(2,n)};var scratchCartographic0$1=new Cartographic,scratchCartographic1$2=new Cartographic,scratchCartographic2$1=new Cartographic,scratchCartesian0=new Cartesian3;PolygonGeometryLibrary.subdivideRhumbLineCount=function(e,t,i,r){var n=new EllipsoidRhumbLine(e.cartesianToCartographic(t,scratchCartographic0$1),e.cartesianToCartographic(i,scratchCartographic1$2),e).surfaceDistance/r,a=Math.max(0,Math.ceil(CesiumMath.log2(n)));return Math.pow(2,a)},PolygonGeometryLibrary.subdivideLine=function(e,t,i,r){var n=PolygonGeometryLibrary.subdivideLineCount(e,t,i),a=Cartesian3.distance(e,t),o=a/n;defined(r)||(r=[]);var s=r;s.length=3*n;for(var l=0,c=0;c<n;c++){var u=getPointAtDistance(e,t,c*o,a);s[l++]=u[0],s[l++]=u[1],s[l++]=u[2]}return s},PolygonGeometryLibrary.subdivideRhumbLine=function(e,t,i,r,n){var a=new EllipsoidRhumbLine(e.cartesianToCartographic(t,scratchCartographic0$1),e.cartesianToCartographic(i,scratchCartographic1$2),e),o=a.surfaceDistance/r,s=Math.max(0,Math.ceil(CesiumMath.log2(o))),l=Math.pow(2,s),c=a.surfaceDistance/l;defined(n)||(n=[]);var u=n;u.length=3*l;for(var d=0,h=0;h<l;h++){var p=a.interpolateUsingSurfaceDistance(h*c,scratchCartographic2$1),f=e.cartographicToCartesian(p,scratchCartesian0);u[d++]=f.x,u[d++]=f.y,u[d++]=f.z}return u};var scaleToGeodeticHeightN1=new Cartesian3,scaleToGeodeticHeightN2=new Cartesian3,scaleToGeodeticHeightP1=new Cartesian3,scaleToGeodeticHeightP2=new Cartesian3;PolygonGeometryLibrary.scaleToGeodeticHeightExtruded=function(e,t,i,r,n){r=defaultValue(r,Ellipsoid.WGS84);var a=scaleToGeodeticHeightN1,o=scaleToGeodeticHeightN2,s=scaleToGeodeticHeightP1,l=scaleToGeodeticHeightP2;if(defined(e)&&defined(e.attributes)&&defined(e.attributes.position))for(var c=e.attributes.position.values,u=c.length/2,d=0;d<u;d+=3)Cartesian3.fromArray(c,d,s),r.geodeticSurfaceNormal(s,a),l=r.scaleToGeodeticSurface(s,l),o=Cartesian3.multiplyByScalar(a,i,o),o=Cartesian3.add(l,o,o),c[d+u]=o.x,c[d+1+u]=o.y,c[d+2+u]=o.z,n&&(l=Cartesian3.clone(s,l)),o=Cartesian3.multiplyByScalar(a,t,o),o=Cartesian3.add(l,o,o),c[d]=o.x,c[d+1]=o.y,c[d+2]=o.z;return e},PolygonGeometryLibrary.polygonOutlinesFromHierarchy=function(e,t,i){var r,n,a,o=[],s=new Queue;for(s.enqueue(e);0!==s.length;){var l=s.dequeue(),c=l.positions;if(t)for(a=c.length,r=0;r<a;r++)i.scaleToGeodeticSurface(c[r],c[r]);if(!((c=arrayRemoveDuplicates(c,Cartesian3.equalsEpsilon,!0)).length<3)){var u=l.holes?l.holes.length:0;for(r=0;r<u;r++){var d=l.holes[r],h=d.positions;if(t)for(a=h.length,n=0;n<a;++n)i.scaleToGeodeticSurface(h[n],h[n]);if(!((h=arrayRemoveDuplicates(h,Cartesian3.equalsEpsilon,!0)).length<3)){o.push(h);var p=0;for(defined(d.holes)&&(p=d.holes.length),n=0;n<p;n++)s.enqueue(d.holes[n])}}o.push(c)}}return o},PolygonGeometryLibrary.polygonsFromHierarchy=function(e,t,i,r){var n=[],a=[],o=new Queue;for(o.enqueue(e);0!==o.length;){var s,l,c=o.dequeue(),u=c.positions,d=c.holes;if(i)for(l=u.length,s=0;s<l;s++)r.scaleToGeodeticSurface(u[s],u[s]);if(!((u=arrayRemoveDuplicates(u,Cartesian3.equalsEpsilon,!0)).length<3)){var h=t(u);if(defined(h)){var p=[],f=PolygonPipeline.computeWindingOrder2D(h);f===WindingOrder$1.CLOCKWISE&&(h.reverse(),u=u.slice().reverse());var m,g=u.slice(),_=defined(d)?d.length:0,y=[];for(s=0;s<_;s++){var v=d[s],C=v.positions;if(i)for(l=C.length,m=0;m<l;++m)r.scaleToGeodeticSurface(C[m],C[m]);if(!((C=arrayRemoveDuplicates(C,Cartesian3.equalsEpsilon,!0)).length<3)){var T=t(C);if(defined(T)){(f=PolygonPipeline.computeWindingOrder2D(T))===WindingOrder$1.CLOCKWISE&&(T.reverse(),C=C.slice().reverse()),y.push(C),p.push(g.length),g=g.concat(C),h=h.concat(T);var S=0;for(defined(v.holes)&&(S=v.holes.length),m=0;m<S;m++)o.enqueue(v.holes[m])}}}n.push({outerRing:u,holes:y}),a.push({positions:g,positions2D:h,holes:p})}}}return{hierarchy:n,polygons:a}};var computeBoundingRectangleCartesian2=new Cartesian2,computeBoundingRectangleCartesian3=new Cartesian3,computeBoundingRectangleQuaternion=new Quaternion,computeBoundingRectangleMatrix3=new Matrix3;PolygonGeometryLibrary.computeBoundingRectangle=function(e,t,i,r,n){for(var a=Quaternion.fromAxisAngle(e,r,computeBoundingRectangleQuaternion),o=Matrix3.fromQuaternion(a,computeBoundingRectangleMatrix3),s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,d=i.length,h=0;h<d;++h){var p=Cartesian3.clone(i[h],computeBoundingRectangleCartesian3);Matrix3.multiplyByVector(o,p,p);var f=t(p,computeBoundingRectangleCartesian2);defined(f)&&(s=Math.min(s,f.x),l=Math.max(l,f.x),c=Math.min(c,f.y),u=Math.max(u,f.y))}return n.x=s,n.y=c,n.width=l-s,n.height=u-c,n},PolygonGeometryLibrary.createGeometryFromPositions=function(e,t,i,r,n,a){var o=PolygonPipeline.triangulate(t.positions2D,t.holes);o.length<3&&(o=[0,1,2]);var s=t.positions;if(r){for(var l=s.length,c=new Array(3*l),u=0,d=0;d<l;d++){var h=s[d];c[u++]=h.x,c[u++]=h.y,c[u++]=h.z}var p=new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:c})},indices:o,primitiveType:PrimitiveType$1.TRIANGLES});return n.normal?GeometryPipeline.computeNormal(p):p}return a===ArcType$1.GEODESIC?PolygonPipeline.computeSubdivision(e,s,o,i):a===ArcType$1.RHUMB?PolygonPipeline.computeRhumbLineSubdivision(e,s,o,i):void 0};var computeWallIndicesSubdivided=[],p1Scratch$1=new Cartesian3,p2Scratch$1=new Cartesian3;PolygonGeometryLibrary.computeWallGeometry=function(e,t,i,r,n){var a,o,s,l,c,u=e.length,d=0;if(r)for(o=3*u*2,a=new Array(2*o),s=0;s<u;s++)l=e[s],c=e[(s+1)%u],a[d]=a[d+o]=l.x,a[++d]=a[d+o]=l.y,a[++d]=a[d+o]=l.z,a[++d]=a[d+o]=c.x,a[++d]=a[d+o]=c.y,a[++d]=a[d+o]=c.z,++d;else{var h=CesiumMath.chordLength(i,t.maximumRadius),p=0;if(n===ArcType$1.GEODESIC)for(s=0;s<u;s++)p+=PolygonGeometryLibrary.subdivideLineCount(e[s],e[(s+1)%u],h);else if(n===ArcType$1.RHUMB)for(s=0;s<u;s++)p+=PolygonGeometryLibrary.subdivideRhumbLineCount(t,e[s],e[(s+1)%u],h);for(o=3*(p+u),a=new Array(2*o),s=0;s<u;s++){var f;l=e[s],c=e[(s+1)%u],n===ArcType$1.GEODESIC?f=PolygonGeometryLibrary.subdivideLine(l,c,h,computeWallIndicesSubdivided):n===ArcType$1.RHUMB&&(f=PolygonGeometryLibrary.subdivideRhumbLine(t,l,c,h,computeWallIndicesSubdivided));for(var m=f.length,g=0;g<m;++g,++d)a[d]=f[g],a[d+o]=f[g];a[d]=c.x,a[d+o]=c.x,a[++d]=c.y,a[d+o]=c.y,a[++d]=c.z,a[d+o]=c.z,++d}}u=a.length;var _=IndexDatatype$1.createTypedArray(u/3,u-6*e.length),y=0;for(u/=6,s=0;s<u;s++){var v=s,C=v+1,T=v+u,S=T+1;l=Cartesian3.fromArray(a,3*v,p1Scratch$1),c=Cartesian3.fromArray(a,3*C,p2Scratch$1),Cartesian3.equalsEpsilon(l,c,CesiumMath.EPSILON10,CesiumMath.EPSILON10)||(_[y++]=v,_[y++]=T,_[y++]=C,_[y++]=C,_[y++]=T,_[y++]=S)}return new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})}),indices:_,primitiveType:PrimitiveType$1.TRIANGLES})};var scratchPosition$c=new Cartesian3,scratchBR=new BoundingRectangle,stScratch$1=new Cartesian2,textureCoordinatesOrigin=new Cartesian2,scratchNormal$4=new Cartesian3,scratchTangent$3=new Cartesian3,scratchBitangent$3=new Cartesian3,centerScratch$6=new Cartesian3,axis1Scratch=new Cartesian3,axis2Scratch=new Cartesian3,quaternionScratch$2=new Quaternion,textureMatrixScratch=new Matrix3,tangentRotationScratch=new Matrix3,surfaceNormalScratch=new Cartesian3;function createGeometryFromPolygon(e,t,i,r,n,a,o,s){var l=e.positions,c=PolygonPipeline.triangulate(e.positions2D,e.holes);c.length<3&&(c=[0,1,2]);var u=IndexDatatype$1.createTypedArray(l.length,c.length);u.set(c);var d=textureMatrixScratch;if(0!==r){var h=Quaternion.fromAxisAngle(a,r,quaternionScratch$2);if(d=Matrix3.fromQuaternion(h,d),t.tangent||t.bitangent){h=Quaternion.fromAxisAngle(a,-r,quaternionScratch$2);var p=Matrix3.fromQuaternion(h,tangentRotationScratch);o=Cartesian3.normalize(Matrix3.multiplyByVector(p,o,o),o),t.bitangent&&(s=Cartesian3.normalize(Cartesian3.cross(a,o,s),s))}}else d=Matrix3.clone(Matrix3.IDENTITY,d);var f=textureCoordinatesOrigin;t.st&&(f.x=i.x,f.y=i.y);for(var m=l.length,g=3*m,_=new Float64Array(g),y=t.normal?new Float32Array(g):void 0,v=t.tangent?new Float32Array(g):void 0,C=t.bitangent?new Float32Array(g):void 0,T=t.st?new Float32Array(2*m):void 0,S=0,A=0,x=0,E=0,b=0,P=0;P<m;P++){var D=l[P];if(_[S++]=D.x,_[S++]=D.y,_[S++]=D.z,t.st){var w=n(Matrix3.multiplyByVector(d,D,scratchPosition$c),stScratch$1);Cartesian2.subtract(w,f,w);var M=CesiumMath.clamp(w.x/i.width,0,1),I=CesiumMath.clamp(w.y/i.height,0,1);T[b++]=M,T[b++]=I}t.normal&&(y[A++]=a.x,y[A++]=a.y,y[A++]=a.z),t.tangent&&(v[E++]=o.x,v[E++]=o.y,v[E++]=o.z),t.bitangent&&(C[x++]=s.x,C[x++]=s.y,C[x++]=s.z)}var R=new GeometryAttributes;return t.position&&(R.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:_})),t.normal&&(R.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:y})),t.tangent&&(R.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:v})),t.bitangent&&(R.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:C})),t.st&&(R.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:T})),new Geometry({attributes:R,indices:u,primitiveType:PrimitiveType$1.TRIANGLES})}function CoplanarPolygonGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polygonHierarchy,i=defaultValue(e.vertexFormat,VertexFormat.DEFAULT);this._vertexFormat=VertexFormat.clone(i),this._polygonHierarchy=t,this._stRotation=defaultValue(e.stRotation,0),this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._workerName="createCoplanarPolygonGeometry",this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+VertexFormat.packedLength+Ellipsoid.packedLength+2}CoplanarPolygonGeometry.fromPositions=function(e){return new CoplanarPolygonGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid})},CoplanarPolygonGeometry.pack=function(e,t,i){return i=defaultValue(i,0),i=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,i),Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._stRotation,t[i]=e.packedLength,t};var scratchEllipsoid$c=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$a=new VertexFormat,scratchOptions$h={polygonHierarchy:{}};function createGeometryFromPositions$1(e){for(var t=e.length,i=new Float64Array(3*t),r=IndexDatatype$1.createTypedArray(t,2*t),n=0,a=0,o=0;o<t;o++){var s=e[o];i[n++]=s.x,i[n++]=s.y,i[n++]=s.z,r[a++]=o,r[a++]=(o+1)%t}return new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:i})}),indices:r,primitiveType:PrimitiveType$1.LINES})}function CoplanarPolygonOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polygonHierarchy;this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+1}CoplanarPolygonGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=r.startingIndex,delete r.startingIndex;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$c);t+=Ellipsoid.packedLength;var a=VertexFormat.unpack(e,t,scratchVertexFormat$a);t+=VertexFormat.packedLength;var o=e[t++],s=e[t];return defined(i)||(i=new CoplanarPolygonGeometry(scratchOptions$h)),i._polygonHierarchy=r,i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._vertexFormat=VertexFormat.clone(a,i._vertexFormat),i._stRotation=o,i.packedLength=s,i},CoplanarPolygonGeometry.createGeometry=function(e){var t=e._vertexFormat,i=e._polygonHierarchy,r=e._stRotation,n=i.positions;if(!((n=arrayRemoveDuplicates(n,Cartesian3.equalsEpsilon,!0)).length<3)){var a=scratchNormal$4,o=scratchTangent$3,s=scratchBitangent$3,l=axis1Scratch,c=axis2Scratch;if(CoplanarPolygonGeometryLibrary.computeProjectTo2DArguments(n,centerScratch$6,l,c)){if(a=Cartesian3.cross(l,c,a),a=Cartesian3.normalize(a,a),!Cartesian3.equalsEpsilon(centerScratch$6,Cartesian3.ZERO,CesiumMath.EPSILON6)){var u=e._ellipsoid.geodeticSurfaceNormal(centerScratch$6,surfaceNormalScratch);Cartesian3.dot(a,u)<0&&(a=Cartesian3.negate(a,a),l=Cartesian3.negate(l,l))}var d=CoplanarPolygonGeometryLibrary.createProjectPointsTo2DFunction(centerScratch$6,l,c),h=CoplanarPolygonGeometryLibrary.createProjectPointTo2DFunction(centerScratch$6,l,c);t.tangent&&(o=Cartesian3.clone(l,o)),t.bitangent&&(s=Cartesian3.clone(c,s));var p=PolygonGeometryLibrary.polygonsFromHierarchy(i,d,!1),f=p.hierarchy,m=p.polygons;if(0!==f.length){n=f[0].outerRing;for(var g=BoundingSphere.fromPoints(n),_=PolygonGeometryLibrary.computeBoundingRectangle(a,h,n,r,scratchBR),y=[],v=0;v<m.length;v++){var C=new GeometryInstance({geometry:createGeometryFromPolygon(m[v],t,_,r,h,a,o,s)});y.push(C)}var T=GeometryPipeline.combineInstances(y)[0];T.attributes.position.values=new Float64Array(T.attributes.position.values),T.indices=IndexDatatype$1.createTypedArray(T.attributes.position.values.length/3,T.indices);var S=T.attributes;return t.position||delete S.position,new Geometry({attributes:S,indices:T.indices,primitiveType:T.primitiveType,boundingSphere:g})}}}},CoplanarPolygonOutlineGeometry.fromPositions=function(e){return new CoplanarPolygonOutlineGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions}})},CoplanarPolygonOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),t[i=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,i)]=e.packedLength,t};var scratchOptions$g={polygonHierarchy:{}};CoplanarPolygonOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=r.startingIndex,delete r.startingIndex;var n=e[t];return defined(i)||(i=new CoplanarPolygonOutlineGeometry(scratchOptions$g)),i._polygonHierarchy=r,i.packedLength=n,i},CoplanarPolygonOutlineGeometry.createGeometry=function(e){var t=e._polygonHierarchy,i=t.positions;if(!((i=arrayRemoveDuplicates(i,Cartesian3.equalsEpsilon,!0)).length<3)&&CoplanarPolygonGeometryLibrary.validOutline(i)){var r=PolygonGeometryLibrary.polygonOutlinesFromHierarchy(t,!1);if(0!==r.length){for(var n=[],a=0;a<r.length;a++){var o=new GeometryInstance({geometry:createGeometryFromPositions$1(r[a])});n.push(o)}var s=GeometryPipeline.combineInstances(n)[0],l=BoundingSphere.fromPoints(t.positions);return new Geometry({attributes:s.attributes,indices:s.indices,primitiveType:s.primitiveType,boundingSphere:l})}}};var CornerType={ROUNDED:0,MITERED:1,BEVELED:2},CornerType$1=Object.freeze(CornerType);function setConstants(e){var t=e._uSquared,i=e._ellipsoid.maximumRadius,r=e._ellipsoid.minimumRadius,n=(i-r)/i,a=Math.cos(e._startHeading),o=Math.sin(e._startHeading),s=(1-n)*Math.tan(e._start.latitude),l=1/Math.sqrt(1+s*s),c=l*s,u=Math.atan2(s,a),d=l*o,h=d*d,p=1-h,f=Math.sqrt(p),m=t/4,g=m*m,_=g*m,y=g*g,v=1+m-3*g/4+5*_/4-175*y/64,C=1-m+15*g/8-35*_/8,T=1-3*m+35*g/4,S=1-5*m,A=v*u-C*Math.sin(2*u)*m/2-T*Math.sin(4*u)*g/16-S*Math.sin(6*u)*_/48-5*Math.sin(8*u)*y/512,x=e._constants;x.a=i,x.b=r,x.f=n,x.cosineHeading=a,x.sineHeading=o,x.tanU=s,x.cosineU=l,x.sineU=c,x.sigma=u,x.sineAlpha=d,x.sineSquaredAlpha=h,x.cosineSquaredAlpha=p,x.cosineAlpha=f,x.u2Over4=m,x.u4Over16=g,x.u6Over64=_,x.u8Over256=y,x.a0=v,x.a1=C,x.a2=T,x.a3=S,x.distanceRatio=A}function computeC(e,t){return e*t*(4+e*(4-3*t))/16}function computeDeltaLambda(e,t,i,r,n,a,o){var s=computeC(e,i);return(1-s)*e*t*(r+s*n*(o+s*a*(2*o*o-1)))}function vincentyInverseFormula(e,t,i,r,n,a,o){var s,l,c,u,d,h=(t-i)/t,p=a-r,f=Math.atan((1-h)*Math.tan(n)),m=Math.atan((1-h)*Math.tan(o)),g=Math.cos(f),_=Math.sin(f),y=Math.cos(m),v=Math.sin(m),C=g*y,T=g*v,S=_*v,A=_*y,x=p,E=CesiumMath.TWO_PI,b=Math.cos(x),P=Math.sin(x);do{b=Math.cos(x),P=Math.sin(x);var D,w=T-A*b;c=Math.sqrt(y*y*P*P+w*w),l=S+C*b,s=Math.atan2(c,l),0===c?(D=0,u=1):u=1-(D=C*P/c)*D,E=x,d=l-2*S/u,isFinite(d)||(d=0),x=p+computeDeltaLambda(h,D,u,s,c,l,d)}while(Math.abs(x-E)>CesiumMath.EPSILON12);var M=u*(t*t-i*i)/(i*i),I=M*(256+M*(M*(74-47*M)-128))/1024,R=d*d,O=i*(1+M*(4096+M*(M*(320-175*M)-768))/16384)*(s-I*c*(d+I*(l*(2*R-1)-I*d*(4*c*c-3)*(4*R-3)/6)/4)),B=Math.atan2(y*P,T-A*b),L=Math.atan2(g*P,T*b-A);e._distance=O,e._startHeading=B,e._endHeading=L,e._uSquared=M}var scratchCart1=new Cartesian3,scratchCart2$1=new Cartesian3;function computeProperties(e,t,i,r){Cartesian3.normalize(r.cartographicToCartesian(t,scratchCart2$1),scratchCart1),Cartesian3.normalize(r.cartographicToCartesian(i,scratchCart2$1),scratchCart2$1),vincentyInverseFormula(e,r.maximumRadius,r.minimumRadius,t.longitude,t.latitude,i.longitude,i.latitude),e._start=Cartographic.clone(t,e._start),e._end=Cartographic.clone(i,e._end),e._start.height=0,e._end.height=0,setConstants(e)}function EllipsoidGeodesic(e,t,i){var r=defaultValue(i,Ellipsoid.WGS84);this._ellipsoid=r,this._start=new Cartographic,this._end=new Cartographic,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,defined(e)&&defined(t)&&computeProperties(this,e,t,r)}Object.defineProperties(EllipsoidGeodesic.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),EllipsoidGeodesic.prototype.setEndPoints=function(e,t){computeProperties(this,e,t,this._ellipsoid)},EllipsoidGeodesic.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},EllipsoidGeodesic.prototype.interpolateUsingSurfaceDistance=function(e,t){var i=this._constants,r=i.distanceRatio+e/i.b,n=Math.cos(2*r),a=Math.cos(4*r),o=Math.cos(6*r),s=Math.sin(2*r),l=Math.sin(4*r),c=Math.sin(6*r),u=Math.sin(8*r),d=r*r,h=r*d,p=i.u8Over256,f=i.u2Over4,m=i.u6Over64,g=i.u4Over16,_=2*h*p*n/3+r*(1-f+7*g/4-15*m/4+579*p/64-(g-15*m/4+187*p/16)*n-(5*m/4-115*p/16)*a-29*p*o/16)+(f/2-g+71*m/32-85*p/16)*s+(5*g/16-5*m/4+383*p/96)*l-d*((m-11*p/2)*s+5*p*l/2)+(29*m/96-29*p/16)*c+539*p*u/1536,y=Math.asin(Math.sin(_)*i.cosineAlpha),v=Math.atan(i.a/i.b*Math.tan(y));_-=i.sigma;var C=Math.cos(2*i.sigma+_),T=Math.sin(_),S=Math.cos(_),A=i.cosineU*S,x=i.sineU*T,E=Math.atan2(T*i.sineHeading,A-x*i.cosineHeading)-computeDeltaLambda(i.f,i.sineAlpha,i.cosineSquaredAlpha,_,T,S,C);return defined(t)?(t.longitude=this._start.longitude+E,t.latitude=v,t.height=0,t):new Cartographic(this._start.longitude+E,v,0)};var PolylinePipeline={numberOfPoints:function(e,t,i){var r=Cartesian3.distance(e,t);return Math.ceil(r/i)},numberOfPointsRhumbLine:function(e,t,i){var r=Math.pow(e.longitude-t.longitude,2)+Math.pow(e.latitude-t.latitude,2);return Math.max(1,Math.ceil(Math.sqrt(r/(i*i))))}},cartoScratch$2=new Cartographic;PolylinePipeline.extractHeights=function(e,t){for(var i=e.length,r=new Array(i),n=0;n<i;n++){var a=e[n];r[n]=t.cartesianToCartographic(a,cartoScratch$2).height}return r};var wrapLongitudeInversMatrix=new Matrix4,wrapLongitudeOrigin=new Cartesian3,wrapLongitudeXZNormal=new Cartesian3,wrapLongitudeXZPlane=new Plane(Cartesian3.UNIT_X,0),wrapLongitudeYZNormal=new Cartesian3,wrapLongitudeYZPlane=new Plane(Cartesian3.UNIT_X,0),wrapLongitudeIntersection=new Cartesian3,wrapLongitudeOffset=new Cartesian3,subdivideHeightsScratchArray=[];function subdivideHeights$1(e,t,i){var r,n=subdivideHeightsScratchArray;if(n.length=e,t===i){for(r=0;r<e;r++)n[r]=t;return n}var a=(i-t)/e;for(r=0;r<e;r++){var o=t+r*a;n[r]=o}return n}var carto1=new Cartographic,carto2=new Cartographic,cartesian=new Cartesian3,scaleFirst=new Cartesian3,scaleLast=new Cartesian3,ellipsoidGeodesic$1=new EllipsoidGeodesic,ellipsoidRhumb=new EllipsoidRhumbLine;function generateCartesianArc(e,t,i,r,n,a,o,s){var l=r.scaleToGeodeticSurface(e,scaleFirst),c=r.scaleToGeodeticSurface(t,scaleLast),u=PolylinePipeline.numberOfPoints(e,t,i),d=r.cartesianToCartographic(l,carto1),h=r.cartesianToCartographic(c,carto2),p=subdivideHeights$1(u,n,a);ellipsoidGeodesic$1.setEndPoints(d,h);var f=ellipsoidGeodesic$1.surfaceDistance/u,m=s;d.height=n;var g=r.cartographicToCartesian(d,cartesian);Cartesian3.pack(g,o,m),m+=3;for(var _=1;_<u;_++){var y=ellipsoidGeodesic$1.interpolateUsingSurfaceDistance(_*f,carto2);y.height=p[_],g=r.cartographicToCartesian(y,cartesian),Cartesian3.pack(g,o,m),m+=3}return m}function generateCartesianRhumbArc(e,t,i,r,n,a,o,s){var l=r.cartesianToCartographic(e,carto1),c=r.cartesianToCartographic(t,carto2),u=PolylinePipeline.numberOfPointsRhumbLine(l,c,i);l.height=0,c.height=0;var d=subdivideHeights$1(u,n,a);ellipsoidRhumb.ellipsoid.equals(r)||(ellipsoidRhumb=new EllipsoidRhumbLine(void 0,void 0,r)),ellipsoidRhumb.setEndPoints(l,c);var h=ellipsoidRhumb.surfaceDistance/u,p=s;l.height=n;var f=r.cartographicToCartesian(l,cartesian);Cartesian3.pack(f,o,p),p+=3;for(var m=1;m<u;m++){var g=ellipsoidRhumb.interpolateUsingSurfaceDistance(m*h,carto2);g.height=d[m],f=r.cartographicToCartesian(g,cartesian),Cartesian3.pack(f,o,p),p+=3}return p}PolylinePipeline.wrapLongitude=function(e,t){var i=[],r=[];if(defined(e)&&e.length>0){t=defaultValue(t,Matrix4.IDENTITY);var n=Matrix4.inverseTransformation(t,wrapLongitudeInversMatrix),a=Matrix4.multiplyByPoint(n,Cartesian3.ZERO,wrapLongitudeOrigin),o=Cartesian3.normalize(Matrix4.multiplyByPointAsVector(n,Cartesian3.UNIT_Y,wrapLongitudeXZNormal),wrapLongitudeXZNormal),s=Plane.fromPointNormal(a,o,wrapLongitudeXZPlane),l=Cartesian3.normalize(Matrix4.multiplyByPointAsVector(n,Cartesian3.UNIT_X,wrapLongitudeYZNormal),wrapLongitudeYZNormal),c=Plane.fromPointNormal(a,l,wrapLongitudeYZPlane),u=1;i.push(Cartesian3.clone(e[0]));for(var d=i[0],h=e.length,p=1;p<h;++p){var f=e[p];if(Plane.getPointDistance(c,d)<0||Plane.getPointDistance(c,f)<0){var m=IntersectionTests.lineSegmentPlane(d,f,s,wrapLongitudeIntersection);if(defined(m)){var g=Cartesian3.multiplyByScalar(o,5e-9,wrapLongitudeOffset);Plane.getPointDistance(s,d)<0&&Cartesian3.negate(g,g),i.push(Cartesian3.add(m,g,new Cartesian3)),r.push(u+1),Cartesian3.negate(g,g),i.push(Cartesian3.add(m,g,new Cartesian3)),u=1}}i.push(Cartesian3.clone(e[p])),u++,d=f}r.push(u)}return{positions:i,lengths:r}},PolylinePipeline.generateArc=function(e){defined(e)||(e={});var t=e.positions,i=t.length,r=defaultValue(e.ellipsoid,Ellipsoid.WGS84),n=defaultValue(e.height,0),a=Array.isArray(n);if(i<1)return[];if(1===i){var o=r.scaleToGeodeticSurface(t[0],scaleFirst);if(0!==(n=a?n[0]:n)){var s=r.geodeticSurfaceNormal(o,cartesian);Cartesian3.multiplyByScalar(s,n,s),Cartesian3.add(o,s,o)}return[o.x,o.y,o.z]}var l=e.minDistance;if(!defined(l)){var c=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE);l=CesiumMath.chordLength(c,r.maximumRadius)}var u,d=0;for(u=0;u<i-1;u++)d+=PolylinePipeline.numberOfPoints(t[u],t[u+1],l);var h=3*(d+1),p=new Array(h),f=0;for(u=0;u<i-1;u++){f=generateCartesianArc(t[u],t[u+1],l,r,a?n[u]:n,a?n[u+1]:n,p,f)}subdivideHeightsScratchArray.length=0;var m=t[i-1],g=r.cartesianToCartographic(m,carto1);g.height=a?n[i-1]:n;var _=r.cartographicToCartesian(g,cartesian);return Cartesian3.pack(_,p,h-3),p};var scratchCartographic0=new Cartographic,scratchCartographic1$1=new Cartographic;PolylinePipeline.generateRhumbArc=function(e){defined(e)||(e={});var t=e.positions,i=t.length,r=defaultValue(e.ellipsoid,Ellipsoid.WGS84),n=defaultValue(e.height,0),a=Array.isArray(n);if(i<1)return[];if(1===i){var o=r.scaleToGeodeticSurface(t[0],scaleFirst);if(0!==(n=a?n[0]:n)){var s=r.geodeticSurfaceNormal(o,cartesian);Cartesian3.multiplyByScalar(s,n,s),Cartesian3.add(o,s,o)}return[o.x,o.y,o.z]}var l,c,u=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),d=0,h=r.cartesianToCartographic(t[0],scratchCartographic0);for(l=0;l<i-1;l++)c=r.cartesianToCartographic(t[l+1],scratchCartographic1$1),d+=PolylinePipeline.numberOfPointsRhumbLine(h,c,u),h=Cartographic.clone(c,scratchCartographic0);var p=3*(d+1),f=new Array(p),m=0;for(l=0;l<i-1;l++){m=generateCartesianRhumbArc(t[l],t[l+1],u,r,a?n[l]:n,a?n[l+1]:n,f,m)}subdivideHeightsScratchArray.length=0;var g=t[i-1],_=r.cartesianToCartographic(g,carto1);_.height=a?n[i-1]:n;var y=r.cartographicToCartesian(_,cartesian);return Cartesian3.pack(y,f,p-3),f},PolylinePipeline.generateCartesianArc=function(e){for(var t=PolylinePipeline.generateArc(e),i=t.length/3,r=new Array(i),n=0;n<i;n++)r[n]=Cartesian3.unpack(t,3*n);return r},PolylinePipeline.generateCartesianRhumbArc=function(e){for(var t=PolylinePipeline.generateRhumbArc(e),i=t.length/3,r=new Array(i),n=0;n<i;n++)r[n]=Cartesian3.unpack(t,3*n);return r};var warnings={};function oneTimeWarning(e,t){defined(warnings[e])||(warnings[e]=!0,console.warn(defaultValue(t,e)))}oneTimeWarning.geometryOutlines="Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.",oneTimeWarning.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored",oneTimeWarning.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored",oneTimeWarning.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";var scratch2Array=[new Cartesian3,new Cartesian3],scratchCartesian1$3=new Cartesian3,scratchCartesian2$6=new Cartesian3,scratchCartesian3$7=new Cartesian3,scratchCartesian4$4=new Cartesian3,scratchCartesian5$1=new Cartesian3,scratchCartesian6=new Cartesian3,scratchCartesian7=new Cartesian3,scratchCartesian8=new Cartesian3,scratchCartesian9=new Cartesian3,scratch1$2=new Cartesian3,scratch2$2=new Cartesian3,PolylineVolumeGeometryLibrary={},cartographic=new Cartographic;function scaleToSurface$2(e,t){for(var i=new Array(e.length),r=0;r<e.length;r++){var n=e[r];cartographic=t.cartesianToCartographic(n,cartographic),i[r]=cartographic.height,e[r]=t.scaleToGeodeticSurface(n,n)}return i}function subdivideHeights(e,t,i,r){var n,a=e[0],o=e[1],s=Cartesian3.angleBetween(a,o),l=Math.ceil(s/r),c=new Array(l);if(t===i){for(n=0;n<l;n++)c[n]=t;return c.push(i),c}var u=(i-t)/l;for(n=1;n<l;n++){var d=t+n*u;c[n]=d}return c[0]=t,c.push(i),c}var nextScratch=new Cartesian3,prevScratch=new Cartesian3;function computeRotationAngle(e,t,i,r){var n=new EllipsoidTangentPlane(i,r),a=n.projectPointOntoPlane(Cartesian3.add(i,e,nextScratch),nextScratch),o=n.projectPointOntoPlane(Cartesian3.add(i,t,prevScratch),prevScratch),s=Cartesian2.angleBetween(a,o);return o.x*a.y-o.y*a.x>=0?-s:s}var negativeX=new Cartesian3(-1,0,0),transform$2=new Matrix4,translation$1=new Matrix4,rotationZ=new Matrix3,scaleMatrix=Matrix3.IDENTITY.clone(),westScratch=new Cartesian3,finalPosScratch=new Cartesian4,heightCartesian=new Cartesian3;function addPosition(e,t,i,r,n,a,o,s){var l=westScratch,c=finalPosScratch;transform$2=Transforms.eastNorthUpToFixedFrame(e,n,transform$2),l=Matrix4.multiplyByPointAsVector(transform$2,negativeX,l);var u=computeRotationAngle(l=Cartesian3.normalize(l,l),t,e,n);rotationZ=Matrix3.fromRotationZ(u,rotationZ),heightCartesian.z=a,transform$2=Matrix4.multiplyTransformation(transform$2,Matrix4.fromRotationTranslation(rotationZ,heightCartesian,translation$1),transform$2);var d=scaleMatrix;d[0]=o;for(var h=0;h<s;h++)for(var p=0;p<i.length;p+=3)c=Cartesian3.fromArray(i,p,c),c=Matrix3.multiplyByVector(d,c,c),c=Matrix4.multiplyByPoint(transform$2,c,c),r.push(c.x,c.y,c.z);return r}var centerScratch$5=new Cartesian3;function addPositions(e,t,i,r,n,a,o){for(var s=0;s<e.length;s+=3){r=addPosition(Cartesian3.fromArray(e,s,centerScratch$5),t,i,r,n,a[s/3],o,1)}return r}function convertShapeTo3DDuplicate(e,t){var i=e.length,r=new Array(6*i),n=0,a=t.x+t.width/2,o=t.y+t.height/2,s=e[0];r[n++]=s.x-a,r[n++]=0,r[n++]=s.y-o;for(var l=1;l<i;l++){var c=(s=e[l]).x-a,u=s.y-o;r[n++]=c,r[n++]=0,r[n++]=u,r[n++]=c,r[n++]=0,r[n++]=u}return s=e[0],r[n++]=s.x-a,r[n++]=0,r[n++]=s.y-o,r}function convertShapeTo3D(e,t){for(var i=e.length,r=new Array(3*i),n=0,a=t.x+t.width/2,o=t.y+t.height/2,s=0;s<i;s++)r[n++]=e[s].x-a,r[n++]=0,r[n++]=e[s].y-o;return r}var quaterion$1=new Quaternion,startPointScratch=new Cartesian3,rotMatrix$1=new Matrix3;function computeRoundCorner$1(e,t,i,r,n,a,o,s,l,c){var u,d,h=Cartesian3.angleBetween(Cartesian3.subtract(t,e,scratch1$2),Cartesian3.subtract(i,e,scratch2$2)),p=r===CornerType$1.BEVELED?0:Math.ceil(h/CesiumMath.toRadians(5));if(u=n?Matrix3.fromQuaternion(Quaternion.fromAxisAngle(Cartesian3.negate(e,scratch1$2),h/(p+1),quaterion$1),rotMatrix$1):Matrix3.fromQuaternion(Quaternion.fromAxisAngle(e,h/(p+1),quaterion$1),rotMatrix$1),t=Cartesian3.clone(t,startPointScratch),p>0)for(var f=c?2:1,m=0;m<p;m++)t=Matrix3.multiplyByVector(u,t,t),d=Cartesian3.subtract(t,e,scratch1$2),d=Cartesian3.normalize(d,d),n||(d=Cartesian3.negate(d,d)),o=addPosition(a.scaleToGeodeticSurface(t,scratch2$2),d,s,o,a,l,1,f);else d=Cartesian3.subtract(t,e,scratch1$2),d=Cartesian3.normalize(d,d),n||(d=Cartesian3.negate(d,d)),o=addPosition(a.scaleToGeodeticSurface(t,scratch2$2),d,s,o,a,l,1,1),i=Cartesian3.clone(i,startPointScratch),d=Cartesian3.subtract(i,e,scratch1$2),d=Cartesian3.normalize(d,d),n||(d=Cartesian3.negate(d,d)),o=addPosition(a.scaleToGeodeticSurface(i,scratch2$2),d,s,o,a,l,1,1);return o}PolylineVolumeGeometryLibrary.removeDuplicatesFromShape=function(e){for(var t=e.length,i=[],r=t-1,n=0;n<t;r=n++){var a=e[r],o=e[n];Cartesian2.equals(a,o)||i.push(o)}return i},PolylineVolumeGeometryLibrary.angleIsGreaterThanPi=function(e,t,i,r){var n=new EllipsoidTangentPlane(i,r),a=n.projectPointOntoPlane(Cartesian3.add(i,e,nextScratch),nextScratch),o=n.projectPointOntoPlane(Cartesian3.add(i,t,prevScratch),prevScratch);return o.x*a.y-o.y*a.x>=0};var scratchForwardProjection$1=new Cartesian3,scratchBackwardProjection$1=new Cartesian3;PolylineVolumeGeometryLibrary.computePositions=function(e,t,i,r,n){var a=r._ellipsoid,o=scaleToSurface$2(e,a),s=r._granularity,l=r._cornerType,c=n?convertShapeTo3DDuplicate(t,i):convertShapeTo3D(t,i),u=n?convertShapeTo3D(t,i):void 0,d=i.height/2,h=i.width/2,p=e.length,f=[],m=n?[]:void 0,g=scratchCartesian1$3,_=scratchCartesian2$6,y=scratchCartesian3$7,v=scratchCartesian4$4,C=scratchCartesian5$1,T=scratchCartesian6,S=scratchCartesian7,A=scratchCartesian8,x=scratchCartesian9,E=e[0],b=e[1];v=a.geodeticSurfaceNormal(E,v),g=Cartesian3.subtract(b,E,g),g=Cartesian3.normalize(g,g),A=Cartesian3.cross(v,g,A),A=Cartesian3.normalize(A,A);var P,D=o[0],w=o[1];n&&(m=addPosition(E,A,u,m,a,D+d,1,1)),x=Cartesian3.clone(E,x),E=b,_=Cartesian3.negate(g,_);for(var M=1;M<p-1;M++){var I=n?2:1;if(b=e[M+1],E.equals(b))oneTimeWarning("Positions are too close and are considered equivalent with rounding error.");else{g=Cartesian3.subtract(b,E,g),g=Cartesian3.normalize(g,g),y=Cartesian3.add(g,_,y),y=Cartesian3.normalize(y,y),v=a.geodeticSurfaceNormal(E,v);var R=Cartesian3.multiplyByScalar(v,Cartesian3.dot(g,v),scratchForwardProjection$1);Cartesian3.subtract(g,R,R),Cartesian3.normalize(R,R);var O=Cartesian3.multiplyByScalar(v,Cartesian3.dot(_,v),scratchBackwardProjection$1);if(Cartesian3.subtract(_,O,O),Cartesian3.normalize(O,O),!CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(R,O)),1,CesiumMath.EPSILON7)){y=Cartesian3.cross(y,v,y),y=Cartesian3.cross(v,y,y),y=Cartesian3.normalize(y,y);var B=1/Math.max(.25,Cartesian3.magnitude(Cartesian3.cross(y,_,scratch1$2))),L=PolylineVolumeGeometryLibrary.angleIsGreaterThanPi(g,_,E,a);L?(C=Cartesian3.add(E,Cartesian3.multiplyByScalar(y,B*h,y),C),T=Cartesian3.add(C,Cartesian3.multiplyByScalar(A,h,T),T),scratch2Array[0]=Cartesian3.clone(x,scratch2Array[0]),scratch2Array[1]=Cartesian3.clone(T,scratch2Array[1]),P=subdivideHeights(scratch2Array,D+d,w+d,s),f=addPositions(PolylinePipeline.generateArc({positions:scratch2Array,granularity:s,ellipsoid:a}),A,c,f,a,P,1),A=Cartesian3.cross(v,g,A),A=Cartesian3.normalize(A,A),S=Cartesian3.add(C,Cartesian3.multiplyByScalar(A,h,S),S),l===CornerType$1.ROUNDED||l===CornerType$1.BEVELED?computeRoundCorner$1(C,T,S,l,L,a,f,c,w+d,n):f=addPosition(E,y=Cartesian3.negate(y,y),c,f,a,w+d,B,I),x=Cartesian3.clone(S,x)):(C=Cartesian3.add(E,Cartesian3.multiplyByScalar(y,B*h,y),C),T=Cartesian3.add(C,Cartesian3.multiplyByScalar(A,-h,T),T),scratch2Array[0]=Cartesian3.clone(x,scratch2Array[0]),scratch2Array[1]=Cartesian3.clone(T,scratch2Array[1]),P=subdivideHeights(scratch2Array,D+d,w+d,s),f=addPositions(PolylinePipeline.generateArc({positions:scratch2Array,granularity:s,ellipsoid:a}),A,c,f,a,P,1),A=Cartesian3.cross(v,g,A),A=Cartesian3.normalize(A,A),S=Cartesian3.add(C,Cartesian3.multiplyByScalar(A,-h,S),S),l===CornerType$1.ROUNDED||l===CornerType$1.BEVELED?computeRoundCorner$1(C,T,S,l,L,a,f,c,w+d,n):f=addPosition(E,y,c,f,a,w+d,B,I),x=Cartesian3.clone(S,x)),_=Cartesian3.negate(g,_)}else f=addPosition(x,A,c,f,a,D+d,1,1),x=E;D=w,w=o[M+1],E=b}}scratch2Array[0]=Cartesian3.clone(x,scratch2Array[0]),scratch2Array[1]=Cartesian3.clone(E,scratch2Array[1]),P=subdivideHeights(scratch2Array,D+d,w+d,s),f=addPositions(PolylinePipeline.generateArc({positions:scratch2Array,granularity:s,ellipsoid:a}),A,c,f,a,P,1),n&&(m=addPosition(E,A,u,m,a,w+d,1,1)),p=f.length;var F=n?p+m.length:p,N=new Float64Array(F);return N.set(f),n&&N.set(m,p),N};var CorridorGeometryLibrary={},scratch1$1=new Cartesian3,scratch2$1=new Cartesian3,scratch3=new Cartesian3,scratch4=new Cartesian3,scaleArray2=[new Cartesian3,new Cartesian3],cartesian1$2=new Cartesian3,cartesian2$2=new Cartesian3,cartesian3$2=new Cartesian3,cartesian4$1=new Cartesian3,cartesian5$1=new Cartesian3,cartesian6$1=new Cartesian3,cartesian7=new Cartesian3,cartesian8=new Cartesian3,cartesian9=new Cartesian3,cartesian10=new Cartesian3,quaterion=new Quaternion,rotMatrix=new Matrix3;function computeRoundCorner(e,t,i,r,n){var a,o=Cartesian3.angleBetween(Cartesian3.subtract(t,e,scratch1$1),Cartesian3.subtract(i,e,scratch2$1)),s=r===CornerType$1.BEVELED?1:Math.ceil(o/CesiumMath.toRadians(5))+1,l=3*s,c=new Array(l);c[l-3]=i.x,c[l-2]=i.y,c[l-1]=i.z,a=n?Matrix3.fromQuaternion(Quaternion.fromAxisAngle(Cartesian3.negate(e,scratch1$1),o/s,quaterion),rotMatrix):Matrix3.fromQuaternion(Quaternion.fromAxisAngle(e,o/s,quaterion),rotMatrix);var u=0;t=Cartesian3.clone(t,scratch1$1);for(var d=0;d<s;d++)t=Matrix3.multiplyByVector(a,t,t),c[u++]=t.x,c[u++]=t.y,c[u++]=t.z;return c}function addEndCaps(e){var t=cartesian1$2,i=cartesian2$2,r=cartesian3$2,n=e[1];i=Cartesian3.fromArray(e[1],n.length-3,i),r=Cartesian3.fromArray(e[0],0,r);var a=computeRoundCorner(t=Cartesian3.midpoint(i,r,t),i,r,CornerType$1.ROUNDED,!1),o=e.length-1,s=e[o-1];return n=e[o],i=Cartesian3.fromArray(s,s.length-3,i),r=Cartesian3.fromArray(n,0,r),[a,computeRoundCorner(t=Cartesian3.midpoint(i,r,t),i,r,CornerType$1.ROUNDED,!1)]}function computeMiteredCorner(e,t,i,r){var n=scratch1$1;return r||(t=Cartesian3.negate(t,t)),[(n=Cartesian3.add(e,t,n)).x,n.y,n.z,i.x,i.y,i.z]}function addShiftedPositions(e,t,i,r){for(var n=new Array(e.length),a=new Array(e.length),o=Cartesian3.multiplyByScalar(t,i,scratch1$1),s=Cartesian3.negate(o,scratch2$1),l=0,c=e.length-1,u=0;u<e.length;u+=3){var d=Cartesian3.fromArray(e,u,scratch3),h=Cartesian3.add(d,s,scratch4);n[l++]=h.x,n[l++]=h.y,n[l++]=h.z;var p=Cartesian3.add(d,o,scratch4);a[c--]=p.z,a[c--]=p.y,a[c--]=p.x}return r.push(n,a),r}CorridorGeometryLibrary.addAttribute=function(e,t,i,r){var n=t.x,a=t.y,o=t.z;defined(i)&&(e[i]=n,e[i+1]=a,e[i+2]=o),defined(r)&&(e[r]=o,e[r-1]=a,e[r-2]=n)};var scratchForwardProjection=new Cartesian3,scratchBackwardProjection=new Cartesian3;CorridorGeometryLibrary.computePositions=function(e){var t=e.granularity,i=e.positions,r=e.ellipsoid,n=e.width/2,a=e.cornerType,o=e.saveAttributes,s=cartesian1$2,l=cartesian2$2,c=cartesian3$2,u=cartesian4$1,d=cartesian5$1,h=cartesian6$1,p=cartesian7,f=cartesian8,m=cartesian9,g=cartesian10,_=[],y=o?[]:void 0,v=o?[]:void 0,C=i[0],T=i[1];l=Cartesian3.normalize(Cartesian3.subtract(T,C,l),l),s=r.geodeticSurfaceNormal(C,s),u=Cartesian3.normalize(Cartesian3.cross(s,l,u),u),o&&(y.push(u.x,u.y,u.z),v.push(s.x,s.y,s.z)),p=Cartesian3.clone(C,p),C=T,c=Cartesian3.negate(l,c);var S,A,x=[],E=i.length;for(S=1;S<E-1;S++){s=r.geodeticSurfaceNormal(C,s),T=i[S+1],l=Cartesian3.normalize(Cartesian3.subtract(T,C,l),l),d=Cartesian3.normalize(Cartesian3.add(l,c,d),d);var b=Cartesian3.multiplyByScalar(s,Cartesian3.dot(l,s),scratchForwardProjection);Cartesian3.subtract(l,b,b),Cartesian3.normalize(b,b);var P=Cartesian3.multiplyByScalar(s,Cartesian3.dot(c,s),scratchBackwardProjection);if(Cartesian3.subtract(c,P,P),Cartesian3.normalize(P,P),!CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(b,P)),1,CesiumMath.EPSILON7)){d=Cartesian3.cross(d,s,d),d=Cartesian3.cross(s,d,d),d=Cartesian3.normalize(d,d);var D=n/Math.max(.25,Cartesian3.magnitude(Cartesian3.cross(d,c,scratch1$1))),w=PolylineVolumeGeometryLibrary.angleIsGreaterThanPi(l,c,C,r);d=Cartesian3.multiplyByScalar(d,D,d),w?(f=Cartesian3.add(C,d,f),g=Cartesian3.add(f,Cartesian3.multiplyByScalar(u,n,g),g),m=Cartesian3.add(f,Cartesian3.multiplyByScalar(u,2*n,m),m),scaleArray2[0]=Cartesian3.clone(p,scaleArray2[0]),scaleArray2[1]=Cartesian3.clone(g,scaleArray2[1]),_=addShiftedPositions(PolylinePipeline.generateArc({positions:scaleArray2,granularity:t,ellipsoid:r}),u,n,_),o&&(y.push(u.x,u.y,u.z),v.push(s.x,s.y,s.z)),h=Cartesian3.clone(m,h),u=Cartesian3.normalize(Cartesian3.cross(s,l,u),u),m=Cartesian3.add(f,Cartesian3.multiplyByScalar(u,2*n,m),m),p=Cartesian3.add(f,Cartesian3.multiplyByScalar(u,n,p),p),a===CornerType$1.ROUNDED||a===CornerType$1.BEVELED?x.push({leftPositions:computeRoundCorner(f,h,m,a,w)}):x.push({leftPositions:computeMiteredCorner(C,Cartesian3.negate(d,d),m,w)})):(m=Cartesian3.add(C,d,m),g=Cartesian3.add(m,Cartesian3.negate(Cartesian3.multiplyByScalar(u,n,g),g),g),f=Cartesian3.add(m,Cartesian3.negate(Cartesian3.multiplyByScalar(u,2*n,f),f),f),scaleArray2[0]=Cartesian3.clone(p,scaleArray2[0]),scaleArray2[1]=Cartesian3.clone(g,scaleArray2[1]),_=addShiftedPositions(PolylinePipeline.generateArc({positions:scaleArray2,granularity:t,ellipsoid:r}),u,n,_),o&&(y.push(u.x,u.y,u.z),v.push(s.x,s.y,s.z)),h=Cartesian3.clone(f,h),u=Cartesian3.normalize(Cartesian3.cross(s,l,u),u),f=Cartesian3.add(m,Cartesian3.negate(Cartesian3.multiplyByScalar(u,2*n,f),f),f),p=Cartesian3.add(m,Cartesian3.negate(Cartesian3.multiplyByScalar(u,n,p),p),p),a===CornerType$1.ROUNDED||a===CornerType$1.BEVELED?x.push({rightPositions:computeRoundCorner(m,h,f,a,w)}):x.push({rightPositions:computeMiteredCorner(C,d,f,w)})),c=Cartesian3.negate(l,c)}C=T}return s=r.geodeticSurfaceNormal(C,s),scaleArray2[0]=Cartesian3.clone(p,scaleArray2[0]),scaleArray2[1]=Cartesian3.clone(C,scaleArray2[1]),_=addShiftedPositions(PolylinePipeline.generateArc({positions:scaleArray2,granularity:t,ellipsoid:r}),u,n,_),o&&(y.push(u.x,u.y,u.z),v.push(s.x,s.y,s.z)),a===CornerType$1.ROUNDED&&(A=addEndCaps(_)),{positions:_,corners:x,lefts:y,normals:v,endPositions:A}};var cartesian1$1=new Cartesian3,cartesian2$1=new Cartesian3,cartesian3$1=new Cartesian3,cartesian4=new Cartesian3,cartesian5=new Cartesian3,cartesian6=new Cartesian3,scratch1=new Cartesian3,scratch2=new Cartesian3;function scaleToSurface$1(e,t){for(var i=0;i<e.length;i++)e[i]=t.scaleToGeodeticSurface(e[i],e[i]);return e}function addNormals(e,t,i,r,n,a){var o=e.normals,s=e.tangents,l=e.bitangents,c=Cartesian3.normalize(Cartesian3.cross(i,t,scratch1),scratch1);a.normal&&CorridorGeometryLibrary.addAttribute(o,t,r,n),a.tangent&&CorridorGeometryLibrary.addAttribute(s,c,r,n),a.bitangent&&CorridorGeometryLibrary.addAttribute(l,i,r,n)}function combine$1(e,t,i){var r,n,a,o=e.positions,s=e.corners,l=e.endPositions,c=e.lefts,u=e.normals,d=new GeometryAttributes,h=0,p=0,f=0;for(n=0;n<o.length;n+=2)h+=a=o[n].length-3,f+=2*a,p+=o[n+1].length-3;for(h+=3,p+=3,n=0;n<s.length;n++){r=s[n];var m=s[n].leftPositions;defined(m)?(h+=a=m.length,f+=a):(p+=a=s[n].rightPositions.length,f+=a)}var g,_=defined(l);_&&(h+=g=l[0].length-3,p+=g,f+=6*(g/=3));var y,v,C,T,S,A,x=h+p,E=new Float64Array(x),b={normals:t.normal?new Float32Array(x):void 0,tangents:t.tangent?new Float32Array(x):void 0,bitangents:t.bitangent?new Float32Array(x):void 0},P=0,D=x-1,w=cartesian1$1,M=cartesian2$1,I=g/2,R=IndexDatatype$1.createTypedArray(x/3,f),O=0;if(_){A=cartesian3$1,S=cartesian4;var B=l[0];for(w=Cartesian3.fromArray(u,0,w),M=Cartesian3.fromArray(c,0,M),n=0;n<I;n++)A=Cartesian3.fromArray(B,3*(I-1-n),A),S=Cartesian3.fromArray(B,3*(I+n),S),CorridorGeometryLibrary.addAttribute(E,S,P),CorridorGeometryLibrary.addAttribute(E,A,void 0,D),addNormals(b,w,M,P,D,t),T=(v=P/3)+1,C=(y=(D-2)/3)-1,R[O++]=y,R[O++]=v,R[O++]=C,R[O++]=C,R[O++]=v,R[O++]=T,P+=3,D-=3}var L,F,N=0,V=0,k=o[N++],U=o[N++];for(E.set(k,P),E.set(U,D-U.length+1),M=Cartesian3.fromArray(c,V,M),a=U.length-3,n=0;n<a;n+=3)L=i.geodeticSurfaceNormal(Cartesian3.fromArray(k,n,scratch1),scratch1),F=i.geodeticSurfaceNormal(Cartesian3.fromArray(U,a-n,scratch2),scratch2),addNormals(b,w=Cartesian3.normalize(Cartesian3.add(L,F,w),w),M,P,D,t),T=(v=P/3)+1,C=(y=(D-2)/3)-1,R[O++]=y,R[O++]=v,R[O++]=C,R[O++]=C,R[O++]=v,R[O++]=T,P+=3,D-=3;for(L=i.geodeticSurfaceNormal(Cartesian3.fromArray(k,a,scratch1),scratch1),F=i.geodeticSurfaceNormal(Cartesian3.fromArray(U,a,scratch2),scratch2),w=Cartesian3.normalize(Cartesian3.add(L,F,w),w),V+=3,n=0;n<s.length;n++){var G,$,z,H=(r=s[n]).leftPositions,W=r.rightPositions,j=cartesian6,q=cartesian3$1,X=cartesian4;if(w=Cartesian3.fromArray(u,V,w),defined(H)){for(addNormals(b,w,M,void 0,D,t),D-=3,$=T,z=C,G=0;G<H.length/3;G++)j=Cartesian3.fromArray(H,3*G,j),R[O++]=$,R[O++]=z-G-1,R[O++]=z-G,CorridorGeometryLibrary.addAttribute(E,j,void 0,D),q=Cartesian3.fromArray(E,3*(z-G-1),q),X=Cartesian3.fromArray(E,3*$,X),addNormals(b,w,M=Cartesian3.normalize(Cartesian3.subtract(q,X,M),M),void 0,D,t),D-=3;j=Cartesian3.fromArray(E,3*$,j),q=Cartesian3.subtract(Cartesian3.fromArray(E,3*z,q),j,q),X=Cartesian3.subtract(Cartesian3.fromArray(E,3*(z-G),X),j,X),addNormals(b,w,M=Cartesian3.normalize(Cartesian3.add(q,X,M),M),P,void 0,t),P+=3}else{for(addNormals(b,w,M,P,void 0,t),P+=3,$=C,z=T,G=0;G<W.length/3;G++)j=Cartesian3.fromArray(W,3*G,j),R[O++]=$,R[O++]=z+G,R[O++]=z+G+1,CorridorGeometryLibrary.addAttribute(E,j,P),q=Cartesian3.fromArray(E,3*$,q),X=Cartesian3.fromArray(E,3*(z+G),X),addNormals(b,w,M=Cartesian3.normalize(Cartesian3.subtract(q,X,M),M),P,void 0,t),P+=3;j=Cartesian3.fromArray(E,3*$,j),q=Cartesian3.subtract(Cartesian3.fromArray(E,3*(z+G),q),j,q),X=Cartesian3.subtract(Cartesian3.fromArray(E,3*z,X),j,X),addNormals(b,w,M=Cartesian3.normalize(Cartesian3.negate(Cartesian3.add(X,q,M),M),M),void 0,D,t),D-=3}for(k=o[N++],U=o[N++],k.splice(0,3),U.splice(U.length-3,3),E.set(k,P),E.set(U,D-U.length+1),a=U.length-3,V+=3,M=Cartesian3.fromArray(c,V,M),G=0;G<U.length;G+=3)L=i.geodeticSurfaceNormal(Cartesian3.fromArray(k,G,scratch1),scratch1),F=i.geodeticSurfaceNormal(Cartesian3.fromArray(U,a-G,scratch2),scratch2),addNormals(b,w=Cartesian3.normalize(Cartesian3.add(L,F,w),w),M,P,D,t),v=(T=P/3)-1,y=(C=(D-2)/3)+1,R[O++]=y,R[O++]=v,R[O++]=C,R[O++]=C,R[O++]=v,R[O++]=T,P+=3,D-=3;P-=3,D+=3}if(addNormals(b,w=Cartesian3.fromArray(u,u.length-3,w),M,P,D,t),_){P+=3,D-=3,A=cartesian3$1,S=cartesian4;var Y=l[1];for(n=0;n<I;n++)A=Cartesian3.fromArray(Y,3*(g-n-1),A),S=Cartesian3.fromArray(Y,3*n,S),CorridorGeometryLibrary.addAttribute(E,A,void 0,D),CorridorGeometryLibrary.addAttribute(E,S,P),addNormals(b,w,M,P,D,t),v=(T=P/3)-1,y=(C=(D-2)/3)+1,R[O++]=y,R[O++]=v,R[O++]=C,R[O++]=C,R[O++]=v,R[O++]=T,P+=3,D-=3}if(d.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:E}),t.st){var K,J,Q=new Float32Array(x/3*2),Z=0;if(_){h/=3,p/=3;var ee,te=Math.PI/(g+1);J=1/(h-g+1),K=1/(p-g+1);var ie=g/2;for(n=ie+1;n<g+1;n++)ee=CesiumMath.PI_OVER_TWO+te*n,Q[Z++]=K*(1+Math.cos(ee)),Q[Z++]=.5*(1+Math.sin(ee));for(n=1;n<p-g+1;n++)Q[Z++]=n*K,Q[Z++]=0;for(n=g;n>ie;n--)ee=CesiumMath.PI_OVER_TWO-n*te,Q[Z++]=1-K*(1+Math.cos(ee)),Q[Z++]=.5*(1+Math.sin(ee));for(n=ie;n>0;n--)ee=CesiumMath.PI_OVER_TWO-te*n,Q[Z++]=1-J*(1+Math.cos(ee)),Q[Z++]=.5*(1+Math.sin(ee));for(n=h-g;n>0;n--)Q[Z++]=n*J,Q[Z++]=1;for(n=1;n<ie+1;n++)ee=CesiumMath.PI_OVER_TWO+te*n,Q[Z++]=J*(1+Math.cos(ee)),Q[Z++]=.5*(1+Math.sin(ee))}else{for(J=1/((h/=3)-1),K=1/((p/=3)-1),n=0;n<p;n++)Q[Z++]=n*K,Q[Z++]=0;for(n=h;n>0;n--)Q[Z++]=(n-1)*J,Q[Z++]=1}d.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:Q})}return t.normal&&(d.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:b.normals})),t.tangent&&(d.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:b.tangents})),t.bitangent&&(d.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:b.bitangents})),{attributes:d,indices:R}}function extrudedAttributes(e,t){if(!(t.normal||t.tangent||t.bitangent||t.st))return e;var i,r,n=e.position.values;(t.normal||t.bitangent)&&(i=e.normal.values,r=e.bitangent.values);var a,o=e.position.values.length/18,s=3*o,l=2*o,c=2*s;if(t.normal||t.bitangent||t.tangent){var u=t.normal?new Float32Array(6*s):void 0,d=t.tangent?new Float32Array(6*s):void 0,h=t.bitangent?new Float32Array(6*s):void 0,p=cartesian1$1,f=cartesian2$1,m=cartesian3$1,g=cartesian4,_=cartesian5,y=cartesian6,v=c;for(a=0;a<s;a+=3){var C=v+c;p=Cartesian3.fromArray(n,a,p),f=Cartesian3.fromArray(n,a+s,f),m=Cartesian3.fromArray(n,(a+3)%s,m),f=Cartesian3.subtract(f,p,f),m=Cartesian3.subtract(m,p,m),g=Cartesian3.normalize(Cartesian3.cross(f,m,g),g),t.normal&&(CorridorGeometryLibrary.addAttribute(u,g,C),CorridorGeometryLibrary.addAttribute(u,g,C+3),CorridorGeometryLibrary.addAttribute(u,g,v),CorridorGeometryLibrary.addAttribute(u,g,v+3)),(t.tangent||t.bitangent)&&(y=Cartesian3.fromArray(i,a,y),t.bitangent&&(CorridorGeometryLibrary.addAttribute(h,y,C),CorridorGeometryLibrary.addAttribute(h,y,C+3),CorridorGeometryLibrary.addAttribute(h,y,v),CorridorGeometryLibrary.addAttribute(h,y,v+3)),t.tangent&&(_=Cartesian3.normalize(Cartesian3.cross(y,g,_),_),CorridorGeometryLibrary.addAttribute(d,_,C),CorridorGeometryLibrary.addAttribute(d,_,C+3),CorridorGeometryLibrary.addAttribute(d,_,v),CorridorGeometryLibrary.addAttribute(d,_,v+3))),v+=6}if(t.normal){for(u.set(i),a=0;a<s;a+=3)u[a+s]=-i[a],u[a+s+1]=-i[a+1],u[a+s+2]=-i[a+2];e.normal.values=u}else e.normal=void 0;if(t.bitangent?(h.set(r),h.set(r,s),e.bitangent.values=h):e.bitangent=void 0,t.tangent){var T=e.tangent.values;d.set(T),d.set(T,s),e.tangent.values=d}}if(t.st){var S=e.st.values,A=new Float32Array(6*l);A.set(S),A.set(S,l);for(var x=2*l,E=0;E<2;E++){for(A[x++]=S[0],A[x++]=S[1],a=2;a<l;a+=2){var b=S[a],P=S[a+1];A[x++]=b,A[x++]=P,A[x++]=b,A[x++]=P}A[x++]=S[0],A[x++]=S[1]}e.st.values=A}return e}function addWallPositions$1(e,t,i){i[t++]=e[0],i[t++]=e[1],i[t++]=e[2];for(var r=3;r<e.length;r+=3){var n=e[r],a=e[r+1],o=e[r+2];i[t++]=n,i[t++]=a,i[t++]=o,i[t++]=n,i[t++]=a,i[t++]=o}return i[t++]=e[0],i[t++]=e[1],i[t++]=e[2],i}function computePositionsExtruded$1(e,t){var i=new VertexFormat({position:t.position,normal:t.normal||t.bitangent||e.shadowVolume,tangent:t.tangent,bitangent:t.normal||t.bitangent,st:t.st}),r=e.ellipsoid,n=combine$1(CorridorGeometryLibrary.computePositions(e),i,r),a=e.height,o=e.extrudedHeight,s=n.attributes,l=n.indices,c=s.position.values,u=c.length,d=new Float64Array(6*u),h=new Float64Array(u);h.set(c);var p,f=new Float64Array(4*u);f=addWallPositions$1(c=PolygonPipeline.scaleToGeodeticHeight(c,a,r),0,f),f=addWallPositions$1(h=PolygonPipeline.scaleToGeodeticHeight(h,o,r),2*u,f),d.set(c),d.set(h,u),d.set(f,2*u),s.position.values=d,s=extrudedAttributes(s,t);var m=u/3;if(e.shadowVolume){var g=s.normal.values;u=g.length;var _=new Float32Array(6*u);for(p=0;p<u;p++)g[p]=-g[p];_.set(g,u),_=addWallPositions$1(g,4*u,_),s.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:_}),t.normal||(s.normal=void 0)}if(defined(e.offsetAttribute)){var y=new Uint8Array(6*m);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)y=arrayFill(y,1,0,m),y=arrayFill(y,1,2*m,4*m);else y=arrayFill(y,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1);s.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}var v=l.length,C=m+m,T=IndexDatatype$1.createTypedArray(d.length/3,2*v+3*C);T.set(l);var S,A,x,E,b=v;for(p=0;p<v;p+=3){var P=l[p],D=l[p+1],w=l[p+2];T[b++]=w+m,T[b++]=D+m,T[b++]=P+m}for(p=0;p<C;p+=2)x=(S=p+C)+1,E=(A=S+C)+1,T[b++]=S,T[b++]=A,T[b++]=x,T[b++]=x,T[b++]=A,T[b++]=E;return{attributes:s,indices:T}}var scratchCartesian1$2=new Cartesian3,scratchCartesian2$5=new Cartesian3,scratchCartographic$f=new Cartographic;function computeOffsetPoints(e,t,i,r,n,a){var o=Cartesian3.subtract(t,e,scratchCartesian1$2);Cartesian3.normalize(o,o);var s=i.geodeticSurfaceNormal(e,scratchCartesian2$5),l=Cartesian3.cross(o,s,scratchCartesian1$2);Cartesian3.multiplyByScalar(l,r,l);var c=n.latitude,u=n.longitude,d=a.latitude,h=a.longitude;Cartesian3.add(e,l,scratchCartesian2$5),i.cartesianToCartographic(scratchCartesian2$5,scratchCartographic$f);var p=scratchCartographic$f.latitude,f=scratchCartographic$f.longitude;c=Math.min(c,p),u=Math.min(u,f),d=Math.max(d,p),h=Math.max(h,f),Cartesian3.subtract(e,l,scratchCartesian2$5),i.cartesianToCartographic(scratchCartesian2$5,scratchCartographic$f),p=scratchCartographic$f.latitude,f=scratchCartographic$f.longitude,c=Math.min(c,p),u=Math.min(u,f),d=Math.max(d,p),h=Math.max(h,f),n.latitude=c,n.longitude=u,a.latitude=d,a.longitude=h}var scratchCartesianOffset=new Cartesian3,scratchCartesianEnds=new Cartesian3,scratchCartographicMin=new Cartographic,scratchCartographicMax=new Cartographic;function computeRectangle$2(e,t,i,r,n){var a=arrayRemoveDuplicates(e=scaleToSurface$1(e,t),Cartesian3.equalsEpsilon),o=a.length;if(o<2||i<=0)return new Rectangle;var s,l,c=.5*i;if(scratchCartographicMin.latitude=Number.POSITIVE_INFINITY,scratchCartographicMin.longitude=Number.POSITIVE_INFINITY,scratchCartographicMax.latitude=Number.NEGATIVE_INFINITY,scratchCartographicMax.longitude=Number.NEGATIVE_INFINITY,r===CornerType$1.ROUNDED){var u=a[0];Cartesian3.subtract(u,a[1],scratchCartesianOffset),Cartesian3.normalize(scratchCartesianOffset,scratchCartesianOffset),Cartesian3.multiplyByScalar(scratchCartesianOffset,c,scratchCartesianOffset),Cartesian3.add(u,scratchCartesianOffset,scratchCartesianEnds),t.cartesianToCartographic(scratchCartesianEnds,scratchCartographic$f),s=scratchCartographic$f.latitude,l=scratchCartographic$f.longitude,scratchCartographicMin.latitude=Math.min(scratchCartographicMin.latitude,s),scratchCartographicMin.longitude=Math.min(scratchCartographicMin.longitude,l),scratchCartographicMax.latitude=Math.max(scratchCartographicMax.latitude,s),scratchCartographicMax.longitude=Math.max(scratchCartographicMax.longitude,l)}for(var d=0;d<o-1;++d)computeOffsetPoints(a[d],a[d+1],t,c,scratchCartographicMin,scratchCartographicMax);var h=a[o-1];Cartesian3.subtract(h,a[o-2],scratchCartesianOffset),Cartesian3.normalize(scratchCartesianOffset,scratchCartesianOffset),Cartesian3.multiplyByScalar(scratchCartesianOffset,c,scratchCartesianOffset),Cartesian3.add(h,scratchCartesianOffset,scratchCartesianEnds),computeOffsetPoints(h,scratchCartesianEnds,t,c,scratchCartographicMin,scratchCartographicMax),r===CornerType$1.ROUNDED&&(t.cartesianToCartographic(scratchCartesianEnds,scratchCartographic$f),s=scratchCartographic$f.latitude,l=scratchCartographic$f.longitude,scratchCartographicMin.latitude=Math.min(scratchCartographicMin.latitude,s),scratchCartographicMin.longitude=Math.min(scratchCartographicMin.longitude,l),scratchCartographicMax.latitude=Math.max(scratchCartographicMax.latitude,s),scratchCartographicMax.longitude=Math.max(scratchCartographicMax.longitude,l));var p=defined(n)?n:new Rectangle;return p.north=scratchCartographicMax.latitude,p.south=scratchCartographicMin.latitude,p.east=scratchCartographicMax.longitude,p.west=scratchCartographicMin.longitude,p}function CorridorGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.width,r=defaultValue(e.height,0),n=defaultValue(e.extrudedHeight,r);this._positions=t,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._width=i,this._height=Math.max(r,n),this._extrudedHeight=Math.min(r,n),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createCorridorGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this.packedLength=1+t.length*Cartesian3.packedLength+Ellipsoid.packedLength+VertexFormat.packedLength+7}CorridorGeometry.pack=function(e,t,i){i=defaultValue(i,0);var r=e._positions,n=r.length;t[i++]=n;for(var a=0;a<n;++a,i+=Cartesian3.packedLength)Cartesian3.pack(r[a],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._width,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._cornerType,t[i++]=e._granularity,t[i++]=e._shadowVolume?1:0,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchEllipsoid$b=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$9=new VertexFormat,scratchOptions$f={positions:void 0,ellipsoid:scratchEllipsoid$b,vertexFormat:scratchVertexFormat$9,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};CorridorGeometry.unpack=function(e,t,i){t=defaultValue(t,0);for(var r=e[t++],n=new Array(r),a=0;a<r;++a,t+=Cartesian3.packedLength)n[a]=Cartesian3.unpack(e,t);var o=Ellipsoid.unpack(e,t,scratchEllipsoid$b);t+=Ellipsoid.packedLength;var s=VertexFormat.unpack(e,t,scratchVertexFormat$9);t+=VertexFormat.packedLength;var l=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t++],p=1===e[t++],f=e[t];return defined(i)?(i._positions=n,i._ellipsoid=Ellipsoid.clone(o,i._ellipsoid),i._vertexFormat=VertexFormat.clone(s,i._vertexFormat),i._width=l,i._height=c,i._extrudedHeight=u,i._cornerType=d,i._granularity=h,i._shadowVolume=p,i._offsetAttribute=-1===f?void 0:f,i):(scratchOptions$f.positions=n,scratchOptions$f.width=l,scratchOptions$f.height=c,scratchOptions$f.extrudedHeight=u,scratchOptions$f.cornerType=d,scratchOptions$f.granularity=h,scratchOptions$f.shadowVolume=p,scratchOptions$f.offsetAttribute=-1===f?void 0:f,new CorridorGeometry(scratchOptions$f))},CorridorGeometry.computeRectangle=function(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,r=e.width;return computeRectangle$2(i,defaultValue(e.ellipsoid,Ellipsoid.WGS84),r,defaultValue(e.cornerType,CornerType$1.ROUNDED),t)},CorridorGeometry.createGeometry=function(e){var t=e._positions,i=e._width,r=e._ellipsoid,n=arrayRemoveDuplicates(t=scaleToSurface$1(t,r),Cartesian3.equalsEpsilon);if(!(n.length<2||i<=0)){var a,o=e._height,s=e._extrudedHeight,l=!CesiumMath.equalsEpsilon(o,s,0,CesiumMath.EPSILON2),c=e._vertexFormat,u={ellipsoid:r,positions:n,width:i,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!0};if(l)u.height=o,u.extrudedHeight=s,u.shadowVolume=e._shadowVolume,u.offsetAttribute=e._offsetAttribute,a=computePositionsExtruded$1(u,c);else if((a=combine$1(CorridorGeometryLibrary.computePositions(u),c,r)).attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(a.attributes.position.values,o,r),defined(e._offsetAttribute)){var d=e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1,h=a.attributes.position.values.length,p=new Uint8Array(h/3);arrayFill(p,d),a.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}var f=a.attributes,m=BoundingSphere.fromVertices(f.position.values,void 0,3);return c.position||(a.attributes.position.values=void 0),new Geometry({attributes:f,indices:a.indices,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:m,offsetAttribute:e._offsetAttribute})}},CorridorGeometry.createShadowVolume=function(e,t,i){var r=e._granularity,n=e._ellipsoid,a=t(r,n),o=i(r,n);return new CorridorGeometry({positions:e._positions,width:e._width,cornerType:e._cornerType,ellipsoid:n,granularity:r,extrudedHeight:a,height:o,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(CorridorGeometry.prototype,{rectangle:{get:function(){return defined(this._rectangle)||(this._rectangle=computeRectangle$2(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}});var cartesian1=new Cartesian3,cartesian2=new Cartesian3,cartesian3=new Cartesian3;function scaleToSurface(e,t){for(var i=0;i<e.length;i++)e[i]=t.scaleToGeodeticSurface(e[i],e[i]);return e}function combine(e,t){var i,r,n,a=[],o=e.positions,s=e.corners,l=e.endPositions,c=new GeometryAttributes,u=0,d=0,h=0;for(r=0;r<o.length;r+=2)u+=n=o[r].length-3,h+=n/3*4,d+=o[r+1].length-3;for(u+=3,d+=3,r=0;r<s.length;r++){i=s[r];var p=s[r].leftPositions;defined(p)?(u+=n=p.length,h+=n/3*2):(d+=n=s[r].rightPositions.length,h+=n/3*2)}var f,m=defined(l);m&&(u+=f=l[0].length-3,d+=f,h+=4*(f/=3));var g,_,y,v,C,T,S=u+d,A=new Float64Array(S),x=0,E=S-1,b=f/2,P=IndexDatatype$1.createTypedArray(S/3,h+4),D=0;if(P[D++]=x/3,P[D++]=(E-2)/3,m){a.push(x/3),T=cartesian1,C=cartesian2;var w=l[0];for(r=0;r<b;r++)T=Cartesian3.fromArray(w,3*(b-1-r),T),C=Cartesian3.fromArray(w,3*(b+r),C),CorridorGeometryLibrary.addAttribute(A,C,x),CorridorGeometryLibrary.addAttribute(A,T,void 0,E),v=(_=x/3)+1,y=(g=(E-2)/3)-1,P[D++]=g,P[D++]=y,P[D++]=_,P[D++]=v,x+=3,E-=3}var M=0,I=o[M++],R=o[M++];for(A.set(I,x),A.set(R,E-R.length+1),n=R.length-3,a.push(x/3,(E-2)/3),r=0;r<n;r+=3)v=(_=x/3)+1,y=(g=(E-2)/3)-1,P[D++]=g,P[D++]=y,P[D++]=_,P[D++]=v,x+=3,E-=3;for(r=0;r<s.length;r++){var O,B,L=(i=s[r]).leftPositions,F=i.rightPositions,N=cartesian3;if(defined(L)){for(E-=3,B=y,a.push(v),O=0;O<L.length/3;O++)N=Cartesian3.fromArray(L,3*O,N),P[D++]=B-O-1,P[D++]=B-O,CorridorGeometryLibrary.addAttribute(A,N,void 0,E),E-=3;a.push(B-Math.floor(L.length/6)),t===CornerType$1.BEVELED&&a.push((E-2)/3+1),x+=3}else{for(x+=3,B=v,a.push(y),O=0;O<F.length/3;O++)N=Cartesian3.fromArray(F,3*O,N),P[D++]=B+O,P[D++]=B+O+1,CorridorGeometryLibrary.addAttribute(A,N,x),x+=3;a.push(B+Math.floor(F.length/6)),t===CornerType$1.BEVELED&&a.push(x/3-1),E-=3}for(I=o[M++],R=o[M++],I.splice(0,3),R.splice(R.length-3,3),A.set(I,x),A.set(R,E-R.length+1),n=R.length-3,O=0;O<R.length;O+=3)_=(v=x/3)-1,g=(y=(E-2)/3)+1,P[D++]=g,P[D++]=y,P[D++]=_,P[D++]=v,x+=3,E-=3;x-=3,E+=3,a.push(x/3,(E-2)/3)}if(m){x+=3,E-=3,T=cartesian1,C=cartesian2;var V=l[1];for(r=0;r<b;r++)T=Cartesian3.fromArray(V,3*(f-r-1),T),C=Cartesian3.fromArray(V,3*r,C),CorridorGeometryLibrary.addAttribute(A,T,void 0,E),CorridorGeometryLibrary.addAttribute(A,C,x),_=(v=x/3)-1,g=(y=(E-2)/3)+1,P[D++]=g,P[D++]=y,P[D++]=_,P[D++]=v,x+=3,E-=3;a.push(x/3)}else a.push(x/3,(E-2)/3);return P[D++]=x/3,P[D++]=(E-2)/3,c.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:A}),{attributes:c,indices:P,wallIndices:a}}function computePositionsExtruded(e){var t=e.ellipsoid,i=combine(CorridorGeometryLibrary.computePositions(e),e.cornerType),r=i.wallIndices,n=e.height,a=e.extrudedHeight,o=i.attributes,s=i.indices,l=o.position.values,c=l.length,u=new Float64Array(c);u.set(l);var d,h=new Float64Array(2*c);if(l=PolygonPipeline.scaleToGeodeticHeight(l,n,t),u=PolygonPipeline.scaleToGeodeticHeight(u,a,t),h.set(l),h.set(u,c),o.position.values=h,c/=3,defined(e.offsetAttribute)){var p=new Uint8Array(2*c);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)p=arrayFill(p,1,0,c);else p=arrayFill(p,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1);o.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}var f=s.length,m=IndexDatatype$1.createTypedArray(h.length/3,2*(f+r.length));m.set(s);var g,_,y=f;for(d=0;d<f;d+=2){var v=s[d],C=s[d+1];m[y++]=v+c,m[y++]=C+c}for(d=0;d<r.length;d++)_=(g=r[d])+c,m[y++]=g,m[y++]=_;return{attributes:o,indices:m}}function CorridorOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.width,r=defaultValue(e.height,0),n=defaultValue(e.extrudedHeight,r);this._positions=t,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._width=i,this._height=Math.max(r,n),this._extrudedHeight=Math.min(r,n),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*Cartesian3.packedLength+Ellipsoid.packedLength+6}CorridorOutlineGeometry.pack=function(e,t,i){i=defaultValue(i,0);var r=e._positions,n=r.length;t[i++]=n;for(var a=0;a<n;++a,i+=Cartesian3.packedLength)Cartesian3.pack(r[a],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._width,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._cornerType,t[i++]=e._granularity,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchEllipsoid$a=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$e={positions:void 0,ellipsoid:scratchEllipsoid$a,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0},defaultTokenCredit;CorridorOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);for(var r=e[t++],n=new Array(r),a=0;a<r;++a,t+=Cartesian3.packedLength)n[a]=Cartesian3.unpack(e,t);var o=Ellipsoid.unpack(e,t,scratchEllipsoid$a);t+=Ellipsoid.packedLength;var s=e[t++],l=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t];return defined(i)?(i._positions=n,i._ellipsoid=Ellipsoid.clone(o,i._ellipsoid),i._width=s,i._height=l,i._extrudedHeight=c,i._cornerType=u,i._granularity=d,i._offsetAttribute=-1===h?void 0:h,i):(scratchOptions$e.positions=n,scratchOptions$e.width=s,scratchOptions$e.height=l,scratchOptions$e.extrudedHeight=c,scratchOptions$e.cornerType=u,scratchOptions$e.granularity=d,scratchOptions$e.offsetAttribute=-1===h?void 0:h,new CorridorOutlineGeometry(scratchOptions$e))},CorridorOutlineGeometry.createGeometry=function(e){var t=e._positions,i=e._width,r=e._ellipsoid,n=arrayRemoveDuplicates(t=scaleToSurface(t,r),Cartesian3.equalsEpsilon);if(!(n.length<2||i<=0)){var a,o=e._height,s=e._extrudedHeight,l=!CesiumMath.equalsEpsilon(o,s,0,CesiumMath.EPSILON2),c={ellipsoid:r,positions:n,width:i,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!1};if(l)c.height=o,c.extrudedHeight=s,c.offsetAttribute=e._offsetAttribute,a=computePositionsExtruded(c);else if((a=combine(CorridorGeometryLibrary.computePositions(c),c.cornerType)).attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(a.attributes.position.values,o,r),defined(e._offsetAttribute)){var u=a.attributes.position.values.length,d=new Uint8Array(u/3);arrayFill(d,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),a.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:d})}var h=a.attributes,p=BoundingSphere.fromVertices(h.position.values,void 0,3);return new Geometry({attributes:h,indices:a.indices,primitiveType:PrimitiveType$1.LINES,boundingSphere:p,offsetAttribute:e._offsetAttribute})}};var defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkN2E1Y2Q3My1mYTRmLTQ1YzAtOTlmMS04Mzk0NDc2MDM1NmQiLCJpZCI6MjU5LCJpYXQiOjE2MzgzODA0NjV9.EVUrPFOMOB6mmPc6-P33Bmcu85DYCdrhJC6J7FcZRT8",Ion={};function IonResource(e,t){var i,r=e.externalType,n=defined(r);if(n){if("3DTILES"!==r&&"STK_TERRAIN_SERVER"!==r)throw new RuntimeError("Ion.createResource does not support external imagery assets; use IonImageryProvider instead.");i={url:e.options.url}}else i={url:e.url,retryAttempts:1,retryCallback:retryCallback};Resource.call(this,i),this._ionEndpoint=e,this._ionEndpointDomain=n?void 0:new URI(e.url).authority(),this._ionEndpointResource=t,this._ionRoot=void 0,this._pendingPromise=void 0,this._credits=void 0,this._isExternal=n}function retryCallback(e,t){var i=defaultValue(e._ionRoot,e),r=i._ionEndpointResource,n="undefined"!=typeof Image;return defined(t)&&(401===t.statusCode||n&&t.target instanceof Image)?(defined(i._pendingPromise)||(i._pendingPromise=r.fetchJson().then((function(e){return i._ionEndpoint=e,e})).always((function(e){return i._pendingPromise=void 0,e}))),i._pendingPromise.then((function(t){return e._ionEndpoint=t,!0}))):when.resolve(!1)}function createWorldTerrain(e){return e=defaultValue(e,defaultValue.EMPTY_OBJECT),new CesiumTerrainProvider({url:IonResource.fromAssetId(1),requestVertexNormals:defaultValue(e.requestVertexNormals,!1),requestWaterMask:defaultValue(e.requestWaterMask,!1)})}function CullingVolume(e){this.planes=defaultValue(e,[])}Ion.defaultAccessToken=defaultAccessToken,Ion.defaultServer=new Resource({url:"https://api.cesium.com/"}),Ion.getDefaultTokenCredit=function(e){if(e===defaultAccessToken){if(!defined(defaultTokenCredit)){defaultTokenCredit=new Credit('<b> This application is using Cesium\'s default ion access token. Please assign <i>Cesium.Ion.defaultAccessToken</i> with an access token from your ion account before making any Cesium API calls. You can sign up for a free ion account at <a href="https://cesium.com">https://cesium.com</a>.</b>',!0)}return defaultTokenCredit}},defined(Object.create)&&(IonResource.prototype=Object.create(Resource.prototype),IonResource.prototype.constructor=IonResource),IonResource.fromAssetId=function(e,t){var i=IonResource._createEndpointResource(e,t);return i.fetchJson().then((function(e){return new IonResource(e,i)}))},Object.defineProperties(IonResource.prototype,{credits:{get:function(){return defined(this._ionRoot)?this._ionRoot.credits:(defined(this._credits)||(this._credits=IonResource.getCreditsFromEndpoint(this._ionEndpoint,this._ionEndpointResource)),this._credits)}}}),IonResource.getCreditsFromEndpoint=function(e,t){var i=e.attributions.map(Credit.getIonCredit),r=Ion.getDefaultTokenCredit(t.queryParameters.access_token);return defined(r)&&i.push(Credit.clone(r)),i},IonResource.prototype.clone=function(e){var t=defaultValue(this._ionRoot,this);return defined(e)||(e=new IonResource(t._ionEndpoint,t._ionEndpointResource)),(e=Resource.prototype.clone.call(this,e))._ionRoot=t,e._isExternal=this._isExternal,e},IonResource.prototype.fetchImage=function(e){if(!this._isExternal){var t=e;e={preferBlob:!0},defined(t)&&(e.flipY=t.flipY,e.preferImageBitmap=t.preferImageBitmap)}return Resource.prototype.fetchImage.call(this,e)},IonResource.prototype._makeRequest=function(e){return this._isExternal||new URI(this.url).authority()!==this._ionEndpointDomain||(defined(e.headers)||(e.headers={}),e.headers.Authorization="Bearer "+this._ionEndpoint.accessToken),Resource.prototype._makeRequest.call(this,e)},IonResource._createEndpointResource=function(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT);var i=defaultValue(t.server,Ion.defaultServer),r=defaultValue(t.accessToken,Ion.defaultAccessToken);i=Resource.createIfNeeded(i);var n={url:"v1/assets/"+e+"/endpoint"};return defined(r)&&(n.queryParameters={access_token:r}),i.getDerivedResource(n)};var faces=[new Cartesian3,new Cartesian3,new Cartesian3];Cartesian3.clone(Cartesian3.UNIT_X,faces[0]),Cartesian3.clone(Cartesian3.UNIT_Y,faces[1]),Cartesian3.clone(Cartesian3.UNIT_Z,faces[2]);var scratchPlaneCenter=new Cartesian3,scratchPlaneNormal=new Cartesian3,scratchPlane$1=new Plane(new Cartesian3(1,0,0),0);function CustomHeightmapTerrainProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._callback=e.callback,this._tilingScheme=e.tilingScheme,defined(this._tilingScheme)||(this._tilingScheme=new GeographicTilingScheme({ellipsoid:defaultValue(e.ellipsoid,Ellipsoid.WGS84)})),this._width=e.width,this._height=e.height;var t=Math.max(this._width,this._height);this._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,t,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new Event;var i=e.credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i,this._readyPromise=when.resolve(!0)}CullingVolume.fromBoundingSphere=function(e,t){defined(t)||(t=new CullingVolume);var i=faces.length,r=t.planes;r.length=2*i;for(var n=e.center,a=e.radius,o=0,s=0;s<i;++s){var l=faces[s],c=r[o],u=r[o+1];defined(c)||(c=r[o]=new Cartesian4),defined(u)||(u=r[o+1]=new Cartesian4),Cartesian3.multiplyByScalar(l,-a,scratchPlaneCenter),Cartesian3.add(n,scratchPlaneCenter,scratchPlaneCenter),c.x=l.x,c.y=l.y,c.z=l.z,c.w=-Cartesian3.dot(l,scratchPlaneCenter),Cartesian3.multiplyByScalar(l,a,scratchPlaneCenter),Cartesian3.add(n,scratchPlaneCenter,scratchPlaneCenter),u.x=-l.x,u.y=-l.y,u.z=-l.z,u.w=-Cartesian3.dot(Cartesian3.negate(l,scratchPlaneNormal),scratchPlaneCenter),o+=2}return t},CullingVolume.prototype.computeVisibility=function(e){for(var t=this.planes,i=!1,r=0,n=t.length;r<n;++r){var a=e.intersectPlane(Plane.fromCartesian4(t[r],scratchPlane$1));if(a===Intersect$1.OUTSIDE)return Intersect$1.OUTSIDE;a===Intersect$1.INTERSECTING&&(i=!0)}return i?Intersect$1.INTERSECTING:Intersect$1.INSIDE},CullingVolume.prototype.computeVisibilityWithPlaneMask=function(e,t){if(t===CullingVolume.MASK_OUTSIDE||t===CullingVolume.MASK_INSIDE)return t;for(var i=CullingVolume.MASK_INSIDE,r=this.planes,n=0,a=r.length;n<a;++n){var o=n<31?1<<n:0;if(!(n<31&&0==(t&o))){var s=e.intersectPlane(Plane.fromCartesian4(r[n],scratchPlane$1));if(s===Intersect$1.OUTSIDE)return CullingVolume.MASK_OUTSIDE;s===Intersect$1.INTERSECTING&&(i|=o)}}return i},CullingVolume.MASK_OUTSIDE=4294967295,CullingVolume.MASK_INSIDE=0,CullingVolume.MASK_INDETERMINATE=2147483647,Object.defineProperties(CustomHeightmapTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}}),CustomHeightmapTerrainProvider.prototype.requestTileGeometry=function(e,t,i,r){var n=this._callback(e,t,i);if(defined(n)){var a=this._width,o=this._height;return when(n).then((function(e){var t=e;return Array.isArray(t)&&(t=new Float64Array(t)),new HeightmapTerrainData({buffer:t,width:a,height:o})}))}},CustomHeightmapTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},CustomHeightmapTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){},CustomHeightmapTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){};var CylinderGeometryLibrary={computePositions:function(e,t,i,r,n){var a,o=.5*e,s=-o,l=r+r,c=new Float64Array(3*(n?2*l:l)),u=0,d=0,h=n?3*l:0,p=n?3*(l+r):3*r;for(a=0;a<r;a++){var f=a/r*CesiumMath.TWO_PI,m=Math.cos(f),g=Math.sin(f),_=m*i,y=g*i,v=m*t,C=g*t;c[d+h]=_,c[d+h+1]=y,c[d+h+2]=s,c[d+p]=v,c[d+p+1]=C,c[d+p+2]=o,d+=3,n&&(c[u++]=_,c[u++]=y,c[u++]=s,c[u++]=v,c[u++]=C,c[u++]=o)}return c}},radiusScratch$1=new Cartesian2,normalScratch$3=new Cartesian3,bitangentScratch$1=new Cartesian3,tangentScratch$1=new Cartesian3,positionScratch$a=new Cartesian3;function CylinderGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).length,i=e.topRadius,r=e.bottomRadius,n=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),a=defaultValue(e.slices,128);this._length=t,this._topRadius=i,this._bottomRadius=r,this._vertexFormat=VertexFormat.clone(n),this._slices=a,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderGeometry"}CylinderGeometry.packedLength=VertexFormat.packedLength+5,CylinderGeometry.pack=function(e,t,i){return i=defaultValue(i,0),VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._length,t[i++]=e._topRadius,t[i++]=e._bottomRadius,t[i++]=e._slices,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchVertexFormat$8=new VertexFormat,scratchOptions$d={vertexFormat:scratchVertexFormat$8,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0},unitCylinderGeometry;CylinderGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=VertexFormat.unpack(e,t,scratchVertexFormat$8);t+=VertexFormat.packedLength;var n=e[t++],a=e[t++],o=e[t++],s=e[t++],l=e[t];return defined(i)?(i._vertexFormat=VertexFormat.clone(r,i._vertexFormat),i._length=n,i._topRadius=a,i._bottomRadius=o,i._slices=s,i._offsetAttribute=-1===l?void 0:l,i):(scratchOptions$d.length=n,scratchOptions$d.topRadius=a,scratchOptions$d.bottomRadius=o,scratchOptions$d.slices=s,scratchOptions$d.offsetAttribute=-1===l?void 0:l,new CylinderGeometry(scratchOptions$d))},CylinderGeometry.createGeometry=function(e){var t=e._length,i=e._topRadius,r=e._bottomRadius,n=e._vertexFormat,a=e._slices;if(!(t<=0||i<0||r<0||0===i&&0===r)){var o,s=a+a,l=a+s,c=s+s,u=CylinderGeometryLibrary.computePositions(t,i,r,a,!0),d=n.st?new Float32Array(2*c):void 0,h=n.normal?new Float32Array(3*c):void 0,p=n.tangent?new Float32Array(3*c):void 0,f=n.bitangent?new Float32Array(3*c):void 0,m=n.normal||n.tangent||n.bitangent;if(m){var g=n.tangent||n.bitangent,_=0,y=0,v=0,C=Math.atan2(r-i,t),T=normalScratch$3;T.z=Math.sin(C);var S=Math.cos(C),A=tangentScratch$1,x=bitangentScratch$1;for(o=0;o<a;o++){var E=o/a*CesiumMath.TWO_PI,b=S*Math.cos(E),P=S*Math.sin(E);m&&(T.x=b,T.y=P,g&&(A=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,T,A),A)),n.normal&&(h[_++]=T.x,h[_++]=T.y,h[_++]=T.z,h[_++]=T.x,h[_++]=T.y,h[_++]=T.z),n.tangent&&(p[y++]=A.x,p[y++]=A.y,p[y++]=A.z,p[y++]=A.x,p[y++]=A.y,p[y++]=A.z),n.bitangent&&(x=Cartesian3.normalize(Cartesian3.cross(T,A,x),x),f[v++]=x.x,f[v++]=x.y,f[v++]=x.z,f[v++]=x.x,f[v++]=x.y,f[v++]=x.z))}for(o=0;o<a;o++)n.normal&&(h[_++]=0,h[_++]=0,h[_++]=-1),n.tangent&&(p[y++]=1,p[y++]=0,p[y++]=0),n.bitangent&&(f[v++]=0,f[v++]=-1,f[v++]=0);for(o=0;o<a;o++)n.normal&&(h[_++]=0,h[_++]=0,h[_++]=1),n.tangent&&(p[y++]=1,p[y++]=0,p[y++]=0),n.bitangent&&(f[v++]=0,f[v++]=1,f[v++]=0)}var D=12*a-12,w=IndexDatatype$1.createTypedArray(c,D),M=0,I=0;for(o=0;o<a-1;o++)w[M++]=I,w[M++]=I+2,w[M++]=I+3,w[M++]=I,w[M++]=I+3,w[M++]=I+1,I+=2;for(w[M++]=s-2,w[M++]=0,w[M++]=1,w[M++]=s-2,w[M++]=1,w[M++]=s-1,o=1;o<a-1;o++)w[M++]=s+o+1,w[M++]=s+o,w[M++]=s;for(o=1;o<a-1;o++)w[M++]=l,w[M++]=l+o,w[M++]=l+o+1;var R=0;if(n.st){var O=Math.max(i,r);for(o=0;o<c;o++){var B=Cartesian3.fromArray(u,3*o,positionScratch$a);d[R++]=(B.x+O)/(2*O),d[R++]=(B.y+O)/(2*O)}}var L=new GeometryAttributes;n.position&&(L.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:u})),n.normal&&(L.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:h})),n.tangent&&(L.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p})),n.bitangent&&(L.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:f})),n.st&&(L.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:d})),radiusScratch$1.x=.5*t,radiusScratch$1.y=Math.max(r,i);var F=new BoundingSphere(Cartesian3.ZERO,Cartesian2.magnitude(radiusScratch$1));if(defined(e._offsetAttribute)){t=u.length;var N=new Uint8Array(t/3);arrayFill(N,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),L.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:N})}return new Geometry({attributes:L,indices:w,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:F,offsetAttribute:e._offsetAttribute})}},CylinderGeometry.getUnitCylinder=function(){return defined(unitCylinderGeometry)||(unitCylinderGeometry=CylinderGeometry.createGeometry(new CylinderGeometry({topRadius:1,bottomRadius:1,length:1,vertexFormat:VertexFormat.POSITION_ONLY}))),unitCylinderGeometry};var radiusScratch=new Cartesian2;function CylinderOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).length,i=e.topRadius,r=e.bottomRadius,n=defaultValue(e.slices,128),a=Math.max(defaultValue(e.numberOfVerticalLines,16),0);this._length=t,this._topRadius=i,this._bottomRadius=r,this._slices=n,this._numberOfVerticalLines=a,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}CylinderOutlineGeometry.packedLength=6,CylinderOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e._length,t[i++]=e._topRadius,t[i++]=e._bottomRadius,t[i++]=e._slices,t[i++]=e._numberOfVerticalLines,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchOptions$c={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};CylinderOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=e[t++],n=e[t++],a=e[t++],o=e[t++],s=e[t++],l=e[t];return defined(i)?(i._length=r,i._topRadius=n,i._bottomRadius=a,i._slices=o,i._numberOfVerticalLines=s,i._offsetAttribute=-1===l?void 0:l,i):(scratchOptions$c.length=r,scratchOptions$c.topRadius=n,scratchOptions$c.bottomRadius=a,scratchOptions$c.slices=o,scratchOptions$c.numberOfVerticalLines=s,scratchOptions$c.offsetAttribute=-1===l?void 0:l,new CylinderOutlineGeometry(scratchOptions$c))},CylinderOutlineGeometry.createGeometry=function(e){var t=e._length,i=e._topRadius,r=e._bottomRadius,n=e._slices,a=e._numberOfVerticalLines;if(!(t<=0||i<0||r<0||0===i&&0===r)){var o,s=2*n,l=CylinderGeometryLibrary.computePositions(t,i,r,n,!1),c=2*n;if(a>0){var u=Math.min(a,n);o=Math.round(n/u),c+=u}var d,h=IndexDatatype$1.createTypedArray(s,2*c),p=0;for(d=0;d<n-1;d++)h[p++]=d,h[p++]=d+1,h[p++]=d+n,h[p++]=d+1+n;if(h[p++]=n-1,h[p++]=0,h[p++]=n+n-1,h[p++]=n,a>0)for(d=0;d<n;d+=o)h[p++]=d,h[p++]=d+n;var f=new GeometryAttributes;f.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:l}),radiusScratch.x=.5*t,radiusScratch.y=Math.max(r,i);var m=new BoundingSphere(Cartesian3.ZERO,Cartesian2.magnitude(radiusScratch));if(defined(e._offsetAttribute)){t=l.length;var g=new Uint8Array(t/3);arrayFill(g,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),f.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}return new Geometry({attributes:f,indices:h,primitiveType:PrimitiveType$1.LINES,boundingSphere:m,offsetAttribute:e._offsetAttribute})}};var compressedMagic=1953029805,compressedMagicSwap=2917034100;function decodeGoogleEarthEnterpriseData(e,t){if(decodeGoogleEarthEnterpriseData.passThroughDataForTesting)return t;var i=e.byteLength;if(0===i||i%4!=0)throw new RuntimeError("The length of key must be greater than 0 and a multiple of 4.");var r=new DataView(t),n=r.getUint32(0,!0);if(n===compressedMagic||n===compressedMagicSwap)return t;for(var a,o=new DataView(e),s=0,l=t.byteLength,c=l-l%8,u=i,d=8;s<c;)for(a=d=(d+8)%24;s<c&&a<u;)r.setUint32(s,r.getUint32(s,!0)^o.getUint32(a,!0),!0),r.setUint32(s+4,r.getUint32(s+4,!0)^o.getUint32(a+4,!0),!0),s+=8,a+=24;if(s<l)for(a>=u&&(a=d=(d+8)%24);s<l;)r.setUint8(s,r.getUint8(s)^o.getUint8(a)),s++,a++}decodeGoogleEarthEnterpriseData.passThroughDataForTesting=!1;var maxShort=32767,scratchBVCartographic$1=new Cartographic,scratchEncodedPosition=new Cartesian3;function decodeVectorPolylinePositions(e,t,i,r,n){var a=e.length/3,o=e.subarray(0,a),s=e.subarray(a,2*a),l=e.subarray(2*a,3*a);AttributeCompression.zigZagDeltaDecode(o,s,l);for(var c=new Float64Array(e.length),u=0;u<a;++u){var d=o[u],h=s[u],p=l[u],f=CesiumMath.lerp(t.west,t.east,d/maxShort),m=CesiumMath.lerp(t.south,t.north,h/maxShort),g=CesiumMath.lerp(i,r,p/maxShort),_=Cartographic.fromRadians(f,m,g,scratchBVCartographic$1),y=n.cartographicToCartesian(_,scratchEncodedPosition);Cartesian3.pack(y,c,3*u)}return c}function DefaultProxy(e){this.proxy=e}function deprecationWarning(e,t){oneTimeWarning(e,t)}function DistanceDisplayCondition(e,t){e=defaultValue(e,0),this._near=e,t=defaultValue(t,Number.MAX_VALUE),this._far=t}function DistanceDisplayConditionGeometryInstanceAttribute(e,t){e=defaultValue(e,0),t=defaultValue(t,Number.MAX_VALUE),this.value=new Float32Array([e,t])}function DoubleEndedPriorityQueue(e){this._comparator=e.comparator,this._maximumLength=e.maximumLength,this._array=defined(e.maximumLength)?new Array(e.maximumLength):[],this._length=0}function swap$2(e,t,i){var r=e._array,n=r[t];r[t]=r[i],r[i]=n}function lessThan(e,t,i){return e._comparator(e._array[t],e._array[i])<0}function greaterThan(e,t,i){return e._comparator(e._array[t],e._array[i])>0}function pushUp(e,t){if(0!==t){var i=Math.floor(CesiumMath.log2(t+1))%2==0,r=Math.floor((t-1)/2),n=lessThan(e,t,r);for(n!==i&&(swap$2(e,t,r),t=r);t>=3;){var a=Math.floor((t-3)/4);if(lessThan(e,t,a)!==n)break;swap$2(e,t,a),t=a}}}function pushDown(e,t){for(var i,r=e._length,n=Math.floor(CesiumMath.log2(t+1))%2==0;(i=2*t+1)<r;){var a=i,o=i+1;if(o<r){lessThan(e,o,a)===n&&(a=o);for(var s=2*i+1,l=Math.max(Math.min(r-s,4),0),c=0;c<l;c++){var u=s+c;lessThan(e,u,a)===n&&(a=u)}}if(lessThan(e,a,t)===n&&(swap$2(e,a,t),a!==i&&a!==o)){var d=Math.floor((a-1)/2);greaterThan(e,a,d)===n&&swap$2(e,a,d)}t=a}}function DoublyLinkedList(){this.head=void 0,this.tail=void 0,this._length=0}function DoublyLinkedListNode(e,t,i){this.item=e,this.previous=t,this.next=i}function remove$2(e,t){defined(t.previous)&&defined(t.next)?(t.previous.next=t.next,t.next.previous=t.previous):defined(t.previous)?(t.previous.next=void 0,e.tail=t.previous):defined(t.next)?(t.next.previous=void 0,e.head=t.next):(e.head=void 0,e.tail=void 0),t.next=void 0,t.previous=void 0}DefaultProxy.prototype.getURL=function(e){var t=-1===this.proxy.indexOf("?")?"?":"";return this.proxy+t+encodeURIComponent(e)},Object.defineProperties(DistanceDisplayCondition.prototype,{near:{get:function(){return this._near},set:function(e){this._near=e}},far:{get:function(){return this._far},set:function(e){this._far=e}}}),DistanceDisplayCondition.packedLength=2,DistanceDisplayCondition.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.near,t[i]=e.far,t},DistanceDisplayCondition.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new DistanceDisplayCondition),i.near=e[t++],i.far=e[t],i},DistanceDisplayCondition.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.near===t.near&&e.far===t.far},DistanceDisplayCondition.clone=function(e,t){if(defined(e))return defined(t)||(t=new DistanceDisplayCondition),t.near=e.near,t.far=e.far,t},DistanceDisplayCondition.prototype.clone=function(e){return DistanceDisplayCondition.clone(this,e)},DistanceDisplayCondition.prototype.equals=function(e){return DistanceDisplayCondition.equals(this,e)},Object.defineProperties(DistanceDisplayConditionGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.FLOAT}},componentsPerAttribute:{get:function(){return 2}},normalize:{get:function(){return!1}}}),DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition=function(e){return new DistanceDisplayConditionGeometryInstanceAttribute(e.near,e.far)},DistanceDisplayConditionGeometryInstanceAttribute.toValue=function(e,t){return defined(t)?(t[0]=e.near,t[1]=e.far,t):new Float32Array([e.near,e.far])},Object.defineProperties(DoubleEndedPriorityQueue.prototype,{length:{get:function(){return this._length}},maximumLength:{get:function(){return this._maximumLength},set:function(e){if(defined(e)){for(;this._length>e;)this.removeMinimum();this._array.length=e}this._maximumLength=e}},internalArray:{get:function(){return this._array}},comparator:{get:function(){return this._comparator}}}),DoubleEndedPriorityQueue.prototype.clone=function(){var e=this._maximumLength,t=this._comparator,i=this._array,r=this._length,n=new DoubleEndedPriorityQueue({comparator:t,maximumLength:e});n._length=r;for(var a=0;a<r;a++)n._array[a]=i[a];return n},DoubleEndedPriorityQueue.prototype.reset=function(){this._length=0;var e=this._maximumLength;if(defined(e))for(var t=0;t<e;t++)this._array[t]=void 0;else this._array.length=0},DoubleEndedPriorityQueue.prototype.resort=function(){for(var e=this._length,t=0;t<e;t++)pushUp(this,t)},DoubleEndedPriorityQueue.prototype.insert=function(e){var t,i=this._maximumLength;if(defined(i)){if(0===i)return;if(this._length===i){var r=this._array[0];if(this._comparator(e,r)<=0)return e;t=this.removeMinimum()}}var n=this._length;return this._array[n]=e,this._length++,pushUp(this,n),t},DoubleEndedPriorityQueue.prototype.removeMinimum=function(){var e=this._length;if(0!==e){this._length--;var t=this._array[0];return e>=2&&(this._array[0]=this._array[e-1],pushDown(this,0)),this._array[e-1]=void 0,t}},DoubleEndedPriorityQueue.prototype.removeMaximum=function(){var e=this._length;if(0!==e){var t;if(this._length--,e<=2)t=this._array[e-1];else{var i=greaterThan(this,1,2)?1:2;t=this._array[i],this._array[i]=this._array[e-1],e>=4&&pushDown(this,i)}return this._array[e-1]=void 0,t}},DoubleEndedPriorityQueue.prototype.getMinimum=function(){if(0!==this._length)return this._array[0]},DoubleEndedPriorityQueue.prototype.getMaximum=function(){var e=this._length;if(0!==e)return e<=2?this._array[e-1]:this._array[greaterThan(this,1,2)?1:2]},Object.defineProperties(DoublyLinkedList.prototype,{length:{get:function(){return this._length}}}),DoublyLinkedList.prototype.add=function(e){var t=new DoublyLinkedListNode(e,this.tail,void 0);return defined(this.tail)?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t},DoublyLinkedList.prototype.remove=function(e){defined(e)&&(remove$2(this,e),--this._length)},DoublyLinkedList.prototype.splice=function(e,t){if(e!==t){remove$2(this,t);var i=e.next;e.next=t,this.tail===e?this.tail=t:i.previous=t,t.next=i,t.previous=e}};var Tween$1=createCommonjsModule((function(e,t){var i,r=r||(i=[],{getAll:function(){return i},removeAll:function(){i=[]},add:function(e){i.push(e)},remove:function(e){var t=i.indexOf(e);-1!==t&&i.splice(t,1)},update:function(e,t){if(0===i.length)return!1;var n=0;for(e=void 0!==e?e:r.now();n<i.length;)i[n].update(e)||t?n++:i.splice(n,1);return!0}});"undefined"==typeof window&&"undefined"!=typeof process?r.now=function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?r.now=window.performance.now.bind(window.performance):void 0!==Date.now?r.now=Date.now:r.now=function(){return(new Date).getTime()},r.Tween=function(e){var t,i=e,n={},a={},o={},s=1e3,l=0,c=!1,u=!1,d=0,h=null,p=r.Easing.Linear.None,f=r.Interpolation.Linear,m=[],g=null,_=!1,y=null,v=null,C=null;this.to=function(e,t){return a=e,void 0!==t&&(s=t),this},this.start=function(e){for(var t in r.add(this),u=!0,_=!1,h=void 0!==e?e:r.now(),h+=d,a){if(a[t]instanceof Array){if(0===a[t].length)continue;a[t]=[i[t]].concat(a[t])}void 0!==i[t]&&(n[t]=i[t],n[t]instanceof Array==!1&&(n[t]*=1),o[t]=n[t]||0)}return this},this.stop=function(){return u?(r.remove(this),u=!1,null!==C&&C.call(i,i),this.stopChainedTweens(),this):this},this.end=function(){return this.update(h+s),this},this.stopChainedTweens=function(){for(var e=0,t=m.length;e<t;e++)m[e].stop()},this.delay=function(e){return d=e,this},this.repeat=function(e){return l=e,this},this.repeatDelay=function(e){return t=e,this},this.yoyo=function(e){return c=e,this},this.easing=function(e){return p=e,this},this.interpolation=function(e){return f=e,this},this.chain=function(){return m=arguments,this},this.onStart=function(e){return g=e,this},this.onUpdate=function(e){return y=e,this},this.onComplete=function(e){return v=e,this},this.onStop=function(e){return C=e,this},this.update=function(e){var r,u,C;if(e<h)return!0;for(r in!1===_&&(null!==g&&g.call(i,i),_=!0),C=p(u=(u=(e-h)/s)>1?1:u),a)if(void 0!==n[r]){var T=n[r]||0,S=a[r];S instanceof Array?i[r]=f(S,C):("string"==typeof S&&(S="+"===S.charAt(0)||"-"===S.charAt(0)?T+parseFloat(S):parseFloat(S)),"number"==typeof S&&(i[r]=T+(S-T)*C))}if(null!==y&&y.call(i,C),1===u){if(l>0){for(r in isFinite(l)&&l--,o){if("string"==typeof a[r]&&(o[r]=o[r]+parseFloat(a[r])),c){var A=o[r];o[r]=a[r],a[r]=A}n[r]=o[r]}return h=void 0!==t?e+t:e+d,!0}null!==v&&v.call(i,i);for(var x=0,E=m.length;x<E;x++)m[x].start(h+s);return!1}return!0}},r.Easing={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-r.Easing.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*r.Easing.Bounce.In(2*e):.5*r.Easing.Bounce.Out(2*e-1)+.5}}},r.Interpolation={Linear:function(e,t){var i=e.length-1,n=i*t,a=Math.floor(n),o=r.Interpolation.Utils.Linear;return t<0?o(e[0],e[1],n):t>1?o(e[i],e[i-1],i-n):o(e[a],e[a+1>i?i:a+1],n-a)},Bezier:function(e,t){for(var i=0,n=e.length-1,a=Math.pow,o=r.Interpolation.Utils.Bernstein,s=0;s<=n;s++)i+=a(1-t,n-s)*a(t,s)*e[s]*o(n,s);return i},CatmullRom:function(e,t){var i=e.length-1,n=i*t,a=Math.floor(n),o=r.Interpolation.Utils.CatmullRom;return e[0]===e[i]?(t<0&&(a=Math.floor(n=i*(1+t))),o(e[(a-1+i)%i],e[a],e[(a+1)%i],e[(a+2)%i],n-a)):t<0?e[0]-(o(e[0],e[0],e[1],e[1],-n)-e[0]):t>1?e[i]-(o(e[i],e[i],e[i-1],e[i-1],n-i)-e[i]):o(e[a?a-1:0],e[a],e[i<a+1?i:a+1],e[i<a+2?i:a+2],n-a)},Utils:{Linear:function(e,t,i){return(t-e)*i+e},Bernstein:function(e,t){var i=r.Interpolation.Utils.Factorial;return i(e)/i(t)/i(e-t)},Factorial:function(){var e=[1];return function(t){var i=1;if(e[t])return e[t];for(var r=t;r>1;r--)i*=r;return e[t]=i,i}}(),CatmullRom:function(e,t,i,r,n){var a=.5*(i-e),o=.5*(r-t),s=n*n;return(2*t-2*i+a+o)*(n*s)+(-3*t+3*i-2*a-o)*s+a*n+t}}},e.exports=r})),EasingFunction={LINEAR_NONE:Tween$1.Easing.Linear.None,QUADRATIC_IN:Tween$1.Easing.Quadratic.In,QUADRATIC_OUT:Tween$1.Easing.Quadratic.Out,QUADRATIC_IN_OUT:Tween$1.Easing.Quadratic.InOut,CUBIC_IN:Tween$1.Easing.Cubic.In,CUBIC_OUT:Tween$1.Easing.Cubic.Out,CUBIC_IN_OUT:Tween$1.Easing.Cubic.InOut,QUARTIC_IN:Tween$1.Easing.Quartic.In,QUARTIC_OUT:Tween$1.Easing.Quartic.Out,QUARTIC_IN_OUT:Tween$1.Easing.Quartic.InOut,QUINTIC_IN:Tween$1.Easing.Quintic.In,QUINTIC_OUT:Tween$1.Easing.Quintic.Out,QUINTIC_IN_OUT:Tween$1.Easing.Quintic.InOut,SINUSOIDAL_IN:Tween$1.Easing.Sinusoidal.In,SINUSOIDAL_OUT:Tween$1.Easing.Sinusoidal.Out,SINUSOIDAL_IN_OUT:Tween$1.Easing.Sinusoidal.InOut,EXPONENTIAL_IN:Tween$1.Easing.Exponential.In,EXPONENTIAL_OUT:Tween$1.Easing.Exponential.Out,EXPONENTIAL_IN_OUT:Tween$1.Easing.Exponential.InOut,CIRCULAR_IN:Tween$1.Easing.Circular.In,CIRCULAR_OUT:Tween$1.Easing.Circular.Out,CIRCULAR_IN_OUT:Tween$1.Easing.Circular.InOut,ELASTIC_IN:Tween$1.Easing.Elastic.In,ELASTIC_OUT:Tween$1.Easing.Elastic.Out,ELASTIC_IN_OUT:Tween$1.Easing.Elastic.InOut,BACK_IN:Tween$1.Easing.Back.In,BACK_OUT:Tween$1.Easing.Back.Out,BACK_IN_OUT:Tween$1.Easing.Back.InOut,BOUNCE_IN:Tween$1.Easing.Bounce.In,BOUNCE_OUT:Tween$1.Easing.Bounce.Out,BOUNCE_IN_OUT:Tween$1.Easing.Bounce.InOut},EasingFunction$1=Object.freeze(EasingFunction),scratchPosition$b=new Cartesian3,scratchNormal$3=new Cartesian3,scratchTangent$2=new Cartesian3,scratchBitangent$2=new Cartesian3,scratchNormalST=new Cartesian3,defaultRadii$1=new Cartesian3(1,1,1),cos$2=Math.cos,sin$2=Math.sin;function EllipsoidGeometry(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=defaultValue(e.radii,defaultRadii$1),i=defaultValue(e.innerRadii,t),r=defaultValue(e.minimumClock,0),n=defaultValue(e.maximumClock,CesiumMath.TWO_PI),a=defaultValue(e.minimumCone,0),o=defaultValue(e.maximumCone,CesiumMath.PI),s=Math.round(defaultValue(e.stackPartitions,64)),l=Math.round(defaultValue(e.slicePartitions,64)),c=defaultValue(e.vertexFormat,VertexFormat.DEFAULT);this._radii=Cartesian3.clone(t),this._innerRadii=Cartesian3.clone(i),this._minimumClock=r,this._maximumClock=n,this._minimumCone=a,this._maximumCone=o,this._stackPartitions=s,this._slicePartitions=l,this._vertexFormat=VertexFormat.clone(c),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidGeometry"}EllipsoidGeometry.packedLength=2*Cartesian3.packedLength+VertexFormat.packedLength+7,EllipsoidGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._radii,t,i),i+=Cartesian3.packedLength,Cartesian3.pack(e._innerRadii,t,i),i+=Cartesian3.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._minimumClock,t[i++]=e._maximumClock,t[i++]=e._minimumCone,t[i++]=e._maximumCone,t[i++]=e._stackPartitions,t[i++]=e._slicePartitions,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchRadii$2=new Cartesian3,scratchInnerRadii$1=new Cartesian3,scratchVertexFormat$7=new VertexFormat,scratchOptions$b={radii:scratchRadii$2,innerRadii:scratchInnerRadii$1,vertexFormat:scratchVertexFormat$7,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0},unitEllipsoidGeometry;EllipsoidGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t,scratchRadii$2);t+=Cartesian3.packedLength;var n=Cartesian3.unpack(e,t,scratchInnerRadii$1);t+=Cartesian3.packedLength;var a=VertexFormat.unpack(e,t,scratchVertexFormat$7);t+=VertexFormat.packedLength;var o=e[t++],s=e[t++],l=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t];return defined(i)?(i._radii=Cartesian3.clone(r,i._radii),i._innerRadii=Cartesian3.clone(n,i._innerRadii),i._vertexFormat=VertexFormat.clone(a,i._vertexFormat),i._minimumClock=o,i._maximumClock=s,i._minimumCone=l,i._maximumCone=c,i._stackPartitions=u,i._slicePartitions=d,i._offsetAttribute=-1===h?void 0:h,i):(scratchOptions$b.minimumClock=o,scratchOptions$b.maximumClock=s,scratchOptions$b.minimumCone=l,scratchOptions$b.maximumCone=c,scratchOptions$b.stackPartitions=u,scratchOptions$b.slicePartitions=d,scratchOptions$b.offsetAttribute=-1===h?void 0:h,new EllipsoidGeometry(scratchOptions$b))},EllipsoidGeometry.createGeometry=function(e){var t=e._radii;if(!(t.x<=0||t.y<=0||t.z<=0)){var i=e._innerRadii;if(!(i.x<=0||i.y<=0||i.z<=0)){var r,n,a=e._minimumClock,o=e._maximumClock,s=e._minimumCone,l=e._maximumCone,c=e._vertexFormat,u=e._slicePartitions+1,d=e._stackPartitions+1;(u=Math.round(u*Math.abs(o-a)/CesiumMath.TWO_PI))<2&&(u=2),(d=Math.round(d*Math.abs(l-s)/CesiumMath.PI))<2&&(d=2);var h=0,p=[s],f=[a];for(r=0;r<d;r++)p.push(s+r*(l-s)/(d-1));for(p.push(l),n=0;n<u;n++)f.push(a+n*(o-a)/(u-1));f.push(o);var m=p.length,g=f.length,_=0,y=1,v=i.x!==t.x||i.y!==t.y||i.z!==t.z,C=!1,T=!1,S=!1;v&&(y=2,s>0&&(C=!0,_+=u-1),l<Math.PI&&(T=!0,_+=u-1),(o-a)%CesiumMath.TWO_PI?(S=!0,_+=2*(d-1)+1):_+=1);var A=g*m*y,x=new Float64Array(3*A),E=arrayFill(new Array(A),!1),b=arrayFill(new Array(A),!1),P=u*d*y,D=6*(P+_+1-(u+d)*y),w=IndexDatatype$1.createTypedArray(P,D),M=c.normal?new Float32Array(3*A):void 0,I=c.tangent?new Float32Array(3*A):void 0,R=c.bitangent?new Float32Array(3*A):void 0,O=c.st?new Float32Array(2*A):void 0,B=new Array(m),L=new Array(m);for(r=0;r<m;r++)B[r]=sin$2(p[r]),L[r]=cos$2(p[r]);var F=new Array(g),N=new Array(g);for(n=0;n<g;n++)N[n]=cos$2(f[n]),F[n]=sin$2(f[n]);for(r=0;r<m;r++)for(n=0;n<g;n++)x[h++]=t.x*B[r]*N[n],x[h++]=t.y*B[r]*F[n],x[h++]=t.z*L[r];var V,k,U,G,$=A/2;if(v)for(r=0;r<m;r++)for(n=0;n<g;n++)x[h++]=i.x*B[r]*N[n],x[h++]=i.y*B[r]*F[n],x[h++]=i.z*L[r],E[$]=!0,r>0&&r!==m-1&&0!==n&&n!==g-1&&(b[$]=!0),$++;for(h=0,r=1;r<m-2;r++)for(V=r*g,k=(r+1)*g,n=1;n<g-2;n++)w[h++]=k+n,w[h++]=k+n+1,w[h++]=V+n+1,w[h++]=k+n,w[h++]=V+n+1,w[h++]=V+n;if(v){var z=m*g;for(r=1;r<m-2;r++)for(V=z+r*g,k=z+(r+1)*g,n=1;n<g-2;n++)w[h++]=k+n,w[h++]=V+n,w[h++]=V+n+1,w[h++]=k+n,w[h++]=V+n+1,w[h++]=k+n+1}if(v){if(C)for(G=m*g,r=1;r<g-2;r++)w[h++]=r,w[h++]=r+1,w[h++]=G+r+1,w[h++]=r,w[h++]=G+r+1,w[h++]=G+r;if(T)for(U=m*g-g,G=m*g*y-g,r=1;r<g-2;r++)w[h++]=U+r+1,w[h++]=U+r,w[h++]=G+r,w[h++]=U+r+1,w[h++]=G+r,w[h++]=G+r+1}if(S){for(r=1;r<m-2;r++)G=g*m+g*r,U=g*r,w[h++]=G,w[h++]=U+g,w[h++]=U,w[h++]=G,w[h++]=G+g,w[h++]=U+g;for(r=1;r<m-2;r++)G=g*m+g*(r+1)-1,U=g*(r+1)-1,w[h++]=U+g,w[h++]=G,w[h++]=U,w[h++]=U+g,w[h++]=G+g,w[h++]=G}var H=new GeometryAttributes;c.position&&(H.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:x}));var W,j=0,q=0,X=0,Y=0,K=A/2,J=Ellipsoid.fromCartesian3(t),Q=Ellipsoid.fromCartesian3(i);if(c.st||c.normal||c.tangent||c.bitangent){for(r=0;r<A;r++){W=E[r]?Q:J;var Z=Cartesian3.fromArray(x,3*r,scratchPosition$b),ee=W.geodeticSurfaceNormal(Z,scratchNormal$3);if(b[r]&&Cartesian3.negate(ee,ee),c.st){var te=Cartesian2.negate(ee,scratchNormalST);O[j++]=Math.atan2(te.y,te.x)/CesiumMath.TWO_PI+.5,O[j++]=Math.asin(ee.z)/Math.PI+.5}if(c.normal&&(M[q++]=ee.x,M[q++]=ee.y,M[q++]=ee.z),c.tangent||c.bitangent){var ie,re=scratchTangent$2,ne=0;if(E[r]&&(ne=K),ie=!C&&r>=ne&&r<ne+2*g?Cartesian3.UNIT_X:Cartesian3.UNIT_Z,Cartesian3.cross(ie,ee,re),Cartesian3.normalize(re,re),c.tangent&&(I[X++]=re.x,I[X++]=re.y,I[X++]=re.z),c.bitangent){var ae=Cartesian3.cross(ee,re,scratchBitangent$2);Cartesian3.normalize(ae,ae),R[Y++]=ae.x,R[Y++]=ae.y,R[Y++]=ae.z}}}c.st&&(H.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:O})),c.normal&&(H.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:M})),c.tangent&&(H.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:I})),c.bitangent&&(H.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:R}))}if(defined(e._offsetAttribute)){var oe=x.length,se=new Uint8Array(oe/3);arrayFill(se,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),H.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:se})}return new Geometry({attributes:H,indices:w,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:BoundingSphere.fromEllipsoid(J),offsetAttribute:e._offsetAttribute})}}},EllipsoidGeometry.getUnitEllipsoid=function(){return defined(unitEllipsoidGeometry)||(unitEllipsoidGeometry=EllipsoidGeometry.createGeometry(new EllipsoidGeometry({radii:new Cartesian3(1,1,1),vertexFormat:VertexFormat.POSITION_ONLY}))),unitEllipsoidGeometry};var defaultRadii=new Cartesian3(1,1,1),cos$1=Math.cos,sin$1=Math.sin;function EllipsoidOutlineGeometry(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=defaultValue(e.radii,defaultRadii),i=defaultValue(e.innerRadii,t),r=defaultValue(e.minimumClock,0),n=defaultValue(e.maximumClock,CesiumMath.TWO_PI),a=defaultValue(e.minimumCone,0),o=defaultValue(e.maximumCone,CesiumMath.PI),s=Math.round(defaultValue(e.stackPartitions,10)),l=Math.round(defaultValue(e.slicePartitions,8)),c=Math.round(defaultValue(e.subdivisions,128));this._radii=Cartesian3.clone(t),this._innerRadii=Cartesian3.clone(i),this._minimumClock=r,this._maximumClock=n,this._minimumCone=a,this._maximumCone=o,this._stackPartitions=s,this._slicePartitions=l,this._subdivisions=c,this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}EllipsoidOutlineGeometry.packedLength=2*Cartesian3.packedLength+8,EllipsoidOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._radii,t,i),i+=Cartesian3.packedLength,Cartesian3.pack(e._innerRadii,t,i),i+=Cartesian3.packedLength,t[i++]=e._minimumClock,t[i++]=e._maximumClock,t[i++]=e._minimumCone,t[i++]=e._maximumCone,t[i++]=e._stackPartitions,t[i++]=e._slicePartitions,t[i++]=e._subdivisions,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchRadii$1=new Cartesian3,scratchInnerRadii=new Cartesian3,scratchOptions$a={radii:scratchRadii$1,innerRadii:scratchInnerRadii,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};function EllipsoidTerrainProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._tilingScheme=e.tilingScheme,defined(this._tilingScheme)||(this._tilingScheme=new GeographicTilingScheme({ellipsoid:defaultValue(e.ellipsoid,Ellipsoid.WGS84)})),this._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,64,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new Event,this._readyPromise=when.resolve(!0)}function EventHelper(){this._removalFunctions=[]}EllipsoidOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t,scratchRadii$1);t+=Cartesian3.packedLength;var n=Cartesian3.unpack(e,t,scratchInnerRadii);t+=Cartesian3.packedLength;var a=e[t++],o=e[t++],s=e[t++],l=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t];return defined(i)?(i._radii=Cartesian3.clone(r,i._radii),i._innerRadii=Cartesian3.clone(n,i._innerRadii),i._minimumClock=a,i._maximumClock=o,i._minimumCone=s,i._maximumCone=l,i._stackPartitions=c,i._slicePartitions=u,i._subdivisions=d,i._offsetAttribute=-1===h?void 0:h,i):(scratchOptions$a.minimumClock=a,scratchOptions$a.maximumClock=o,scratchOptions$a.minimumCone=s,scratchOptions$a.maximumCone=l,scratchOptions$a.stackPartitions=c,scratchOptions$a.slicePartitions=u,scratchOptions$a.subdivisions=d,scratchOptions$a.offsetAttribute=-1===h?void 0:h,new EllipsoidOutlineGeometry(scratchOptions$a))},EllipsoidOutlineGeometry.createGeometry=function(e){var t=e._radii;if(!(t.x<=0||t.y<=0||t.z<=0)){var i=e._innerRadii;if(!(i.x<=0||i.y<=0||i.z<=0)){var r=e._minimumClock,n=e._maximumClock,a=e._minimumCone,o=e._maximumCone,s=e._subdivisions,l=Ellipsoid.fromCartesian3(t),c=e._slicePartitions+1,u=e._stackPartitions+1;(c=Math.round(c*Math.abs(n-r)/CesiumMath.TWO_PI))<2&&(c=2),(u=Math.round(u*Math.abs(o-a)/CesiumMath.PI))<2&&(u=2);var d=0,h=1,p=i.x!==t.x||i.y!==t.y||i.z!==t.z,f=!1,m=!1;p&&(h=2,a>0&&(f=!0,d+=c),o<Math.PI&&(m=!0,d+=c));var g,_,y,v,C=s*h*(u+c),T=new Float64Array(3*C),S=2*(C+d-(c+u)*h),A=IndexDatatype$1.createTypedArray(C,S),x=0,E=new Array(u),b=new Array(u);for(g=0;g<u;g++)v=a+g*(o-a)/(u-1),E[g]=sin$1(v),b[g]=cos$1(v);var P=new Array(s),D=new Array(s);for(g=0;g<s;g++)y=r+g*(n-r)/(s-1),P[g]=sin$1(y),D[g]=cos$1(y);for(g=0;g<u;g++)for(_=0;_<s;_++)T[x++]=t.x*E[g]*D[_],T[x++]=t.y*E[g]*P[_],T[x++]=t.z*b[g];if(p)for(g=0;g<u;g++)for(_=0;_<s;_++)T[x++]=i.x*E[g]*D[_],T[x++]=i.y*E[g]*P[_],T[x++]=i.z*b[g];for(E.length=s,b.length=s,g=0;g<s;g++)v=a+g*(o-a)/(s-1),E[g]=sin$1(v),b[g]=cos$1(v);for(P.length=c,D.length=c,g=0;g<c;g++)y=r+g*(n-r)/(c-1),P[g]=sin$1(y),D[g]=cos$1(y);for(g=0;g<s;g++)for(_=0;_<c;_++)T[x++]=t.x*E[g]*D[_],T[x++]=t.y*E[g]*P[_],T[x++]=t.z*b[g];if(p)for(g=0;g<s;g++)for(_=0;_<c;_++)T[x++]=i.x*E[g]*D[_],T[x++]=i.y*E[g]*P[_],T[x++]=i.z*b[g];for(x=0,g=0;g<u*h;g++){var w=g*s;for(_=0;_<s-1;_++)A[x++]=w+_,A[x++]=w+_+1}var M=u*s*h;for(g=0;g<c;g++)for(_=0;_<s-1;_++)A[x++]=M+g+_*c,A[x++]=M+g+(_+1)*c;if(p)for(M=u*s*h+c*s,g=0;g<c;g++)for(_=0;_<s-1;_++)A[x++]=M+g+_*c,A[x++]=M+g+(_+1)*c;if(p){var I=u*s*h,R=I+s*c;if(f)for(g=0;g<c;g++)A[x++]=I+g,A[x++]=R+g;if(m)for(I+=s*c-c,R+=s*c-c,g=0;g<c;g++)A[x++]=I+g,A[x++]=R+g}var O=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:T})});if(defined(e._offsetAttribute)){var B=T.length,L=new Uint8Array(B/3);arrayFill(L,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),O.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:L})}return new Geometry({attributes:O,indices:A,primitiveType:PrimitiveType$1.LINES,boundingSphere:BoundingSphere.fromEllipsoid(l),offsetAttribute:e._offsetAttribute})}}},Object.defineProperties(EllipsoidTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}}),EllipsoidTerrainProvider.prototype.requestTileGeometry=function(e,t,i,r){return when.resolve(new HeightmapTerrainData({buffer:new Uint8Array(256),width:16,height:16}))},EllipsoidTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},EllipsoidTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){},EllipsoidTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){},EventHelper.prototype.add=function(e,t,i){var r=e.addEventListener(t,i);this._removalFunctions.push(r);var n=this;return function(){r();var e=n._removalFunctions;e.splice(e.indexOf(r),1)}},EventHelper.prototype.removeAll=function(){for(var e=this._removalFunctions,t=0,i=e.length;t<i;++t)e[t]();e.length=0};var ExperimentalFeatures={enableModelExperimental:!1},ExtrapolationType={NONE:0,HOLD:1,EXTRAPOLATE:2},ExtrapolationType$1=Object.freeze(ExtrapolationType);function OrthographicOffCenterFrustum(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.left=e.left,this._left=void 0,this.right=e.right,this._right=void 0,this.top=e.top,this._top=void 0,this.bottom=e.bottom,this._bottom=void 0,this.near=defaultValue(e.near,1),this._near=this.near,this.far=defaultValue(e.far,5e8),this._far=this.far,this._cullingVolume=new CullingVolume,this._orthographicMatrix=new Matrix4}function update$5(e){e.top===e._top&&e.bottom===e._bottom&&e.left===e._left&&e.right===e._right&&e.near===e._near&&e.far===e._far||(e._left=e.left,e._right=e.right,e._top=e.top,e._bottom=e.bottom,e._near=e.near,e._far=e.far,e._orthographicMatrix=Matrix4.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix))}Object.defineProperties(OrthographicOffCenterFrustum.prototype,{projectionMatrix:{get:function(){return update$5(this),this._orthographicMatrix}}});var getPlanesRight$1=new Cartesian3,getPlanesNearCenter$1=new Cartesian3,getPlanesPoint=new Cartesian3,negateScratch=new Cartesian3;function OrthographicFrustum(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new OrthographicOffCenterFrustum,this.width=e.width,this._width=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=defaultValue(e.near,1),this._near=this.near,this.far=defaultValue(e.far,5e8),this._far=this.far}function update$4(e){var t=e._offCenterFrustum;if(e.width!==e._width||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far){e._aspectRatio=e.aspectRatio,e._width=e.width,e._near=e.near,e._far=e.far;var i=1/e.aspectRatio;t.right=.5*e.width,t.left=-t.right,t.top=i*t.right,t.bottom=-t.top,t.near=e.near,t.far=e.far}}function PerspectiveOffCenterFrustum(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.left=e.left,this._left=void 0,this.right=e.right,this._right=void 0,this.top=e.top,this._top=void 0,this.bottom=e.bottom,this._bottom=void 0,this.near=defaultValue(e.near,1),this._near=this.near,this.far=defaultValue(e.far,5e8),this._far=this.far,this._cullingVolume=new CullingVolume,this._perspectiveMatrix=new Matrix4,this._infinitePerspective=new Matrix4}function update$3(e){var t=e.top,i=e.bottom,r=e.right,n=e.left,a=e.near,o=e.far;t===e._top&&i===e._bottom&&n===e._left&&r===e._right&&a===e._near&&o===e._far||(e._left=n,e._right=r,e._top=t,e._bottom=i,e._near=a,e._far=o,e._perspectiveMatrix=Matrix4.computePerspectiveOffCenter(n,r,i,t,a,o,e._perspectiveMatrix),e._infinitePerspective=Matrix4.computeInfinitePerspectiveOffCenter(n,r,i,t,a,e._infinitePerspective))}OrthographicOffCenterFrustum.prototype.computeCullingVolume=function(e,t,i){var r=this._cullingVolume.planes,n=this.top,a=this.bottom,o=this.right,s=this.left,l=this.near,c=this.far,u=Cartesian3.cross(t,i,getPlanesRight$1);Cartesian3.normalize(u,u);var d=getPlanesNearCenter$1;Cartesian3.multiplyByScalar(t,l,d),Cartesian3.add(e,d,d);var h=getPlanesPoint;Cartesian3.multiplyByScalar(u,s,h),Cartesian3.add(d,h,h);var p=r[0];return defined(p)||(p=r[0]=new Cartesian4),p.x=u.x,p.y=u.y,p.z=u.z,p.w=-Cartesian3.dot(u,h),Cartesian3.multiplyByScalar(u,o,h),Cartesian3.add(d,h,h),defined(p=r[1])||(p=r[1]=new Cartesian4),p.x=-u.x,p.y=-u.y,p.z=-u.z,p.w=-Cartesian3.dot(Cartesian3.negate(u,negateScratch),h),Cartesian3.multiplyByScalar(i,a,h),Cartesian3.add(d,h,h),defined(p=r[2])||(p=r[2]=new Cartesian4),p.x=i.x,p.y=i.y,p.z=i.z,p.w=-Cartesian3.dot(i,h),Cartesian3.multiplyByScalar(i,n,h),Cartesian3.add(d,h,h),defined(p=r[3])||(p=r[3]=new Cartesian4),p.x=-i.x,p.y=-i.y,p.z=-i.z,p.w=-Cartesian3.dot(Cartesian3.negate(i,negateScratch),h),defined(p=r[4])||(p=r[4]=new Cartesian4),p.x=t.x,p.y=t.y,p.z=t.z,p.w=-Cartesian3.dot(t,d),Cartesian3.multiplyByScalar(t,c,h),Cartesian3.add(e,h,h),defined(p=r[5])||(p=r[5]=new Cartesian4),p.x=-t.x,p.y=-t.y,p.z=-t.z,p.w=-Cartesian3.dot(Cartesian3.negate(t,negateScratch),h),this._cullingVolume},OrthographicOffCenterFrustum.prototype.getPixelDimensions=function(e,t,i,r,n){update$5(this);var a=r*(this.right-this.left)/e,o=r*(this.top-this.bottom)/t;return n.x=a,n.y=o,n},OrthographicOffCenterFrustum.prototype.clone=function(e){return defined(e)||(e=new OrthographicOffCenterFrustum),e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e},OrthographicOffCenterFrustum.prototype.equals=function(e){return defined(e)&&e instanceof OrthographicOffCenterFrustum&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},OrthographicOffCenterFrustum.prototype.equalsEpsilon=function(e,t,i){return e===this||defined(e)&&e instanceof OrthographicOffCenterFrustum&&CesiumMath.equalsEpsilon(this.right,e.right,t,i)&&CesiumMath.equalsEpsilon(this.left,e.left,t,i)&&CesiumMath.equalsEpsilon(this.top,e.top,t,i)&&CesiumMath.equalsEpsilon(this.bottom,e.bottom,t,i)&&CesiumMath.equalsEpsilon(this.near,e.near,t,i)&&CesiumMath.equalsEpsilon(this.far,e.far,t,i)},OrthographicFrustum.packedLength=4,OrthographicFrustum.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.width,t[i++]=e.aspectRatio,t[i++]=e.near,t[i]=e.far,t},OrthographicFrustum.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new OrthographicFrustum),i.width=e[t++],i.aspectRatio=e[t++],i.near=e[t++],i.far=e[t],i},Object.defineProperties(OrthographicFrustum.prototype,{projectionMatrix:{get:function(){return update$4(this),this._offCenterFrustum.projectionMatrix}}}),OrthographicFrustum.prototype.computeCullingVolume=function(e,t,i){return update$4(this),this._offCenterFrustum.computeCullingVolume(e,t,i)},OrthographicFrustum.prototype.getPixelDimensions=function(e,t,i,r,n){return update$4(this),this._offCenterFrustum.getPixelDimensions(e,t,i,r,n)},OrthographicFrustum.prototype.clone=function(e){return defined(e)||(e=new OrthographicFrustum),e.aspectRatio=this.aspectRatio,e.width=this.width,e.near=this.near,e.far=this.far,e._aspectRatio=void 0,e._width=void 0,e._near=void 0,e._far=void 0,this._offCenterFrustum.clone(e._offCenterFrustum),e},OrthographicFrustum.prototype.equals=function(e){return!!(defined(e)&&e instanceof OrthographicFrustum)&&(update$4(this),update$4(e),this.width===e.width&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))},OrthographicFrustum.prototype.equalsEpsilon=function(e,t,i){return!!(defined(e)&&e instanceof OrthographicFrustum)&&(update$4(this),update$4(e),CesiumMath.equalsEpsilon(this.width,e.width,t,i)&&CesiumMath.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,i)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,i))},Object.defineProperties(PerspectiveOffCenterFrustum.prototype,{projectionMatrix:{get:function(){return update$3(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return update$3(this),this._infinitePerspective}}});var getPlanesRight=new Cartesian3,getPlanesNearCenter=new Cartesian3,getPlanesFarCenter=new Cartesian3,getPlanesNormal=new Cartesian3;function PerspectiveFrustum(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new PerspectiveOffCenterFrustum,this.fov=e.fov,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=defaultValue(e.near,1),this._near=this.near,this.far=defaultValue(e.far,5e8),this._far=this.far,this.xOffset=defaultValue(e.xOffset,0),this._xOffset=this.xOffset,this.yOffset=defaultValue(e.yOffset,0),this._yOffset=this.yOffset}function update$2(e){var t=e._offCenterFrustum;e.fov===e._fov&&e.aspectRatio===e._aspectRatio&&e.near===e._near&&e.far===e._far&&e.xOffset===e._xOffset&&e.yOffset===e._yOffset||(e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:2*Math.atan(Math.tan(.5*e.fov)/e.aspectRatio),e._near=e.near,e._far=e.far,e._sseDenominator=2*Math.tan(.5*e._fovy),e._xOffset=e.xOffset,e._yOffset=e.yOffset,t.top=e.near*Math.tan(.5*e._fovy),t.bottom=-t.top,t.right=e.aspectRatio*t.top,t.left=-t.right,t.near=e.near,t.far=e.far,t.right+=e.xOffset,t.left+=e.xOffset,t.top+=e.yOffset,t.bottom+=e.yOffset)}PerspectiveOffCenterFrustum.prototype.computeCullingVolume=function(e,t,i){var r=this._cullingVolume.planes,n=this.top,a=this.bottom,o=this.right,s=this.left,l=this.near,c=this.far,u=Cartesian3.cross(t,i,getPlanesRight),d=getPlanesNearCenter;Cartesian3.multiplyByScalar(t,l,d),Cartesian3.add(e,d,d);var h=getPlanesFarCenter;Cartesian3.multiplyByScalar(t,c,h),Cartesian3.add(e,h,h);var p=getPlanesNormal;Cartesian3.multiplyByScalar(u,s,p),Cartesian3.add(d,p,p),Cartesian3.subtract(p,e,p),Cartesian3.normalize(p,p),Cartesian3.cross(p,i,p),Cartesian3.normalize(p,p);var f=r[0];return defined(f)||(f=r[0]=new Cartesian4),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-Cartesian3.dot(p,e),Cartesian3.multiplyByScalar(u,o,p),Cartesian3.add(d,p,p),Cartesian3.subtract(p,e,p),Cartesian3.cross(i,p,p),Cartesian3.normalize(p,p),defined(f=r[1])||(f=r[1]=new Cartesian4),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-Cartesian3.dot(p,e),Cartesian3.multiplyByScalar(i,a,p),Cartesian3.add(d,p,p),Cartesian3.subtract(p,e,p),Cartesian3.cross(u,p,p),Cartesian3.normalize(p,p),defined(f=r[2])||(f=r[2]=new Cartesian4),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-Cartesian3.dot(p,e),Cartesian3.multiplyByScalar(i,n,p),Cartesian3.add(d,p,p),Cartesian3.subtract(p,e,p),Cartesian3.cross(p,u,p),Cartesian3.normalize(p,p),defined(f=r[3])||(f=r[3]=new Cartesian4),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-Cartesian3.dot(p,e),defined(f=r[4])||(f=r[4]=new Cartesian4),f.x=t.x,f.y=t.y,f.z=t.z,f.w=-Cartesian3.dot(t,d),Cartesian3.negate(t,p),defined(f=r[5])||(f=r[5]=new Cartesian4),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-Cartesian3.dot(p,h),this._cullingVolume},PerspectiveOffCenterFrustum.prototype.getPixelDimensions=function(e,t,i,r,n){update$3(this);var a=1/this.near,o=this.top*a,s=2*r*i*o/t,l=2*r*i*(o=this.right*a)/e;return n.x=l,n.y=s,n},PerspectiveOffCenterFrustum.prototype.clone=function(e){return defined(e)||(e=new PerspectiveOffCenterFrustum),e.right=this.right,e.left=this.left,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e},PerspectiveOffCenterFrustum.prototype.equals=function(e){return defined(e)&&e instanceof PerspectiveOffCenterFrustum&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},PerspectiveOffCenterFrustum.prototype.equalsEpsilon=function(e,t,i){return e===this||defined(e)&&e instanceof PerspectiveOffCenterFrustum&&CesiumMath.equalsEpsilon(this.right,e.right,t,i)&&CesiumMath.equalsEpsilon(this.left,e.left,t,i)&&CesiumMath.equalsEpsilon(this.top,e.top,t,i)&&CesiumMath.equalsEpsilon(this.bottom,e.bottom,t,i)&&CesiumMath.equalsEpsilon(this.near,e.near,t,i)&&CesiumMath.equalsEpsilon(this.far,e.far,t,i)},PerspectiveFrustum.packedLength=6,PerspectiveFrustum.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.fov,t[i++]=e.aspectRatio,t[i++]=e.near,t[i++]=e.far,t[i++]=e.xOffset,t[i]=e.yOffset,t},PerspectiveFrustum.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new PerspectiveFrustum),i.fov=e[t++],i.aspectRatio=e[t++],i.near=e[t++],i.far=e[t++],i.xOffset=e[t++],i.yOffset=e[t],i},Object.defineProperties(PerspectiveFrustum.prototype,{projectionMatrix:{get:function(){return update$2(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return update$2(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return update$2(this),this._fovy}},sseDenominator:{get:function(){return update$2(this),this._sseDenominator}}}),PerspectiveFrustum.prototype.computeCullingVolume=function(e,t,i){return update$2(this),this._offCenterFrustum.computeCullingVolume(e,t,i)},PerspectiveFrustum.prototype.getPixelDimensions=function(e,t,i,r,n){return update$2(this),this._offCenterFrustum.getPixelDimensions(e,t,i,r,n)},PerspectiveFrustum.prototype.clone=function(e){return defined(e)||(e=new PerspectiveFrustum),e.aspectRatio=this.aspectRatio,e.fov=this.fov,e.near=this.near,e.far=this.far,e._aspectRatio=void 0,e._fov=void 0,e._near=void 0,e._far=void 0,this._offCenterFrustum.clone(e._offCenterFrustum),e},PerspectiveFrustum.prototype.equals=function(e){return!!(defined(e)&&e instanceof PerspectiveFrustum)&&(update$2(this),update$2(e),this.fov===e.fov&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))},PerspectiveFrustum.prototype.equalsEpsilon=function(e,t,i){return!!(defined(e)&&e instanceof PerspectiveFrustum)&&(update$2(this),update$2(e),CesiumMath.equalsEpsilon(this.fov,e.fov,t,i)&&CesiumMath.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,i)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,i))};var PERSPECTIVE$1=0,ORTHOGRAPHIC$1=1;function FrustumGeometry(e){var t,i,r=e.frustum,n=e.orientation,a=e.origin,o=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),s=defaultValue(e._drawNearPlane,!0);r instanceof PerspectiveFrustum?(t=PERSPECTIVE$1,i=PerspectiveFrustum.packedLength):r instanceof OrthographicFrustum&&(t=ORTHOGRAPHIC$1,i=OrthographicFrustum.packedLength),this._frustumType=t,this._frustum=r.clone(),this._origin=Cartesian3.clone(a),this._orientation=Quaternion.clone(n),this._drawNearPlane=s,this._vertexFormat=o,this._workerName="createFrustumGeometry",this.packedLength=2+i+Cartesian3.packedLength+Quaternion.packedLength+VertexFormat.packedLength}FrustumGeometry.pack=function(e,t,i){i=defaultValue(i,0);var r=e._frustumType,n=e._frustum;return t[i++]=r,r===PERSPECTIVE$1?(PerspectiveFrustum.pack(n,t,i),i+=PerspectiveFrustum.packedLength):(OrthographicFrustum.pack(n,t,i),i+=OrthographicFrustum.packedLength),Cartesian3.pack(e._origin,t,i),i+=Cartesian3.packedLength,Quaternion.pack(e._orientation,t,i),i+=Quaternion.packedLength,VertexFormat.pack(e._vertexFormat,t,i),t[i+=VertexFormat.packedLength]=e._drawNearPlane?1:0,t};var scratchPackPerspective$1=new PerspectiveFrustum,scratchPackOrthographic$1=new OrthographicFrustum,scratchPackQuaternion$1=new Quaternion,scratchPackorigin$1=new Cartesian3,scratchVertexFormat$6=new VertexFormat;function getAttributes(e,t,i,r,n,a,o,s){for(var l=e/3*2,c=0;c<4;++c)defined(t)&&(t[e]=a.x,t[e+1]=a.y,t[e+2]=a.z),defined(i)&&(i[e]=o.x,i[e+1]=o.y,i[e+2]=o.z),defined(r)&&(r[e]=s.x,r[e+1]=s.y,r[e+2]=s.z),e+=3;n[l]=0,n[l+1]=0,n[l+2]=1,n[l+3]=0,n[l+4]=1,n[l+5]=1,n[l+6]=0,n[l+7]=1}FrustumGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r,n=e[t++];n===PERSPECTIVE$1?(r=PerspectiveFrustum.unpack(e,t,scratchPackPerspective$1),t+=PerspectiveFrustum.packedLength):(r=OrthographicFrustum.unpack(e,t,scratchPackOrthographic$1),t+=OrthographicFrustum.packedLength);var a=Cartesian3.unpack(e,t,scratchPackorigin$1);t+=Cartesian3.packedLength;var o=Quaternion.unpack(e,t,scratchPackQuaternion$1);t+=Quaternion.packedLength;var s=VertexFormat.unpack(e,t,scratchVertexFormat$6),l=1===e[t+=VertexFormat.packedLength];if(!defined(i))return new FrustumGeometry({frustum:r,origin:a,orientation:o,vertexFormat:s,_drawNearPlane:l});var c=n===i._frustumType?i._frustum:void 0;return i._frustum=r.clone(c),i._frustumType=n,i._origin=Cartesian3.clone(a,i._origin),i._orientation=Quaternion.clone(o,i._orientation),i._vertexFormat=VertexFormat.clone(s,i._vertexFormat),i._drawNearPlane=l,i};var scratchRotationMatrix=new Matrix3,scratchViewMatrix=new Matrix4,scratchInverseMatrix=new Matrix4,scratchXDirection=new Cartesian3,scratchYDirection=new Cartesian3,scratchZDirection=new Cartesian3,scratchNegativeX=new Cartesian3,scratchNegativeY=new Cartesian3,scratchNegativeZ=new Cartesian3,frustumSplits=new Array(3),frustumCornersNDC$1=new Array(4);frustumCornersNDC$1[0]=new Cartesian4(-1,-1,1,1),frustumCornersNDC$1[1]=new Cartesian4(1,-1,1,1),frustumCornersNDC$1[2]=new Cartesian4(1,1,1,1),frustumCornersNDC$1[3]=new Cartesian4(-1,1,1,1);for(var scratchFrustumCorners$1=new Array(4),i$6=0;i$6<4;++i$6)scratchFrustumCorners$1[i$6]=new Cartesian4;FrustumGeometry._computeNearFarPlanes=function(e,t,i,r,n,a,o,s){var l=Matrix3.fromQuaternion(t,scratchRotationMatrix),c=defaultValue(a,scratchXDirection),u=defaultValue(o,scratchYDirection),d=defaultValue(s,scratchZDirection);c=Matrix3.getColumn(l,0,c),u=Matrix3.getColumn(l,1,u),d=Matrix3.getColumn(l,2,d),Cartesian3.normalize(c,c),Cartesian3.normalize(u,u),Cartesian3.normalize(d,d),Cartesian3.negate(c,c);var h,p,f=Matrix4.computeView(e,d,u,c,scratchViewMatrix);if(i===PERSPECTIVE$1){var m=r.projectionMatrix,g=Matrix4.multiply(m,f,scratchInverseMatrix);p=Matrix4.inverse(g,scratchInverseMatrix)}else h=Matrix4.inverseTransformation(f,scratchInverseMatrix);defined(p)?(frustumSplits[0]=r.near,frustumSplits[1]=r.far):(frustumSplits[0]=0,frustumSplits[1]=r.near,frustumSplits[2]=r.far);for(var _=0;_<2;++_)for(var y=0;y<4;++y){var v=Cartesian4.clone(frustumCornersNDC$1[y],scratchFrustumCorners$1[y]);if(defined(p)){var C=1/(v=Matrix4.multiplyByVector(p,v,v)).w;Cartesian3.multiplyByScalar(v,C,v),Cartesian3.subtract(v,e,v),Cartesian3.normalize(v,v);var T=Cartesian3.dot(d,v);Cartesian3.multiplyByScalar(v,frustumSplits[_]/T,v),Cartesian3.add(v,e,v)}else{defined(r._offCenterFrustum)&&(r=r._offCenterFrustum);var S=frustumSplits[_],A=frustumSplits[_+1];v.x=.5*(v.x*(r.right-r.left)+r.left+r.right),v.y=.5*(v.y*(r.top-r.bottom)+r.bottom+r.top),v.z=.5*(v.z*(S-A)-S-A),v.w=1,Matrix4.multiplyByVector(h,v,v)}n[12*_+3*y]=v.x,n[12*_+3*y+1]=v.y,n[12*_+3*y+2]=v.z}},FrustumGeometry.createGeometry=function(e){var t=e._frustumType,i=e._frustum,r=e._origin,n=e._orientation,a=e._drawNearPlane,o=e._vertexFormat,s=a?6:5,l=new Float64Array(72);FrustumGeometry._computeNearFarPlanes(r,n,t,i,l);var c=24;l[c]=l[12],l[c+1]=l[13],l[c+2]=l[14],l[c+3]=l[0],l[c+4]=l[1],l[c+5]=l[2],l[c+6]=l[9],l[c+7]=l[10],l[c+8]=l[11],l[c+9]=l[21],l[c+10]=l[22],l[c+11]=l[23],l[c+=12]=l[15],l[c+1]=l[16],l[c+2]=l[17],l[c+3]=l[3],l[c+4]=l[4],l[c+5]=l[5],l[c+6]=l[0],l[c+7]=l[1],l[c+8]=l[2],l[c+9]=l[12],l[c+10]=l[13],l[c+11]=l[14],l[c+=12]=l[3],l[c+1]=l[4],l[c+2]=l[5],l[c+3]=l[15],l[c+4]=l[16],l[c+5]=l[17],l[c+6]=l[18],l[c+7]=l[19],l[c+8]=l[20],l[c+9]=l[6],l[c+10]=l[7],l[c+11]=l[8],l[c+=12]=l[6],l[c+1]=l[7],l[c+2]=l[8],l[c+3]=l[18],l[c+4]=l[19],l[c+5]=l[20],l[c+6]=l[21],l[c+7]=l[22],l[c+8]=l[23],l[c+9]=l[9],l[c+10]=l[10],l[c+11]=l[11],a||(l=l.subarray(12));var u=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:l})});if(defined(o.normal)||defined(o.tangent)||defined(o.bitangent)||defined(o.st)){var d=defined(o.normal)?new Float32Array(12*s):void 0,h=defined(o.tangent)?new Float32Array(12*s):void 0,p=defined(o.bitangent)?new Float32Array(12*s):void 0,f=defined(o.st)?new Float32Array(8*s):void 0,m=scratchXDirection,g=scratchYDirection,_=scratchZDirection,y=Cartesian3.negate(m,scratchNegativeX),v=Cartesian3.negate(g,scratchNegativeY),C=Cartesian3.negate(_,scratchNegativeZ);c=0,a&&(getAttributes(c,d,h,p,f,C,m,g),c+=12),getAttributes(c,d,h,p,f,_,y,g),getAttributes(c+=12,d,h,p,f,y,C,g),getAttributes(c+=12,d,h,p,f,v,C,y),getAttributes(c+=12,d,h,p,f,m,_,g),getAttributes(c+=12,d,h,p,f,g,_,y),defined(d)&&(u.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:d})),defined(h)&&(u.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:h})),defined(p)&&(u.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p})),defined(f)&&(u.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:f}))}for(var T=new Uint16Array(6*s),S=0;S<s;++S){var A=6*S,x=4*S;T[A]=x,T[A+1]=x+1,T[A+2]=x+2,T[A+3]=x,T[A+4]=x+2,T[A+5]=x+3}return new Geometry({attributes:u,indices:T,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:BoundingSphere.fromVertices(l)})};var PERSPECTIVE=0,ORTHOGRAPHIC=1;function FrustumOutlineGeometry(e){var t,i,r=e.frustum,n=e.orientation,a=e.origin,o=defaultValue(e._drawNearPlane,!0);r instanceof PerspectiveFrustum?(t=PERSPECTIVE,i=PerspectiveFrustum.packedLength):r instanceof OrthographicFrustum&&(t=ORTHOGRAPHIC,i=OrthographicFrustum.packedLength),this._frustumType=t,this._frustum=r.clone(),this._origin=Cartesian3.clone(a),this._orientation=Quaternion.clone(n),this._drawNearPlane=o,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+i+Cartesian3.packedLength+Quaternion.packedLength}FrustumOutlineGeometry.pack=function(e,t,i){i=defaultValue(i,0);var r=e._frustumType,n=e._frustum;return t[i++]=r,r===PERSPECTIVE?(PerspectiveFrustum.pack(n,t,i),i+=PerspectiveFrustum.packedLength):(OrthographicFrustum.pack(n,t,i),i+=OrthographicFrustum.packedLength),Cartesian3.pack(e._origin,t,i),i+=Cartesian3.packedLength,Quaternion.pack(e._orientation,t,i),t[i+=Quaternion.packedLength]=e._drawNearPlane?1:0,t};var scratchPackPerspective=new PerspectiveFrustum,scratchPackOrthographic=new OrthographicFrustum,scratchPackQuaternion=new Quaternion,scratchPackorigin=new Cartesian3;function GeocoderService(){}FrustumOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r,n=e[t++];n===PERSPECTIVE?(r=PerspectiveFrustum.unpack(e,t,scratchPackPerspective),t+=PerspectiveFrustum.packedLength):(r=OrthographicFrustum.unpack(e,t,scratchPackOrthographic),t+=OrthographicFrustum.packedLength);var a=Cartesian3.unpack(e,t,scratchPackorigin);t+=Cartesian3.packedLength;var o=Quaternion.unpack(e,t,scratchPackQuaternion),s=1===e[t+=Quaternion.packedLength];if(!defined(i))return new FrustumOutlineGeometry({frustum:r,origin:a,orientation:o,_drawNearPlane:s});var l=n===i._frustumType?i._frustum:void 0;return i._frustum=r.clone(l),i._frustumType=n,i._origin=Cartesian3.clone(a,i._origin),i._orientation=Quaternion.clone(o,i._orientation),i._drawNearPlane=s,i},FrustumOutlineGeometry.createGeometry=function(e){var t=e._frustumType,i=e._frustum,r=e._origin,n=e._orientation,a=e._drawNearPlane,o=new Float64Array(24);FrustumGeometry._computeNearFarPlanes(r,n,t,i,o);for(var s,l,c=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:o})}),u=a?2:1,d=new Uint16Array(8*(u+1)),h=a?0:1;h<2;++h)l=4*h,d[s=a?8*h:0]=l,d[s+1]=l+1,d[s+2]=l+1,d[s+3]=l+2,d[s+4]=l+2,d[s+5]=l+3,d[s+6]=l+3,d[s+7]=l;for(h=0;h<2;++h)l=4*h,d[s=8*(u+h)]=l,d[s+1]=l+4,d[s+2]=l+1,d[s+3]=l+5,d[s+4]=l+2,d[s+5]=l+6,d[s+6]=l+3,d[s+7]=l+7;return new Geometry({attributes:c,indices:d,primitiveType:PrimitiveType$1.LINES,boundingSphere:BoundingSphere.fromVertices(o)})},GeocoderService.prototype.geocode=DeveloperError.throwInstantiationError;var GeocodeType={SEARCH:0,AUTOCOMPLETE:1},GeocodeType$1=Object.freeze(GeocodeType);function GeometryFactory(){DeveloperError.throwInstantiationError()}function GeometryInstanceAttribute(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=defaultValue(e.normalize,!1),this.value=e.value}function getFilenameFromUri(e){var t=new URI(e);t.normalize();var i=t.path(),r=i.lastIndexOf("/");return-1!==r&&(i=i.substr(r+1)),i}GeometryFactory.createGeometry=function(e){DeveloperError.throwInstantiationError()};var context2DsByWidthAndHeight={};function getImagePixels(e,t,i){defined(t)||(t=e.width),defined(i)||(i=e.height);var r=context2DsByWidthAndHeight[t];defined(r)||(r={},context2DsByWidthAndHeight[t]=r);var n=r[i];if(!defined(n)){var a=document.createElement("canvas");a.width=t,a.height=i,(n=a.getContext("2d")).globalCompositeOperation="copy",r[i]=n}return n.drawImage(e,0,0,t,i),n.getImageData(0,0,t,i).data}function getMagic(e,t){return getStringFromTypedArray(e,t=defaultValue(t,0),Math.min(4,e.length))}function _mergeNamespaces$1(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(i){if("default"!==i&&!(i in e)){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}))})),Object.freeze(e)}var protobuf=createCommonjsModule((function(module){
|
(function(global,undefined$1){!function(e,t,i){var r=global.protobuf=function i(r){var n=t[r];return n||e[r][0].call(n=t[r]={exports:{}},i,n,n.exports),n.exports}(i[0]);"function"==typeof undefined$1&&undefined$1.amd&&undefined$1(["long"],(function(e){return e&&e.isLong&&(r.util.Long=e,r.configure()),r})),module&&module.exports&&(module.exports=r)}({1:[function(e,t,i){t.exports=function(e,t){for(var i=[],r=2;r<arguments.length;)i.push(arguments[r++]);var n=!0;return new Promise((function(r,a){i.push((function(e){if(n)if(n=!1,e)a(e);else{for(var t=[],i=1;i<arguments.length;)t.push(arguments[i++]);r.apply(null,t)}}));try{e.apply(t||this,i)}catch(e){n&&(n=!1,a(e))}}))}},{}],2:[function(e,t,i){var r=i;r.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&"="===e.charAt(t);)++i;return Math.ceil(3*e.length)/4-i};for(var n=new Array(64),a=new Array(123),o=0;o<64;)a[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;r.encode=function(e,t,i){for(var r,a=[],o=0,s=0;t<i;){var l=e[t++];switch(s){case 0:a[o++]=n[l>>2],r=(3&l)<<4,s=1;break;case 1:a[o++]=n[r|l>>4],r=(15&l)<<2,s=2;break;case 2:a[o++]=n[r|l>>6],a[o++]=n[63&l],s=0}}return s&&(a[o++]=n[r],a[o]=61,1===s&&(a[o+1]=61)),String.fromCharCode.apply(String,a)};var s="invalid encoding";r.decode=function(e,t,i){for(var r,n=i,o=0,l=0;l<e.length;){var c=e.charCodeAt(l++);if(61===c&&o>1)break;if((c=a[c])===undefined$1)throw Error(s);switch(o){case 0:r=c,o=1;break;case 1:t[i++]=r<<2|(48&c)>>4,r=c,o=2;break;case 2:t[i++]=(15&r)<<4|(60&c)>>2,r=c,o=3;break;case 3:t[i++]=(3&r)<<6|c,o=0}}if(1===o)throw Error(s);return i-n},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},{}],3:[function(e,t,i){function r(){this._listeners={}}t.exports=r,r.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this},r.prototype.off=function(e,t){if(e===undefined$1)this._listeners={};else if(t===undefined$1)this._listeners[e]=[];else for(var i=this._listeners[e],r=0;r<i.length;)i[r].fn===t?i.splice(r,1):++r;return this},r.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var i=[],r=1;r<arguments.length;)i.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,i)}return this}},{}],4:[function(e,t,i){function r(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),i=new Uint8Array(t.buffer),r=128===i[3];function n(e,r,n){t[0]=e,r[n]=i[0],r[n+1]=i[1],r[n+2]=i[2],r[n+3]=i[3]}function a(e,r,n){t[0]=e,r[n]=i[3],r[n+1]=i[2],r[n+2]=i[1],r[n+3]=i[0]}function o(e,r){return i[0]=e[r],i[1]=e[r+1],i[2]=e[r+2],i[3]=e[r+3],t[0]}function s(e,r){return i[3]=e[r],i[2]=e[r+1],i[1]=e[r+2],i[0]=e[r+3],t[0]}e.writeFloatLE=r?n:a,e.writeFloatBE=r?a:n,e.readFloatLE=r?o:s,e.readFloatBE=r?s:o}():function(){function t(e,t,i,r){var n=t<0?1:0;if(n&&(t=-t),0===t)e(1/t>0?0:2147483648,i,r);else if(isNaN(t))e(2143289344,i,r);else if(t>34028234663852886e22)e((n<<31|2139095040)>>>0,i,r);else if(t<11754943508222875e-54)e((n<<31|Math.round(t/1401298464324817e-60))>>>0,i,r);else{var a=Math.floor(Math.log(t)/Math.LN2);e((n<<31|a+127<<23|8388607&Math.round(t*Math.pow(2,-a)*8388608))>>>0,i,r)}}function i(e,t,i){var r=e(t,i),n=2*(r>>31)+1,a=r>>>23&255,o=8388607&r;return 255===a?o?NaN:n*(1/0):0===a?1401298464324817e-60*n*o:n*Math.pow(2,a-150)*(o+8388608)}e.writeFloatLE=t.bind(null,n),e.writeFloatBE=t.bind(null,a),e.readFloatLE=i.bind(null,o),e.readFloatBE=i.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),i=new Uint8Array(t.buffer),r=128===i[7];function n(e,r,n){t[0]=e,r[n]=i[0],r[n+1]=i[1],r[n+2]=i[2],r[n+3]=i[3],r[n+4]=i[4],r[n+5]=i[5],r[n+6]=i[6],r[n+7]=i[7]}function a(e,r,n){t[0]=e,r[n]=i[7],r[n+1]=i[6],r[n+2]=i[5],r[n+3]=i[4],r[n+4]=i[3],r[n+5]=i[2],r[n+6]=i[1],r[n+7]=i[0]}function o(e,r){return i[0]=e[r],i[1]=e[r+1],i[2]=e[r+2],i[3]=e[r+3],i[4]=e[r+4],i[5]=e[r+5],i[6]=e[r+6],i[7]=e[r+7],t[0]}function s(e,r){return i[7]=e[r],i[6]=e[r+1],i[5]=e[r+2],i[4]=e[r+3],i[3]=e[r+4],i[2]=e[r+5],i[1]=e[r+6],i[0]=e[r+7],t[0]}e.writeDoubleLE=r?n:a,e.writeDoubleBE=r?a:n,e.readDoubleLE=r?o:s,e.readDoubleBE=r?s:o}():function(){function t(e,t,i,r,n,a){var o=r<0?1:0;if(o&&(r=-r),0===r)e(0,n,a+t),e(1/r>0?0:2147483648,n,a+i);else if(isNaN(r))e(0,n,a+t),e(2146959360,n,a+i);else if(r>17976931348623157e292)e(0,n,a+t),e((o<<31|2146435072)>>>0,n,a+i);else{var s;if(r<22250738585072014e-324)e((s=r/5e-324)>>>0,n,a+t),e((o<<31|s/4294967296)>>>0,n,a+i);else{var l=Math.floor(Math.log(r)/Math.LN2);1024===l&&(l=1023),e(4503599627370496*(s=r*Math.pow(2,-l))>>>0,n,a+t),e((o<<31|l+1023<<20|1048576*s&1048575)>>>0,n,a+i)}}}function i(e,t,i,r,n){var a=e(r,n+t),o=e(r,n+i),s=2*(o>>31)+1,l=o>>>20&2047,c=4294967296*(1048575&o)+a;return 2047===l?c?NaN:s*(1/0):0===l?5e-324*s*c:s*Math.pow(2,l-1075)*(c+4503599627370496)}e.writeDoubleLE=t.bind(null,n,0,4),e.writeDoubleBE=t.bind(null,a,4,0),e.readDoubleLE=i.bind(null,o,0,4),e.readDoubleBE=i.bind(null,s,4,0)}(),e}function n(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}function a(e,t,i){t[i]=e>>>24,t[i+1]=e>>>16&255,t[i+2]=e>>>8&255,t[i+3]=255&e}function o(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}t.exports=r(r)},{}],5:[function(require,module,exports){function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},{}],6:[function(e,t,i){t.exports=function(e,t,i){var r=i||8192,n=r>>>1,a=null,o=r;return function(i){if(i<1||i>n)return e(i);o+i>r&&(a=e(r),o=0);var s=t.call(a,o,o+=i);return 7&o&&(o=1+(7|o)),s}}},{}],7:[function(e,t,i){var r=i;r.length=function(e){for(var t=0,i=0,r=0;r<e.length;++r)(i=e.charCodeAt(r))<128?t+=1:i<2048?t+=2:55296==(64512&i)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},r.read=function(e,t,i){if(i-t<1)return"";for(var r,n=null,a=[],o=0;t<i;)(r=e[t++])<128?a[o++]=r:r>191&&r<224?a[o++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,a[o++]=55296+(r>>10),a[o++]=56320+(1023&r)):a[o++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,a)),o=0);return n?(o&&n.push(String.fromCharCode.apply(String,a.slice(0,o))),n.join("")):String.fromCharCode.apply(String,a.slice(0,o))},r.write=function(e,t,i){for(var r,n,a=i,o=0;o<e.length;++o)(r=e.charCodeAt(o))<128?t[i++]=r:r<2048?(t[i++]=r>>6|192,t[i++]=63&r|128):55296==(64512&r)&&56320==(64512&(n=e.charCodeAt(o+1)))?(r=65536+((1023&r)<<10)+(1023&n),++o,t[i++]=r>>18|240,t[i++]=r>>12&63|128,t[i++]=r>>6&63|128,t[i++]=63&r|128):(t[i++]=r>>12|224,t[i++]=r>>6&63|128,t[i++]=63&r|128);return i-a}},{}],8:[function(e,t,i){var r=i;function n(){r.Reader._configure(r.BufferReader),r.util._configure()}r.build="minimal",r.roots={},r.Writer=e(15),r.BufferWriter=e(16),r.Reader=e(9),r.BufferReader=e(10),r.util=e(14),r.rpc=e(11),r.configure=n,r.Writer._configure(r.BufferWriter),n()},{10:10,11:11,14:14,15:15,16:16,9:9}],9:[function(e,t,i){t.exports=l;var r,n=e(14),a=n.LongBits,o=n.utf8;function s(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var c,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new l(e);throw Error("illegal buffer")};function d(){var e=new a(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw s(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw s(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function h(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw s(this,8);return new a(h(this.buf,this.pos+=4),h(this.buf,this.pos+=4))}l.create=n.Buffer?function(e){return(l.create=function(e){return n.Buffer.isBuffer(e)?new r(e):u(e)})(e)}:u,l.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,l.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return c}),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},l.prototype.bool=function(){return 0!==this.uint32()},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return h(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|h(this.buf,this.pos+=4)},l.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var e=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},l.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var e=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw s(this,e);return this.pos+=e,t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)},l.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},l.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw s(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},l.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){if(4==(e=7&this.uint32()))break;this.skipType(e)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},l._configure=function(e){r=e;var t=n.Long?"toLong":"toNumber";n.merge(l.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},{14:14}],10:[function(e,t,i){t.exports=a;var r=e(9);(a.prototype=Object.create(r.prototype)).constructor=a;var n=e(14);function a(e){r.call(this,e)}n.Buffer&&(a.prototype._slice=n.Buffer.prototype.slice),a.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))}},{14:14,9:9}],11:[function(e,t,i){i.Service=e(12)},{12:12}],12:[function(e,t,i){t.exports=n;var r=e(14);function n(e,t,i){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(i)}(n.prototype=Object.create(r.EventEmitter.prototype)).constructor=n,n.prototype.rpcCall=function e(t,i,n,a,o){if(!a)throw TypeError("request must be specified");var s=this;if(!o)return r.asPromise(e,s,t,i,n,a);if(!s.rpcImpl)return setTimeout((function(){o(Error("already ended"))}),0),undefined$1;try{return s.rpcImpl(t,i[s.requestDelimited?"encodeDelimited":"encode"](a).finish(),(function(e,i){if(e)return s.emit("error",e,t),o(e);if(null===i)return s.end(!0),undefined$1;if(!(i instanceof n))try{i=n[s.responseDelimited?"decodeDelimited":"decode"](i)}catch(e){return s.emit("error",e,t),o(e)}return s.emit("data",i,t),o(null,i)}))}catch(e){return s.emit("error",e,t),setTimeout((function(){o(e)}),0),undefined$1}},n.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{14:14}],13:[function(e,t,i){t.exports=n;var r=e(14);function n(e,t){this.lo=e>>>0,this.hi=t>>>0}var a=n.zero=new n(0,0);a.toNumber=function(){return 0},a.zzEncode=a.zzDecode=function(){return this},a.length=function(){return 1};var o=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return a;var t=e<0;t&&(e=-e);var i=e>>>0,r=(e-i)/4294967296>>>0;return t&&(r=~r>>>0,i=~i>>>0,++i>4294967295&&(i=0,++r>4294967295&&(r=0))),new n(i,r)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if(r.isString(e)){if(!r.Long)return n.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):a},n.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+4294967296*i)}return this.lo+4294967296*this.hi},n.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var s=String.prototype.charCodeAt;n.fromHash=function(e){return e===o?a:new n((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},n.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},n.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0===i?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}},{14:14}],14:[function(e,t,i){var r=i;function n(e,t,i){for(var r=Object.keys(t),n=0;n<r.length;++n)e[r[n]]!==undefined$1&&i||(e[r[n]]=t[r[n]]);return e}function a(e){function t(e,i){if(!(this instanceof t))return new t(e,i);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),i&&n(this,i)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}r.asPromise=e(1),r.base64=e(2),r.EventEmitter=e(3),r.float=e(4),r.inquire=e(5),r.utf8=e(7),r.pool=e(6),r.LongBits=e(13),r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isNode=Boolean(global.process&&global.process.versions&&global.process.versions.node),r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.isset=r.isSet=function(e,t){var i=e[t];return!(null==i||!e.hasOwnProperty(t))&&("object"!=typeof i||(Array.isArray(i)?i.length:Object.keys(i).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=global.dcodeIO&&global.dcodeIO.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var i=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))},r.merge=n,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=a,r.ProtocolError=a("ProtocolError"),r.oneOfGetter=function(e){for(var t={},i=0;i<e.length;++i)t[e[i]]=1;return function(){for(var e=Object.keys(this),i=e.length-1;i>-1;--i)if(1===t[e[i]]&&this[e[i]]!==undefined$1&&null!==this[e[i]])return e[i]}},r.oneOfSetter=function(e){return function(t){for(var i=0;i<e.length;++i)e[i]!==t&&delete this[e[i]]}},r.lazyResolve=function(e,t){for(var i=0;i<t.length;++i)for(var r=Object.keys(t[i]),n=0;n<r.length;++n){for(var a=t[i][r[n]].split("."),o=e;a.length;)o=o[a.shift()];t[i][r[n]]=o}},r.toJSONOptions={longs:String,enums:String,bytes:String},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,i){return new e(t,i)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},{1:1,13:13,2:2,3:3,4:4,5:5,6:6,7:7}],15:[function(e,t,i){t.exports=d;var r,n=e(14),a=n.LongBits,o=n.base64,s=n.utf8;function l(e,t,i){this.fn=e,this.len=t,this.next=undefined$1,this.val=i}function c(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function d(){this.len=0,this.head=new l(c,0,0),this.tail=this.head,this.states=null}function h(e,t,i){t[i]=255&e}function p(e,t){this.len=e,this.next=undefined$1,this.val=t}function f(e,t,i){for(;e.hi;)t[i++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[i++]=127&e.lo|128,e.lo=e.lo>>>7;t[i++]=e.lo}function m(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}d.create=n.Buffer?function(){return(d.create=function(){return new r})()}:function(){return new d},d.alloc=function(e){return new n.Array(e)},n.Array!==Array&&(d.alloc=n.pool(d.alloc,n.Array.prototype.subarray)),d.prototype.push=function(e,t,i){return this.tail=this.tail.next=new l(e,t,i),this.len+=t,this},p.prototype=Object.create(l.prototype),p.prototype.fn=function(e,t,i){for(;e>127;)t[i++]=127&e|128,e>>>=7;t[i]=e},d.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},d.prototype.int32=function(e){return e<0?this.push(f,10,a.fromNumber(e)):this.uint32(e)},d.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},d.prototype.uint64=function(e){var t=a.from(e);return this.push(f,t.length(),t)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(e){var t=a.from(e).zzEncode();return this.push(f,t.length(),t)},d.prototype.bool=function(e){return this.push(h,1,e?1:0)},d.prototype.fixed32=function(e){return this.push(m,4,e>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(e){var t=a.from(e);return this.push(m,4,t.lo).push(m,4,t.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(e){return this.push(n.float.writeFloatLE,4,e)},d.prototype.double=function(e){return this.push(n.float.writeDoubleLE,8,e)};var g=n.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var r=0;r<e.length;++r)t[i+r]=e[r]};d.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this.push(h,1,0);if(n.isString(e)){var i=d.alloc(t=o.length(e));o.decode(e,i,0),e=i}return this.uint32(t).push(g,t,e)},d.prototype.string=function(e){var t=s.length(e);return t?this.uint32(t).push(s.write,t,e):this.push(h,1,0)},d.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new l(c,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(c,0,0),this.len=0),this},d.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this},d.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t},d._configure=function(e){r=e}},{14:14}],16:[function(e,t,i){t.exports=o;var r=e(15);(o.prototype=Object.create(r.prototype)).constructor=o;var n=e(14),a=n.Buffer;function o(){r.call(this)}o.alloc=function(e){return(o.alloc=n._Buffer_allocUnsafe)(e)};var s=a&&a.prototype instanceof Uint8Array&&"set"===a.prototype.set.name?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var r=0;r<e.length;)t[i++]=e[r++]};function l(e,t,i){e.length<40?n.utf8.write(e,t,i):t.utf8Write(e,i)}o.prototype.bytes=function(e){n.isString(e)&&(e=n._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this.push(s,t,e),this},o.prototype.string=function(e){var t=a.byteLength(e);return this.uint32(t),t&&this.push(l,t,e),this}},{14:14,15:15}]},{},[8])})("object"==typeof window&&window||"object"==typeof self&&self||commonjsGlobal)})),protobuf$1=Object.freeze(_mergeNamespaces$1({__proto__:null,default:protobuf},[protobuf]));function isBitSet(e,t){return 0!=(e&t)}var childrenBitmasks=[1,2,4,8],anyChildBitmask=15,cacheFlagBitmask=16,imageBitmask=64,terrainBitmask=128;function GoogleEarthEnterpriseTileInformation(e,t,i,r,n,a){this._bits=e,this.cnodeVersion=t,this.imageryVersion=i,this.terrainVersion=r,this.imageryProvider=n,this.terrainProvider=a,this.ancestorHasTerrain=!1,this.terrainState=void 0}function stringToBuffer(e){for(var t=e.length,i=new ArrayBuffer(t),r=new Uint8Array(i),n=0;n<t;++n)r[n]=e.charCodeAt(n);return i}GoogleEarthEnterpriseTileInformation.clone=function(e,t){return defined(t)?(t._bits=e._bits,t.cnodeVersion=e.cnodeVersion,t.imageryVersion=e.imageryVersion,t.terrainVersion=e.terrainVersion,t.imageryProvider=e.imageryProvider,t.terrainProvider=e.terrainProvider):t=new GoogleEarthEnterpriseTileInformation(e._bits,e.cnodeVersion,e.imageryVersion,e.terrainVersion,e.imageryProvider,e.terrainProvider),t.ancestorHasTerrain=e.ancestorHasTerrain,t.terrainState=e.terrainState,t},GoogleEarthEnterpriseTileInformation.prototype.setParent=function(e){this.ancestorHasTerrain=e.ancestorHasTerrain||this.hasTerrain()},GoogleEarthEnterpriseTileInformation.prototype.hasSubtree=function(){return isBitSet(this._bits,cacheFlagBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasImagery=function(){return isBitSet(this._bits,imageBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasTerrain=function(){return isBitSet(this._bits,terrainBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasChildren=function(){return isBitSet(this._bits,anyChildBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasChild=function(e){return isBitSet(this._bits,childrenBitmasks[e])},GoogleEarthEnterpriseTileInformation.prototype.getChildBitmask=function(){return this._bits&anyChildBitmask};var defaultKey=stringToBuffer('Eô½\vyâjE",ÍqøIFgQ\0B%Æèa,f)\bÆ4Üjb%y\nwmiÖðk¡½NuàA[ß@V\fÙ»r|3SîOlÔq°{ÀEVZwUe\v3*¬l5Å0sø3>mF8J´Ýð.ÝuÚDt"úa"\f3"So¯9D\v9Ù9L¹¿«\\P_"uxéqh;ÁÄð<VqH\'UfYNeu£aF}a?A\0×´4MÎF°Õ¸\'{Ü+»Mg0ÈÑö\\Pú[/Fn5/\'C.ë\n\f^¥se4ål.jC\'c#U©?q{gC}:¯ÍâTUýKÆâ/(íË\\Æ-f§;/*"N°k.Ý\r}}GºC²²+>Mª>}æÎIÆæx\fa1-¤O¥~q ì\r1èN\v\0nPh}=\b\r¦n£h$[kó#ó¶s³\r\v@ÀØQ]ú".jßI\0¹ wUÆïj¿{GLîÜÜF
©S+S4ÿYä8è1N¹XFkË-#p\x005"Ï1²&/çÃu-6,rt°#G·ÓÑ&
7râ\0DÏÚ3-Þ`i#i*|ÍKQ\rT9w.)ê¦P¢joP\\>TûïP[\vEm(w7ÛJfJo åpâ¹q~\fmI-zþrÇòY0»]såÉ êxì ðB|G`°½&·q¶ÇÑ3=Ó«îcÈ+S D\\qÆÌD2O<ÊÀ)=RÓaX©}e´ÜÏ\rô=ñ\b©BÚ#\tØ¿^PIøMÀËGLO÷{+ØÅ1;µoÜl\rÑÛ?âéÚ_ÔâFaZÞUϤ\0¾ýÎgñJiæ HØ]~®q N®ÀV©<rçvì)IÖ]-ãÛ6©;fjÕ¶=P^R¹KÇsWxÉô.YoÐKW>\'\'Ç`Û;íSD>?mw¢\në?R¨ÆU^1I7
ôÅ&-©¿\'TÚÃj å*x°Öprªh½÷_H±~ÀXL?fù>áeÀp§Ï8i¯ðVldI\'xtOÂÞV9\0Úw\vË-û5Oõ\bQ`Á\nZGM&30xÚÀFGâ[y`In7gS\n>éìF9²ñ4\rÆSuná\fYÙÞ)
{II¥wy¾IV.6ç\v:»Ob{ÒM1/½8{¨O!áìFpv})"x\nÝ\\ÚÞQÏðüYRe|3ßóHÚ»*uÛ`²Ôüíì5¨ÿ(1-ÈÜF|["');function GoogleEarthEnterpriseMetadata(e){var t=e;"string"==typeof t||t instanceof Resource||(t=e.url);var i=Resource.createIfNeeded(t);i.appendForwardSlash(),this._resource=i,this.imageryPresent=!0,this.protoImagery=void 0,this.terrainPresent=!0,this.negativeAltitudeExponentBias=32,this.negativeAltitudeThreshold=CesiumMath.EPSILON12,this.providers={},this.key=void 0,this._quadPacketVersion=1,this._tileInfo={},this._subtreePromises={};var r=this;this._readyPromise=requestDbRoot(this).then((function(){return r.getQuadTreePacket("",r._quadPacketVersion)})).then((function(){return!0})).otherwise((function(e){var t="An error occurred while accessing "+getMetadataResource(r,"",1).url+".";return when.reject(new RuntimeError(t))}))}Object.defineProperties(GoogleEarthEnterpriseMetadata.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},resource:{get:function(){return this._resource}},readyPromise:{get:function(){return this._readyPromise}}}),GoogleEarthEnterpriseMetadata.tileXYToQuadKey=function(e,t,i){for(var r="",n=i;n>=0;--n){var a=1<<n,o=0;isBitSet(t,a)?isBitSet(e,a)&&(o|=1):(o|=2,isBitSet(e,a)||(o|=1)),r+=o}return r},GoogleEarthEnterpriseMetadata.quadKeyToTileXY=function(e){for(var t=0,i=0,r=e.length-1,n=r;n>=0;--n){var a=1<<n,o=+e[r-n];isBitSet(o,2)?isBitSet(o,1)||(t|=a):(i|=a,isBitSet(o,1)&&(t|=a))}return{x:t,y:i,level:r}},GoogleEarthEnterpriseMetadata.prototype.isValid=function(e){var t=this.getTileInformationFromQuadKey(e);if(defined(t))return null!==t;for(var i,r=!0,n=e;n.length>1;){if(i=n.substring(n.length-1),n=n.substring(0,n.length-1),defined(t=this.getTileInformationFromQuadKey(n))){t.hasSubtree()||t.hasChild(parseInt(i))||(r=!1);break}if(null===t){r=!1;break}}return r};var taskProcessor$1=new TaskProcessor("decodeGoogleEarthEnterprisePacket"),dbrootParser,dbrootParserPromise;function populateSubtree(e,t,i){var r,n=e._tileInfo,a=t,o=n[a];if(defined(o)&&(!o.hasSubtree()||o.hasChildren()))return o;for(;void 0===o&&a.length>1;)o=n[a=a.substring(0,a.length-1)];var s=e._subtreePromises,l=s[a];return defined(l)?l.then((function(){return r=new Request({throttle:i.throttle,throttleByServer:i.throttleByServer,type:i.type,priorityFunction:i.priorityFunction}),populateSubtree(e,t,r)})):defined(o)&&o.hasSubtree()?defined(l=e.getQuadTreePacket(a,o.cnodeVersion,i))?(s[a]=l,l.then((function(){return r=new Request({throttle:i.throttle,throttleByServer:i.throttleByServer,type:i.type,priorityFunction:i.priorityFunction}),populateSubtree(e,t,r)})).always((function(){delete s[a]}))):void 0:when.reject(new RuntimeError("Couldn't load metadata for tile "+t))}function getMetadataResource(e,t,i,r){return e._resource.getDerivedResource({url:"flatfile?q2-0"+t+"-q."+i.toString(),request:r})}function requestDbRoot(e){var t=e._resource.getDerivedResource({url:"dbRoot.v5",queryParameters:{output:"proto"}});if(!defined(dbrootParserPromise)){var i=buildModuleUrl("ThirdParty/google-earth-dbroot-parser.js"),r=window.cesiumGoogleEarthDbRootParser;dbrootParserPromise=loadAndExecuteScript(i).then((function(){dbrootParser=window.cesiumGoogleEarthDbRootParser(protobuf$1),defined(r)?window.cesiumGoogleEarthDbRootParser=r:delete window.cesiumGoogleEarthDbRootParser}))}return dbrootParserPromise.then((function(){return t.fetchArrayBuffer()})).then((function(t){var i=dbrootParser.EncryptedDbRootProto.decode(new Uint8Array(t)),r=i.encryptionData,n=r.byteOffset,a=n+r.byteLength,o=e.key=r.buffer.slice(n,a);a=(n=(r=i.dbrootData).byteOffset)+r.byteLength;var s=r.buffer.slice(n,a);return taskProcessor$1.scheduleTask({buffer:s,type:"DbRoot",key:o},[s])})).then((function(t){var i=dbrootParser.DbRootProto.decode(new Uint8Array(t.buffer));if(e.imageryPresent=defaultValue(i.imageryPresent,e.imageryPresent),e.protoImagery=i.protoImagery,e.terrainPresent=defaultValue(i.terrainPresent,e.terrainPresent),defined(i.endSnippet)&&defined(i.endSnippet.model)){var r=i.endSnippet.model;e.negativeAltitudeExponentBias=defaultValue(r.negativeAltitudeExponentBias,e.negativeAltitudeExponentBias),e.negativeAltitudeThreshold=defaultValue(r.compressedNegativeAltitudeThreshold,e.negativeAltitudeThreshold)}defined(i.databaseVersion)&&(e._quadPacketVersion=defaultValue(i.databaseVersion.quadtreeVersion,e._quadPacketVersion));for(var n=e.providers,a=defaultValue(i.providerInfo,[]),o=a.length,s=0;s<o;++s){var l=a[s],c=l.copyrightString;defined(c)&&(n[l.providerId]=new Credit(c.value))}})).otherwise((function(){console.log("Failed to retrieve "+t.url+". Using defaults."),e.key=defaultKey}))}function GoogleEarthEnterpriseTerrainData(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._buffer=e.buffer,this._credits=e.credits,this._negativeAltitudeExponentBias=e.negativeAltitudeExponentBias,this._negativeElevationThreshold=e.negativeElevationThreshold;var t=defaultValue(e.childTileMask,15),i=3&t;i|=4&t?8:0,i|=8&t?4:0,this._childTileMask=i,this._createdByUpsampling=defaultValue(e.createdByUpsampling,!1),this._skirtHeight=void 0,this._bufferType=this._buffer.constructor,this._mesh=void 0,this._minimumHeight=void 0,this._maximumHeight=void 0}GoogleEarthEnterpriseMetadata.prototype.getQuadTreePacket=function(e,t,i){t=defaultValue(t,1);var r=getMetadataResource(this,e=defaultValue(e,""),t,i).fetchArrayBuffer();if(defined(r)){var n=this._tileInfo,a=this.key;return r.then((function(t){return taskProcessor$1.scheduleTask({buffer:t,quadKey:e,type:"Metadata",key:a},[t]).then((function(t){var i,r=-1;if(""!==e){r=e.length+1;var a=t[e];(i=n[e])._bits|=a._bits,delete t[e]}var o=Object.keys(t);o.sort((function(e,t){return e.length-t.length}));for(var s=o.length,l=0;l<s;++l){var c=o[l];if(null!==t[c]){var u=GoogleEarthEnterpriseTileInformation.clone(t[c]),d=c.length;if(d===r)u.setParent(i);else if(d>1){var h=n[c.substring(0,c.length-1)];u.setParent(h)}n[c]=u}else n[c]=null}}))}))}},GoogleEarthEnterpriseMetadata.prototype.populateSubtree=function(e,t,i,r){return populateSubtree(this,GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i),r)},GoogleEarthEnterpriseMetadata.prototype.getTileInformation=function(e,t,i){var r=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i);return this._tileInfo[r]},GoogleEarthEnterpriseMetadata.prototype.getTileInformationFromQuadKey=function(e){return this._tileInfo[e]},Object.defineProperties(GoogleEarthEnterpriseTerrainData.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){}}});var createMeshTaskName="createVerticesFromGoogleEarthEnterpriseBuffer",createMeshTaskProcessorNoThrottle=new TaskProcessor(createMeshTaskName),createMeshTaskProcessorThrottle=new TaskProcessor(createMeshTaskName,TerrainData.maximumAsynchronousTasks),nativeRectangleScratch=new Rectangle,rectangleScratch$6=new Rectangle;GoogleEarthEnterpriseTerrainData.prototype.createMesh=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).tilingScheme,i=e.x,r=e.y,n=e.level,a=defaultValue(e.exaggeration,1),o=defaultValue(e.exaggerationRelativeHeight,0),s=defaultValue(e.throttle,!0),l=t.ellipsoid;t.tileXYToNativeRectangle(i,r,n,nativeRectangleScratch),t.tileXYToRectangle(i,r,n,rectangleScratch$6);var c=l.cartographicToCartesian(Rectangle.center(rectangleScratch$6)),u=40075.16/(1<<n);this._skirtHeight=Math.min(8*u,1e3);var d=(s?createMeshTaskProcessorThrottle:createMeshTaskProcessorNoThrottle).scheduleTask({buffer:this._buffer,nativeRectangle:nativeRectangleScratch,rectangle:rectangleScratch$6,relativeToCenter:c,ellipsoid:l,skirtHeight:this._skirtHeight,exaggeration:a,exaggerationRelativeHeight:o,includeWebMercatorT:!0,negativeAltitudeExponentBias:this._negativeAltitudeExponentBias,negativeElevationThreshold:this._negativeElevationThreshold});if(defined(d)){var h=this;return d.then((function(e){return h._mesh=new TerrainMesh(c,new Float32Array(e.vertices),new Uint16Array(e.indices),e.indexCountWithoutSkirts,e.vertexCountWithoutSkirts,e.minimumHeight,e.maximumHeight,BoundingSphere.clone(e.boundingSphere3D),Cartesian3.clone(e.occludeePointInScaledSpace),e.numberOfAttributes,OrientedBoundingBox.clone(e.orientedBoundingBox),TerrainEncoding.clone(e.encoding),e.westIndicesSouthToNorth,e.southIndicesEastToWest,e.eastIndicesNorthToSouth,e.northIndicesWestToEast),h._minimumHeight=e.minimumHeight,h._maximumHeight=e.maximumHeight,h._buffer=void 0,h._mesh}))}},GoogleEarthEnterpriseTerrainData.prototype.interpolateHeight=function(e,t,i){var r=CesiumMath.clamp((t-e.west)/e.width,0,1),n=CesiumMath.clamp((i-e.south)/e.height,0,1);return defined(this._mesh)?interpolateMeshHeight(this,r,n):interpolateHeight(this,r,n,e)};var upsampleTaskProcessor=new TaskProcessor("upsampleQuantizedTerrainMesh",TerrainData.maximumAsynchronousTasks);GoogleEarthEnterpriseTerrainData.prototype.upsample=function(e,t,i,r,n,a,o){var s=this._mesh;if(defined(this._mesh)){var l=2*t!==n,c=2*i===a,u=e.ellipsoid,d=e.tileXYToRectangle(n,a,o),h=upsampleTaskProcessor.scheduleTask({vertices:s.vertices,indices:s.indices,indexCountWithoutSkirts:s.indexCountWithoutSkirts,vertexCountWithoutSkirts:s.vertexCountWithoutSkirts,encoding:s.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:l,isNorthChild:c,childRectangle:d,ellipsoid:u});if(defined(h)){var p=this;return h.then((function(e){var t=new Uint16Array(e.vertices),i=IndexDatatype$1.createTypedArray(t.length/3,e.indices),r=p._skirtHeight;return new QuantizedMeshTerrainData({quantizedVertices:t,indices:i,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,boundingSphere:BoundingSphere.clone(e.boundingSphere),orientedBoundingBox:OrientedBoundingBox.clone(e.orientedBoundingBox),horizonOcclusionPoint:Cartesian3.clone(e.horizonOcclusionPoint),westIndices:e.westIndices,southIndices:e.southIndices,eastIndices:e.eastIndices,northIndices:e.northIndices,westSkirtHeight:r,southSkirtHeight:r,eastSkirtHeight:r,northSkirtHeight:r,childTileMask:0,createdByUpsampling:!0,credits:p._credits})}))}}},GoogleEarthEnterpriseTerrainData.prototype.isChildAvailable=function(e,t,i,r){var n=2;return i!==2*e&&++n,r!==2*t&&(n-=2),0!=(this._childTileMask&1<<n)},GoogleEarthEnterpriseTerrainData.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};var texCoordScratch0=new Cartesian2,texCoordScratch1=new Cartesian2,texCoordScratch2=new Cartesian2,barycentricCoordinateScratch=new Cartesian3;function interpolateMeshHeight(e,t,i){for(var r=e._mesh,n=r.vertices,a=r.encoding,o=r.indices,s=0,l=o.length;s<l;s+=3){var c=o[s],u=o[s+1],d=o[s+2],h=a.decodeTextureCoordinates(n,c,texCoordScratch0),p=a.decodeTextureCoordinates(n,u,texCoordScratch1),f=a.decodeTextureCoordinates(n,d,texCoordScratch2),m=Intersections2D.computeBarycentricCoordinates(t,i,h.x,h.y,p.x,p.y,f.x,f.y,barycentricCoordinateScratch);if(m.x>=-1e-15&&m.y>=-1e-15&&m.z>=-1e-15){var g=a.decodeHeight(n,c),_=a.decodeHeight(n,u),y=a.decodeHeight(n,d);return m.x*g+m.y*_+m.z*y}}}var sizeOfUint16=Uint16Array.BYTES_PER_ELEMENT,sizeOfUint32$7=Uint32Array.BYTES_PER_ELEMENT,sizeOfInt32=Int32Array.BYTES_PER_ELEMENT,sizeOfFloat=Float32Array.BYTES_PER_ELEMENT,sizeOfDouble=Float64Array.BYTES_PER_ELEMENT;function interpolateHeight(e,t,i,r){var n=e._buffer,a=0,o=0,s=0;i>.5?(t>.5?(a=2,o=.5):a=3,s=.5):t>.5&&(a=1,o=.5);for(var l=new DataView(n),c=0,u=0;u<a;++u)c+=l.getUint32(c,!0),c+=sizeOfUint32$7;c+=sizeOfUint32$7,c+=2*sizeOfDouble;var d=CesiumMath.toRadians(180*l.getFloat64(c,!0));c+=sizeOfDouble;var h=CesiumMath.toRadians(180*l.getFloat64(c,!0));c+=sizeOfDouble;var p=r.width/d/2,f=r.height/h/2,m=l.getInt32(c,!0);c+=sizeOfInt32;var g=3*l.getInt32(c,!0);c+=sizeOfInt32,c+=sizeOfInt32;var _,y=new Array(m),v=new Array(m),C=new Array(m);for(_=0;_<m;++_)y[_]=o+l.getUint8(c++)*p,v[_]=s+l.getUint8(c++)*f,C[_]=6371010*l.getFloat32(c,!0),c+=sizeOfFloat;var T=new Array(g);for(_=0;_<g;++_)T[_]=l.getUint16(c,!0),c+=sizeOfUint16;for(_=0;_<g;_+=3){var S=T[_],A=T[_+1],x=T[_+2],E=y[S],b=y[A],P=y[x],D=v[S],w=v[A],M=v[x],I=Intersections2D.computeBarycentricCoordinates(t,i,E,D,b,w,P,M,barycentricCoordinateScratch);if(I.x>=-1e-15&&I.y>=-1e-15&&I.z>=-1e-15)return I.x*C[S]+I.y*C[A]+I.z*C[x]}}var TerrainState$2={UNKNOWN:0,NONE:1,SELF:2,PARENT:3},julianDateScratch=new JulianDate;function TerrainCache(){this._terrainCache={},this._lastTidy=JulianDate.now()}function GoogleEarthEnterpriseTerrainProvider(e){var t;if(defined((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).metadata))t=e.metadata;else{var i=Resource.createIfNeeded(e.url);t=new GoogleEarthEnterpriseMetadata(i)}this._metadata=t,this._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Rectangle(-CesiumMath.PI,-CesiumMath.PI,CesiumMath.PI,CesiumMath.PI),ellipsoid:e.ellipsoid});var r=e.credit;"string"==typeof r&&(r=new Credit(r)),this._credit=r,this._levelZeroMaximumGeometricError=40075.16,this._terrainCache=new TerrainCache,this._terrainPromises={},this._terrainRequests={},this._errorEvent=new Event,this._ready=!1;var n,a=this;this._readyPromise=t.readyPromise.then((function(e){if(!t.terrainPresent){var i=new RuntimeError("The server "+t.url+" doesn't have terrain");return n=TileProviderError.handleError(n,a,a._errorEvent,i.message,void 0,void 0,void 0,i),when.reject(i)}return TileProviderError.handleSuccess(n),a._ready=e,e})).otherwise((function(e){return n=TileProviderError.handleError(n,a,a._errorEvent,e.message,void 0,void 0,void 0,e),when.reject(e)}))}TerrainCache.prototype.add=function(e,t){this._terrainCache[e]={buffer:t,timestamp:JulianDate.now()}},TerrainCache.prototype.get=function(e){var t=this._terrainCache[e];if(defined(t))return delete this._terrainCache[e],t.buffer},TerrainCache.prototype.tidy=function(){if(JulianDate.now(julianDateScratch),JulianDate.secondsDifference(julianDateScratch,this._lastTidy)>10){for(var e=this._terrainCache,t=Object.keys(e),i=t.length,r=0;r<i;++r){var n=t[r],a=e[n];JulianDate.secondsDifference(julianDateScratch,a.timestamp)>10&&delete e[n]}JulianDate.clone(julianDateScratch,this._lastTidy)}},Object.defineProperties(GoogleEarthEnterpriseTerrainProvider.prototype,{url:{get:function(){return this._metadata.url}},proxy:{get:function(){return this._metadata.proxy}},tilingScheme:{get:function(){return this._tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});var taskProcessor=new TaskProcessor("decodeGoogleEarthEnterprisePacket");function computeChildMask(e,t,i){var r=t.getChildBitmask();if(t.terrainState===TerrainState$2.PARENT){r=0;for(var n=0;n<4;++n){var a=i.getTileInformationFromQuadKey(e+n.toString());defined(a)&&a.hasTerrain()&&(r|=1<<n)}}return r}function buildTerrainResource(e,t,i,r){return i=defined(i)&&i>0?i:1,e._metadata.resource.getDerivedResource({url:"flatfile?f1c-0"+t+"-t."+i.toString(),request:r})}GoogleEarthEnterpriseTerrainProvider.prototype.requestTileGeometry=function(e,t,i,r){var n=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i),a=this._terrainCache,o=this._metadata,s=o.getTileInformationFromQuadKey(n);if(!defined(s))return when.reject(new RuntimeError("Terrain tile doesn't exist"));var l=s.terrainState;defined(l)||(l=s.terrainState=TerrainState$2.UNKNOWN);var c,u=a.get(n);if(defined(u)){var d=o.providers[s.terrainProvider];return when.resolve(new GoogleEarthEnterpriseTerrainData({buffer:u,childTileMask:computeChildMask(n,s,o),credits:defined(d)?[d]:void 0,negativeAltitudeExponentBias:o.negativeAltitudeExponentBias,negativeElevationThreshold:o.negativeAltitudeThreshold}))}if(a.tidy(),!s.ancestorHasTerrain)return when.resolve(new HeightmapTerrainData({buffer:new Uint8Array(256),width:16,height:16}));if(l===TerrainState$2.NONE)return when.reject(new RuntimeError("Terrain tile doesn't exist"));var h=n,p=-1;switch(l){case TerrainState$2.SELF:p=s.terrainVersion;break;case TerrainState$2.PARENT:h=h.substring(0,h.length-1),p=(c=o.getTileInformationFromQuadKey(h)).terrainVersion;break;case TerrainState$2.UNKNOWN:s.hasTerrain()?p=s.terrainVersion:(h=h.substring(0,h.length-1),defined(c=o.getTileInformationFromQuadKey(h))&&c.hasTerrain()&&(p=c.terrainVersion))}if(p<0)return when.reject(new RuntimeError("Terrain tile doesn't exist"));var f,m,g=this._terrainPromises,_=this._terrainRequests;if(defined(g[h]))f=g[h],m=_[h];else{var y=buildTerrainResource(this,h,p,m=r).fetchArrayBuffer();if(!defined(y))return;f=y.then((function(e){return defined(e)?taskProcessor.scheduleTask({buffer:e,type:"Terrain",key:o.key},[e]).then((function(e){var t=o.getTileInformationFromQuadKey(h);t.terrainState=TerrainState$2.SELF,a.add(h,e[0]);for(var i=t.terrainProvider,r=e.length-1,n=0;n<r;++n){var s=h+n.toString(),l=o.getTileInformationFromQuadKey(s);defined(l)&&(a.add(s,e[n+1]),l.terrainState=TerrainState$2.PARENT,0===l.terrainProvider&&(l.terrainProvider=i))}})):when.reject(new RuntimeError("Failed to load terrain."))})),g[h]=f,_[h]=m,f=f.always((function(){delete g[h],delete _[h]}))}return f.then((function(){var e=a.get(n);if(defined(e)){var t=o.providers[s.terrainProvider];return new GoogleEarthEnterpriseTerrainData({buffer:e,childTileMask:computeChildMask(n,s,o),credits:defined(t)?[t]:void 0,negativeAltitudeExponentBias:o.negativeAltitudeExponentBias,negativeElevationThreshold:o.negativeAltitudeThreshold})}return when.reject(new RuntimeError("Failed to load terrain."))})).otherwise((function(e){return m.state===RequestState$1.CANCELLED?(r.state=m.state,when.reject(e)):(s.terrainState=TerrainState$2.NONE,when.reject(e))}))},GoogleEarthEnterpriseTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},GoogleEarthEnterpriseTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){var r=this._metadata,n=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i),a=r.getTileInformation(e,t,i);if(null===a)return!1;if(defined(a)){if(!a.ancestorHasTerrain)return!0;var o=a.terrainState;if(o===TerrainState$2.NONE)return!1;if(!(defined(o)&&o!==TerrainState$2.UNKNOWN||(a.terrainState=TerrainState$2.UNKNOWN,a.hasTerrain()))){n=n.substring(0,n.length-1);var s=r.getTileInformationFromQuadKey(n);if(!defined(s)||!s.hasTerrain())return!1}return!0}if(r.isValid(n)){var l=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.TERRAIN});r.populateSubtree(e,t,i,l)}return!1},GoogleEarthEnterpriseTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){};var PROJECTIONS=[GeographicProjection,WebMercatorProjection],PROJECTION_COUNT=PROJECTIONS.length,MITER_BREAK_SMALL=Math.cos(CesiumMath.toRadians(30)),MITER_BREAK_LARGE=Math.cos(CesiumMath.toRadians(150)),WALL_INITIAL_MIN_HEIGHT=0,WALL_INITIAL_MAX_HEIGHT=1e3;function GroundPolylineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions;this.width=defaultValue(e.width,1),this._positions=t,this.granularity=defaultValue(e.granularity,9999),this.loop=defaultValue(e.loop,!1),this.arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._ellipsoid=Ellipsoid.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(GroundPolylineGeometry.prototype,{packedLength:{get:function(){return 1+3*this._positions.length+1+1+1+Ellipsoid.packedLength+1+1}}}),GroundPolylineGeometry.setProjectionAndEllipsoid=function(e,t){for(var i=0,r=0;r<PROJECTION_COUNT;r++)if(t instanceof PROJECTIONS[r]){i=r;break}e._projectionIndex=i,e._ellipsoid=t.ellipsoid};var cart3Scratch1=new Cartesian3,cart3Scratch2=new Cartesian3,cart3Scratch3=new Cartesian3;function computeRightNormal(e,t,i,r,n){var a=getPosition$2(r,e,0,cart3Scratch1),o=getPosition$2(r,e,i,cart3Scratch2),s=getPosition$2(r,t,0,cart3Scratch3),l=direction(o,a,cart3Scratch2),c=direction(s,a,cart3Scratch3);return Cartesian3.cross(c,l,n),Cartesian3.normalize(n,n)}var interpolatedCartographicScratch$1=new Cartographic,interpolatedBottomScratch=new Cartesian3,interpolatedTopScratch=new Cartesian3,interpolatedNormalScratch=new Cartesian3;function interpolateSegment(e,t,i,r,n,a,o,s,l,c,u){if(0!==n){var d;a===ArcType$1.GEODESIC?d=new EllipsoidGeodesic(e,t,o):a===ArcType$1.RHUMB&&(d=new EllipsoidRhumbLine(e,t,o));var h=d.surfaceDistance;if(!(h<n))for(var p=computeRightNormal(e,t,r,o,interpolatedNormalScratch),f=Math.ceil(h/n),m=h/f,g=m,_=f-1,y=s.length,v=0;v<_;v++){var C=d.interpolateUsingSurfaceDistance(g,interpolatedCartographicScratch$1),T=getPosition$2(o,C,i,interpolatedBottomScratch),S=getPosition$2(o,C,r,interpolatedTopScratch);Cartesian3.pack(p,s,y),Cartesian3.pack(T,l,y),Cartesian3.pack(S,c,y),u.push(C.latitude),u.push(C.longitude),y+=3,g+=m}}}var heightlessCartographicScratch=new Cartographic;function getPosition$2(e,t,i,r){return Cartographic.clone(t,heightlessCartographicScratch),heightlessCartographicScratch.height=i,Cartographic.toCartesian(heightlessCartographicScratch,e,r)}function direction(e,t,i){return Cartesian3.subtract(e,t,i),Cartesian3.normalize(i,i),i}function tangentDirection(e,t,i,r){return r=direction(e,t,r),r=Cartesian3.cross(r,i,r),r=Cartesian3.normalize(r,r),r=Cartesian3.cross(i,r,r)}GroundPolylineGeometry.pack=function(e,t,i){var r=defaultValue(i,0),n=e._positions,a=n.length;t[r++]=a;for(var o=0;o<a;++o){var s=n[o];Cartesian3.pack(s,t,r),r+=3}return t[r++]=e.granularity,t[r++]=e.loop?1:0,t[r++]=e.arcType,Ellipsoid.pack(e._ellipsoid,t,r),r+=Ellipsoid.packedLength,t[r++]=e._projectionIndex,t[r++]=e._scene3DOnly?1:0,t},GroundPolylineGeometry.unpack=function(e,t,i){for(var r=defaultValue(t,0),n=e[r++],a=new Array(n),o=0;o<n;o++)a[o]=Cartesian3.unpack(e,r),r+=3;var s=e[r++],l=1===e[r++],c=e[r++],u=Ellipsoid.unpack(e,r);r+=Ellipsoid.packedLength;var d=e[r++],h=1===e[r++];return defined(i)||(i=new GroundPolylineGeometry({positions:a})),i._positions=a,i.granularity=s,i.loop=l,i.arcType=c,i._ellipsoid=u,i._projectionIndex=d,i._scene3DOnly=h,i};var toPreviousScratch=new Cartesian3,toNextScratch=new Cartesian3,forwardScratch=new Cartesian3,vertexUpScratch=new Cartesian3,cosine90=0,cosine180=-1;function computeVertexMiterNormal(e,t,i,r,n){var a=direction(i,t,vertexUpScratch),o=tangentDirection(e,t,a,toPreviousScratch),s=tangentDirection(r,t,a,toNextScratch);if(CesiumMath.equalsEpsilon(Cartesian3.dot(o,s),cosine180,CesiumMath.EPSILON5))return n=Cartesian3.cross(a,o,n),n=Cartesian3.normalize(n,n);n=Cartesian3.add(s,o,n),n=Cartesian3.normalize(n,n);var l=Cartesian3.cross(a,n,forwardScratch);return Cartesian3.dot(s,l)<cosine90&&(n=Cartesian3.negate(n,n)),n}var XZ_PLANE=Plane.fromPointNormal(Cartesian3.ZERO,Cartesian3.UNIT_Y),previousBottomScratch=new Cartesian3,vertexBottomScratch=new Cartesian3,vertexTopScratch=new Cartesian3,nextBottomScratch=new Cartesian3,vertexNormalScratch=new Cartesian3,intersectionScratch$1=new Cartesian3,cartographicScratch0=new Cartographic,cartographicScratch1=new Cartographic,cartographicIntersectionScratch=new Cartographic;GroundPolylineGeometry.createGeometry=function(e){var t,i,r,n,a,o,s=!e._scene3DOnly,l=e.loop,c=e._ellipsoid,u=e.granularity,d=e.arcType,h=new PROJECTIONS[e._projectionIndex](c),p=WALL_INITIAL_MIN_HEIGHT,f=WALL_INITIAL_MAX_HEIGHT,m=e._positions,g=m.length;2===g&&(l=!1);var _,y,v,C=new EllipsoidRhumbLine(void 0,void 0,c),T=[m[0]];for(i=0;i<g-1;i++)r=m[i],n=m[i+1],!defined(_=IntersectionTests.lineSegmentPlane(r,n,XZ_PLANE,intersectionScratch$1))||Cartesian3.equalsEpsilon(_,r,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(_,n,CesiumMath.EPSILON7)||(e.arcType===ArcType$1.GEODESIC?T.push(Cartesian3.clone(_)):e.arcType===ArcType$1.RHUMB&&(v=c.cartesianToCartographic(_,cartographicScratch0).longitude,a=c.cartesianToCartographic(r,cartographicScratch0),o=c.cartesianToCartographic(n,cartographicScratch1),C.setEndPoints(a,o),y=C.findIntersectionWithLongitude(v,cartographicIntersectionScratch),!defined(_=c.cartographicToCartesian(y,intersectionScratch$1))||Cartesian3.equalsEpsilon(_,r,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(_,n,CesiumMath.EPSILON7)||T.push(Cartesian3.clone(_)))),T.push(n);l&&(r=m[g-1],n=m[0],!defined(_=IntersectionTests.lineSegmentPlane(r,n,XZ_PLANE,intersectionScratch$1))||Cartesian3.equalsEpsilon(_,r,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(_,n,CesiumMath.EPSILON7)||(e.arcType===ArcType$1.GEODESIC?T.push(Cartesian3.clone(_)):e.arcType===ArcType$1.RHUMB&&(v=c.cartesianToCartographic(_,cartographicScratch0).longitude,a=c.cartesianToCartographic(r,cartographicScratch0),o=c.cartesianToCartographic(n,cartographicScratch1),C.setEndPoints(a,o),y=C.findIntersectionWithLongitude(v,cartographicIntersectionScratch),!defined(_=c.cartographicToCartesian(y,intersectionScratch$1))||Cartesian3.equalsEpsilon(_,r,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(_,n,CesiumMath.EPSILON7)||T.push(Cartesian3.clone(_)))));var S=T.length,A=new Array(S);for(i=0;i<S;i++){var x=Cartographic.fromCartesian(T[i],c);x.height=0,A[i]=x}if(!((S=(A=arrayRemoveDuplicates(A,Cartographic.equalsEpsilon)).length)<2)){var E=[],b=[],P=[],D=[],w=previousBottomScratch,M=vertexBottomScratch,I=vertexTopScratch,R=nextBottomScratch,O=vertexNormalScratch,B=A[0],L=A[1];for(w=getPosition$2(c,A[S-1],p,w),R=getPosition$2(c,L,p,R),M=getPosition$2(c,B,p,M),I=getPosition$2(c,B,f,I),O=l?computeVertexMiterNormal(w,M,I,R,O):computeRightNormal(B,L,f,c,O),Cartesian3.pack(O,b,0),Cartesian3.pack(M,P,0),Cartesian3.pack(I,D,0),E.push(B.latitude),E.push(B.longitude),interpolateSegment(B,L,p,f,u,d,c,b,P,D,E),i=1;i<S-1;++i){w=Cartesian3.clone(M,w),M=Cartesian3.clone(R,M);var F=A[i];getPosition$2(c,F,f,I),getPosition$2(c,A[i+1],p,R),computeVertexMiterNormal(w,M,I,R,O),t=b.length,Cartesian3.pack(O,b,t),Cartesian3.pack(M,P,t),Cartesian3.pack(I,D,t),E.push(F.latitude),E.push(F.longitude),interpolateSegment(A[i],A[i+1],p,f,u,d,c,b,P,D,E)}var N=A[S-1],V=A[S-2];if(M=getPosition$2(c,N,p,M),I=getPosition$2(c,N,f,I),l){var k=A[0];O=computeVertexMiterNormal(w=getPosition$2(c,V,p,w),M,I,R=getPosition$2(c,k,p,R),O)}else O=computeRightNormal(V,N,f,c,O);if(t=b.length,Cartesian3.pack(O,b,t),Cartesian3.pack(M,P,t),Cartesian3.pack(I,D,t),E.push(N.latitude),E.push(N.longitude),l){for(interpolateSegment(N,B,p,f,u,d,c,b,P,D,E),t=b.length,i=0;i<3;++i)b[t+i]=b[i],P[t+i]=P[i],D[t+i]=D[i];E.push(B.latitude),E.push(B.longitude)}return generateGeometryAttributes(l,h,P,D,b,E,s)}};var lineDirectionScratch=new Cartesian3,matrix3Scratch$1=new Matrix3,quaternionScratch$1=new Quaternion;function breakMiter(e,t,i,r){var n=direction(i,t,lineDirectionScratch),a=Cartesian3.dot(n,e);if(a>MITER_BREAK_SMALL||a<MITER_BREAK_LARGE){var o=direction(r,i,vertexUpScratch),s=a<MITER_BREAK_LARGE?CesiumMath.PI_OVER_TWO:-CesiumMath.PI_OVER_TWO,l=Quaternion.fromAxisAngle(o,s,quaternionScratch$1),c=Matrix3.fromQuaternion(l,matrix3Scratch$1);return Matrix3.multiplyByVector(c,e,e),!0}return!1}var endPosCartographicScratch=new Cartographic,normalStartpointScratch=new Cartesian3,normalEndpointScratch=new Cartesian3;function projectNormal(e,t,i,r,n){var a=Cartographic.toCartesian(t,e._ellipsoid,normalStartpointScratch),o=Cartesian3.add(a,i,normalEndpointScratch),s=!1,l=e._ellipsoid,c=l.cartesianToCartographic(o,endPosCartographicScratch);Math.abs(t.longitude-c.longitude)>CesiumMath.PI_OVER_TWO&&(s=!0,o=Cartesian3.subtract(a,i,normalEndpointScratch),c=l.cartesianToCartographic(o,endPosCartographicScratch)),c.height=0;var u=e.project(c,n);return(n=Cartesian3.subtract(u,r,n)).z=0,n=Cartesian3.normalize(n,n),s&&Cartesian3.negate(n,n),n}var adjustHeightNormalScratch=new Cartesian3,adjustHeightOffsetScratch=new Cartesian3;function adjustHeights(e,t,i,r,n,a){var o=Cartesian3.subtract(t,e,adjustHeightNormalScratch);Cartesian3.normalize(o,o);var s=i-WALL_INITIAL_MIN_HEIGHT,l=Cartesian3.multiplyByScalar(o,s,adjustHeightOffsetScratch);Cartesian3.add(e,l,n);var c=r-WALL_INITIAL_MAX_HEIGHT;l=Cartesian3.multiplyByScalar(o,c,adjustHeightOffsetScratch),Cartesian3.add(t,l,a)}var nudgeDirectionScratch=new Cartesian3;function nudgeXZ(e,t){var i=Plane.getPointDistance(XZ_PLANE,e),r=Plane.getPointDistance(XZ_PLANE,t),n=nudgeDirectionScratch;CesiumMath.equalsEpsilon(i,0,CesiumMath.EPSILON2)?(n=direction(t,e,n),Cartesian3.multiplyByScalar(n,CesiumMath.EPSILON2,n),Cartesian3.add(e,n,e)):CesiumMath.equalsEpsilon(r,0,CesiumMath.EPSILON2)&&(n=direction(e,t,n),Cartesian3.multiplyByScalar(n,CesiumMath.EPSILON2,n),Cartesian3.add(t,n,t))}function nudgeCartographic(e,t){var i=Math.abs(e.longitude),r=Math.abs(t.longitude);if(CesiumMath.equalsEpsilon(i,CesiumMath.PI,CesiumMath.EPSILON11)){var n=CesiumMath.sign(t.longitude);return e.longitude=n*(i-CesiumMath.EPSILON11),1}if(CesiumMath.equalsEpsilon(r,CesiumMath.PI,CesiumMath.EPSILON11)){var a=CesiumMath.sign(e.longitude);return t.longitude=a*(r-CesiumMath.EPSILON11),2}return 0}var startCartographicScratch$1=new Cartographic,endCartographicScratch$1=new Cartographic,segmentStartTopScratch=new Cartesian3,segmentEndTopScratch=new Cartesian3,segmentStartBottomScratch=new Cartesian3,segmentEndBottomScratch=new Cartesian3,segmentStartNormalScratch=new Cartesian3,segmentEndNormalScratch=new Cartesian3,getHeightCartographics=[startCartographicScratch$1,endCartographicScratch$1],getHeightRectangleScratch=new Rectangle,adjustHeightStartTopScratch=new Cartesian3,adjustHeightEndTopScratch=new Cartesian3,adjustHeightStartBottomScratch=new Cartesian3,adjustHeightEndBottomScratch=new Cartesian3,segmentStart2DScratch=new Cartesian3,segmentEnd2DScratch=new Cartesian3,segmentStartNormal2DScratch=new Cartesian3,segmentEndNormal2DScratch=new Cartesian3,offsetScratch$b=new Cartesian3,startUpScratch=new Cartesian3,endUpScratch=new Cartesian3,rightScratch=new Cartesian3,startPlaneNormalScratch=new Cartesian3,endPlaneNormalScratch=new Cartesian3,encodeScratch$1=new EncodedCartesian3,encodeScratch2D=new EncodedCartesian3,forwardOffset2DScratch=new Cartesian3,right2DScratch=new Cartesian3,normalNudgeScratch=new Cartesian3,scratchBoundingSpheres=[new BoundingSphere,new BoundingSphere],REFERENCE_INDICES=[0,2,1,0,3,2,0,7,3,0,4,7,0,5,4,0,1,5,5,7,4,5,6,7,5,2,6,5,1,2,3,6,2,3,7,6],REFERENCE_INDICES_LENGTH=REFERENCE_INDICES.length;function generateGeometryAttributes(e,t,i,r,n,a,o){var s,l,c,u,d,h,p=t._ellipsoid,f=i.length/3-1,m=8*f,g=4*m,_=36*f,y=m>65535?new Uint32Array(_):new Uint16Array(_),v=new Float64Array(3*m),C=new Float32Array(g),T=new Float32Array(g),S=new Float32Array(g),A=new Float32Array(g),x=new Float32Array(g);o&&(c=new Float32Array(g),u=new Float32Array(g),d=new Float32Array(g),h=new Float32Array(2*m));var E=a.length/2,b=0,P=startCartographicScratch$1;P.height=0;var D=endCartographicScratch$1;D.height=0;var w=segmentStartTopScratch,M=segmentEndTopScratch;if(o)for(l=0,s=1;s<E;s++)P.latitude=a[l],P.longitude=a[l+1],D.latitude=a[l+2],D.longitude=a[l+3],w=t.project(P,w),M=t.project(D,M),b+=Cartesian3.distance(w,M),l+=2;var I=r.length/3;M=Cartesian3.unpack(r,0,M);var R,O=0;for(l=3,s=1;s<I;s++)w=Cartesian3.clone(M,w),M=Cartesian3.unpack(r,l,M),O+=Cartesian3.distance(w,M),l+=3;l=3;var B=0,L=0,F=0,N=0,V=!1,k=Cartesian3.unpack(i,0,segmentEndBottomScratch),U=Cartesian3.unpack(r,0,segmentEndTopScratch),G=Cartesian3.unpack(n,0,segmentEndNormalScratch);e&&(breakMiter(G,Cartesian3.unpack(i,i.length-6,segmentStartBottomScratch),k,U)&&(G=Cartesian3.negate(G,G)));var $=0,z=0,H=0;for(s=0;s<f;s++){var W,j,q,X,Y=Cartesian3.clone(k,segmentStartBottomScratch),K=Cartesian3.clone(U,segmentStartTopScratch),J=Cartesian3.clone(G,segmentStartNormalScratch);if(V&&(J=Cartesian3.negate(J,J)),k=Cartesian3.unpack(i,l,segmentEndBottomScratch),U=Cartesian3.unpack(r,l,segmentEndTopScratch),V=breakMiter(G=Cartesian3.unpack(n,l,segmentEndNormalScratch),Y,k,U),P.latitude=a[B],P.longitude=a[B+1],D.latitude=a[B+2],D.longitude=a[B+3],o){var Q=nudgeCartographic(P,D);W=t.project(P,segmentStart2DScratch);var Z=direction(j=t.project(D,segmentEnd2DScratch),W,forwardOffset2DScratch);Z.y=Math.abs(Z.y),q=segmentStartNormal2DScratch,X=segmentEndNormal2DScratch,0===Q||Cartesian3.dot(Z,Cartesian3.UNIT_Y)>MITER_BREAK_SMALL?(q=projectNormal(t,P,J,W,segmentStartNormal2DScratch),X=projectNormal(t,D,G,j,segmentEndNormal2DScratch)):1===Q?(X=projectNormal(t,D,G,j,segmentEndNormal2DScratch),q.x=0,q.y=CesiumMath.sign(P.longitude-Math.abs(D.longitude)),q.z=0):(q=projectNormal(t,P,J,W,segmentStartNormal2DScratch),X.x=0,X.y=CesiumMath.sign(P.longitude-D.longitude),X.z=0)}var ee=Cartesian3.distance(K,U),te=EncodedCartesian3.fromCartesian(Y,encodeScratch$1),ie=Cartesian3.subtract(k,Y,offsetScratch$b),re=Cartesian3.normalize(ie,rightScratch),ne=Cartesian3.subtract(K,Y,startUpScratch);ne=Cartesian3.normalize(ne,ne);var ae=Cartesian3.cross(re,ne,rightScratch);ae=Cartesian3.normalize(ae,ae);var oe=Cartesian3.cross(ne,J,startPlaneNormalScratch);oe=Cartesian3.normalize(oe,oe);var se=Cartesian3.subtract(U,k,endUpScratch);se=Cartesian3.normalize(se,se);var le=Cartesian3.cross(G,se,endPlaneNormalScratch);le=Cartesian3.normalize(le,le);var ce,ue,de,he=ee/O,pe=$/O,fe=0,me=0,ge=0;if(o){fe=Cartesian3.distance(W,j),ce=EncodedCartesian3.fromCartesian(W,encodeScratch2D),ue=Cartesian3.subtract(j,W,forwardOffset2DScratch);var _e=(de=Cartesian3.normalize(ue,right2DScratch)).x;de.x=de.y,de.y=-_e,me=fe/b,ge=z/b}for(R=0;R<8;R++){var ye=N+4*R,ve=L+2*R,Ce=ye+3,Te=R<4?1:-1,Se=2===R||3===R||6===R||7===R?1:-1;Cartesian3.pack(te.high,C,ye),C[Ce]=ie.x,Cartesian3.pack(te.low,T,ye),T[Ce]=ie.y,Cartesian3.pack(oe,S,ye),S[Ce]=ie.z,Cartesian3.pack(le,A,ye),A[Ce]=he*Te,Cartesian3.pack(ae,x,ye);var Ae=pe*Se;0===Ae&&Se<0&&(Ae=9),x[Ce]=Ae,o&&(c[ye]=ce.high.x,c[ye+1]=ce.high.y,c[ye+2]=ce.low.x,c[ye+3]=ce.low.y,d[ye]=-q.y,d[ye+1]=q.x,d[ye+2]=X.y,d[ye+3]=-X.x,u[ye]=ue.x,u[ye+1]=ue.y,u[ye+2]=de.x,u[ye+3]=de.y,h[ve]=me*Te,0===(Ae=ge*Se)&&Se<0&&(Ae=9),h[ve+1]=Ae)}var xe=adjustHeightStartBottomScratch,Ee=adjustHeightEndBottomScratch,be=adjustHeightStartTopScratch,Pe=adjustHeightEndTopScratch,De=Rectangle.fromCartographicArray(getHeightCartographics,getHeightRectangleScratch),we=ApproximateTerrainHeights.getMinimumMaximumHeights(De,p),Me=we.minimumTerrainHeight,Ie=we.maximumTerrainHeight;H+=Me,H+=Ie,adjustHeights(Y,K,Me,Ie,xe,be),adjustHeights(k,U,Me,Ie,Ee,Pe);var Re=Cartesian3.multiplyByScalar(ae,CesiumMath.EPSILON5,normalNudgeScratch);Cartesian3.add(xe,Re,xe),Cartesian3.add(Ee,Re,Ee),Cartesian3.add(be,Re,be),Cartesian3.add(Pe,Re,Pe),nudgeXZ(xe,Ee),nudgeXZ(be,Pe),Cartesian3.pack(xe,v,F),Cartesian3.pack(Ee,v,F+3),Cartesian3.pack(Pe,v,F+6),Cartesian3.pack(be,v,F+9),Re=Cartesian3.multiplyByScalar(ae,-2*CesiumMath.EPSILON5,normalNudgeScratch),Cartesian3.add(xe,Re,xe),Cartesian3.add(Ee,Re,Ee),Cartesian3.add(be,Re,be),Cartesian3.add(Pe,Re,Pe),nudgeXZ(xe,Ee),nudgeXZ(be,Pe),Cartesian3.pack(xe,v,F+12),Cartesian3.pack(Ee,v,F+15),Cartesian3.pack(Pe,v,F+18),Cartesian3.pack(be,v,F+21),B+=2,l+=3,L+=16,F+=24,N+=32,$+=ee,z+=fe}l=0;var Oe=0;for(s=0;s<f;s++){for(R=0;R<REFERENCE_INDICES_LENGTH;R++)y[l+R]=REFERENCE_INDICES[R]+Oe;Oe+=8,l+=REFERENCE_INDICES_LENGTH}var Be=scratchBoundingSpheres;BoundingSphere.fromVertices(i,Cartesian3.ZERO,3,Be[0]),BoundingSphere.fromVertices(r,Cartesian3.ZERO,3,Be[1]);var Le=BoundingSphere.fromBoundingSpheres(Be);Le.radius+=H/(2*f);var Fe={position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,normalize:!1,values:v}),startHiAndForwardOffsetX:getVec4GeometryAttribute(C),startLoAndForwardOffsetY:getVec4GeometryAttribute(T),startNormalAndForwardOffsetZ:getVec4GeometryAttribute(S),endNormalAndTextureCoordinateNormalizationX:getVec4GeometryAttribute(A),rightNormalAndTextureCoordinateNormalizationY:getVec4GeometryAttribute(x)};return o&&(Fe.startHiLo2D=getVec4GeometryAttribute(c),Fe.offsetAndRight2D=getVec4GeometryAttribute(u),Fe.startEndNormals2D=getVec4GeometryAttribute(d),Fe.texcoordNormalization2D=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,normalize:!1,values:h})),new Geometry({attributes:Fe,indices:y,boundingSphere:Le})}function getVec4GeometryAttribute(e){return new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}function HeadingPitchRange(e,t,i){this.heading=defaultValue(e,0),this.pitch=defaultValue(t,0),this.range=defaultValue(i,0)}GroundPolylineGeometry._projectNormal=projectNormal,HeadingPitchRange.clone=function(e,t){if(defined(e))return defined(t)||(t=new HeadingPitchRange),t.heading=e.heading,t.pitch=e.pitch,t.range=e.range,t};var factorial=CesiumMath.factorial;function calculateCoefficientTerm(e,t,i,r,n,a){var o,s,l,c=0;if(r>0){for(s=0;s<n;s++){for(o=!1,l=0;l<a.length&&!o;l++)s===a[l]&&(o=!0);o||(a.push(s),c+=calculateCoefficientTerm(e,t,i,r-1,n,a),a.splice(a.length-1,1))}return c}for(c=1,s=0;s<n;s++){for(o=!1,l=0;l<a.length&&!o;l++)s===a[l]&&(o=!0);o||(c*=e-i[t[s]])}return c}var HermitePolynomialApproximation={type:"Hermite",getRequiredDataPoints:function(e,t){return t=defaultValue(t,0),Math.max(Math.floor((e+1)/(t+1)),2)},interpolateOrderZero:function(e,t,i,r,n){var a,o,s,l,c;defined(n)||(n=new Array(r));var u=t.length,d=new Array(r);for(a=0;a<r;a++){n[a]=0;var h=new Array(u);for(d[a]=h,o=0;o<u;o++)h[o]=[]}var p=u,f=new Array(p);for(a=0;a<p;a++)f[a]=a;var m=u-1;for(l=0;l<r;l++){for(o=0;o<p;o++)c=f[o]*r+l,d[l][0].push(i[c]);for(a=1;a<p;a++){var g=!1;for(o=0;o<p-a;o++){var _,y=t[f[o]],v=t[f[o+a]];v-y<=0?(_=i[c=f[o]*r+r*a+l],d[l][a].push(_/factorial(a))):(_=d[l][a-1][o+1]-d[l][a-1][o],d[l][a].push(_/(v-y))),g=g||0!==_}g||(m=a-1)}}for(s=0,0;s<=0;s++)for(a=s;a<=m;a++){var C=calculateCoefficientTerm(e,f,t,s,a,[]);for(l=0;l<r;l++){var T=d[l][a][0];n[l+s*r]+=T*C}}return n}},arrayScratch=[];function fillCoefficientList(e,t,i,r,n,a){for(var o,s,l=-1,c=t.length,u=c*(c+1)/2,d=0;d<n;d++){var h=Math.floor(d*u);for(o=0;o<c;o++)s=t[o]*n*(a+1)+d,e[h+o]=r[s];for(var p=1;p<c;p++){var f=0,m=Math.floor(p*(1-p)/2)+c*p,g=!1;for(o=0;o<c-p;o++){var _,y,v=i[t[o]],C=i[t[o+p]];if(C-v<=0)y=(_=r[s=t[o]*n*(a+1)+n*p+d])/CesiumMath.factorial(p),e[h+m+f]=y,f++;else{var T=Math.floor((p-1)*(2-p)/2)+c*(p-1);y=(_=e[h+T+o+1]-e[h+T+o])/(C-v),e[h+m+f]=y,f++}g=g||0!==_}g&&(l=Math.max(l,p))}}return l}HermitePolynomialApproximation.interpolate=function(e,t,i,r,n,a,o){var s=r*(a+1);defined(o)||(o=new Array(s));for(var l=0;l<s;l++)o[l]=0;var c,u=t.length,d=new Array(u*(n+1));for(c=0;c<u;c++)for(var h=0;h<n+1;h++)d[c*(n+1)+h]=c;for(var p=d.length,f=arrayScratch,m=fillCoefficientList(f,d,t,i,r,n),g=[],_=p*(p+1)/2,y=Math.min(m,a),v=0;v<=y;v++)for(c=v;c<=m;c++){g.length=0;for(var C=calculateCoefficientTerm(e,d,t,v,c,g),T=Math.floor(c*(1-c)/2)+p*c,S=0;S<r;S++){var A=f[Math.floor(S*_)+T];o[S+v*r]+=A*C}}return o};var HilbertOrder={};function rotate$1(e,t,i,r){if(0===r){1===i&&(t.x=e-1-t.x,t.y=e-1-t.y);var n=t.x;t.x=t.y,t.y=n}}function IauOrientationParameters(e,t,i,r){this.rightAscension=e,this.declination=t,this.rotation=i,this.rotationRate=r}HilbertOrder.encode2D=function(e,t,i){var r,n,a,o=Math.pow(2,e),s={x:t,y:i},l=BigInt(0);for(a=o/2;a>0;a/=2)r=(s.x&a)>0?1:0,n=(s.y&a)>0?1:0,l+=BigInt((3*r^n)*a*a),rotate$1(o,s,r,n);return l},HilbertOrder.decode2D=function(e,t){var i,r,n,a,o=Math.pow(2,e),s={x:0,y:0};for(n=1,a=t;n<o;n*=2)rotate$1(n,s,i=1&Number(a/BigInt(2)),r=1&Number(a^BigInt(i))),s.x+=n*i,s.y+=n*r,a/=BigInt(4);return[s.x,s.y]};var Iau2000Orientation={},TdtMinusTai$1=32.184,J2000d$1=2451545,c1=-.0529921,c2=-.1059842,c3=13.0120009,c4=13.3407154,c5=.9856003,c6=26.4057084,c7=13.064993,c8=.3287146,c9=1.7484877,c10=-.1589763,c11=.0036096,c12=.1643573,c13=12.9590088,dateTT=new JulianDate;function IauOrientationAxes(e){defined(e)&&"function"==typeof e||(e=Iau2000Orientation.ComputeMoon),this._computeFunction=e}Iau2000Orientation.ComputeMoon=function(e,t){defined(e)||(e=JulianDate.now()),dateTT=JulianDate.addSeconds(e,TdtMinusTai$1,dateTT);var i=JulianDate.totalDays(dateTT)-J2000d$1,r=i/TimeConstants$1.DAYS_PER_JULIAN_CENTURY,n=(125.045+c1*i)*CesiumMath.RADIANS_PER_DEGREE,a=(250.089+c2*i)*CesiumMath.RADIANS_PER_DEGREE,o=(260.008+c3*i)*CesiumMath.RADIANS_PER_DEGREE,s=(176.625+c4*i)*CesiumMath.RADIANS_PER_DEGREE,l=(357.529+c5*i)*CesiumMath.RADIANS_PER_DEGREE,c=(311.589+c6*i)*CesiumMath.RADIANS_PER_DEGREE,u=(134.963+c7*i)*CesiumMath.RADIANS_PER_DEGREE,d=(276.617+c8*i)*CesiumMath.RADIANS_PER_DEGREE,h=(34.226+c9*i)*CesiumMath.RADIANS_PER_DEGREE,p=(15.134+c10*i)*CesiumMath.RADIANS_PER_DEGREE,f=(119.743+c11*i)*CesiumMath.RADIANS_PER_DEGREE,m=(239.961+c12*i)*CesiumMath.RADIANS_PER_DEGREE,g=(25.053+c13*i)*CesiumMath.RADIANS_PER_DEGREE,_=Math.sin(n),y=Math.sin(a),v=Math.sin(o),C=Math.sin(s),T=Math.sin(l),S=Math.sin(c),A=Math.sin(u),x=Math.sin(d),E=Math.sin(h),b=Math.sin(p),P=Math.sin(f),D=Math.sin(m),w=Math.sin(g),M=Math.cos(n),I=Math.cos(a),R=Math.cos(o),O=Math.cos(s),B=Math.cos(l),L=Math.cos(c),F=Math.cos(u),N=Math.cos(d),V=Math.cos(h),k=Math.cos(p),U=Math.cos(f),G=Math.cos(m),$=Math.cos(g),z=(269.9949+.0031*r-3.8787*_-.1204*y+.07*v-.0172*C+.0072*S-.0052*b+.0043*w)*CesiumMath.RADIANS_PER_DEGREE,H=(66.5392+.013*r+1.5419*M+.0239*I-.0278*R+.0068*O-.0029*L+9e-4*F+8e-4*k-9e-4*$)*CesiumMath.RADIANS_PER_DEGREE,W=(38.3213+13.17635815*i-14e-13*i*i+3.561*_+.1208*y-.0642*v+.0158*C+.0252*T-.0066*S-.0047*A-.0046*x+.0028*E+.0052*b+.004*P+.0019*D-.0044*w)*CesiumMath.RADIANS_PER_DEGREE,j=(13.17635815-2*i*14e-13+3.561*M*c1+.1208*I*c2-.0642*R*c3+.0158*O*c4+.0252*B*c5-.0066*L*c6-.0047*F*c7-.0046*N*c8+.0028*V*c9+.0052*k*c10+.004*U*c11+.0019*G*c12-.0044*$*c13)/86400*CesiumMath.RADIANS_PER_DEGREE;return defined(t)||(t=new IauOrientationParameters),t.rightAscension=z,t.declination=H,t.rotation=W,t.rotationRate=j,t};var xAxisScratch=new Cartesian3,yAxisScratch=new Cartesian3,zAxisScratch=new Cartesian3;function computeRotationMatrix(e,t,i){var r=xAxisScratch;r.x=Math.cos(e+CesiumMath.PI_OVER_TWO),r.y=Math.sin(e+CesiumMath.PI_OVER_TWO),r.z=0;var n=Math.cos(t),a=zAxisScratch;a.x=n*Math.cos(e),a.y=n*Math.sin(e),a.z=Math.sin(t);var o=Cartesian3.cross(a,r,yAxisScratch);return defined(i)||(i=new Matrix3),i[0]=r.x,i[1]=o.x,i[2]=a.x,i[3]=r.y,i[4]=o.y,i[5]=a.y,i[6]=r.z,i[7]=o.z,i[8]=a.z,i}var rotMtxScratch=new Matrix3,quatScratch=new Quaternion;IauOrientationAxes.prototype.evaluate=function(e,t){defined(e)||(e=JulianDate.now());var i=this._computeFunction(e),r=computeRotationMatrix(i.rightAscension,i.declination,t),n=CesiumMath.zeroToTwoPi(i.rotation),a=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,n,quatScratch),o=Matrix3.fromQuaternion(Quaternion.conjugate(a,a),rotMtxScratch);return Matrix3.multiply(o,r,r)};var InterpolationAlgorithm={};function PeliasGeocoderService(e){this._url=Resource.createIfNeeded(e),this._url.appendForwardSlash()}function IonGeocoderService(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=defaultValue(e.accessToken,Ion.defaultAccessToken),i=Resource.createIfNeeded(defaultValue(e.server,Ion.defaultServer));i.appendForwardSlash();var r=Ion.getDefaultTokenCredit(t);defined(r)&&e.scene.frameState.creditDisplay.addDefaultCredit(Credit.clone(r));var n=i.getDerivedResource({url:"v1/geocode"});defined(t)&&n.appendQueryParameters({access_token:t}),this._accessToken=t,this._server=i,this._pelias=new PeliasGeocoderService(n)}function TimeInterval(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.start=defined(e.start)?JulianDate.clone(e.start):new JulianDate,this.stop=defined(e.stop)?JulianDate.clone(e.stop):new JulianDate,this.data=e.data,this.isStartIncluded=defaultValue(e.isStartIncluded,!0),this.isStopIncluded=defaultValue(e.isStopIncluded,!0)}InterpolationAlgorithm.type=void 0,InterpolationAlgorithm.getRequiredDataPoints=DeveloperError.throwInstantiationError,InterpolationAlgorithm.interpolateOrderZero=DeveloperError.throwInstantiationError,InterpolationAlgorithm.interpolate=DeveloperError.throwInstantiationError,Object.defineProperties(PeliasGeocoderService.prototype,{url:{get:function(){return this._url}}}),PeliasGeocoderService.prototype.geocode=function(e,t){return this._url.getDerivedResource({url:t===GeocodeType$1.AUTOCOMPLETE?"autocomplete":"search",queryParameters:{text:e}}).fetchJson().then((function(e){return e.features.map((function(e){var t,i=e.bbox;if(defined(i))t=Rectangle.fromDegrees(i[0],i[1],i[2],i[3]);else{var r=e.geometry.coordinates[0],n=e.geometry.coordinates[1];t=Cartesian3.fromDegrees(r,n)}return{displayName:e.properties.label,destination:t}}))}))},IonGeocoderService.prototype.geocode=function(e,t){return this._pelias.geocode(e,t)},Object.defineProperties(TimeInterval.prototype,{isEmpty:{get:function(){var e=JulianDate.compare(this.stop,this.start);return e<0||0===e&&(!this.isStartIncluded||!this.isStopIncluded)}}});var scratchInterval={start:void 0,stop:void 0,isStartIncluded:void 0,isStopIncluded:void 0,data:void 0};TimeInterval.fromIso8601=function(e,t){var i=e.iso8601.split("/");if(2!==i.length)throw new DeveloperError("options.iso8601 is an invalid ISO 8601 interval.");var r=JulianDate.fromIso8601(i[0]),n=JulianDate.fromIso8601(i[1]),a=defaultValue(e.isStartIncluded,!0),o=defaultValue(e.isStopIncluded,!0),s=e.data;return defined(t)?(t.start=r,t.stop=n,t.isStartIncluded=a,t.isStopIncluded=o,t.data=s,t):(scratchInterval.start=r,scratchInterval.stop=n,scratchInterval.isStartIncluded=a,scratchInterval.isStopIncluded=o,scratchInterval.data=s,new TimeInterval(scratchInterval))},TimeInterval.toIso8601=function(e,t){return JulianDate.toIso8601(e.start,t)+"/"+JulianDate.toIso8601(e.stop,t)},TimeInterval.clone=function(e,t){if(defined(e))return defined(t)?(t.start=e.start,t.stop=e.stop,t.isStartIncluded=e.isStartIncluded,t.isStopIncluded=e.isStopIncluded,t.data=e.data,t):new TimeInterval(e)},TimeInterval.equals=function(e,t,i){return e===t||defined(e)&&defined(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&JulianDate.equals(e.start,t.start)&&JulianDate.equals(e.stop,t.stop)&&(e.data===t.data||defined(i)&&i(e.data,t.data)))},TimeInterval.equalsEpsilon=function(e,t,i,r){return i=defaultValue(i,0),e===t||defined(e)&&defined(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&JulianDate.equalsEpsilon(e.start,t.start,i)&&JulianDate.equalsEpsilon(e.stop,t.stop,i)&&(e.data===t.data||defined(r)&&r(e.data,t.data)))},TimeInterval.intersect=function(e,t,i,r){if(!defined(t))return TimeInterval.clone(TimeInterval.EMPTY,i);var n=e.start,a=e.stop,o=t.start,s=t.stop,l=JulianDate.greaterThanOrEquals(o,n)&&JulianDate.greaterThanOrEquals(a,o),c=!l&&JulianDate.lessThanOrEquals(o,n)&&JulianDate.lessThanOrEquals(n,s);if(!l&&!c)return TimeInterval.clone(TimeInterval.EMPTY,i);var u=e.isStartIncluded,d=e.isStopIncluded,h=t.isStartIncluded,p=t.isStopIncluded,f=JulianDate.lessThan(a,s);return defined(i)||(i=new TimeInterval),i.start=l?o:n,i.isStartIncluded=u&&h||!JulianDate.equals(o,n)&&(l&&h||c&&u),i.stop=f?a:s,i.isStopIncluded=f?d:d&&p||!JulianDate.equals(s,a)&&p,i.data=defined(r)?r(e.data,t.data):e.data,i},TimeInterval.contains=function(e,t){if(e.isEmpty)return!1;var i=JulianDate.compare(e.start,t);if(0===i)return e.isStartIncluded;var r=JulianDate.compare(t,e.stop);return 0===r?e.isStopIncluded:i<0&&r<0},TimeInterval.prototype.clone=function(e){return TimeInterval.clone(this,e)},TimeInterval.prototype.equals=function(e,t){return TimeInterval.equals(this,e,t)},TimeInterval.prototype.equalsEpsilon=function(e,t,i){return TimeInterval.equalsEpsilon(this,e,t,i)},TimeInterval.prototype.toString=function(){return TimeInterval.toIso8601(this)},TimeInterval.EMPTY=Object.freeze(new TimeInterval({start:new JulianDate,stop:new JulianDate,isStartIncluded:!1,isStopIncluded:!1}));var MINIMUM_VALUE=Object.freeze(JulianDate.fromIso8601("0000-01-01T00:00:00Z")),MAXIMUM_VALUE=Object.freeze(JulianDate.fromIso8601("9999-12-31T24:00:00Z")),MAXIMUM_INTERVAL=Object.freeze(new TimeInterval({start:MINIMUM_VALUE,stop:MAXIMUM_VALUE})),Iso8601={MINIMUM_VALUE:MINIMUM_VALUE,MAXIMUM_VALUE:MAXIMUM_VALUE,MAXIMUM_INTERVAL:MAXIMUM_INTERVAL},KeyboardEventModifier={SHIFT:0,CTRL:1,ALT:2},KeyboardEventModifier$1=Object.freeze(KeyboardEventModifier);function KTX2Transcoder(){}function makeReadyPromise(){var e=KTX2Transcoder._transcodeTaskProcessor.initWebAssemblyModule({modulePath:"ThirdParty/Workers/basis_transcoder.js",wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then((function(){return KTX2Transcoder._transcodeTaskProcessor}));KTX2Transcoder._readyPromise=e}KTX2Transcoder._transcodeTaskProcessor=new TaskProcessor("transcodeKTX2",Number.POSITIVE_INFINITY),KTX2Transcoder._readyPromise=void 0,KTX2Transcoder.transcode=function(e,t){return defined(KTX2Transcoder._readyPromise)||makeReadyPromise(),KTX2Transcoder._readyPromise.then((function(i){var r;if(e instanceof ArrayBuffer){var n=new Uint8Array(e);return r={supportedTargetFormats:t,ktx2Buffer:n},i.scheduleTask(r,[e])}return r={supportedTargetFormats:t,ktx2Buffer:e},i.scheduleTask(r,[e.buffer])})).then((function(e){var t,i=e.length,r=Object.keys(e[0]),n=r.length;for(t=0;t<i;t++)for(var a=e[t],o=0;o<n;o++){var s=a[r[o]];a[r[o]]=new CompressedTextureBuffer(s.internalFormat,s.datatype,s.width,s.height,s.levelBuffer)}if(1===n){for(t=0;t<i;++t)e[t]=e[t][r[0]];1===i&&(e=e[0])}return e})).otherwise((function(e){throw e}))};var LagrangePolynomialApproximation={type:"Lagrange",getRequiredDataPoints:function(e){return Math.max(e+1,2)},interpolateOrderZero:function(e,t,i,r,n){var a,o;defined(n)||(n=new Array(r));var s=t.length;for(a=0;a<r;a++)n[a]=0;for(a=0;a<s;a++){var l=1;for(o=0;o<s;o++)if(o!==a){var c=t[a]-t[o];l*=(e-t[o])/c}for(o=0;o<r;o++)n[o]+=l*i[a*r+o]}return n}},LinearApproximation={type:"Linear"},supportedTranscoderFormats;function loadImageFromTypedArray(e){var t,i=e.uint8Array,r=e.format,n=e.request,a=defaultValue(e.flipY,!1),o=defaultValue(e.skipColorSpaceConversion,!1),s=new Blob([i],{type:r});return Resource.supportsImageBitmapOptions().then((function(e){return e?when(Resource.createImageBitmapFromBlob(s,{flipY:a,premultiplyAlpha:!1,skipColorSpaceConversion:o})):new Resource({url:t=window.URL.createObjectURL(s),request:n}).fetchImage({flipY:a,skipColorSpaceConversion:o})})).then((function(e){return defined(t)&&window.URL.revokeObjectURL(t),e})).otherwise((function(e){return defined(t)&&window.URL.revokeObjectURL(t),when.reject(e)}))}function loadKTX2(e){var t;e instanceof ArrayBuffer||ArrayBuffer.isView(e)?t=when.resolve(e):t=Resource.createIfNeeded(e).fetchArrayBuffer();return t.then((function(e){return KTX2Transcoder.transcode(e,supportedTranscoderFormats)}))}function ManagedArray(e){e=defaultValue(e,0),this._array=new Array(e),this._length=e}function MapProjection(){DeveloperError.throwInstantiationError()}LinearApproximation.getRequiredDataPoints=function(e){return 2},LinearApproximation.interpolateOrderZero=function(e,t,i,r,n){var a,o,s;defined(n)||(n=new Array(r));var l=t[0],c=t[1];for(a=0;a<r;a++)o=i[a],s=i[a+r],n[a]=((s-o)*e+c*o-l*s)/(c-l);return n},loadKTX2.setKTX2SupportedFormats=function(e,t,i,r,n,a){supportedTranscoderFormats={s3tc:e,pvrtc:t,astc:i,etc:r,etc1:n,bc7:a}},Object.defineProperties(ManagedArray.prototype,{length:{get:function(){return this._length},set:function(e){var t=this._array,i=this._length;if(e<i)for(var r=e;r<i;++r)t[r]=void 0;else e>t.length&&(t.length=e);this._length=e}},values:{get:function(){return this._array}}}),ManagedArray.prototype.get=function(e){return this._array[e]},ManagedArray.prototype.set=function(e,t){e>=this._length&&(this.length=e+1),this._array[e]=t},ManagedArray.prototype.peek=function(){return this._array[this._length-1]},ManagedArray.prototype.push=function(e){var t=this.length++;this._array[t]=e},ManagedArray.prototype.pop=function(){if(0!==this._length){var e=this._array[this._length-1];return--this.length,e}},ManagedArray.prototype.reserve=function(e){e>this._array.length&&(this._array.length=e)},ManagedArray.prototype.resize=function(e){this.length=e},ManagedArray.prototype.trim=function(e){e=defaultValue(e,this._length),this._array.length=e},Object.defineProperties(MapProjection.prototype,{ellipsoid:{get:DeveloperError.throwInstantiationError}}),MapProjection.prototype.project=DeveloperError.throwInstantiationError,MapProjection.prototype.unproject=DeveloperError.throwInstantiationError;var leftScratchArray=[],rightScratchArray=[];function merge$1(e,t,i,r,n,a){var o,s,l=n-r+1,c=a-n,u=leftScratchArray,d=rightScratchArray;for(o=0;o<l;++o)u[o]=e[r+o];for(s=0;s<c;++s)d[s]=e[n+s+1];o=0,s=0;for(var h=r;h<=a;++h){var p=u[o],f=d[s];o<l&&(s>=c||t(p,f,i)<=0)?(e[h]=p,++o):s<c&&(e[h]=f,++s)}}function sort(e,t,i,r,n){if(!(r>=n)){var a=Math.floor(.5*(r+n));sort(e,t,i,r,a),sort(e,t,i,a+1,n),merge$1(e,t,i,r,a,n)}}function mergeSort(e,t,i){var r=e.length,n=Math.ceil(.5*r);leftScratchArray.length=n,rightScratchArray.length=n,sort(e,t,i,0,r-1),leftScratchArray.length=0,rightScratchArray.length=0}var MortonOrder={};function insertOneSpacing(e){return e=1431655765&((e=858993459&((e=252645135&((e=16711935&(e^e<<8))^e<<4))^e<<2))^e<<1)}function insertTwoSpacing(e){return e=153391689&((e=51130563&((e=50393103&((e=50331903&(e^e<<16))^e<<8))^e<<4))^e<<2)}function removeOneSpacing(e){return e=65535&((e=16711935&((e=252645135&((e=858993459&((e&=1431655765)^e>>1))^e>>2))^e>>4))^e>>8)}function removeTwoSpacing(e){return e=1023&((e=4278190335&((e=50393103&((e=51130563&((e&=153391689)^e>>2))^e>>4))^e>>8))^e>>16)}function NearFarScalar(e,t,i,r){this.near=defaultValue(e,0),this.nearValue=defaultValue(t,0),this.far=defaultValue(i,1),this.farValue=defaultValue(r,0)}MortonOrder.encode2D=function(e,t){return(insertOneSpacing(e)|insertOneSpacing(t)<<1)>>>0},MortonOrder.decode2D=function(e,t){return defined(t)||(t=new Array(2)),t[0]=removeOneSpacing(e),t[1]=removeOneSpacing(e>>1),t},MortonOrder.encode3D=function(e,t,i){return insertTwoSpacing(e)|insertTwoSpacing(t)<<1|insertTwoSpacing(i)<<2},MortonOrder.decode3D=function(e,t){return defined(t)||(t=new Array(3)),t[0]=removeTwoSpacing(e),t[1]=removeTwoSpacing(e>>1),t[2]=removeTwoSpacing(e>>2),t},NearFarScalar.clone=function(e,t){if(defined(e))return defined(t)?(t.near=e.near,t.nearValue=e.nearValue,t.far=e.far,t.farValue=e.farValue,t):new NearFarScalar(e.near,e.nearValue,e.far,e.farValue)},NearFarScalar.packedLength=4,NearFarScalar.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.near,t[i++]=e.nearValue,t[i++]=e.far,t[i]=e.farValue,t},NearFarScalar.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new NearFarScalar),i.near=e[t++],i.nearValue=e[t++],i.far=e[t++],i.farValue=e[t],i},NearFarScalar.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.near===t.near&&e.nearValue===t.nearValue&&e.far===t.far&&e.farValue===t.farValue},NearFarScalar.prototype.clone=function(e){return NearFarScalar.clone(this,e)},NearFarScalar.prototype.equals=function(e){return NearFarScalar.equals(this,e)};var Visibility={NONE:-1,PARTIAL:0,FULL:1},Visibility$1=Object.freeze(Visibility);function Occluder(e,t){this._occluderPosition=Cartesian3.clone(e.center),this._occluderRadius=e.radius,this._horizonDistance=0,this._horizonPlaneNormal=void 0,this._horizonPlanePosition=void 0,this._cameraPosition=void 0,this.cameraPosition=t}var scratchCartesian3$6=new Cartesian3;Object.defineProperties(Occluder.prototype,{position:{get:function(){return this._occluderPosition}},radius:{get:function(){return this._occluderRadius}},cameraPosition:{set:function(e){e=Cartesian3.clone(e,this._cameraPosition);var t,i,r,n=Cartesian3.subtract(this._occluderPosition,e,scratchCartesian3$6),a=Cartesian3.magnitudeSquared(n),o=this._occluderRadius*this._occluderRadius;if(a>o){t=Math.sqrt(a-o),a=1/Math.sqrt(a),i=Cartesian3.multiplyByScalar(n,a,scratchCartesian3$6);var s=t*t*a;r=Cartesian3.add(e,Cartesian3.multiplyByScalar(i,s,scratchCartesian3$6),scratchCartesian3$6)}else t=Number.MAX_VALUE;this._horizonDistance=t,this._horizonPlaneNormal=i,this._horizonPlanePosition=r,this._cameraPosition=e}}}),Occluder.fromBoundingSphere=function(e,t,i){return defined(i)?(Cartesian3.clone(e.center,i._occluderPosition),i._occluderRadius=e.radius,i.cameraPosition=t,i):new Occluder(e,t)};var tempVecScratch=new Cartesian3;Occluder.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){var t=Cartesian3.subtract(e,this._occluderPosition,tempVecScratch),i=this._occluderRadius;if((i=Cartesian3.magnitudeSquared(t)-i*i)>0)return i=Math.sqrt(i)+this._horizonDistance,t=Cartesian3.subtract(e,this._cameraPosition,t),i*i>Cartesian3.magnitudeSquared(t)}return!1};var occludeePositionScratch=new Cartesian3;Occluder.prototype.isBoundingSphereVisible=function(e){var t=Cartesian3.clone(e.center,occludeePositionScratch),i=e.radius;if(this._horizonDistance!==Number.MAX_VALUE){var r=Cartesian3.subtract(t,this._occluderPosition,tempVecScratch),n=this._occluderRadius-i;if(n=Cartesian3.magnitudeSquared(r)-n*n,i<this._occluderRadius)return n>0&&(n=Math.sqrt(n)+this._horizonDistance,r=Cartesian3.subtract(t,this._cameraPosition,r),n*n+i*i>Cartesian3.magnitudeSquared(r));if(n>0){r=Cartesian3.subtract(t,this._cameraPosition,r);var a=Cartesian3.magnitudeSquared(r),o=this._occluderRadius*this._occluderRadius,s=i*i;return(this._horizonDistance*this._horizonDistance+o)*s>a*o||(n=Math.sqrt(n)+this._horizonDistance)*n+s>a}return!0}return!1};var tempScratch=new Cartesian3;Occluder.prototype.computeVisibility=function(e){var t=Cartesian3.clone(e.center),i=e.radius;if(i>this._occluderRadius)return Visibility$1.FULL;if(this._horizonDistance!==Number.MAX_VALUE){var r=Cartesian3.subtract(t,this._occluderPosition,tempScratch),n=this._occluderRadius-i,a=Cartesian3.magnitudeSquared(r);if((n=a-n*n)>0){n=Math.sqrt(n)+this._horizonDistance,r=Cartesian3.subtract(t,this._cameraPosition,r);var o=Cartesian3.magnitudeSquared(r);return n*n+i*i<o?Visibility$1.NONE:(n=a-(n=this._occluderRadius+i)*n)>0?o<(n=Math.sqrt(n)+this._horizonDistance)*n+i*i?Visibility$1.FULL:Visibility$1.PARTIAL:(r=Cartesian3.subtract(t,this._horizonPlanePosition,r),Cartesian3.dot(r,this._horizonPlaneNormal)>-i?Visibility$1.PARTIAL:Visibility$1.FULL)}}return Visibility$1.NONE};var occludeePointScratch=new Cartesian3;Occluder.computeOccludeePoint=function(e,t,i){var r=Cartesian3.clone(t),n=Cartesian3.clone(e.center),a=e.radius,o=i.length,s=Cartesian3.normalize(Cartesian3.subtract(r,n,occludeePointScratch),occludeePointScratch),l=-Cartesian3.dot(s,n),c=Occluder._anyRotationVector(n,s,l),u=Occluder._horizonToPlaneNormalDotProduct(e,s,l,c,i[0]);if(u){for(var d,h=1;h<o;++h){if(!(d=Occluder._horizonToPlaneNormalDotProduct(e,s,l,c,i[h])))return;d<u&&(u=d)}if(!(u<.0017453283658983088)){var p=a/u;return Cartesian3.add(n,Cartesian3.multiplyByScalar(s,p,occludeePointScratch),occludeePointScratch)}}};var computeOccludeePointFromRectangleScratch=[];Occluder.computeOccludeePointFromRectangle=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);var i=Rectangle.subsample(e,t,0,computeOccludeePointFromRectangleScratch),r=BoundingSphere.fromPoints(i),n=Cartesian3.ZERO;if(!Cartesian3.equals(n,r.center))return Occluder.computeOccludeePoint(new BoundingSphere(n,t.minimumRadius),r.center,i)};var tempVec0Scratch=new Cartesian3;Occluder._anyRotationVector=function(e,t,i){var r=Cartesian3.abs(t,tempVec0Scratch),n=r.x>r.y?0:1;(0===n&&r.z>r.x||1===n&&r.z>r.y)&&(n=2);var a,o=new Cartesian3;0===n?(r.x=e.x,r.y=e.y+1,r.z=e.z+1,a=Cartesian3.UNIT_X):1===n?(r.x=e.x+1,r.y=e.y,r.z=e.z+1,a=Cartesian3.UNIT_Y):(r.x=e.x+1,r.y=e.y+1,r.z=e.z,a=Cartesian3.UNIT_Z);var s=(Cartesian3.dot(t,r)+i)/-Cartesian3.dot(t,a);return Cartesian3.normalize(Cartesian3.subtract(Cartesian3.add(r,Cartesian3.multiplyByScalar(a,s,o),r),e,r),r)};var posDirectionScratch=new Cartesian3;Occluder._rotationVector=function(e,t,i,r,n){var a=Cartesian3.subtract(r,e,posDirectionScratch);if(a=Cartesian3.normalize(a,a),Cartesian3.dot(t,a)<.9999999847691291){var o=Cartesian3.cross(t,a,a);if(Cartesian3.magnitude(o)>CesiumMath.EPSILON13)return Cartesian3.normalize(o,new Cartesian3)}return n};var posScratch1=new Cartesian3,occluerPosScratch=new Cartesian3,posScratch2=new Cartesian3,horizonPlanePosScratch=new Cartesian3;function OffsetGeometryInstanceAttribute(e,t,i){e=defaultValue(e,0),t=defaultValue(t,0),i=defaultValue(i,0),this.value=new Float32Array([e,t,i])}function OpenCageGeocoderService(e,t,i){(e=Resource.createIfNeeded(e)).appendForwardSlash(),e.setQueryParameters({key:t}),this._url=e,this._params=defaultValue(i,{})}Occluder._horizonToPlaneNormalDotProduct=function(e,t,i,r,n){var a=Cartesian3.clone(n,posScratch1),o=Cartesian3.clone(e.center,occluerPosScratch),s=e.radius,l=Cartesian3.subtract(o,a,posScratch2),c=Cartesian3.magnitudeSquared(l),u=s*s;if(c<u)return!1;var d=c-u,h=Math.sqrt(d),p=h*(1/Math.sqrt(c))*h;l=Cartesian3.normalize(l,l);var f=Cartesian3.add(a,Cartesian3.multiplyByScalar(l,p,horizonPlanePosScratch),horizonPlanePosScratch),m=Math.sqrt(d-p*p),g=this._rotationVector(o,t,i,a,r),_=Cartesian3.fromElements(g.x*g.x*l.x+(g.x*g.y-g.z)*l.y+(g.x*g.z+g.y)*l.z,(g.x*g.y+g.z)*l.x+g.y*g.y*l.y+(g.y*g.z-g.x)*l.z,(g.x*g.z-g.y)*l.x+(g.y*g.z+g.x)*l.y+g.z*g.z*l.z,posScratch1);_=Cartesian3.normalize(_,_);var y=Cartesian3.multiplyByScalar(_,m,posScratch1);g=Cartesian3.normalize(Cartesian3.subtract(Cartesian3.add(f,y,posScratch2),o,posScratch2),posScratch2);var v=Cartesian3.dot(t,g);g=Cartesian3.normalize(Cartesian3.subtract(Cartesian3.subtract(f,y,g),o,g),g);var C=Cartesian3.dot(t,g);return v<C?v:C},Object.defineProperties(OffsetGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}}),OffsetGeometryInstanceAttribute.fromCartesian3=function(e){return new OffsetGeometryInstanceAttribute(e.x,e.y,e.z)},OffsetGeometryInstanceAttribute.toValue=function(e,t){return defined(t)||(t=new Float32Array([e.x,e.y,e.z])),t[0]=e.x,t[1]=e.y,t[2]=e.z,t},Object.defineProperties(OpenCageGeocoderService.prototype,{url:{get:function(){return this._url}},params:{get:function(){return this._params}}}),OpenCageGeocoderService.prototype.geocode=function(e){return this._url.getDerivedResource({url:"json",queryParameters:combine$2(this._params,{q:e})}).fetchJson().then((function(e){return e.results.map((function(e){var t,i=e.bounds;if(defined(i))t=Rectangle.fromDegrees(i.southwest.lng,i.southwest.lat,i.northeast.lng,i.northeast.lat);else{var r=e.geometry.lat,n=e.geometry.lng;t=Cartesian3.fromDegrees(r,n)}return{displayName:e.formatted,destination:t}}))}))};var Packable={packedLength:void 0,pack:DeveloperError.throwInstantiationError,unpack:DeveloperError.throwInstantiationError},PackableForInterpolation={packedInterpolationLength:void 0,convertPackedArrayForInterpolation:DeveloperError.throwInstantiationError,unpackInterpolationResult:DeveloperError.throwInstantiationError},imageSmoothingEnabledName;function measureText(e,t,i,r,n){var a=e.measureText(t);if(!!/\S/.test(t)){var o=document.defaultView.getComputedStyle(e.canvas).getPropertyValue("font-size").replace("px",""),s=document.createElement("canvas"),l=100,c=a.width+l|0,u=3*o,d=u/2;s.width=c,s.height=u;var h=s.getContext("2d");h.font=i,h.fillStyle="white",h.fillRect(0,0,s.width+1,s.height+1),r&&(h.strokeStyle="black",h.lineWidth=e.lineWidth,h.strokeText(t,50,d)),n&&(h.fillStyle="black",h.fillText(t,50,d));var p,f,m,g,_=h.getImageData(0,0,c,u).data,y=_.length,v=4*c;for(p=0;p<y;++p)if(255!==_[p]){m=p/v|0;break}for(p=y-1;p>=0;--p)if(255!==_[p]){g=p/v|0;break}var C=-1;for(p=0;p<c&&-1===C;++p)for(f=0;f<u;++f){var T=4*p+f*v;if(255!==_[T]||255!==_[T+1]||255!==_[T+2]||255!==_[T+3]){C=p;break}}return{width:a.width,height:g-m,ascent:d-m,descent:g-d,minx:C-50}}return{width:a.width,height:0,ascent:0,descent:0,minx:0}}function writeTextToCanvas(e,t){if(""!==e){t=defaultValue(t,defaultValue.EMPTY_OBJECT);var i=defaultValue(t.font,"10px sans-serif"),r=defaultValue(t.stroke,!1),n=defaultValue(t.fill,!0),a=defaultValue(t.strokeWidth,1),o=defaultValue(t.backgroundColor,Color.TRANSPARENT),s=defaultValue(t.padding,0),l=2*s,c=document.createElement("canvas");c.width=1,c.height=1,c.style.font=i;var u=c.getContext("2d");defined(imageSmoothingEnabledName)||(defined(u.imageSmoothingEnabled)?imageSmoothingEnabledName="imageSmoothingEnabled":defined(u.mozImageSmoothingEnabled)?imageSmoothingEnabledName="mozImageSmoothingEnabled":defined(u.webkitImageSmoothingEnabled)?imageSmoothingEnabledName="webkitImageSmoothingEnabled":defined(u.msImageSmoothingEnabled)&&(imageSmoothingEnabledName="msImageSmoothingEnabled")),u.font=i,u.lineJoin="round",u.lineWidth=a,u[imageSmoothingEnabledName]=!1,c.style.visibility="hidden",document.body.appendChild(c);var d=measureText(u,e,i,r,n);c.dimensions=d,document.body.removeChild(c),c.style.visibility="";var h=-d.minx,p=Math.ceil(d.width)+h+l,f=d.height+l,m=f-(f-d.ascent+s)+l;if(c.width=p,c.height=f,u.font=i,u.lineJoin="round",u.lineWidth=a,u[imageSmoothingEnabledName]=!1,o!==Color.TRANSPARENT&&(u.fillStyle=o.toCssColorString(),u.fillRect(0,0,c.width,c.height)),r){var g=defaultValue(t.strokeColor,Color.BLACK);u.strokeStyle=g.toCssColorString(),u.strokeText(e,h+s,m)}if(n){var _=defaultValue(t.fillColor,Color.WHITE);u.fillStyle=_.toCssColorString(),u.fillText(e,h+s,m)}return c}}function PinBuilder(){this._cache={}}PinBuilder.prototype.fromColor=function(e,t){return createPin(void 0,void 0,e,t,this._cache)},PinBuilder.prototype.fromUrl=function(e,t,i){return createPin(e,void 0,t,i,this._cache)},PinBuilder.prototype.fromMakiIconId=function(e,t,i){return createPin(buildModuleUrl("Assets/Textures/maki/"+encodeURIComponent(e)+".png"),void 0,t,i,this._cache)},PinBuilder.prototype.fromText=function(e,t,i){return createPin(void 0,e,t,i,this._cache)};var colorScratch$7=new Color;function drawPin(e,t,i){e.save(),e.scale(i/24,i/24),e.fillStyle=t.toCssColorString(),e.strokeStyle=t.brighten(.6,colorScratch$7).toCssColorString(),e.lineWidth=.846,e.beginPath(),e.moveTo(6.72,.422),e.lineTo(17.28,.422),e.bezierCurveTo(18.553,.422,19.577,1.758,19.577,3.415),e.lineTo(19.577,10.973),e.bezierCurveTo(19.577,12.63,18.553,13.966,17.282,13.966),e.lineTo(14.386,14.008),e.lineTo(11.826,23.578),e.lineTo(9.614,14.008),e.lineTo(6.719,13.965),e.bezierCurveTo(5.446,13.983,4.422,12.629,4.422,10.972),e.lineTo(4.422,3.416),e.bezierCurveTo(4.423,1.76,5.447,.423,6.718,.423),e.closePath(),e.fill(),e.stroke(),e.restore()}function drawIcon(e,t,i){var r=i/2.5,n=r,a=r;t.width>t.height?a=r*(t.height/t.width):t.width<t.height&&(n=r*(t.width/t.height));var o=Math.round((i-n)/2),s=Math.round(7/24*i-a/2);e.globalCompositeOperation="destination-out",e.drawImage(t,o-1,s,n,a),e.drawImage(t,o,s-1,n,a),e.drawImage(t,o+1,s,n,a),e.drawImage(t,o,s+1,n,a),e.globalCompositeOperation="destination-over",e.fillStyle=Color.BLACK.toCssColorString(),e.fillRect(o-1,s-1,n+2,a+2),e.globalCompositeOperation="destination-out",e.drawImage(t,o,s,n,a),e.globalCompositeOperation="destination-over",e.fillStyle=Color.WHITE.toCssColorString(),e.fillRect(o-1,s-2,n+2,a+2)}var stringifyScratch=new Array(4);function createPin(e,t,i,r,n){stringifyScratch[0]=e,stringifyScratch[1]=t,stringifyScratch[2]=i,stringifyScratch[3]=r;var a=JSON.stringify(stringifyScratch),o=n[a];if(defined(o))return o;var s=document.createElement("canvas");s.width=r,s.height=r;var l=s.getContext("2d");if(drawPin(l,i,r),defined(e)){var c=Resource.createIfNeeded(e).fetchImage().then((function(e){return drawIcon(l,e,r),n[a]=s,s}));return n[a]=c,c}if(defined(t)){var u=writeTextToCanvas(t,{font:"bold "+r+"px sans-serif"});drawIcon(l,u,r)}return n[a]=s,s}function PlaneGeometry(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=defaultValue(e.vertexFormat,VertexFormat.DEFAULT);this._vertexFormat=t,this._workerName="createPlaneGeometry"}PlaneGeometry.packedLength=VertexFormat.packedLength,PlaneGeometry.pack=function(e,t,i){return i=defaultValue(i,0),VertexFormat.pack(e._vertexFormat,t,i),t};var scratchVertexFormat$5=new VertexFormat,scratchOptions$9={vertexFormat:scratchVertexFormat$5};PlaneGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=VertexFormat.unpack(e,t,scratchVertexFormat$5);return defined(i)?(i._vertexFormat=VertexFormat.clone(r,i._vertexFormat),i):new PlaneGeometry(scratchOptions$9)};var min$1=new Cartesian3(-.5,-.5,0),max$1=new Cartesian3(.5,.5,0);function PlaneOutlineGeometry(){this._workerName="createPlaneOutlineGeometry"}PlaneGeometry.createGeometry=function(e){var t,i,r=e._vertexFormat,n=new GeometryAttributes;if(r.position){if((i=new Float64Array(12))[0]=min$1.x,i[1]=min$1.y,i[2]=0,i[3]=max$1.x,i[4]=min$1.y,i[5]=0,i[6]=max$1.x,i[7]=max$1.y,i[8]=0,i[9]=min$1.x,i[10]=max$1.y,i[11]=0,n.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:i}),r.normal){var a=new Float32Array(12);a[0]=0,a[1]=0,a[2]=1,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=1,a[9]=0,a[10]=0,a[11]=1,n.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:a})}if(r.st){var o=new Float32Array(8);o[0]=0,o[1]=0,o[2]=1,o[3]=0,o[4]=1,o[5]=1,o[6]=0,o[7]=1,n.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:o})}if(r.tangent){var s=new Float32Array(12);s[0]=1,s[1]=0,s[2]=0,s[3]=1,s[4]=0,s[5]=0,s[6]=1,s[7]=0,s[8]=0,s[9]=1,s[10]=0,s[11]=0,n.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:s})}if(r.bitangent){var l=new Float32Array(12);l[0]=0,l[1]=1,l[2]=0,l[3]=0,l[4]=1,l[5]=0,l[6]=0,l[7]=1,l[8]=0,l[9]=0,l[10]=1,l[11]=0,n.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:l})}(t=new Uint16Array(6))[0]=0,t[1]=1,t[2]=2,t[3]=0,t[4]=2,t[5]=3}return new Geometry({attributes:n,indices:t,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,Math.sqrt(2))})},PlaneOutlineGeometry.packedLength=0,PlaneOutlineGeometry.pack=function(e,t){return t},PlaneOutlineGeometry.unpack=function(e,t,i){return defined(i)?i:new PlaneOutlineGeometry};var min=new Cartesian3(-.5,-.5,0),max=new Cartesian3(.5,.5,0);PlaneOutlineGeometry.createGeometry=function(){var e=new GeometryAttributes,t=new Uint16Array(8),i=new Float64Array(12);return i[0]=min.x,i[1]=min.y,i[2]=min.z,i[3]=max.x,i[4]=min.y,i[5]=min.z,i[6]=max.x,i[7]=max.y,i[8]=min.z,i[9]=min.x,i[10]=max.y,i[11]=min.z,e.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:i}),t[0]=0,t[1]=1,t[2]=1,t[3]=2,t[4]=2,t[5]=3,t[6]=3,t[7]=0,new Geometry({attributes:e,indices:t,primitiveType:PrimitiveType$1.LINES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,Math.sqrt(2))})};var coords=new Cartesian3;function pointInsideTriangle(e,t,i,r){return barycentricCoordinates(e,t,i,r,coords),coords.x>0&&coords.y>0&&coords.z>0}var scratchCarto1=new Cartographic,scratchCarto2=new Cartographic;function adjustPosHeightsForNormal(e,t,i,r){var n=r.cartesianToCartographic(e,scratchCarto1).height,a=r.cartesianToCartographic(t,scratchCarto2);a.height=n,r.cartographicToCartesian(a,t);var o=r.cartesianToCartographic(i,scratchCarto2);o.height=n-100,r.cartographicToCartesian(o,i)}var scratchBoundingRectangle=new BoundingRectangle,scratchPosition$a=new Cartesian3,scratchNormal$2=new Cartesian3,scratchTangent$1=new Cartesian3,scratchBitangent$1=new Cartesian3,p1Scratch=new Cartesian3,p2Scratch=new Cartesian3,scratchPerPosNormal=new Cartesian3,scratchPerPosTangent=new Cartesian3,scratchPerPosBitangent=new Cartesian3,appendTextureCoordinatesOrigin=new Cartesian2,appendTextureCoordinatesCartesian2=new Cartesian2,appendTextureCoordinatesCartesian3=new Cartesian3,appendTextureCoordinatesQuaternion=new Quaternion,appendTextureCoordinatesMatrix3=new Matrix3,tangentMatrixScratch=new Matrix3;function computeAttributes$2(e){var t=e.vertexFormat,i=e.geometry,r=e.shadowVolume,n=i.attributes.position.values,a=n.length,o=e.wall,s=e.top||o,l=e.bottom||o;if(t.st||t.normal||t.tangent||t.bitangent||r){var c=e.boundingRectangle,u=e.tangentPlane,d=e.ellipsoid,h=e.stRotation,p=e.perPositionHeight,f=appendTextureCoordinatesOrigin;f.x=c.x,f.y=c.y;var m,g=t.st?new Float32Array(a/3*2):void 0;t.normal&&(m=p&&s&&!o?i.attributes.normal.values:new Float32Array(a));var _=t.tangent?new Float32Array(a):void 0,y=t.bitangent?new Float32Array(a):void 0,v=r?new Float32Array(a):void 0,C=0,T=0,S=scratchNormal$2,A=scratchTangent$1,x=scratchBitangent$1,E=!0,b=appendTextureCoordinatesMatrix3,P=tangentMatrixScratch;if(0!==h){var D=Quaternion.fromAxisAngle(u._plane.normal,h,appendTextureCoordinatesQuaternion);b=Matrix3.fromQuaternion(D,b),D=Quaternion.fromAxisAngle(u._plane.normal,-h,appendTextureCoordinatesQuaternion),P=Matrix3.fromQuaternion(D,P)}else b=Matrix3.clone(Matrix3.IDENTITY,b),P=Matrix3.clone(Matrix3.IDENTITY,P);var w=0,M=0;s&&l&&(w=a/2,M=a/3,a/=2);for(var I=0;I<a;I+=3){var R=Cartesian3.fromArray(n,I,appendTextureCoordinatesCartesian3);if(t.st){var O=Matrix3.multiplyByVector(b,R,scratchPosition$a);O=d.scaleToGeodeticSurface(O,O);var B=u.projectPointOntoPlane(O,appendTextureCoordinatesCartesian2);Cartesian2.subtract(B,f,B);var L=CesiumMath.clamp(B.x/c.width,0,1),F=CesiumMath.clamp(B.y/c.height,0,1);l&&(g[C+M]=L,g[C+1+M]=F),s&&(g[C]=L,g[C+1]=F),C+=2}if(t.normal||t.tangent||t.bitangent||r){var N=T+1,V=T+2;if(o){if(I+3<a){var k=Cartesian3.fromArray(n,I+3,p1Scratch);if(E){var U=Cartesian3.fromArray(n,I+a,p2Scratch);p&&adjustPosHeightsForNormal(R,k,U,d),Cartesian3.subtract(k,R,k),Cartesian3.subtract(U,R,U),S=Cartesian3.normalize(Cartesian3.cross(U,k,S),S),E=!1}Cartesian3.equalsEpsilon(k,R,CesiumMath.EPSILON10)&&(E=!0)}(t.tangent||t.bitangent)&&(x=d.geodeticSurfaceNormal(R,x),t.tangent&&(A=Cartesian3.normalize(Cartesian3.cross(x,S,A),A)))}else S=d.geodeticSurfaceNormal(R,S),(t.tangent||t.bitangent)&&(p&&(scratchPerPosNormal=Cartesian3.fromArray(m,T,scratchPerPosNormal),scratchPerPosTangent=Cartesian3.cross(Cartesian3.UNIT_Z,scratchPerPosNormal,scratchPerPosTangent),scratchPerPosTangent=Cartesian3.normalize(Matrix3.multiplyByVector(P,scratchPerPosTangent,scratchPerPosTangent),scratchPerPosTangent),t.bitangent&&(scratchPerPosBitangent=Cartesian3.normalize(Cartesian3.cross(scratchPerPosNormal,scratchPerPosTangent,scratchPerPosBitangent),scratchPerPosBitangent))),A=Cartesian3.cross(Cartesian3.UNIT_Z,S,A),A=Cartesian3.normalize(Matrix3.multiplyByVector(P,A,A),A),t.bitangent&&(x=Cartesian3.normalize(Cartesian3.cross(S,A,x),x)));t.normal&&(e.wall?(m[T+w]=S.x,m[N+w]=S.y,m[V+w]=S.z):l&&(m[T+w]=-S.x,m[N+w]=-S.y,m[V+w]=-S.z),(s&&!p||o)&&(m[T]=S.x,m[N]=S.y,m[V]=S.z)),r&&(o&&(S=d.geodeticSurfaceNormal(R,S)),v[T+w]=-S.x,v[N+w]=-S.y,v[V+w]=-S.z),t.tangent&&(e.wall?(_[T+w]=A.x,_[N+w]=A.y,_[V+w]=A.z):l&&(_[T+w]=-A.x,_[N+w]=-A.y,_[V+w]=-A.z),s&&(p?(_[T]=scratchPerPosTangent.x,_[N]=scratchPerPosTangent.y,_[V]=scratchPerPosTangent.z):(_[T]=A.x,_[N]=A.y,_[V]=A.z))),t.bitangent&&(l&&(y[T+w]=x.x,y[N+w]=x.y,y[V+w]=x.z),s&&(p?(y[T]=scratchPerPosBitangent.x,y[N]=scratchPerPosBitangent.y,y[V]=scratchPerPosBitangent.z):(y[T]=x.x,y[N]=x.y,y[V]=x.z))),T+=3}}t.st&&(i.attributes.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:g})),t.normal&&(i.attributes.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:m})),t.tangent&&(i.attributes.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:_})),t.bitangent&&(i.attributes.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:y})),r&&(i.attributes.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:v}))}if(e.extrude&&defined(e.offsetAttribute)){var G=n.length/3,$=new Uint8Array(G);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)s&&l||o?$=arrayFill($,1,0,G/2):s&&($=arrayFill($,1));else $=arrayFill($,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1);i.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:$})}return i}var startCartographicScratch=new Cartographic,endCartographicScratch=new Cartographic,idlCross={westOverIDL:0,eastOverIDL:0},ellipsoidGeodesic=new EllipsoidGeodesic;function computeRectangle$1(e,t,i,r,n){if(n=defaultValue(n,new Rectangle),!defined(e)||e.length<3)return n.west=0,n.north=0,n.south=0,n.east=0,n;if(i===ArcType$1.RHUMB)return Rectangle.fromCartesianArray(e,t,n);ellipsoidGeodesic.ellipsoid.equals(t)||(ellipsoidGeodesic=new EllipsoidGeodesic(void 0,void 0,t)),n.west=Number.POSITIVE_INFINITY,n.east=Number.NEGATIVE_INFINITY,n.south=Number.POSITIVE_INFINITY,n.north=Number.NEGATIVE_INFINITY,idlCross.westOverIDL=Number.POSITIVE_INFINITY,idlCross.eastOverIDL=Number.NEGATIVE_INFINITY;for(var a,o=1/CesiumMath.chordLength(r,t.maximumRadius),s=e.length,l=t.cartesianToCartographic(e[0],endCartographicScratch),c=startCartographicScratch,u=1;u<s;u++)a=c,c=l,l=t.cartesianToCartographic(e[u],a),ellipsoidGeodesic.setEndPoints(c,l),interpolateAndGrowRectangle(ellipsoidGeodesic,o,n,idlCross);return a=c,c=l,l=t.cartesianToCartographic(e[0],a),ellipsoidGeodesic.setEndPoints(c,l),interpolateAndGrowRectangle(ellipsoidGeodesic,o,n,idlCross),n.east-n.west>idlCross.eastOverIDL-idlCross.westOverIDL&&(n.west=idlCross.westOverIDL,n.east=idlCross.eastOverIDL,n.east>CesiumMath.PI&&(n.east=n.east-CesiumMath.TWO_PI),n.west>CesiumMath.PI&&(n.west=n.west-CesiumMath.TWO_PI)),n}var interpolatedCartographicScratch=new Cartographic;function interpolateAndGrowRectangle(e,t,i,r){for(var n=e.surfaceDistance,a=Math.ceil(n*t),o=a>0?n/(a-1):Number.POSITIVE_INFINITY,s=0,l=0;l<a;l++){var c=e.interpolateUsingSurfaceDistance(s,interpolatedCartographicScratch);s+=o;var u=c.longitude,d=c.latitude;i.west=Math.min(i.west,u),i.east=Math.max(i.east,u),i.south=Math.min(i.south,d),i.north=Math.max(i.north,d);var h=u>=0?u:u+CesiumMath.TWO_PI;r.westOverIDL=Math.min(r.westOverIDL,h),r.eastOverIDL=Math.max(r.eastOverIDL,h)}}var createGeometryFromPositionsExtrudedPositions=[];function createGeometryFromPositionsExtruded$1(e,t,i,r,n,a,o,s,l){var c,u={walls:[]};if(a||o){var d,h,p=PolygonGeometryLibrary.createGeometryFromPositions(e,t,i,n,s,l),f=p.attributes.position.values,m=p.indices;if(a&&o){var g=f.concat(f);d=g.length/3,(h=IndexDatatype$1.createTypedArray(d,2*m.length)).set(m);var _=m.length,y=d/2;for(c=0;c<_;c+=3){var v=h[c]+y,C=h[c+1]+y,T=h[c+2]+y;h[c+_]=T,h[c+1+_]=C,h[c+2+_]=v}if(p.attributes.position.values=g,n&&s.normal){var S=p.attributes.normal.values;p.attributes.normal.values=new Float32Array(g.length),p.attributes.normal.values.set(S)}p.indices=h}else if(o){for(d=f.length/3,h=IndexDatatype$1.createTypedArray(d,m.length),c=0;c<m.length;c+=3)h[c]=m[c+2],h[c+1]=m[c+1],h[c+2]=m[c];p.indices=h}u.topAndBottom=new GeometryInstance({geometry:p})}var A=r.outerRing,x=EllipsoidTangentPlane.fromPoints(A,e),E=x.projectPointsOntoPlane(A,createGeometryFromPositionsExtrudedPositions),b=PolygonPipeline.computeWindingOrder2D(E);b===WindingOrder$1.CLOCKWISE&&(A=A.slice().reverse());var P=PolygonGeometryLibrary.computeWallGeometry(A,e,i,n,l);u.walls.push(new GeometryInstance({geometry:P}));var D=r.holes;for(c=0;c<D.length;c++){var w=D[c];E=(x=EllipsoidTangentPlane.fromPoints(w,e)).projectPointsOntoPlane(w,createGeometryFromPositionsExtrudedPositions),(b=PolygonPipeline.computeWindingOrder2D(E))===WindingOrder$1.COUNTER_CLOCKWISE&&(w=w.slice().reverse()),P=PolygonGeometryLibrary.computeWallGeometry(w,e,i,n,l),u.walls.push(new GeometryInstance({geometry:P}))}return u}function PolygonGeometry(e){var t=e.polygonHierarchy,i=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),r=defaultValue(e.ellipsoid,Ellipsoid.WGS84),n=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),a=defaultValue(e.stRotation,0),o=defaultValue(e.perPositionHeight,!1),s=o&&defined(e.extrudedHeight),l=defaultValue(e.height,0),c=defaultValue(e.extrudedHeight,l);if(!s){var u=Math.max(l,c);c=Math.min(l,c),l=u}this._vertexFormat=VertexFormat.clone(i),this._ellipsoid=Ellipsoid.clone(r),this._granularity=n,this._stRotation=a,this._height=l,this._extrudedHeight=c,this._closeTop=defaultValue(e.closeTop,!0),this._closeBottom=defaultValue(e.closeBottom,!0),this._polygonHierarchy=t,this._perPositionHeight=o,this._perPositionHeightExtrude=s,this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=e.offsetAttribute,this._arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+Ellipsoid.packedLength+VertexFormat.packedLength+12}PolygonGeometry.fromPositions=function(e){return new PolygonGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions},height:e.height,extrudedHeight:e.extrudedHeight,vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,closeTop:e.closeTop,closeBottom:e.closeBottom,offsetAttribute:e.offsetAttribute,arcType:e.arcType})},PolygonGeometry.pack=function(e,t,i){return i=defaultValue(i,0),i=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,i),Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._granularity,t[i++]=e._stRotation,t[i++]=e._perPositionHeightExtrude?1:0,t[i++]=e._perPositionHeight?1:0,t[i++]=e._closeTop?1:0,t[i++]=e._closeBottom?1:0,t[i++]=e._shadowVolume?1:0,t[i++]=defaultValue(e._offsetAttribute,-1),t[i++]=e._arcType,t[i]=e.packedLength,t};var scratchEllipsoid$9=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$4=new VertexFormat,dummyOptions$1={polygonHierarchy:{}};function textureCoordinateRotationPoints$1(e){var t=-e._stRotation;if(0===t)return[0,0,0,1,1,0];var i=e._ellipsoid,r=e._polygonHierarchy.positions,n=e.rectangle;return Geometry._textureCoordinateRotationPoints(r,t,i,n)}function PolygonHierarchy(e,t){this.positions=defined(e)?e:[],this.holes=defined(t)?t:[]}PolygonGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=r.startingIndex,delete r.startingIndex;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$9);t+=Ellipsoid.packedLength;var a=VertexFormat.unpack(e,t,scratchVertexFormat$4);t+=VertexFormat.packedLength;var o=e[t++],s=e[t++],l=e[t++],c=e[t++],u=1===e[t++],d=1===e[t++],h=1===e[t++],p=1===e[t++],f=1===e[t++],m=e[t++],g=e[t++],_=e[t];return defined(i)||(i=new PolygonGeometry(dummyOptions$1)),i._polygonHierarchy=r,i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._vertexFormat=VertexFormat.clone(a,i._vertexFormat),i._height=o,i._extrudedHeight=s,i._granularity=l,i._stRotation=c,i._perPositionHeightExtrude=u,i._perPositionHeight=d,i._closeTop=h,i._closeBottom=p,i._shadowVolume=f,i._offsetAttribute=-1===m?void 0:m,i._arcType=g,i.packedLength=_,i},PolygonGeometry.computeRectangle=function(e,t){var i=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),r=defaultValue(e.arcType,ArcType$1.GEODESIC),n=e.polygonHierarchy,a=defaultValue(e.ellipsoid,Ellipsoid.WGS84);return computeRectangle$1(n.positions,a,r,i,t)},PolygonGeometry.createGeometry=function(e){var t=e._vertexFormat,i=e._ellipsoid,r=e._granularity,n=e._stRotation,a=e._polygonHierarchy,o=e._perPositionHeight,s=e._closeTop,l=e._closeBottom,c=e._arcType,u=a.positions;if(!(u.length<3)){var d=EllipsoidTangentPlane.fromPoints(u,i),h=PolygonGeometryLibrary.polygonsFromHierarchy(a,d.projectPointsOntoPlane.bind(d),!o,i),p=h.hierarchy,f=h.polygons;if(0!==p.length){u=p[0].outerRing;var m,g=PolygonGeometryLibrary.computeBoundingRectangle(d.plane.normal,d.projectPointOntoPlane.bind(d),u,n,scratchBoundingRectangle),_=[],y=e._height,v=e._extrudedHeight,C={perPositionHeight:o,vertexFormat:t,geometry:void 0,tangentPlane:d,boundingRectangle:g,ellipsoid:i,stRotation:n,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:c};if(e._perPositionHeightExtrude||!CesiumMath.equalsEpsilon(y,v,0,CesiumMath.EPSILON2))for(C.extrude=!0,C.top=s,C.bottom=l,C.shadowVolume=e._shadowVolume,C.offsetAttribute=e._offsetAttribute,m=0;m<f.length;m++){var T,S=createGeometryFromPositionsExtruded$1(i,f[m],r,p[m],o,s,l,t,c);s&&l?(T=S.topAndBottom,C.geometry=PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(T.geometry,y,v,i,o)):s?((T=S.topAndBottom).geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(T.geometry.attributes.position.values,y,i,!o),C.geometry=T.geometry):l&&((T=S.topAndBottom).geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(T.geometry.attributes.position.values,v,i,!0),C.geometry=T.geometry),(s||l)&&(C.wall=!1,T.geometry=computeAttributes$2(C),_.push(T));var A=S.walls;C.wall=!0;for(var x=0;x<A.length;x++){var E=A[x];C.geometry=PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(E.geometry,y,v,i,o),E.geometry=computeAttributes$2(C),_.push(E)}}else for(m=0;m<f.length;m++){var b=new GeometryInstance({geometry:PolygonGeometryLibrary.createGeometryFromPositions(i,f[m],r,o,t,c)});if(b.geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(b.geometry.attributes.position.values,y,i,!o),C.geometry=b.geometry,b.geometry=computeAttributes$2(C),defined(e._offsetAttribute)){var P=b.geometry.attributes.position.values.length,D=new Uint8Array(P/3);arrayFill(D,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),b.geometry.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:D})}_.push(b)}var w=GeometryPipeline.combineInstances(_)[0];w.attributes.position.values=new Float64Array(w.attributes.position.values),w.indices=IndexDatatype$1.createTypedArray(w.attributes.position.values.length/3,w.indices);var M=w.attributes,I=BoundingSphere.fromVertices(M.position.values);return t.position||delete M.position,new Geometry({attributes:M,indices:w.indices,primitiveType:w.primitiveType,boundingSphere:I,offsetAttribute:e._offsetAttribute})}}},PolygonGeometry.createShadowVolume=function(e,t,i){var r=e._granularity,n=e._ellipsoid,a=t(r,n),o=i(r,n);return new PolygonGeometry({polygonHierarchy:e._polygonHierarchy,ellipsoid:n,stRotation:e._stRotation,granularity:r,perPositionHeight:!1,extrudedHeight:a,height:o,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0,arcType:e._arcType})},Object.defineProperties(PolygonGeometry.prototype,{rectangle:{get:function(){if(!defined(this._rectangle)){var e=this._polygonHierarchy.positions;this._rectangle=computeRectangle$1(e,this._ellipsoid,this._arcType,this._granularity)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=textureCoordinateRotationPoints$1(this)),this._textureCoordinateRotationPoints}}});var createGeometryFromPositionsPositions=[],createGeometryFromPositionsSubdivided=[];function createGeometryFromPositions(e,t,i,r,n){var a,o,s=EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t,createGeometryFromPositionsPositions);PolygonPipeline.computeWindingOrder2D(s)===WindingOrder$1.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());var l=t.length,c=0;if(r)for(a=new Float64Array(2*l*3),o=0;o<l;o++){var u=t[o],d=t[(o+1)%l];a[c++]=u.x,a[c++]=u.y,a[c++]=u.z,a[c++]=d.x,a[c++]=d.y,a[c++]=d.z}else{var h=0;if(n===ArcType$1.GEODESIC)for(o=0;o<l;o++)h+=PolygonGeometryLibrary.subdivideLineCount(t[o],t[(o+1)%l],i);else if(n===ArcType$1.RHUMB)for(o=0;o<l;o++)h+=PolygonGeometryLibrary.subdivideRhumbLineCount(e,t[o],t[(o+1)%l],i);for(a=new Float64Array(3*h),o=0;o<l;o++){var p;n===ArcType$1.GEODESIC?p=PolygonGeometryLibrary.subdivideLine(t[o],t[(o+1)%l],i,createGeometryFromPositionsSubdivided):n===ArcType$1.RHUMB&&(p=PolygonGeometryLibrary.subdivideRhumbLine(e,t[o],t[(o+1)%l],i,createGeometryFromPositionsSubdivided));for(var f=p.length,m=0;m<f;++m)a[c++]=p[m]}}var g=2*(l=a.length/3),_=IndexDatatype$1.createTypedArray(l,g);for(c=0,o=0;o<l-1;o++)_[c++]=o,_[c++]=o+1;return _[c++]=l-1,_[c++]=0,new GeometryInstance({geometry:new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})}),indices:_,primitiveType:PrimitiveType$1.LINES})})}function createGeometryFromPositionsExtruded(e,t,i,r,n){var a,o,s=EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t,createGeometryFromPositionsPositions);PolygonPipeline.computeWindingOrder2D(s)===WindingOrder$1.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());var l=t.length,c=new Array(l),u=0;if(r)for(a=new Float64Array(2*l*3*2),o=0;o<l;++o){c[o]=u/3;var d=t[o],h=t[(o+1)%l];a[u++]=d.x,a[u++]=d.y,a[u++]=d.z,a[u++]=h.x,a[u++]=h.y,a[u++]=h.z}else{var p=0;if(n===ArcType$1.GEODESIC)for(o=0;o<l;o++)p+=PolygonGeometryLibrary.subdivideLineCount(t[o],t[(o+1)%l],i);else if(n===ArcType$1.RHUMB)for(o=0;o<l;o++)p+=PolygonGeometryLibrary.subdivideRhumbLineCount(e,t[o],t[(o+1)%l],i);for(a=new Float64Array(3*p*2),o=0;o<l;++o){var f;c[o]=u/3,n===ArcType$1.GEODESIC?f=PolygonGeometryLibrary.subdivideLine(t[o],t[(o+1)%l],i,createGeometryFromPositionsSubdivided):n===ArcType$1.RHUMB&&(f=PolygonGeometryLibrary.subdivideRhumbLine(e,t[o],t[(o+1)%l],i,createGeometryFromPositionsSubdivided));for(var m=f.length,g=0;g<m;++g)a[u++]=f[g]}}l=a.length/6;var _=c.length,y=2*(2*l+_),v=IndexDatatype$1.createTypedArray(l+_,y);for(u=0,o=0;o<l;++o)v[u++]=o,v[u++]=(o+1)%l,v[u++]=o+l,v[u++]=(o+1)%l+l;for(o=0;o<_;o++){var C=c[o];v[u++]=C,v[u++]=C+l}return new GeometryInstance({geometry:new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})}),indices:v,primitiveType:PrimitiveType$1.LINES})})}function PolygonOutlineGeometry(e){var t=e.polygonHierarchy,i=defaultValue(e.ellipsoid,Ellipsoid.WGS84),r=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),n=defaultValue(e.perPositionHeight,!1),a=n&&defined(e.extrudedHeight),o=defaultValue(e.arcType,ArcType$1.GEODESIC),s=defaultValue(e.height,0),l=defaultValue(e.extrudedHeight,s);if(!a){var c=Math.max(s,l);l=Math.min(s,l),s=c}this._ellipsoid=Ellipsoid.clone(i),this._granularity=r,this._height=s,this._extrudedHeight=l,this._arcType=o,this._polygonHierarchy=t,this._perPositionHeight=n,this._perPositionHeightExtrude=a,this._offsetAttribute=e.offsetAttribute,this._workerName="createPolygonOutlineGeometry",this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+Ellipsoid.packedLength+8}PolygonOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),i=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,i),Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._granularity,t[i++]=e._perPositionHeightExtrude?1:0,t[i++]=e._perPositionHeight?1:0,t[i++]=e._arcType,t[i++]=defaultValue(e._offsetAttribute,-1),t[i]=e.packedLength,t};var scratchEllipsoid$8=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),dummyOptions={polygonHierarchy:{}};PolygonOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=r.startingIndex,delete r.startingIndex;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$8);t+=Ellipsoid.packedLength;var a=e[t++],o=e[t++],s=e[t++],l=1===e[t++],c=1===e[t++],u=e[t++],d=e[t++],h=e[t];return defined(i)||(i=new PolygonOutlineGeometry(dummyOptions)),i._polygonHierarchy=r,i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._height=a,i._extrudedHeight=o,i._granularity=s,i._perPositionHeight=c,i._perPositionHeightExtrude=l,i._arcType=u,i._offsetAttribute=-1===d?void 0:d,i.packedLength=h,i},PolygonOutlineGeometry.fromPositions=function(e){return new PolygonOutlineGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions},height:e.height,extrudedHeight:e.extrudedHeight,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,arcType:e.arcType,offsetAttribute:e.offsetAttribute})},PolygonOutlineGeometry.createGeometry=function(e){var t=e._ellipsoid,i=e._granularity,r=e._polygonHierarchy,n=e._perPositionHeight,a=e._arcType,o=PolygonGeometryLibrary.polygonOutlinesFromHierarchy(r,!n,t);if(0!==o.length){var s,l,c=[],u=CesiumMath.chordLength(i,t.maximumRadius),d=e._height,h=e._extrudedHeight;if(e._perPositionHeightExtrude||!CesiumMath.equalsEpsilon(d,h,0,CesiumMath.EPSILON2))for(l=0;l<o.length;l++){if((s=createGeometryFromPositionsExtruded(t,o[l],u,n,a)).geometry=PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(s.geometry,d,h,t,n),defined(e._offsetAttribute)){var p=s.geometry.attributes.position.values.length/3,f=new Uint8Array(p);f=e._offsetAttribute===GeometryOffsetAttribute$1.TOP?arrayFill(f,1,0,p/2):arrayFill(f,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),s.geometry.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:f})}c.push(s)}else for(l=0;l<o.length;l++){if((s=createGeometryFromPositions(t,o[l],u,n,a)).geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(s.geometry.attributes.position.values,d,t,!n),defined(e._offsetAttribute)){var m=s.geometry.attributes.position.values.length,g=new Uint8Array(m/3);arrayFill(g,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),s.geometry.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}c.push(s)}var _=GeometryPipeline.combineInstances(c)[0],y=BoundingSphere.fromVertices(_.attributes.position.values);return new Geometry({attributes:_.attributes,indices:_.indices,primitiveType:_.primitiveType,boundingSphere:y,offsetAttribute:e._offsetAttribute})}};var scratchInterpolateColorsArray=[];function interpolateColors$1(e,t,i,r,n){var a,o=scratchInterpolateColorsArray;o.length=n;var s=i.red,l=i.green,c=i.blue,u=i.alpha,d=r.red,h=r.green,p=r.blue,f=r.alpha;if(Color.equals(i,r)){for(a=0;a<n;a++)o[a]=Color.clone(i);return o}var m=(d-s)/n,g=(h-l)/n,_=(p-c)/n,y=(f-u)/n;for(a=0;a<n;a++)o[a]=new Color(s+a*m,l+a*g,c+a*_,u+a*y);return o}function PolylineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.colors,r=defaultValue(e.width,1),n=defaultValue(e.colorsPerVertex,!1);this._positions=t,this._colors=i,this._width=r,this._colorsPerVertex=n,this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._workerName="createPolylineGeometry";var a=1+t.length*Cartesian3.packedLength;a+=defined(i)?1+i.length*Color.packedLength:1,this.packedLength=a+Ellipsoid.packedLength+VertexFormat.packedLength+4}PolylineGeometry.pack=function(e,t,i){var r;i=defaultValue(i,0);var n=e._positions,a=n.length;for(t[i++]=a,r=0;r<a;++r,i+=Cartesian3.packedLength)Cartesian3.pack(n[r],t,i);var o=e._colors;for(a=defined(o)?o.length:0,t[i++]=a,r=0;r<a;++r,i+=Color.packedLength)Color.pack(o[r],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._width,t[i++]=e._colorsPerVertex?1:0,t[i++]=e._arcType,t[i]=e._granularity,t};var scratchEllipsoid$7=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$3=new VertexFormat,scratchOptions$8={positions:void 0,colors:void 0,ellipsoid:scratchEllipsoid$7,vertexFormat:scratchVertexFormat$3,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};PolylineGeometry.unpack=function(e,t,i){var r;t=defaultValue(t,0);var n=e[t++],a=new Array(n);for(r=0;r<n;++r,t+=Cartesian3.packedLength)a[r]=Cartesian3.unpack(e,t);var o=(n=e[t++])>0?new Array(n):void 0;for(r=0;r<n;++r,t+=Color.packedLength)o[r]=Color.unpack(e,t);var s=Ellipsoid.unpack(e,t,scratchEllipsoid$7);t+=Ellipsoid.packedLength;var l=VertexFormat.unpack(e,t,scratchVertexFormat$3);t+=VertexFormat.packedLength;var c=e[t++],u=1===e[t++],d=e[t++],h=e[t];return defined(i)?(i._positions=a,i._colors=o,i._ellipsoid=Ellipsoid.clone(s,i._ellipsoid),i._vertexFormat=VertexFormat.clone(l,i._vertexFormat),i._width=c,i._colorsPerVertex=u,i._arcType=d,i._granularity=h,i):(scratchOptions$8.positions=a,scratchOptions$8.colors=o,scratchOptions$8.width=c,scratchOptions$8.colorsPerVertex=u,scratchOptions$8.arcType=d,scratchOptions$8.granularity=h,new PolylineGeometry(scratchOptions$8))};var scratchCartesian3$5=new Cartesian3,scratchPosition$9=new Cartesian3,scratchPrevPosition=new Cartesian3,scratchNextPosition=new Cartesian3;function computeAttributes$1(e,t,i,r){var n=new GeometryAttributes;r.position&&(n.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:e}));var a,o,s,l,c,u,d=t.length,h=e.length/3,p=(h-2*d)/(2*d),f=PolygonPipeline.triangulate(t),m=(p-1)*d*6+2*f.length,g=IndexDatatype$1.createTypedArray(h,m),_=2*d,y=0;for(a=0;a<p-1;a++){for(o=0;o<d-1;o++)u=(s=2*o+a*d*2)+_,c=(l=s+1)+_,g[y++]=l,g[y++]=s,g[y++]=c,g[y++]=c,g[y++]=s,g[y++]=u;c=(l=(s=2*d-2+a*d*2)+1)+_,u=s+_,g[y++]=l,g[y++]=s,g[y++]=c,g[y++]=c,g[y++]=s,g[y++]=u}if(r.st||r.tangent||r.bitangent){var v,C,T=new Float32Array(2*h),S=1/(p-1),A=1/i.height,x=i.height/2,E=0;for(a=0;a<p;a++){for(v=a*S,C=A*(t[0].y+x),T[E++]=v,T[E++]=C,o=1;o<d;o++)C=A*(t[o].y+x),T[E++]=v,T[E++]=C,T[E++]=v,T[E++]=C;C=A*(t[0].y+x),T[E++]=v,T[E++]=C}for(o=0;o<d;o++)v=0,C=A*(t[o].y+x),T[E++]=v,T[E++]=C;for(o=0;o<d;o++)v=(p-1)*S,C=A*(t[o].y+x),T[E++]=v,T[E++]=C;n.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:new Float32Array(T)})}var b=h-2*d;for(a=0;a<f.length;a+=3){var P=f[a]+b,D=f[a+1]+b,w=f[a+2]+b;g[y++]=P,g[y++]=D,g[y++]=w,g[y++]=w+d,g[y++]=D+d,g[y++]=P+d}var M=new Geometry({attributes:n,indices:g,boundingSphere:BoundingSphere.fromVertices(e),primitiveType:PrimitiveType$1.TRIANGLES});if(r.normal&&(M=GeometryPipeline.computeNormal(M)),r.tangent||r.bitangent){try{M=GeometryPipeline.computeTangentAndBitangent(M)}catch(e){oneTimeWarning("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}r.tangent||(M.attributes.tangent=void 0),r.bitangent||(M.attributes.bitangent=void 0),r.st||(M.attributes.st=void 0)}return M}function PolylineVolumeGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polylinePositions,i=e.shapePositions;this._positions=t,this._shape=i,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";var r=1+t.length*Cartesian3.packedLength;r+=1+i.length*Cartesian2.packedLength,this.packedLength=r+Ellipsoid.packedLength+VertexFormat.packedLength+2}PolylineGeometry.createGeometry=function(e){var t,i,r,n=e._width,a=e._vertexFormat,o=e._colors,s=e._colorsPerVertex,l=e._arcType,c=e._granularity,u=e._ellipsoid,d=[],h=arrayRemoveDuplicates(e._positions,Cartesian3.equalsEpsilon,!1,d);if(defined(o)&&d.length>0){var p=0,f=d[0];o=o.filter((function(e,t){return!(s?t===f||0===t&&1===f:t+1===f)||(p++,f=d[p],!1)}))}var m=h.length;if(!(m<2||n<=0)){if(l===ArcType$1.GEODESIC||l===ArcType$1.RHUMB){var g,_;l===ArcType$1.GEODESIC?(g=CesiumMath.chordLength(c,u.maximumRadius),_=PolylinePipeline.numberOfPoints):(g=c,_=PolylinePipeline.numberOfPointsRhumbLine);var y=PolylinePipeline.extractHeights(h,u);if(defined(o)){var v=1;for(t=0;t<m-1;++t)v+=_(h[t],h[t+1],g);var C=new Array(v),T=0;for(t=0;t<m-1;++t){var S=h[t],A=h[t+1],x=o[t],E=_(S,A,g);if(s&&t<v){var b=interpolateColors$1(S,A,x,o[t+1],E),P=b.length;for(i=0;i<P;++i)C[T++]=b[i]}else for(i=0;i<E;++i)C[T++]=Color.clone(x)}C[T]=Color.clone(o[o.length-1]),o=C,scratchInterpolateColorsArray.length=0}h=l===ArcType$1.GEODESIC?PolylinePipeline.generateCartesianArc({positions:h,minDistance:g,ellipsoid:u,height:y}):PolylinePipeline.generateCartesianRhumbArc({positions:h,granularity:g,ellipsoid:u,height:y})}var D,w=4*(m=h.length)-4,M=new Float64Array(3*w),I=new Float64Array(3*w),R=new Float64Array(3*w),O=new Float32Array(2*w),B=a.st?new Float32Array(2*w):void 0,L=defined(o)?new Uint8Array(4*w):void 0,F=0,N=0,V=0,k=0;for(i=0;i<m;++i){var U,G;0===i?(D=scratchCartesian3$5,Cartesian3.subtract(h[0],h[1],D),Cartesian3.add(h[0],D,D)):D=h[i-1],Cartesian3.clone(D,scratchPrevPosition),Cartesian3.clone(h[i],scratchPosition$9),i===m-1?(D=scratchCartesian3$5,Cartesian3.subtract(h[m-1],h[m-2],D),Cartesian3.add(h[m-1],D,D)):D=h[i+1],Cartesian3.clone(D,scratchNextPosition),defined(L)&&(U=0===i||s?o[i]:o[i-1],i!==m-1&&(G=o[i]));var $=i===m-1?2:4;for(r=0===i?2:0;r<$;++r){Cartesian3.pack(scratchPosition$9,M,F),Cartesian3.pack(scratchPrevPosition,I,F),Cartesian3.pack(scratchNextPosition,R,F),F+=3;var z=r-2<0?-1:1;if(O[N++]=r%2*2-1,O[N++]=z*n,a.st&&(B[V++]=i/(m-1),B[V++]=Math.max(O[N-2],0)),defined(L)){var H=r<2?U:G;L[k++]=Color.floatToByte(H.red),L[k++]=Color.floatToByte(H.green),L[k++]=Color.floatToByte(H.blue),L[k++]=Color.floatToByte(H.alpha)}}}var W=new GeometryAttributes;W.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:M}),W.prevPosition=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:I}),W.nextPosition=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:R}),W.expandAndWidth=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:O}),a.st&&(W.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:B})),defined(L)&&(W.color=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,values:L,normalize:!0}));var j=IndexDatatype$1.createTypedArray(w,6*m-6),q=0,X=0,Y=m-1;for(i=0;i<Y;++i)j[X++]=q,j[X++]=q+2,j[X++]=q+1,j[X++]=q+1,j[X++]=q+2,j[X++]=q+3,q+=4;return new Geometry({attributes:W,indices:j,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:BoundingSphere.fromPoints(h),geometryType:GeometryType$1.POLYLINES})}},PolylineVolumeGeometry.pack=function(e,t,i){var r;i=defaultValue(i,0);var n=e._positions,a=n.length;for(t[i++]=a,r=0;r<a;++r,i+=Cartesian3.packedLength)Cartesian3.pack(n[r],t,i);var o=e._shape;for(a=o.length,t[i++]=a,r=0;r<a;++r,i+=Cartesian2.packedLength)Cartesian2.pack(o[r],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._cornerType,t[i]=e._granularity,t};var scratchEllipsoid$6=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$2=new VertexFormat,scratchOptions$7={polylinePositions:void 0,shapePositions:void 0,ellipsoid:scratchEllipsoid$6,vertexFormat:scratchVertexFormat$2,cornerType:void 0,granularity:void 0};PolylineVolumeGeometry.unpack=function(e,t,i){var r;t=defaultValue(t,0);var n=e[t++],a=new Array(n);for(r=0;r<n;++r,t+=Cartesian3.packedLength)a[r]=Cartesian3.unpack(e,t);n=e[t++];var o=new Array(n);for(r=0;r<n;++r,t+=Cartesian2.packedLength)o[r]=Cartesian2.unpack(e,t);var s=Ellipsoid.unpack(e,t,scratchEllipsoid$6);t+=Ellipsoid.packedLength;var l=VertexFormat.unpack(e,t,scratchVertexFormat$2);t+=VertexFormat.packedLength;var c=e[t++],u=e[t];return defined(i)?(i._positions=a,i._shape=o,i._ellipsoid=Ellipsoid.clone(s,i._ellipsoid),i._vertexFormat=VertexFormat.clone(l,i._vertexFormat),i._cornerType=c,i._granularity=u,i):(scratchOptions$7.polylinePositions=a,scratchOptions$7.shapePositions=o,scratchOptions$7.cornerType=c,scratchOptions$7.granularity=u,new PolylineVolumeGeometry(scratchOptions$7))};var brScratch$1=new BoundingRectangle;function computeAttributes(e,t){var i=new GeometryAttributes;i.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:e});var r,n,a=t.length,o=i.position.values.length/3,s=e.length/3/a,l=IndexDatatype$1.createTypedArray(o,2*a*(s+1)),c=0,u=(r=0)*a;for(n=0;n<a-1;n++)l[c++]=n+u,l[c++]=n+u+1;for(l[c++]=a-1+u,l[c++]=u,u=(r=s-1)*a,n=0;n<a-1;n++)l[c++]=n+u,l[c++]=n+u+1;for(l[c++]=a-1+u,l[c++]=u,r=0;r<s-1;r++){var d=a*r,h=d+a;for(n=0;n<a;n++)l[c++]=n+d,l[c++]=n+h}return new Geometry({attributes:i,indices:IndexDatatype$1.createTypedArray(o,l),boundingSphere:BoundingSphere.fromVertices(e),primitiveType:PrimitiveType$1.LINES})}function PolylineVolumeOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polylinePositions,i=e.shapePositions;this._positions=t,this._shape=i,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";var r=1+t.length*Cartesian3.packedLength;r+=1+i.length*Cartesian2.packedLength,this.packedLength=r+Ellipsoid.packedLength+2}PolylineVolumeGeometry.createGeometry=function(e){var t=arrayRemoveDuplicates(e._positions,Cartesian3.equalsEpsilon),i=e._shape;if(i=PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(i),!(t.length<2||i.length<3)){PolygonPipeline.computeWindingOrder2D(i)===WindingOrder$1.CLOCKWISE&&i.reverse();var r=BoundingRectangle.fromPoints(i,brScratch$1);return computeAttributes$1(PolylineVolumeGeometryLibrary.computePositions(t,i,r,e,!0),i,r,e._vertexFormat)}},PolylineVolumeOutlineGeometry.pack=function(e,t,i){var r;i=defaultValue(i,0);var n=e._positions,a=n.length;for(t[i++]=a,r=0;r<a;++r,i+=Cartesian3.packedLength)Cartesian3.pack(n[r],t,i);var o=e._shape;for(a=o.length,t[i++]=a,r=0;r<a;++r,i+=Cartesian2.packedLength)Cartesian2.pack(o[r],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._cornerType,t[i]=e._granularity,t};var scratchEllipsoid$5=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$6={polylinePositions:void 0,shapePositions:void 0,ellipsoid:scratchEllipsoid$5,height:void 0,cornerType:void 0,granularity:void 0};PolylineVolumeOutlineGeometry.unpack=function(e,t,i){var r;t=defaultValue(t,0);var n=e[t++],a=new Array(n);for(r=0;r<n;++r,t+=Cartesian3.packedLength)a[r]=Cartesian3.unpack(e,t);n=e[t++];var o=new Array(n);for(r=0;r<n;++r,t+=Cartesian2.packedLength)o[r]=Cartesian2.unpack(e,t);var s=Ellipsoid.unpack(e,t,scratchEllipsoid$5);t+=Ellipsoid.packedLength;var l=e[t++],c=e[t];return defined(i)?(i._positions=a,i._shape=o,i._ellipsoid=Ellipsoid.clone(s,i._ellipsoid),i._cornerType=l,i._granularity=c,i):(scratchOptions$6.polylinePositions=a,scratchOptions$6.shapePositions=o,scratchOptions$6.cornerType=l,scratchOptions$6.granularity=c,new PolylineVolumeOutlineGeometry(scratchOptions$6))};var brScratch=new BoundingRectangle;function Proxy(){DeveloperError.throwInstantiationError()}function createEvaluateFunction(e){var t=e.points,i=e.times;return function(r,n){defined(n)||(n=new Quaternion);var a=e._lastTimeIndex=e.findTimeInterval(r,e._lastTimeIndex),o=(r-i[a])/(i[a+1]-i[a]),s=t[a],l=t[a+1];return Quaternion.fastSlerp(s,l,o,n)}}function QuaternionSpline(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,i=e.times;this._times=i,this._points=t,this._evaluateFunction=createEvaluateFunction(this),this._lastTimeIndex=0}function quickselect(e,t,i,r,n){quickselectStep(e,t,i||0,r||e.length-1,n||defaultCompare)}function quickselectStep(e,t,i,r,n){for(;r>i;){if(r-i>600){var a=r-i+1,o=t-i+1,s=Math.log(a),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(a-l)/a)*(o-a/2<0?-1:1);quickselectStep(e,t,Math.max(i,Math.floor(t-o*l/a+c)),Math.min(r,Math.floor(t+(a-o)*l/a+c)),n)}var u=e[t],d=i,h=r;for(swap$1(e,i,t),n(e[r],u)>0&&swap$1(e,i,r);d<h;){for(swap$1(e,d,h),d++,h--;n(e[d],u)<0;)d++;for(;n(e[h],u)>0;)h--}0===n(e[i],u)?swap$1(e,i,h):swap$1(e,++h,r),h<=t&&(i=h+1),t<=h&&(r=h-1)}}function swap$1(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function defaultCompare(e,t){return e<t?-1:e>t?1:0}PolylineVolumeOutlineGeometry.createGeometry=function(e){var t=arrayRemoveDuplicates(e._positions,Cartesian3.equalsEpsilon),i=e._shape;if(i=PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(i),!(t.length<2||i.length<3)){PolygonPipeline.computeWindingOrder2D(i)===WindingOrder$1.CLOCKWISE&&i.reverse();var r=BoundingRectangle.fromPoints(i,brScratch);return computeAttributes(PolylineVolumeGeometryLibrary.computePositions(t,i,r,e,!1),i)}},Proxy.prototype.getURL=DeveloperError.throwInstantiationError,Object.defineProperties(QuaternionSpline.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}}),QuaternionSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,QuaternionSpline.prototype.wrapTime=Spline.prototype.wrapTime,QuaternionSpline.prototype.clampTime=Spline.prototype.clampTime,QuaternionSpline.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)};class RBush{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const i=[];if(!intersects(e,t))return i;const r=this.toBBox,n=[];for(;t;){for(let a=0;a<t.children.length;a++){const o=t.children[a],s=t.leaf?r(o):o;intersects(e,s)&&(t.leaf?i.push(o):contains$1(e,s)?this._all(o,i):n.push(o))}t=n.pop()}return i}collides(e){let t=this.data;if(!intersects(e,t))return!1;const i=[];for(;t;){for(let r=0;r<t.children.length;r++){const n=t.children[r],a=t.leaf?this.toBBox(n):n;if(intersects(e,a)){if(t.leaf||contains$1(e,a))return!0;i.push(n)}}t=i.pop()}return!1}load(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}else this.data=t;return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=createNode([]),this}remove(e,t){if(!e)return this;let i=this.data;const r=this.toBBox(e),n=[],a=[];let o,s,l;for(;i||n.length;){if(i||(i=n.pop(),s=n[n.length-1],o=a.pop(),l=!0),i.leaf){const r=findItem(e,i.children,t);if(-1!==r)return i.children.splice(r,1),n.push(i),this._condense(n),this}l||i.leaf||!contains$1(i,r)?s?(o++,i=s.children[o],l=!1):i=null:(n.push(i),a.push(o),o=0,s=i,i=i.children[0])}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const i=[];for(;e;)e.leaf?t.push(...e.children):i.push(...e.children),e=i.pop();return t}_build(e,t,i,r){const n=i-t+1;let a,o=this._maxEntries;if(n<=o)return a=createNode(e.slice(t,i+1)),calcBBox(a,this.toBBox),a;r||(r=Math.ceil(Math.log(n)/Math.log(o)),o=Math.ceil(n/Math.pow(o,r-1))),a=createNode([]),a.leaf=!1,a.height=r;const s=Math.ceil(n/o),l=s*Math.ceil(Math.sqrt(o));multiSelect(e,t,i,l,this.compareMinX);for(let n=t;n<=i;n+=l){const t=Math.min(n+l-1,i);multiSelect(e,n,t,s,this.compareMinY);for(let i=n;i<=t;i+=s){const n=Math.min(i+s-1,t);a.children.push(this._build(e,i,n,r-1))}}return calcBBox(a,this.toBBox),a}_chooseSubtree(e,t,i,r){for(;r.push(t),!t.leaf&&r.length-1!==i;){let i,r=1/0,n=1/0;for(let a=0;a<t.children.length;a++){const o=t.children[a],s=bboxArea(o),l=enlargedArea(e,o)-s;l<n?(n=l,r=s<r?s:r,i=o):l===n&&s<r&&(r=s,i=o)}t=i||t.children[0]}return t}_insert(e,t,i){const r=i?e:this.toBBox(e),n=[],a=this._chooseSubtree(r,this.data,t,n);for(a.children.push(e),extend(a,r);t>=0&&n[t].children.length>this._maxEntries;)this._split(n,t),t--;this._adjustParentBBoxes(r,n,t)}_split(e,t){const i=e[t],r=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,r);const a=this._chooseSplitIndex(i,n,r),o=createNode(i.children.splice(a,i.children.length-a));o.height=i.height,o.leaf=i.leaf,calcBBox(i,this.toBBox),calcBBox(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(i,o)}_splitRoot(e,t){this.data=createNode([e,t]),this.data.height=e.height+1,this.data.leaf=!1,calcBBox(this.data,this.toBBox)}_chooseSplitIndex(e,t,i){let r,n=1/0,a=1/0;for(let o=t;o<=i-t;o++){const t=distBBox(e,0,o,this.toBBox),s=distBBox(e,o,i,this.toBBox),l=intersectionArea(t,s),c=bboxArea(t)+bboxArea(s);l<n?(n=l,r=o,a=c<a?c:a):l===n&&c<a&&(a=c,r=o)}return r||i-t}_chooseSplitAxis(e,t,i){const r=e.leaf?this.compareMinX:compareNodeMinX,n=e.leaf?this.compareMinY:compareNodeMinY;this._allDistMargin(e,t,i,r)<this._allDistMargin(e,t,i,n)&&e.children.sort(r)}_allDistMargin(e,t,i,r){e.children.sort(r);const n=this.toBBox,a=distBBox(e,0,t,n),o=distBBox(e,i-t,i,n);let s=bboxMargin(a)+bboxMargin(o);for(let r=t;r<i-t;r++){const t=e.children[r];extend(a,e.leaf?n(t):t),s+=bboxMargin(a)}for(let r=i-t-1;r>=t;r--){const t=e.children[r];extend(o,e.leaf?n(t):t),s+=bboxMargin(o)}return s}_adjustParentBBoxes(e,t,i){for(let r=i;r>=0;r--)extend(t[r],e)}_condense(e){for(let t,i=e.length-1;i>=0;i--)0===e[i].children.length?i>0?(t=e[i-1].children,t.splice(t.indexOf(e[i]),1)):this.clear():calcBBox(e[i],this.toBBox)}}function findItem(e,t,i){if(!i)return t.indexOf(e);for(let r=0;r<t.length;r++)if(i(e,t[r]))return r;return-1}function calcBBox(e,t){distBBox(e,0,e.children.length,t,e)}function distBBox(e,t,i,r,n){n||(n=createNode(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let a=t;a<i;a++){const t=e.children[a];extend(n,e.leaf?r(t):t)}return n}function extend(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function compareNodeMinX(e,t){return e.minX-t.minX}function compareNodeMinY(e,t){return e.minY-t.minY}function bboxArea(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function bboxMargin(e){return e.maxX-e.minX+(e.maxY-e.minY)}function enlargedArea(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function intersectionArea(e,t){const i=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),n=Math.min(e.maxX,t.maxX),a=Math.min(e.maxY,t.maxY);return Math.max(0,n-i)*Math.max(0,a-r)}function contains$1(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function intersects(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function createNode(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function multiSelect(e,t,i,r,n){const a=[t,i];for(;a.length;){if((i=a.pop())-(t=a.pop())<=r)continue;const o=t+Math.ceil((i-t)/r/2)*r;quickselect(e,o,t,i,n),a.push(t,o,o,i)}}function RectangleCollisionChecker(){this._tree=new RBush}function RectangleWithId(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.id=""}function idCompare(e,t){return e.id===t.id}RectangleWithId.fromRectangleAndId=function(e,t,i){return i.minX=t.west,i.minY=t.south,i.maxX=t.east,i.maxY=t.north,i.id=e,i},RectangleCollisionChecker.prototype.insert=function(e,t){var i=RectangleWithId.fromRectangleAndId(e,t,new RectangleWithId);this._tree.insert(i)};var removalScratch=new RectangleWithId;RectangleCollisionChecker.prototype.remove=function(e,t){var i=RectangleWithId.fromRectangleAndId(e,t,removalScratch);this._tree.remove(i,idCompare)};var collisionScratch=new RectangleWithId;RectangleCollisionChecker.prototype.collides=function(e){var t=RectangleWithId.fromRectangleAndId("",e,collisionScratch);return this._tree.collides(t)};var cos=Math.cos,sin=Math.sin,sqrt=Math.sqrt,RectangleGeometryLibrary={computePosition:function(e,t,i,r,n,a,o){var s=t.radiiSquared,l=e.nwCorner,c=e.boundingRectangle,u=l.latitude-e.granYCos*r+n*e.granXSin,d=cos(u),h=sin(u),p=s.z*h,f=l.longitude+r*e.granYSin+n*e.granXCos,m=d*cos(f),g=d*sin(f),_=s.x*m,y=s.y*g,v=sqrt(_*m+y*g+p*h);if(a.x=_/v,a.y=y/v,a.z=p/v,i){var C=e.stNwCorner;defined(C)?(u=C.latitude-e.stGranYCos*r+n*e.stGranXSin,f=C.longitude+r*e.stGranYSin+n*e.stGranXCos,o.x=(f-e.stWest)*e.lonScalar,o.y=(u-e.stSouth)*e.latScalar):(o.x=(f-c.west)*e.lonScalar,o.y=(u-c.south)*e.latScalar)}}},rotationMatrixScratch=new Matrix2,nwCartesian=new Cartesian3,centerScratch$4=new Cartographic,centerCartesian=new Cartesian3,proj=new GeographicProjection;function getRotationOptions(e,t,i,r,n,a,o){var s=Math.cos(t),l=r*s,c=i*s,u=Math.sin(t),d=r*u,h=i*u;nwCartesian=proj.project(e,nwCartesian),nwCartesian=Cartesian3.subtract(nwCartesian,centerCartesian,nwCartesian);var p=Matrix2.fromRotation(t,rotationMatrixScratch);nwCartesian=Matrix2.multiplyByVector(p,nwCartesian,nwCartesian),nwCartesian=Cartesian3.add(nwCartesian,centerCartesian,nwCartesian),a-=1,o-=1;var f=(e=proj.unproject(nwCartesian,e)).latitude,m=f+a*h,g=f-l*o,_=f-l*o+a*h,y=Math.max(f,m,g,_),v=Math.min(f,m,g,_),C=e.longitude,T=C+a*c,S=C+o*d,A=C+o*d+a*c;return{north:y,south:v,east:Math.max(C,T,S,A),west:Math.min(C,T,S,A),granYCos:l,granYSin:d,granXCos:c,granXSin:h,nwCorner:e}}RectangleGeometryLibrary.computeOptions=function(e,t,i,r,n,a,o){var s,l,c,u,d,h=e.east,p=e.west,f=e.north,m=e.south,g=!1,_=!1;f===CesiumMath.PI_OVER_TWO&&(g=!0),m===-CesiumMath.PI_OVER_TWO&&(_=!0);var y=f-m;c=(d=p>h?CesiumMath.TWO_PI-p+h:h-p)/((s=Math.ceil(d/t)+1)-1),u=y/((l=Math.ceil(y/t)+1)-1);var v=Rectangle.northwest(e,a),C=Rectangle.center(e,centerScratch$4);0===i&&0===r||(C.longitude<v.longitude&&(C.longitude+=CesiumMath.TWO_PI),centerCartesian=proj.project(C,centerCartesian));var T=u,S=c,A=Rectangle.clone(e,n),x={granYCos:T,granYSin:0,granXCos:S,granXSin:0,nwCorner:v,boundingRectangle:A,width:s,height:l,northCap:g,southCap:_};if(0!==i){var E=getRotationOptions(v,i,c,u,C,s,l);f=E.north,m=E.south,h=E.east,p=E.west,x.granYCos=E.granYCos,x.granYSin=E.granYSin,x.granXCos=E.granXCos,x.granXSin=E.granXSin,A.north=f,A.south=m,A.east=h,A.west=p}if(0!==r){i-=r;var b=Rectangle.northwest(A,o),P=getRotationOptions(b,i,c,u,C,s,l);x.stGranYCos=P.granYCos,x.stGranXCos=P.granXCos,x.stGranYSin=P.granYSin,x.stGranXSin=P.granXSin,x.stNwCorner=b,x.stWest=P.west,x.stSouth=P.south}return x};var positionScratch$9=new Cartesian3,normalScratch$2=new Cartesian3,tangentScratch=new Cartesian3,bitangentScratch=new Cartesian3,rectangleScratch$5=new Rectangle,stScratch=new Cartesian2,bottomBoundingSphere$1=new BoundingSphere,topBoundingSphere$1=new BoundingSphere;function createAttributes(e,t){var i=new Geometry({attributes:new GeometryAttributes,primitiveType:PrimitiveType$1.TRIANGLES});return i.attributes.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(i.attributes.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(i.attributes.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.bitangent&&(i.attributes.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t.bitangents})),i}function calculateAttributes(e,t,i,r){var n=e.length,a=t.normal?new Float32Array(n):void 0,o=t.tangent?new Float32Array(n):void 0,s=t.bitangent?new Float32Array(n):void 0,l=0,c=bitangentScratch,u=tangentScratch,d=normalScratch$2;if(t.normal||t.tangent||t.bitangent)for(var h=0;h<n;h+=3){var p=Cartesian3.fromArray(e,h,positionScratch$9),f=l+1,m=l+2;d=i.geodeticSurfaceNormal(p,d),(t.tangent||t.bitangent)&&(Cartesian3.cross(Cartesian3.UNIT_Z,d,u),Matrix3.multiplyByVector(r,u,u),Cartesian3.normalize(u,u),t.bitangent&&Cartesian3.normalize(Cartesian3.cross(d,u,c),c)),t.normal&&(a[l]=d.x,a[f]=d.y,a[m]=d.z),t.tangent&&(o[l]=u.x,o[f]=u.y,o[m]=u.z),t.bitangent&&(s[l]=c.x,s[f]=c.y,s[m]=c.z),l+=3}return createAttributes(t,{positions:e,normals:a,tangents:o,bitangents:s})}var v1Scratch=new Cartesian3,v2Scratch=new Cartesian3;function calculateAttributesWall(e,t,i){var r=e.length,n=t.normal?new Float32Array(r):void 0,a=t.tangent?new Float32Array(r):void 0,o=t.bitangent?new Float32Array(r):void 0,s=0,l=0,c=0,u=!0,d=bitangentScratch,h=tangentScratch,p=normalScratch$2;if(t.normal||t.tangent||t.bitangent)for(var f=0;f<r;f+=6){var m=Cartesian3.fromArray(e,f,positionScratch$9),g=Cartesian3.fromArray(e,(f+6)%r,v1Scratch);if(u){var _=Cartesian3.fromArray(e,(f+3)%r,v2Scratch);Cartesian3.subtract(g,m,g),Cartesian3.subtract(_,m,_),p=Cartesian3.normalize(Cartesian3.cross(_,g,p),p),u=!1}Cartesian3.equalsEpsilon(g,m,CesiumMath.EPSILON10)&&(u=!0),(t.tangent||t.bitangent)&&(d=i.geodeticSurfaceNormal(m,d),t.tangent&&(h=Cartesian3.normalize(Cartesian3.cross(d,p,h),h))),t.normal&&(n[s++]=p.x,n[s++]=p.y,n[s++]=p.z,n[s++]=p.x,n[s++]=p.y,n[s++]=p.z),t.tangent&&(a[l++]=h.x,a[l++]=h.y,a[l++]=h.z,a[l++]=h.x,a[l++]=h.y,a[l++]=h.z),t.bitangent&&(o[c++]=d.x,o[c++]=d.y,o[c++]=d.z,o[c++]=d.x,o[c++]=d.y,o[c++]=d.z)}return createAttributes(t,{positions:e,normals:n,tangents:a,bitangents:o})}function constructRectangle$1(e,t){var i=e._vertexFormat,r=e._ellipsoid,n=t.height,a=t.width,o=t.northCap,s=t.southCap,l=0,c=n,u=n,d=0;o&&(l=1,u-=1,d+=1),s&&(c-=1,u-=1,d+=1),d+=a*u;for(var h=i.position?new Float64Array(3*d):void 0,p=i.st?new Float32Array(2*d):void 0,f=0,m=0,g=positionScratch$9,_=stScratch,y=Number.MAX_VALUE,v=Number.MAX_VALUE,C=-Number.MAX_VALUE,T=-Number.MAX_VALUE,S=l;S<c;++S)for(var A=0;A<a;++A)RectangleGeometryLibrary.computePosition(t,r,i.st,S,A,g,_),h[f++]=g.x,h[f++]=g.y,h[f++]=g.z,i.st&&(p[m++]=_.x,p[m++]=_.y,y=Math.min(y,_.x),v=Math.min(v,_.y),C=Math.max(C,_.x),T=Math.max(T,_.y));if(o&&(RectangleGeometryLibrary.computePosition(t,r,i.st,0,0,g,_),h[f++]=g.x,h[f++]=g.y,h[f++]=g.z,i.st&&(p[m++]=_.x,p[m++]=_.y,y=_.x,v=_.y,C=_.x,T=_.y)),s&&(RectangleGeometryLibrary.computePosition(t,r,i.st,n-1,0,g,_),h[f++]=g.x,h[f++]=g.y,h[f]=g.z,i.st&&(p[m++]=_.x,p[m]=_.y,y=Math.min(y,_.x),v=Math.min(v,_.y),C=Math.max(C,_.x),T=Math.max(T,_.y))),i.st&&(y<0||v<0||C>1||T>1))for(var x=0;x<p.length;x+=2)p[x]=(p[x]-y)/(C-y),p[x+1]=(p[x+1]-v)/(T-v);var E=calculateAttributes(h,i,r,t.tangentRotationMatrix),b=6*(a-1)*(u-1);o&&(b+=3*(a-1)),s&&(b+=3*(a-1));var P,D=IndexDatatype$1.createTypedArray(d,b),w=0,M=0;for(P=0;P<u-1;++P){for(var I=0;I<a-1;++I){var R=w,O=R+a,B=O+1,L=R+1;D[M++]=R,D[M++]=O,D[M++]=L,D[M++]=L,D[M++]=O,D[M++]=B,++w}++w}if(o||s){var F,N,V=d-1,k=d-1;if(o&&s&&(V=d-2),w=0,o)for(P=0;P<a-1;P++)N=(F=w)+1,D[M++]=V,D[M++]=F,D[M++]=N,++w;if(s)for(w=(u-1)*a,P=0;P<a-1;P++)N=(F=w)+1,D[M++]=F,D[M++]=k,D[M++]=N,++w}return E.indices=D,i.st&&(E.attributes.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:p})),E}function addWallPositions(e,t,i,r,n){return e[t++]=r[i],e[t++]=r[i+1],e[t++]=r[i+2],e[t++]=n[i],e[t++]=n[i+1],e[t]=n[i+2],e}function addWallTextureCoordinates(e,t,i,r){return e[t++]=r[i],e[t++]=r[i+1],e[t++]=r[i],e[t]=r[i+1],e}var scratchVertexFormat$1=new VertexFormat;function constructExtrudedRectangle$1(e,t){var i,r=e._shadowVolume,n=e._offsetAttribute,a=e._vertexFormat,o=e._extrudedHeight,s=e._surfaceHeight,l=e._ellipsoid,c=t.height,u=t.width;if(r){var d=VertexFormat.clone(a,scratchVertexFormat$1);d.normal=!0,e._vertexFormat=d}var h=constructRectangle$1(e,t);r&&(e._vertexFormat=a);var p=PolygonPipeline.scaleToGeodeticHeight(h.attributes.position.values,s,l,!1),f=(p=new Float64Array(p)).length,m=2*f,g=new Float64Array(m);g.set(p);var _=PolygonPipeline.scaleToGeodeticHeight(h.attributes.position.values,o,l);g.set(_,f),h.attributes.position.values=g;var y,v,C=a.normal?new Float32Array(m):void 0,T=a.tangent?new Float32Array(m):void 0,S=a.bitangent?new Float32Array(m):void 0,A=a.st?new Float32Array(m/3*2):void 0;if(a.normal){for(v=h.attributes.normal.values,C.set(v),i=0;i<f;i++)v[i]=-v[i];C.set(v,f),h.attributes.normal.values=C}if(r){v=h.attributes.normal.values,a.normal||(h.attributes.normal=void 0);var x=new Float32Array(m);for(i=0;i<f;i++)v[i]=-v[i];x.set(v,f),h.attributes.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:x})}var E=defined(n);if(E){var b=f/3*2,P=new Uint8Array(b);P=n===GeometryOffsetAttribute$1.TOP?arrayFill(P,1,0,b/2):arrayFill(P,n===GeometryOffsetAttribute$1.NONE?0:1),h.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:P})}if(a.tangent){var D=h.attributes.tangent.values;for(T.set(D),i=0;i<f;i++)D[i]=-D[i];T.set(D,f),h.attributes.tangent.values=T}if(a.bitangent){var w=h.attributes.bitangent.values;S.set(w),S.set(w,f),h.attributes.bitangent.values=S}a.st&&(y=h.attributes.st.values,A.set(y),A.set(y,f/3*2),h.attributes.st.values=A);var M=h.indices,I=M.length,R=f/3,O=IndexDatatype$1.createTypedArray(m/3,2*I);for(O.set(M),i=0;i<I;i+=3)O[i+I]=M[i+2]+R,O[i+1+I]=M[i+1]+R,O[i+2+I]=M[i]+R;h.indices=O;var B=t.northCap,L=t.southCap,F=c,N=2,V=0,k=4,U=4;B&&(N-=1,F-=1,V+=1,k-=2,U-=1),L&&(N-=1,F-=1,V+=1,k-=2,U-=1);var G=2*((V+=N*u+2*F-k)+U),$=new Float64Array(3*G),z=r?new Float32Array(3*G):void 0,H=E?new Uint8Array(G):void 0,W=a.st?new Float32Array(2*G):void 0,j=n===GeometryOffsetAttribute$1.TOP;E&&!j&&(H=arrayFill(H,n===GeometryOffsetAttribute$1.ALL?1:0));var q,X=0,Y=0,K=0,J=0,Q=u*F;for(i=0;i<Q;i+=u)$=addWallPositions($,X,q=3*i,p,_),X+=6,a.st&&(W=addWallTextureCoordinates(W,Y,2*i,y),Y+=4),r&&(K+=3,z[K++]=v[q],z[K++]=v[q+1],z[K++]=v[q+2]),j&&(H[J++]=1,J+=1);if(L){var Z=B?Q+1:Q;for(q=3*Z,i=0;i<2;i++)$=addWallPositions($,X,q,p,_),X+=6,a.st&&(W=addWallTextureCoordinates(W,Y,2*Z,y),Y+=4),r&&(K+=3,z[K++]=v[q],z[K++]=v[q+1],z[K++]=v[q+2]),j&&(H[J++]=1,J+=1)}else for(i=Q-u;i<Q;i++)$=addWallPositions($,X,q=3*i,p,_),X+=6,a.st&&(W=addWallTextureCoordinates(W,Y,2*i,y),Y+=4),r&&(K+=3,z[K++]=v[q],z[K++]=v[q+1],z[K++]=v[q+2]),j&&(H[J++]=1,J+=1);for(i=Q-1;i>0;i-=u)$=addWallPositions($,X,q=3*i,p,_),X+=6,a.st&&(W=addWallTextureCoordinates(W,Y,2*i,y),Y+=4),r&&(K+=3,z[K++]=v[q],z[K++]=v[q+1],z[K++]=v[q+2]),j&&(H[J++]=1,J+=1);if(B){var ee=Q;for(q=3*ee,i=0;i<2;i++)$=addWallPositions($,X,q,p,_),X+=6,a.st&&(W=addWallTextureCoordinates(W,Y,2*ee,y),Y+=4),r&&(K+=3,z[K++]=v[q],z[K++]=v[q+1],z[K++]=v[q+2]),j&&(H[J++]=1,J+=1)}else for(i=u-1;i>=0;i--)$=addWallPositions($,X,q=3*i,p,_),X+=6,a.st&&(W=addWallTextureCoordinates(W,Y,2*i,y),Y+=4),r&&(K+=3,z[K++]=v[q],z[K++]=v[q+1],z[K++]=v[q+2]),j&&(H[J++]=1,J+=1);var te=calculateAttributesWall($,a,l);a.st&&(te.attributes.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:W})),r&&(te.attributes.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:z})),E&&(te.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:H}));var ie,re,ne,ae,oe=IndexDatatype$1.createTypedArray(G,6*V);f=$.length/3;var se=0;for(i=0;i<f-1;i+=2){ae=((ie=i)+2)%f;var le=Cartesian3.fromArray($,3*ie,v1Scratch),ce=Cartesian3.fromArray($,3*ae,v2Scratch);Cartesian3.equalsEpsilon(le,ce,CesiumMath.EPSILON10)||(ne=((re=(ie+1)%f)+2)%f,oe[se++]=ie,oe[se++]=re,oe[se++]=ae,oe[se++]=ae,oe[se++]=re,oe[se++]=ne)}return te.indices=oe,(te=GeometryPipeline.combineInstances([new GeometryInstance({geometry:h}),new GeometryInstance({geometry:te})]))[0]}var scratchRectanglePoints=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3],nwScratch$1=new Cartographic,stNwScratch=new Cartographic;function computeRectangle(e,t,i,r,n){if(0===i)return Rectangle.clone(e,n);var a=RectangleGeometryLibrary.computeOptions(e,t,i,0,rectangleScratch$5,nwScratch$1),o=a.height,s=a.width,l=scratchRectanglePoints;return RectangleGeometryLibrary.computePosition(a,r,!1,0,0,l[0]),RectangleGeometryLibrary.computePosition(a,r,!1,0,s-1,l[1]),RectangleGeometryLibrary.computePosition(a,r,!1,o-1,0,l[2]),RectangleGeometryLibrary.computePosition(a,r,!1,o-1,s-1,l[3]),Rectangle.fromCartesianArray(l,r,n)}function RectangleGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).rectangle,i=defaultValue(e.height,0),r=defaultValue(e.extrudedHeight,i);this._rectangle=Rectangle.clone(t),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._surfaceHeight=Math.max(i,r),this._rotation=defaultValue(e.rotation,0),this._stRotation=defaultValue(e.stRotation,0),this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._extrudedHeight=Math.min(i,r),this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createRectangleGeometry",this._offsetAttribute=e.offsetAttribute,this._rotatedRectangle=void 0,this._textureCoordinateRotationPoints=void 0}RectangleGeometry.packedLength=Rectangle.packedLength+Ellipsoid.packedLength+VertexFormat.packedLength+7,RectangleGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Rectangle.pack(e._rectangle,t,i),i+=Rectangle.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._granularity,t[i++]=e._surfaceHeight,t[i++]=e._rotation,t[i++]=e._stRotation,t[i++]=e._extrudedHeight,t[i++]=e._shadowVolume?1:0,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchRectangle$8=new Rectangle,scratchEllipsoid$4=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$5={rectangle:scratchRectangle$8,ellipsoid:scratchEllipsoid$4,vertexFormat:scratchVertexFormat$1,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};RectangleGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Rectangle.unpack(e,t,scratchRectangle$8);t+=Rectangle.packedLength;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$4);t+=Ellipsoid.packedLength;var a=VertexFormat.unpack(e,t,scratchVertexFormat$1);t+=VertexFormat.packedLength;var o=e[t++],s=e[t++],l=e[t++],c=e[t++],u=e[t++],d=1===e[t++],h=e[t];return defined(i)?(i._rectangle=Rectangle.clone(r,i._rectangle),i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._vertexFormat=VertexFormat.clone(a,i._vertexFormat),i._granularity=o,i._surfaceHeight=s,i._rotation=l,i._stRotation=c,i._extrudedHeight=u,i._shadowVolume=d,i._offsetAttribute=-1===h?void 0:h,i):(scratchOptions$5.granularity=o,scratchOptions$5.height=s,scratchOptions$5.rotation=l,scratchOptions$5.stRotation=c,scratchOptions$5.extrudedHeight=u,scratchOptions$5.shadowVolume=d,scratchOptions$5.offsetAttribute=-1===h?void 0:h,new RectangleGeometry(scratchOptions$5))},RectangleGeometry.computeRectangle=function(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).rectangle,r=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),n=defaultValue(e.ellipsoid,Ellipsoid.WGS84);return computeRectangle(i,r,defaultValue(e.rotation,0),n,t)};var tangentRotationMatrixScratch=new Matrix3,quaternionScratch=new Quaternion,centerScratch$3=new Cartographic;RectangleGeometry.createGeometry=function(e){if(!CesiumMath.equalsEpsilon(e._rectangle.north,e._rectangle.south,CesiumMath.EPSILON10)&&!CesiumMath.equalsEpsilon(e._rectangle.east,e._rectangle.west,CesiumMath.EPSILON10)){var t=e._rectangle,i=e._ellipsoid,r=e._rotation,n=e._stRotation,a=e._vertexFormat,o=RectangleGeometryLibrary.computeOptions(t,e._granularity,r,n,rectangleScratch$5,nwScratch$1,stNwScratch),s=tangentRotationMatrixScratch;if(0!==n||0!==r){var l=Rectangle.center(t,centerScratch$3),c=i.geodeticSurfaceNormalCartographic(l,v1Scratch);Quaternion.fromAxisAngle(c,-n,quaternionScratch),Matrix3.fromQuaternion(quaternionScratch,s)}else Matrix3.clone(Matrix3.IDENTITY,s);var u,d,h=e._surfaceHeight,p=e._extrudedHeight,f=!CesiumMath.equalsEpsilon(h,p,0,CesiumMath.EPSILON2);if(o.lonScalar=1/e._rectangle.width,o.latScalar=1/e._rectangle.height,o.tangentRotationMatrix=s,t=e._rectangle,f){u=constructExtrudedRectangle$1(e,o);var m=BoundingSphere.fromRectangle3D(t,i,h,topBoundingSphere$1),g=BoundingSphere.fromRectangle3D(t,i,p,bottomBoundingSphere$1);d=BoundingSphere.union(m,g)}else{if((u=constructRectangle$1(e,o)).attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(u.attributes.position.values,h,i,!1),defined(e._offsetAttribute)){var _=u.attributes.position.values.length,y=new Uint8Array(_/3);arrayFill(y,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),u.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}d=BoundingSphere.fromRectangle3D(t,i,h)}return a.position||delete u.attributes.position,new Geometry({attributes:u.attributes,indices:u.indices,primitiveType:u.primitiveType,boundingSphere:d,offsetAttribute:e._offsetAttribute})}},RectangleGeometry.createShadowVolume=function(e,t,i){var r=e._granularity,n=e._ellipsoid,a=t(r,n),o=i(r,n);return new RectangleGeometry({rectangle:e._rectangle,rotation:e._rotation,ellipsoid:n,stRotation:e._stRotation,granularity:r,extrudedHeight:o,height:a,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})};var unrotatedTextureRectangleScratch=new Rectangle,points2DScratch$1=[new Cartesian2,new Cartesian2,new Cartesian2],rotation2DScratch=new Matrix2,rectangleCenterScratch$2=new Cartographic;function textureCoordinateRotationPoints(e){if(0===e._stRotation)return[0,0,0,1,1,0];var t=Rectangle.clone(e._rectangle,unrotatedTextureRectangleScratch),i=e._granularity,r=e._ellipsoid,n=computeRectangle(t,i,e._rotation-e._stRotation,r,unrotatedTextureRectangleScratch),a=points2DScratch$1;a[0].x=n.west,a[0].y=n.south,a[1].x=n.west,a[1].y=n.north,a[2].x=n.east,a[2].y=n.south;for(var o=e.rectangle,s=Matrix2.fromRotation(e._stRotation,rotation2DScratch),l=Rectangle.center(o,rectangleCenterScratch$2),c=0;c<3;++c){var u=a[c];u.x-=l.longitude,u.y-=l.latitude,Matrix2.multiplyByVector(s,u,u),u.x+=l.longitude,u.y+=l.latitude,u.x=(u.x-o.west)/o.width,u.y=(u.y-o.south)/o.height}var d=a[0],h=a[1],p=a[2],f=new Array(6);return Cartesian2.pack(d,f),Cartesian2.pack(h,f,2),Cartesian2.pack(p,f,4),f}Object.defineProperties(RectangleGeometry.prototype,{rectangle:{get:function(){return defined(this._rotatedRectangle)||(this._rotatedRectangle=computeRectangle(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=textureCoordinateRotationPoints(this)),this._textureCoordinateRotationPoints}}});var bottomBoundingSphere=new BoundingSphere,topBoundingSphere=new BoundingSphere,positionScratch$8=new Cartesian3,rectangleScratch$4=new Rectangle;function constructRectangle(e,t){var i=e._ellipsoid,r=t.height,n=t.width,a=t.northCap,o=t.southCap,s=r,l=2,c=0,u=4;a&&(l-=1,s-=1,c+=1,u-=2),o&&(l-=1,s-=1,c+=1,u-=2),c+=l*n+2*s-u;var d,h=new Float64Array(3*c),p=0,f=0,m=positionScratch$8;if(a)RectangleGeometryLibrary.computePosition(t,i,!1,f,0,m),h[p++]=m.x,h[p++]=m.y,h[p++]=m.z;else for(d=0;d<n;d++)RectangleGeometryLibrary.computePosition(t,i,!1,f,d,m),h[p++]=m.x,h[p++]=m.y,h[p++]=m.z;for(d=n-1,f=1;f<r;f++)RectangleGeometryLibrary.computePosition(t,i,!1,f,d,m),h[p++]=m.x,h[p++]=m.y,h[p++]=m.z;if(f=r-1,!o)for(d=n-2;d>=0;d--)RectangleGeometryLibrary.computePosition(t,i,!1,f,d,m),h[p++]=m.x,h[p++]=m.y,h[p++]=m.z;for(d=0,f=r-2;f>0;f--)RectangleGeometryLibrary.computePosition(t,i,!1,f,d,m),h[p++]=m.x,h[p++]=m.y,h[p++]=m.z;for(var g=h.length/3*2,_=IndexDatatype$1.createTypedArray(h.length/3,g),y=0,v=0;v<h.length/3-1;v++)_[y++]=v,_[y++]=v+1;_[y++]=h.length/3-1,_[y++]=0;var C=new Geometry({attributes:new GeometryAttributes,primitiveType:PrimitiveType$1.LINES});return C.attributes.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:h}),C.indices=_,C}function constructExtrudedRectangle(e,t){var i=e._surfaceHeight,r=e._extrudedHeight,n=e._ellipsoid,a=r,o=i,s=constructRectangle(e,t),l=t.height,c=t.width,u=PolygonPipeline.scaleToGeodeticHeight(s.attributes.position.values,o,n,!1),d=u.length,h=new Float64Array(2*d);h.set(u);var p=PolygonPipeline.scaleToGeodeticHeight(s.attributes.position.values,a,n);h.set(p,d),s.attributes.position.values=h;var f=t.northCap,m=t.southCap,g=4;f&&(g-=1),m&&(g-=1);var _=2*(h.length/3+g),y=IndexDatatype$1.createTypedArray(h.length/3,_);d=h.length/6;for(var v,C=0,T=0;T<d-1;T++)y[C++]=T,y[C++]=T+1,y[C++]=T+d,y[C++]=T+d+1;if(y[C++]=d-1,y[C++]=0,y[C++]=d+d-1,y[C++]=d,y[C++]=0,y[C++]=d,f)v=l-1;else{var S=c-1;y[C++]=S,y[C++]=S+d,v=c+l-2}if(y[C++]=v,y[C++]=v+d,!m){var A=c+v-1;y[C++]=A,y[C]=A+d}return s.indices=y,s}function RectangleOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).rectangle,i=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),r=defaultValue(e.ellipsoid,Ellipsoid.WGS84),n=defaultValue(e.rotation,0),a=defaultValue(e.height,0),o=defaultValue(e.extrudedHeight,a);this._rectangle=Rectangle.clone(t),this._granularity=i,this._ellipsoid=r,this._surfaceHeight=Math.max(a,o),this._rotation=n,this._extrudedHeight=Math.min(a,o),this._offsetAttribute=e.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}RectangleOutlineGeometry.packedLength=Rectangle.packedLength+Ellipsoid.packedLength+5,RectangleOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Rectangle.pack(e._rectangle,t,i),i+=Rectangle.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._granularity,t[i++]=e._surfaceHeight,t[i++]=e._rotation,t[i++]=e._extrudedHeight,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchRectangle$7=new Rectangle,scratchEllipsoid$3=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$4={rectangle:scratchRectangle$7,ellipsoid:scratchEllipsoid$3,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};RectangleOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Rectangle.unpack(e,t,scratchRectangle$7);t+=Rectangle.packedLength;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$3);t+=Ellipsoid.packedLength;var a=e[t++],o=e[t++],s=e[t++],l=e[t++],c=e[t];return defined(i)?(i._rectangle=Rectangle.clone(r,i._rectangle),i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._surfaceHeight=o,i._rotation=s,i._extrudedHeight=l,i._offsetAttribute=-1===c?void 0:c,i):(scratchOptions$4.granularity=a,scratchOptions$4.height=o,scratchOptions$4.rotation=s,scratchOptions$4.extrudedHeight=l,scratchOptions$4.offsetAttribute=-1===c?void 0:c,new RectangleOutlineGeometry(scratchOptions$4))};var nwScratch=new Cartographic;RectangleOutlineGeometry.createGeometry=function(e){var t,i,r=e._rectangle,n=e._ellipsoid,a=RectangleGeometryLibrary.computeOptions(r,e._granularity,e._rotation,0,rectangleScratch$4,nwScratch);if(!CesiumMath.equalsEpsilon(r.north,r.south,CesiumMath.EPSILON10)&&!CesiumMath.equalsEpsilon(r.east,r.west,CesiumMath.EPSILON10)){var o=e._surfaceHeight,s=e._extrudedHeight;if(!CesiumMath.equalsEpsilon(o,s,0,CesiumMath.EPSILON2)){if(t=constructExtrudedRectangle(e,a),defined(e._offsetAttribute)){var l=t.attributes.position.values.length/3,c=new Uint8Array(l);c=e._offsetAttribute===GeometryOffsetAttribute$1.TOP?arrayFill(c,1,0,l/2):arrayFill(c,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),t.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}var u=BoundingSphere.fromRectangle3D(r,n,o,topBoundingSphere),d=BoundingSphere.fromRectangle3D(r,n,s,bottomBoundingSphere);i=BoundingSphere.union(u,d)}else{if((t=constructRectangle(e,a)).attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(t.attributes.position.values,o,n,!1),defined(e._offsetAttribute)){var h=t.attributes.position.values.length,p=new Uint8Array(h/3);arrayFill(p,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),t.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}i=BoundingSphere.fromRectangle3D(r,n,o)}return new Geometry({attributes:t.attributes,indices:t.indices,primitiveType:PrimitiveType$1.LINES,boundingSphere:i,offsetAttribute:e._offsetAttribute})}};var ReferenceFrame={FIXED:0,INERTIAL:1},ReferenceFrame$1=Object.freeze(ReferenceFrame),implementation;function requestAnimationFramePolyFill(e){return implementation(e)}"undefined"!=typeof requestAnimationFrame&&(implementation=requestAnimationFrame),function(){if(!defined(implementation)&&"undefined"!=typeof window)for(var e=["webkit","moz","ms","o"],t=0,i=e.length;t<i&&!defined(implementation);)implementation=window[e[t]+"RequestAnimationFrame"],++t;if(!defined(implementation)){var r=0;implementation=function(e){var t=getTimestamp$1(),i=Math.max(16.666666666666668-(t-r),0);return r=t+i,setTimeout((function(){e(r)}),i)}}}();var S2_MAX_LEVEL=30,S2_LIMIT_IJ=1<<S2_MAX_LEVEL,S2_MAX_SITI=1<<S2_MAX_LEVEL+1>>>0,S2_POSITION_BITS=2*S2_MAX_LEVEL+1,S2_LOOKUP_BITS=4,S2_LOOKUP_POSITIONS=[],S2_LOOKUP_IJ=[],S2_POSITION_TO_IJ=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],S2_SWAP_MASK=1,S2_INVERT_MASK=2,S2_POSITION_TO_ORIENTATION_MASK=[S2_SWAP_MASK,0,0,S2_SWAP_MASK|S2_INVERT_MASK];function S2Cell(e){if(!FeatureDetection.supportsBigInt())throw new RuntimeError("S2 required BigInt support");this._cellId=e,this._level=S2Cell.getLevel(e)}function getS2Center(e,t){var i=convertCellIdToFaceSiTi(e,t);return convertFaceSiTitoXYZ(i[0],i[1],i[2])}function getS2Vertex(e,t,i){var r=convertCellIdToFaceIJ(e),n=convertIJLeveltoBoundUV([r[1],r[2]],t),a=i>>1&1;return convertFaceUVtoXYZ(r[0],n[0][a^1&i],n[1][a])}function convertCellIdToFaceSiTi(e,t){var i=convertCellIdToFaceIJ(e),r=i[0],n=i[1],a=i[2],o=30===t,s=!o&&(BigInt(n)^e>>BigInt(2))&BigInt(1),l=o?1:s?2:0;return[r,(n<<1)+l,(a<<1)+l]}function convertCellIdToFaceIJ(e){0===S2_LOOKUP_POSITIONS.length&&generateLookupTable();for(var t=Number(e>>BigInt(S2_POSITION_BITS)),i=t&S2_SWAP_MASK,r=(1<<S2_LOOKUP_BITS)-1,n=0,a=0,o=7;o>=0;o--){var s=(1<<2*(7===o?S2_MAX_LEVEL-7*S2_LOOKUP_BITS:S2_LOOKUP_BITS))-1;i+=Number(e>>BigInt(2*o*S2_LOOKUP_BITS+1)&BigInt(s))<<2,i=S2_LOOKUP_IJ[i];var l=o*S2_LOOKUP_BITS;n+=i>>S2_LOOKUP_BITS+2<<l,a+=(i>>2&r)<<l,i&=S2_SWAP_MASK|S2_INVERT_MASK}return[t,n,a]}function convertFaceSiTitoXYZ(e,t,i){var r=convertSiTitoST(t),n=convertSiTitoST(i);return convertFaceUVtoXYZ(e,convertSTtoUV(r),convertSTtoUV(n))}function convertFaceUVtoXYZ(e,t,i){switch(e){case 0:return new Cartesian3(1,t,i);case 1:return new Cartesian3(-t,1,i);case 2:return new Cartesian3(-t,-i,1);case 3:return new Cartesian3(-1,-i,-t);case 4:return new Cartesian3(i,-1,-t);default:return new Cartesian3(i,t,-1)}}function convertSTtoUV(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function convertSiTitoST(e){return 1/S2_MAX_SITI*e}function convertIJLeveltoBoundUV(e,t){for(var i=[[],[]],r=getSizeIJ(t),n=0;n<2;++n){var a=e[n]&-r,o=a+r;i[n][0]=convertSTtoUV(convertIJtoSTMinimum(a)),i[n][1]=convertSTtoUV(convertIJtoSTMinimum(o))}return i}function getSizeIJ(e){return 1<<S2_MAX_LEVEL-e>>>0}function convertIJtoSTMinimum(e){return 1/S2_LIMIT_IJ*e}function generateLookupCell(e,t,i,r,n,a){if(e===S2_LOOKUP_BITS){var o=(t<<S2_LOOKUP_BITS)+i;S2_LOOKUP_POSITIONS[(o<<2)+r]=(n<<2)+a,S2_LOOKUP_IJ[(n<<2)+r]=(o<<2)+a}else{e++,t<<=1,i<<=1,n<<=2;var s=S2_POSITION_TO_IJ[a];generateLookupCell(e,t+(s[0]>>1),i+(1&s[0]),r,n,a^S2_POSITION_TO_ORIENTATION_MASK[0]),generateLookupCell(e,t+(s[1]>>1),i+(1&s[1]),r,n+1,a^S2_POSITION_TO_ORIENTATION_MASK[1]),generateLookupCell(e,t+(s[2]>>1),i+(1&s[2]),r,n+2,a^S2_POSITION_TO_ORIENTATION_MASK[2]),generateLookupCell(e,t+(s[3]>>1),i+(1&s[3]),r,n+3,a^S2_POSITION_TO_ORIENTATION_MASK[3])}}function generateLookupTable(){generateLookupCell(0,0,0,0,0,0),generateLookupCell(0,0,0,S2_SWAP_MASK,0,S2_SWAP_MASK),generateLookupCell(0,0,0,S2_INVERT_MASK,0,S2_INVERT_MASK),generateLookupCell(0,0,0,S2_SWAP_MASK|S2_INVERT_MASK,0,S2_SWAP_MASK|S2_INVERT_MASK)}function lsb(e){return e&~e+BigInt(1)}function lsbForLevel(e){return BigInt(1)<<BigInt(2*(S2_MAX_LEVEL-e))}S2Cell.fromToken=function(e){return new S2Cell(S2Cell.getIdFromToken(e))},S2Cell.isValidId=function(e){return!(e<=0)&&(!(e>>BigInt(S2_POSITION_BITS)>5)&&!!(e&~e+BigInt(1)&BigInt("0x1555555555555555")))},S2Cell.isValidToken=function(e){return!!/^[0-9a-fA-F]{1,16}$/.test(e)&&S2Cell.isValidId(S2Cell.getIdFromToken(e))},S2Cell.getIdFromToken=function(e){return BigInt("0x"+e+"0".repeat(16-e.length))},S2Cell.getTokenFromId=function(e){var t=Math.floor(countTrailingZeroBits(e)/4),i=e.toString(16).replace(/0*$/,"");return Array(17-t-i.length).join("0")+i},S2Cell.getLevel=function(e){for(var t=0;e!==BigInt(0)&&!(e&BigInt(1));)t++,e>>=BigInt(1);return S2_MAX_LEVEL-(t>>1)},S2Cell.prototype.getChild=function(e){var t=lsb(this._cellId)>>BigInt(2);return new S2Cell(this._cellId+BigInt(2*e+1-4)*t)},S2Cell.prototype.getParent=function(){var e=lsb(this._cellId)<<BigInt(2);return new S2Cell(this._cellId&~e+BigInt(1)|e)},S2Cell.prototype.getParentAtLevel=function(e){var t=lsbForLevel(e);return new S2Cell(this._cellId&-t|t)},S2Cell.prototype.getCenter=function(e){e=defaultValue(e,Ellipsoid.WGS84);var t=getS2Center(this._cellId,this._level);t=Cartesian3.normalize(t,t);var i=new Cartographic.fromCartesian(t,Ellipsoid.UNIT_SPHERE);return Cartographic.toCartesian(i,e,new Cartesian3)},S2Cell.prototype.getVertex=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);var i=getS2Vertex(this._cellId,this._level,e);i=Cartesian3.normalize(i,i);var r=new Cartographic.fromCartesian(i,Ellipsoid.UNIT_SPHERE);return Cartographic.toCartesian(r,t,new Cartesian3)},S2Cell.fromFacePositionLevel=function(e,t,i){var r=(e<4?"0":"")+(e<2?"0":"")+e.toString(2),n=t.toString(2),a=Array(2*i-n.length+1).join("0"),o=Array(S2_POSITION_BITS-2*i).join("0");return new S2Cell(BigInt("0b"+r+a+n+"1"+o))};var Mod67BitPosition=[64,0,1,39,2,15,40,23,3,12,16,59,41,19,24,54,4,64,13,10,17,62,60,28,42,30,20,51,25,44,55,47,5,32,65,38,14,22,11,58,18,53,63,9,61,27,29,50,43,46,31,37,21,57,52,8,26,49,45,36,56,7,48,35,6,34,33,0];function countTrailingZeroBits(e){return Mod67BitPosition[(-e&e)%BigInt(67)]}function sampleTerrain(e,t,i){return e.readyPromise.then((function(){return doSampling(e,t,i)}))}function doSampling(e,t,i){var r,n=e.tilingScheme,a=[],o={};for(r=0;r<i.length;++r){var s=n.positionToTileXY(i[r],t),l=s.toString();if(!o.hasOwnProperty(l)){var c={x:s.x,y:s.y,level:t,tilingScheme:n,terrainProvider:e,positions:[]};o[l]=c,a.push(c)}o[l].positions.push(i[r])}var u=[];for(r=0;r<a.length;++r){var d=a[r],h=d.terrainProvider.requestTileGeometry(d.x,d.y,d.level).then(createInterpolateFunction(d)).otherwise(createMarkFailedFunction(d));u.push(h)}return when.all(u,(function(){return i}))}function interpolateAndAssignHeight(e,t,i){var r=t.interpolateHeight(i,e.longitude,e.latitude);return void 0!==r&&(e.height=r,!0)}function createInterpolateFunction(e){var t=e.positions,i=e.tilingScheme.tileXYToRectangle(e.x,e.y,e.level);return function(r){for(var n=!1,a=0;a<t.length;++a){if(!interpolateAndAssignHeight(t[a],r,i)){n=!0;break}}return n?r.createMesh({tilingScheme:e.tilingScheme,x:e.x,y:e.y,level:e.level,throttle:!1}).then((function(){for(var e=0;e<t.length;++e){interpolateAndAssignHeight(t[e],r,i)}})):when.resolve()}}function createMarkFailedFunction(e){var t=e.positions;return function(){for(var e=0;e<t.length;++e){t[e].height=void 0}}}var scratchCartesian2$4=new Cartesian2;function sampleTerrainMostDetailed(e,t){return e.readyPromise.then((function(){for(var i=[],r=[],n=e.availability,a=[],o=0;o<t.length;++o){var s=t[o],l=n.computeMaximumLevelAtPosition(s);if(r[o]=l,0===l){e.tilingScheme.positionToTileXY(s,1,scratchCartesian2$4);var c=e.loadTileDataAvailability(scratchCartesian2$4.x,scratchCartesian2$4.y,1);defined(c)&&a.push(c)}var u=i[l];defined(u)||(i[l]=u=[]),u.push(s)}return when.all(a).then((function(){return when.all(i.map((function(t,i){if(defined(t))return sampleTerrain(e,i,t)})))})).then((function(){for(var i=[],a=0;a<t.length;++a){var o=t[a];n.computeMaximumLevelAtPosition(o)!==r[a]&&i.push(o)}if(i.length>0)return sampleTerrainMostDetailed(e,i)})).then((function(){return t}))}))}var ScreenSpaceEventType={LEFT_DOWN:0,LEFT_UP:1,LEFT_CLICK:2,LEFT_DOUBLE_CLICK:3,RIGHT_DOWN:5,RIGHT_UP:6,RIGHT_CLICK:7,MIDDLE_DOWN:10,MIDDLE_UP:11,MIDDLE_CLICK:12,MOUSE_MOVE:15,WHEEL:16,PINCH_START:17,PINCH_END:18,PINCH_MOVE:19},ScreenSpaceEventType$1=Object.freeze(ScreenSpaceEventType);function getPosition$1(e,t,i){var r=e._element;if(r===document)return i.x=t.clientX,i.y=t.clientY,i;var n=r.getBoundingClientRect();return i.x=t.clientX-n.left,i.y=t.clientY-n.top,i}function getInputEventKey(e,t){var i=e;return defined(t)&&(i+="+"+t),i}function getModifier(e){return e.shiftKey?KeyboardEventModifier$1.SHIFT:e.ctrlKey?KeyboardEventModifier$1.CTRL:e.altKey?KeyboardEventModifier$1.ALT:void 0}var MouseButton={LEFT:0,MIDDLE:1,RIGHT:2};function registerListener(e,t,i,r){function n(t){r(e,t)}FeatureDetection.isInternetExplorer()?i.addEventListener(t,n,!1):i.addEventListener(t,n,{capture:!1,passive:!1}),e._removalFunctions.push((function(){i.removeEventListener(t,n,!1)}))}function registerListeners(e){var t=e._element,i=defined(t.disableRootEvents)?t:document;FeatureDetection.supportsPointerEvents()?(registerListener(e,"pointerdown",t,handlePointerDown),registerListener(e,"pointerup",t,handlePointerUp),registerListener(e,"pointermove",t,handlePointerMove),registerListener(e,"pointercancel",t,handlePointerUp)):(registerListener(e,"mousedown",t,handleMouseDown),registerListener(e,"mouseup",i,handleMouseUp),registerListener(e,"mousemove",i,handleMouseMove),registerListener(e,"touchstart",t,handleTouchStart),registerListener(e,"touchend",i,handleTouchEnd),registerListener(e,"touchmove",i,handleTouchMove),registerListener(e,"touchcancel",i,handleTouchEnd)),registerListener(e,"dblclick",t,handleDblClick),registerListener(e,"onwheel"in t?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",t,handleWheel)}function unregisterListeners(e){for(var t=e._removalFunctions,i=0;i<t.length;++i)t[i]()}var mouseDownEvent={position:new Cartesian2};function gotTouchEvent(e){e._lastSeenTouchEvent=getTimestamp$1()}function canProcessMouseEvent(e){return getTimestamp$1()-e._lastSeenTouchEvent>ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds}function checkPixelTolerance(e,t,i){var r=e.x-t.x,n=e.y-t.y;return Math.sqrt(r*r+n*n)<i}function handleMouseDown(e,t){if(canProcessMouseEvent(e)){var i,r=t.button;if(e._buttonDown[r]=!0,r===MouseButton.LEFT)i=ScreenSpaceEventType$1.LEFT_DOWN;else if(r===MouseButton.MIDDLE)i=ScreenSpaceEventType$1.MIDDLE_DOWN;else{if(r!==MouseButton.RIGHT)return;i=ScreenSpaceEventType$1.RIGHT_DOWN}var n=getPosition$1(e,t,e._primaryPosition);Cartesian2.clone(n,e._primaryStartPosition),Cartesian2.clone(n,e._primaryPreviousPosition);var a=getModifier(t),o=e.getInputAction(i,a);defined(o)&&(Cartesian2.clone(n,mouseDownEvent.position),o(mouseDownEvent),t.preventDefault())}}var mouseUpEvent={position:new Cartesian2},mouseClickEvent={position:new Cartesian2};function cancelMouseEvent(e,t,i,r){var n=getModifier(r),a=e.getInputAction(t,n),o=e.getInputAction(i,n);if(defined(a)||defined(o)){var s=getPosition$1(e,r,e._primaryPosition);if(defined(a)&&(Cartesian2.clone(s,mouseUpEvent.position),a(mouseUpEvent)),defined(o))checkPixelTolerance(e._primaryStartPosition,s,e._clickPixelTolerance)&&(Cartesian2.clone(s,mouseClickEvent.position),o(mouseClickEvent))}}function handleMouseUp(e,t){if(canProcessMouseEvent(e)){var i=t.button;i!==MouseButton.LEFT&&i!==MouseButton.MIDDLE&&i!==MouseButton.RIGHT||(e._buttonDown[MouseButton.LEFT]&&(cancelMouseEvent(e,ScreenSpaceEventType$1.LEFT_UP,ScreenSpaceEventType$1.LEFT_CLICK,t),e._buttonDown[MouseButton.LEFT]=!1),e._buttonDown[MouseButton.MIDDLE]&&(cancelMouseEvent(e,ScreenSpaceEventType$1.MIDDLE_UP,ScreenSpaceEventType$1.MIDDLE_CLICK,t),e._buttonDown[MouseButton.MIDDLE]=!1),e._buttonDown[MouseButton.RIGHT]&&(cancelMouseEvent(e,ScreenSpaceEventType$1.RIGHT_UP,ScreenSpaceEventType$1.RIGHT_CLICK,t),e._buttonDown[MouseButton.RIGHT]=!1))}}var mouseMoveEvent={startPosition:new Cartesian2,endPosition:new Cartesian2};function handleMouseMove(e,t){if(canProcessMouseEvent(e)){var i=getModifier(t),r=getPosition$1(e,t,e._primaryPosition),n=e._primaryPreviousPosition,a=e.getInputAction(ScreenSpaceEventType$1.MOUSE_MOVE,i);defined(a)&&(Cartesian2.clone(n,mouseMoveEvent.startPosition),Cartesian2.clone(r,mouseMoveEvent.endPosition),a(mouseMoveEvent)),Cartesian2.clone(r,n),(e._buttonDown[MouseButton.LEFT]||e._buttonDown[MouseButton.MIDDLE]||e._buttonDown[MouseButton.RIGHT])&&t.preventDefault()}}var mouseDblClickEvent={position:new Cartesian2};function handleDblClick(e,t){var i;if(t.button===MouseButton.LEFT){i=ScreenSpaceEventType$1.LEFT_DOUBLE_CLICK;var r=getModifier(t),n=e.getInputAction(i,r);defined(n)&&(getPosition$1(e,t,mouseDblClickEvent.position),n(mouseDblClickEvent))}}function handleWheel(e,t){var i;if(defined(t.deltaY)){var r=t.deltaMode;i=r===t.DOM_DELTA_PIXEL?-t.deltaY:r===t.DOM_DELTA_LINE?40*-t.deltaY:120*-t.deltaY}else i=t.detail>0?-120*t.detail:t.wheelDelta;if(defined(i)){var n=getModifier(t),a=e.getInputAction(ScreenSpaceEventType$1.WHEEL,n);defined(a)&&(a(i),t.preventDefault())}}function handleTouchStart(e,t){gotTouchEvent(e);var i,r,n,a=t.changedTouches,o=a.length,s=e._positions;for(i=0;i<o;++i)n=(r=a[i]).identifier,s.set(n,getPosition$1(e,r,new Cartesian2));fireTouchEvents(e,t);var l=e._previousPositions;for(i=0;i<o;++i)n=(r=a[i]).identifier,l.set(n,Cartesian2.clone(s.get(n)))}function handleTouchEnd(e,t){gotTouchEvent(e);var i,r,n=t.changedTouches,a=n.length,o=e._positions;for(i=0;i<a;++i)r=n[i].identifier,o.remove(r);fireTouchEvents(e,t);var s=e._previousPositions;for(i=0;i<a;++i)r=n[i].identifier,s.remove(r)}var touchStartEvent={position:new Cartesian2},touch2StartEvent={position1:new Cartesian2,position2:new Cartesian2},touchEndEvent={position:new Cartesian2},touchClickEvent={position:new Cartesian2},touchHoldEvent={position:new Cartesian2};function fireTouchEvents(e,t){var i,r,n=getModifier(t),a=e._positions,o=a.length,s=e._isPinching;if(1!==o&&e._buttonDown[MouseButton.LEFT]){if(e._buttonDown[MouseButton.LEFT]=!1,defined(e._touchHoldTimer)&&(clearTimeout(e._touchHoldTimer),e._touchHoldTimer=void 0),defined(i=e.getInputAction(ScreenSpaceEventType$1.LEFT_UP,n))&&(Cartesian2.clone(e._primaryPosition,touchEndEvent.position),i(touchEndEvent)),0===o&&!e._isTouchHolding)if(defined(r=e.getInputAction(ScreenSpaceEventType$1.LEFT_CLICK,n)))checkPixelTolerance(e._primaryStartPosition,e._previousPositions.values[0],e._clickPixelTolerance)&&(Cartesian2.clone(e._primaryPosition,touchClickEvent.position),r(touchClickEvent));e._isTouchHolding=!1}if(0===o&&s&&(e._isPinching=!1,defined(i=e.getInputAction(ScreenSpaceEventType$1.PINCH_END,n))&&i()),1===o&&!s){var l=a.values[0];Cartesian2.clone(l,e._primaryPosition),Cartesian2.clone(l,e._primaryStartPosition),Cartesian2.clone(l,e._primaryPreviousPosition),e._buttonDown[MouseButton.LEFT]=!0,defined(i=e.getInputAction(ScreenSpaceEventType$1.LEFT_DOWN,n))&&(Cartesian2.clone(l,touchStartEvent.position),i(touchStartEvent)),e._touchHoldTimer=setTimeout((function(){e.isDestroyed()||(e._touchHoldTimer=void 0,e._isTouchHolding=!0,defined(r=e.getInputAction(ScreenSpaceEventType$1.RIGHT_CLICK,n))&&checkPixelTolerance(e._primaryStartPosition,e._previousPositions.values[0],e._holdPixelTolerance)&&(Cartesian2.clone(e._primaryPosition,touchHoldEvent.position),r(touchHoldEvent)))}),ScreenSpaceEventHandler.touchHoldDelayMilliseconds),t.preventDefault()}2!==o||s||(e._isPinching=!0,defined(i=e.getInputAction(ScreenSpaceEventType$1.PINCH_START,n))&&(Cartesian2.clone(a.values[0],touch2StartEvent.position1),Cartesian2.clone(a.values[1],touch2StartEvent.position2),i(touch2StartEvent),t.preventDefault()))}function handleTouchMove(e,t){gotTouchEvent(e);var i,r,n,a=t.changedTouches,o=a.length,s=e._positions;for(i=0;i<o;++i){n=(r=a[i]).identifier;var l=s.get(n);defined(l)&&getPosition$1(e,r,l)}fireTouchMoveEvents(e,t);var c=e._previousPositions;for(i=0;i<o;++i)n=(r=a[i]).identifier,Cartesian2.clone(s.get(n),c.get(n))}var touchMoveEvent={startPosition:new Cartesian2,endPosition:new Cartesian2},touchPinchMovementEvent={distance:{startPosition:new Cartesian2,endPosition:new Cartesian2},angleAndHeight:{startPosition:new Cartesian2,endPosition:new Cartesian2}};function fireTouchMoveEvents(e,t){var i,r=getModifier(t),n=e._positions,a=e._previousPositions,o=n.length;if(1===o&&e._buttonDown[MouseButton.LEFT]){var s=n.values[0];Cartesian2.clone(s,e._primaryPosition);var l=e._primaryPreviousPosition;defined(i=e.getInputAction(ScreenSpaceEventType$1.MOUSE_MOVE,r))&&(Cartesian2.clone(l,touchMoveEvent.startPosition),Cartesian2.clone(s,touchMoveEvent.endPosition),i(touchMoveEvent)),Cartesian2.clone(s,l),t.preventDefault()}else if(2===o&&e._isPinching&&defined(i=e.getInputAction(ScreenSpaceEventType$1.PINCH_MOVE,r))){var c=n.values[0],u=n.values[1],d=a.values[0],h=a.values[1],p=u.x-c.x,f=u.y-c.y,m=.25*Math.sqrt(p*p+f*f),g=h.x-d.x,_=h.y-d.y,y=.25*Math.sqrt(g*g+_*_),v=.125*(u.y+c.y),C=.125*(h.y+d.y),T=Math.atan2(f,p),S=Math.atan2(_,g);Cartesian2.fromElements(0,y,touchPinchMovementEvent.distance.startPosition),Cartesian2.fromElements(0,m,touchPinchMovementEvent.distance.endPosition),Cartesian2.fromElements(S,C,touchPinchMovementEvent.angleAndHeight.startPosition),Cartesian2.fromElements(T,v,touchPinchMovementEvent.angleAndHeight.endPosition),i(touchPinchMovementEvent)}}function handlePointerDown(e,t){if(t.target.setPointerCapture(t.pointerId),"touch"===t.pointerType){var i=e._positions,r=t.pointerId;i.set(r,getPosition$1(e,t,new Cartesian2)),fireTouchEvents(e,t),e._previousPositions.set(r,Cartesian2.clone(i.get(r)))}else handleMouseDown(e,t)}function handlePointerUp(e,t){if("touch"===t.pointerType){var i=e._positions,r=t.pointerId;i.remove(r),fireTouchEvents(e,t),e._previousPositions.remove(r)}else handleMouseUp(e,t)}function handlePointerMove(e,t){if("touch"===t.pointerType){var i=e._positions,r=t.pointerId,n=i.get(r);if(!defined(n))return;getPosition$1(e,t,n),fireTouchMoveEvents(e,t);var a=e._previousPositions;Cartesian2.clone(i.get(r),a.get(r))}else handleMouseMove(e,t)}function ScreenSpaceEventHandler(e){this._inputEvents={},this._buttonDown={LEFT:!1,MIDDLE:!1,RIGHT:!1},this._isPinching=!1,this._isTouchHolding=!1,this._lastSeenTouchEvent=-ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds,this._primaryStartPosition=new Cartesian2,this._primaryPosition=new Cartesian2,this._primaryPreviousPosition=new Cartesian2,this._positions=new AssociativeArray,this._previousPositions=new AssociativeArray,this._removalFunctions=[],this._touchHoldTimer=void 0,this._clickPixelTolerance=5,this._holdPixelTolerance=25,this._element=defaultValue(e,document),registerListeners(this)}function ShowGeometryInstanceAttribute(e){e=defaultValue(e,!0),this.value=ShowGeometryInstanceAttribute.toValue(e)}ScreenSpaceEventHandler.prototype.setInputAction=function(e,t,i){var r=getInputEventKey(t,i);this._inputEvents[r]=e},ScreenSpaceEventHandler.prototype.getInputAction=function(e,t){var i=getInputEventKey(e,t);return this._inputEvents[i]},ScreenSpaceEventHandler.prototype.removeInputAction=function(e,t){var i=getInputEventKey(e,t);delete this._inputEvents[i]},ScreenSpaceEventHandler.prototype.isDestroyed=function(){return!1},ScreenSpaceEventHandler.prototype.destroy=function(){return unregisterListeners(this),destroyObject(this)},ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds=800,ScreenSpaceEventHandler.touchHoldDelayMilliseconds=1500,Object.defineProperties(ShowGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 1}},normalize:{get:function(){return!1}}}),ShowGeometryInstanceAttribute.toValue=function(e,t){return defined(t)?(t[0]=e,t):new Uint8Array([e])};var Simon1994PlanetaryPositions={};function computeTdbMinusTtSpice(e){var t=6.239996+.0172019696544*e;return.001657*Math.sin(t+.01671*Math.sin(t))}var TdtMinusTai=32.184,J2000d=2451545;function taiToTdb(e,t){t=JulianDate.addSeconds(e,TdtMinusTai,t);var i=JulianDate.totalDays(t)-J2000d;return t=JulianDate.addSeconds(t,computeTdbMinusTtSpice(i),t)}var epoch=new JulianDate(2451545,0,TimeStandard$1.TAI),MetersPerKilometer=1e3,RadiansPerDegree=CesiumMath.RADIANS_PER_DEGREE,RadiansPerArcSecond=CesiumMath.RADIANS_PER_ARCSECOND,MetersPerAstronomicalUnit=14959787e4,perifocalToEquatorial=new Matrix3;function elementsToCartesian(e,t,i,r,n,a,o){i<0&&(i=-i,n+=CesiumMath.PI);var s=e*(1-t),l=r-n,c=n,u=meanAnomalyToTrueAnomaly(a-r,t);perifocalToCartesianMatrix(l,i,c,perifocalToEquatorial);var d=s*(1+t),h=Math.cos(u),p=Math.sin(u),f=d/(1+t*h);return defined(o)?(o.x=f*h,o.y=f*p,o.z=0):o=new Cartesian3(f*h,f*p,0),Matrix3.multiplyByVector(perifocalToEquatorial,o,o)}function meanAnomalyToTrueAnomaly(e,t){return eccentricAnomalyToTrueAnomaly(meanAnomalyToEccentricAnomaly(e,t),t)}var maxIterationCount=50,keplerEqConvergence=CesiumMath.EPSILON8;function meanAnomalyToEccentricAnomaly(e,t){var i,r=Math.floor(e/CesiumMath.TWO_PI),n=(e-=r*CesiumMath.TWO_PI)+t*Math.sin(e)/(1-Math.sin(e+t)+Math.sin(e)),a=Number.MAX_VALUE;for(i=0;i<maxIterationCount&&Math.abs(a-n)>keplerEqConvergence;++i){n=(a=n)-(a-t*Math.sin(a)-e)/(1-t*Math.cos(a))}return a=n+r*CesiumMath.TWO_PI}function eccentricAnomalyToTrueAnomaly(e,t){var i=Math.floor(e/CesiumMath.TWO_PI);e-=i*CesiumMath.TWO_PI;var r=Math.cos(e)-t,n=Math.sin(e)*Math.sqrt(1-t*t),a=Math.atan2(n,r);return a=CesiumMath.zeroToTwoPi(a),e<0&&(a-=CesiumMath.TWO_PI),a+=i*CesiumMath.TWO_PI}function perifocalToCartesianMatrix(e,t,i,r){var n=Math.cos(e),a=Math.sin(e),o=Math.cos(t),s=Math.sin(t),l=Math.cos(i),c=Math.sin(i);return defined(r)?(r[0]=l*n-c*a*o,r[1]=c*n+l*a*o,r[2]=a*s,r[3]=-l*a-c*n*o,r[4]=-c*a+l*n*o,r[5]=n*s,r[6]=c*s,r[7]=-l*s,r[8]=o):r=new Matrix3(l*n-c*a*o,-l*a-c*n*o,c*s,c*n+l*a*o,-c*a+l*n*o,-l*s,a*s,n*s,o),r}var semiMajorAxis0=1.0000010178*MetersPerAstronomicalUnit,meanLongitude0=100.46645683*RadiansPerDegree,meanLongitude1=1295977422.83429*RadiansPerArcSecond,p1u=16002,p2u=21863,p3u=32004,p4u=10931,p5u=14529,p6u=16368,p7u=15318,p8u=32794,Ca1=64*1e-7*MetersPerAstronomicalUnit,Ca2=1e-7*-152*MetersPerAstronomicalUnit,Ca3=62*1e-7*MetersPerAstronomicalUnit,Ca4=-8e-7*MetersPerAstronomicalUnit,Ca5=32*1e-7*MetersPerAstronomicalUnit,Ca6=1e-7*-41*MetersPerAstronomicalUnit,Ca7=19*1e-7*MetersPerAstronomicalUnit,Ca8=1e-7*-11*MetersPerAstronomicalUnit,Sa1=1e-7*-150*MetersPerAstronomicalUnit,Sa2=1e-7*-46*MetersPerAstronomicalUnit,Sa3=68*1e-7*MetersPerAstronomicalUnit,Sa4=54*1e-7*MetersPerAstronomicalUnit,Sa5=14*1e-7*MetersPerAstronomicalUnit,Sa6=24*1e-7*MetersPerAstronomicalUnit,Sa7=1e-7*-28*MetersPerAstronomicalUnit,Sa8=22*1e-7*MetersPerAstronomicalUnit,q1u=10,q2u=16002,q3u=21863,q4u=10931,q5u=1473,q6u=32004,q7u=4387,q8u=73,Cl1=1e-7*-325,Cl2=1e-7*-322,Cl3=1e-7*-79,Cl4=232*1e-7,Cl5=1e-7*-52,Cl6=97*1e-7,Cl7=55*1e-7,Cl8=1e-7*-41,Sl1=1e-7*-105,Sl2=1e-7*-137,Sl3=258*1e-7,Sl4=35*1e-7,Sl5=1e-7*-116,Sl6=1e-7*-88,Sl7=1e-7*-112,Sl8=1e-7*-80,scratchDate$1=new JulianDate(0,0,TimeStandard$1.TAI);function computeSimonEarthMoonBarycenter(e,t){taiToTdb(e,scratchDate$1);var i=(scratchDate$1.dayNumber-epoch.dayNumber+(scratchDate$1.secondsOfDay-epoch.secondsOfDay)/TimeConstants$1.SECONDS_PER_DAY)/(10*TimeConstants$1.DAYS_PER_JULIAN_CENTURY),r=.3595362*i,n=semiMajorAxis0+Ca1*Math.cos(p1u*r)+Sa1*Math.sin(p1u*r)+Ca2*Math.cos(p2u*r)+Sa2*Math.sin(p2u*r)+Ca3*Math.cos(p3u*r)+Sa3*Math.sin(p3u*r)+Ca4*Math.cos(p4u*r)+Sa4*Math.sin(p4u*r)+Ca5*Math.cos(p5u*r)+Sa5*Math.sin(p5u*r)+Ca6*Math.cos(p6u*r)+Sa6*Math.sin(p6u*r)+Ca7*Math.cos(p7u*r)+Sa7*Math.sin(p7u*r)+Ca8*Math.cos(p8u*r)+Sa8*Math.sin(p8u*r),a=meanLongitude0+meanLongitude1*i+Cl1*Math.cos(q1u*r)+Sl1*Math.sin(q1u*r)+Cl2*Math.cos(q2u*r)+Sl2*Math.sin(q2u*r)+Cl3*Math.cos(q3u*r)+Sl3*Math.sin(q3u*r)+Cl4*Math.cos(q4u*r)+Sl4*Math.sin(q4u*r)+Cl5*Math.cos(q5u*r)+Sl5*Math.sin(q5u*r)+Cl6*Math.cos(q6u*r)+Sl6*Math.sin(q6u*r)+Cl7*Math.cos(q7u*r)+Sl7*Math.sin(q7u*r)+Cl8*Math.cos(q8u*r)+Sl8*Math.sin(q8u*r);return elementsToCartesian(n,.0167086342-.0004203654*i,469.97289*RadiansPerArcSecond*i,102.93734808*RadiansPerDegree+11612.3529*RadiansPerArcSecond*i,174.87317577*RadiansPerDegree-8679.27034*RadiansPerArcSecond*i,a,t)}function computeSimonMoon(e,t){taiToTdb(e,scratchDate$1);var i=(scratchDate$1.dayNumber-epoch.dayNumber+(scratchDate$1.secondsOfDay-epoch.secondsOfDay)/TimeConstants$1.SECONDS_PER_DAY)/TimeConstants$1.DAYS_PER_JULIAN_CENTURY,r=i*i,n=r*i,a=n*i,o=383397.7725+.004*i,s=.055545526-16e-9*i,l=5.15668983*RadiansPerDegree,c=-8e-5*i+.02966*r-42e-6*n-13e-8*a,u=83.35324312*RadiansPerDegree,d=14643420.2669*i-38.2702*r-.045047*n+21301e-8*a,h=125.04455501*RadiansPerDegree,p=-6967919.3631*i+6.3602*r+.007625*n-3586e-8*a,f=218.31664563*RadiansPerDegree,m=1732559343.4847*i-6.391*r+.006588*n-3169e-8*a,g=297.85019547*RadiansPerDegree+RadiansPerArcSecond*(1602961601.209*i-6.3706*r+.006593*n-3169e-8*a),_=134.96340251*RadiansPerDegree+RadiansPerArcSecond*(1717915923.2178*i+31.8792*r+.051635*n-2447e-7*a),y=357.52910918*RadiansPerDegree+RadiansPerArcSecond*(129596581.0481*i-.5532*r+136e-6*n-1149e-8*a),v=310.17137918*RadiansPerDegree-RadiansPerArcSecond*(6967051.436*i+6.2068*r+.007618*n-3219e-8*a),C=2*g,T=4*g,S=6*g,A=2*_,x=3*_,E=4*_,b=2*(93.27209062*RadiansPerDegree+RadiansPerArcSecond*(1739527262.8478*i-12.7512*r-.001037*n+417e-8*a));o+=3400.4*Math.cos(C)-635.6*Math.cos(C-_)-235.6*Math.cos(_)+218.1*Math.cos(C-y)+181*Math.cos(C+_),s+=.014216*Math.cos(C-_)+.008551*Math.cos(C-A)-.001383*Math.cos(_)+.001356*Math.cos(C+_)-.001147*Math.cos(T-x)-914e-6*Math.cos(T-A)+869e-6*Math.cos(C-y-_)-627e-6*Math.cos(C)-394e-6*Math.cos(T-E)+282e-6*Math.cos(C-y-A)-279e-6*Math.cos(g-_)-236e-6*Math.cos(A)+231e-6*Math.cos(T)+229e-6*Math.cos(S-E)-201e-6*Math.cos(A-b),c+=486.26*Math.cos(C-b)-40.13*Math.cos(C)+37.51*Math.cos(b)+25.73*Math.cos(A-b)+19.97*Math.cos(C-y-b),d+=-55609*Math.sin(C-_)-34711*Math.sin(C-A)-9792*Math.sin(_)+9385*Math.sin(T-x)+7505*Math.sin(T-A)+5318*Math.sin(C+_)+3484*Math.sin(T-E)-3417*Math.sin(C-y-_)-2530*Math.sin(S-E)-2376*Math.sin(C)-2075*Math.sin(C-x)-1883*Math.sin(A)-1736*Math.sin(S-5*_)+1626*Math.sin(y)-1370*Math.sin(S-x),p+=-5392*Math.sin(C-b)-540*Math.sin(y)-441*Math.sin(C)+423*Math.sin(b)-288*Math.sin(A-b),m+=-3332.9*Math.sin(C)+1197.4*Math.sin(C-_)-662.5*Math.sin(y)+396.3*Math.sin(_)-218*Math.sin(C-y);var P=2*v,D=3*v;c+=46.997*Math.cos(v)*i-.614*Math.cos(C-b+v)*i+.614*Math.cos(C-b-v)*i-.0297*Math.cos(P)*r-.0335*Math.cos(v)*r+.0012*Math.cos(C-b+P)*r-16e-5*Math.cos(v)*n+4e-5*Math.cos(D)*n+4e-5*Math.cos(P)*n;var w=2.116*Math.sin(v)*i-.111*Math.sin(C-b-v)*i-.0015*Math.sin(v)*r;return d+=w,m+=w,p+=-520.77*Math.sin(v)*i+13.66*Math.sin(C-b+v)*i+1.12*Math.sin(C-v)*i-1.06*Math.sin(b-v)*i+.66*Math.sin(P)*r+.371*Math.sin(v)*r-.035*Math.sin(C-b+P)*r-.015*Math.sin(C-b+v)*r+.0014*Math.sin(v)*n-.0011*Math.sin(D)*n-9e-4*Math.sin(P)*n,elementsToCartesian(o*=MetersPerKilometer,s,l+c*RadiansPerArcSecond,u+d*RadiansPerArcSecond,h+p*RadiansPerArcSecond,f+m*RadiansPerArcSecond,t)}var moonEarthMassRatio=.012300034,factor=moonEarthMassRatio/(moonEarthMassRatio+1)*-1;function computeSimonEarth(e,t){return t=computeSimonMoon(e,t),Cartesian3.multiplyByScalar(t,factor,t)}var axesTransformation=new Matrix3(1.0000000000000002,5619723173785822e-31,4690511510146299e-34,-5154129427414611e-31,.9174820620691819,-.39777715593191376,-223970096136568e-30,.39777715593191376,.9174820620691819),translation=new Cartesian3;function interpolateColors(e,t,i,r,n,a,o){var s,l=PolylinePipeline.numberOfPoints(e,t,n),c=i.red,u=i.green,d=i.blue,h=i.alpha,p=r.red,f=r.green,m=r.blue,g=r.alpha;if(Color.equals(i,r)){for(s=0;s<l;s++)a[o++]=Color.floatToByte(c),a[o++]=Color.floatToByte(u),a[o++]=Color.floatToByte(d),a[o++]=Color.floatToByte(h);return o}var _=(p-c)/l,y=(f-u)/l,v=(m-d)/l,C=(g-h)/l,T=o;for(s=0;s<l;s++)a[T++]=Color.floatToByte(c+s*_),a[T++]=Color.floatToByte(u+s*y),a[T++]=Color.floatToByte(d+s*v),a[T++]=Color.floatToByte(h+s*C);return T}function SimplePolylineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.colors,r=defaultValue(e.colorsPerVertex,!1);this._positions=t,this._colors=i,this._colorsPerVertex=r,this._arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._workerName="createSimplePolylineGeometry";var n=1+t.length*Cartesian3.packedLength;n+=defined(i)?1+i.length*Color.packedLength:1,this.packedLength=n+Ellipsoid.packedLength+3}Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame=function(e,t){return defined(e)||(e=JulianDate.now()),defined(t)||(t=new Cartesian3),translation=computeSimonEarthMoonBarycenter(e,translation),t=Cartesian3.negate(translation,t),computeSimonEarth(e,translation),Cartesian3.subtract(t,translation,t),Matrix3.multiplyByVector(axesTransformation,t,t),t},Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame=function(e,t){return defined(e)||(e=JulianDate.now()),t=computeSimonMoon(e,t),Matrix3.multiplyByVector(axesTransformation,t,t),t},SimplePolylineGeometry.pack=function(e,t,i){var r;i=defaultValue(i,0);var n=e._positions,a=n.length;for(t[i++]=a,r=0;r<a;++r,i+=Cartesian3.packedLength)Cartesian3.pack(n[r],t,i);var o=e._colors;for(a=defined(o)?o.length:0,t[i++]=a,r=0;r<a;++r,i+=Color.packedLength)Color.pack(o[r],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._colorsPerVertex?1:0,t[i++]=e._arcType,t[i]=e._granularity,t},SimplePolylineGeometry.unpack=function(e,t,i){var r;t=defaultValue(t,0);var n=e[t++],a=new Array(n);for(r=0;r<n;++r,t+=Cartesian3.packedLength)a[r]=Cartesian3.unpack(e,t);var o=(n=e[t++])>0?new Array(n):void 0;for(r=0;r<n;++r,t+=Color.packedLength)o[r]=Color.unpack(e,t);var s=Ellipsoid.unpack(e,t);t+=Ellipsoid.packedLength;var l=1===e[t++],c=e[t++],u=e[t];return defined(i)?(i._positions=a,i._colors=o,i._ellipsoid=s,i._colorsPerVertex=l,i._arcType=c,i._granularity=u,i):new SimplePolylineGeometry({positions:a,colors:o,ellipsoid:s,colorsPerVertex:l,arcType:c,granularity:u})};var scratchArray1=new Array(2),scratchArray2=new Array(2),generateArcOptionsScratch$1={positions:scratchArray1,height:scratchArray2,ellipsoid:void 0,minDistance:void 0,granularity:void 0};function SphereGeometry(e){var t=defaultValue(e.radius,1),i={radii:new Cartesian3(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,vertexFormat:e.vertexFormat};this._ellipsoidGeometry=new EllipsoidGeometry(i),this._workerName="createSphereGeometry"}SimplePolylineGeometry.createGeometry=function(e){var t,i,r,n,a,o=e._positions,s=e._colors,l=e._colorsPerVertex,c=e._arcType,u=e._granularity,d=e._ellipsoid,h=CesiumMath.chordLength(u,d.maximumRadius),p=defined(s)&&!l,f=o.length,m=0;if(c===ArcType$1.GEODESIC||c===ArcType$1.RHUMB){var g,_,y;c===ArcType$1.GEODESIC?(g=CesiumMath.chordLength(u,d.maximumRadius),_=PolylinePipeline.numberOfPoints,y=PolylinePipeline.generateArc):(g=u,_=PolylinePipeline.numberOfPointsRhumbLine,y=PolylinePipeline.generateRhumbArc);var v=PolylinePipeline.extractHeights(o,d),C=generateArcOptionsScratch$1;if(c===ArcType$1.GEODESIC?C.minDistance=h:C.granularity=u,C.ellipsoid=d,p){var T=0;for(t=0;t<f-1;t++)T+=_(o[t],o[t+1],g)+1;i=new Float64Array(3*T),n=new Uint8Array(4*T),C.positions=scratchArray1,C.height=scratchArray2;var S=0;for(t=0;t<f-1;++t){scratchArray1[0]=o[t],scratchArray1[1]=o[t+1],scratchArray2[0]=v[t],scratchArray2[1]=v[t+1];var A=y(C);if(defined(s)){var x=A.length/3;a=s[t];for(var E=0;E<x;++E)n[S++]=Color.floatToByte(a.red),n[S++]=Color.floatToByte(a.green),n[S++]=Color.floatToByte(a.blue),n[S++]=Color.floatToByte(a.alpha)}i.set(A,m),m+=A.length}}else if(C.positions=o,C.height=v,i=new Float64Array(y(C)),defined(s)){for(n=new Uint8Array(i.length/3*4),t=0;t<f-1;++t){m=interpolateColors(o[t],o[t+1],s[t],s[t+1],h,n,m)}var b=s[f-1];n[m++]=Color.floatToByte(b.red),n[m++]=Color.floatToByte(b.green),n[m++]=Color.floatToByte(b.blue),n[m++]=Color.floatToByte(b.alpha)}}else{r=p?2*f-2:f,i=new Float64Array(3*r),n=defined(s)?new Uint8Array(4*r):void 0;var P=0,D=0;for(t=0;t<f;++t){var w=o[t];if(p&&t>0&&(Cartesian3.pack(w,i,P),P+=3,a=s[t-1],n[D++]=Color.floatToByte(a.red),n[D++]=Color.floatToByte(a.green),n[D++]=Color.floatToByte(a.blue),n[D++]=Color.floatToByte(a.alpha)),p&&t===f-1)break;Cartesian3.pack(w,i,P),P+=3,defined(s)&&(a=s[t],n[D++]=Color.floatToByte(a.red),n[D++]=Color.floatToByte(a.green),n[D++]=Color.floatToByte(a.blue),n[D++]=Color.floatToByte(a.alpha))}}var M=new GeometryAttributes;M.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:i}),defined(s)&&(M.color=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,values:n,normalize:!0}));var I=2*((r=i.length/3)-1),R=IndexDatatype$1.createTypedArray(r,I),O=0;for(t=0;t<r-1;++t)R[O++]=t,R[O++]=t+1;return new Geometry({attributes:M,indices:R,primitiveType:PrimitiveType$1.LINES,boundingSphere:BoundingSphere.fromPoints(o)})},SphereGeometry.packedLength=EllipsoidGeometry.packedLength,SphereGeometry.pack=function(e,t,i){return EllipsoidGeometry.pack(e._ellipsoidGeometry,t,i)};var scratchEllipsoidGeometry$1=new EllipsoidGeometry,scratchOptions$3={radius:void 0,radii:new Cartesian3,vertexFormat:new VertexFormat,stackPartitions:void 0,slicePartitions:void 0};function SphereOutlineGeometry(e){var t=defaultValue(e.radius,1),i={radii:new Cartesian3(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,subdivisions:e.subdivisions};this._ellipsoidGeometry=new EllipsoidOutlineGeometry(i),this._workerName="createSphereOutlineGeometry"}SphereGeometry.unpack=function(e,t,i){var r=EllipsoidGeometry.unpack(e,t,scratchEllipsoidGeometry$1);return scratchOptions$3.vertexFormat=VertexFormat.clone(r._vertexFormat,scratchOptions$3.vertexFormat),scratchOptions$3.stackPartitions=r._stackPartitions,scratchOptions$3.slicePartitions=r._slicePartitions,defined(i)?(Cartesian3.clone(r._radii,scratchOptions$3.radii),i._ellipsoidGeometry=new EllipsoidGeometry(scratchOptions$3),i):(scratchOptions$3.radius=r._radii.x,new SphereGeometry(scratchOptions$3))},SphereGeometry.createGeometry=function(e){return EllipsoidGeometry.createGeometry(e._ellipsoidGeometry)},SphereOutlineGeometry.packedLength=EllipsoidOutlineGeometry.packedLength,SphereOutlineGeometry.pack=function(e,t,i){return EllipsoidOutlineGeometry.pack(e._ellipsoidGeometry,t,i)};var scratchEllipsoidGeometry=new EllipsoidOutlineGeometry,scratchOptions$2={radius:void 0,radii:new Cartesian3,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};function Spherical(e,t,i){this.clock=defaultValue(e,0),this.cone=defaultValue(t,0),this.magnitude=defaultValue(i,1)}function subdivideArray(e,t){for(var i=[],r=e.length,n=0;n<r;){var a=Math.ceil((r-n)/t--);i.push(e.slice(n,n+a)),n+=a}return i}SphereOutlineGeometry.unpack=function(e,t,i){var r=EllipsoidOutlineGeometry.unpack(e,t,scratchEllipsoidGeometry);return scratchOptions$2.stackPartitions=r._stackPartitions,scratchOptions$2.slicePartitions=r._slicePartitions,scratchOptions$2.subdivisions=r._subdivisions,defined(i)?(Cartesian3.clone(r._radii,scratchOptions$2.radii),i._ellipsoidGeometry=new EllipsoidOutlineGeometry(scratchOptions$2),i):(scratchOptions$2.radius=r._radii.x,new SphereOutlineGeometry(scratchOptions$2))},SphereOutlineGeometry.createGeometry=function(e){return EllipsoidOutlineGeometry.createGeometry(e._ellipsoidGeometry)},Spherical.fromCartesian3=function(e,t){var i=e.x,r=e.y,n=e.z,a=i*i+r*r;return defined(t)||(t=new Spherical),t.clock=Math.atan2(r,i),t.cone=Math.atan2(Math.sqrt(a),n),t.magnitude=Math.sqrt(a+n*n),t},Spherical.clone=function(e,t){if(defined(e))return defined(t)?(t.clock=e.clock,t.cone=e.cone,t.magnitude=e.magnitude,t):new Spherical(e.clock,e.cone,e.magnitude)},Spherical.normalize=function(e,t){return defined(t)?(t.clock=e.clock,t.cone=e.cone,t.magnitude=1,t):new Spherical(e.clock,e.cone,1)},Spherical.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.clock===t.clock&&e.cone===t.cone&&e.magnitude===t.magnitude},Spherical.equalsEpsilon=function(e,t,i){return i=defaultValue(i,0),e===t||defined(e)&&defined(t)&&Math.abs(e.clock-t.clock)<=i&&Math.abs(e.cone-t.cone)<=i&&Math.abs(e.magnitude-t.magnitude)<=i},Spherical.prototype.equals=function(e){return Spherical.equals(this,e)},Spherical.prototype.clone=function(e){return Spherical.clone(this,e)},Spherical.prototype.equalsEpsilon=function(e,t){return Spherical.equalsEpsilon(this,e,t)},Spherical.prototype.toString=function(){return"("+this.clock+", "+this.cone+", "+this.magnitude+")"};var TileEdge={WEST:0,NORTH:1,EAST:2,SOUTH:3,NORTHWEST:4,NORTHEAST:5,SOUTHWEST:6,SOUTHEAST:7};function TilingScheme(e){}function compareIntervalStartTimes(e,t){return JulianDate.compare(e.start,t.start)}function TimeIntervalCollection(e){if(this._intervals=[],this._changedEvent=new Event,defined(e))for(var t=e.length,i=0;i<t;i++)this.addInterval(e[i])}Object.defineProperties(TilingScheme.prototype,{ellipsoid:{get:DeveloperError.throwInstantiationError},rectangle:{get:DeveloperError.throwInstantiationError},projection:{get:DeveloperError.throwInstantiationError}}),TilingScheme.prototype.getNumberOfXTilesAtLevel=DeveloperError.throwInstantiationError,TilingScheme.prototype.getNumberOfYTilesAtLevel=DeveloperError.throwInstantiationError,TilingScheme.prototype.rectangleToNativeRectangle=DeveloperError.throwInstantiationError,TilingScheme.prototype.tileXYToNativeRectangle=DeveloperError.throwInstantiationError,TilingScheme.prototype.tileXYToRectangle=DeveloperError.throwInstantiationError,TilingScheme.prototype.positionToTileXY=DeveloperError.throwInstantiationError,Object.defineProperties(TimeIntervalCollection.prototype,{changedEvent:{get:function(){return this._changedEvent}},start:{get:function(){var e=this._intervals;return 0===e.length?void 0:e[0].start}},isStartIncluded:{get:function(){var e=this._intervals;return 0!==e.length&&e[0].isStartIncluded}},stop:{get:function(){var e=this._intervals,t=e.length;return 0===t?void 0:e[t-1].stop}},isStopIncluded:{get:function(){var e=this._intervals,t=e.length;return 0!==t&&e[t-1].isStopIncluded}},length:{get:function(){return this._intervals.length}},isEmpty:{get:function(){return 0===this._intervals.length}}}),TimeIntervalCollection.prototype.equals=function(e,t){if(this===e)return!0;if(!(e instanceof TimeIntervalCollection))return!1;var i=this._intervals,r=e._intervals,n=i.length;if(n!==r.length)return!1;for(var a=0;a<n;a++)if(!TimeInterval.equals(i[a],r[a],t))return!1;return!0},TimeIntervalCollection.prototype.get=function(e){return this._intervals[e]},TimeIntervalCollection.prototype.removeAll=function(){this._intervals.length>0&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))},TimeIntervalCollection.prototype.findIntervalContainingDate=function(e){var t=this.indexOf(e);return t>=0?this._intervals[t]:void 0},TimeIntervalCollection.prototype.findDataForIntervalContainingDate=function(e){var t=this.indexOf(e);return t>=0?this._intervals[t].data:void 0},TimeIntervalCollection.prototype.contains=function(e){return this.indexOf(e)>=0};var indexOfScratch=new TimeInterval;TimeIntervalCollection.prototype.indexOf=function(e){var t=this._intervals;indexOfScratch.start=e,indexOfScratch.stop=e;var i=binarySearch(t,indexOfScratch,compareIntervalStartTimes);return i>=0?t[i].isStartIncluded?i:i>0&&t[i-1].stop.equals(e)&&t[i-1].isStopIncluded?i-1:~i:(i=~i)>0&&i-1<t.length&&TimeInterval.contains(t[i-1],e)?i-1:~i},TimeIntervalCollection.prototype.findInterval=function(e){for(var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).start,i=e.stop,r=e.isStartIncluded,n=e.isStopIncluded,a=this._intervals,o=0,s=a.length;o<s;o++){var l=a[o];if((!defined(t)||l.start.equals(t))&&(!defined(i)||l.stop.equals(i))&&(!defined(r)||l.isStartIncluded===r)&&(!defined(n)||l.isStopIncluded===n))return a[o]}},TimeIntervalCollection.prototype.addInterval=function(e,t){if(!e.isEmpty){var i=this._intervals;if(0===i.length||JulianDate.greaterThan(e.start,i[i.length-1].stop))return i.push(e),void this._changedEvent.raiseEvent(this);var r,n=binarySearch(i,e,compareIntervalStartTimes);for(n<0?n=~n:n>0&&e.isStartIncluded&&i[n-1].isStartIncluded&&i[n-1].start.equals(e.start)?--n:n<i.length&&!e.isStartIncluded&&i[n].isStartIncluded&&i[n].start.equals(e.start)&&++n,n>0&&((r=JulianDate.compare(i[n-1].stop,e.start))>0||0===r&&(i[n-1].isStopIncluded||e.isStartIncluded))&&((defined(t)?t(i[n-1].data,e.data):i[n-1].data===e.data)?(e=JulianDate.greaterThan(e.stop,i[n-1].stop)?new TimeInterval({start:i[n-1].start,stop:e.stop,isStartIncluded:i[n-1].isStartIncluded,isStopIncluded:e.isStopIncluded,data:e.data}):new TimeInterval({start:i[n-1].start,stop:i[n-1].stop,isStartIncluded:i[n-1].isStartIncluded,isStopIncluded:i[n-1].isStopIncluded||e.stop.equals(i[n-1].stop)&&e.isStopIncluded,data:e.data}),i.splice(n-1,1),--n):(((r=JulianDate.compare(i[n-1].stop,e.stop))>0||0===r&&i[n-1].isStopIncluded&&!e.isStopIncluded)&&i.splice(n,0,new TimeInterval({start:e.stop,stop:i[n-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:i[n-1].isStopIncluded,data:i[n-1].data})),i[n-1]=new TimeInterval({start:i[n-1].start,stop:e.start,isStartIncluded:i[n-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:i[n-1].data})));n<i.length&&((r=JulianDate.compare(e.stop,i[n].start))>0||0===r&&(e.isStopIncluded||i[n].isStartIncluded));)if(defined(t)?t(i[n].data,e.data):i[n].data===e.data)e=new TimeInterval({start:e.start,stop:JulianDate.greaterThan(i[n].stop,e.stop)?i[n].stop:e.stop,isStartIncluded:e.isStartIncluded,isStopIncluded:JulianDate.greaterThan(i[n].stop,e.stop)?i[n].isStopIncluded:e.isStopIncluded,data:e.data}),i.splice(n,1);else{if(i[n]=new TimeInterval({start:e.stop,stop:i[n].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:i[n].isStopIncluded,data:i[n].data}),!i[n].isEmpty)break;i.splice(n,1)}i.splice(n,0,e),this._changedEvent.raiseEvent(this)}},TimeIntervalCollection.prototype.removeInterval=function(e){if(e.isEmpty)return!1;var t=this._intervals,i=binarySearch(t,e,compareIntervalStartTimes);i<0&&(i=~i);var r=!1;for(i>0&&(JulianDate.greaterThan(t[i-1].stop,e.start)||t[i-1].stop.equals(e.start)&&t[i-1].isStopIncluded&&e.isStartIncluded)&&(r=!0,(JulianDate.greaterThan(t[i-1].stop,e.stop)||t[i-1].isStopIncluded&&!e.isStopIncluded&&t[i-1].stop.equals(e.stop))&&t.splice(i,0,new TimeInterval({start:e.stop,stop:t[i-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[i-1].isStopIncluded,data:t[i-1].data})),t[i-1]=new TimeInterval({start:t[i-1].start,stop:e.start,isStartIncluded:t[i-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:t[i-1].data})),i<t.length&&!e.isStartIncluded&&t[i].isStartIncluded&&e.start.equals(t[i].start)&&(r=!0,t.splice(i,0,new TimeInterval({start:t[i].start,stop:t[i].start,isStartIncluded:!0,isStopIncluded:!0,data:t[i].data})),++i);i<t.length&&JulianDate.greaterThan(e.stop,t[i].stop);)r=!0,t.splice(i,1);return i<t.length&&e.stop.equals(t[i].stop)&&(r=!0,!e.isStopIncluded&&t[i].isStopIncluded?i+1<t.length&&t[i+1].start.equals(e.stop)&&t[i].data===t[i+1].data?(t.splice(i,1),t[i]=new TimeInterval({start:t[i].start,stop:t[i].stop,isStartIncluded:!0,isStopIncluded:t[i].isStopIncluded,data:t[i].data})):t[i]=new TimeInterval({start:e.stop,stop:e.stop,isStartIncluded:!0,isStopIncluded:!0,data:t[i].data}):t.splice(i,1)),i<t.length&&(JulianDate.greaterThan(e.stop,t[i].start)||e.stop.equals(t[i].start)&&e.isStopIncluded&&t[i].isStartIncluded)&&(r=!0,t[i]=new TimeInterval({start:e.stop,stop:t[i].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[i].isStopIncluded,data:t[i].data})),r&&this._changedEvent.raiseEvent(this),r},TimeIntervalCollection.prototype.intersect=function(e,t,i){for(var r=new TimeIntervalCollection,n=0,a=0,o=this._intervals,s=e._intervals;n<o.length&&a<s.length;){var l=o[n],c=s[a];if(JulianDate.lessThan(l.stop,c.start))++n;else if(JulianDate.lessThan(c.stop,l.start))++a;else{if(defined(i)||defined(t)&&t(l.data,c.data)||!defined(t)&&c.data===l.data){var u=TimeInterval.intersect(l,c,new TimeInterval,i);u.isEmpty||r.addInterval(u,t)}JulianDate.lessThan(l.stop,c.stop)||l.stop.equals(c.stop)&&!l.isStopIncluded&&c.isStopIncluded?++n:++a}}return r},TimeIntervalCollection.fromJulianDateArray=function(e,t){defined(t)||(t=new TimeIntervalCollection);var i,r=e.julianDates,n=r.length,a=e.dataCallback,o=defaultValue(e.isStartIncluded,!0),s=defaultValue(e.isStopIncluded,!0),l=defaultValue(e.leadingInterval,!1),c=defaultValue(e.trailingInterval,!1),u=0;l&&(++u,(i=new TimeInterval({start:Iso8601.MINIMUM_VALUE,stop:r[0],isStartIncluded:!0,isStopIncluded:!o})).data=defined(a)?a(i,t.length):t.length,t.addInterval(i));for(var d=0;d<n-1;++d){var h=r[d],p=r[d+1];(i=new TimeInterval({start:h,stop:p,isStartIncluded:t.length!==u||o,isStopIncluded:d===n-2&&s})).data=defined(a)?a(i,t.length):t.length,t.addInterval(i),h=p}return c&&((i=new TimeInterval({start:r[n-1],stop:Iso8601.MAXIMUM_VALUE,isStartIncluded:!s,isStopIncluded:!0})).data=defined(a)?a(i,t.length):t.length,t.addInterval(i)),t};var scratchGregorianDate=new GregorianDate,monthLengths=[0,31,28,31,30,31,30,31,31,30,31,30,31];function addToDate(e,t,i){defined(i)||(i=new JulianDate),JulianDate.toGregorianDate(e,scratchGregorianDate);var r=scratchGregorianDate.millisecond+t.millisecond,n=scratchGregorianDate.second+t.second,a=scratchGregorianDate.minute+t.minute,o=scratchGregorianDate.hour+t.hour,s=scratchGregorianDate.day+t.day,l=scratchGregorianDate.month+t.month,c=scratchGregorianDate.year+t.year;for(r>=1e3&&(n+=Math.floor(r/1e3),r%=1e3),n>=60&&(a+=Math.floor(n/60),n%=60),a>=60&&(o+=Math.floor(a/60),a%=60),o>=24&&(s+=Math.floor(o/24),o%=24),monthLengths[2]=isLeapYear(c)?29:28;s>monthLengths[l]||l>=13;)s>monthLengths[l]&&(s-=monthLengths[l],++l),l>=13&&(--l,c+=Math.floor(l/12),l%=12,++l),monthLengths[2]=isLeapYear(c)?29:28;return scratchGregorianDate.millisecond=r,scratchGregorianDate.second=n,scratchGregorianDate.minute=a,scratchGregorianDate.hour=o,scratchGregorianDate.day=s,scratchGregorianDate.month=l,scratchGregorianDate.year=c,JulianDate.fromGregorianDate(scratchGregorianDate,i)}var scratchJulianDate$2=new JulianDate,durationRegex=/P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;function parseDuration(e,t){if(!defined(e)||0===e.length)return!1;if(t.year=0,t.month=0,t.day=0,t.hour=0,t.minute=0,t.second=0,t.millisecond=0,"P"===e[0]){var i=e.match(durationRegex);if(!defined(i))return!1;if(defined(i[1])&&(t.year=Number(i[1].replace(",","."))),defined(i[2])&&(t.month=Number(i[2].replace(",","."))),defined(i[3])&&(t.day=7*Number(i[3].replace(",","."))),defined(i[4])&&(t.day+=Number(i[4].replace(",","."))),defined(i[5])&&(t.hour=Number(i[5].replace(",","."))),defined(i[6])&&(t.minute=Number(i[6].replace(",","."))),defined(i[7])){var r=Number(i[7].replace(",","."));t.second=Math.floor(r),t.millisecond=r%1*1e3}}else"Z"!==e[e.length-1]&&(e+="Z"),JulianDate.toGregorianDate(JulianDate.fromIso8601(e,scratchJulianDate$2),t);return t.year||t.month||t.day||t.hour||t.minute||t.second||t.millisecond}var scratchDuration=new GregorianDate;TimeIntervalCollection.fromIso8601=function(e,t){var i=e.iso8601.split("/"),r=JulianDate.fromIso8601(i[0]),n=JulianDate.fromIso8601(i[1]),a=[];if(parseDuration(i[2],scratchDuration)){var o=JulianDate.clone(r);for(a.push(o);JulianDate.compare(o,n)<0;){o=addToDate(o,scratchDuration),JulianDate.compare(n,o)<=0&&JulianDate.clone(n,o),a.push(o)}}else a.push(r,n);return TimeIntervalCollection.fromJulianDateArray({julianDates:a,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)},TimeIntervalCollection.fromIso8601DateArray=function(e,t){return TimeIntervalCollection.fromJulianDateArray({julianDates:e.iso8601Dates.map((function(e){return JulianDate.fromIso8601(e)})),isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)},TimeIntervalCollection.fromIso8601DurationArray=function(e,t){for(var i,r,n=e.epoch,a=e.iso8601Durations,o=defaultValue(e.relativeToPrevious,!1),s=[],l=a.length,c=0;c<l;++c)(parseDuration(a[c],scratchDuration)||0===c)&&(i=o&&defined(r)?addToDate(r,scratchDuration):addToDate(n,scratchDuration),s.push(i),r=i);return TimeIntervalCollection.fromJulianDateArray({julianDates:s,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};var defaultScale$4=new Cartesian3(1,1,1),defaultTranslation=Cartesian3.ZERO,defaultRotation$1=Quaternion.IDENTITY;function TranslationRotationScale(e,t,i){this.translation=Cartesian3.clone(defaultValue(e,defaultTranslation)),this.rotation=Quaternion.clone(defaultValue(t,defaultRotation$1)),this.scale=Cartesian3.clone(defaultValue(i,defaultScale$4))}function VideoSynchronizer(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._clock=void 0,this._element=void 0,this._clockSubscription=void 0,this._seekFunction=void 0,this._lastPlaybackRate=void 0,this.clock=e.clock,this.element=e.element,this.epoch=defaultValue(e.epoch,Iso8601.MINIMUM_VALUE),this.tolerance=defaultValue(e.tolerance,1),this._seeking=!1,this._seekFunction=void 0,this._firstTickAfterSeek=!1}function createSeekFunction(e){return function(){e._seeking=!1,e._firstTickAfterSeek=!0}}function DataRectangle(e,t){this.rectangle=e,this.maxLevel=t}function VRTheWorldTerrainProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=Resource.createIfNeeded(e.url);this._resource=t,this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer(),this._terrainDataStructure={heightScale:.001,heightOffset:-1e3,elementsPerHeight:3,stride:4,elementMultiplier:256,isBigEndian:!0,lowestEncodedHeight:0,highestEncodedHeight:16777215};var i=e.credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i,this._tilingScheme=void 0,this._rectangles=[];var r,n=this,a=defaultValue(e.ellipsoid,Ellipsoid.WGS84);function o(e){var t=e.getElementsByTagName("SRS")[0].textContent;if("EPSG:4326"===t){n._tilingScheme=new GeographicTilingScheme({ellipsoid:a});var i=e.getElementsByTagName("TileFormat")[0];n._heightmapWidth=parseInt(i.getAttribute("width"),10),n._heightmapHeight=parseInt(i.getAttribute("height"),10),n._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(a,Math.min(n._heightmapWidth,n._heightmapHeight),n._tilingScheme.getNumberOfXTilesAtLevel(0));for(var r=e.getElementsByTagName("DataExtent"),o=0;o<r.length;++o){var l=r[o],c=CesiumMath.toRadians(parseFloat(l.getAttribute("minx"))),u=CesiumMath.toRadians(parseFloat(l.getAttribute("miny"))),d=CesiumMath.toRadians(parseFloat(l.getAttribute("maxx"))),h=CesiumMath.toRadians(parseFloat(l.getAttribute("maxy"))),p=parseInt(l.getAttribute("maxlevel"),10);n._rectangles.push(new DataRectangle(new Rectangle(c,u,d,h),p))}n._ready=!0,n._readyPromise.resolve(!0)}else s("SRS "+t+" is not supported.")}function s(e){var t=defaultValue(e,"An error occurred while accessing "+n._resource.url+".");r=TileProviderError.handleError(r,n,n._errorEvent,t,void 0,void 0,void 0,l)}function l(){when(n._resource.fetchXML(),o,s)}l()}TranslationRotationScale.prototype.equals=function(e){return this===e||defined(e)&&Cartesian3.equals(this.translation,e.translation)&&Quaternion.equals(this.rotation,e.rotation)&&Cartesian3.equals(this.scale,e.scale)},Object.defineProperties(VideoSynchronizer.prototype,{clock:{get:function(){return this._clock},set:function(e){var t=this._clock;t!==e&&(defined(t)&&(this._clockSubscription(),this._clockSubscription=void 0),defined(e)&&(this._clockSubscription=e.onTick.addEventListener(VideoSynchronizer.prototype._onTick,this)),this._clock=e)}},element:{get:function(){return this._element},set:function(e){var t=this._element;t!==e&&(defined(t)&&t.removeEventListener("seeked",this._seekFunction,!1),defined(e)&&(this._seeking=!1,this._seekFunction=createSeekFunction(this),e.addEventListener("seeked",this._seekFunction,!1)),this._element=e,this._seeking=!1,this._firstTickAfterSeek=!1)}}}),VideoSynchronizer.prototype.destroy=function(){return this.element=void 0,this.clock=void 0,destroyObject(this)},VideoSynchronizer.prototype.isDestroyed=function(){return!1},VideoSynchronizer.prototype._trySetPlaybackRate=function(e){if(this._lastPlaybackRate!==e.multiplier){var t=this._element;try{t.playbackRate=e.multiplier}catch(e){t.playbackRate=0}this._lastPlaybackRate=e.multiplier}},VideoSynchronizer.prototype._onTick=function(e){var t=this._element;if(defined(t)&&!(t.readyState<2)){var i=t.paused,r=e.shouldAnimate;if(r===i&&(r?t.play():t.pause()),this._seeking||this._firstTickAfterSeek)this._firstTickAfterSeek=!1;else{this._trySetPlaybackRate(e);var n,a=e.currentTime,o=defaultValue(this.epoch,Iso8601.MINIMUM_VALUE),s=JulianDate.secondsDifference(a,o),l=t.duration,c=t.currentTime;t.loop?((s%=l)<0&&(s=l-s),n=s):n=s>l?l:s<0?0:s;var u=r?defaultValue(this.tolerance,1):.001;Math.abs(n-c)>u&&(this._seeking=!0,t.currentTime=n)}}},Object.defineProperties(VRTheWorldTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}}),VRTheWorldTerrainProvider.prototype.requestTileGeometry=function(e,t,i,r){var n=this._tilingScheme.getNumberOfYTilesAtLevel(i),a=this._resource.getDerivedResource({url:i+"/"+e+"/"+(n-t-1)+".tif",queryParameters:{cesium:!0},request:r}).fetchImage({preferImageBitmap:!0});if(defined(a)){var o=this;return when(a).then((function(r){return new HeightmapTerrainData({buffer:getImagePixels(r),width:o._heightmapWidth,height:o._heightmapHeight,childTileMask:getChildMask(o,e,t,i),structure:o._terrainDataStructure})}))}},VRTheWorldTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};var rectangleScratch$3=new Rectangle;function getChildMask(e,t,i,r){for(var n=e._tilingScheme,a=e._rectangles,o=n.tileXYToRectangle(t,i,r),s=0,l=0;l<a.length&&15!==s;++l){var c=a[l];if(!(c.maxLevel<=r)){var u=c.rectangle;defined(Rectangle.intersection(u,o,rectangleScratch$3))&&(isTileInRectangle(n,u,2*t,2*i,r+1)&&(s|=4),isTileInRectangle(n,u,2*t+1,2*i,r+1)&&(s|=8),isTileInRectangle(n,u,2*t,2*i+1,r+1)&&(s|=1),isTileInRectangle(n,u,2*t+1,2*i+1,r+1)&&(s|=2))}}return s}function isTileInRectangle(e,t,i,r,n){var a=e.tileXYToRectangle(i,r,n);return defined(Rectangle.intersection(a,t,rectangleScratch$3))}VRTheWorldTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){},VRTheWorldTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){};var VulkanConstants={VK_FORMAT_UNDEFINED:0,VK_FORMAT_R4G4_UNORM_PACK8:1,VK_FORMAT_R4G4B4A4_UNORM_PACK16:2,VK_FORMAT_B4G4R4A4_UNORM_PACK16:3,VK_FORMAT_R5G6B5_UNORM_PACK16:4,VK_FORMAT_B5G6R5_UNORM_PACK16:5,VK_FORMAT_R5G5B5A1_UNORM_PACK16:6,VK_FORMAT_B5G5R5A1_UNORM_PACK16:7,VK_FORMAT_A1R5G5B5_UNORM_PACK16:8,VK_FORMAT_R8_UNORM:9,VK_FORMAT_R8_SNORM:10,VK_FORMAT_R8_USCALED:11,VK_FORMAT_R8_SSCALED:12,VK_FORMAT_R8_UINT:13,VK_FORMAT_R8_SINT:14,VK_FORMAT_R8_SRGB:15,VK_FORMAT_R8G8_UNORM:16,VK_FORMAT_R8G8_SNORM:17,VK_FORMAT_R8G8_USCALED:18,VK_FORMAT_R8G8_SSCALED:19,VK_FORMAT_R8G8_UINT:20,VK_FORMAT_R8G8_SINT:21,VK_FORMAT_R8G8_SRGB:22,VK_FORMAT_R8G8B8_UNORM:23,VK_FORMAT_R8G8B8_SNORM:24,VK_FORMAT_R8G8B8_USCALED:25,VK_FORMAT_R8G8B8_SSCALED:26,VK_FORMAT_R8G8B8_UINT:27,VK_FORMAT_R8G8B8_SINT:28,VK_FORMAT_R8G8B8_SRGB:29,VK_FORMAT_B8G8R8_UNORM:30,VK_FORMAT_B8G8R8_SNORM:31,VK_FORMAT_B8G8R8_USCALED:32,VK_FORMAT_B8G8R8_SSCALED:33,VK_FORMAT_B8G8R8_UINT:34,VK_FORMAT_B8G8R8_SINT:35,VK_FORMAT_B8G8R8_SRGB:36,VK_FORMAT_R8G8B8A8_UNORM:37,VK_FORMAT_R8G8B8A8_SNORM:38,VK_FORMAT_R8G8B8A8_USCALED:39,VK_FORMAT_R8G8B8A8_SSCALED:40,VK_FORMAT_R8G8B8A8_UINT:41,VK_FORMAT_R8G8B8A8_SINT:42,VK_FORMAT_R8G8B8A8_SRGB:43,VK_FORMAT_B8G8R8A8_UNORM:44,VK_FORMAT_B8G8R8A8_SNORM:45,VK_FORMAT_B8G8R8A8_USCALED:46,VK_FORMAT_B8G8R8A8_SSCALED:47,VK_FORMAT_B8G8R8A8_UINT:48,VK_FORMAT_B8G8R8A8_SINT:49,VK_FORMAT_B8G8R8A8_SRGB:50,VK_FORMAT_A8B8G8R8_UNORM_PACK32:51,VK_FORMAT_A8B8G8R8_SNORM_PACK32:52,VK_FORMAT_A8B8G8R8_USCALED_PACK32:53,VK_FORMAT_A8B8G8R8_SSCALED_PACK32:54,VK_FORMAT_A8B8G8R8_UINT_PACK32:55,VK_FORMAT_A8B8G8R8_SINT_PACK32:56,VK_FORMAT_A8B8G8R8_SRGB_PACK32:57,VK_FORMAT_A2R10G10B10_UNORM_PACK32:58,VK_FORMAT_A2R10G10B10_SNORM_PACK32:59,VK_FORMAT_A2R10G10B10_USCALED_PACK32:60,VK_FORMAT_A2R10G10B10_SSCALED_PACK32:61,VK_FORMAT_A2R10G10B10_UINT_PACK32:62,VK_FORMAT_A2R10G10B10_SINT_PACK32:63,VK_FORMAT_A2B10G10R10_UNORM_PACK32:64,VK_FORMAT_A2B10G10R10_SNORM_PACK32:65,VK_FORMAT_A2B10G10R10_USCALED_PACK32:66,VK_FORMAT_A2B10G10R10_SSCALED_PACK32:67,VK_FORMAT_A2B10G10R10_UINT_PACK32:68,VK_FORMAT_A2B10G10R10_SINT_PACK32:69,VK_FORMAT_R16_UNORM:70,VK_FORMAT_R16_SNORM:71,VK_FORMAT_R16_USCALED:72,VK_FORMAT_R16_SSCALED:73,VK_FORMAT_R16_UINT:74,VK_FORMAT_R16_SINT:75,VK_FORMAT_R16_SFLOAT:76,VK_FORMAT_R16G16_UNORM:77,VK_FORMAT_R16G16_SNORM:78,VK_FORMAT_R16G16_USCALED:79,VK_FORMAT_R16G16_SSCALED:80,VK_FORMAT_R16G16_UINT:81,VK_FORMAT_R16G16_SINT:82,VK_FORMAT_R16G16_SFLOAT:83,VK_FORMAT_R16G16B16_UNORM:84,VK_FORMAT_R16G16B16_SNORM:85,VK_FORMAT_R16G16B16_USCALED:86,VK_FORMAT_R16G16B16_SSCALED:87,VK_FORMAT_R16G16B16_UINT:88,VK_FORMAT_R16G16B16_SINT:89,VK_FORMAT_R16G16B16_SFLOAT:90,VK_FORMAT_R16G16B16A16_UNORM:91,VK_FORMAT_R16G16B16A16_SNORM:92,VK_FORMAT_R16G16B16A16_USCALED:93,VK_FORMAT_R16G16B16A16_SSCALED:94,VK_FORMAT_R16G16B16A16_UINT:95,VK_FORMAT_R16G16B16A16_SINT:96,VK_FORMAT_R16G16B16A16_SFLOAT:97,VK_FORMAT_R32_UINT:98,VK_FORMAT_R32_SINT:99,VK_FORMAT_R32_SFLOAT:100,VK_FORMAT_R32G32_UINT:101,VK_FORMAT_R32G32_SINT:102,VK_FORMAT_R32G32_SFLOAT:103,VK_FORMAT_R32G32B32_UINT:104,VK_FORMAT_R32G32B32_SINT:105,VK_FORMAT_R32G32B32_SFLOAT:106,VK_FORMAT_R32G32B32A32_UINT:107,VK_FORMAT_R32G32B32A32_SINT:108,VK_FORMAT_R32G32B32A32_SFLOAT:109,VK_FORMAT_R64_UINT:110,VK_FORMAT_R64_SINT:111,VK_FORMAT_R64_SFLOAT:112,VK_FORMAT_R64G64_UINT:113,VK_FORMAT_R64G64_SINT:114,VK_FORMAT_R64G64_SFLOAT:115,VK_FORMAT_R64G64B64_UINT:116,VK_FORMAT_R64G64B64_SINT:117,VK_FORMAT_R64G64B64_SFLOAT:118,VK_FORMAT_R64G64B64A64_UINT:119,VK_FORMAT_R64G64B64A64_SINT:120,VK_FORMAT_R64G64B64A64_SFLOAT:121,VK_FORMAT_B10G11R11_UFLOAT_PACK32:122,VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:123,VK_FORMAT_D16_UNORM:124,VK_FORMAT_X8_D24_UNORM_PACK32:125,VK_FORMAT_D32_SFLOAT:126,VK_FORMAT_S8_UINT:127,VK_FORMAT_D16_UNORM_S8_UINT:128,VK_FORMAT_D24_UNORM_S8_UINT:129,VK_FORMAT_D32_SFLOAT_S8_UINT:130,VK_FORMAT_BC1_RGB_UNORM_BLOCK:131,VK_FORMAT_BC1_RGB_SRGB_BLOCK:132,VK_FORMAT_BC1_RGBA_UNORM_BLOCK:133,VK_FORMAT_BC1_RGBA_SRGB_BLOCK:134,VK_FORMAT_BC2_UNORM_BLOCK:135,VK_FORMAT_BC2_SRGB_BLOCK:136,VK_FORMAT_BC3_UNORM_BLOCK:137,VK_FORMAT_BC3_SRGB_BLOCK:138,VK_FORMAT_BC4_UNORM_BLOCK:139,VK_FORMAT_BC4_SNORM_BLOCK:140,VK_FORMAT_BC5_UNORM_BLOCK:141,VK_FORMAT_BC5_SNORM_BLOCK:142,VK_FORMAT_BC6H_UFLOAT_BLOCK:143,VK_FORMAT_BC6H_SFLOAT_BLOCK:144,VK_FORMAT_BC7_UNORM_BLOCK:145,VK_FORMAT_BC7_SRGB_BLOCK:146,VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:147,VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:148,VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:149,VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:150,VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:151,VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:152,VK_FORMAT_EAC_R11_UNORM_BLOCK:153,VK_FORMAT_EAC_R11_SNORM_BLOCK:154,VK_FORMAT_EAC_R11G11_UNORM_BLOCK:155,VK_FORMAT_EAC_R11G11_SNORM_BLOCK:156,VK_FORMAT_ASTC_4x4_UNORM_BLOCK:157,VK_FORMAT_ASTC_4x4_SRGB_BLOCK:158,VK_FORMAT_ASTC_5x4_UNORM_BLOCK:159,VK_FORMAT_ASTC_5x4_SRGB_BLOCK:160,VK_FORMAT_ASTC_5x5_UNORM_BLOCK:161,VK_FORMAT_ASTC_5x5_SRGB_BLOCK:162,VK_FORMAT_ASTC_6x5_UNORM_BLOCK:163,VK_FORMAT_ASTC_6x5_SRGB_BLOCK:164,VK_FORMAT_ASTC_6x6_UNORM_BLOCK:165,VK_FORMAT_ASTC_6x6_SRGB_BLOCK:166,VK_FORMAT_ASTC_8x5_UNORM_BLOCK:167,VK_FORMAT_ASTC_8x5_SRGB_BLOCK:168,VK_FORMAT_ASTC_8x6_UNORM_BLOCK:169,VK_FORMAT_ASTC_8x6_SRGB_BLOCK:170,VK_FORMAT_ASTC_8x8_UNORM_BLOCK:171,VK_FORMAT_ASTC_8x8_SRGB_BLOCK:172,VK_FORMAT_ASTC_10x5_UNORM_BLOCK:173,VK_FORMAT_ASTC_10x5_SRGB_BLOCK:174,VK_FORMAT_ASTC_10x6_UNORM_BLOCK:175,VK_FORMAT_ASTC_10x6_SRGB_BLOCK:176,VK_FORMAT_ASTC_10x8_UNORM_BLOCK:177,VK_FORMAT_ASTC_10x8_SRGB_BLOCK:178,VK_FORMAT_ASTC_10x10_UNORM_BLOCK:179,VK_FORMAT_ASTC_10x10_SRGB_BLOCK:180,VK_FORMAT_ASTC_12x10_UNORM_BLOCK:181,VK_FORMAT_ASTC_12x10_SRGB_BLOCK:182,VK_FORMAT_ASTC_12x12_UNORM_BLOCK:183,VK_FORMAT_ASTC_12x12_SRGB_BLOCK:184,VK_FORMAT_G8B8G8R8_422_UNORM:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM:1000156006,VK_FORMAT_R10X6_UNORM_PACK16:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16:1000156016,VK_FORMAT_R12X4_UNORM_PACK16:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM:1000156033,VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG:1000054e3,VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG:1000054001,VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG:1000054002,VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG:1000054003,VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG:1000054004,VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG:1000054005,VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG:1000054006,VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG:1000054007,VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT:1000066e3,VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT:1000066001,VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT:1000066002,VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT:1000066003,VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT:1000066004,VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT:1000066005,VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT:1000066006,VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT:1000066007,VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT:1000066008,VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT:1000066009,VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT:1000066010,VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT:1000066011,VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT:1000066012,VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT:1000066013,VK_FORMAT_G8B8G8R8_422_UNORM_KHR:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM_KHR:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR:1000156006,VK_FORMAT_R10X6_UNORM_PACK16_KHR:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR:1000156016,VK_FORMAT_R12X4_UNORM_PACK16_KHR:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM_KHR:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM_KHR:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR:1000156033},VulkanConstants$1=Object.freeze(VulkanConstants),WallGeometryLibrary={};function latLonEquals(e,t){return CesiumMath.equalsEpsilon(e.latitude,t.latitude,CesiumMath.EPSILON10)&&CesiumMath.equalsEpsilon(e.longitude,t.longitude,CesiumMath.EPSILON10)}var scratchCartographic1=new Cartographic,scratchCartographic2=new Cartographic;function removeDuplicates$1(e,t,i,r){var n=(t=arrayRemoveDuplicates(t,Cartesian3.equalsEpsilon)).length;if(!(n<2)){var a=defined(r),o=defined(i),s=new Array(n),l=new Array(n),c=new Array(n),u=t[0];s[0]=u;var d=e.cartesianToCartographic(u,scratchCartographic1);o&&(d.height=i[0]),l[0]=d.height,c[0]=a?r[0]:0;for(var h=l[0]===c[0],p=1,f=1;f<n;++f){var m=t[f],g=e.cartesianToCartographic(m,scratchCartographic2);o&&(g.height=i[f]),h=h&&0===g.height,latLonEquals(d,g)?d.height<g.height&&(l[p-1]=g.height):(s[p]=m,l[p]=g.height,c[p]=a?r[f]:0,h=h&&l[p]===c[p],Cartographic.clone(g,d),++p)}if(!(h||p<2))return s.length=p,l.length=p,c.length=p,{positions:s,topHeights:l,bottomHeights:c}}}var positionsArrayScratch=new Array(2),heightsArrayScratch=new Array(2),generateArcOptionsScratch={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};WallGeometryLibrary.computePositions=function(e,t,i,r,n,a){var o=removeDuplicates$1(e,t,i,r);if(defined(o)){t=o.positions,i=o.topHeights,r=o.bottomHeights;var s,l,c=t.length,u=c-2,d=CesiumMath.chordLength(n,e.maximumRadius),h=generateArcOptionsScratch;if(h.minDistance=d,h.ellipsoid=e,a){var p,f=0;for(p=0;p<c-1;p++)f+=PolylinePipeline.numberOfPoints(t[p],t[p+1],d)+1;s=new Float64Array(3*f),l=new Float64Array(3*f);var m=positionsArrayScratch,g=heightsArrayScratch;h.positions=m,h.height=g;var _=0;for(p=0;p<c-1;p++){m[0]=t[p],m[1]=t[p+1],g[0]=i[p],g[1]=i[p+1];var y=PolylinePipeline.generateArc(h);s.set(y,_),g[0]=r[p],g[1]=r[p+1],l.set(PolylinePipeline.generateArc(h),_),_+=y.length}}else h.positions=t,h.height=i,s=new Float64Array(PolylinePipeline.generateArc(h)),h.height=r,l=new Float64Array(PolylinePipeline.generateArc(h));return{bottomPositions:l,topPositions:s,numCorners:u}}};var scratchCartesian3Position1$1=new Cartesian3,scratchCartesian3Position2$1=new Cartesian3,scratchCartesian3Position4=new Cartesian3,scratchCartesian3Position5=new Cartesian3,scratchBitangent=new Cartesian3,scratchTangent=new Cartesian3,scratchNormal$1=new Cartesian3;function WallGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.maximumHeights,r=e.minimumHeights,n=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),a=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),o=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this._positions=t,this._minimumHeights=r,this._maximumHeights=i,this._vertexFormat=VertexFormat.clone(n),this._granularity=a,this._ellipsoid=Ellipsoid.clone(o),this._workerName="createWallGeometry";var s=1+t.length*Cartesian3.packedLength+2;defined(r)&&(s+=r.length),defined(i)&&(s+=i.length),this.packedLength=s+Ellipsoid.packedLength+VertexFormat.packedLength+1}WallGeometry.pack=function(e,t,i){var r;i=defaultValue(i,0);var n=e._positions,a=n.length;for(t[i++]=a,r=0;r<a;++r,i+=Cartesian3.packedLength)Cartesian3.pack(n[r],t,i);var o=e._minimumHeights;if(a=defined(o)?o.length:0,t[i++]=a,defined(o))for(r=0;r<a;++r)t[i++]=o[r];var s=e._maximumHeights;if(a=defined(s)?s.length:0,t[i++]=a,defined(s))for(r=0;r<a;++r)t[i++]=s[r];return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),t[i+=VertexFormat.packedLength]=e._granularity,t};var scratchEllipsoid$2=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat=new VertexFormat,scratchOptions$1={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:scratchEllipsoid$2,vertexFormat:scratchVertexFormat,granularity:void 0};WallGeometry.unpack=function(e,t,i){var r;t=defaultValue(t,0);var n,a,o=e[t++],s=new Array(o);for(r=0;r<o;++r,t+=Cartesian3.packedLength)s[r]=Cartesian3.unpack(e,t);if((o=e[t++])>0)for(n=new Array(o),r=0;r<o;++r)n[r]=e[t++];if((o=e[t++])>0)for(a=new Array(o),r=0;r<o;++r)a[r]=e[t++];var l=Ellipsoid.unpack(e,t,scratchEllipsoid$2);t+=Ellipsoid.packedLength;var c=VertexFormat.unpack(e,t,scratchVertexFormat),u=e[t+=VertexFormat.packedLength];return defined(i)?(i._positions=s,i._minimumHeights=n,i._maximumHeights=a,i._ellipsoid=Ellipsoid.clone(l,i._ellipsoid),i._vertexFormat=VertexFormat.clone(c,i._vertexFormat),i._granularity=u,i):(scratchOptions$1.positions=s,scratchOptions$1.minimumHeights=n,scratchOptions$1.maximumHeights=a,scratchOptions$1.granularity=u,new WallGeometry(scratchOptions$1))},WallGeometry.fromConstantHeights=function(e){var t,i,r=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,n=e.minimumHeight,a=e.maximumHeight,o=defined(n),s=defined(a);if(o||s){var l=r.length;t=o?new Array(l):void 0,i=s?new Array(l):void 0;for(var c=0;c<l;++c)o&&(t[c]=n),s&&(i[c]=a)}return new WallGeometry({positions:r,maximumHeights:i,minimumHeights:t,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat})},WallGeometry.createGeometry=function(e){var t=e._positions,i=e._minimumHeights,r=e._maximumHeights,n=e._vertexFormat,a=e._granularity,o=e._ellipsoid,s=WallGeometryLibrary.computePositions(o,t,r,i,a,!0);if(defined(s)){var l,c=s.bottomPositions,u=s.topPositions,d=s.numCorners,h=u.length,p=2*h,f=n.position?new Float64Array(p):void 0,m=n.normal?new Float32Array(p):void 0,g=n.tangent?new Float32Array(p):void 0,_=n.bitangent?new Float32Array(p):void 0,y=n.st?new Float32Array(p/3*2):void 0,v=0,C=0,T=0,S=0,A=0,x=scratchNormal$1,E=scratchTangent,b=scratchBitangent,P=!0,D=0,w=1/((h/=3)-d-1);for(l=0;l<h;++l){var M=3*l,I=Cartesian3.fromArray(u,M,scratchCartesian3Position1$1),R=Cartesian3.fromArray(c,M,scratchCartesian3Position2$1);if(n.position&&(f[v++]=R.x,f[v++]=R.y,f[v++]=R.z,f[v++]=I.x,f[v++]=I.y,f[v++]=I.z),n.st&&(y[A++]=D,y[A++]=0,y[A++]=D,y[A++]=1),n.normal||n.tangent||n.bitangent){var O=Cartesian3.clone(Cartesian3.ZERO,scratchCartesian3Position5),B=Cartesian3.subtract(I,o.geodeticSurfaceNormal(I,scratchCartesian3Position2$1),scratchCartesian3Position2$1);if(l+1<h&&(O=Cartesian3.fromArray(u,M+3,scratchCartesian3Position5)),P){var L=Cartesian3.subtract(O,I,scratchCartesian3Position4),F=Cartesian3.subtract(B,I,scratchCartesian3Position1$1);x=Cartesian3.normalize(Cartesian3.cross(F,L,x),x),P=!1}Cartesian3.equalsEpsilon(I,O,CesiumMath.EPSILON10)?P=!0:(D+=w,n.tangent&&(E=Cartesian3.normalize(Cartesian3.subtract(O,I,E),E)),n.bitangent&&(b=Cartesian3.normalize(Cartesian3.cross(x,E,b),b))),n.normal&&(m[C++]=x.x,m[C++]=x.y,m[C++]=x.z,m[C++]=x.x,m[C++]=x.y,m[C++]=x.z),n.tangent&&(g[S++]=E.x,g[S++]=E.y,g[S++]=E.z,g[S++]=E.x,g[S++]=E.y,g[S++]=E.z),n.bitangent&&(_[T++]=b.x,_[T++]=b.y,_[T++]=b.z,_[T++]=b.x,_[T++]=b.y,_[T++]=b.z)}}var N=new GeometryAttributes;n.position&&(N.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:f})),n.normal&&(N.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:m})),n.tangent&&(N.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:g})),n.bitangent&&(N.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:_})),n.st&&(N.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:y}));var V=p/3;p-=6*(d+1);var k=IndexDatatype$1.createTypedArray(V,p),U=0;for(l=0;l<V-2;l+=2){var G=l,$=l+2,z=Cartesian3.fromArray(f,3*G,scratchCartesian3Position1$1),H=Cartesian3.fromArray(f,3*$,scratchCartesian3Position2$1);if(!Cartesian3.equalsEpsilon(z,H,CesiumMath.EPSILON10)){var W=l+1,j=l+3;k[U++]=W,k[U++]=G,k[U++]=j,k[U++]=j,k[U++]=G,k[U++]=$}}return new Geometry({attributes:N,indices:k,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:new BoundingSphere.fromVertices(f)})}};var scratchCartesian3Position1=new Cartesian3,scratchCartesian3Position2=new Cartesian3;function WallOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.maximumHeights,r=e.minimumHeights,n=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),a=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this._positions=t,this._minimumHeights=r,this._maximumHeights=i,this._granularity=n,this._ellipsoid=Ellipsoid.clone(a),this._workerName="createWallOutlineGeometry";var o=1+t.length*Cartesian3.packedLength+2;defined(r)&&(o+=r.length),defined(i)&&(o+=i.length),this.packedLength=o+Ellipsoid.packedLength+1}WallOutlineGeometry.pack=function(e,t,i){var r;i=defaultValue(i,0);var n=e._positions,a=n.length;for(t[i++]=a,r=0;r<a;++r,i+=Cartesian3.packedLength)Cartesian3.pack(n[r],t,i);var o=e._minimumHeights;if(a=defined(o)?o.length:0,t[i++]=a,defined(o))for(r=0;r<a;++r)t[i++]=o[r];var s=e._maximumHeights;if(a=defined(s)?s.length:0,t[i++]=a,defined(s))for(r=0;r<a;++r)t[i++]=s[r];return Ellipsoid.pack(e._ellipsoid,t,i),t[i+=Ellipsoid.packedLength]=e._granularity,t};var scratchEllipsoid$1=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:scratchEllipsoid$1,granularity:void 0};function webGLConstantToGlslType(e){switch(e){case WebGLConstants$1.FLOAT:return"float";case WebGLConstants$1.FLOAT_VEC2:return"vec2";case WebGLConstants$1.FLOAT_VEC3:return"vec3";case WebGLConstants$1.FLOAT_VEC4:return"vec4";case WebGLConstants$1.FLOAT_MAT2:return"mat2";case WebGLConstants$1.FLOAT_MAT3:return"mat3";case WebGLConstants$1.FLOAT_MAT4:return"mat4";case WebGLConstants$1.SAMPLER_2D:return"sampler2D";case WebGLConstants$1.BOOL:return"bool"}}function WeightSpline(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).weights,i=e.times;this._times=i,this._weights=t,this._count=t.length/i.length,this._lastTimeIndex=0}function wrapFunction(e,t,i){return function(){i.apply(e,arguments),t.apply(e,arguments)}}function ConstantProperty(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new Event,this.setValue(e)}function createProperty(e,t,i,r,n){return{configurable:r,get:function(){return this[t]},set:function(r){var a=this[t],o=this[i];defined(o)&&(o(),this[i]=void 0),!(void 0!==r)||defined(r)&&defined(r.getValue)||!defined(n)||(r=n(r)),a!==r&&(this[t]=r,this._definitionChanged.raiseEvent(this,e,r,a)),defined(r)&&defined(r.definitionChanged)&&(this[i]=r.definitionChanged.addEventListener((function(){this._definitionChanged.raiseEvent(this,e,r,r)}),this))}}}function createConstantProperty$1(e){return new ConstantProperty(e)}function createPropertyDescriptor(e,t,i){return createProperty(e,"_"+e.toString(),"_"+e.toString()+"Subscription",defaultValue(t,!1),defaultValue(i,createConstantProperty$1))}function BillboardGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._image=void 0,this._imageSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._alignedAxis=void 0,this._alignedAxisSubscription=void 0,this._sizeInMeters=void 0,this._sizeInMetersSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._imageSubRegion=void 0,this._imageSubRegionSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}WallOutlineGeometry.unpack=function(e,t,i){var r;t=defaultValue(t,0);var n,a,o=e[t++],s=new Array(o);for(r=0;r<o;++r,t+=Cartesian3.packedLength)s[r]=Cartesian3.unpack(e,t);if((o=e[t++])>0)for(n=new Array(o),r=0;r<o;++r)n[r]=e[t++];if((o=e[t++])>0)for(a=new Array(o),r=0;r<o;++r)a[r]=e[t++];var l=Ellipsoid.unpack(e,t,scratchEllipsoid$1),c=e[t+=Ellipsoid.packedLength];return defined(i)?(i._positions=s,i._minimumHeights=n,i._maximumHeights=a,i._ellipsoid=Ellipsoid.clone(l,i._ellipsoid),i._granularity=c,i):(scratchOptions.positions=s,scratchOptions.minimumHeights=n,scratchOptions.maximumHeights=a,scratchOptions.granularity=c,new WallOutlineGeometry(scratchOptions))},WallOutlineGeometry.fromConstantHeights=function(e){var t,i,r=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,n=e.minimumHeight,a=e.maximumHeight,o=defined(n),s=defined(a);if(o||s){var l=r.length;t=o?new Array(l):void 0,i=s?new Array(l):void 0;for(var c=0;c<l;++c)o&&(t[c]=n),s&&(i[c]=a)}return new WallOutlineGeometry({positions:r,maximumHeights:i,minimumHeights:t,ellipsoid:e.ellipsoid})},WallOutlineGeometry.createGeometry=function(e){var t=e._positions,i=e._minimumHeights,r=e._maximumHeights,n=e._granularity,a=e._ellipsoid,o=WallGeometryLibrary.computePositions(a,t,r,i,n,!1);if(defined(o)){var s,l=o.bottomPositions,c=o.topPositions,u=c.length,d=2*u,h=new Float64Array(d),p=0;for(u/=3,s=0;s<u;++s){var f=3*s,m=Cartesian3.fromArray(c,f,scratchCartesian3Position1),g=Cartesian3.fromArray(l,f,scratchCartesian3Position2);h[p++]=g.x,h[p++]=g.y,h[p++]=g.z,h[p++]=m.x,h[p++]=m.y,h[p++]=m.z}var _=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:h})}),y=d/3;d=2*y-4+y;var v=IndexDatatype$1.createTypedArray(y,d),C=0;for(s=0;s<y-2;s+=2){var T=s,S=s+2,A=Cartesian3.fromArray(h,3*T,scratchCartesian3Position1),x=Cartesian3.fromArray(h,3*S,scratchCartesian3Position2);if(!Cartesian3.equalsEpsilon(A,x,CesiumMath.EPSILON10)){var E=s+1,b=s+3;v[C++]=E,v[C++]=T,v[C++]=E,v[C++]=b,v[C++]=T,v[C++]=S}}return v[C++]=y-2,v[C++]=y-1,new Geometry({attributes:_,indices:v,primitiveType:PrimitiveType$1.LINES,boundingSphere:new BoundingSphere.fromVertices(h)})}},Object.defineProperties(WeightSpline.prototype,{times:{get:function(){return this._times}},weights:{get:function(){return this._weights}}}),WeightSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,WeightSpline.prototype.wrapTime=Spline.prototype.wrapTime,WeightSpline.prototype.clampTime=Spline.prototype.clampTime,WeightSpline.prototype.evaluate=function(e,t){var i=this.weights,r=this.times,n=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),a=(e-r[n])/(r[n+1]-r[n]);defined(t)||(t=new Array(this._count));for(var o=0;o<this._count;o++){var s=n*this._count+o;t[o]=i[s]*(1-a)+i[s+this._count]*a}return t},Object.defineProperties(ConstantProperty.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}}),ConstantProperty.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value},ConstantProperty.prototype.setValue=function(e){var t=this._value;if(t!==e){var i=defined(e),r=i&&"function"==typeof e.clone,n=i&&"function"==typeof e.equals;(!n||!e.equals(t))&&(this._hasClone=r,this._hasEquals=n,this._value=r?e.clone(this._value):e,this._definitionChanged.raiseEvent(this))}},ConstantProperty.prototype.equals=function(e){return this===e||e instanceof ConstantProperty&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))},ConstantProperty.prototype.valueOf=function(){return this._value},ConstantProperty.prototype.toString=function(){return String(this._value)},Object.defineProperties(BillboardGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),image:createPropertyDescriptor("image"),scale:createPropertyDescriptor("scale"),pixelOffset:createPropertyDescriptor("pixelOffset"),eyeOffset:createPropertyDescriptor("eyeOffset"),horizontalOrigin:createPropertyDescriptor("horizontalOrigin"),verticalOrigin:createPropertyDescriptor("verticalOrigin"),heightReference:createPropertyDescriptor("heightReference"),color:createPropertyDescriptor("color"),rotation:createPropertyDescriptor("rotation"),alignedAxis:createPropertyDescriptor("alignedAxis"),sizeInMeters:createPropertyDescriptor("sizeInMeters"),width:createPropertyDescriptor("width"),height:createPropertyDescriptor("height"),scaleByDistance:createPropertyDescriptor("scaleByDistance"),translucencyByDistance:createPropertyDescriptor("translucencyByDistance"),pixelOffsetScaleByDistance:createPropertyDescriptor("pixelOffsetScaleByDistance"),imageSubRegion:createPropertyDescriptor("imageSubRegion"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),disableDepthTestDistance:createPropertyDescriptor("disableDepthTestDistance")}),BillboardGraphics.prototype.clone=function(e){return defined(e)?(e.show=this._show,e.image=this._image,e.scale=this._scale,e.pixelOffset=this._pixelOffset,e.eyeOffset=this._eyeOffset,e.horizontalOrigin=this._horizontalOrigin,e.verticalOrigin=this._verticalOrigin,e.heightReference=this._heightReference,e.color=this._color,e.rotation=this._rotation,e.alignedAxis=this._alignedAxis,e.sizeInMeters=this._sizeInMeters,e.width=this._width,e.height=this._height,e.scaleByDistance=this._scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.pixelOffsetScaleByDistance=this._pixelOffsetScaleByDistance,e.imageSubRegion=this._imageSubRegion,e.distanceDisplayCondition=this._distanceDisplayCondition,e.disableDepthTestDistance=this._disableDepthTestDistance,e):new BillboardGraphics(this)},BillboardGraphics.prototype.merge=function(e){this.show=defaultValue(this._show,e.show),this.image=defaultValue(this._image,e.image),this.scale=defaultValue(this._scale,e.scale),this.pixelOffset=defaultValue(this._pixelOffset,e.pixelOffset),this.eyeOffset=defaultValue(this._eyeOffset,e.eyeOffset),this.horizontalOrigin=defaultValue(this._horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=defaultValue(this._verticalOrigin,e.verticalOrigin),this.heightReference=defaultValue(this._heightReference,e.heightReference),this.color=defaultValue(this._color,e.color),this.rotation=defaultValue(this._rotation,e.rotation),this.alignedAxis=defaultValue(this._alignedAxis,e.alignedAxis),this.sizeInMeters=defaultValue(this._sizeInMeters,e.sizeInMeters),this.width=defaultValue(this._width,e.width),this.height=defaultValue(this._height,e.height),this.scaleByDistance=defaultValue(this._scaleByDistance,e.scaleByDistance),this.translucencyByDistance=defaultValue(this._translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=defaultValue(this._pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.imageSubRegion=defaultValue(this._imageSubRegion,e.imageSubRegion),this.distanceDisplayCondition=defaultValue(this._distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=defaultValue(this._disableDepthTestDistance,e.disableDepthTestDistance)};var HeightReference={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2},HeightReference$1=Object.freeze(HeightReference),HorizontalOrigin={CENTER:0,LEFT:1,RIGHT:-1},HorizontalOrigin$1=Object.freeze(HorizontalOrigin),VerticalOrigin={CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1},VerticalOrigin$1=Object.freeze(VerticalOrigin),BoundingSphereState={DONE:0,PENDING:1,FAILED:2},BoundingSphereState$1=Object.freeze(BoundingSphereState);function Property(){DeveloperError.throwInstantiationError()}Object.defineProperties(Property.prototype,{isConstant:{get:DeveloperError.throwInstantiationError},definitionChanged:{get:DeveloperError.throwInstantiationError}}),Property.prototype.getValue=DeveloperError.throwInstantiationError,Property.prototype.equals=DeveloperError.throwInstantiationError,Property.equals=function(e,t){return e===t||defined(e)&&e.equals(t)},Property.arrayEquals=function(e,t){if(e===t)return!0;if(!defined(e)||!defined(t)||e.length!==t.length)return!1;for(var i=e.length,r=0;r<i;r++)if(!Property.equals(e[r],t[r]))return!1;return!0},Property.isConstant=function(e){return!defined(e)||e.isConstant},Property.getValueOrUndefined=function(e,t,i){return defined(e)?e.getValue(t,i):void 0},Property.getValueOrDefault=function(e,t,i,r){return defined(e)?defaultValue(e.getValue(t,r),i):i},Property.getValueOrClonedDefault=function(e,t,i,r){var n;return defined(e)&&(n=e.getValue(t,r)),defined(n)||(n=i.clone(n)),n};var defaultColor$8=Color.WHITE,defaultEyeOffset$1=Cartesian3.ZERO,defaultHeightReference$2=HeightReference$1.NONE,defaultPixelOffset$1=Cartesian2.ZERO,defaultScale$3=1,defaultRotation=0,defaultAlignedAxis=Cartesian3.ZERO,defaultHorizontalOrigin$1=HorizontalOrigin$1.CENTER,defaultVerticalOrigin$1=VerticalOrigin$1.CENTER,defaultSizeInMeters=!1,positionScratch$7=new Cartesian3,colorScratch$6=new Color,eyeOffsetScratch$1=new Cartesian3,pixelOffsetScratch$1=new Cartesian2,scaleByDistanceScratch$2=new NearFarScalar,translucencyByDistanceScratch$2=new NearFarScalar,pixelOffsetScaleByDistanceScratch$1=new NearFarScalar,boundingRectangleScratch=new BoundingRectangle,distanceDisplayConditionScratch$8=new DistanceDisplayCondition;function EntityData$3(e){this.entity=e,this.billboard=void 0,this.textureValue=void 0}function BillboardVisualizer(e,t){t.collectionChanged.addEventListener(BillboardVisualizer.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function returnPrimitive$2(e,t,i){defined(e)&&(e.billboard=void 0,i.removeBillboard(t))}BillboardVisualizer.prototype.update=function(e){for(var t=this._items.values,i=this._cluster,r=0,n=t.length;r<n;r++){var a,o,s=t[r],l=s.entity,c=l._billboard,u=s.billboard,d=l.isShowing&&l.isAvailable(e)&&Property.getValueOrDefault(c._show,e,!0);if(d&&(o=Property.getValueOrUndefined(l._position,e,positionScratch$7),a=Property.getValueOrUndefined(c._image,e),d=defined(o)&&defined(a)),d){Property.isConstant(l._position)||(i._clusterDirty=!0),defined(u)||((u=i.getBillboard(l)).id=l,u.image=void 0,s.billboard=u),u.show=d,defined(u.image)&&s.textureValue===a||(u.image=a,s.textureValue=a),u.position=o,u.color=Property.getValueOrDefault(c._color,e,defaultColor$8,colorScratch$6),u.eyeOffset=Property.getValueOrDefault(c._eyeOffset,e,defaultEyeOffset$1,eyeOffsetScratch$1),u.heightReference=Property.getValueOrDefault(c._heightReference,e,defaultHeightReference$2),u.pixelOffset=Property.getValueOrDefault(c._pixelOffset,e,defaultPixelOffset$1,pixelOffsetScratch$1),u.scale=Property.getValueOrDefault(c._scale,e,defaultScale$3),u.rotation=Property.getValueOrDefault(c._rotation,e,defaultRotation),u.alignedAxis=Property.getValueOrDefault(c._alignedAxis,e,defaultAlignedAxis),u.horizontalOrigin=Property.getValueOrDefault(c._horizontalOrigin,e,defaultHorizontalOrigin$1),u.verticalOrigin=Property.getValueOrDefault(c._verticalOrigin,e,defaultVerticalOrigin$1),u.width=Property.getValueOrUndefined(c._width,e),u.height=Property.getValueOrUndefined(c._height,e),u.scaleByDistance=Property.getValueOrUndefined(c._scaleByDistance,e,scaleByDistanceScratch$2),u.translucencyByDistance=Property.getValueOrUndefined(c._translucencyByDistance,e,translucencyByDistanceScratch$2),u.pixelOffsetScaleByDistance=Property.getValueOrUndefined(c._pixelOffsetScaleByDistance,e,pixelOffsetScaleByDistanceScratch$1),u.sizeInMeters=Property.getValueOrDefault(c._sizeInMeters,e,defaultSizeInMeters),u.distanceDisplayCondition=Property.getValueOrUndefined(c._distanceDisplayCondition,e,distanceDisplayConditionScratch$8),u.disableDepthTestDistance=Property.getValueOrUndefined(c._disableDepthTestDistance,e);var h=Property.getValueOrUndefined(c._imageSubRegion,e,boundingRectangleScratch);defined(h)&&u.setImageSubRegion(u._imageId,h)}else returnPrimitive$2(s,l,i)}return!0},BillboardVisualizer.prototype.getBoundingSphere=function(e,t){var i=this._items.get(e.id);if(!defined(i)||!defined(i.billboard))return BoundingSphereState$1.FAILED;var r=i.billboard;if(r.heightReference===HeightReference$1.NONE)t.center=Cartesian3.clone(r.position,t.center);else{if(!defined(r._clampedPosition))return BoundingSphereState$1.PENDING;t.center=Cartesian3.clone(r._clampedPosition,t.center)}return t.radius=0,BoundingSphereState$1.DONE},BillboardVisualizer.prototype.isDestroyed=function(){return!1},BillboardVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(BillboardVisualizer.prototype._onCollectionChanged,this);for(var e=this._entityCollection.values,t=0;t<e.length;t++)this._cluster.removeBillboard(e[t]);return destroyObject(this)},BillboardVisualizer.prototype._onCollectionChanged=function(e,t,i,r){var n,a,o=this._items,s=this._cluster;for(n=t.length-1;n>-1;n--)defined((a=t[n])._billboard)&&defined(a._position)&&o.set(a.id,new EntityData$3(a));for(n=r.length-1;n>-1;n--)defined((a=r[n])._billboard)&&defined(a._position)?o.contains(a.id)||o.set(a.id,new EntityData$3(a)):(returnPrimitive$2(o.get(a.id),a,s),o.remove(a.id));for(n=i.length-1;n>-1;n--)a=i[n],returnPrimitive$2(o.get(a.id),a,s),o.remove(a.id)};var AllMaterialAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_bitangentEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nmat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = tangentToEyeMatrix;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nmaterialInput.st = v_st;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n",AllMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec3 tangent;\nattribute vec3 bitangent;\nattribute vec2 st;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_bitangentEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_tangentEC = czm_normal * tangent;\nv_bitangentEC = czm_normal * bitangent;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",BasicMaterialAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n",BasicMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",TexturedMaterialAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nmaterialInput.st = v_st;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n",TexturedMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec2 st;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",BlendEquation={ADD:WebGLConstants$1.FUNC_ADD,SUBTRACT:WebGLConstants$1.FUNC_SUBTRACT,REVERSE_SUBTRACT:WebGLConstants$1.FUNC_REVERSE_SUBTRACT,MIN:WebGLConstants$1.MIN,MAX:WebGLConstants$1.MAX},BlendEquation$1=Object.freeze(BlendEquation),BlendFunction={ZERO:WebGLConstants$1.ZERO,ONE:WebGLConstants$1.ONE,SOURCE_COLOR:WebGLConstants$1.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:WebGLConstants$1.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:WebGLConstants$1.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:WebGLConstants$1.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:WebGLConstants$1.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:WebGLConstants$1.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:WebGLConstants$1.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:WebGLConstants$1.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:WebGLConstants$1.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:WebGLConstants$1.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:WebGLConstants$1.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:WebGLConstants$1.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:WebGLConstants$1.SRC_ALPHA_SATURATE},BlendFunction$1=Object.freeze(BlendFunction),BlendingState={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.SOURCE_ALPHA,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ONE,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.SOURCE_ALPHA,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE,functionDestinationAlpha:BlendFunction$1.ONE})},BlendingState$1=Object.freeze(BlendingState),CullFace={FRONT:WebGLConstants$1.FRONT,BACK:WebGLConstants$1.BACK,FRONT_AND_BACK:WebGLConstants$1.FRONT_AND_BACK},CullFace$1=Object.freeze(CullFace);function Appearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.material=e.material,this.translucent=defaultValue(e.translucent,!0),this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=defaultValue(e.closed,!1)}function CubeMapFace(e,t,i,r,n,a,o,s,l,c,u){this._context=e,this._texture=t,this._textureTarget=i,this._targetFace=r,this._pixelDatatype=o,this._internalFormat=n,this._pixelFormat=a,this._size=s,this._preMultiplyAlpha=l,this._flipY=c,this._initialized=u}function CubeMap(e){var t,i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,r=e.source;if(defined(r)){var n=[r.positiveX,r.negativeX,r.positiveY,r.negativeY,r.positiveZ,r.negativeZ];t=n[0].width,n[0].height}else t=e.width;var a=t,o=defaultValue(e.pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE),s=defaultValue(e.pixelFormat,PixelFormat$1.RGBA),l=PixelFormat$1.toInternalFormat(s,o,i),c=6*PixelFormat$1.textureSizeInBytes(s,o,a,a),u=e.preMultiplyAlpha||s===PixelFormat$1.RGB||s===PixelFormat$1.LUMINANCE,d=defaultValue(e.flipY,!0),h=defaultValue(e.skipColorSpaceConversion,!1),p=i._gl,f=p.TEXTURE_CUBE_MAP,m=p.createTexture();function g(e,r,n,c,u){var d=r.arrayBufferView;defined(d)||(d=r.bufferView);var h=4;defined(d)&&(h=PixelFormat$1.alignmentInBytes(s,o,t)),p.pixelStorei(p.UNPACK_ALIGNMENT,h),u?p.pixelStorei(p.UNPACK_COLORSPACE_CONVERSION_WEBGL,p.NONE):p.pixelStorei(p.UNPACK_COLORSPACE_CONVERSION_WEBGL,p.BROWSER_DEFAULT_WEBGL),defined(d)?(p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,!1),c&&(d=PixelFormat$1.flipY(d,s,o,a,a)),p.texImage2D(e,0,l,a,a,0,s,PixelDatatype$1.toWebGLConstant(o,i),d)):(p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,c),p.texImage2D(e,0,l,s,PixelDatatype$1.toWebGLConstant(o,i),r))}p.activeTexture(p.TEXTURE0),p.bindTexture(f,m),defined(r)?(g(p.TEXTURE_CUBE_MAP_POSITIVE_X,r.positiveX,u,d,h),g(p.TEXTURE_CUBE_MAP_NEGATIVE_X,r.negativeX,u,d,h),g(p.TEXTURE_CUBE_MAP_POSITIVE_Y,r.positiveY,u,d,h),g(p.TEXTURE_CUBE_MAP_NEGATIVE_Y,r.negativeY,u,d,h),g(p.TEXTURE_CUBE_MAP_POSITIVE_Z,r.positiveZ,u,d,h),g(p.TEXTURE_CUBE_MAP_NEGATIVE_Z,r.negativeZ,u,d,h)):(p.texImage2D(p.TEXTURE_CUBE_MAP_POSITIVE_X,0,l,a,a,0,s,PixelDatatype$1.toWebGLConstant(o,i),null),p.texImage2D(p.TEXTURE_CUBE_MAP_NEGATIVE_X,0,l,a,a,0,s,PixelDatatype$1.toWebGLConstant(o,i),null),p.texImage2D(p.TEXTURE_CUBE_MAP_POSITIVE_Y,0,l,a,a,0,s,PixelDatatype$1.toWebGLConstant(o,i),null),p.texImage2D(p.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,l,a,a,0,s,PixelDatatype$1.toWebGLConstant(o,i),null),p.texImage2D(p.TEXTURE_CUBE_MAP_POSITIVE_Z,0,l,a,a,0,s,PixelDatatype$1.toWebGLConstant(o,i),null),p.texImage2D(p.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,l,a,a,0,s,PixelDatatype$1.toWebGLConstant(o,i),null)),p.bindTexture(f,null),this._context=i,this._textureFilterAnisotropic=i._textureFilterAnisotropic,this._textureTarget=f,this._texture=m,this._pixelFormat=s,this._pixelDatatype=o,this._size=a,this._hasMipmap=!1,this._sizeInBytes=c,this._preMultiplyAlpha=u,this._flipY=d,this._sampler=void 0;var _=defined(r);this._positiveX=new CubeMapFace(i,m,f,p.TEXTURE_CUBE_MAP_POSITIVE_X,l,s,o,a,u,d,_),this._negativeX=new CubeMapFace(i,m,f,p.TEXTURE_CUBE_MAP_NEGATIVE_X,l,s,o,a,u,d,_),this._positiveY=new CubeMapFace(i,m,f,p.TEXTURE_CUBE_MAP_POSITIVE_Y,l,s,o,a,u,d,_),this._negativeY=new CubeMapFace(i,m,f,p.TEXTURE_CUBE_MAP_NEGATIVE_Y,l,s,o,a,u,d,_),this._positiveZ=new CubeMapFace(i,m,f,p.TEXTURE_CUBE_MAP_POSITIVE_Z,l,s,o,a,u,d,_),this._negativeZ=new CubeMapFace(i,m,f,p.TEXTURE_CUBE_MAP_NEGATIVE_Z,l,s,o,a,u,d,_),this.sampler=defined(e.sampler)?e.sampler:new Sampler}Object.defineProperties(Appearance.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}}}),Appearance.prototype.getFragmentShaderSource=function(){var e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),defined(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join("\n")},Appearance.prototype.isTranslucent=function(){return defined(this.material)&&this.material.isTranslucent()||!defined(this.material)&&this.translucent},Appearance.prototype.getRenderState=function(){var e=this.isTranslucent(),t=clone$1(this.renderState,!1);return e?(t.depthMask=!1,t.blending=BlendingState$1.ALPHA_BLEND):t.depthMask=!0,t},Appearance.getDefaultRenderState=function(e,t,i){var r={depthTest:{enabled:!0}};return e&&(r.depthMask=!1,r.blending=BlendingState$1.ALPHA_BLEND),t&&(r.cull={enabled:!0,face:CullFace$1.BACK}),defined(i)&&(r=combine$2(i,r,!0)),r},Object.defineProperties(CubeMapFace.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}}),CubeMapFace.prototype.copyFrom=function(e){var t=defaultValue(e.xOffset,0),i=defaultValue(e.yOffset,0),r=e.source,n=this._context._gl,a=this._textureTarget,o=this._targetFace;n.activeTexture(n.TEXTURE0),n.bindTexture(a,this._texture);var s=r.width,l=r.height,c=r.arrayBufferView,u=this._size,d=this._pixelFormat,h=this._internalFormat,p=this._pixelDatatype,f=this._preMultiplyAlpha,m=this._flipY,g=defaultValue(e.skipColorSpaceConversion,!1),_=4;defined(c)&&(_=PixelFormat$1.alignmentInBytes(d,p,s)),n.pixelStorei(n.UNPACK_ALIGNMENT,_),g?n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE):n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.BROWSER_DEFAULT_WEBGL);var y=!1;if(!this._initialized){if(0===t&&0===i&&s===u&&l===u)defined(c)?(n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),m&&(c=PixelFormat$1.flipY(c,d,p,u,u)),n.texImage2D(o,0,h,u,u,0,d,PixelDatatype$1.toWebGLConstant(p,this._context),c)):(n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,m),n.texImage2D(o,0,h,d,PixelDatatype$1.toWebGLConstant(p,this._context),r)),y=!0;else{n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);var v=PixelFormat$1.createTypedArray(d,p,u,u);n.texImage2D(o,0,h,u,u,0,d,PixelDatatype$1.toWebGLConstant(p,this._context),v)}this._initialized=!0}y||(defined(c)?(n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),m&&(c=PixelFormat$1.flipY(c,d,p,s,l)),n.texSubImage2D(o,0,t,i,s,l,d,PixelDatatype$1.toWebGLConstant(p,this._context),c)):(n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,m),n.texSubImage2D(o,0,t,i,d,PixelDatatype$1.toWebGLConstant(p,this._context),r))),n.bindTexture(a,null)},CubeMapFace.prototype.copyFromFramebuffer=function(e,t,i,r,n,a){e=defaultValue(e,0),t=defaultValue(t,0),i=defaultValue(i,0),r=defaultValue(r,0),n=defaultValue(n,this._size),a=defaultValue(a,this._size);var o=this._context._gl,s=this._textureTarget;o.activeTexture(o.TEXTURE0),o.bindTexture(s,this._texture),o.copyTexSubImage2D(this._targetFace,0,e,t,i,r,n,a),o.bindTexture(s,null),this._initialized=!0},Object.defineProperties(CubeMap.prototype,{positiveX:{get:function(){return this._positiveX}},negativeX:{get:function(){return this._negativeX}},positiveY:{get:function(){return this._positiveY}},negativeY:{get:function(){return this._negativeY}},positiveZ:{get:function(){return this._positiveZ}},negativeZ:{get:function(){return this._negativeZ}},sampler:{get:function(){return this._sampler},set:function(e){var t=e.minificationFilter,i=e.magnificationFilter,r=t===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||t===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR||t===TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST||t===TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR,n=this._context,a=this._pixelDatatype;(a===PixelDatatype$1.FLOAT&&!n.textureFloatLinear||a===PixelDatatype$1.HALF_FLOAT&&!n.textureHalfFloatLinear)&&(t=r?TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST:TextureMinificationFilter$1.NEAREST,i=TextureMagnificationFilter$1.NEAREST);var o=n._gl,s=this._textureTarget;o.activeTexture(o.TEXTURE0),o.bindTexture(s,this._texture),o.texParameteri(s,o.TEXTURE_MIN_FILTER,t),o.texParameteri(s,o.TEXTURE_MAG_FILTER,i),o.texParameteri(s,o.TEXTURE_WRAP_S,e.wrapS),o.texParameteri(s,o.TEXTURE_WRAP_T,e.wrapT),defined(this._textureFilterAnisotropic)&&o.texParameteri(s,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),o.bindTexture(s,null),this._sampler=e}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},width:{get:function(){return this._size}},height:{get:function(){return this._size}},sizeInBytes:{get:function(){return this._hasMipmap?Math.floor(4*this._sizeInBytes/3):this._sizeInBytes}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},_target:{get:function(){return this._textureTarget}}}),CubeMap.prototype.generateMipmap=function(e){e=defaultValue(e,MipmapHint$1.DONT_CARE),this._hasMipmap=!0;var t=this._context._gl,i=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(i,this._texture),t.generateMipmap(i),t.bindTexture(i,null)},CubeMap.prototype.isDestroyed=function(){return!1},CubeMap.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),this._positiveX=destroyObject(this._positiveX),this._negativeX=destroyObject(this._negativeX),this._positiveY=destroyObject(this._positiveY),this._negativeY=destroyObject(this._negativeY),this._positiveZ=destroyObject(this._positiveZ),this._negativeZ=destroyObject(this._negativeZ),destroyObject(this)};var AspectRampMaterial="uniform sampler2D image;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 rampColor = texture2D(image, vec2(materialInput.aspect / (2.0 * czm_pi), 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n",BumpMapMaterial="uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nvec2 centerPixel = fract(repeat * st);\nfloat centerBump = texture2D(image, centerPixel).channel;\nfloat imageWidth = float(imageDimensions.x);\nvec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));\nfloat rightBump = texture2D(image, rightPixel).channel;\nfloat imageHeight = float(imageDimensions.y);\nvec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));\nfloat topBump = texture2D(image, leftPixel).channel;\nvec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nmaterial.diffuse = vec3(0.01);\nreturn material;\n}\n",CheckerboardMaterial="uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0);\nfloat scaledWidth = fract(repeat.s * st.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(repeat.t * st.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value = min(scaledWidth, scaledHeight);\nvec4 currentColor = mix(lightColor, darkColor, b);\nvec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",DotMaterial="uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5));\nvec4 color = mix(lightColor, darkColor, b);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",ElevationBandMaterial="uniform sampler2D heights;\nuniform sampler2D colors;\nfloat getHeight(int idx, float invTexSize)\n{\nvec2 uv = vec2((float(idx) + 0.5) * invTexSize, 0.5);\n#ifdef OES_texture_float\nreturn texture2D(heights, uv).x;\n#else\nreturn czm_unpackFloat(texture2D(heights, uv));\n#endif\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat height = materialInput.height;\nfloat invTexSize = 1.0 / float(heightsDimensions.x);\nfloat minHeight = getHeight(0, invTexSize);\nfloat maxHeight = getHeight(heightsDimensions.x - 1, invTexSize);\nif (height < minHeight || height > maxHeight) {\nmaterial.diffuse = vec3(0.0);\nmaterial.alpha = 0.0;\nreturn material;\n}\nint idxBelow = 0;\nint idxAbove = heightsDimensions.x;\nfloat heightBelow = minHeight;\nfloat heightAbove = maxHeight;\nconst int maxIterations = 16;\nfor (int i = 0; i < maxIterations; i++) {\nif (idxBelow >= idxAbove - 1) {\nbreak;\n}\nint idxMid = (idxBelow + idxAbove) / 2;\nfloat heightTex = getHeight(idxMid, invTexSize);\nif (height > heightTex) {\nidxBelow = idxMid;\nheightBelow = heightTex;\n} else {\nidxAbove = idxMid;\nheightAbove = heightTex;\n}\n}\nfloat lerper = heightBelow == heightAbove ? 1.0 : (height - heightBelow) / (heightAbove - heightBelow);\nvec2 colorUv = vec2(invTexSize * (float(idxBelow) + 0.5 + lerper), 0.5);\nvec4 color = texture2D(colors, colorUv);\nif (color.a > 0.0)\n{\ncolor.rgb /= color.a;\n}\ncolor.rgb = czm_gammaCorrect(color.rgb);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",ElevationContourMaterial="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nuniform float spacing;\nuniform float width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat distanceToContour = mod(materialInput.height, spacing);\n#ifdef GL_OES_standard_derivatives\nfloat dxc = abs(dFdx(materialInput.height));\nfloat dyc = abs(dFdy(materialInput.height));\nfloat dF = max(dxc, dyc) * czm_pixelRatio * width;\nfloat alpha = (distanceToContour < dF) ? 1.0 : 0.0;\n#else\nfloat alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;\n#endif\nvec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n",ElevationRampMaterial="uniform sampler2D image;\nuniform float minimumHeight;\nuniform float maximumHeight;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat scaledHeight = clamp((materialInput.height - minimumHeight) / (maximumHeight - minimumHeight), 0.0, 1.0);\nvec4 rampColor = texture2D(image, vec2(scaledHeight, 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n",FadeMaterial="uniform vec4 fadeInColor;\nuniform vec4 fadeOutColor;\nuniform float maximumDistance;\nuniform bool repeat;\nuniform vec2 fadeDirection;\nuniform vec2 time;\nfloat getTime(float t, float coord)\n{\nfloat scalar = 1.0 / maximumDistance;\nfloat q = distance(t, coord) * scalar;\nif (repeat)\n{\nfloat r = distance(t, coord + 1.0) * scalar;\nfloat s = distance(t, coord - 1.0) * scalar;\nq = min(min(r, s), q);\n}\nreturn clamp(q, 0.0, 1.0);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat s = getTime(time.x, st.s) * fadeDirection.s;\nfloat t = getTime(time.y, st.t) * fadeDirection.t;\nfloat u = length(vec2(s, t));\nvec4 color = mix(fadeInColor, fadeOutColor, u);\ncolor = czm_gammaCorrect(color);\nmaterial.emission = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",GridMaterial="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nuniform float cellAlpha;\nuniform vec2 lineCount;\nuniform vec2 lineThickness;\nuniform vec2 lineOffset;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat scaledWidth = fract(lineCount.s * st.s - lineOffset.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(lineCount.t * st.t - lineOffset.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value;\n#ifdef GL_OES_standard_derivatives\nconst float fuzz = 1.2;\nvec2 thickness = (lineThickness * czm_pixelRatio) - 1.0;\nvec2 dx = abs(dFdx(st));\nvec2 dy = abs(dFdy(st));\nvec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;\nvalue = min(\nsmoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),\nsmoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));\n#else\nconst float fuzz = 0.05;\nvec2 range = 0.5 - (lineThickness * 0.05);\nvalue = min(\n1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),\n1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));\n#endif\nfloat dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)));\nfloat sRim = smoothstep(0.8, 1.0, dRim);\nvalue *= (1.0 - sRim);\nvec4 halfColor;\nhalfColor.rgb = color.rgb * 0.5;\nhalfColor.a = color.a * (1.0 - ((1.0 - cellAlpha) * value));\nhalfColor = czm_gammaCorrect(halfColor);\nmaterial.diffuse = halfColor.rgb;\nmaterial.emission = halfColor.rgb;\nmaterial.alpha = halfColor.a;\nreturn material;\n}\n",NormalMapMaterial="uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 textureValue = texture2D(image, fract(repeat * materialInput.st));\nvec3 normalTangentSpace = textureValue.channels;\nnormalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;\nnormalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);\nnormalTangentSpace = normalize(normalTangentSpace);\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nreturn material;\n}\n",PolylineArrowMaterial="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nfloat getPointOnLine(vec2 p0, vec2 p1, float x)\n{\nfloat slope = (p0.y - p1.y) / (p0.x - p1.x);\nreturn slope * (x - p0.x) + p0.y;\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\n#ifdef GL_OES_standard_derivatives\nfloat base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio;\n#else\nfloat base = 0.975;\n#endif\nvec2 center = vec2(1.0, 0.5);\nfloat ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);\nfloat ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);\nfloat halfWidth = 0.15;\nfloat s = step(0.5 - halfWidth, st.t);\ns *= 1.0 - step(0.5 + halfWidth, st.t);\ns *= 1.0 - step(base, st.s);\nfloat t = step(base, materialInput.st.s);\nt *= 1.0 - step(ptOnUpperLine, st.t);\nt *= step(ptOnLowerLine, st.t);\nfloat dist;\nif (st.s < base)\n{\nfloat d1 = abs(st.t - (0.5 - halfWidth));\nfloat d2 = abs(st.t - (0.5 + halfWidth));\ndist = min(d1, d2);\n}\nelse\n{\nfloat d1 = czm_infinity;\nif (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)\n{\nd1 = abs(st.s - base);\n}\nfloat d2 = abs(st.t - ptOnUpperLine);\nfloat d3 = abs(st.t - ptOnLowerLine);\ndist = min(min(d1, d2), d3);\n}\nvec4 outsideColor = vec4(0.0);\nvec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));\nvec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);\noutColor = czm_gammaCorrect(outColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n",PolylineDashMaterial="uniform vec4 color;\nuniform vec4 gapColor;\nuniform float dashLength;\nuniform float dashPattern;\nvarying float v_polylineAngle;\nconst float maskLength = 16.0;\nmat2 rotate(float rad) {\nfloat c = cos(rad);\nfloat s = sin(rad);\nreturn mat2(\nc, s,\n-s, c\n);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;\nfloat dashPosition = fract(pos.x / (dashLength * czm_pixelRatio));\nfloat maskIndex = floor(dashPosition * maskLength);\nfloat maskTest = floor(dashPattern / pow(2.0, maskIndex));\nvec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;\nif (fragColor.a < 0.005) {\ndiscard;\n}\nfragColor = czm_gammaCorrect(fragColor);\nmaterial.emission = fragColor.rgb;\nmaterial.alpha = fragColor.a;\nreturn material;\n}\n",PolylineGlowMaterial="uniform vec4 color;\nuniform float glowPower;\nuniform float taperPower;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);\nif (taperPower <= 0.99999) {\nglow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5));\n}\nvec4 fragColor;\nfragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb);\nfragColor.a = clamp(0.0, 1.0, glow) * color.a;\nfragColor = czm_gammaCorrect(fragColor);\nmaterial.emission = fragColor.rgb;\nmaterial.alpha = fragColor.a;\nreturn material;\n}\n",PolylineOutlineMaterial="uniform vec4 color;\nuniform vec4 outlineColor;\nuniform float outlineWidth;\nvarying float v_width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;\nfloat b = step(0.5 - halfInteriorWidth, st.t);\nb *= 1.0 - step(0.5 + halfInteriorWidth, st.t);\nfloat d1 = abs(st.t - (0.5 - halfInteriorWidth));\nfloat d2 = abs(st.t - (0.5 + halfInteriorWidth));\nfloat dist = min(d1, d2);\nvec4 currentColor = mix(outlineColor, color, b);\nvec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);\noutColor = czm_gammaCorrect(outColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n",RimLightingMaterial="uniform vec4 color;\nuniform vec4 rimColor;\nuniform float width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\nfloat s = smoothstep(1.0 - width, 1.0, d);\nvec4 outColor = czm_gammaCorrect(color);\nvec4 outRimColor = czm_gammaCorrect(rimColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.emission = outRimColor.rgb * s;\nmaterial.alpha = mix(outColor.a, outRimColor.a, s);\nreturn material;\n}\n",SlopeRampMaterial="uniform sampler2D image;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 rampColor = texture2D(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n",StripeMaterial="uniform vec4 evenColor;\nuniform vec4 oddColor;\nuniform float offset;\nuniform float repeat;\nuniform bool horizontal;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));\nfloat value = fract((coord - offset) * (repeat * 0.5));\nfloat dist = min(value, min(abs(value - 0.5), 1.0 - value));\nvec4 currentColor = mix(evenColor, oddColor, step(0.5, value));\nvec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",WaterMaterial="uniform sampler2D specularMap;\nuniform sampler2D normalMap;\nuniform vec4 baseWaterColor;\nuniform vec4 blendColor;\nuniform float frequency;\nuniform float animationSpeed;\nuniform float amplitude;\nuniform float specularIntensity;\nuniform float fadeFactor;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat time = czm_frameNumber * animationSpeed;\nfloat fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);\nfloat specularMapValue = texture2D(specularMap, materialInput.st).r;\nvec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);\nvec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));\nnormalTangentSpace.xy /= fade;\nnormalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);\nnormalTangentSpace = normalize(normalTangentSpace);\nfloat tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);\nmaterial.alpha = mix(blendColor.a, baseWaterColor.a, specularMapValue) * specularMapValue;\nmaterial.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);\nmaterial.diffuse += (0.1 * tsPerturbationRatio);\nmaterial.diffuse = material.diffuse;\nmaterial.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);\nmaterial.specular = specularIntensity;\nmaterial.shininess = 10.0;\nreturn material;\n}\n";function Material$3(e){this.type=void 0,this.shaderSource=void 0,this.materials=void 0,this.uniforms=void 0,this._uniforms=void 0,this.translucent=void 0,this._minificationFilter=defaultValue(e.minificationFilter,TextureMinificationFilter$1.LINEAR),this._magnificationFilter=defaultValue(e.magnificationFilter,TextureMagnificationFilter$1.LINEAR),this._strict=void 0,this._template=void 0,this._count=void 0,this._texturePaths={},this._loadedImages=[],this._loadedCubeMaps=[],this._textures={},this._updateFunctions=[],this._defaultTexture=void 0,initializeMaterial(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),defined(Material$3._uniformList[this.type])||(Material$3._uniformList[this.type]=Object.keys(this._uniforms))}function initializeMaterial(e,t){var i;e=defaultValue(e,defaultValue.EMPTY_OBJECT),t._strict=defaultValue(e.strict,!1),t._count=defaultValue(e.count,0),t._template=clone$1(defaultValue(e.fabric,defaultValue.EMPTY_OBJECT)),t._template.uniforms=clone$1(defaultValue(t._template.uniforms,defaultValue.EMPTY_OBJECT)),t._template.materials=clone$1(defaultValue(t._template.materials,defaultValue.EMPTY_OBJECT)),t.type=defined(t._template.type)?t._template.type:createGuid(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];var r=Material$3._materialCache.getMaterial(t.type);if(defined(r)){var n=clone$1(r.fabric,!0);t._template=combine$2(t._template,n,!0),i=r.translucent}checkForTemplateErrors(t),defined(r)||Material$3._materialCache.addMaterial(t.type,t),createMethodDefinition(t),createUniforms(t),createSubMaterials(t);var a=0===t._translucentFunctions.length||void 0;if(i=defaultValue(i,a),defined(i=defaultValue(e.translucent,i)))if("function"==typeof i){t._translucentFunctions.push((function(){return i(t)}))}else t._translucentFunctions.push(i)}function checkForValidProperties(e,t,i,r){if(defined(e))for(var n in e)if(e.hasOwnProperty(n)){var a=-1!==t.indexOf(n);(r&&!a||!r&&a)&&i(n,t)}}function invalidNameError(e,t){}function duplicateNameError(e,t){}Material$3._uniformList={},Material$3.fromType=function(e,t){var i=new Material$3({fabric:{type:e}});if(defined(t))for(var r in t)t.hasOwnProperty(r)&&(i.uniforms[r]=t[r]);return i},Material$3.prototype.isTranslucent=function(){if(defined(this.translucent))return"function"==typeof this.translucent?this.translucent():this.translucent;for(var e=!0,t=this._translucentFunctions,i=t.length,r=0;r<i;++r){var n=t[r];if(!(e="function"==typeof n?e&&n():e&&n))break}return e},Material$3.prototype.update=function(e){var t,i;this._defaultTexture=e.defaultTexture;var r=this._loadedImages,n=r.length;for(t=0;t<n;++t){var a=r[t];i=a.id;var o,s=a.image;Array.isArray(s)&&(o=s.slice(1,s.length).map((function(e){return e.bufferView})),s=s[0]);var l,c=new Sampler({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter});l=defined(s.internalFormat)?new Texture({context:e,pixelFormat:s.internalFormat,width:s.width,height:s.height,source:{arrayBufferView:s.bufferView,mipLevels:o},sampler:c}):new Texture({context:e,source:s,sampler:c});var u=this._textures[i];defined(u)&&u!==this._defaultTexture&&u.destroy(),this._textures[i]=l;var d=i+"Dimensions";if(this.uniforms.hasOwnProperty(d)){var h=this.uniforms[d];h.x=l._width,h.y=l._height}}r.length=0;var p=this._loadedCubeMaps;for(n=p.length,t=0;t<n;++t){var f=p[t];i=f.id;var m=f.images,g=new CubeMap({context:e,source:{positiveX:m[0],negativeX:m[1],positiveY:m[2],negativeY:m[3],positiveZ:m[4],negativeZ:m[5]},sampler:new Sampler({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter})});this._textures[i]=g}p.length=0;var _=this._updateFunctions;for(n=_.length,t=0;t<n;++t)_[t](this,e);var y=this.materials;for(var v in y)y.hasOwnProperty(v)&&y[v].update(e)},Material$3.prototype.isDestroyed=function(){return!1},Material$3.prototype.destroy=function(){var e=this._textures;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];i!==this._defaultTexture&&i.destroy()}var r=this.materials;for(var n in r)r.hasOwnProperty(n)&&r[n].destroy();return destroyObject(this)};var templateProperties=["type","materials","uniforms","components","source"],componentProperties=["diffuse","specular","shininess","normal","emission","alpha"];function checkForTemplateErrors(e){var t=e._template,i=t.uniforms,r=t.materials,n=t.components;checkForValidProperties(t,templateProperties,invalidNameError,!0),checkForValidProperties(n,componentProperties,invalidNameError,!0);var a=[];for(var o in r)r.hasOwnProperty(o)&&a.push(o);checkForValidProperties(i,a,duplicateNameError,!1)}function isMaterialFused(e,t){var i=t._template.materials;for(var r in i)if(i.hasOwnProperty(r)&&e.indexOf(r)>-1)return!0;return!1}function createMethodDefinition(e){var t=e._template.components,i=e._template.source;if(defined(i))e.shaderSource+=i+"\n";else{if(e.shaderSource+="czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n",e.shaderSource+="czm_material material = czm_getDefaultMaterial(materialInput);\n",defined(t)){var r=Object.keys(e._template.materials).length>0;for(var n in t)if(t.hasOwnProperty(n))if("diffuse"===n||"emission"===n){var a=r&&isMaterialFused(t[n],e)?t[n]:"czm_gammaCorrect("+t[n]+")";e.shaderSource+="material."+n+" = "+a+"; \n"}else e.shaderSource+="alpha"===n?"material.alpha = "+t.alpha+"; \n":"material."+n+" = "+t[n]+";\n"}e.shaderSource+="return material;\n}\n"}}var matrixMap={mat2:Matrix2,mat3:Matrix3,mat4:Matrix4},ktx2Regex$3=/\.ktx2$/i;function createTexture2DUpdateFunction(e){var t;return function(i,r){var n=i.uniforms,a=n[e],o=t!==a,s=!defined(a)||a===Material$3.DefaultImageId;t=a;var l,c,u=i._textures[e];if(a instanceof HTMLVideoElement)if(a.readyState>=2){if(o&&defined(u)&&(u!==r.defaultTexture&&u.destroy(),u=void 0),!defined(u)||u===r.defaultTexture){var d=new Sampler({minificationFilter:i._minificationFilter,magnificationFilter:i._magnificationFilter});return u=new Texture({context:r,source:a,sampler:d}),void(i._textures[e]=u)}u.copyFrom({source:a})}else defined(u)||(i._textures[e]=r.defaultTexture);else{if(a instanceof Texture&&a!==u){i._texturePaths[e]=void 0;var h=i._textures[e];return defined(h)&&h!==i._defaultTexture&&h.destroy(),i._textures[e]=a,l=e+"Dimensions",void(n.hasOwnProperty(l)&&((c=n[l]).x=a._width,c.y=a._height))}if(o&&defined(u)&&s&&(u!==i._defaultTexture&&u.destroy(),u=void 0),defined(u)||(i._texturePaths[e]=void 0,u=i._textures[e]=i._defaultTexture,l=e+"Dimensions",n.hasOwnProperty(l)&&((c=n[l]).x=u._width,c.y=u._height)),!s){var p=a instanceof Resource;if(!defined(i._texturePaths[e])||p&&a.url!==i._texturePaths[e].url||!p&&a!==i._texturePaths[e]){if("string"==typeof a||p){var f=p?a:Resource.createIfNeeded(a);(ktx2Regex$3.test(f.url)?loadKTX2(f.url):f.fetchImage()).then((function(t){i._loadedImages.push({id:e,image:t})})).otherwise((function(){defined(u)&&u!==i._defaultTexture&&u.destroy(),i._textures[e]=i._defaultTexture}))}else(a instanceof HTMLCanvasElement||a instanceof HTMLImageElement)&&i._loadedImages.push({id:e,image:a});i._texturePaths[e]=a}}}}}function createCubeMapUpdateFunction(e){return function(t,i){var r=t.uniforms[e];if(r instanceof CubeMap){var n=t._textures[e];return n!==t._defaultTexture&&n.destroy(),t._texturePaths[e]=void 0,void(t._textures[e]=r)}if(defined(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=i.defaultCubeMap),r!==Material$3.DefaultCubeMapId){var a=r.positiveX+r.negativeX+r.positiveY+r.negativeY+r.positiveZ+r.negativeZ;if(a!==t._texturePaths[e]){var o=[Resource.createIfNeeded(r.positiveX).fetchImage(),Resource.createIfNeeded(r.negativeX).fetchImage(),Resource.createIfNeeded(r.positiveY).fetchImage(),Resource.createIfNeeded(r.negativeY).fetchImage(),Resource.createIfNeeded(r.positiveZ).fetchImage(),Resource.createIfNeeded(r.negativeZ).fetchImage()];when.all(o).then((function(i){t._loadedCubeMaps.push({id:e,images:i})})),t._texturePaths[e]=a}}}}function createUniforms(e){var t=e._template.uniforms;for(var i in t)t.hasOwnProperty(i)&&createUniform$1(e,i)}function createUniform$1(e,t){e._strict;var i=e._template.uniforms,r=i[t],n=getUniformType(r);if("channels"===n)replaceToken(e,t,r,!1);else{if("sampler2D"===n){var a=t+"Dimensions";getNumberOfTokens(e,a)>0&&(i[a]={type:"ivec3",x:1,y:1},createUniform$1(e,a))}if(!new RegExp("uniform\\s+"+n+"\\s+"+t+"\\s*;").test(e.shaderSource)){var o="uniform "+n+" "+t+";";e.shaderSource=o+e.shaderSource}var s=t+"_"+e._count++;if(replaceToken(e,t,s),e.uniforms[t]=r,"sampler2D"===n)e._uniforms[s]=function(){return e._textures[t]},e._updateFunctions.push(createTexture2DUpdateFunction(t));else if("samplerCube"===n)e._uniforms[s]=function(){return e._textures[t]},e._updateFunctions.push(createCubeMapUpdateFunction(t));else if(-1!==n.indexOf("mat")){var l=new matrixMap[n];e._uniforms[s]=function(){return matrixMap[n].fromColumnMajorArray(e.uniforms[t],l)}}else e._uniforms[s]=function(){return e.uniforms[t]}}}function getUniformType(e){var t=e.type;if(!defined(t)){var i=typeof e;if("number"===i)t="float";else if("boolean"===i)t="bool";else if("string"===i||e instanceof Resource||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)t=/^([rgba]){1,4}$/i.test(e)?"channels":e===Material$3.DefaultCubeMapId?"samplerCube":"sampler2D";else if("object"===i)if(Array.isArray(e))4!==e.length&&9!==e.length&&16!==e.length||(t="mat"+Math.sqrt(e.length));else{var r=0;for(var n in e)e.hasOwnProperty(n)&&(r+=1);r>=2&&r<=4?t="vec"+r:6===r&&(t="samplerCube")}}return t}function createSubMaterials(e){var t=e._strict,i=e._template.materials;for(var r in i)if(i.hasOwnProperty(r)){var n=new Material$3({strict:t,fabric:i[r],count:e._count});e._count=n._count,e._uniforms=combine$2(e._uniforms,n._uniforms,!0),e.materials[r]=n,e._translucentFunctions=e._translucentFunctions.concat(n._translucentFunctions);var a="czm_getMaterial",o="czm_getMaterial_"+e._count++;replaceToken(n,a,o),e.shaderSource=n.shaderSource+e.shaderSource,replaceToken(e,r,o+"(materialInput)")}}function replaceToken(e,t,i,r){r=defaultValue(r,!0);var n=0,a=new RegExp("([\\w"+(r?".":"")+"])?"+t+"([\\w])?","g");return e.shaderSource=e.shaderSource.replace(a,(function(e,t,r){return t||r?e:(n+=1,i)})),n}function getNumberOfTokens(e,t,i){return replaceToken(e,t,t,i)}function MaterialAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=defaultValue(e.translucent,!0),i=defaultValue(e.closed,!1),r=defaultValue(e.materialSupport,MaterialAppearance.MaterialSupport.TEXTURED);this.material=defined(e.material)?e.material:Material$3.fromType(Material$3.ColorType),this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,r.vertexShaderSource),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,r.fragmentShaderSource),this._renderState=Appearance.getDefaultRenderState(t,i,e.renderState),this._closed=i,this._materialSupport=r,this._vertexFormat=r.vertexFormat,this._flat=defaultValue(e.flat,!1),this._faceForward=defaultValue(e.faceForward,!i)}Material$3._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}},Material$3.DefaultImageId="czm_defaultImage",Material$3.DefaultCubeMapId="czm_defaultCubeMap",Material$3.ColorType="Color",Material$3._materialCache.addMaterial(Material$3.ColorType,{fabric:{type:Material$3.ColorType,uniforms:{color:new Color(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),Material$3.ImageType="Image",Material$3._materialCache.addMaterial(Material$3.ImageType,{fabric:{type:Material$3.ImageType,uniforms:{image:Material$3.DefaultImageId,repeat:new Cartesian2(1,1),color:new Color(1,1,1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).rgb * color.rgb",alpha:"texture2D(image, fract(repeat * materialInput.st)).a * color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),Material$3.DiffuseMapType="DiffuseMap",Material$3._materialCache.addMaterial(Material$3.DiffuseMapType,{fabric:{type:Material$3.DiffuseMapType,uniforms:{image:Material$3.DefaultImageId,channels:"rgb",repeat:new Cartesian2(1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),Material$3.AlphaMapType="AlphaMap",Material$3._materialCache.addMaterial(Material$3.AlphaMapType,{fabric:{type:Material$3.AlphaMapType,uniforms:{image:Material$3.DefaultImageId,channel:"a",repeat:new Cartesian2(1,1)},components:{alpha:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!0}),Material$3.SpecularMapType="SpecularMap",Material$3._materialCache.addMaterial(Material$3.SpecularMapType,{fabric:{type:Material$3.SpecularMapType,uniforms:{image:Material$3.DefaultImageId,channel:"r",repeat:new Cartesian2(1,1)},components:{specular:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!1}),Material$3.EmissionMapType="EmissionMap",Material$3._materialCache.addMaterial(Material$3.EmissionMapType,{fabric:{type:Material$3.EmissionMapType,uniforms:{image:Material$3.DefaultImageId,channels:"rgb",repeat:new Cartesian2(1,1)},components:{emission:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),Material$3.BumpMapType="BumpMap",Material$3._materialCache.addMaterial(Material$3.BumpMapType,{fabric:{type:Material$3.BumpMapType,uniforms:{image:Material$3.DefaultImageId,channel:"r",strength:.8,repeat:new Cartesian2(1,1)},source:BumpMapMaterial},translucent:!1}),Material$3.NormalMapType="NormalMap",Material$3._materialCache.addMaterial(Material$3.NormalMapType,{fabric:{type:Material$3.NormalMapType,uniforms:{image:Material$3.DefaultImageId,channels:"rgb",strength:.8,repeat:new Cartesian2(1,1)},source:NormalMapMaterial},translucent:!1}),Material$3.GridType="Grid",Material$3._materialCache.addMaterial(Material$3.GridType,{fabric:{type:Material$3.GridType,uniforms:{color:new Color(0,1,0,1),cellAlpha:.1,lineCount:new Cartesian2(8,8),lineThickness:new Cartesian2(1,1),lineOffset:new Cartesian2(0,0)},source:GridMaterial},translucent:function(e){var t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}}),Material$3.StripeType="Stripe",Material$3._materialCache.addMaterial(Material$3.StripeType,{fabric:{type:Material$3.StripeType,uniforms:{horizontal:!0,evenColor:new Color(1,1,1,.5),oddColor:new Color(0,0,1,.5),offset:0,repeat:5},source:StripeMaterial},translucent:function(e){var t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}}),Material$3.CheckerboardType="Checkerboard",Material$3._materialCache.addMaterial(Material$3.CheckerboardType,{fabric:{type:Material$3.CheckerboardType,uniforms:{lightColor:new Color(1,1,1,.5),darkColor:new Color(0,0,0,.5),repeat:new Cartesian2(5,5)},source:CheckerboardMaterial},translucent:function(e){var t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}}),Material$3.DotType="Dot",Material$3._materialCache.addMaterial(Material$3.DotType,{fabric:{type:Material$3.DotType,uniforms:{lightColor:new Color(1,1,0,.75),darkColor:new Color(0,1,1,.75),repeat:new Cartesian2(5,5)},source:DotMaterial},translucent:function(e){var t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}}),Material$3.WaterType="Water",Material$3._materialCache.addMaterial(Material$3.WaterType,{fabric:{type:Material$3.WaterType,uniforms:{baseWaterColor:new Color(.2,.3,.6,1),blendColor:new Color(0,1,.699,1),specularMap:Material$3.DefaultImageId,normalMap:Material$3.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:WaterMaterial},translucent:function(e){var t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}}),Material$3.RimLightingType="RimLighting",Material$3._materialCache.addMaterial(Material$3.RimLightingType,{fabric:{type:Material$3.RimLightingType,uniforms:{color:new Color(1,0,0,.7),rimColor:new Color(1,1,1,.4),width:.3},source:RimLightingMaterial},translucent:function(e){var t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}}),Material$3.FadeType="Fade",Material$3._materialCache.addMaterial(Material$3.FadeType,{fabric:{type:Material$3.FadeType,uniforms:{fadeInColor:new Color(1,0,0,1),fadeOutColor:new Color(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new Cartesian2(.5,.5)},source:FadeMaterial},translucent:function(e){var t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}}),Material$3.PolylineArrowType="PolylineArrow",Material$3._materialCache.addMaterial(Material$3.PolylineArrowType,{fabric:{type:Material$3.PolylineArrowType,uniforms:{color:new Color(1,1,1,1)},source:PolylineArrowMaterial},translucent:!0}),Material$3.PolylineDashType="PolylineDash",Material$3._materialCache.addMaterial(Material$3.PolylineDashType,{fabric:{type:Material$3.PolylineDashType,uniforms:{color:new Color(1,0,1,1),gapColor:new Color(0,0,0,0),dashLength:16,dashPattern:255},source:PolylineDashMaterial},translucent:!0}),Material$3.PolylineGlowType="PolylineGlow",Material$3._materialCache.addMaterial(Material$3.PolylineGlowType,{fabric:{type:Material$3.PolylineGlowType,uniforms:{color:new Color(0,.5,1,1),glowPower:.25,taperPower:1},source:PolylineGlowMaterial},translucent:!0}),Material$3.PolylineOutlineType="PolylineOutline",Material$3._materialCache.addMaterial(Material$3.PolylineOutlineType,{fabric:{type:Material$3.PolylineOutlineType,uniforms:{color:new Color(1,1,1,1),outlineColor:new Color(1,0,0,1),outlineWidth:1},source:PolylineOutlineMaterial},translucent:function(e){var t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}}),Material$3.ElevationContourType="ElevationContour",Material$3._materialCache.addMaterial(Material$3.ElevationContourType,{fabric:{type:Material$3.ElevationContourType,uniforms:{spacing:100,color:new Color(1,0,0,1),width:1},source:ElevationContourMaterial},translucent:!1}),Material$3.ElevationRampType="ElevationRamp",Material$3._materialCache.addMaterial(Material$3.ElevationRampType,{fabric:{type:Material$3.ElevationRampType,uniforms:{image:Material$3.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:ElevationRampMaterial},translucent:!1}),Material$3.SlopeRampMaterialType="SlopeRamp",Material$3._materialCache.addMaterial(Material$3.SlopeRampMaterialType,{fabric:{type:Material$3.SlopeRampMaterialType,uniforms:{image:Material$3.DefaultImageId},source:SlopeRampMaterial},translucent:!1}),Material$3.AspectRampMaterialType="AspectRamp",Material$3._materialCache.addMaterial(Material$3.AspectRampMaterialType,{fabric:{type:Material$3.AspectRampMaterialType,uniforms:{image:Material$3.DefaultImageId},source:AspectRampMaterial},translucent:!1}),Material$3.ElevationBandType="ElevationBand",Material$3._materialCache.addMaterial(Material$3.ElevationBandType,{fabric:{type:Material$3.ElevationBandType,uniforms:{heights:Material$3.DefaultImageId,colors:Material$3.DefaultImageId},source:ElevationBandMaterial},translucent:!0}),Object.defineProperties(MaterialAppearance.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},materialSupport:{get:function(){return this._materialSupport}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}}),MaterialAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,MaterialAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,MaterialAppearance.prototype.getRenderState=Appearance.prototype.getRenderState,MaterialAppearance.MaterialSupport={BASIC:Object.freeze({vertexFormat:VertexFormat.POSITION_AND_NORMAL,vertexShaderSource:BasicMaterialAppearanceVS,fragmentShaderSource:BasicMaterialAppearanceFS}),TEXTURED:Object.freeze({vertexFormat:VertexFormat.POSITION_NORMAL_AND_ST,vertexShaderSource:TexturedMaterialAppearanceVS,fragmentShaderSource:TexturedMaterialAppearanceFS}),ALL:Object.freeze({vertexFormat:VertexFormat.ALL,vertexShaderSource:AllMaterialAppearanceVS,fragmentShaderSource:AllMaterialAppearanceFS})};var PerInstanceColorAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nvec4 color = czm_gammaCorrect(v_color);\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n}\n",PerInstanceColorAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec4 color;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",PerInstanceFlatColorAppearanceFS="varying vec4 v_color;\nvoid main()\n{\ngl_FragColor = czm_gammaCorrect(v_color);\n}\n",PerInstanceFlatColorAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 color;\nattribute float batchId;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";function PerInstanceColorAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=defaultValue(e.translucent,!0),i=defaultValue(e.closed,!1),r=defaultValue(e.flat,!1),n=r?PerInstanceFlatColorAppearanceVS:PerInstanceColorAppearanceVS,a=r?PerInstanceFlatColorAppearanceFS:PerInstanceColorAppearanceFS,o=r?PerInstanceColorAppearance.FLAT_VERTEX_FORMAT:PerInstanceColorAppearance.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,n),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,a),this._renderState=Appearance.getDefaultRenderState(t,i,e.renderState),this._closed=i,this._vertexFormat=o,this._flat=r,this._faceForward=defaultValue(e.faceForward,!i)}function ColorMaterialProperty(e){this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this.color=e}function DrawCommand(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._cull=defaultValue(e.cull,!0),this._occlude=defaultValue(e.occlude,!0),this._modelMatrix=e.modelMatrix,this._primitiveType=defaultValue(e.primitiveType,PrimitiveType$1.TRIANGLES),this._vertexArray=e.vertexArray,this._count=e.count,this._offset=defaultValue(e.offset,0),this._instanceCount=defaultValue(e.instanceCount,0),this._shaderProgram=e.shaderProgram,this._uniformMap=e.uniformMap,this._renderState=e.renderState,this._framebuffer=e.framebuffer,this._pass=e.pass,this._executeInClosestFrustum=defaultValue(e.executeInClosestFrustum,!1),this._owner=e.owner,this._debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugOverlappingFrustums=0,this._castShadows=defaultValue(e.castShadows,!1),this._receiveShadows=defaultValue(e.receiveShadows,!1),this._pickId=e.pickId,this._pickOnly=defaultValue(e.pickOnly,!1),this._depthForTranslucentClassification=defaultValue(e.depthForTranslucentClassification,!1),this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}Object.defineProperties(PerInstanceColorAppearance.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}}),PerInstanceColorAppearance.VERTEX_FORMAT=VertexFormat.POSITION_AND_NORMAL,PerInstanceColorAppearance.FLAT_VERTEX_FORMAT=VertexFormat.POSITION_ONLY,PerInstanceColorAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,PerInstanceColorAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,PerInstanceColorAppearance.prototype.getRenderState=Appearance.prototype.getRenderState,Object.defineProperties(ColorMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color")}),ColorMaterialProperty.prototype.getType=function(e){return"Color"},ColorMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,Color.WHITE,t.color),t},ColorMaterialProperty.prototype.equals=function(e){return this===e||e instanceof ColorMaterialProperty&&Property.equals(this._color,e._color)},Object.defineProperties(DrawCommand.prototype,{boundingVolume:{get:function(){return this._boundingVolume},set:function(e){this._boundingVolume!==e&&(this._boundingVolume=e,this.dirty=!0)}},orientedBoundingBox:{get:function(){return this._orientedBoundingBox},set:function(e){this._orientedBoundingBox!==e&&(this._orientedBoundingBox=e,this.dirty=!0)}},cull:{get:function(){return this._cull},set:function(e){this._cull!==e&&(this._cull=e,this.dirty=!0)}},occlude:{get:function(){return this._occlude},set:function(e){this._occlude!==e&&(this._occlude=e,this.dirty=!0)}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix!==e&&(this._modelMatrix=e,this.dirty=!0)}},primitiveType:{get:function(){return this._primitiveType},set:function(e){this._primitiveType!==e&&(this._primitiveType=e,this.dirty=!0)}},vertexArray:{get:function(){return this._vertexArray},set:function(e){this._vertexArray!==e&&(this._vertexArray=e,this.dirty=!0)}},count:{get:function(){return this._count},set:function(e){this._count!==e&&(this._count=e,this.dirty=!0)}},offset:{get:function(){return this._offset},set:function(e){this._offset!==e&&(this._offset=e,this.dirty=!0)}},instanceCount:{get:function(){return this._instanceCount},set:function(e){this._instanceCount!==e&&(this._instanceCount=e,this.dirty=!0)}},shaderProgram:{get:function(){return this._shaderProgram},set:function(e){this._shaderProgram!==e&&(this._shaderProgram=e,this.dirty=!0)}},castShadows:{get:function(){return this._castShadows},set:function(e){this._castShadows!==e&&(this._castShadows=e,this.dirty=!0)}},receiveShadows:{get:function(){return this._receiveShadows},set:function(e){this._receiveShadows!==e&&(this._receiveShadows=e,this.dirty=!0)}},uniformMap:{get:function(){return this._uniformMap},set:function(e){this._uniformMap!==e&&(this._uniformMap=e,this.dirty=!0)}},renderState:{get:function(){return this._renderState},set:function(e){this._renderState!==e&&(this._renderState=e,this.dirty=!0)}},framebuffer:{get:function(){return this._framebuffer},set:function(e){this._framebuffer!==e&&(this._framebuffer=e,this.dirty=!0)}},pass:{get:function(){return this._pass},set:function(e){this._pass!==e&&(this._pass=e,this.dirty=!0)}},executeInClosestFrustum:{get:function(){return this._executeInClosestFrustum},set:function(e){this._executeInClosestFrustum!==e&&(this._executeInClosestFrustum=e,this.dirty=!0)}},owner:{get:function(){return this._owner},set:function(e){this._owner!==e&&(this._owner=e,this.dirty=!0)}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolume=e,this.dirty=!0)}},debugOverlappingFrustums:{get:function(){return this._debugOverlappingFrustums},set:function(e){this._debugOverlappingFrustums!==e&&(this._debugOverlappingFrustums=e,this.dirty=!0)}},pickId:{get:function(){return this._pickId},set:function(e){this._pickId!==e&&(this._pickId=e,this.dirty=!0)}},pickOnly:{get:function(){return this._pickOnly},set:function(e){this._pickOnly!==e&&(this._pickOnly=e,this.dirty=!0)}},depthForTranslucentClassification:{get:function(){return this._depthForTranslucentClassification},set:function(e){this._depthForTranslucentClassification!==e&&(this._depthForTranslucentClassification=e,this.dirty=!0)}}}),DrawCommand.shallowClone=function(e,t){if(defined(e))return defined(t)||(t=new DrawCommand),t._boundingVolume=e._boundingVolume,t._orientedBoundingBox=e._orientedBoundingBox,t._cull=e._cull,t._occlude=e._occlude,t._modelMatrix=e._modelMatrix,t._primitiveType=e._primitiveType,t._vertexArray=e._vertexArray,t._count=e._count,t._offset=e._offset,t._instanceCount=e._instanceCount,t._shaderProgram=e._shaderProgram,t._uniformMap=e._uniformMap,t._renderState=e._renderState,t._framebuffer=e._framebuffer,t._pass=e._pass,t._executeInClosestFrustum=e._executeInClosestFrustum,t._owner=e._owner,t._debugShowBoundingVolume=e._debugShowBoundingVolume,t._debugOverlappingFrustums=e._debugOverlappingFrustums,t._castShadows=e._castShadows,t._receiveShadows=e._receiveShadows,t._pickId=e._pickId,t._pickOnly=e._pickOnly,t._depthForTranslucentClassification=e._depthForTranslucentClassification,t.dirty=!0,t.lastDirtyTime=0,t},DrawCommand.prototype.execute=function(e,t){e.draw(this,t)};var Pass={ENVIRONMENT:0,COMPUTE:1,GLOBE:2,TERRAIN_CLASSIFICATION:3,CESIUM_3D_TILE:4,CESIUM_3D_TILE_CLASSIFICATION:5,CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW:6,OPAQUE:7,TRANSLUCENT:8,OVERLAY:9,NUMBER_OF_PASSES:10},Pass$1=Object.freeze(Pass);function freezeRenderState(e){if("object"!=typeof e||null===e)return e;for(var t,i=Object.keys(e),r=0;r<i.length;r++)t=i[r],e.hasOwnProperty(t)&&"_applyFunctions"!==t&&(e[t]=freezeRenderState(e[t]));return Object.freeze(e)}function RenderState(e){var t=defaultValue(e,defaultValue.EMPTY_OBJECT),i=defaultValue(t.cull,defaultValue.EMPTY_OBJECT),r=defaultValue(t.polygonOffset,defaultValue.EMPTY_OBJECT),n=defaultValue(t.scissorTest,defaultValue.EMPTY_OBJECT),a=defaultValue(n.rectangle,defaultValue.EMPTY_OBJECT),o=defaultValue(t.depthRange,defaultValue.EMPTY_OBJECT),s=defaultValue(t.depthTest,defaultValue.EMPTY_OBJECT),l=defaultValue(t.colorMask,defaultValue.EMPTY_OBJECT),c=defaultValue(t.blending,defaultValue.EMPTY_OBJECT),u=defaultValue(c.color,defaultValue.EMPTY_OBJECT),d=defaultValue(t.stencilTest,defaultValue.EMPTY_OBJECT),h=defaultValue(d.frontOperation,defaultValue.EMPTY_OBJECT),p=defaultValue(d.backOperation,defaultValue.EMPTY_OBJECT),f=defaultValue(t.sampleCoverage,defaultValue.EMPTY_OBJECT),m=t.viewport;this.frontFace=defaultValue(t.frontFace,WindingOrder$1.COUNTER_CLOCKWISE),this.cull={enabled:defaultValue(i.enabled,!1),face:defaultValue(i.face,WebGLConstants$1.BACK)},this.lineWidth=defaultValue(t.lineWidth,1),this.polygonOffset={enabled:defaultValue(r.enabled,!1),factor:defaultValue(r.factor,0),units:defaultValue(r.units,0)},this.scissorTest={enabled:defaultValue(n.enabled,!1),rectangle:BoundingRectangle.clone(a)},this.depthRange={near:defaultValue(o.near,0),far:defaultValue(o.far,1)},this.depthTest={enabled:defaultValue(s.enabled,!1),func:defaultValue(s.func,WebGLConstants$1.LESS)},this.colorMask={red:defaultValue(l.red,!0),green:defaultValue(l.green,!0),blue:defaultValue(l.blue,!0),alpha:defaultValue(l.alpha,!0)},this.depthMask=defaultValue(t.depthMask,!0),this.stencilMask=defaultValue(t.stencilMask,-1),this.blending={enabled:defaultValue(c.enabled,!1),color:new Color(defaultValue(u.red,0),defaultValue(u.green,0),defaultValue(u.blue,0),defaultValue(u.alpha,0)),equationRgb:defaultValue(c.equationRgb,WebGLConstants$1.FUNC_ADD),equationAlpha:defaultValue(c.equationAlpha,WebGLConstants$1.FUNC_ADD),functionSourceRgb:defaultValue(c.functionSourceRgb,WebGLConstants$1.ONE),functionSourceAlpha:defaultValue(c.functionSourceAlpha,WebGLConstants$1.ONE),functionDestinationRgb:defaultValue(c.functionDestinationRgb,WebGLConstants$1.ZERO),functionDestinationAlpha:defaultValue(c.functionDestinationAlpha,WebGLConstants$1.ZERO)},this.stencilTest={enabled:defaultValue(d.enabled,!1),frontFunction:defaultValue(d.frontFunction,WebGLConstants$1.ALWAYS),backFunction:defaultValue(d.backFunction,WebGLConstants$1.ALWAYS),reference:defaultValue(d.reference,0),mask:defaultValue(d.mask,-1),frontOperation:{fail:defaultValue(h.fail,WebGLConstants$1.KEEP),zFail:defaultValue(h.zFail,WebGLConstants$1.KEEP),zPass:defaultValue(h.zPass,WebGLConstants$1.KEEP)},backOperation:{fail:defaultValue(p.fail,WebGLConstants$1.KEEP),zFail:defaultValue(p.zFail,WebGLConstants$1.KEEP),zPass:defaultValue(p.zPass,WebGLConstants$1.KEEP)}},this.sampleCoverage={enabled:defaultValue(f.enabled,!1),value:defaultValue(f.value,1),invert:defaultValue(f.invert,!1)},this.viewport=defined(m)?new BoundingRectangle(m.x,m.y,m.width,m.height):void 0,this.id=0,this._applyFunctions=[]}var nextRenderStateId=0,renderStateCache={};function enableOrDisable(e,t,i){i?e.enable(t):e.disable(t)}function applyFrontFace(e,t){e.frontFace(t.frontFace)}function applyCull(e,t){var i=t.cull,r=i.enabled;enableOrDisable(e,e.CULL_FACE,r),r&&e.cullFace(i.face)}function applyLineWidth(e,t){e.lineWidth(t.lineWidth)}function applyPolygonOffset(e,t){var i=t.polygonOffset,r=i.enabled;enableOrDisable(e,e.POLYGON_OFFSET_FILL,r),r&&e.polygonOffset(i.factor,i.units)}function applyScissorTest(e,t,i){var r=t.scissorTest,n=defined(i.scissorTest)?i.scissorTest.enabled:r.enabled;if(enableOrDisable(e,e.SCISSOR_TEST,n),n){var a=defined(i.scissorTest)?i.scissorTest.rectangle:r.rectangle;e.scissor(a.x,a.y,a.width,a.height)}}function applyDepthRange(e,t){var i=t.depthRange;e.depthRange(i.near,i.far)}function applyDepthTest(e,t){var i=t.depthTest,r=i.enabled;enableOrDisable(e,e.DEPTH_TEST,r),r&&e.depthFunc(i.func)}function applyColorMask(e,t){var i=t.colorMask;e.colorMask(i.red,i.green,i.blue,i.alpha)}function applyDepthMask(e,t){e.depthMask(t.depthMask)}function applyStencilMask(e,t){e.stencilMask(t.stencilMask)}function applyBlendingColor(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}function applyBlending(e,t,i){var r=t.blending,n=defined(i.blendingEnabled)?i.blendingEnabled:r.enabled;enableOrDisable(e,e.BLEND,n),n&&(applyBlendingColor(e,r.color),e.blendEquationSeparate(r.equationRgb,r.equationAlpha),e.blendFuncSeparate(r.functionSourceRgb,r.functionDestinationRgb,r.functionSourceAlpha,r.functionDestinationAlpha))}function applyStencilTest(e,t){var i=t.stencilTest,r=i.enabled;if(enableOrDisable(e,e.STENCIL_TEST,r),r){var n=i.frontFunction,a=i.backFunction,o=i.reference,s=i.mask;e.stencilFunc(n,o,s),e.stencilFuncSeparate(e.BACK,a,o,s),e.stencilFuncSeparate(e.FRONT,n,o,s);var l=i.frontOperation,c=l.fail,u=l.zFail,d=l.zPass;e.stencilOpSeparate(e.FRONT,c,u,d);var h=i.backOperation,p=h.fail,f=h.zFail,m=h.zPass;e.stencilOpSeparate(e.BACK,p,f,m)}}function applySampleCoverage(e,t){var i=t.sampleCoverage,r=i.enabled;enableOrDisable(e,e.SAMPLE_COVERAGE,r),r&&e.sampleCoverage(i.value,i.invert)}RenderState.fromCache=function(e){var t=JSON.stringify(e),i=renderStateCache[t];if(defined(i))return++i.referenceCount,i.state;var r=new RenderState(e),n=JSON.stringify(r);return defined(i=renderStateCache[n])||(r.id=nextRenderStateId++,i={referenceCount:0,state:r},renderStateCache[n]=i),++i.referenceCount,renderStateCache[t]={referenceCount:1,state:i.state},i.state},RenderState.removeFromCache=function(e){var t=new RenderState(e),i=JSON.stringify(t),r=renderStateCache[i],n=JSON.stringify(e),a=renderStateCache[n];defined(a)&&(--a.referenceCount,0===a.referenceCount&&(delete renderStateCache[n],defined(r)&&--r.referenceCount)),defined(r)&&0===r.referenceCount&&delete renderStateCache[i]},RenderState.getCache=function(){return renderStateCache},RenderState.clearCache=function(){renderStateCache={}};var scratchViewport$2=new BoundingRectangle;function applyViewport(e,t,i){var r=defaultValue(t.viewport,i.viewport);defined(r)||((r=scratchViewport$2).width=i.context.drawingBufferWidth,r.height=i.context.drawingBufferHeight),i.context.uniformState.viewport=r,e.viewport(r.x,r.y,r.width,r.height)}function createFuncs(e,t){var i=[];return e.frontFace!==t.frontFace&&i.push(applyFrontFace),e.cull.enabled===t.cull.enabled&&e.cull.face===t.cull.face||i.push(applyCull),e.lineWidth!==t.lineWidth&&i.push(applyLineWidth),e.polygonOffset.enabled===t.polygonOffset.enabled&&e.polygonOffset.factor===t.polygonOffset.factor&&e.polygonOffset.units===t.polygonOffset.units||i.push(applyPolygonOffset),e.depthRange.near===t.depthRange.near&&e.depthRange.far===t.depthRange.far||i.push(applyDepthRange),e.depthTest.enabled===t.depthTest.enabled&&e.depthTest.func===t.depthTest.func||i.push(applyDepthTest),e.colorMask.red===t.colorMask.red&&e.colorMask.green===t.colorMask.green&&e.colorMask.blue===t.colorMask.blue&&e.colorMask.alpha===t.colorMask.alpha||i.push(applyColorMask),e.depthMask!==t.depthMask&&i.push(applyDepthMask),e.stencilMask!==t.stencilMask&&i.push(applyStencilMask),e.stencilTest.enabled===t.stencilTest.enabled&&e.stencilTest.frontFunction===t.stencilTest.frontFunction&&e.stencilTest.backFunction===t.stencilTest.backFunction&&e.stencilTest.reference===t.stencilTest.reference&&e.stencilTest.mask===t.stencilTest.mask&&e.stencilTest.frontOperation.fail===t.stencilTest.frontOperation.fail&&e.stencilTest.frontOperation.zFail===t.stencilTest.frontOperation.zFail&&e.stencilTest.backOperation.fail===t.stencilTest.backOperation.fail&&e.stencilTest.backOperation.zFail===t.stencilTest.backOperation.zFail&&e.stencilTest.backOperation.zPass===t.stencilTest.backOperation.zPass||i.push(applyStencilTest),e.sampleCoverage.enabled===t.sampleCoverage.enabled&&e.sampleCoverage.value===t.sampleCoverage.value&&e.sampleCoverage.invert===t.sampleCoverage.invert||i.push(applySampleCoverage),i}RenderState.apply=function(e,t,i){applyFrontFace(e,t),applyCull(e,t),applyLineWidth(e,t),applyPolygonOffset(e,t),applyDepthRange(e,t),applyDepthTest(e,t),applyColorMask(e,t),applyDepthMask(e,t),applyStencilMask(e,t),applyStencilTest(e,t),applySampleCoverage(e,t),applyScissorTest(e,t,i),applyBlending(e,t,i),applyViewport(e,t,i)},RenderState.partialApply=function(e,t,i,r,n,a){if(t!==i){var o=i._applyFunctions[t.id];defined(o)||(o=createFuncs(t,i),i._applyFunctions[t.id]=o);for(var s=o.length,l=0;l<s;++l)o[l](e,i)}((defined(r.scissorTest)?r.scissorTest:t.scissorTest)!==(defined(n.scissorTest)?n.scissorTest:i.scissorTest)||a)&&applyScissorTest(e,i,n);var c=defined(r.blendingEnabled)?r.blendingEnabled:t.blending.enabled,u=defined(n.blendingEnabled)?n.blendingEnabled:i.blending.enabled;(c!==u||u&&t.blending!==i.blending)&&applyBlending(e,i,n),t===i&&r===n&&r.context===n.context||applyViewport(e,i,n)},RenderState.getState=function(e){return{frontFace:e.frontFace,cull:{enabled:e.cull.enabled,face:e.cull.face},lineWidth:e.lineWidth,polygonOffset:{enabled:e.polygonOffset.enabled,factor:e.polygonOffset.factor,units:e.polygonOffset.units},scissorTest:{enabled:e.scissorTest.enabled,rectangle:BoundingRectangle.clone(e.scissorTest.rectangle)},depthRange:{near:e.depthRange.near,far:e.depthRange.far},depthTest:{enabled:e.depthTest.enabled,func:e.depthTest.func},colorMask:{red:e.colorMask.red,green:e.colorMask.green,blue:e.colorMask.blue,alpha:e.colorMask.alpha},depthMask:e.depthMask,stencilMask:e.stencilMask,blending:{enabled:e.blending.enabled,color:Color.clone(e.blending.color),equationRgb:e.blending.equationRgb,equationAlpha:e.blending.equationAlpha,functionSourceRgb:e.blending.functionSourceRgb,functionSourceAlpha:e.blending.functionSourceAlpha,functionDestinationRgb:e.blending.functionDestinationRgb,functionDestinationAlpha:e.blending.functionDestinationAlpha},stencilTest:{enabled:e.stencilTest.enabled,frontFunction:e.stencilTest.frontFunction,backFunction:e.stencilTest.backFunction,reference:e.stencilTest.reference,mask:e.stencilTest.mask,frontOperation:{fail:e.stencilTest.frontOperation.fail,zFail:e.stencilTest.frontOperation.zFail,zPass:e.stencilTest.frontOperation.zPass},backOperation:{fail:e.stencilTest.backOperation.fail,zFail:e.stencilTest.backOperation.zFail,zPass:e.stencilTest.backOperation.zPass}},sampleCoverage:{enabled:e.sampleCoverage.enabled,value:e.sampleCoverage.value,invert:e.sampleCoverage.invert},viewport:defined(e.viewport)?BoundingRectangle.clone(e.viewport):void 0}};var viewerPositionWCScratch=new Cartesian3;function AutomaticUniform(e){this._size=e.size,this._datatype=e.datatype,this.getValue=e.getValue}var datatypeToGlsl={};datatypeToGlsl[WebGLConstants$1.FLOAT]="float",datatypeToGlsl[WebGLConstants$1.FLOAT_VEC2]="vec2",datatypeToGlsl[WebGLConstants$1.FLOAT_VEC3]="vec3",datatypeToGlsl[WebGLConstants$1.FLOAT_VEC4]="vec4",datatypeToGlsl[WebGLConstants$1.INT]="int",datatypeToGlsl[WebGLConstants$1.INT_VEC2]="ivec2",datatypeToGlsl[WebGLConstants$1.INT_VEC3]="ivec3",datatypeToGlsl[WebGLConstants$1.INT_VEC4]="ivec4",datatypeToGlsl[WebGLConstants$1.BOOL]="bool",datatypeToGlsl[WebGLConstants$1.BOOL_VEC2]="bvec2",datatypeToGlsl[WebGLConstants$1.BOOL_VEC3]="bvec3",datatypeToGlsl[WebGLConstants$1.BOOL_VEC4]="bvec4",datatypeToGlsl[WebGLConstants$1.FLOAT_MAT2]="mat2",datatypeToGlsl[WebGLConstants$1.FLOAT_MAT3]="mat3",datatypeToGlsl[WebGLConstants$1.FLOAT_MAT4]="mat4",datatypeToGlsl[WebGLConstants$1.SAMPLER_2D]="sampler2D",datatypeToGlsl[WebGLConstants$1.SAMPLER_CUBE]="samplerCube",AutomaticUniform.prototype.getDeclaration=function(e){var t="uniform "+datatypeToGlsl[this._datatype]+" "+e,i=this._size;return t+=1===i?";":"["+i.toString()+"];"};var AutomaticUniforms={czm_viewport:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.viewportCartesian4}}),czm_viewportOrthographic:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.viewportOrthographic}}),czm_viewportTransformation:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.viewportTransformation}}),czm_globeDepthTexture:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e.globeDepthTexture}}),czm_model:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.model}}),czm_inverseModel:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModel}}),czm_view:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.view}}),czm_view3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.view3D}}),czm_viewRotation:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.viewRotation}}),czm_viewRotation3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.viewRotation3D}}),czm_inverseView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseView}}),czm_inverseView3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseView3D}}),czm_inverseViewRotation:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation}}),czm_inverseViewRotation3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation3D}}),czm_projection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.projection}}),czm_inverseProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseProjection}}),czm_infiniteProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.infiniteProjection}}),czm_modelView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelView}}),czm_modelView3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelView3D}}),czm_modelViewRelativeToEye:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewRelativeToEye}}),czm_inverseModelView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModelView}}),czm_inverseModelView3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModelView3D}}),czm_viewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.viewProjection}}),czm_inverseViewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseViewProjection}}),czm_modelViewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewProjection}}),czm_inverseModelViewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModelViewProjection}}),czm_modelViewProjectionRelativeToEye:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewProjectionRelativeToEye}}),czm_modelViewInfiniteProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewInfiniteProjection}}),czm_orthographicIn3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.orthographicIn3D?1:0}}),czm_normal:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.normal}}),czm_normal3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.normal3D}}),czm_inverseNormal:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseNormal}}),czm_inverseNormal3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseNormal3D}}),czm_eyeHeight:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.eyeHeight}}),czm_eyeHeight2D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.eyeHeight2D}}),czm_entireFrustum:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.entireFrustum}}),czm_currentFrustum:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.currentFrustum}}),czm_frustumPlanes:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.frustumPlanes}}),czm_farDepthFromNearPlusOne:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.farDepthFromNearPlusOne}}),czm_log2FarDepthFromNearPlusOne:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.log2FarDepthFromNearPlusOne}}),czm_oneOverLog2FarDepthFromNearPlusOne:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.oneOverLog2FarDepthFromNearPlusOne}}),czm_sunPositionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunPositionWC}}),czm_sunPositionColumbusView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunPositionColumbusView}}),czm_sunDirectionEC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunDirectionEC}}),czm_sunDirectionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunDirectionWC}}),czm_moonDirectionEC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.moonDirectionEC}}),czm_lightDirectionEC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.lightDirectionEC}}),czm_lightDirectionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.lightDirectionWC}}),czm_lightColor:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.lightColor}}),czm_lightColorHdr:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.lightColorHdr}}),czm_encodedCameraPositionMCHigh:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCHigh}}),czm_encodedCameraPositionMCLow:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCLow}}),czm_viewerPositionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return Matrix4.getTranslation(e.inverseView,viewerPositionWCScratch)}}),czm_frameNumber:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.frameState.frameNumber}}),czm_morphTime:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.frameState.morphTime}}),czm_sceneMode:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.frameState.mode}}),czm_pass:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.pass}}),czm_backgroundColor:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.backgroundColor}}),czm_brdfLut:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e.brdfLut}}),czm_environmentMap:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_CUBE,getValue:function(e){return e.environmentMap}}),czm_specularEnvironmentMaps:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e.specularEnvironmentMaps}}),czm_specularEnvironmentMapSize:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.specularEnvironmentMapsDimensions}}),czm_specularEnvironmentMapsMaximumLOD:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.specularEnvironmentMapsMaximumLOD}}),czm_sphericalHarmonicCoefficients:new AutomaticUniform({size:9,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sphericalHarmonicCoefficients}}),czm_temeToPseudoFixed:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.temeToPseudoFixedMatrix}}),czm_pixelRatio:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.pixelRatio}}),czm_fogDensity:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.fogDensity}}),czm_imagerySplitPosition:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.imagerySplitPosition}}),czm_geometricToleranceOverMeter:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.geometricToleranceOverMeter}}),czm_minimumDisableDepthTestDistance:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.minimumDisableDepthTestDistance}}),czm_invertClassificationColor:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.invertClassificationColor}}),czm_gamma:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.gamma}}),czm_ellipsoidRadii:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.radii}}),czm_ellipsoidInverseRadii:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.oneOverRadii}})};function createUniform(e,t,i,r){switch(t.type){case e.FLOAT:return new UniformFloat(e,t,i,r);case e.FLOAT_VEC2:return new UniformFloatVec2(e,t,i,r);case e.FLOAT_VEC3:return new UniformFloatVec3(e,t,i,r);case e.FLOAT_VEC4:return new UniformFloatVec4(e,t,i,r);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new UniformSampler(e,t,i,r);case e.INT:case e.BOOL:return new UniformInt(e,t,i,r);case e.INT_VEC2:case e.BOOL_VEC2:return new UniformIntVec2(e,t,i,r);case e.INT_VEC3:case e.BOOL_VEC3:return new UniformIntVec3(e,t,i,r);case e.INT_VEC4:case e.BOOL_VEC4:return new UniformIntVec4(e,t,i,r);case e.FLOAT_MAT2:return new UniformMat2(e,t,i,r);case e.FLOAT_MAT3:return new UniformMat3(e,t,i,r);case e.FLOAT_MAT4:return new UniformMat4(e,t,i,r);default:throw new RuntimeError("Unrecognized uniform type: "+t.type+' for uniform "'+i+'".')}}function UniformFloat(e,t,i,r){this.name=i,this.value=void 0,this._value=0,this._gl=e,this._location=r}function UniformFloatVec2(e,t,i,r){this.name=i,this.value=void 0,this._value=new Cartesian2,this._gl=e,this._location=r}function UniformFloatVec3(e,t,i,r){this.name=i,this.value=void 0,this._value=void 0,this._gl=e,this._location=r}function UniformFloatVec4(e,t,i,r){this.name=i,this.value=void 0,this._value=void 0,this._gl=e,this._location=r}function UniformSampler(e,t,i,r){this.name=i,this.value=void 0,this._gl=e,this._location=r,this.textureUnitIndex=void 0}function UniformInt(e,t,i,r){this.name=i,this.value=void 0,this._value=0,this._gl=e,this._location=r}function UniformIntVec2(e,t,i,r){this.name=i,this.value=void 0,this._value=new Cartesian2,this._gl=e,this._location=r}function UniformIntVec3(e,t,i,r){this.name=i,this.value=void 0,this._value=new Cartesian3,this._gl=e,this._location=r}function UniformIntVec4(e,t,i,r){this.name=i,this.value=void 0,this._value=new Cartesian4,this._gl=e,this._location=r}UniformFloat.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))},UniformFloatVec2.prototype.set=function(){var e=this.value;Cartesian2.equals(e,this._value)||(Cartesian2.clone(e,this._value),this._gl.uniform2f(this._location,e.x,e.y))},UniformFloatVec3.prototype.set=function(){var e=this.value;defined(e.red)?Color.equals(e,this._value)||(this._value=Color.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue)):defined(e.x)&&(Cartesian3.equals(e,this._value)||(this._value=Cartesian3.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z)))},UniformFloatVec4.prototype.set=function(){var e=this.value;defined(e.red)?Color.equals(e,this._value)||(this._value=Color.clone(e,this._value),this._gl.uniform4f(this._location,e.red,e.green,e.blue,e.alpha)):defined(e.x)&&(Cartesian4.equals(e,this._value)||(this._value=Cartesian4.clone(e,this._value),this._gl.uniform4f(this._location,e.x,e.y,e.z,e.w)))},UniformSampler.prototype.set=function(){var e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);var t=this.value;e.bindTexture(t._target,t._texture)},UniformSampler.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1},UniformInt.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))},UniformIntVec2.prototype.set=function(){var e=this.value;Cartesian2.equals(e,this._value)||(Cartesian2.clone(e,this._value),this._gl.uniform2i(this._location,e.x,e.y))},UniformIntVec3.prototype.set=function(){var e=this.value;Cartesian3.equals(e,this._value)||(Cartesian3.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))},UniformIntVec4.prototype.set=function(){var e=this.value;Cartesian4.equals(e,this._value)||(Cartesian4.clone(e,this._value),this._gl.uniform4i(this._location,e.x,e.y,e.z,e.w))};var scratchUniformArray$1=new Float32Array(4);function UniformMat2(e,t,i,r){this.name=i,this.value=void 0,this._value=new Matrix2,this._gl=e,this._location=r}UniformMat2.prototype.set=function(){if(!Matrix2.equalsArray(this.value,this._value,0)){Matrix2.clone(this.value,this._value);var e=Matrix2.toArray(this.value,scratchUniformArray$1);this._gl.uniformMatrix2fv(this._location,!1,e)}};var scratchMat3Array=new Float32Array(9);function UniformMat3(e,t,i,r){this.name=i,this.value=void 0,this._value=new Matrix3,this._gl=e,this._location=r}UniformMat3.prototype.set=function(){if(!Matrix3.equalsArray(this.value,this._value,0)){Matrix3.clone(this.value,this._value);var e=Matrix3.toArray(this.value,scratchMat3Array);this._gl.uniformMatrix3fv(this._location,!1,e)}};var scratchMat4Array=new Float32Array(16);function UniformMat4(e,t,i,r){this.name=i,this.value=void 0,this._value=new Matrix4,this._gl=e,this._location=r}function createUniformArray(e,t,i,r){switch(t.type){case e.FLOAT:return new UniformArrayFloat(e,t,i,r);case e.FLOAT_VEC2:return new UniformArrayFloatVec2(e,t,i,r);case e.FLOAT_VEC3:return new UniformArrayFloatVec3(e,t,i,r);case e.FLOAT_VEC4:return new UniformArrayFloatVec4(e,t,i,r);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new UniformArraySampler(e,t,i,r);case e.INT:case e.BOOL:return new UniformArrayInt(e,t,i,r);case e.INT_VEC2:case e.BOOL_VEC2:return new UniformArrayIntVec2(e,t,i,r);case e.INT_VEC3:case e.BOOL_VEC3:return new UniformArrayIntVec3(e,t,i,r);case e.INT_VEC4:case e.BOOL_VEC4:return new UniformArrayIntVec4(e,t,i,r);case e.FLOAT_MAT2:return new UniformArrayMat2(e,t,i,r);case e.FLOAT_MAT3:return new UniformArrayMat3(e,t,i,r);case e.FLOAT_MAT4:return new UniformArrayMat4(e,t,i,r);default:throw new RuntimeError("Unrecognized uniform type: "+t.type+' for uniform "'+i+'".')}}function UniformArrayFloat(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(n),this._gl=e,this._location=r[0]}function UniformArrayFloatVec2(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(2*n),this._gl=e,this._location=r[0]}function UniformArrayFloatVec3(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(3*n),this._gl=e,this._location=r[0]}function UniformArrayFloatVec4(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(4*n),this._gl=e,this._location=r[0]}function UniformArraySampler(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(n),this._gl=e,this._locations=r,this.textureUnitIndex=void 0}function UniformArrayInt(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Int32Array(n),this._gl=e,this._location=r[0]}function UniformArrayIntVec2(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Int32Array(2*n),this._gl=e,this._location=r[0]}function UniformArrayIntVec3(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Int32Array(3*n),this._gl=e,this._location=r[0]}function UniformArrayIntVec4(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Int32Array(4*n),this._gl=e,this._location=r[0]}function UniformArrayMat2(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(4*n),this._gl=e,this._location=r[0]}function UniformArrayMat3(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(9*n),this._gl=e,this._location=r[0]}function UniformArrayMat4(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(16*n),this._gl=e,this._location=r[0]}UniformMat4.prototype.set=function(){if(!Matrix4.equalsArray(this.value,this._value,0)){Matrix4.clone(this.value,this._value);var e=Matrix4.toArray(this.value,scratchMat4Array);this._gl.uniformMatrix4fv(this._location,!1,e)}},UniformArrayFloat.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0;n<t;++n){var a=e[n];a!==i[n]&&(i[n]=a,r=!0)}r&&this._gl.uniform1fv(this._location,i)},UniformArrayFloatVec2.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Cartesian2.equalsArray(o,i,n)||(Cartesian2.pack(o,i,n),r=!0),n+=2}r&&this._gl.uniform2fv(this._location,i)},UniformArrayFloatVec3.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];defined(o.red)?o.red===i[n]&&o.green===i[n+1]&&o.blue===i[n+2]||(i[n]=o.red,i[n+1]=o.green,i[n+2]=o.blue,r=!0):defined(o.x)&&(Cartesian3.equalsArray(o,i,n)||(Cartesian3.pack(o,i,n),r=!0)),n+=3}r&&this._gl.uniform3fv(this._location,i)},UniformArrayFloatVec4.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];defined(o.red)?Color.equalsArray(o,i,n)||(Color.pack(o,i,n),r=!0):defined(o.x)&&(Cartesian4.equalsArray(o,i,n)||(Cartesian4.pack(o,i,n),r=!0)),n+=4}r&&this._gl.uniform4fv(this._location,i)},UniformArraySampler.prototype.set=function(){for(var e=this._gl,t=e.TEXTURE0+this.textureUnitIndex,i=this.value,r=i.length,n=0;n<r;++n){var a=i[n];e.activeTexture(t+n),e.bindTexture(a._target,a._texture)}},UniformArraySampler.prototype._setSampler=function(e){this.textureUnitIndex=e;for(var t=this._locations,i=t.length,r=0;r<i;++r){var n=e+r;this._gl.uniform1i(t[r],n)}return e+i},UniformArrayInt.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0;n<t;++n){var a=e[n];a!==i[n]&&(i[n]=a,r=!0)}r&&this._gl.uniform1iv(this._location,i)},UniformArrayIntVec2.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Cartesian2.equalsArray(o,i,n)||(Cartesian2.pack(o,i,n),r=!0),n+=2}r&&this._gl.uniform2iv(this._location,i)},UniformArrayIntVec3.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Cartesian3.equalsArray(o,i,n)||(Cartesian3.pack(o,i,n),r=!0),n+=3}r&&this._gl.uniform3iv(this._location,i)},UniformArrayIntVec4.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Cartesian4.equalsArray(o,i,n)||(Cartesian4.pack(o,i,n),r=!0),n+=4}r&&this._gl.uniform4iv(this._location,i)},UniformArrayMat2.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Matrix2.equalsArray(o,i,n)||(Matrix2.pack(o,i,n),r=!0),n+=4}r&&this._gl.uniformMatrix2fv(this._location,!1,i)},UniformArrayMat3.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Matrix3.equalsArray(o,i,n)||(Matrix3.pack(o,i,n),r=!0),n+=9}r&&this._gl.uniformMatrix3fv(this._location,!1,i)},UniformArrayMat4.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Matrix4.equalsArray(o,i,n)||(Matrix4.pack(o,i,n),r=!0),n+=16}r&&this._gl.uniformMatrix4fv(this._location,!1,i)};var nextShaderProgramId=0;function ShaderProgram(e){var t=e.vertexShaderText,i=e.fragmentShaderText;"undefined"!=typeof spector&&(t=t.replace(/^#line/gm,"//#line"),i=i.replace(/^#line/gm,"//#line"));var r=handleUniformPrecisionMismatches(t,i);this._gl=e.gl,this._logShaderCompilation=e.logShaderCompilation,this._debugShaders=e.debugShaders,this._attributeLocations=e.attributeLocations,this._program=void 0,this._numberOfVertexAttributes=void 0,this._vertexAttributes=void 0,this._uniformsByName=void 0,this._uniforms=void 0,this._automaticUniforms=void 0,this._manualUniforms=void 0,this._duplicateUniformNames=r.duplicateUniformNames,this._cachedShader=void 0,this.maximumTextureUnitIndex=void 0,this._vertexShaderSource=e.vertexShaderSource,this._vertexShaderText=e.vertexShaderText,this._fragmentShaderSource=e.fragmentShaderSource,this._fragmentShaderText=r.fragmentShaderText,this.id=nextShaderProgramId++}function extractUniforms(e){var t=[],i=e.match(/uniform.*?(?![^{]*})(?=[=\[;])/g);if(defined(i))for(var r=i.length,n=0;n<r;n++){var a=i[n].trim(),o=a.slice(a.lastIndexOf(" ")+1);t.push(o)}return t}function handleUniformPrecisionMismatches(e,t){var i={};if(!ContextLimits.highpFloatSupported||!ContextLimits.highpIntSupported){var r,n,a,o,s=extractUniforms(e),l=extractUniforms(t),c=s.length,u=l.length;for(r=0;r<c;r++)for(n=0;n<u;n++)if(s[r]===l[n]){o="czm_mediump_"+(a=s[r]);var d=new RegExp(a+"\\b","g");t=t.replace(d,o),i[o]=a}}return{fragmentShaderText:t,duplicateUniformNames:i}}ShaderProgram.fromCache=function(e){return(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context.shaderCache.getShaderProgram(e)},ShaderProgram.replaceCache=function(e){return(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context.shaderCache.replaceShaderProgram(e)},Object.defineProperties(ShaderProgram.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return initialize$g(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return initialize$g(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return initialize$g(this),this._uniformsByName}}});var consolePrefix="[Cesium WebGL] ";function createAndLinkProgram(e,t){var i=t._vertexShaderText,r=t._fragmentShaderText,n=e.createShader(e.VERTEX_SHADER);e.shaderSource(n,i),e.compileShader(n);var a=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(a,r),e.compileShader(a);var o=e.createProgram();e.attachShader(o,n),e.attachShader(o,a),e.deleteShader(n),e.deleteShader(a);var s,l=t._attributeLocations;if(defined(l))for(var c in l)l.hasOwnProperty(c)&&e.bindAttribLocation(o,l[c],c);if(e.linkProgram(o),!e.getProgramParameter(o,e.LINK_STATUS)){var u=t._debugShaders;if(!e.getShaderParameter(a,e.COMPILE_STATUS)){if(s=e.getShaderInfoLog(a),console.error(consolePrefix+"Fragment shader compile log: "+s),defined(u)){var d=u.getTranslatedShaderSource(a);""!==d?console.error(consolePrefix+"Translated fragment shader source:\n"+d):console.error(consolePrefix+"Fragment shader translation failed.")}throw e.deleteProgram(o),new RuntimeError("Fragment shader failed to compile. Compile log: "+s)}if(!e.getShaderParameter(n,e.COMPILE_STATUS)){if(s=e.getShaderInfoLog(n),console.error(consolePrefix+"Vertex shader compile log: "+s),defined(u)){var h=u.getTranslatedShaderSource(n);""!==h?console.error(consolePrefix+"Translated vertex shader source:\n"+h):console.error(consolePrefix+"Vertex shader translation failed.")}throw e.deleteProgram(o),new RuntimeError("Vertex shader failed to compile. Compile log: "+s)}throw s=e.getProgramInfoLog(o),console.error(consolePrefix+"Shader program link log: "+s),defined(u)&&(console.error(consolePrefix+"Translated vertex shader source:\n"+u.getTranslatedShaderSource(n)),console.error(consolePrefix+"Translated fragment shader source:\n"+u.getTranslatedShaderSource(a))),e.deleteProgram(o),new RuntimeError("Program failed to link. Link log: "+s)}var p=t._logShaderCompilation;return p&&defined(s=e.getShaderInfoLog(n))&&s.length>0&&console.log(consolePrefix+"Vertex shader compile log: "+s),p&&defined(s=e.getShaderInfoLog(a))&&s.length>0&&console.log(consolePrefix+"Fragment shader compile log: "+s),p&&defined(s=e.getProgramInfoLog(o))&&s.length>0&&console.log(consolePrefix+"Shader program link log: "+s),o}function findVertexAttributes(e,t,i){for(var r={},n=0;n<i;++n){var a=e.getActiveAttrib(t,n),o=e.getAttribLocation(t,a.name);r[a.name]={name:a.name,type:a.type,index:o}}return r}function findUniforms(e,t){for(var i={},r=[],n=[],a=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),o=0;o<a;++o){var s=e.getActiveUniform(t,o),l=-1!==s.name.indexOf("[0]",s.name.length-"[0]".length)?s.name.slice(0,s.name.length-3):s.name;if(0!==l.indexOf("gl_"))if(s.name.indexOf("[")<0){var c=e.getUniformLocation(t,l);if(null!==c){var u=createUniform(e,s,l,c);i[l]=u,r.push(u),u._setSampler&&n.push(u)}}else{var d,h,p,f,m=l.indexOf("[");if(m>=0){if(!defined(d=i[l.slice(0,m)]))continue;(h=d._locations).length<=1&&(p=d.value,null!==(f=e.getUniformLocation(t,l))&&(h.push(f),p.push(e.getUniform(t,f))))}else{h=[];for(var g=0;g<s.size;++g)null!==(f=e.getUniformLocation(t,l+"["+g+"]"))&&h.push(f);d=createUniformArray(e,s,l,h),i[l]=d,r.push(d),d._setSampler&&n.push(d)}}}return{uniformsByName:i,uniforms:r,samplerUniforms:n}}function partitionUniforms(e,t){var i=[],r=[];for(var n in t)if(t.hasOwnProperty(n)){var a=t[n],o=n,s=e._duplicateUniformNames[o];defined(s)&&(a.name=s,o=s);var l=AutomaticUniforms[o];defined(l)?i.push({uniform:a,automaticUniform:l}):r.push(a)}return{automaticUniforms:i,manualUniforms:r}}function setSamplerUniforms(e,t,i){e.useProgram(t);for(var r=0,n=i.length,a=0;a<n;++a)r=i[a]._setSampler(r);return e.useProgram(null),r}function initialize$g(e){defined(e._program)||reinitialize(e)}function reinitialize(e){var t=e._program,i=e._gl,r=createAndLinkProgram(i,e,e._debugShaders),n=i.getProgramParameter(r,i.ACTIVE_ATTRIBUTES),a=findUniforms(i,r),o=partitionUniforms(e,a.uniformsByName);e._program=r,e._numberOfVertexAttributes=n,e._vertexAttributes=findVertexAttributes(i,r,n),e._uniformsByName=a.uniformsByName,e._uniforms=a.uniforms,e._automaticUniforms=o.automaticUniforms,e._manualUniforms=o.manualUniforms,e.maximumTextureUnitIndex=setSamplerUniforms(i,r,a.samplerUniforms),t&&e._gl.deleteProgram(t),"undefined"!=typeof spector&&(e._program.__SPECTOR_rebuildProgram=function(t,i,r,n){var a=e._vertexShaderText,o=e._fragmentShaderText,s=/ ! = /g;e._vertexShaderText=t.replace(s," != "),e._fragmentShaderText=i.replace(s," != ");try{reinitialize(e),r(e._program)}catch(t){e._vertexShaderText=a,e._fragmentShaderText=o;var l=/(?:Compile|Link) error: ([^]*)/.exec(t.message);n(l?l[1]:t.message)}})}function modernizeShader(e,t){var i=/#define OUTPUT_DECLARATION/,r=e.split("\n");if(/#version 300 es/g.test(e))return e;var n,a,o=-1;for(n=0;n<r.length;++n)if(a=r[n],i.test(a)){o=n;break}if(-1===o)throw new DeveloperError("Could not find a #define OUTPUT_DECLARATION!");var s=[];for(n=0;n<10;n++){var l="gl_FragData\\["+n+"\\]",c="czm_out"+n;new RegExp(l,"g").test(e)&&(setAdd(c,s),replaceInSourceString(l,c,r),r.splice(o,0,"layout(location = "+n+") out vec4 "+c+";"),o+=1)}var u="czm_fragColor";findInSource("gl_FragColor",r)&&(setAdd(u,s),replaceInSourceString("gl_FragColor",u,r),r.splice(o,0,"layout(location = 0) out vec4 czm_fragColor;"),o+=1);var d=getVariablePreprocessorBranch(s,r),h={};for(n=0;n<r.length;n++)for(var p in a=r[n],d){if(d.hasOwnProperty(p))new RegExp("(layout)[^]+(out)[^]+("+p+")[^]+","g").test(a)&&(h[a]=p)}for(var f in h)if(h.hasOwnProperty(f)){var m,g=h[f],_=r.indexOf(f),y=d[g],v=y.length;for(m=0;m<v;m++)r.splice(_,0,y[m]);for(_+=v+1,m=v-1;m>=0;m--)r.splice(_,0,"#endif //"+y[m])}var C="WEBGL_2",T="#version 300 es",S=!1;for(n=0;n<r.length;n++)if(/#version/.test(r[n])){r[n]=T,S=!0;break}return S||r.splice(0,0,T),r.splice(1,0,"#define WEBGL_2"),removeExtension("EXT_draw_buffers",C,r),removeExtension("EXT_frag_depth",C,r),removeExtension("OES_standard_derivatives",C,r),replaceInSourceString("texture2D","texture",r),replaceInSourceString("texture3D","texture",r),replaceInSourceString("textureCube","texture",r),replaceInSourceString("gl_FragDepthEXT","gl_FragDepth",r),t?replaceInSourceString("varying","in",r):(replaceInSourceString("attribute","in",r),replaceInSourceString("varying","out",r)),compileSource(r)}function replaceInSourceString(e,t,i){for(var r=new RegExp("(^|[^\\w])("+e+")($|[^\\w])","g"),n=i.length,a=0;a<n;++a){var o=i[a];i[a]=o.replace(r,"$1"+t+"$3")}}function replaceInSourceRegex(e,t,i){for(var r=i.length,n=0;n<r;++n){var a=i[n];i[n]=a.replace(e,t)}}function findInSource(e,t){for(var i=new RegExp("(^|[^\\w])("+e+")($|[^\\w])","g"),r=t.length,n=0;n<r;++n){var a=t[n];if(i.test(a))return!0}return!1}function compileSource(e){for(var t="",i=e.length,r=0;r<i;++r)t+=e[r]+"\n";return t}function setAdd(e,t){-1===t.indexOf(e)&&t.push(e)}function getVariablePreprocessorBranch(e,t){for(var i={},r=e.length,n=[],a=0;a<t.length;++a){var o=t[a],s=/(#ifdef|#if)/g.test(o),l=/#else/g.test(o),c=/#endif/g.test(o);if(s)n.push(o);else if(l){var u=n[n.length-1].replace("ifdef","ifndef");/if/g.test(u)&&(u=u.replace(/(#if\s+)(\S*)([^]*)/,"$1!($2)$3")),n.pop(),n.push(u)}else if(c)n.pop();else if(!/layout/g.test(o))for(var d=0;d<r;++d){var h=e[d];-1!==o.indexOf(h)&&(defined(i[h])?i[h]=i[h].filter((function(e){return n.indexOf(e)>=0})):i[h]=n.slice())}}return i}function removeExtension(e,t,i){replaceInSourceRegex(new RegExp("#extension\\s+GL_"+e+"\\s+:\\s+[a-zA-Z0-9]+\\s*$","g"),"",i),replaceInSourceString("GL_"+e,t,i)}ShaderProgram.prototype._bind=function(){initialize$g(this),this._gl.useProgram(this._program)},ShaderProgram.prototype._setUniforms=function(e,t,i){var r,n;if(defined(e)){var a=this._manualUniforms;for(r=a.length,n=0;n<r;++n){var o=a[n];o.value=e[o.name]()}}var s=this._automaticUniforms;for(r=s.length,n=0;n<r;++n){var l=s[n];l.uniform.value=l.automaticUniform.getValue(t)}var c=this._uniforms;for(r=c.length,n=0;n<r;++n)c[n].set();if(i){var u=this._gl,d=this._program;u.validateProgram(d)}},ShaderProgram.prototype.isDestroyed=function(){return!1},ShaderProgram.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)},ShaderProgram.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),destroyObject(this)};var czm_degreesPerRadian="const float czm_degreesPerRadian = 57.29577951308232;\n",czm_depthRange="const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);\n",czm_epsilon1="const float czm_epsilon1 = 0.1;\n",czm_epsilon2="const float czm_epsilon2 = 0.01;\n",czm_epsilon3="const float czm_epsilon3 = 0.001;\n",czm_epsilon4="const float czm_epsilon4 = 0.0001;\n",czm_epsilon5="const float czm_epsilon5 = 0.00001;\n",czm_epsilon6="const float czm_epsilon6 = 0.000001;\n",czm_epsilon7="const float czm_epsilon7 = 0.0000001;\n",czm_infinity="const float czm_infinity = 5906376272000.0;\n",czm_oneOverPi="const float czm_oneOverPi = 0.3183098861837907;\n",czm_oneOverTwoPi="const float czm_oneOverTwoPi = 0.15915494309189535;\n",czm_passCesium3DTile="const float czm_passCesium3DTile = 4.0;\n",czm_passCesium3DTileClassification="const float czm_passCesium3DTileClassification = 5.0;\n",czm_passCesium3DTileClassificationIgnoreShow="const float czm_passCesium3DTileClassificationIgnoreShow = 6.0;\n",czm_passClassification="const float czm_passClassification = 7.0;\n",czm_passCompute="const float czm_passCompute = 1.0;\n",czm_passEnvironment="const float czm_passEnvironment = 0.0;\n",czm_passGlobe="const float czm_passGlobe = 2.0;\n",czm_passOpaque="const float czm_passOpaque = 7.0;\n",czm_passOverlay="const float czm_passOverlay = 9.0;\n",czm_passTerrainClassification="const float czm_passTerrainClassification = 3.0;\n",czm_passTranslucent="const float czm_passTranslucent = 8.0;\n",czm_pi="const float czm_pi = 3.141592653589793;\n",czm_piOverFour="const float czm_piOverFour = 0.7853981633974483;\n",czm_piOverSix="const float czm_piOverSix = 0.5235987755982988;\n",czm_piOverThree="const float czm_piOverThree = 1.0471975511965976;\n",czm_piOverTwo="const float czm_piOverTwo = 1.5707963267948966;\n",czm_radiansPerDegree="const float czm_radiansPerDegree = 0.017453292519943295;\n",czm_sceneMode2D="const float czm_sceneMode2D = 2.0;\n",czm_sceneMode3D="const float czm_sceneMode3D = 3.0;\n",czm_sceneModeColumbusView="const float czm_sceneModeColumbusView = 1.0;\n",czm_sceneModeMorphing="const float czm_sceneModeMorphing = 0.0;\n",czm_solarRadius="const float czm_solarRadius = 695500000.0;\n",czm_threePiOver2="const float czm_threePiOver2 = 4.71238898038469;\n",czm_twoPi="const float czm_twoPi = 6.283185307179586;\n",czm_webMercatorMaxLatitude="const float czm_webMercatorMaxLatitude = 1.4844222297453324;\n",czm_depthRangeStruct="struct czm_depthRangeStruct\n{\nfloat near;\nfloat far;\n};\n",czm_ellipsoid="struct czm_ellipsoid\n{\nvec3 center;\nvec3 radii;\nvec3 inverseRadii;\nvec3 inverseRadiiSquared;\n};\n",czm_material="struct czm_material\n{\nvec3 diffuse;\nfloat specular;\nfloat shininess;\nvec3 normal;\nvec3 emission;\nfloat alpha;\n};\n",czm_materialInput="struct czm_materialInput\n{\nfloat s;\nvec2 st;\nvec3 str;\nvec3 normalEC;\nmat3 tangentToEyeMatrix;\nvec3 positionToEyeEC;\nfloat height;\nfloat slope;\nfloat aspect;\n};\n",czm_modelMaterial="struct czm_modelMaterial {\nvec3 diffuse;\nfloat alpha;\nvec3 specular;\nfloat roughness;\nvec3 normalEC;\nfloat occlusion;\nvec3 emissive;\n};\n",czm_modelVertexOutput="struct czm_modelVertexOutput {\nvec3 positionMC;\nfloat pointSize;\n};\n",czm_pbrParameters="struct czm_pbrParameters\n{\nvec3 diffuseColor;\nfloat roughness;\nvec3 f0;\n};\n",czm_ray="struct czm_ray\n{\nvec3 origin;\nvec3 direction;\n};\n",czm_raySegment="struct czm_raySegment\n{\nfloat start;\nfloat stop;\n};\nconst czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);\nconst czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);\n",czm_shadowParameters="struct czm_shadowParameters\n{\n#ifdef USE_CUBE_MAP_SHADOW\nvec3 texCoords;\n#else\nvec2 texCoords;\n#endif\nfloat depthBias;\nfloat depth;\nfloat nDotL;\nvec2 texelStepSize;\nfloat normalShadingSmooth;\nfloat darkness;\n};\n",czm_acesTonemapping="vec3 czm_acesTonemapping(vec3 color) {\nfloat g = 0.985;\nfloat a = 0.065;\nfloat b = 0.0001;\nfloat c = 0.433;\nfloat d = 0.238;\ncolor = (color * (color + a) - b) / (color * (g * color + c) + d);\ncolor = clamp(color, 0.0, 1.0);\nreturn color;\n}\n",czm_alphaWeight="float czm_alphaWeight(float a)\n{\nfloat z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\nreturn pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0))));\n}\n",czm_antialias="vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)\n{\nfloat val1 = clamp(dist / fuzzFactor, 0.0, 1.0);\nfloat val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);\nval1 = val1 * (1.0 - val2);\nval1 = val1 * val1 * (3.0 - (2.0 * val1));\nval1 = pow(val1, 0.5);\nvec4 midColor = (color1 + color2) * 0.5;\nreturn mix(midColor, currentColor, val1);\n}\nvec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)\n{\nreturn czm_antialias(color1, color2, currentColor, dist, 0.1);\n}\n",czm_approximateSphericalCoordinates="vec2 czm_approximateSphericalCoordinates(vec3 normal) {\nfloat latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z);\nfloat longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y);\nreturn vec2(latitudeApproximation, longitudeApproximation);\n}\n",czm_backFacing="bool czm_backFacing()\n{\nreturn gl_FrontFacing == false;\n}\n",czm_branchFreeTernary="float czm_branchFreeTernary(bool comparison, float a, float b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\nvec2 czm_branchFreeTernary(bool comparison, vec2 a, vec2 b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\nvec3 czm_branchFreeTernary(bool comparison, vec3 a, vec3 b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\nvec4 czm_branchFreeTernary(bool comparison, vec4 a, vec4 b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\n",czm_cascadeColor="vec4 czm_cascadeColor(vec4 weights)\n{\nreturn vec4(1.0, 0.0, 0.0, 1.0) * weights.x +\nvec4(0.0, 1.0, 0.0, 1.0) * weights.y +\nvec4(0.0, 0.0, 1.0, 1.0) * weights.z +\nvec4(1.0, 0.0, 1.0, 1.0) * weights.w;\n}\n",czm_cascadeDistance="uniform vec4 shadowMap_cascadeDistances;\nfloat czm_cascadeDistance(vec4 weights)\n{\nreturn dot(shadowMap_cascadeDistances, weights);\n}\n",czm_cascadeMatrix="uniform mat4 shadowMap_cascadeMatrices[4];\nmat4 czm_cascadeMatrix(vec4 weights)\n{\nreturn shadowMap_cascadeMatrices[0] * weights.x +\nshadowMap_cascadeMatrices[1] * weights.y +\nshadowMap_cascadeMatrices[2] * weights.z +\nshadowMap_cascadeMatrices[3] * weights.w;\n}\n",czm_cascadeWeights="uniform vec4 shadowMap_cascadeSplits[2];\nvec4 czm_cascadeWeights(float depthEye)\n{\nvec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));\nvec4 far = step(depthEye, shadowMap_cascadeSplits[1]);\nreturn near * far;\n}\n",czm_columbusViewMorph="vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)\n{\nvec3 p = mix(position2D.xyz, position3D.xyz, time);\nreturn vec4(p, 1.0);\n}\n",czm_computePosition="vec4 czm_computePosition();\n",czm_cosineAndSine="vec2 cordic(float angle)\n{\nvec2 vector = vec2(6.0725293500888267e-1, 0.0);\nfloat sense = (angle < 0.0) ? -1.0 : 1.0;\nmat2 rotation = mat2(1.0, sense, -sense, 1.0);\nvector = rotation * vector;\nangle -= sense * 7.8539816339744828e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfloat factor = sense * 5.0e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.6364760900080609e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.5e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.4497866312686414e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.25e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.2435499454676144e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 6.25e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 6.2418809995957350e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.125e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.1239833430268277e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.5625e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.5623728620476831e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 7.8125e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 7.8123410601011111e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.90625e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.9062301319669718e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.953125e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.9531225164788188e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 9.765625e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 9.7656218955931946e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 4.8828125e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.8828121119489829e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.44140625e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.4414062014936177e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.220703125e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.2207031189367021e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 6.103515625e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 6.1035156174208773e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.0517578125e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.0517578115526096e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.52587890625e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.5258789061315762e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 7.62939453125e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 7.6293945311019700e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.814697265625e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.8146972656064961e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.9073486328125e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.9073486328101870e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 9.5367431640625e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 9.5367431640596084e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 4.76837158203125e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.7683715820308884e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.384185791015625e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.3841857910155797e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.1920928955078125e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nreturn vector;\n}\nvec2 czm_cosineAndSine(float angle)\n{\nif (angle < -czm_piOverTwo || angle > czm_piOverTwo)\n{\nif (angle < 0.0)\n{\nreturn -cordic(angle + czm_pi);\n}\nelse\n{\nreturn -cordic(angle - czm_pi);\n}\n}\nelse\n{\nreturn cordic(angle);\n}\n}\n",czm_decompressTextureCoordinates="vec2 czm_decompressTextureCoordinates(float encoded)\n{\nfloat temp = encoded / 4096.0;\nfloat xZeroTo4095 = floor(temp);\nfloat stx = xZeroTo4095 / 4095.0;\nfloat sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;\nreturn vec2(stx, sty);\n}\n",czm_defaultPbrMaterial="czm_pbrParameters czm_defaultPbrMaterial()\n{\nczm_pbrParameters results;\nresults.diffuseColor = vec3(1.0);\nresults.roughness = 1.0;\nconst vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);\nresults.f0 = REFLECTANCE_DIELECTRIC;\nreturn results;\n}\n",czm_depthClamp="#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\nvarying float v_WindowZ;\n#endif\nvec4 czm_depthClamp(vec4 coords)\n{\n#ifndef LOG_DEPTH\n#ifdef GL_EXT_frag_depth\nv_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;\ncoords.z = 0.0;\n#else\ncoords.z = min(coords.z, coords.w);\n#endif\n#endif\nreturn coords;\n}\n",czm_eastNorthUpToEyeCoordinates="mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)\n{\nvec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0));\nvec3 tangentEC = normalize(czm_normal3D * tangentMC);\nvec3 bitangentEC = normalize(cross(normalEC, tangentEC));\nreturn mat3(\ntangentEC.x, tangentEC.y, tangentEC.z,\nbitangentEC.x, bitangentEC.y, bitangentEC.z,\nnormalEC.x, normalEC.y, normalEC.z);\n}\n",czm_ellipsoidContainsPoint="bool czm_ellipsoidContainsPoint(vec3 ellipsoid_inverseRadii, vec3 point)\n{\nvec3 scaled = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;\nreturn (dot(scaled, scaled) <= 1.0);\n}\n",czm_ellipsoidWgs84TextureCoordinates="vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n{\nreturn vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n}\n",czm_equalsEpsilon="bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec4(epsilon)));\n}\nbool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec3(epsilon)));\n}\nbool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec2(epsilon)));\n}\nbool czm_equalsEpsilon(float left, float right, float epsilon) {\nreturn (abs(left - right) <= epsilon);\n}\n",czm_eyeOffset="vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)\n{\nvec4 p = positionEC;\nvec4 zEyeOffset = normalize(p) * eyeOffset.z;\np.xy += eyeOffset.xy + zEyeOffset.xy;\np.z += zEyeOffset.z;\nreturn p;\n}\n",czm_eyeToWindowCoordinates="vec4 czm_eyeToWindowCoordinates(vec4 positionEC)\n{\nvec4 q = czm_projection * positionEC;\nq.xyz /= q.w;\nq.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\nreturn q;\n}\n",czm_fastApproximateAtan="float czm_fastApproximateAtan(float x) {\nreturn x * (-0.1784 * x - 0.0663 * x * x + 1.0301);\n}\nfloat czm_fastApproximateAtan(float x, float y) {\nfloat t = abs(x);\nfloat opposite = abs(y);\nfloat adjacent = max(t, opposite);\nopposite = min(t, opposite);\nt = czm_fastApproximateAtan(opposite / adjacent);\nt = czm_branchFreeTernary(abs(y) > abs(x), czm_piOverTwo - t, t);\nt = czm_branchFreeTernary(x < 0.0, czm_pi - t, t);\nt = czm_branchFreeTernary(y < 0.0, -t, t);\nreturn t;\n}\n",czm_fog="vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)\n{\nfloat scalar = distanceToCamera * czm_fogDensity;\nfloat fog = 1.0 - exp(-(scalar * scalar));\nreturn mix(color, fogColor, fog);\n}\nvec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor, float fogModifierConstant)\n{\nfloat scalar = distanceToCamera * czm_fogDensity;\nfloat fog = 1.0 - exp(-((fogModifierConstant * scalar + fogModifierConstant) * (scalar * (1.0 + fogModifierConstant))));\nreturn mix(color, fogColor, fog);\n}\n",czm_gammaCorrect="vec3 czm_gammaCorrect(vec3 color) {\n#ifdef HDR\ncolor = pow(color, vec3(czm_gamma));\n#endif\nreturn color;\n}\nvec4 czm_gammaCorrect(vec4 color) {\n#ifdef HDR\ncolor.rgb = pow(color.rgb, vec3(czm_gamma));\n#endif\nreturn color;\n}\n",czm_geodeticSurfaceNormal="vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)\n{\nreturn normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);\n}\n",czm_getDefaultMaterial="czm_material czm_getDefaultMaterial(czm_materialInput materialInput)\n{\nczm_material material;\nmaterial.diffuse = vec3(0.0);\nmaterial.specular = 0.0;\nmaterial.shininess = 1.0;\nmaterial.normal = materialInput.normalEC;\nmaterial.emission = vec3(0.0);\nmaterial.alpha = 1.0;\nreturn material;\n}\n",czm_getLambertDiffuse="float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)\n{\nreturn max(dot(lightDirectionEC, normalEC), 0.0);\n}\n",czm_getSpecular="float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)\n{\nvec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);\nfloat specular = max(dot(toReflectedLight, toEyeEC), 0.0);\nreturn pow(specular, max(shininess, czm_epsilon2));\n}\n",czm_getWaterNoise="vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)\n{\nfloat cosAngle = cos(angleInRadians);\nfloat sinAngle = sin(angleInRadians);\nvec2 s0 = vec2(1.0/17.0, 0.0);\nvec2 s1 = vec2(-1.0/29.0, 0.0);\nvec2 s2 = vec2(1.0/101.0, 1.0/59.0);\nvec2 s3 = vec2(-1.0/109.0, -1.0/57.0);\ns0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));\ns1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));\ns2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));\ns3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));\nvec2 uv0 = (uv/103.0) + (time * s0);\nvec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);\nvec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);\nvec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);\nuv0 = fract(uv0);\nuv1 = fract(uv1);\nuv2 = fract(uv2);\nuv3 = fract(uv3);\nvec4 noise = (texture2D(normalMap, uv0)) +\n(texture2D(normalMap, uv1)) +\n(texture2D(normalMap, uv2)) +\n(texture2D(normalMap, uv3));\nreturn ((noise / 4.0) - 0.5) * 2.0;\n}\n",czm_HSBToRGB="const vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\nvec3 czm_HSBToRGB(vec3 hsb)\n{\nvec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www);\nreturn hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y);\n}\n",czm_HSLToRGB="vec3 hueToRGB(float hue)\n{\nfloat r = abs(hue * 6.0 - 3.0) - 1.0;\nfloat g = 2.0 - abs(hue * 6.0 - 2.0);\nfloat b = 2.0 - abs(hue * 6.0 - 4.0);\nreturn clamp(vec3(r, g, b), 0.0, 1.0);\n}\nvec3 czm_HSLToRGB(vec3 hsl)\n{\nvec3 rgb = hueToRGB(hsl.x);\nfloat c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;\nreturn (rgb - 0.5) * c + hsl.z;\n}\n",czm_hue="vec3 czm_hue(vec3 rgb, float adjustment)\n{\nconst mat3 toYIQ = mat3(0.299, 0.587, 0.114,\n0.595716, -0.274453, -0.321263,\n0.211456, -0.522591, 0.311135);\nconst mat3 toRGB = mat3(1.0, 0.9563, 0.6210,\n1.0, -0.2721, -0.6474,\n1.0, -1.107, 1.7046);\nvec3 yiq = toYIQ * rgb;\nfloat hue = atan(yiq.z, yiq.y) + adjustment;\nfloat chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\nvec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\nreturn toRGB * color;\n}\n",czm_inverseGamma="vec3 czm_inverseGamma(vec3 color) {\nreturn pow(color, vec3(1.0 / czm_gamma));\n}\n",czm_isEmpty="bool czm_isEmpty(czm_raySegment interval)\n{\nreturn (interval.stop < 0.0);\n}\n",czm_isFull="bool czm_isFull(czm_raySegment interval)\n{\nreturn (interval.start == 0.0 && interval.stop == czm_infinity);\n}\n",czm_latitudeToWebMercatorFraction="float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight)\n{\nfloat sinLatitude = sin(latitude);\nfloat mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));\nreturn (mercatorY - southMercatorY) * oneOverMercatorHeight;\n}\n",czm_lineDistance="float czm_lineDistance(vec2 point1, vec2 point2, vec2 point) {\nreturn abs((point2.y - point1.y) * point.x - (point2.x - point1.x) * point.y + point2.x * point1.y - point2.y * point1.x) / distance(point2, point1);\n}\n",czm_luminance="float czm_luminance(vec3 rgb)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nreturn dot(rgb, W);\n}\n",czm_metersPerPixel="float czm_metersPerPixel(vec4 positionEC, float pixelRatio)\n{\nfloat width = czm_viewport.z;\nfloat height = czm_viewport.w;\nfloat pixelWidth;\nfloat pixelHeight;\nfloat top = czm_frustumPlanes.x;\nfloat bottom = czm_frustumPlanes.y;\nfloat left = czm_frustumPlanes.z;\nfloat right = czm_frustumPlanes.w;\nif (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0)\n{\nfloat frustumWidth = right - left;\nfloat frustumHeight = top - bottom;\npixelWidth = frustumWidth / width;\npixelHeight = frustumHeight / height;\n}\nelse\n{\nfloat distanceToPixel = -positionEC.z;\nfloat inverseNear = 1.0 / czm_currentFrustum.x;\nfloat tanTheta = top * inverseNear;\npixelHeight = 2.0 * distanceToPixel * tanTheta / height;\ntanTheta = right * inverseNear;\npixelWidth = 2.0 * distanceToPixel * tanTheta / width;\n}\nreturn max(pixelWidth, pixelHeight) * pixelRatio;\n}\nfloat czm_metersPerPixel(vec4 positionEC)\n{\nreturn czm_metersPerPixel(positionEC, czm_pixelRatio);\n}\n",czm_modelToWindowCoordinates="vec4 czm_modelToWindowCoordinates(vec4 position)\n{\nvec4 q = czm_modelViewProjection * position;\nq.xyz /= q.w;\nq.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\nreturn q;\n}\n",czm_multiplyWithColorBalance="vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nvec3 target = left * right;\nfloat leftLuminance = dot(left, W);\nfloat rightLuminance = dot(right, W);\nfloat targetLuminance = dot(target, W);\nreturn ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;\n}\n",czm_nearFarScalar="float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)\n{\nfloat valueAtMin = nearFarScalar.y;\nfloat valueAtMax = nearFarScalar.w;\nfloat nearDistanceSq = nearFarScalar.x * nearFarScalar.x;\nfloat farDistanceSq = nearFarScalar.z * nearFarScalar.z;\nfloat t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);\nt = pow(clamp(t, 0.0, 1.0), 0.2);\nreturn mix(valueAtMin, valueAtMax, t);\n}\n",czm_octDecode="vec3 czm_octDecode(vec2 encoded, float range)\n{\nif (encoded.x == 0.0 && encoded.y == 0.0) {\nreturn vec3(0.0, 0.0, 0.0);\n}\nencoded = encoded / range * 2.0 - 1.0;\nvec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\nif (v.z < 0.0)\n{\nv.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);\n}\nreturn normalize(v);\n}\nvec3 czm_octDecode(vec2 encoded)\n{\nreturn czm_octDecode(encoded, 255.0);\n}\nvec3 czm_octDecode(float encoded)\n{\nfloat temp = encoded / 256.0;\nfloat x = floor(temp);\nfloat y = (temp - x) * 256.0;\nreturn czm_octDecode(vec2(x, y));\n}\nvoid czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)\n{\nfloat temp = encoded.x / 65536.0;\nfloat x = floor(temp);\nfloat encodedFloat1 = (temp - x) * 65536.0;\ntemp = encoded.y / 65536.0;\nfloat y = floor(temp);\nfloat encodedFloat2 = (temp - y) * 65536.0;\nvector1 = czm_octDecode(encodedFloat1);\nvector2 = czm_octDecode(encodedFloat2);\nvector3 = czm_octDecode(vec2(x, y));\n}\n",czm_packDepth="vec4 czm_packDepth(float depth)\n{\nvec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\nenc = fract(enc);\nenc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\nreturn enc;\n}\n",czm_pbrLighting="vec3 lambertianDiffuse(vec3 diffuseColor)\n{\nreturn diffuseColor / czm_pi;\n}\nvec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)\n{\nreturn f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n}\nfloat smithVisibilityG1(float NdotV, float roughness)\n{\nfloat k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\nreturn NdotV / (NdotV * (1.0 - k) + k);\n}\nfloat smithVisibilityGGX(float roughness, float NdotL, float NdotV)\n{\nreturn (\nsmithVisibilityG1(NdotL, roughness) *\nsmithVisibilityG1(NdotV, roughness)\n);\n}\nfloat GGX(float roughness, float NdotH)\n{\nfloat roughnessSquared = roughness * roughness;\nfloat f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\nreturn roughnessSquared / (czm_pi * f * f);\n}\nvec3 czm_pbrLighting(\nvec3 positionEC,\nvec3 normalEC,\nvec3 lightDirectionEC,\nvec3 lightColorHdr,\nczm_pbrParameters pbrParameters\n)\n{\nvec3 v = -normalize(positionEC);\nvec3 l = normalize(lightDirectionEC);\nvec3 h = normalize(v + l);\nvec3 n = normalEC;\nfloat NdotL = clamp(dot(n, l), 0.001, 1.0);\nfloat NdotV = abs(dot(n, v)) + 0.001;\nfloat NdotH = clamp(dot(n, h), 0.0, 1.0);\nfloat LdotH = clamp(dot(l, h), 0.0, 1.0);\nfloat VdotH = clamp(dot(v, h), 0.0, 1.0);\nvec3 f0 = pbrParameters.f0;\nfloat reflectance = max(max(f0.r, f0.g), f0.b);\nvec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\nvec3 F = fresnelSchlick2(f0, f90, VdotH);\nfloat alpha = pbrParameters.roughness;\nfloat G = smithVisibilityGGX(alpha, NdotL, NdotV);\nfloat D = GGX(alpha, NdotH);\nvec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);\nvec3 diffuseColor = pbrParameters.diffuseColor;\nvec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);\nreturn (diffuseContribution + specularContribution) * NdotL * lightColorHdr;\n}\n",czm_pbrMetallicRoughnessMaterial="czm_pbrParameters czm_pbrMetallicRoughnessMaterial(\nvec3 baseColor,\nfloat metallic,\nfloat roughness\n)\n{\nczm_pbrParameters results;\nroughness = clamp(roughness, 0.0, 1.0);\nresults.roughness = roughness * roughness;\nmetallic = clamp(metallic, 0.0, 1.0);\nconst vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);\nvec3 f0 = mix(REFLECTANCE_DIELECTRIC, baseColor, metallic);\nresults.f0 = f0;\nresults.diffuseColor = baseColor * (1.0 - f0) * (1.0 - metallic);\nreturn results;\n}\n",czm_pbrSpecularGlossinessMaterial="czm_pbrParameters czm_pbrSpecularGlossinessMaterial(\nvec3 diffuse,\nvec3 specular,\nfloat glossiness\n)\n{\nczm_pbrParameters results;\nfloat roughness = 1.0 - glossiness;\nresults.roughness = roughness * roughness;\nresults.diffuseColor = diffuse * (1.0 - max(max(specular.r, specular.g), specular.b));\nresults.f0 = specular;\nreturn results;\n}\n",czm_phong="float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)\n{\nreturn czm_getLambertDiffuse(lightDirectionEC, material.normal);\n}\nfloat czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)\n{\nreturn czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);\n}\nvec4 czm_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\nfloat diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);\nif (czm_sceneMode == czm_sceneMode3D) {\ndiffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);\n}\nfloat specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);\nvec3 materialDiffuse = material.diffuse * 0.5;\nvec3 ambient = materialDiffuse;\nvec3 color = ambient + material.emission;\ncolor += materialDiffuse * diffuse * czm_lightColor;\ncolor += material.specular * specular * czm_lightColor;\nreturn vec4(color, material.alpha);\n}\nvec4 czm_private_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\nfloat diffuse = czm_private_getLambertDiffuseOfMaterial(lightDirectionEC, material);\nfloat specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);\nvec3 ambient = vec3(0.0);\nvec3 color = ambient + material.emission;\ncolor += material.diffuse * diffuse * czm_lightColor;\ncolor += material.specular * specular * czm_lightColor;\nreturn vec4(color, material.alpha);\n}\n",czm_planeDistance="float czm_planeDistance(vec4 plane, vec3 point) {\nreturn (dot(plane.xyz, point) + plane.w);\n}\nfloat czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) {\nreturn (dot(planeNormal, point) + planeDistance);\n}\n",czm_pointAlongRay="vec3 czm_pointAlongRay(czm_ray ray, float time)\n{\nreturn ray.origin + (time * ray.direction);\n}\n",czm_rayEllipsoidIntersectionInterval="czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, vec3 ellipsoid_center, vec3 ellipsoid_inverseRadii)\n{\nvec3 q = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;\nvec3 w = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;\nq = q - ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ellipsoid_center, 1.0)).xyz;\nfloat q2 = dot(q, q);\nfloat qw = dot(q, w);\nif (q2 > 1.0)\n{\nif (qw >= 0.0)\n{\nreturn czm_emptyRaySegment;\n}\nelse\n{\nfloat qw2 = qw * qw;\nfloat difference = q2 - 1.0;\nfloat w2 = dot(w, w);\nfloat product = w2 * difference;\nif (qw2 < product)\n{\nreturn czm_emptyRaySegment;\n}\nelse if (qw2 > product)\n{\nfloat discriminant = qw * qw - product;\nfloat temp = -qw + sqrt(discriminant);\nfloat root0 = temp / w2;\nfloat root1 = difference / temp;\nif (root0 < root1)\n{\nczm_raySegment i = czm_raySegment(root0, root1);\nreturn i;\n}\nelse\n{\nczm_raySegment i = czm_raySegment(root1, root0);\nreturn i;\n}\n}\nelse\n{\nfloat root = sqrt(difference / w2);\nczm_raySegment i = czm_raySegment(root, root);\nreturn i;\n}\n}\n}\nelse if (q2 < 1.0)\n{\nfloat difference = q2 - 1.0;\nfloat w2 = dot(w, w);\nfloat product = w2 * difference;\nfloat discriminant = qw * qw - product;\nfloat temp = -qw + sqrt(discriminant);\nczm_raySegment i = czm_raySegment(0.0, temp / w2);\nreturn i;\n}\nelse\n{\nif (qw < 0.0)\n{\nfloat w2 = dot(w, w);\nczm_raySegment i = czm_raySegment(0.0, -qw / w2);\nreturn i;\n}\nelse\n{\nreturn czm_emptyRaySegment;\n}\n}\n}\n",czm_readDepth="float czm_readDepth(sampler2D depthTexture, vec2 texCoords)\n{\nreturn czm_reverseLogDepth(texture2D(depthTexture, texCoords).r);\n}\n",czm_readNonPerspective="float czm_readNonPerspective(float value, float oneOverW) {\nreturn value * oneOverW;\n}\nvec2 czm_readNonPerspective(vec2 value, float oneOverW) {\nreturn value * oneOverW;\n}\nvec3 czm_readNonPerspective(vec3 value, float oneOverW) {\nreturn value * oneOverW;\n}\nvec4 czm_readNonPerspective(vec4 value, float oneOverW) {\nreturn value * oneOverW;\n}\n",czm_reverseLogDepth="float czm_reverseLogDepth(float logZ)\n{\n#ifdef LOG_DEPTH\nfloat near = czm_currentFrustum.x;\nfloat far = czm_currentFrustum.y;\nfloat log2Depth = logZ * czm_log2FarDepthFromNearPlusOne;\nfloat depthFromNear = pow(2.0, log2Depth) - 1.0;\nreturn far * (1.0 - near / (depthFromNear + near)) / (far - near);\n#endif\nreturn logZ;\n}\n",czm_RGBToHSB="const vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\nvec3 czm_RGBToHSB(vec3 rgb)\n{\nvec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g));\nvec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));\nfloat d = q.x - min(q.w, q.y);\nreturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x);\n}\n",czm_RGBToHSL="vec3 RGBtoHCV(vec3 rgb)\n{\nvec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0);\nvec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\nfloat c = q.x - min(q.w, q.y);\nfloat h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z);\nreturn vec3(h, c, q.x);\n}\nvec3 czm_RGBToHSL(vec3 rgb)\n{\nvec3 hcv = RGBtoHCV(rgb);\nfloat l = hcv.z - hcv.y * 0.5;\nfloat s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7);\nreturn vec3(hcv.x, s, l);\n}\n",czm_RGBToXYZ="vec3 czm_RGBToXYZ(vec3 rgb)\n{\nconst mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,\n0.3576, 0.7152, 0.1192,\n0.1805, 0.0722, 0.9505);\nvec3 xyz = RGB2XYZ * rgb;\nvec3 Yxy;\nYxy.r = xyz.g;\nfloat temp = dot(vec3(1.0), xyz);\nYxy.gb = xyz.rg / temp;\nreturn Yxy;\n}\n",czm_sampleOctahedralProjection="vec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod)\n{\ndirection /= dot(vec3(1.0), abs(direction));\nvec2 rev = abs(direction.zx) - vec2(1.0);\nvec2 neg = vec2(direction.x < 0.0 ? rev.x : -rev.x,\ndirection.z < 0.0 ? rev.y : -rev.y);\nvec2 uv = direction.y < 0.0 ? neg : direction.xz;\nvec2 coord = 0.5 * uv + vec2(0.5);\nvec2 pixel = 1.0 / textureSize;\nif (lod > 0.0)\n{\nfloat scale = 1.0 / pow(2.0, lod);\nfloat offset = ((textureSize.y + 1.0) / textureSize.x);\ncoord.x *= offset;\ncoord *= scale;\ncoord.x += offset + pixel.x;\ncoord.y += (1.0 - (1.0 / pow(2.0, lod - 1.0))) + pixel.y * (lod - 1.0) * 2.0;\n}\nelse\n{\ncoord.x *= (textureSize.y / textureSize.x);\n}\n#ifndef OES_texture_float_linear\nvec3 color1 = texture2D(projectedMap, coord + vec2(0.0, pixel.y)).rgb;\nvec3 color2 = texture2D(projectedMap, coord + vec2(pixel.x, 0.0)).rgb;\nvec3 color3 = texture2D(projectedMap, coord + pixel).rgb;\nvec3 color4 = texture2D(projectedMap, coord).rgb;\nvec2 texturePosition = coord * textureSize;\nfloat fu = fract(texturePosition.x);\nfloat fv = fract(texturePosition.y);\nvec3 average1 = mix(color4, color2, fu);\nvec3 average2 = mix(color1, color3, fu);\nvec3 color = mix(average1, average2, fv);\n#else\nvec3 color = texture2D(projectedMap, coord).rgb;\n#endif\nreturn color;\n}\nvec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) {\nfloat currentLod = floor(lod + 0.5);\nfloat nextLod = min(currentLod + 1.0, maxLod);\nvec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod);\nvec3 colorNextLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, nextLod);\nreturn mix(colorNextLod, colorCurrentLod, nextLod - lod);\n}\n",czm_saturation="vec3 czm_saturation(vec3 rgb, float adjustment)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nvec3 intensity = vec3(dot(rgb, W));\nreturn mix(intensity, rgb, adjustment);\n}\n",czm_shadowDepthCompare="float czm_sampleShadowMap(highp samplerCube shadowMap, vec3 d)\n{\nreturn czm_unpackDepth(textureCube(shadowMap, d));\n}\nfloat czm_sampleShadowMap(highp sampler2D shadowMap, vec2 uv)\n{\n#ifdef USE_SHADOW_DEPTH_TEXTURE\nreturn texture2D(shadowMap, uv).r;\n#else\nreturn czm_unpackDepth(texture2D(shadowMap, uv));\n#endif\n}\nfloat czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)\n{\nreturn step(depth, czm_sampleShadowMap(shadowMap, uv));\n}\nfloat czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)\n{\nreturn step(depth, czm_sampleShadowMap(shadowMap, uv));\n}\n",czm_shadowVisibility="float czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness)\n{\n#ifdef USE_NORMAL_SHADING\n#ifdef USE_NORMAL_SHADING_SMOOTH\nfloat strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0);\n#else\nfloat strength = step(0.0, nDotL);\n#endif\nvisibility *= strength;\n#endif\nvisibility = max(visibility, darkness);\nreturn visibility;\n}\n#ifdef USE_CUBE_MAP_SHADOW\nfloat czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters)\n{\nfloat depthBias = shadowParameters.depthBias;\nfloat depth = shadowParameters.depth;\nfloat nDotL = shadowParameters.nDotL;\nfloat normalShadingSmooth = shadowParameters.normalShadingSmooth;\nfloat darkness = shadowParameters.darkness;\nvec3 uvw = shadowParameters.texCoords;\ndepth -= depthBias;\nfloat visibility = czm_shadowDepthCompare(shadowMap, uvw, depth);\nreturn czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n}\n#else\nfloat czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters)\n{\nfloat depthBias = shadowParameters.depthBias;\nfloat depth = shadowParameters.depth;\nfloat nDotL = shadowParameters.nDotL;\nfloat normalShadingSmooth = shadowParameters.normalShadingSmooth;\nfloat darkness = shadowParameters.darkness;\nvec2 uv = shadowParameters.texCoords;\ndepth -= depthBias;\n#ifdef USE_SOFT_SHADOWS\nvec2 texelStepSize = shadowParameters.texelStepSize;\nfloat radius = 1.0;\nfloat dx0 = -texelStepSize.x * radius;\nfloat dy0 = -texelStepSize.y * radius;\nfloat dx1 = texelStepSize.x * radius;\nfloat dy1 = texelStepSize.y * radius;\nfloat visibility = (\nczm_shadowDepthCompare(shadowMap, uv, depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)\n) * (1.0 / 9.0);\n#else\nfloat visibility = czm_shadowDepthCompare(shadowMap, uv, depth);\n#endif\nreturn czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n}\n#endif\n",czm_signNotZero="float czm_signNotZero(float value)\n{\nreturn value >= 0.0 ? 1.0 : -1.0;\n}\nvec2 czm_signNotZero(vec2 value)\n{\nreturn vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));\n}\nvec3 czm_signNotZero(vec3 value)\n{\nreturn vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));\n}\nvec4 czm_signNotZero(vec4 value)\n{\nreturn vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));\n}\n",czm_sphericalHarmonics="vec3 czm_sphericalHarmonics(vec3 normal, vec3 coefficients[9])\n{\nvec3 L00 = coefficients[0];\nvec3 L1_1 = coefficients[1];\nvec3 L10 = coefficients[2];\nvec3 L11 = coefficients[3];\nvec3 L2_2 = coefficients[4];\nvec3 L2_1 = coefficients[5];\nvec3 L20 = coefficients[6];\nvec3 L21 = coefficients[7];\nvec3 L22 = coefficients[8];\nfloat x = normal.x;\nfloat y = normal.y;\nfloat z = normal.z;\nreturn\nL00\n+ L1_1 * y\n+ L10 * z\n+ L11 * x\n+ L2_2 * (y * x)\n+ L2_1 * (y * z)\n+ L20 * (3.0 * z * z - 1.0)\n+ L21 * (z * x)\n+ L22 * (x * x - y * y);\n}\n",czm_tangentToEyeSpaceMatrix="mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)\n{\nvec3 normal = normalize(normalEC);\nvec3 tangent = normalize(tangentEC);\nvec3 bitangent = normalize(bitangentEC);\nreturn mat3(tangent.x , tangent.y , tangent.z,\nbitangent.x, bitangent.y, bitangent.z,\nnormal.x , normal.y , normal.z);\n}\n",czm_transformPlane="vec4 czm_transformPlane(vec4 plane, mat4 transform) {\nvec4 transformedPlane = transform * plane;\nfloat normalMagnitude = length(transformedPlane.xyz);\nreturn transformedPlane / normalMagnitude;\n}\n",czm_translateRelativeToEye="vec4 czm_translateRelativeToEye(vec3 high, vec3 low)\n{\nvec3 highDifference = high - czm_encodedCameraPositionMCHigh;\nvec3 lowDifference = low - czm_encodedCameraPositionMCLow;\nreturn vec4(highDifference + lowDifference, 1.0);\n}\n",czm_translucentPhong="vec4 czm_translucentPhong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\nfloat diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);\nif (czm_sceneMode == czm_sceneMode3D) {\ndiffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);\n}\ndiffuse = clamp(diffuse, 0.0, 1.0);\nfloat specular = czm_getSpecular(lightDirectionEC, toEye, material.normal, material.shininess);\nvec3 materialDiffuse = material.diffuse * 0.5;\nvec3 ambient = materialDiffuse;\nvec3 color = ambient + material.emission;\ncolor += materialDiffuse * diffuse * czm_lightColor;\ncolor += material.specular * specular * czm_lightColor;\nreturn vec4(color, material.alpha);\n}\n",czm_transpose="mat2 czm_transpose(mat2 matrix)\n{\nreturn mat2(\nmatrix[0][0], matrix[1][0],\nmatrix[0][1], matrix[1][1]);\n}\nmat3 czm_transpose(mat3 matrix)\n{\nreturn mat3(\nmatrix[0][0], matrix[1][0], matrix[2][0],\nmatrix[0][1], matrix[1][1], matrix[2][1],\nmatrix[0][2], matrix[1][2], matrix[2][2]);\n}\nmat4 czm_transpose(mat4 matrix)\n{\nreturn mat4(\nmatrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],\nmatrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],\nmatrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],\nmatrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);\n}\n",czm_unpackDepth="float czm_unpackDepth(vec4 packedDepth)\n{\nreturn dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n}\n",czm_unpackFloat="float czm_unpackFloat(vec4 packedFloat)\n{\npackedFloat = floor(packedFloat * 255.0 + 0.5);\nfloat sign = 1.0 - step(128.0, packedFloat[3]) * 2.0;\nfloat exponent = 2.0 * mod(packedFloat[3], 128.0) + step(128.0, packedFloat[2]) - 127.0;\nif (exponent == -127.0)\n{\nreturn 0.0;\n}\nfloat mantissa = mod(packedFloat[2], 128.0) * 65536.0 + packedFloat[1] * 256.0 + packedFloat[0] + float(0x800000);\nfloat result = sign * exp2(exponent - 23.0) * mantissa;\nreturn result;\n}\n",czm_vertexLogDepth="#ifdef LOG_DEPTH\nvarying float v_depthFromNearPlusOne;\n#ifdef SHADOW_MAP\nvarying vec3 v_logPositionEC;\n#endif\n#endif\nvec4 czm_updatePositionDepth(vec4 coords) {\n#if defined(LOG_DEPTH)\n#ifdef SHADOW_MAP\nvec3 logPositionEC = (czm_inverseProjection * coords).xyz;\nv_logPositionEC = logPositionEC;\n#endif\ncoords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w;\n#endif\nreturn coords;\n}\nvoid czm_vertexLogDepth()\n{\n#ifdef LOG_DEPTH\nv_depthFromNearPlusOne = (gl_Position.w - czm_currentFrustum.x) + 1.0;\ngl_Position = czm_updatePositionDepth(gl_Position);\n#endif\n}\nvoid czm_vertexLogDepth(vec4 clipCoords)\n{\n#ifdef LOG_DEPTH\nv_depthFromNearPlusOne = (clipCoords.w - czm_currentFrustum.x) + 1.0;\nczm_updatePositionDepth(clipCoords);\n#endif\n}\n",czm_windowToEyeCoordinates="vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n{\nfloat x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;\nfloat y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;\nfloat z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\nvec4 q = vec4(x, y, z, 1.0);\nq /= fragmentCoordinate.w;\nif (!(czm_inverseProjection == mat4(0.0)))\n{\nq = czm_inverseProjection * q;\n}\nelse\n{\nfloat top = czm_frustumPlanes.x;\nfloat bottom = czm_frustumPlanes.y;\nfloat left = czm_frustumPlanes.z;\nfloat right = czm_frustumPlanes.w;\nfloat near = czm_currentFrustum.x;\nfloat far = czm_currentFrustum.y;\nq.x = (q.x * (right - left) + left + right) * 0.5;\nq.y = (q.y * (top - bottom) + bottom + top) * 0.5;\nq.z = (q.z * (near - far) - near - far) * 0.5;\nq.w = 1.0;\n}\nreturn q;\n}\nvec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)\n{\n#ifdef LOG_DEPTH\nfloat near = czm_currentFrustum.x;\nfloat far = czm_currentFrustum.y;\nfloat log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne;\nfloat depthFromNear = pow(2.0, log2Depth) - 1.0;\nfloat depthFromCamera = depthFromNear + near;\nvec4 windowCoord = vec4(fragmentCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0);\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(windowCoord);\neyeCoordinate.w = 1.0 / depthFromCamera;\nreturn eyeCoordinate;\n#else\nvec4 windowCoord = vec4(fragmentCoordinateXY, depthOrLogDepth, 1.0);\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(windowCoord);\n#endif\nreturn eyeCoordinate;\n}\n",czm_writeDepthClamp="#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\nvarying float v_WindowZ;\n#endif\nvoid czm_writeDepthClamp()\n{\n#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\ngl_FragDepthEXT = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);\n#endif\n}\n",czm_writeLogDepth="#ifdef LOG_DEPTH\nvarying float v_depthFromNearPlusOne;\n#ifdef POLYGON_OFFSET\nuniform vec2 u_polygonOffset;\n#endif\n#endif\nvoid czm_writeLogDepth(float depth)\n{\n#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH)\nif (depth <= 0.9999999 || depth > czm_farDepthFromNearPlusOne) {\ndiscard;\n}\n#ifdef POLYGON_OFFSET\nfloat factor = u_polygonOffset[0];\nfloat units = u_polygonOffset[1];\n#ifdef GL_OES_standard_derivatives\nfloat x = dFdx(depth);\nfloat y = dFdy(depth);\nfloat m = sqrt(x * x + y * y);\ndepth += m * factor;\n#endif\n#endif\ngl_FragDepthEXT = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne;\n#ifdef POLYGON_OFFSET\ngl_FragDepthEXT += czm_epsilon7 * units;\n#endif\n#endif\n}\nvoid czm_writeLogDepth() {\n#ifdef LOG_DEPTH\nczm_writeLogDepth(v_depthFromNearPlusOne);\n#endif\n}\n",czm_writeNonPerspective="float czm_writeNonPerspective(float value, float w) {\nreturn value * w;\n}\nvec2 czm_writeNonPerspective(vec2 value, float w) {\nreturn value * w;\n}\nvec3 czm_writeNonPerspective(vec3 value, float w) {\nreturn value * w;\n}\nvec4 czm_writeNonPerspective(vec4 value, float w) {\nreturn value * w;\n}\n",czm_XYZToRGB="vec3 czm_XYZToRGB(vec3 Yxy)\n{\nconst mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556,\n-1.5371, 1.8760, -0.2040,\n-0.4985, 0.0416, 1.0572);\nvec3 xyz;\nxyz.r = Yxy.r * Yxy.g / Yxy.b;\nxyz.g = Yxy.r;\nxyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;\nreturn XYZ2RGB * xyz;\n}\n",CzmBuiltins={czm_degreesPerRadian:czm_degreesPerRadian,czm_depthRange:czm_depthRange,czm_epsilon1:czm_epsilon1,czm_epsilon2:czm_epsilon2,czm_epsilon3:czm_epsilon3,czm_epsilon4:czm_epsilon4,czm_epsilon5:czm_epsilon5,czm_epsilon6:czm_epsilon6,czm_epsilon7:czm_epsilon7,czm_infinity:czm_infinity,czm_oneOverPi:czm_oneOverPi,czm_oneOverTwoPi:czm_oneOverTwoPi,czm_passCesium3DTile:czm_passCesium3DTile,czm_passCesium3DTileClassification:czm_passCesium3DTileClassification,czm_passCesium3DTileClassificationIgnoreShow:czm_passCesium3DTileClassificationIgnoreShow,czm_passClassification:czm_passClassification,czm_passCompute:czm_passCompute,czm_passEnvironment:czm_passEnvironment,czm_passGlobe:czm_passGlobe,czm_passOpaque:czm_passOpaque,czm_passOverlay:czm_passOverlay,czm_passTerrainClassification:czm_passTerrainClassification,czm_passTranslucent:czm_passTranslucent,czm_pi:czm_pi,czm_piOverFour:czm_piOverFour,czm_piOverSix:czm_piOverSix,czm_piOverThree:czm_piOverThree,czm_piOverTwo:czm_piOverTwo,czm_radiansPerDegree:czm_radiansPerDegree,czm_sceneMode2D:czm_sceneMode2D,czm_sceneMode3D:czm_sceneMode3D,czm_sceneModeColumbusView:czm_sceneModeColumbusView,czm_sceneModeMorphing:czm_sceneModeMorphing,czm_solarRadius:czm_solarRadius,czm_threePiOver2:czm_threePiOver2,czm_twoPi:czm_twoPi,czm_webMercatorMaxLatitude:czm_webMercatorMaxLatitude,czm_depthRangeStruct:czm_depthRangeStruct,czm_ellipsoid:czm_ellipsoid,czm_material:czm_material,czm_materialInput:czm_materialInput,czm_modelMaterial:czm_modelMaterial,czm_modelVertexOutput:czm_modelVertexOutput,czm_pbrParameters:czm_pbrParameters,czm_ray:czm_ray,czm_raySegment:czm_raySegment,czm_shadowParameters:czm_shadowParameters,czm_acesTonemapping:czm_acesTonemapping,czm_alphaWeight:czm_alphaWeight,czm_antialias:czm_antialias,czm_approximateSphericalCoordinates:czm_approximateSphericalCoordinates,czm_backFacing:czm_backFacing,czm_branchFreeTernary:czm_branchFreeTernary,czm_cascadeColor:czm_cascadeColor,czm_cascadeDistance:czm_cascadeDistance,czm_cascadeMatrix:czm_cascadeMatrix,czm_cascadeWeights:czm_cascadeWeights,czm_columbusViewMorph:czm_columbusViewMorph,czm_computePosition:czm_computePosition,czm_cosineAndSine:czm_cosineAndSine,czm_decompressTextureCoordinates:czm_decompressTextureCoordinates,czm_defaultPbrMaterial:czm_defaultPbrMaterial,czm_depthClamp:czm_depthClamp,czm_eastNorthUpToEyeCoordinates:czm_eastNorthUpToEyeCoordinates,czm_ellipsoidContainsPoint:czm_ellipsoidContainsPoint,czm_ellipsoidWgs84TextureCoordinates:czm_ellipsoidWgs84TextureCoordinates,czm_equalsEpsilon:czm_equalsEpsilon,czm_eyeOffset:czm_eyeOffset,czm_eyeToWindowCoordinates:czm_eyeToWindowCoordinates,czm_fastApproximateAtan:czm_fastApproximateAtan,czm_fog:czm_fog,czm_gammaCorrect:czm_gammaCorrect,czm_geodeticSurfaceNormal:czm_geodeticSurfaceNormal,czm_getDefaultMaterial:czm_getDefaultMaterial,czm_getLambertDiffuse:czm_getLambertDiffuse,czm_getSpecular:czm_getSpecular,czm_getWaterNoise:czm_getWaterNoise,czm_HSBToRGB:czm_HSBToRGB,czm_HSLToRGB:czm_HSLToRGB,czm_hue:czm_hue,czm_inverseGamma:czm_inverseGamma,czm_isEmpty:czm_isEmpty,czm_isFull:czm_isFull,czm_latitudeToWebMercatorFraction:czm_latitudeToWebMercatorFraction,czm_lineDistance:czm_lineDistance,czm_luminance:czm_luminance,czm_metersPerPixel:czm_metersPerPixel,czm_modelToWindowCoordinates:czm_modelToWindowCoordinates,czm_multiplyWithColorBalance:czm_multiplyWithColorBalance,czm_nearFarScalar:czm_nearFarScalar,czm_octDecode:czm_octDecode,czm_packDepth:czm_packDepth,czm_pbrLighting:czm_pbrLighting,czm_pbrMetallicRoughnessMaterial:czm_pbrMetallicRoughnessMaterial,czm_pbrSpecularGlossinessMaterial:czm_pbrSpecularGlossinessMaterial,czm_phong:czm_phong,czm_planeDistance:czm_planeDistance,czm_pointAlongRay:czm_pointAlongRay,czm_rayEllipsoidIntersectionInterval:czm_rayEllipsoidIntersectionInterval,czm_readDepth:czm_readDepth,czm_readNonPerspective:czm_readNonPerspective,czm_reverseLogDepth:czm_reverseLogDepth,czm_RGBToHSB:czm_RGBToHSB,czm_RGBToHSL:czm_RGBToHSL,czm_RGBToXYZ:czm_RGBToXYZ,czm_sampleOctahedralProjection:czm_sampleOctahedralProjection,czm_saturation:czm_saturation,czm_shadowDepthCompare:czm_shadowDepthCompare,czm_shadowVisibility:czm_shadowVisibility,czm_signNotZero:czm_signNotZero,czm_sphericalHarmonics:czm_sphericalHarmonics,czm_tangentToEyeSpaceMatrix:czm_tangentToEyeSpaceMatrix,czm_transformPlane:czm_transformPlane,czm_translateRelativeToEye:czm_translateRelativeToEye,czm_translucentPhong:czm_translucentPhong,czm_transpose:czm_transpose,czm_unpackDepth:czm_unpackDepth,czm_unpackFloat:czm_unpackFloat,czm_vertexLogDepth:czm_vertexLogDepth,czm_windowToEyeCoordinates:czm_windowToEyeCoordinates,czm_writeDepthClamp:czm_writeDepthClamp,czm_writeLogDepth:czm_writeLogDepth,czm_writeNonPerspective:czm_writeNonPerspective,czm_XYZToRGB:czm_XYZToRGB};function removeComments(e){return(e=e.replace(/\/\/.*/g,"")).replace(/\/\*\*[\s\S]*?\*\//gm,(function(e){for(var t=e.match(/\n/gm).length,i="",r=0;r<t;++r)i+="\n";return i}))}function getDependencyNode(e,t,i){for(var r,n=0;n<i.length;++n)i[n].name===e&&(r=i[n]);return defined(r)||(r={name:e,glslSource:t=removeComments(t),dependsOn:[],requiredBy:[],evaluated:!1},i.push(r)),r}function generateDependencies(e,t){if(!e.evaluated){e.evaluated=!0;var i=e.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);defined(i)&&null!==i&&(i=i.filter((function(e,t){return i.indexOf(e)===t}))).forEach((function(i){if(i!==e.name&&ShaderSource._czmBuiltinsAndUniforms.hasOwnProperty(i)){var r=getDependencyNode(i,ShaderSource._czmBuiltinsAndUniforms[i],t);e.dependsOn.push(r),r.requiredBy.push(e),generateDependencies(r,t)}}))}}function sortDependencies(e){for(var t=[],i=[];e.length>0;){var r=e.pop();i.push(r),0===r.requiredBy.length&&t.push(r)}for(;t.length>0;){var n=t.shift();e.push(n);for(var a=0;a<n.dependsOn.length;++a){var o=n.dependsOn[a],s=o.requiredBy.indexOf(n);o.requiredBy.splice(s,1),0===o.requiredBy.length&&t.push(o)}}for(var l=0;l<i.length;++l)i[l].requiredBy.length}function getBuiltinsAndAutomaticUniforms(e){var t=[],i=getDependencyNode("main",e,t);generateDependencies(i,t),sortDependencies(t);for(var r="",n=t.length-1;n>=0;--n)r=r+t[n].glslSource+"\n";return r.replace(i.glslSource,"")}function combineShader(e,t,i){var r,n,a,o="",s=e.sources;if(defined(s))for(r=0,n=s.length;r<n;++r)o+="\n#line 0\n"+s[r];o=(o=removeComments(o)).replace(/#version\s+(.*?)\n/gm,(function(e,t){return a=t,"\n"}));var l=[];o=(o=o.replace(/#extension.*\n/gm,(function(e){return l.push(e),"\n"}))).replace(/precision\s(lowp|mediump|highp)\s(float|int);/,"");var c=e.pickColorQualifier;defined(c)&&(o=ShaderSource.createPickFragmentShaderSource(o,c));var u="";defined(a)&&(u="#version "+a+"\n");var d=l.length;for(r=0;r<d;r++)u+=l[r];t&&(u+="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n #define highp mediump\n#endif\n\n");var h=e.defines;if(defined(h))for(r=0,n=h.length;r<n;++r){var p=h[r];0!==p.length&&(u+="#define "+p+"\n")}return i.webgl2&&(u+="#define OUTPUT_DECLARATION\n\n"),i.textureFloatLinear&&(u+="#define OES_texture_float_linear\n\n"),i.floatingPointTexture&&(u+="#define OES_texture_float\n\n"),e.includeBuiltIns&&(u+=getBuiltinsAndAutomaticUniforms(o)),u+="\n#line 0\n",u+=o,i.webgl2&&(u=modernizeShader(u,t)),u}function ShaderSource(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).pickColorQualifier;this.defines=defined(e.defines)?e.defines.slice(0):[],this.sources=defined(e.sources)?e.sources.slice(0):[],this.pickColorQualifier=t,this.includeBuiltIns=defaultValue(e.includeBuiltIns,!0)}for(var builtinName in ShaderSource.prototype.clone=function(){return new ShaderSource({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})},ShaderSource.replaceMain=function(e,t){return t="void "+t+"()",e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)},ShaderSource.prototype.createCombinedVertexShader=function(e){return combineShader(this,!1,e)},ShaderSource.prototype.createCombinedFragmentShader=function(e){return combineShader(this,!0,e)},ShaderSource._czmBuiltinsAndUniforms={},CzmBuiltins)CzmBuiltins.hasOwnProperty(builtinName)&&(ShaderSource._czmBuiltinsAndUniforms[builtinName]=CzmBuiltins[builtinName]);for(var uniformName in AutomaticUniforms)if(AutomaticUniforms.hasOwnProperty(uniformName)){var uniform=AutomaticUniforms[uniformName];"function"==typeof uniform.getDeclaration&&(ShaderSource._czmBuiltinsAndUniforms[uniformName]=uniform.getDeclaration(uniformName))}ShaderSource.createPickVertexShaderSource=function(e){return ShaderSource.replaceMain(e,"czm_old_main")+"\nattribute vec4 pickColor; \nvarying vec4 czm_pickColor; \nvoid main() \n{ \n czm_old_main(); \n czm_pickColor = pickColor; \n}"},ShaderSource.createPickFragmentShaderSource=function(e,t){return ShaderSource.replaceMain(e,"czm_old_main")+"\n"+(t+" vec4 czm_pickColor; \nvoid main() \n{ \n czm_old_main(); \n if (gl_FragColor.a == 0.0) { \n discard; \n } \n gl_FragColor = czm_pickColor; \n}")},ShaderSource.findVarying=function(e,t){for(var i=e.sources,r=t.length,n=0;n<r;++n)for(var a=t[n],o=i.length,s=0;s<o;++s)if(-1!==i[s].indexOf(a))return a};var normalVaryingNames=["v_normalEC","v_normal"];ShaderSource.findNormalVarying=function(e){return ShaderSource.findVarying(e,normalVaryingNames)};var positionVaryingNames=["v_positionEC"];ShaderSource.findPositionVarying=function(e){return ShaderSource.findVarying(e,positionVaryingNames)};var ShadowVolumeAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute float batchId;\n#ifdef EXTRUDED_GEOMETRY\nattribute vec3 extrudeDirection;\nuniform float u_globeMinimumAltitude;\n#endif // EXTRUDED_GEOMETRY\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif // PER_INSTANCE_COLOR\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nvarying vec4 v_sphericalExtents;\n#else // SPHERICAL\nvarying vec2 v_inversePlaneExtents;\nvarying vec4 v_westPlane;\nvarying vec4 v_southPlane;\n#endif // SPHERICAL\nvarying vec3 v_uvMinAndSphericalLongitudeRotation;\nvarying vec3 v_uMaxAndInverseDistance;\nvarying vec3 v_vMaxAndInverseDistance;\n#endif // TEXTURE_COORDINATES\nvoid main()\n{\nvec4 position = czm_computePosition();\n#ifdef EXTRUDED_GEOMETRY\nfloat delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz));\ndelta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0;\nposition = position + vec4(extrudeDirection * delta, 0.0);\n#endif\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nv_sphericalExtents = czm_batchTable_sphericalExtents(batchId);\nv_uvMinAndSphericalLongitudeRotation.z = czm_batchTable_longitudeRotation(batchId);\n#else // SPHERICAL\n#ifdef COLUMBUS_VIEW_2D\nvec4 planes2D_high = czm_batchTable_planes2D_HIGH(batchId);\nvec4 planes2D_low = czm_batchTable_planes2D_LOW(batchId);\nvec2 idlSplitNewPlaneHiLow = vec2(EAST_MOST_X_HIGH - (WEST_MOST_X_HIGH - planes2D_high.w), EAST_MOST_X_LOW - (WEST_MOST_X_LOW - planes2D_low.w));\nbool idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y > 0.0;\nplanes2D_high.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.w);\nplanes2D_low.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.w);\nidlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y < 0.0;\nidlSplitNewPlaneHiLow = vec2(WEST_MOST_X_HIGH - (EAST_MOST_X_HIGH - planes2D_high.x), WEST_MOST_X_LOW - (EAST_MOST_X_LOW - planes2D_low.x));\nplanes2D_high.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.x);\nplanes2D_low.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.x);\nvec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.xy), vec3(0.0, planes2D_low.xy))).xyz;\nvec3 northWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.x, planes2D_high.z), vec3(0.0, planes2D_low.x, planes2D_low.z))).xyz;\nvec3 southEastCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.w, planes2D_high.y), vec3(0.0, planes2D_low.w, planes2D_low.y))).xyz;\n#else // COLUMBUS_VIEW_2D\nvec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(czm_batchTable_southWest_HIGH(batchId), czm_batchTable_southWest_LOW(batchId))).xyz;\nvec3 northWestCorner = czm_normal * czm_batchTable_northward(batchId) + southWestCorner;\nvec3 southEastCorner = czm_normal * czm_batchTable_eastward(batchId) + southWestCorner;\n#endif // COLUMBUS_VIEW_2D\nvec3 eastWard = southEastCorner - southWestCorner;\nfloat eastExtent = length(eastWard);\neastWard /= eastExtent;\nvec3 northWard = northWestCorner - southWestCorner;\nfloat northExtent = length(northWard);\nnorthWard /= northExtent;\nv_westPlane = vec4(eastWard, -dot(eastWard, southWestCorner));\nv_southPlane = vec4(northWard, -dot(northWard, southWestCorner));\nv_inversePlaneExtents = vec2(1.0 / eastExtent, 1.0 / northExtent);\n#endif // SPHERICAL\nvec4 uvMinAndExtents = czm_batchTable_uvMinAndExtents(batchId);\nvec4 uMaxVmax = czm_batchTable_uMaxVmax(batchId);\nv_uMaxAndInverseDistance = vec3(uMaxVmax.xy, uvMinAndExtents.z);\nv_vMaxAndInverseDistance = vec3(uMaxVmax.zw, uvMinAndExtents.w);\nv_uvMinAndSphericalLongitudeRotation.xy = uvMinAndExtents.xy;\n#endif // TEXTURE_COORDINATES\n#ifdef PER_INSTANCE_COLOR\nv_color = czm_batchTable_color(batchId);\n#endif\ngl_Position = czm_depthClamp(czm_modelViewProjectionRelativeToEye * position);\n}\n",ShadowVolumeFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\nvoid main(void)\n{\n#ifdef VECTOR_TILE\ngl_FragColor = czm_gammaCorrect(u_highlightColor);\n#else\ngl_FragColor = vec4(1.0);\n#endif\nczm_writeDepthClamp();\n}\n",ClassificationType={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2,NUMBER_OF_CLASSIFICATION_TYPES:3},ClassificationType$1=Object.freeze(ClassificationType),DepthFunction={NEVER:WebGLConstants$1.NEVER,LESS:WebGLConstants$1.LESS,EQUAL:WebGLConstants$1.EQUAL,LESS_OR_EQUAL:WebGLConstants$1.LEQUAL,GREATER:WebGLConstants$1.GREATER,NOT_EQUAL:WebGLConstants$1.NOTEQUAL,GREATER_OR_EQUAL:WebGLConstants$1.GEQUAL,ALWAYS:WebGLConstants$1.ALWAYS},DepthFunction$1=Object.freeze(DepthFunction),BufferUsage={STREAM_DRAW:WebGLConstants$1.STREAM_DRAW,STATIC_DRAW:WebGLConstants$1.STATIC_DRAW,DYNAMIC_DRAW:WebGLConstants$1.DYNAMIC_DRAW,validate:function(e){return e===BufferUsage.STREAM_DRAW||e===BufferUsage.STATIC_DRAW||e===BufferUsage.DYNAMIC_DRAW}},BufferUsage$1=Object.freeze(BufferUsage);function Buffer$1(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context._gl,i=e.bufferTarget,r=e.typedArray,n=e.sizeInBytes,a=e.usage,o=defined(r);o&&(n=r.byteLength);var s=t.createBuffer();t.bindBuffer(i,s),t.bufferData(i,o?r:n,a),t.bindBuffer(i,null),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=i,this._sizeInBytes=n,this._usage=a,this._buffer=s,this.vertexArrayDestroyable=!0}function addAttribute(e,t,i,r){var n=defined(t.vertexBuffer),a=defined(t.value),o=t.value?t.value.length:t.componentsPerAttribute,s={index:defaultValue(t.index,i),enabled:defaultValue(t.enabled,!0),vertexBuffer:t.vertexBuffer,value:a?t.value.slice(0):void 0,componentsPerAttribute:o,componentDatatype:defaultValue(t.componentDatatype,ComponentDatatype$1.FLOAT),normalize:defaultValue(t.normalize,!1),offsetInBytes:defaultValue(t.offsetInBytes,0),strideInBytes:defaultValue(t.strideInBytes,0),instanceDivisor:defaultValue(t.instanceDivisor,0)};if(n)s.vertexAttrib=function(e){var t=this.index;e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer._getBuffer()),e.vertexAttribPointer(t,this.componentsPerAttribute,this.componentDatatype,this.normalize,this.strideInBytes,this.offsetInBytes),e.enableVertexAttribArray(t),this.instanceDivisor>0&&(r.glVertexAttribDivisor(t,this.instanceDivisor),r._vertexAttribDivisors[t]=this.instanceDivisor,r._previousDrawInstanced=!0)},s.disableVertexAttribArray=function(e){e.disableVertexAttribArray(this.index),this.instanceDivisor>0&&r.glVertexAttribDivisor(i,0)};else{switch(s.componentsPerAttribute){case 1:s.vertexAttrib=function(e){e.vertexAttrib1fv(this.index,this.value)};break;case 2:s.vertexAttrib=function(e){e.vertexAttrib2fv(this.index,this.value)};break;case 3:s.vertexAttrib=function(e){e.vertexAttrib3fv(this.index,this.value)};break;case 4:s.vertexAttrib=function(e){e.vertexAttrib4fv(this.index,this.value)}}s.disableVertexAttribArray=function(e){}}e.push(s)}function bind(e,t,i){for(var r=0;r<t.length;++r){var n=t[r];n.enabled&&n.vertexAttrib(e)}defined(i)&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i._getBuffer())}function VertexArray(e){var t,i,r=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,n=r._gl,a=e.attributes,o=e.indexBuffer,s=[],l=1,c=!1,u=!1,d=a.length;for(t=0;t<d;++t)addAttribute(s,a[t],t,r);for(d=s.length,t=0;t<d;++t){var h=s[t];if(defined(h.vertexBuffer)&&0===h.instanceDivisor){var p=h.strideInBytes||h.componentsPerAttribute*ComponentDatatype$1.getSizeInBytes(h.componentDatatype);l=h.vertexBuffer.sizeInBytes/p;break}}for(t=0;t<d;++t)s[t].instanceDivisor>0&&(c=!0),defined(s[t].value)&&(u=!0);r.vertexArrayObject&&(i=r.glCreateVertexArray(),r.glBindVertexArray(i),bind(n,s,o),r.glBindVertexArray(null)),this._numberOfVertices=l,this._hasInstancedAttributes=c,this._hasConstantAttributes=u,this._context=r,this._gl=n,this._vao=i,this._attributes=s,this._indexBuffer=o}function computeNumberOfVertices(e){return e.values.length/e.componentsPerAttribute}function computeAttributeSizeInBytes(e){return ComponentDatatype$1.getSizeInBytes(e.componentDatatype)*e.componentsPerAttribute}function interleaveAttributes(e){var t,i,r,n,a=[];for(i in e)e.hasOwnProperty(i)&&defined(e[i])&&defined(e[i].values)&&(a.push(i),e[i].componentDatatype===ComponentDatatype$1.DOUBLE&&(e[i].componentDatatype=ComponentDatatype$1.FLOAT,e[i].values=ComponentDatatype$1.createTypedArray(ComponentDatatype$1.FLOAT,e[i].values)));var o=a.length;if(o>0)for(n=computeNumberOfVertices(e[a[0]]),t=1;t<o;++t){var s=computeNumberOfVertices(e[a[t]]);if(s!==n)throw new RuntimeError("Each attribute list must have the same number of vertices. Attribute "+a[t]+" has a different number of vertices ("+s.toString()+") than attribute "+a[0]+" ("+n.toString()+").")}a.sort((function(t,i){return ComponentDatatype$1.getSizeInBytes(e[i].componentDatatype)-ComponentDatatype$1.getSizeInBytes(e[t].componentDatatype)}));var l=0,c={};for(t=0;t<o;++t)i=a[t],r=e[i],c[i]=l,l+=computeAttributeSizeInBytes(r);if(l>0){var u=ComponentDatatype$1.getSizeInBytes(e[a[0]].componentDatatype),d=l%u;0!==d&&(l+=u-d);var h=new ArrayBuffer(n*l),p={};for(t=0;t<o;++t){i=a[t];var f=ComponentDatatype$1.getSizeInBytes(e[i].componentDatatype);p[i]={pointer:ComponentDatatype$1.createTypedArray(e[i].componentDatatype,h),index:c[i]/f,strideInComponentType:l/f}}for(t=0;t<n;++t)for(var m=0;m<o;++m){i=a[m];for(var g=(r=e[i]).values,_=p[i],y=_.pointer,v=r.componentsPerAttribute,C=0;C<v;++C)y[_.index+C]=g[t*v+C];_.index+=_.strideInComponentType}return{buffer:h,offsetsInBytes:c,vertexSizeInBytes:l}}}function setVertexAttribDivisor(e){var t=e._context,i=e._hasInstancedAttributes;if(i||t._previousDrawInstanced){t._previousDrawInstanced=i;var r,n=t._vertexAttribDivisors,a=e._attributes,o=ContextLimits.maximumVertexAttributes;if(i){var s=a.length;for(r=0;r<s;++r){var l=a[r];if(l.enabled){var c=l.instanceDivisor,u=l.index;c!==n[u]&&(t.glVertexAttribDivisor(u,c),n[u]=c)}}}else for(r=0;r<o;++r)n[r]>0&&(t.glVertexAttribDivisor(r,0),n[r]=0)}}function setConstantAttributes(e,t){for(var i=e._attributes,r=i.length,n=0;n<r;++n){var a=i[n];a.enabled&&defined(a.value)&&a.vertexAttrib(t)}}function BatchTable(e,t,i){if(this._attributes=t,this._numberOfInstances=i,0!==t.length){var r=getDatatype(t),n=e.floatingPointTexture,a=r===PixelDatatype$1.FLOAT&&!n,o=createOffsets(t,a),s=getStride(o,t,a),l=Math.floor(ContextLimits.maximumTextureSize/s),c=Math.min(i,l),u=s*c,d=Math.ceil(i/c),h=1/u,p=.5*h,f=1/d,m=.5*f;this._textureDimensions=new Cartesian2(u,d),this._textureStep=new Cartesian4(h,p,f,m),this._pixelDatatype=a?PixelDatatype$1.UNSIGNED_BYTE:r,this._packFloats=a,this._offsets=o,this._stride=s,this._texture=void 0;var g=4*u*d;this._batchValues=r!==PixelDatatype$1.FLOAT||a?new Uint8Array(g):new Float32Array(g),this._batchValuesDirty=!1}}function getDatatype(e){for(var t=!1,i=e.length,r=0;r<i;++r)if(e[r].componentDatatype!==ComponentDatatype$1.UNSIGNED_BYTE){t=!0;break}return t?PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE}function getAttributeType(e,t){var i=e[t].componentsPerAttribute;return 2===i?Cartesian2:3===i?Cartesian3:4===i?Cartesian4:Number}function createOffsets(e,t){for(var i=new Array(e.length),r=0,n=e.length,a=0;a<n;++a){var o=e[a].componentDatatype;i[a]=r,o!==ComponentDatatype$1.UNSIGNED_BYTE&&t?r+=4:++r}return i}function getStride(e,t,i){var r=e.length,n=e[r-1];return t[r-1].componentDatatype!==ComponentDatatype$1.UNSIGNED_BYTE&&i?n+4:n+1}Buffer$1.createVertexBuffer=function(e){return new Buffer$1({context:e.context,bufferTarget:WebGLConstants$1.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})},Buffer$1.createIndexBuffer=function(e){var t=e.context,i=e.indexDatatype,r=IndexDatatype$1.getSizeInBytes(i),n=new Buffer$1({context:t,bufferTarget:WebGLConstants$1.ELEMENT_ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage}),a=n.sizeInBytes/r;return Object.defineProperties(n,{indexDatatype:{get:function(){return i}},bytesPerIndex:{get:function(){return r}},numberOfIndices:{get:function(){return a}}}),n},Object.defineProperties(Buffer$1.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}}),Buffer$1.prototype._getBuffer=function(){return this._buffer},Buffer$1.prototype.copyFromArrayView=function(e,t){t=defaultValue(t,0);var i=this._gl,r=this._bufferTarget;i.bindBuffer(r,this._buffer),i.bufferSubData(r,t,e),i.bindBuffer(r,null)},Buffer$1.prototype.copyFromBuffer=function(e,t,i,r){var n=WebGLConstants$1.COPY_READ_BUFFER,a=WebGLConstants$1.COPY_WRITE_BUFFER,o=this._gl;o.bindBuffer(a,this._buffer),o.bindBuffer(n,e._buffer),o.copyBufferSubData(n,a,t,i,r),o.bindBuffer(a,null),o.bindBuffer(n,null)},Buffer$1.prototype.getBufferData=function(e,t,i,r){t=defaultValue(t,0),i=defaultValue(i,0);var n=this._gl,a=WebGLConstants$1.COPY_READ_BUFFER;n.bindBuffer(a,this._buffer),n.getBufferSubData(a,t,e,i,r),n.bindBuffer(a,null)},Buffer$1.prototype.isDestroyed=function(){return!1},Buffer$1.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),destroyObject(this)},VertexArray.fromGeometry=function(e){var t,i,r,n,a=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,o=defaultValue(e.geometry,defaultValue.EMPTY_OBJECT),s=defaultValue(e.bufferUsage,BufferUsage$1.DYNAMIC_DRAW),l=defaultValue(e.attributeLocations,defaultValue.EMPTY_OBJECT),c=defaultValue(e.interleave,!1),u=e.vertexArrayAttributes,d=defined(u)?u:[],h=o.attributes;if(c){var p=interleaveAttributes(h);if(defined(p)){r=Buffer$1.createVertexBuffer({context:a,typedArray:p.buffer,usage:s});var f=p.offsetsInBytes,m=p.vertexSizeInBytes;for(t in h)h.hasOwnProperty(t)&&defined(h[t])&&(defined((i=h[t]).values)?d.push({index:l[t],vertexBuffer:r,componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,offsetInBytes:f[t],strideInBytes:m}):d.push({index:l[t],value:i.value,componentDatatype:i.componentDatatype,normalize:i.normalize}))}}else for(t in h)if(h.hasOwnProperty(t)&&defined(h[t])){var g=(i=h[t]).componentDatatype;g===ComponentDatatype$1.DOUBLE&&(g=ComponentDatatype$1.FLOAT),r=void 0,defined(i.values)&&(r=Buffer$1.createVertexBuffer({context:a,typedArray:ComponentDatatype$1.createTypedArray(g,i.values),usage:s})),d.push({index:l[t],vertexBuffer:r,value:i.value,componentDatatype:g,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize})}var _=o.indices;return defined(_)&&(n=Geometry.computeNumberOfVertices(o)>=CesiumMath.SIXTY_FOUR_KILOBYTES&&a.elementIndexUint?Buffer$1.createIndexBuffer({context:a,typedArray:new Uint32Array(_),usage:s,indexDatatype:IndexDatatype$1.UNSIGNED_INT}):Buffer$1.createIndexBuffer({context:a,typedArray:new Uint16Array(_),usage:s,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT})),new VertexArray({context:a,attributes:d,indexBuffer:n})},Object.defineProperties(VertexArray.prototype,{numberOfAttributes:{get:function(){return this._attributes.length}},numberOfVertices:{get:function(){return this._numberOfVertices}},indexBuffer:{get:function(){return this._indexBuffer}}}),VertexArray.prototype.getAttribute=function(e){return this._attributes[e]},VertexArray.prototype._bind=function(){defined(this._vao)?(this._context.glBindVertexArray(this._vao),this._context.instancedArrays&&setVertexAttribDivisor(this),this._hasConstantAttributes&&setConstantAttributes(this,this._gl)):bind(this._gl,this._attributes,this._indexBuffer)},VertexArray.prototype._unBind=function(){if(defined(this._vao))this._context.glBindVertexArray(null);else{for(var e=this._attributes,t=this._gl,i=0;i<e.length;++i){var r=e[i];r.enabled&&r.disableVertexAttribArray(t)}this._indexBuffer&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}},VertexArray.prototype.isDestroyed=function(){return!1},VertexArray.prototype.destroy=function(){for(var e=this._attributes,t=0;t<e.length;++t){var i=e[t].vertexBuffer;defined(i)&&!i.isDestroyed()&&i.vertexArrayDestroyable&&i.destroy()}var r=this._indexBuffer;return defined(r)&&!r.isDestroyed()&&r.vertexArrayDestroyable&&r.destroy(),defined(this._vao)&&this._context.glDeleteVertexArray(this._vao),destroyObject(this)},Object.defineProperties(BatchTable.prototype,{attributes:{get:function(){return this._attributes}},numberOfInstances:{get:function(){return this._numberOfInstances}}});var scratchPackedFloatCartesian4=new Cartesian4;function getPackedFloat(e,t,i){var r=Cartesian4.unpack(e,t,scratchPackedFloatCartesian4),n=Cartesian4.unpackFloat(r);r=Cartesian4.unpack(e,t+4,scratchPackedFloatCartesian4);var a=Cartesian4.unpackFloat(r);r=Cartesian4.unpack(e,t+8,scratchPackedFloatCartesian4);var o=Cartesian4.unpackFloat(r);r=Cartesian4.unpack(e,t+12,scratchPackedFloatCartesian4);var s=Cartesian4.unpackFloat(r);return Cartesian4.fromElements(n,a,o,s,i)}function setPackedAttribute(e,t,i){var r=Cartesian4.packFloat(e.x,scratchPackedFloatCartesian4);Cartesian4.pack(r,t,i),r=Cartesian4.packFloat(e.y,r),Cartesian4.pack(r,t,i+4),r=Cartesian4.packFloat(e.z,r),Cartesian4.pack(r,t,i+8),r=Cartesian4.packFloat(e.w,r),Cartesian4.pack(r,t,i+12)}var scratchGetAttributeCartesian4$1=new Cartesian4;BatchTable.prototype.getBatchedAttribute=function(e,t,i){var r,n=this._attributes,a=this._offsets[t],o=4*this._stride*e+4*a;r=this._packFloats&&n[t].componentDatatype!==PixelDatatype$1.UNSIGNED_BYTE?getPackedFloat(this._batchValues,o,scratchGetAttributeCartesian4$1):Cartesian4.unpack(this._batchValues,o,scratchGetAttributeCartesian4$1);var s=getAttributeType(n,t);return defined(s.fromCartesian4)?s.fromCartesian4(r,i):defined(s.clone)?s.clone(r,i):r.x};var setAttributeScratchValues=[void 0,void 0,new Cartesian2,new Cartesian3,new Cartesian4],setAttributeScratchCartesian4=new Cartesian4;function createTexture$5(e,t){var i=e._textureDimensions;e._texture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:e._pixelDatatype,width:i.x,height:i.y,sampler:Sampler.NEAREST,flipY:!1})}function updateTexture(e){var t=e._textureDimensions;e._texture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}function getGlslComputeSt$1(e){var t=e._stride;return 1===e._textureDimensions.y?"uniform vec4 batchTextureStep; \nvec2 computeSt(float batchId) \n{ \n float stepX = batchTextureStep.x; \n float centerX = batchTextureStep.y; \n float numberOfAttributes = float("+t+"); \n return vec2(centerX + (batchId * numberOfAttributes * stepX), 0.5); \n} \n":"uniform vec4 batchTextureStep; \nuniform vec2 batchTextureDimensions; \nvec2 computeSt(float batchId) \n{ \n float stepX = batchTextureStep.x; \n float centerX = batchTextureStep.y; \n float stepY = batchTextureStep.z; \n float centerY = batchTextureStep.w; \n float numberOfAttributes = float("+t+"); \n float xId = mod(batchId * numberOfAttributes, batchTextureDimensions.x); \n float yId = floor(batchId * numberOfAttributes / batchTextureDimensions.x); \n return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); \n} \n"}function getComponentType(e){return 1===e?"float":"vec"+e}function getComponentSwizzle(e){return 1===e?".x":2===e?".xy":3===e?".xyz":""}function getGlslAttributeFunction(e,t){var i=e._attributes[t],r=i.componentsPerAttribute,n=i.functionName,a=getComponentType(r),o=getComponentSwizzle(r),s=a+" "+n+"(float batchId) \n{ \n vec2 st = computeSt(batchId); \n st.x += batchTextureStep.x * float("+e._offsets[t]+"); \n";return e._packFloats&&i.componentDatatype!==PixelDatatype$1.UNSIGNED_BYTE?s+="vec4 textureValue; \ntextureValue.x = czm_unpackFloat(texture2D(batchTexture, st)); \ntextureValue.y = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x, 0.0))); \ntextureValue.z = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0))); \ntextureValue.w = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0))); \n":s+=" vec4 textureValue = texture2D(batchTexture, st); \n",s+=" "+a+" value = textureValue"+o+"; \n",e._pixelDatatype!==PixelDatatype$1.UNSIGNED_BYTE||i.componentDatatype!==ComponentDatatype$1.UNSIGNED_BYTE||i.normalize?e._pixelDatatype===PixelDatatype$1.FLOAT&&i.componentDatatype===ComponentDatatype$1.UNSIGNED_BYTE&&i.normalize&&(s+="value /= 255.0; \n"):s+="value *= 255.0; \n",s+=" return value; \n} \n"}function transformToWorldCoordinates(e,t,i){var r,n=!i,a=e.length;if(!n&&a>1){var o=e[0].modelMatrix;for(r=1;r<a;++r)if(!Matrix4.equals(o,e[r].modelMatrix)){n=!0;break}}if(n)for(r=0;r<a;++r)defined(e[r].geometry)&&GeometryPipeline.transformToWorldCoordinates(e[r]);else Matrix4.multiplyTransformation(t,e[0].modelMatrix,t)}function addGeometryBatchId(e,t){var i=e.attributes,r=i.position,n=r.values.length/r.componentsPerAttribute;i.batchId=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:1,values:new Float32Array(n)});for(var a=i.batchId.values,o=0;o<n;++o)a[o]=t}function addBatchIds(e){for(var t=e.length,i=0;i<t;++i){var r=e[i];defined(r.geometry)?addGeometryBatchId(r.geometry,i):defined(r.westHemisphereGeometry)&&defined(r.eastHemisphereGeometry)&&(addGeometryBatchId(r.westHemisphereGeometry,i),addGeometryBatchId(r.eastHemisphereGeometry,i))}}function geometryPipeline(e){var t,i,r=e.instances,n=e.projection,a=e.elementIndexUintSupported,o=e.scene3DOnly,s=e.vertexCacheOptimize,l=e.compressVertices,c=e.modelMatrix,u=r.length;for(t=0;t<u;++t)if(defined(r[t].geometry)){r[t].geometry.primitiveType;break}if(transformToWorldCoordinates(r,c,o),!o)for(t=0;t<u;++t)defined(r[t].geometry)&&GeometryPipeline.splitLongitude(r[t]);if(addBatchIds(r),s)for(t=0;t<u;++t){var d=r[t];defined(d.geometry)?(GeometryPipeline.reorderForPostVertexCache(d.geometry),GeometryPipeline.reorderForPreVertexCache(d.geometry)):defined(d.westHemisphereGeometry)&&defined(d.eastHemisphereGeometry)&&(GeometryPipeline.reorderForPostVertexCache(d.westHemisphereGeometry),GeometryPipeline.reorderForPreVertexCache(d.westHemisphereGeometry),GeometryPipeline.reorderForPostVertexCache(d.eastHemisphereGeometry),GeometryPipeline.reorderForPreVertexCache(d.eastHemisphereGeometry))}var h=GeometryPipeline.combineInstances(r);for(u=h.length,t=0;t<u;++t){var p,f=(i=h[t]).attributes;if(o)for(p in f)f.hasOwnProperty(p)&&f[p].componentDatatype===ComponentDatatype$1.DOUBLE&&GeometryPipeline.encodeAttribute(i,p,p+"3DHigh",p+"3DLow");else for(p in f)if(f.hasOwnProperty(p)&&f[p].componentDatatype===ComponentDatatype$1.DOUBLE){var m=p+"3D",g=p+"2D";GeometryPipeline.projectTo2D(i,p,m,g,n),defined(i.boundingSphere)&&"position"===p&&(i.boundingSphereCV=BoundingSphere.fromVertices(i.attributes.position2D.values)),GeometryPipeline.encodeAttribute(i,m,m+"High",m+"Low"),GeometryPipeline.encodeAttribute(i,g,g+"High",g+"Low")}l&&GeometryPipeline.compressVertices(i)}if(!a){var _=[];for(u=h.length,t=0;t<u;++t)i=h[t],_=_.concat(GeometryPipeline.fitToUnsignedShortIndices(i));h=_}return h}function createPickOffsets(e,t,i,r){var n,a,o,s=r.length-1;if(s>=0){var l=r[s];n=l.offset+l.count,a=i[o=l.index].indices.length}else n=0,a=i[o=0].indices.length;for(var c=e.length,u=0;u<c;++u){var d=e[u][t];if(defined(d)){var h=d.indices.length;n+h>a&&(n=0,a=i[++o].indices.length),r.push({index:o,offset:n,count:h}),n+=h}}}function createInstancePickOffsets(e,t){var i=[];return createPickOffsets(e,"geometry",t,i),createPickOffsets(e,"westHemisphereGeometry",t,i),createPickOffsets(e,"eastHemisphereGeometry",t,i),i}BatchTable.prototype.setBatchedAttribute=function(e,t,i){var r=this._attributes,n=setAttributeScratchValues[r[t].componentsPerAttribute],a=this.getBatchedAttribute(e,t,n),o=getAttributeType(this._attributes,t);if(!(defined(o.equals)?o.equals(a,i):a===i)){var s=setAttributeScratchCartesian4;s.x=defined(i.x)?i.x:i,s.y=defined(i.y)?i.y:0,s.z=defined(i.z)?i.z:0,s.w=defined(i.w)?i.w:0;var l=this._offsets[t],c=4*this._stride*e+4*l;this._packFloats&&r[t].componentDatatype!==PixelDatatype$1.UNSIGNED_BYTE?setPackedAttribute(s,this._batchValues,c):Cartesian4.pack(s,this._batchValues,c),this._batchValuesDirty=!0}},BatchTable.prototype.update=function(e){defined(this._texture)&&!this._batchValuesDirty||0===this._attributes.length||(this._batchValuesDirty=!1,defined(this._texture)||createTexture$5(this,e.context),updateTexture(this))},BatchTable.prototype.getUniformMapCallback=function(){var e=this;return function(t){return 0===e._attributes.length?t:combine$2(t,{batchTexture:function(){return e._texture},batchTextureDimensions:function(){return e._textureDimensions},batchTextureStep:function(){return e._textureStep}})}},BatchTable.prototype.getVertexShaderCallback=function(){var e=this._attributes;if(0===e.length)return function(e){return e};var t="uniform highp sampler2D batchTexture; \n";t+=getGlslComputeSt$1(this)+"\n";for(var i=e.length,r=0;r<i;++r)t+=getGlslAttributeFunction(this,r);return function(e){var i=e.indexOf("void main"),r=e.substring(0,i),n=e.substring(i);return r+"\n"+t+"\n"+n}},BatchTable.prototype.isDestroyed=function(){return!1},BatchTable.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),destroyObject(this)};var PrimitivePipeline={};function transferGeometry(e,t){var i=e.attributes;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];defined(n)&&defined(n.values)&&t.push(n.values.buffer)}defined(e.indices)&&t.push(e.indices.buffer)}function transferGeometries(e,t){for(var i=e.length,r=0;r<i;++r)transferGeometry(e[r],t)}function countCreateGeometryResults(e){for(var t=1,i=e.length,r=0;r<i;r++){var n=e[r];if(++t,defined(n)){var a=n.attributes;for(var o in t+=7+2*BoundingSphere.packedLength+(defined(n.indices)?n.indices.length:0),a){if(a.hasOwnProperty(o)&&defined(a[o]))t+=5+a[o].values.length}}}return t}function packInstancesForCombine(e,t){var i=e.length,r=new Float64Array(1+19*i),n=0;r[n++]=i;for(var a=0;a<i;a++){var o=e[a];if(Matrix4.pack(o.modelMatrix,r,n),n+=Matrix4.packedLength,defined(o.attributes)&&defined(o.attributes.offset)){var s=o.attributes.offset.value;r[n]=s[0],r[n+1]=s[1],r[n+2]=s[2]}n+=3}return t.push(r.buffer),r}function unpackInstancesForCombine(e){for(var t=e,i=new Array(t[0]),r=0,n=1;n<t.length;){var a,o=Matrix4.unpack(t,n);defined(t[n+=Matrix4.packedLength])&&(a={offset:new OffsetGeometryInstanceAttribute(t[n],t[n+1],t[n+2])}),n+=3,i[r++]={modelMatrix:o,attributes:a}}return i}function packBoundingSpheres(e){var t=e.length,i=1+(BoundingSphere.packedLength+1)*t,r=new Float32Array(i),n=0;r[n++]=t;for(var a=0;a<t;++a){defined(e[a])?(r[n++]=1,BoundingSphere.pack(e[a],r,n)):r[n++]=0,n+=BoundingSphere.packedLength}return r}function unpackBoundingSpheres(e){for(var t=new Array(e[0]),i=0,r=1;r<e.length;)1===e[r++]&&(t[i]=BoundingSphere.unpack(e,r)),++i,r+=BoundingSphere.packedLength;return t}PrimitivePipeline.combineGeometry=function(e){var t,i,r,n,a=e.instances,o=a.length,s=!1;o>0&&((t=geometryPipeline(e)).length>0&&(i=GeometryPipeline.createAttributeLocations(t[0]),e.createPickOffsets&&(r=createInstancePickOffsets(a,t))),defined(a[0].attributes)&&defined(a[0].attributes.offset)&&(n=new Array(o),s=!0));for(var l=new Array(o),c=new Array(o),u=0;u<o;++u){var d=a[u],h=d.geometry;defined(h)&&(l[u]=h.boundingSphere,c[u]=h.boundingSphereCV,s&&(n[u]=d.geometry.offsetAttribute));var p=d.eastHemisphereGeometry,f=d.westHemisphereGeometry;defined(p)&&defined(f)&&(defined(p.boundingSphere)&&defined(f.boundingSphere)&&(l[u]=BoundingSphere.union(p.boundingSphere,f.boundingSphere)),defined(p.boundingSphereCV)&&defined(f.boundingSphereCV)&&(c[u]=BoundingSphere.union(p.boundingSphereCV,f.boundingSphereCV)))}return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:i,pickOffsets:r,offsetInstanceExtend:n,boundingSpheres:l,boundingSpheresCV:c}},PrimitivePipeline.packCreateGeometryResults=function(e,t){var i=new Float64Array(countCreateGeometryResults(e)),r=[],n={},a=e.length,o=0;i[o++]=a;for(var s=0;s<a;s++){var l=e[s],c=defined(l);if(i[o++]=c?1:0,c){i[o++]=l.primitiveType,i[o++]=l.geometryType,i[o++]=defaultValue(l.offsetAttribute,-1);var u=defined(l.boundingSphere)?1:0;i[o++]=u,u&&BoundingSphere.pack(l.boundingSphere,i,o),o+=BoundingSphere.packedLength;var d=defined(l.boundingSphereCV)?1:0;i[o++]=d,d&&BoundingSphere.pack(l.boundingSphereCV,i,o),o+=BoundingSphere.packedLength;var h=l.attributes,p=[];for(var f in h)h.hasOwnProperty(f)&&defined(h[f])&&(p.push(f),defined(n[f])||(n[f]=r.length,r.push(f)));i[o++]=p.length;for(var m=0;m<p.length;m++){var g=p[m],_=h[g];i[o++]=n[g],i[o++]=_.componentDatatype,i[o++]=_.componentsPerAttribute,i[o++]=_.normalize?1:0,i[o++]=_.values.length,i.set(_.values,o),o+=_.values.length}var y=defined(l.indices)?l.indices.length:0;i[o++]=y,y>0&&(i.set(l.indices,o),o+=y)}}return t.push(i.buffer),{stringTable:r,packedData:i}},PrimitivePipeline.unpackCreateGeometryResults=function(e){for(var t,i=e.stringTable,r=e.packedData,n=new Array(r[0]),a=0,o=1;o<r.length;){if(1===r[o++]){var s,l,c,u,d,h=r[o++],p=r[o++],f=r[o++];-1===f&&(f=void 0),1===r[o++]&&(s=BoundingSphere.unpack(r,o)),o+=BoundingSphere.packedLength,1===r[o++]&&(l=BoundingSphere.unpack(r,o)),o+=BoundingSphere.packedLength;var m,g=new GeometryAttributes,_=r[o++];for(t=0;t<_;t++){var y=i[r[o++]],v=r[o++];d=r[o++];var C=0!==r[o++];c=r[o++],u=ComponentDatatype$1.createTypedArray(v,c);for(var T=0;T<c;T++)u[T]=r[o++];g[y]=new GeometryAttribute({componentDatatype:v,componentsPerAttribute:d,normalize:C,values:u})}if((c=r[o++])>0){var S=u.length/d;for(m=IndexDatatype$1.createTypedArray(S,c),t=0;t<c;t++)m[t]=r[o++]}n[a++]=new Geometry({primitiveType:h,geometryType:p,boundingSphere:s,boundingSphereCV:l,indices:m,attributes:g,offsetAttribute:f})}else n[a++]=void 0}return n},PrimitivePipeline.packCombineGeometryParameters=function(e,t){for(var i=e.createGeometryResults,r=i.length,n=0;n<r;n++)t.push(i[n].packedData.buffer);return{createGeometryResults:e.createGeometryResults,packedInstances:packInstancesForCombine(e.instances,t),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof GeographicProjection,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets}},PrimitivePipeline.unpackCombineGeometryParameters=function(e){for(var t=unpackInstancesForCombine(e.packedInstances),i=e.createGeometryResults,r=i.length,n=0,a=0;a<r;a++)for(var o=PrimitivePipeline.unpackCreateGeometryResults(i[a]),s=o.length,l=0;l<s;l++){var c=o[l];t[n].geometry=c,++n}var u=Ellipsoid.clone(e.ellipsoid);return{instances:t,ellipsoid:u,projection:e.isGeographic?new GeographicProjection(u):new WebMercatorProjection(u),elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:Matrix4.clone(e.modelMatrix),createPickOffsets:e.createPickOffsets}},PrimitivePipeline.packCombineGeometryResults=function(e,t){defined(e.geometries)&&transferGeometries(e.geometries,t);var i=packBoundingSpheres(e.boundingSpheres),r=packBoundingSpheres(e.boundingSpheresCV);return t.push(i.buffer,r.buffer),{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:i,boundingSpheresCV:r}},PrimitivePipeline.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:unpackBoundingSpheres(e.boundingSpheres),boundingSpheresCV:unpackBoundingSpheres(e.boundingSpheresCV)}};var PrimitiveState={READY:0,CREATING:1,CREATED:2,COMBINING:3,COMBINED:4,COMPLETE:5,FAILED:6},PrimitiveState$1=Object.freeze(PrimitiveState),SceneMode={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3,getMorphTime:function(e){return e===SceneMode.SCENE3D?1:e!==SceneMode.MORPHING?0:void 0}},SceneMode$1=Object.freeze(SceneMode),ShadowMode={DISABLED:0,ENABLED:1,CAST_ONLY:2,RECEIVE_ONLY:3,NUMBER_OF_SHADOW_MODES:4,castShadows:function(e){return e===ShadowMode.ENABLED||e===ShadowMode.CAST_ONLY},receiveShadows:function(e){return e===ShadowMode.ENABLED||e===ShadowMode.RECEIVE_ONLY},fromCastReceive:function(e,t){return e&&t?ShadowMode.ENABLED:e?ShadowMode.CAST_ONLY:t?ShadowMode.RECEIVE_ONLY:ShadowMode.DISABLED}},ShadowMode$1=Object.freeze(ShadowMode);function Primitive$2(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this.appearance=e.appearance,this._appearance=void 0,this._material=void 0,this._isUpdateQuad=e.isUpdateQuad||0,this._tile=e.tile||void 0,this.depthFailAppearance=e.depthFailAppearance,this._depthFailAppearance=void 0,this._depthFailMaterial=void 0,this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=new Matrix4,this.show=defaultValue(e.show,!0),this._vertexCacheOptimize=defaultValue(e.vertexCacheOptimize,!1),this._interleave=defaultValue(e.interleave,!1),this._releaseGeometryInstances=defaultValue(e.releaseGeometryInstances,!0),this._allowPicking=defaultValue(e.allowPicking,!0),this._asynchronous=defaultValue(e.asynchronous,!0),this._compressVertices=defaultValue(e.compressVertices,!0),this.cull=defaultValue(e.cull,!0),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.rtcCenter=e.rtcCenter,this.shadows=defaultValue(e.shadows,ShadowMode$1.DISABLED),this._translucent=void 0,this._state=PrimitiveState$1.READY,this._geometries=[],this._error=void 0,this._numberOfInstances=0,this._boundingSpheres=[],this._boundingSphereWC=[],this._boundingSphereCV=[],this._boundingSphere2D=[],this._boundingSphereMorph=[],this._perInstanceAttributeCache=[],this._instanceIds=[],this._lastPerInstanceAttributeIndex=0,this._va=[],this._attributeLocations=void 0,this._primitiveType=void 0,this._frontFaceRS=void 0,this._backFaceRS=void 0,this._sp=void 0,this._depthFailAppearance=void 0,this._spDepthFail=void 0,this._frontFaceDepthFailRS=void 0,this._backFaceDepthFailRS=void 0,this._pickIds=[],this._colorCommands=[],this._pickCommands=[],this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._createRenderStatesFunction=e._createRenderStatesFunction,this._createShaderProgramFunction=e._createShaderProgramFunction,this._createCommandsFunction=e._createCommandsFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._createPickOffsets=e._createPickOffsets,this._pickOffsets=void 0,this._createGeometryResults=void 0,this._ready=!1,this._readyPromise=when.defer(),this._batchTable=void 0,this._batchTableAttributeIndices=void 0,this._offsetInstanceExtend=void 0,this._batchTableOffsetAttribute2DIndex=void 0,this._batchTableOffsetsUpdated=!1,this._instanceBoundingSpheres=void 0,this._instanceBoundingSpheresCV=void 0,this._tempBoundingSpheres=void 0,this._recomputeBoundingSpheres=!1,this._batchTableBoundingSpheresUpdated=!1,this._batchTableBoundingSphereAttributeIndices=void 0}function getCommonPerInstanceAttributeNames(e){var t,i=e.length,r=[],n=e[0].attributes;for(t in n)if(n.hasOwnProperty(t)&&defined(n[t])){for(var a=n[t],o=!0,s=1;s<i;++s){var l=e[s].attributes[t];if(!defined(l)||a.componentDatatype!==l.componentDatatype||a.componentsPerAttribute!==l.componentsPerAttribute||a.normalize!==l.normalize){o=!1;break}}o&&r.push(t)}return r}Object.defineProperties(Primitive$2.prototype,{vertexCacheOptimize:{get:function(){return this._vertexCacheOptimize}},interleave:{get:function(){return this._interleave}},releaseGeometryInstances:{get:function(){return this._releaseGeometryInstances}},allowPicking:{get:function(){return this._allowPicking}},asynchronous:{get:function(){return this._asynchronous}},compressVertices:{get:function(){return this._compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}});var scratchGetAttributeCartesian2=new Cartesian2,scratchGetAttributeCartesian3=new Cartesian3,scratchGetAttributeCartesian4=new Cartesian4;function getAttributeValue(e){var t=e.length;return 1===t?e[0]:2===t?Cartesian2.unpack(e,0,scratchGetAttributeCartesian2):3===t?Cartesian3.unpack(e,0,scratchGetAttributeCartesian3):4===t?Cartesian4.unpack(e,0,scratchGetAttributeCartesian4):void 0}function createBatchTable$1(e,t){var i=e.geometryInstances,r=Array.isArray(i)?i:[i],n=r.length;if(0!==n){var a,o,s,l,c=getCommonPerInstanceAttributeNames(r),u=c.length,d=[],h={},p={},f=r[0].attributes;for(o=0;o<u;++o)l=f[s=c[o]],h[s]=o,d.push({functionName:"czm_batchTable_"+s,componentDatatype:l.componentDatatype,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize});-1!==c.indexOf("distanceDisplayCondition")&&(d.push({functionName:"czm_batchTable_boundingSphereCenter3DHigh",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter3DLow",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DHigh",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DLow",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereRadius",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:1}),p.center3DHigh=d.length-5,p.center3DLow=d.length-4,p.center2DHigh=d.length-3,p.center2DLow=d.length-2,p.radius=d.length-1),-1!==c.indexOf("offset")&&(d.push({functionName:"czm_batchTable_offset2D",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3}),a=d.length-1),d.push({functionName:"czm_batchTable_pickColor",componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0});var m=d.length,g=new BatchTable(t,d,n);for(o=0;o<n;++o){var _=r[o];f=_.attributes;for(var y=0;y<u;++y){var v=getAttributeValue((l=f[s=c[y]]).value),C=h[s];g.setBatchedAttribute(o,C,v)}var T={primitive:defaultValue(_.pickPrimitive,e)};defined(_.id)&&(T.id=_.id);var S=t.createPickId(T);e._pickIds.push(S);var A=S.color,x=scratchGetAttributeCartesian4;x.x=Color.floatToByte(A.red),x.y=Color.floatToByte(A.green),x.z=Color.floatToByte(A.blue),x.w=Color.floatToByte(A.alpha),g.setBatchedAttribute(o,m-1,x)}e._batchTable=g,e._batchTableAttributeIndices=h,e._batchTableBoundingSphereAttributeIndices=p,e._batchTableOffsetAttribute2DIndex=a}}function cloneAttribute(e){var t;return t=Array.isArray(e.values)?e.values.slice(0):new e.values.constructor(e.values),new GeometryAttribute({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,values:t})}function cloneGeometry(e){var t,i=e.attributes,r=new GeometryAttributes;for(var n in i)i.hasOwnProperty(n)&&defined(i[n])&&(r[n]=cloneAttribute(i[n]));if(defined(e.indices)){var a=e.indices;t=Array.isArray(a)?a.slice(0):new a.constructor(a)}return new Geometry({attributes:r,indices:t,primitiveType:e.primitiveType,boundingSphere:BoundingSphere.clone(e.boundingSphere)})}function cloneInstance(e,t){return{geometry:t,attributes:e.attributes,modelMatrix:Matrix4.clone(e.modelMatrix),pickPrimitive:e.pickPrimitive,id:e.id}}var positionRegex=/attribute\s+vec(?:3|4)\s+(.*)3DHigh;/g;function appendPickToVertexShader(e){return ShaderSource.replaceMain(e,"czm_non_pick_main")+"\nvarying vec4 v_pickColor; \nvoid main() \n{ \n czm_non_pick_main(); \n v_pickColor = czm_batchTable_pickColor(batchId); \n}"}function appendPickToFragmentShader(e){return"varying vec4 v_pickColor;\n"+e}function modifyForEncodedNormals$1(e,t){if(!e.compressVertices)return t;var i=-1!==t.search(/attribute\s+vec3\s+normal;/g),r=-1!==t.search(/attribute\s+vec2\s+st;/g);if(!i&&!r)return t;var n=-1!==t.search(/attribute\s+vec3\s+tangent;/g),a=-1!==t.search(/attribute\s+vec3\s+bitangent;/g),o=r&&i?2:1,s="compressedAttributes",l="attribute "+((o+=n||a?1:0)>1?"vec"+o:"float")+" "+s+";",c="",u="";r&&(c+="vec2 st;\n",u+=" st = czm_decompressTextureCoordinates("+(o>1?s+".x":s)+");\n");i&&n&&a?(c+="vec3 normal;\nvec3 tangent;\nvec3 bitangent;\n",u+=" czm_octDecode("+s+"."+(r?"yz":"xy")+", normal, tangent, bitangent);\n"):(i&&(c+="vec3 normal;\n",u+=" normal = czm_octDecode("+s+(o>1?"."+(r?"y":"x"):"")+");\n"),n&&(c+="vec3 tangent;\n",u+=" tangent = czm_octDecode("+s+"."+(r&&i?"z":"y")+");\n"),a&&(c+="vec3 bitangent;\n",u+=" bitangent = czm_octDecode("+s+"."+(r&&i?"z":"y")+");\n"));var d=t;return d=(d=(d=(d=d.replace(/attribute\s+vec3\s+normal;/g,"")).replace(/attribute\s+vec2\s+st;/g,"")).replace(/attribute\s+vec3\s+tangent;/g,"")).replace(/attribute\s+vec3\s+bitangent;/g,""),[l,c,d=ShaderSource.replaceMain(d,"czm_non_compressed_main"),"void main() \n{ \n"+u+" czm_non_compressed_main(); \n}"].join("\n")}function depthClampVS(e){var t=ShaderSource.replaceMain(e,"czm_non_depth_clamp_main");return t+="void main() {\n czm_non_depth_clamp_main();\n gl_Position = czm_depthClamp(gl_Position);}\n"}function depthClampFS(e){var t=ShaderSource.replaceMain(e,"czm_non_depth_clamp_main");return t="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n"+(t+="void main() {\n czm_non_depth_clamp_main();\n#if defined(GL_EXT_frag_depth)\n #if defined(LOG_DEPTH)\n czm_writeLogDepth();\n #else\n czm_writeDepthClamp();\n #endif\n#endif\n}\n")}function validateShaderMatching(e,t){e.vertexAttributes}function getUniformFunction(e,t){return function(){return e[t]}}Primitive$2._modifyShaderPosition=function(e,t,i){for(var r,n="",a="",o="";null!==(r=positionRegex.exec(t));){var s=r[1],l="vec4 czm_compute"+s[0].toUpperCase()+s.substr(1)+"()";"vec4 czm_computePosition()"!==l&&(n+=l+";\n"),defined(e.rtcCenter)?(n+="uniform mat4 u_modifiedModelView;\n",a+="attribute vec4 position;\n",o+=l+"\n{\n return u_modifiedModelView * position;\n}\n\n",t=(t=(t=(t=t.replace(/attribute\s+vec(?:3|4)\s+position3DHigh;/g,"")).replace(/attribute\s+vec(?:3|4)\s+position3DLow;/g,"")).replace(/czm_modelViewRelativeToEye\s+\*\s+/g,"")).replace(/czm_modelViewProjectionRelativeToEye/g,"czm_projection")):i?o+=l+"\n{\n return czm_translateRelativeToEye("+s+"3DHigh, "+s+"3DLow);\n}\n\n":(a+="attribute vec3 "+s+"2DHigh;\nattribute vec3 "+s+"2DLow;\n",o+=l+"\n{\n vec4 p;\n if (czm_morphTime == 1.0)\n {\n p = czm_translateRelativeToEye("+s+"3DHigh, "+s+"3DLow);\n }\n else if (czm_morphTime == 0.0)\n {\n p = czm_translateRelativeToEye("+s+"2DHigh.zxy, "+s+"2DLow.zxy);\n }\n else\n {\n p = czm_columbusViewMorph(\n czm_translateRelativeToEye("+s+"2DHigh.zxy, "+s+"2DLow.zxy),\n czm_translateRelativeToEye("+s+"3DHigh, "+s+"3DLow),\n czm_morphTime);\n }\n return p;\n}\n\n")}return[n,a,t,o].join("\n")},Primitive$2._appendShowToShader=function(e,t){if(!defined(e._batchTableAttributeIndices.show))return t;return ShaderSource.replaceMain(t,"czm_non_show_main")+"\nvoid main() \n{ \n czm_non_show_main(); \n gl_Position *= czm_batchTable_show(batchId); \n}"},Primitive$2._updateColorAttribute=function(e,t,i){if(!defined(e._batchTableAttributeIndices.color)&&!defined(e._batchTableAttributeIndices.depthFailColor))return t;if(-1===t.search(/attribute\s+vec4\s+color;/g))return t;var r=t;return r=r.replace(/attribute\s+vec4\s+color;/g,""),r=i?r.replace(/(\b)color(\b)/g,"$1czm_batchTable_depthFailColor(batchId)$2"):r.replace(/(\b)color(\b)/g,"$1czm_batchTable_color(batchId)$2")},Primitive$2._updatePickColorAttribute=function(e){var t=e.replace(/attribute\s+vec4\s+pickColor;/g,"");return t=t.replace(/(\b)pickColor(\b)/g,"$1czm_batchTable_pickColor(batchId)$2")},Primitive$2._appendOffsetToShader=function(e,t){if(!defined(e._batchTableAttributeIndices.offset))return t;var i=t.replace(/attribute\s+float\s+batchId;/g,"attribute float batchId;\nattribute float applyOffset;");return" if (czm_sceneMode == czm_sceneMode3D)\n"," {\n"," $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0);"," }\n"," else\n"," {\n"," $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0);"," }\n",i=i.replace(/vec4\s+([A-Za-z0-9_]+)\s+=\s+czm_computePosition\(\);/g,"vec4 $1 = czm_computePosition();\n if (czm_sceneMode == czm_sceneMode3D)\n {\n $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0); }\n else\n {\n $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0); }\n")},Primitive$2._appendDistanceDisplayConditionToShader=function(e,t,i){if(!defined(e._batchTableAttributeIndices.distanceDisplayCondition))return t;var r="void main() \n{ \n czm_non_distanceDisplayCondition_main(); \n vec2 distanceDisplayCondition = czm_batchTable_distanceDisplayCondition(batchId);\n vec3 boundingSphereCenter3DHigh = czm_batchTable_boundingSphereCenter3DHigh(batchId);\n vec3 boundingSphereCenter3DLow = czm_batchTable_boundingSphereCenter3DLow(batchId);\n float boundingSphereRadius = czm_batchTable_boundingSphereRadius(batchId);\n";return r+=i?" vec4 centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);\n":" vec3 boundingSphereCenter2DHigh = czm_batchTable_boundingSphereCenter2DHigh(batchId);\n vec3 boundingSphereCenter2DLow = czm_batchTable_boundingSphereCenter2DLow(batchId);\n vec4 centerRTE;\n if (czm_morphTime == 1.0)\n {\n centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);\n }\n else if (czm_morphTime == 0.0)\n {\n centerRTE = czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy);\n }\n else\n {\n centerRTE = czm_columbusViewMorph(\n czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy),\n czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow),\n czm_morphTime);\n }\n",ShaderSource.replaceMain(t,"czm_non_distanceDisplayCondition_main")+"\n"+(r+=" float radiusSq = boundingSphereRadius * boundingSphereRadius; \n float distanceSq; \n if (czm_sceneMode == czm_sceneMode2D) \n { \n distanceSq = czm_eyeHeight2D.y - radiusSq; \n } \n else \n { \n distanceSq = dot(centerRTE.xyz, centerRTE.xyz) - radiusSq; \n } \n distanceSq = max(distanceSq, 0.0); \n float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x; \n float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y; \n float show = (distanceSq >= nearSq && distanceSq <= farSq) ? 1.0 : 0.0; \n gl_Position *= show; \n}")};var numberOfCreationWorkers=Math.max(FeatureDetection.hardwareConcurrency-1,1),createGeometryTaskProcessors,combineGeometryTaskProcessor=new TaskProcessor("combineGeometry");function loadAsynchronous(e,t){var i,r,n,a,o=e._instanceIds;if(e._state===PrimitiveState$1.READY){i=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];var s,l=e._numberOfInstances=i.length,c=[],u=[];for(n=0;n<l;++n)r=i[n].geometry,o.push(i[n].id),u.push({moduleName:r._workerName,geometry:r});if(!defined(createGeometryTaskProcessors))for(createGeometryTaskProcessors=new Array(numberOfCreationWorkers),n=0;n<numberOfCreationWorkers;n++)createGeometryTaskProcessors[n]=new TaskProcessor("createGeometry");for(u=subdivideArray(u,numberOfCreationWorkers),n=0;n<u.length;n++){var d,h=0,p=u[n],f=p.length;for(a=0;a<f;++a)defined((r=(s=p[a]).geometry).constructor.pack)&&(s.offset=h,h+=defaultValue(r.constructor.packedLength,r.packedLength));if(h>0){var m=new Float64Array(h);for(d=[m.buffer],a=0;a<f;++a)defined((r=(s=p[a]).geometry).constructor.pack)&&(r.constructor.pack(r,m,s.offset),s.geometry=m)}c.push(createGeometryTaskProcessors[n].scheduleTask({subTasks:u[n]},d))}e._state=PrimitiveState$1.CREATING,when.all(c,(function(t){e._createGeometryResults=t,e._state=PrimitiveState$1.CREATED})).otherwise((function(i){setReady(e,t,PrimitiveState$1.FAILED,i)}))}else if(e._state===PrimitiveState$1.CREATED){var g=[];i=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];var _=t.scene3DOnly,y=t.mapProjection,v=combineGeometryTaskProcessor.scheduleTask(PrimitivePipeline.packCombineGeometryParameters({createGeometryResults:e._createGeometryResults,instances:i,ellipsoid:y.ellipsoid,projection:y,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:_,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets},g),g);e._createGeometryResults=void 0,e._state=PrimitiveState$1.COMBINING,when(v,(function(i){var r=PrimitivePipeline.unpackCombineGeometryResults(i);e._geometries=r.geometries,e._attributeLocations=r.attributeLocations,e.modelMatrix=Matrix4.clone(r.modelMatrix,e.modelMatrix),e._pickOffsets=r.pickOffsets,e._offsetInstanceExtend=r.offsetInstanceExtend,e._instanceBoundingSpheres=r.boundingSpheres,e._instanceBoundingSpheresCV=r.boundingSpheresCV,defined(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=PrimitiveState$1.COMBINED):setReady(e,t,PrimitiveState$1.FAILED,void 0)})).otherwise((function(i){setReady(e,t,PrimitiveState$1.FAILED,i)}))}}function loadSynchronous(e,t){var i,r,n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances],a=e._numberOfInstances=n.length,o=new Array(a),s=e._instanceIds,l=0;for(r=0;r<a;r++){var c,u=(i=n[r]).geometry;c=defined(u.attributes)&&defined(u.primitiveType)?cloneGeometry(u):u.constructor.createGeometry(u),o[l++]=cloneInstance(i,c),s.push(i.id)}o.length=l;var d=t.scene3DOnly,h=t.mapProjection,p=PrimitivePipeline.combineGeometry({instances:o,ellipsoid:h.ellipsoid,projection:h,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:d,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=p.geometries,e._attributeLocations=p.attributeLocations,e.modelMatrix=Matrix4.clone(p.modelMatrix,e.modelMatrix),e._pickOffsets=p.pickOffsets,e._offsetInstanceExtend=p.offsetInstanceExtend,e._instanceBoundingSpheres=p.boundingSpheres,e._instanceBoundingSpheresCV=p.boundingSpheresCV,defined(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=PrimitiveState$1.COMBINED):setReady(e,t,PrimitiveState$1.FAILED,void 0)}function recomputeBoundingSpheres(e,t){var i=e._batchTableAttributeIndices.offset;if(e._recomputeBoundingSpheres&&defined(i)){var r,n=e._offsetInstanceExtend,a=e._instanceBoundingSpheres,o=a.length,s=e._tempBoundingSpheres;if(!defined(s)){for(s=new Array(o),r=0;r<o;r++)s[r]=new BoundingSphere;e._tempBoundingSpheres=s}for(r=0;r<o;++r){var l=s[r],c=e._batchTable.getBatchedAttribute(r,i,new Cartesian3);transformBoundingSphere(l=a[r].clone(l),c,n[r])}var u=[],d=[],h=[];for(r=0;r<o;++r){var p=s[r];p.center.x-p.radius>0||BoundingSphere.intersectPlane(p,Plane.ORIGIN_ZX_PLANE)!==Intersect$1.INTERSECTING?u.push(p):(d.push(p),h.push(p))}var f=u[0],m=h[0],g=d[0];for(r=1;r<u.length;r++)f=BoundingSphere.union(f,u[r]);for(r=1;r<h.length;r++)m=BoundingSphere.union(m,h[r]);for(r=1;r<d.length;r++)g=BoundingSphere.union(g,d[r]);var _=[];for(defined(f)&&_.push(f),defined(m)&&_.push(m),defined(g)&&_.push(g),r=0;r<_.length;r++){var y=_[r].clone(e._boundingSpheres[r]);e._boundingSpheres[r]=y,e._boundingSphereCV[r]=BoundingSphere.projectTo2D(y,t.mapProjection,e._boundingSphereCV[r])}Primitive$2._updateBoundingVolumes(e,t,e.modelMatrix,!0),e._recomputeBoundingSpheres=!1}else e._recomputeBoundingSpheres=!1}var scratchBoundingSphereCenterEncoded=new EncodedCartesian3,scratchBoundingSphereCartographic=new Cartographic,scratchBoundingSphereCenter2D=new Cartesian3,scratchBoundingSphere$2=new BoundingSphere;function updateBatchTableBoundingSpheres(e,t){if(defined(e._batchTableAttributeIndices.distanceDisplayCondition)&&!e._batchTableBoundingSpheresUpdated){for(var i=e._batchTableBoundingSphereAttributeIndices,r=i.center3DHigh,n=i.center3DLow,a=i.center2DHigh,o=i.center2DLow,s=i.radius,l=t.mapProjection,c=l.ellipsoid,u=e._batchTable,d=e._instanceBoundingSpheres,h=d.length,p=0;p<h;++p){var f=d[p];if(defined(f)){var m=e.modelMatrix;defined(m)&&(f=BoundingSphere.transform(f,m,scratchBoundingSphere$2));var g=f.center,_=f.radius,y=EncodedCartesian3.fromCartesian(g,scratchBoundingSphereCenterEncoded);if(u.setBatchedAttribute(p,r,y.high),u.setBatchedAttribute(p,n,y.low),!t.scene3DOnly){var v=c.cartesianToCartographic(g,scratchBoundingSphereCartographic),C=l.project(v,scratchBoundingSphereCenter2D);y=EncodedCartesian3.fromCartesian(C,scratchBoundingSphereCenterEncoded),u.setBatchedAttribute(p,a,y.high),u.setBatchedAttribute(p,o,y.low)}u.setBatchedAttribute(p,s,_)}}e._batchTableBoundingSpheresUpdated=!0}}var offsetScratchCartesian=new Cartesian3,offsetCenterScratch=new Cartesian3;function updateBatchTableOffsets(e,t){if(defined(e._batchTableAttributeIndices.offset)&&!e._batchTableOffsetsUpdated&&!t.scene3DOnly){for(var i=e._batchTableOffsetAttribute2DIndex,r=t.mapProjection,n=r.ellipsoid,a=e._batchTable,o=e._instanceBoundingSpheres,s=o.length,l=0;l<s;++l){var c=o[l];if(defined(c)){var u=a.getBatchedAttribute(l,e._batchTableAttributeIndices.offset);if(Cartesian3.equals(u,Cartesian3.ZERO))a.setBatchedAttribute(l,i,Cartesian3.ZERO);else{var d=e.modelMatrix;defined(d)&&(c=BoundingSphere.transform(c,d,scratchBoundingSphere$2));var h=c.center;h=n.scaleToGeodeticSurface(h,offsetCenterScratch);var p=n.cartesianToCartographic(h,scratchBoundingSphereCartographic),f=r.project(p,scratchBoundingSphereCenter2D),m=Cartesian3.add(u,h,offsetScratchCartesian);p=n.cartesianToCartographic(m,p);var g=r.project(p,offsetScratchCartesian),_=Cartesian3.subtract(g,f,offsetScratchCartesian),y=_.x;_.x=_.z,_.z=_.y,_.y=y,a.setBatchedAttribute(l,i,_)}}}e._batchTableOffsetsUpdated=!0}}function createVertexArray$6(e,t){for(var i=e._attributeLocations,r=e._geometries,n=t.scene3DOnly,a=t.context,o=[],s=r.length,l=0;l<s;++l){var c=r[l];if(o.push(VertexArray.fromGeometry({context:a,geometry:c,attributeLocations:i,bufferUsage:BufferUsage$1.STATIC_DRAW,interleave:e._interleave})),defined(e._createBoundingVolumeFunction))e._createBoundingVolumeFunction(t,c);else if(e._boundingSpheres.push(BoundingSphere.clone(c.boundingSphere)),e._boundingSphereWC.push(new BoundingSphere),!n){var u=c.boundingSphereCV.center,d=u.x,h=u.y,p=u.z;u.x=p,u.y=d,u.z=h,e._boundingSphereCV.push(BoundingSphere.clone(c.boundingSphereCV)),e._boundingSphere2D.push(new BoundingSphere),e._boundingSphereMorph.push(new BoundingSphere)}}e._va=o,e._primitiveType=r[0].primitiveType,e.releaseGeometryInstances&&(e.geometryInstances=void 0),e._geometries=void 0,setReady(e,t,PrimitiveState$1.COMPLETE,void 0)}function createRenderStates$6(e,t,i,r){var n,a=i.getRenderState();r?((n=clone$1(a,!1)).cull={enabled:!0,face:CullFace$1.BACK},e._frontFaceRS=RenderState.fromCache(n),n.cull.face=CullFace$1.FRONT,e._backFaceRS=RenderState.fromCache(n)):(e._frontFaceRS=RenderState.fromCache(a),e._backFaceRS=e._frontFaceRS),n=clone$1(a,!1),defined(e._depthFailAppearance)&&(n.depthTest.enabled=!1),defined(e._depthFailAppearance)&&((n=clone$1(a=e._depthFailAppearance.getRenderState(),!1)).depthTest.func=DepthFunction$1.GREATER,r?(n.cull={enabled:!0,face:CullFace$1.BACK},e._frontFaceDepthFailRS=RenderState.fromCache(n),n.cull.face=CullFace$1.FRONT,e._backFaceDepthFailRS=RenderState.fromCache(n)):(e._frontFaceDepthFailRS=RenderState.fromCache(n),e._backFaceDepthFailRS=e._frontFaceRS))}function createShaderProgram$3(e,t,i){var r=t.context,n=e._attributeLocations,a=e._batchTable.getVertexShaderCallback()(i.vertexShaderSource);a=Primitive$2._appendOffsetToShader(e,a),a=Primitive$2._appendShowToShader(e,a),a=appendPickToVertexShader(a=Primitive$2._appendDistanceDisplayConditionToShader(e,a,t.scene3DOnly)),a=modifyForEncodedNormals$1(e,a=Primitive$2._updateColorAttribute(e,a,!1)),a=Primitive$2._modifyShaderPosition(e,a,t.scene3DOnly);var o=i.getFragmentShaderSource();o=appendPickToFragmentShader(o),e._sp=ShaderProgram.replaceCache({context:r,shaderProgram:e._sp,vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:n}),validateShaderMatching(e._sp),defined(e._depthFailAppearance)&&(a=e._batchTable.getVertexShaderCallback()(e._depthFailAppearance.vertexShaderSource),a=Primitive$2._appendShowToShader(e,a),a=appendPickToVertexShader(a=Primitive$2._appendDistanceDisplayConditionToShader(e,a,t.scene3DOnly)),a=modifyForEncodedNormals$1(e,a=Primitive$2._updateColorAttribute(e,a,!0)),a=depthClampVS(a=Primitive$2._modifyShaderPosition(e,a,t.scene3DOnly)),o=depthClampFS(o=appendPickToFragmentShader(o=e._depthFailAppearance.getFragmentShaderSource())),e._spDepthFail=ShaderProgram.replaceCache({context:r,shaderProgram:e._spDepthFail,vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:n}),validateShaderMatching(e._spDepthFail))}var modifiedModelViewScratch$4=new Matrix4,rtcScratch$4=new Cartesian3;function getUniforms(e,t,i,r){var n=defined(i)?i._uniforms:void 0,a={},o=t.uniforms;if(defined(o))for(var s in o)o.hasOwnProperty(s)&&(a[s]=getUniformFunction(o,s));var l=combine$2(a,n);return l=e._batchTable.getUniformMapCallback()(l),defined(e.rtcCenter)&&(l.u_modifiedModelView=function(){var t=r.context.uniformState.view;return Matrix4.multiply(t,e._modelMatrix,modifiedModelViewScratch$4),Matrix4.multiplyByPoint(modifiedModelViewScratch$4,e.rtcCenter,rtcScratch$4),Matrix4.setTranslation(modifiedModelViewScratch$4,rtcScratch$4,modifiedModelViewScratch$4),modifiedModelViewScratch$4}),l}function createCommands$5(e,t,i,r,n,a,o,s){var l,c=getUniforms(e,t,i,s);defined(e._depthFailAppearance)&&(l=getUniforms(e,e._depthFailAppearance,e._depthFailAppearance.material,s));var u=r?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,d=n?2:1;d*=defined(e._depthFailAppearance)?2:1,a.length=e._va.length*d;for(var h=a.length,p=0,f=0;f<h;++f){var m;n&&(defined(m=a[f])||(m=a[f]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),m.vertexArray=e._va[p],m.renderState=e._backFaceRS,m.shaderProgram=e._sp,m.uniformMap=c,m.pass=u,++f),defined(m=a[f])||(m=a[f]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),m.vertexArray=e._va[p],m.renderState=e._frontFaceRS,m.shaderProgram=e._sp,m.uniformMap=c,m.pass=u,defined(e._depthFailAppearance)&&(n&&(defined(m=a[++f])||(m=a[f]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),m.vertexArray=e._va[p],m.renderState=e._backFaceDepthFailRS,m.shaderProgram=e._spDepthFail,m.uniformMap=l,m.pass=u),defined(m=a[++f])||(m=a[f]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),m.vertexArray=e._va[p],m.renderState=e._frontFaceDepthFailRS,m.shaderProgram=e._spDepthFail,m.uniformMap=l,m.pass=u),++p}}function updateAndQueueCommands$3(e,t,i,r,n,a,o,s){var l;Primitive$2._updateBoundingVolumes(e,t,n),t.mode===SceneMode$1.SCENE3D?l=e._boundingSphereWC:t.mode===SceneMode$1.COLUMBUS_VIEW?l=e._boundingSphereCV:t.mode===SceneMode$1.SCENE2D&&defined(e._boundingSphere2D)?l=e._boundingSphere2D:defined(e._boundingSphereMorph)&&(l=e._boundingSphereMorph);var c=t.commandList,u=t.passes;if(u.render||u.pick){var d=e.allowPicking,h=ShadowMode$1.castShadows(e.shadows),p=ShadowMode$1.receiveShadows(e.shadows),f=i.length,m=s?2:1;m*=defined(e._depthFailAppearance)?2:1;for(var g=0;g<f;++g){var _=Math.floor(g/m),y=i[g];y.modelMatrix=n,y.boundingVolume=l[_],y.cull=a,y.debugShowBoundingVolume=o,y.castShadows=h,y.receiveShadows=p,y.pickId=d?"v_pickColor":void 0,c.push(y)}}}Primitive$2._updateBoundingVolumes=function(e,t,i,r){var n,a,o;if(r||!Matrix4.equals(i,e._modelMatrix))for(Matrix4.clone(i,e._modelMatrix),a=e._boundingSpheres.length,n=0;n<a;++n)defined(o=e._boundingSpheres[n])&&(e._boundingSphereWC[n]=BoundingSphere.transform(o,i,e._boundingSphereWC[n]),t.scene3DOnly||(e._boundingSphere2D[n]=BoundingSphere.clone(e._boundingSphereCV[n],e._boundingSphere2D[n]),e._boundingSphere2D[n].center.x=0,e._boundingSphereMorph[n]=BoundingSphere.union(e._boundingSphereWC[n],e._boundingSphereCV[n])));var s=e.appearance.pixelSize;if(defined(s))for(a=e._boundingSpheres.length,n=0;n<a;++n){o=e._boundingSpheres[n];var l=e._boundingSphereWC[n],c=t.camera.getPixelSize(o,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*s;l.radius=o.radius+c}},Primitive$2.prototype.update=function(e){if(!(!defined(this.geometryInstances)&&0===this._va.length||defined(this.geometryInstances)&&Array.isArray(this.geometryInstances)&&0===this.geometryInstances.length||!defined(this.appearance)||e.mode!==SceneMode$1.SCENE3D&&e.scene3DOnly||!e.passes.render&&!e.passes.pick)){if(defined(this._error))throw this._error;if(this._state!==PrimitiveState$1.FAILED){var t=e.context;if(defined(this._batchTable)||createBatchTable$1(this,t),this._batchTable.attributes.length>0){if(0===ContextLimits.maximumVertexTextureImageUnits)throw new RuntimeError("Vertex texture fetch support is required to render primitives with per-instance attributes. The maximum number of vertex texture image units must be greater than zero.");this._batchTable.update(e)}if(this._state!==PrimitiveState$1.COMPLETE&&this._state!==PrimitiveState$1.COMBINED&&(this.asynchronous?loadAsynchronous(this,e):loadSynchronous(this,e)),this._state===PrimitiveState$1.COMBINED&&(updateBatchTableBoundingSpheres(this,e),updateBatchTableOffsets(this,e),createVertexArray$6(this,e)),this.show&&this._state===PrimitiveState$1.COMPLETE){this._batchTableOffsetsUpdated||updateBatchTableOffsets(this,e),this._recomputeBoundingSpheres&&recomputeBoundingSpheres(this,e);var i=this.appearance,r=i.material,n=!1,a=!1;this._appearance!==i?(this._appearance=i,this._material=r,n=!0,a=!0):this._material!==r&&(this._material=r,a=!0);var o=this.depthFailAppearance,s=defined(o)?o.material:void 0;this._depthFailAppearance!==o?(this._depthFailAppearance=o,this._depthFailMaterial=s,n=!0,a=!0):this._depthFailMaterial!==s&&(this._depthFailMaterial=s,a=!0);var l=this._appearance.isTranslucent();this._translucent!==l&&(this._translucent=l,n=!0),defined(this._material)&&this._material.update(t);var c=i.closed&&l;if(n)defaultValue(this._createRenderStatesFunction,createRenderStates$6)(this,t,i,c);if(a)defaultValue(this._createShaderProgramFunction,createShaderProgram$3)(this,e,i);if(n||a)defaultValue(this._createCommandsFunction,createCommands$5)(this,i,r,l,c,this._colorCommands,this._pickCommands,e);defaultValue(this._updateAndQueueCommandsFunction,updateAndQueueCommands$3)(this,e,this._colorCommands,this._pickCommands,this.modelMatrix,this.cull,this.debugShowBoundingVolume,c)}}}};var offsetBoundingSphereScratch1=new BoundingSphere,offsetBoundingSphereScratch2=new BoundingSphere;function transformBoundingSphere(e,t,i){if(i===GeometryOffsetAttribute$1.TOP){var r=BoundingSphere.clone(e,offsetBoundingSphereScratch1),n=BoundingSphere.clone(e,offsetBoundingSphereScratch2);n.center=Cartesian3.add(n.center,t,n.center),e=BoundingSphere.union(r,n,e)}else i===GeometryOffsetAttribute$1.ALL&&(e.center=Cartesian3.add(e.center,t,e.center));return e}function createGetFunction(e,t,i){return function(){var r=e.getBatchedAttribute(t,i),n=e.attributes[i],a=n.componentsPerAttribute,o=ComponentDatatype$1.createTypedArray(n.componentDatatype,a);return defined(r.constructor.pack)?r.constructor.pack(r,o,0):o[0]=r,o}}function createSetFunction(e,t,i,r,n){return function(a){var o=getAttributeValue(a);e.setBatchedAttribute(t,i,o),"offset"===n&&(r._recomputeBoundingSpheres=!0,r._batchTableOffsetsUpdated=!1)}}var offsetScratch$a=new Cartesian3;function createBoundingSphereProperties(e,t,i){t.boundingSphere={get:function(){var r=e._instanceBoundingSpheres[i];if(defined(r)){r=r.clone();var n=e.modelMatrix,a=t.offset;defined(a)&&transformBoundingSphere(r,Cartesian3.fromArray(a.get(),0,offsetScratch$a),e._offsetInstanceExtend[i]),defined(n)&&(r=BoundingSphere.transform(r,n))}return r}},t.boundingSphereCV={get:function(){return e._instanceBoundingSpheresCV[i]}}}function createPickIdProperty(e,t,i){t.pickId={get:function(){return e._pickIds[i]}}}function setReady(e,t,i,r){e._error=r,e._state=i,t.afterRender.push((function(){e._ready=e._state===PrimitiveState$1.COMPLETE||e._state===PrimitiveState$1.FAILED,defined(r)?e._readyPromise.reject(r):e._readyPromise.resolve(e)}))}Primitive$2.prototype.getGeometryInstanceAttributes=function(e){for(var t=-1,i=this._lastPerInstanceAttributeIndex,r=this._instanceIds,n=r.length,a=0;a<n;++a){var o=(i+a)%n;if(e===r[o]){t=o;break}}if(-1!==t){var s=this._perInstanceAttributeCache[t];if(defined(s))return s;var l=this._batchTable,c=this._batchTableAttributeIndices;s={};var u={};for(var d in c)if(c.hasOwnProperty(d)){var h=c[d];u[d]={get:createGetFunction(l,t,h),set:createSetFunction(l,t,h,this,d)}}return createBoundingSphereProperties(this,u,t),createPickIdProperty(this,u,t),Object.defineProperties(s,u),this._lastPerInstanceAttributeIndex=t,this._perInstanceAttributeCache[t]=s,s}},Primitive$2.prototype.isDestroyed=function(){return!1},Primitive$2.prototype.destroy=function(){var e,t;this._sp=this._sp&&this._sp.destroy(),this._spDepthFail=this._spDepthFail&&this._spDepthFail.destroy();var i=this._va;for(e=i.length,t=0;t<e;++t)i[t].destroy();this._va=void 0;var r=this._pickIds;for(e=r.length,t=0;t<e;++t)r[t].destroy();return this._pickIds=void 0,this._batchTable=this._batchTable&&this._batchTable.destroy(),this._instanceIds=void 0,this._perInstanceAttributeCache=void 0,this._attributeLocations=void 0,destroyObject(this)};var ShadowVolumeAppearanceFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nvarying vec4 v_sphericalExtents;\n#else // SPHERICAL\nvarying vec2 v_inversePlaneExtents;\nvarying vec4 v_westPlane;\nvarying vec4 v_southPlane;\n#endif // SPHERICAL\nvarying vec3 v_uvMinAndSphericalLongitudeRotation;\nvarying vec3 v_uMaxAndInverseDistance;\nvarying vec3 v_vMaxAndInverseDistance;\n#endif // TEXTURE_COORDINATES\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\n#ifdef NORMAL_EC\nvec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth) {\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);\nreturn eyeCoordinate.xyz / eyeCoordinate.w;\n}\nvec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset) {\nvec2 glFragCoordXY = gl_FragCoord.xy;\nfloat upOrRightLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));\nfloat downOrLeftLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY - positiveOffset) / czm_viewport.zw));\nbvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);\nfloat useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);\nfloat useDownOrLeft = float(useUpOrRight == 0.0);\nvec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);\nvec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);\nreturn (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;\n}\n#endif // NORMAL_EC\nvoid main(void)\n{\n#ifdef REQUIRES_EC\nfloat logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw));\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n#endif\n#ifdef REQUIRES_WC\nvec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\nvec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n#endif\n#ifdef TEXTURE_COORDINATES\nvec2 uv;\n#ifdef SPHERICAL\nvec2 sphericalLatLong = czm_approximateSphericalCoordinates(worldCoordinate);\nsphericalLatLong.y += v_uvMinAndSphericalLongitudeRotation.z;\nsphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);\nuv.x = (sphericalLatLong.y - v_sphericalExtents.y) * v_sphericalExtents.w;\nuv.y = (sphericalLatLong.x - v_sphericalExtents.x) * v_sphericalExtents.z;\n#else // SPHERICAL\nuv.x = czm_planeDistance(v_westPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.x;\nuv.y = czm_planeDistance(v_southPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.y;\n#endif // SPHERICAL\n#endif // TEXTURE_COORDINATES\n#ifdef PICK\n#ifdef CULL_FRAGMENTS\nif (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0 || logDepthOrDepth != 0.0) {\ngl_FragColor.a = 1.0;\nczm_writeDepthClamp();\n}\n#else // CULL_FRAGMENTS\ngl_FragColor.a = 1.0;\n#endif // CULL_FRAGMENTS\n#else // PICK\n#ifdef CULL_FRAGMENTS\nif (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y || logDepthOrDepth == 0.0) {\ndiscard;\n}\n#endif\n#ifdef NORMAL_EC\nvec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0));\nvec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0));\nvec3 normalEC = normalize(cross(leftRight, downUp));\n#endif\n#ifdef PER_INSTANCE_COLOR\nvec4 color = czm_gammaCorrect(v_color);\n#ifdef FLAT\ngl_FragColor = color;\n#else // FLAT\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = -eyeCoordinate.xyz;\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\ngl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);\n#endif // FLAT\ngl_FragColor.rgb *= gl_FragColor.a;\n#else // PER_INSTANCE_COLOR\nczm_materialInput materialInput;\n#ifdef USES_NORMAL_EC\nmaterialInput.normalEC = normalEC;\n#endif\n#ifdef USES_POSITION_TO_EYE_EC\nmaterialInput.positionToEyeEC = -eyeCoordinate.xyz;\n#endif\n#ifdef USES_TANGENT_TO_EYE\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(worldCoordinate, normalEC);\n#endif\n#ifdef USES_ST\nmaterialInput.st.x = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_uMaxAndInverseDistance.xy, uv) * v_uMaxAndInverseDistance.z;\nmaterialInput.st.y = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_vMaxAndInverseDistance.xy, uv) * v_vMaxAndInverseDistance.z;\n#endif\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else // FLAT\ngl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);\n#endif // FLAT\ngl_FragColor.rgb *= gl_FragColor.a;\n#endif // PER_INSTANCE_COLOR\nczm_writeDepthClamp();\n#endif // PICK\n}\n";function ShadowVolumeAppearance(e,t,i){this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};var r=new ShaderDependencies;r.requiresTextureCoordinates=e,r.requiresEC=!i.flat;var n=new ShaderDependencies;if(n.requiresTextureCoordinates=e,i instanceof PerInstanceColorAppearance)r.requiresNormalEC=!i.flat;else{var a=i.material.shaderSource+"\n"+i.fragmentShaderSource;r.normalEC=-1!==a.indexOf("materialInput.normalEC")||-1!==a.indexOf("czm_getDefaultMaterial"),r.positionToEyeEC=-1!==a.indexOf("materialInput.positionToEyeEC"),r.tangentToEyeMatrix=-1!==a.indexOf("materialInput.tangentToEyeMatrix"),r.st=-1!==a.indexOf("materialInput.st")}this._colorShaderDependencies=r,this._pickShaderDependencies=n,this._appearance=i,this._extentsCulling=e,this._planarExtents=t}ShadowVolumeAppearance.prototype.createFragmentShader=function(e){var t=this._appearance,i=this._colorShaderDependencies,r=[];e||this._planarExtents||r.push("SPHERICAL"),i.requiresEC&&r.push("REQUIRES_EC"),i.requiresWC&&r.push("REQUIRES_WC"),i.requiresTextureCoordinates&&r.push("TEXTURE_COORDINATES"),this._extentsCulling&&r.push("CULL_FRAGMENTS"),i.requiresNormalEC&&r.push("NORMAL_EC"),t instanceof PerInstanceColorAppearance&&r.push("PER_INSTANCE_COLOR"),i.normalEC&&r.push("USES_NORMAL_EC"),i.positionToEyeEC&&r.push("USES_POSITION_TO_EYE_EC"),i.tangentToEyeMatrix&&r.push("USES_TANGENT_TO_EYE"),i.st&&r.push("USES_ST"),t.flat&&r.push("FLAT");var n="";return t instanceof PerInstanceColorAppearance||(n=t.material.shaderSource),new ShaderSource({defines:r,sources:[n,ShadowVolumeAppearanceFS]})},ShadowVolumeAppearance.prototype.createPickFragmentShader=function(e){var t=this._pickShaderDependencies,i=["PICK"];return e||this._planarExtents||i.push("SPHERICAL"),t.requiresEC&&i.push("REQUIRES_EC"),t.requiresWC&&i.push("REQUIRES_WC"),t.requiresTextureCoordinates&&i.push("TEXTURE_COORDINATES"),this._extentsCulling&&i.push("CULL_FRAGMENTS"),new ShaderSource({defines:i,sources:[ShadowVolumeAppearanceFS],pickColorQualifier:"varying"})},ShadowVolumeAppearance.prototype.createVertexShader=function(e,t,i,r){return createShadowVolumeAppearanceVS(this._colorShaderDependencies,this._planarExtents,i,e,t,this._appearance,r,this._projectionExtentDefines)},ShadowVolumeAppearance.prototype.createPickVertexShader=function(e,t,i,r){return createShadowVolumeAppearanceVS(this._pickShaderDependencies,this._planarExtents,i,e,t,void 0,r,this._projectionExtentDefines)};var longitudeExtentsCartesianScratch=new Cartesian3,longitudeExtentsCartographicScratch=new Cartographic,longitudeExtentsEncodeScratch={high:0,low:0};function createShadowVolumeAppearanceVS(e,t,i,r,n,a,o,s){var l=r.slice();if(""===s.eastMostYhighDefine){var c=longitudeExtentsCartographicScratch;c.longitude=CesiumMath.PI,c.latitude=0,c.height=0;var u=o.project(c,longitudeExtentsCartesianScratch),d=EncodedCartesian3.encode(u.x,longitudeExtentsEncodeScratch);s.eastMostYhighDefine="EAST_MOST_X_HIGH "+d.high.toFixed((d.high+"").length+1),s.eastMostYlowDefine="EAST_MOST_X_LOW "+d.low.toFixed((d.low+"").length+1);var h=longitudeExtentsCartographicScratch;h.longitude=-CesiumMath.PI,h.latitude=0,h.height=0;var p=o.project(h,longitudeExtentsCartesianScratch);d=EncodedCartesian3.encode(p.x,longitudeExtentsEncodeScratch),s.westMostYhighDefine="WEST_MOST_X_HIGH "+d.high.toFixed((d.high+"").length+1),s.westMostYlowDefine="WEST_MOST_X_LOW "+d.low.toFixed((d.low+"").length+1)}return i&&(l.push(s.eastMostYhighDefine),l.push(s.eastMostYlowDefine),l.push(s.westMostYhighDefine),l.push(s.westMostYlowDefine)),defined(a)&&a instanceof PerInstanceColorAppearance&&l.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(l.push("TEXTURE_COORDINATES"),t||i||l.push("SPHERICAL"),i&&l.push("COLUMBUS_VIEW_2D")),new ShaderSource({defines:l,sources:[n]})}function ShaderDependencies(){this._requiresEC=!1,this._requiresWC=!1,this._requiresNormalEC=!1,this._requiresTextureCoordinates=!1,this._usesNormalEC=!1,this._usesPositionToEyeEC=!1,this._usesTangentToEyeMat=!1,this._usesSt=!1}function pointLineDistance(e,t,i){return Math.abs((t.y-e.y)*i.x-(t.x-e.x)*i.y+t.x*e.y-t.y*e.x)/Cartesian2.distance(t,e)}Object.defineProperties(ShaderDependencies.prototype,{requiresEC:{get:function(){return this._requiresEC},set:function(e){this._requiresEC=e||this._requiresEC}},requiresWC:{get:function(){return this._requiresWC},set:function(e){this._requiresWC=e||this._requiresWC,this.requiresEC=this._requiresWC}},requiresNormalEC:{get:function(){return this._requiresNormalEC},set:function(e){this._requiresNormalEC=e||this._requiresNormalEC,this.requiresEC=this._requiresNormalEC}},requiresTextureCoordinates:{get:function(){return this._requiresTextureCoordinates},set:function(e){this._requiresTextureCoordinates=e||this._requiresTextureCoordinates,this.requiresWC=this._requiresTextureCoordinates}},normalEC:{set:function(e){this.requiresNormalEC=e,this._usesNormalEC=e},get:function(){return this._usesNormalEC}},tangentToEyeMatrix:{set:function(e){this.requiresWC=e,this.requiresNormalEC=e,this._usesTangentToEyeMat=e},get:function(){return this._usesTangentToEyeMat}},positionToEyeEC:{set:function(e){this.requiresEC=e,this._usesPositionToEyeEC=e},get:function(){return this._usesPositionToEyeEC}},st:{set:function(e){this.requiresTextureCoordinates=e,this._usesSt=e},get:function(){return this._usesSt}}});var points2DScratch=[new Cartesian2,new Cartesian2,new Cartesian2,new Cartesian2];function addTextureCoordinateRotationAttributes(e,t){var i=points2DScratch,r=Cartesian2.unpack(t,0,i[0]),n=Cartesian2.unpack(t,2,i[1]),a=Cartesian2.unpack(t,4,i[2]);e.uMaxVmax=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:[n.x,n.y,a.x,a.y]});var o=1/pointLineDistance(r,n,a),s=1/pointLineDistance(r,a,n);e.uvMinAndExtents=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:[r.x,r.y,o,s]})}var cartographicScratch$4=new Cartographic,cornerScratch=new Cartesian3,northWestScratch=new Cartesian3,southEastScratch=new Cartesian3,highLowScratch={high:0,low:0};function add2DTextureCoordinateAttributes(e,t,i){var r=cartographicScratch$4;r.height=0,r.longitude=e.west,r.latitude=e.south;var n=t.project(r,cornerScratch);r.latitude=e.north;var a=t.project(r,northWestScratch);r.longitude=e.east,r.latitude=e.south;var o=t.project(r,southEastScratch),s=[0,0,0,0],l=[0,0,0,0],c=EncodedCartesian3.encode(n.x,highLowScratch);s[0]=c.high,l[0]=c.low,c=EncodedCartesian3.encode(n.y,highLowScratch),s[1]=c.high,l[1]=c.low,c=EncodedCartesian3.encode(a.y,highLowScratch),s[2]=c.high,l[2]=c.low,c=EncodedCartesian3.encode(o.x,highLowScratch),s[3]=c.high,l[3]=c.low,i.planes2D_HIGH=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:s}),i.planes2D_LOW=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:l})}var enuMatrixScratch=new Matrix4,inverseEnuScratch=new Matrix4,rectanglePointCartesianScratch=new Cartesian3,rectangleCenterScratch$1=new Cartographic,pointsCartographicScratch=[new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic];function computeRectangleBounds(e,t,i,r,n,a){var o=Rectangle.center(e,rectangleCenterScratch$1);o.height=i;var s=Cartographic.toCartesian(o,t,rectanglePointCartesianScratch),l=Transforms.eastNorthUpToFixedFrame(s,t,enuMatrixScratch),c=Matrix4.inverse(l,inverseEnuScratch),u=e.west,d=e.east,h=e.north,p=e.south,f=pointsCartographicScratch;f[0].latitude=p,f[0].longitude=u,f[1].latitude=h,f[1].longitude=u,f[2].latitude=h,f[2].longitude=d,f[3].latitude=p,f[3].longitude=d;var m=.5*(u+d),g=.5*(h+p);f[4].latitude=p,f[4].longitude=m,f[5].latitude=h,f[5].longitude=m,f[6].latitude=g,f[6].longitude=u,f[7].latitude=g,f[7].longitude=d;for(var _=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,v=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,T=0;T<8;T++){f[T].height=i;var S=Cartographic.toCartesian(f[T],t,rectanglePointCartesianScratch);Matrix4.multiplyByPoint(c,S,S),S.z=0,_=Math.min(_,S.x),y=Math.max(y,S.x),v=Math.min(v,S.y),C=Math.max(C,S.y)}var A=r;A.x=_,A.y=v,A.z=0,Matrix4.multiplyByPoint(l,A,A);var x=n;x.x=y,x.y=v,x.z=0,Matrix4.multiplyByPoint(l,x,x),Cartesian3.subtract(x,A,n);var E=a;E.x=_,E.y=C,E.z=0,Matrix4.multiplyByPoint(l,E,E),Cartesian3.subtract(E,A,a)}var eastwardScratch=new Cartesian3,northwardScratch=new Cartesian3,encodeScratch=new EncodedCartesian3;ShadowVolumeAppearance.getPlanarTextureCoordinateAttributes=function(e,t,i,r,n){var a=cornerScratch,o=eastwardScratch,s=northwardScratch;computeRectangleBounds(e,i,defaultValue(n,0),a,o,s);var l={};addTextureCoordinateRotationAttributes(l,t);var c=EncodedCartesian3.fromCartesian(a,encodeScratch);return l.southWest_HIGH=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(c.high,[0,0,0])}),l.southWest_LOW=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(c.low,[0,0,0])}),l.eastward=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(o,[0,0,0])}),l.northward=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(s,[0,0,0])}),add2DTextureCoordinateAttributes(e,r,l),l};var spherePointScratch=new Cartesian3;function latLongToSpherical(e,t,i,r){var n=cartographicScratch$4;n.latitude=e,n.longitude=t,n.height=0;var a=Cartographic.toCartesian(n,i,spherePointScratch),o=Math.sqrt(a.x*a.x+a.y*a.y),s=CesiumMath.fastApproximateAtan2(o,a.z),l=CesiumMath.fastApproximateAtan2(a.x,a.y);return r.x=s,r.y=l,r}var sphericalScratch=new Cartesian2;function shouldUseSpherical(e){return Math.max(e.width,e.height)>ShadowVolumeAppearance.MAX_WIDTH_FOR_PLANAR_EXTENTS}ShadowVolumeAppearance.getSphericalExtentGeometryInstanceAttributes=function(e,t,i,r){var n=latLongToSpherical(e.south,e.west,i,sphericalScratch),a=n.x,o=n.y,s=latLongToSpherical(e.north,e.east,i,sphericalScratch),l=s.x,c=s.y,u=0;o>c&&(u=CesiumMath.PI-o,o=-CesiumMath.PI,c+=u),a-=CesiumMath.EPSILON5,o-=CesiumMath.EPSILON5,l+=CesiumMath.EPSILON5;var d=1/((c+=CesiumMath.EPSILON5)-o),h=1/(l-a),p={sphericalExtents:new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:[a,o,h,d]}),longitudeRotation:new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:1,normalize:!1,value:[u]})};return addTextureCoordinateRotationAttributes(p,t),add2DTextureCoordinateAttributes(e,r,p),p},ShadowVolumeAppearance.hasAttributesForTextureCoordinatePlanes=function(e){return defined(e.southWest_HIGH)&&defined(e.southWest_LOW)&&defined(e.northward)&&defined(e.eastward)&&defined(e.planes2D_HIGH)&&defined(e.planes2D_LOW)&&defined(e.uMaxVmax)&&defined(e.uvMinAndExtents)},ShadowVolumeAppearance.hasAttributesForSphericalExtents=function(e){return defined(e.sphericalExtents)&&defined(e.longitudeRotation)&&defined(e.planes2D_HIGH)&&defined(e.planes2D_LOW)&&defined(e.uMaxVmax)&&defined(e.uvMinAndExtents)},ShadowVolumeAppearance.shouldUseSphericalCoordinates=function(e){return shouldUseSpherical(e)},ShadowVolumeAppearance.MAX_WIDTH_FOR_PLANAR_EXTENTS=CesiumMath.toRadians(1);var StencilFunction={NEVER:WebGLConstants$1.NEVER,LESS:WebGLConstants$1.LESS,EQUAL:WebGLConstants$1.EQUAL,LESS_OR_EQUAL:WebGLConstants$1.LEQUAL,GREATER:WebGLConstants$1.GREATER,NOT_EQUAL:WebGLConstants$1.NOTEQUAL,GREATER_OR_EQUAL:WebGLConstants$1.GEQUAL,ALWAYS:WebGLConstants$1.ALWAYS},StencilFunction$1=Object.freeze(StencilFunction),StencilOperation={ZERO:WebGLConstants$1.ZERO,KEEP:WebGLConstants$1.KEEP,REPLACE:WebGLConstants$1.REPLACE,INCREMENT:WebGLConstants$1.INCR,DECREMENT:WebGLConstants$1.DECR,INVERT:WebGLConstants$1.INVERT,INCREMENT_WRAP:WebGLConstants$1.INCR_WRAP,DECREMENT_WRAP:WebGLConstants$1.DECR_WRAP},StencilOperation$1=Object.freeze(StencilOperation),StencilConstants={CESIUM_3D_TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15,setCesium3DTileBit:function(){return{enabled:!0,frontFunction:StencilFunction$1.ALWAYS,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.REPLACE},backFunction:StencilFunction$1.ALWAYS,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.REPLACE},reference:StencilConstants.CESIUM_3D_TILE_MASK,mask:StencilConstants.CESIUM_3D_TILE_MASK}}},StencilConstants$1=Object.freeze(StencilConstants);function ClassificationPrimitive(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).geometryInstances;this.geometryInstances=t,this.show=defaultValue(e.show,!0),this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=defaultValue(e.debugShowShadowVolume,!1),this._debugShowShadowVolume=!1,this._extruded=defaultValue(e._extruded,!1),this._uniformMap=e._uniformMap,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._spColor=void 0,this._spPick2D=void 0,this._spColor2D=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._commandsIgnoreShow=[],this._ready=!1,this._readyPromise=when.defer(),this._primitive=void 0,this._pickPrimitive=e._pickPrimitive,this._hasSphericalExtentsAttribute=!1,this._hasPlanarExtentsAttributes=!1,this._hasPerColorAttribute=!1,this.appearance=e.appearance,this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._usePickOffsets=!1,this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:defaultValue(e.vertexCacheOptimize,!1),interleave:defaultValue(e.interleave,!1),releaseGeometryInstances:defaultValue(e.releaseGeometryInstances,!0),allowPicking:defaultValue(e.allowPicking,!0),asynchronous:defaultValue(e.asynchronous,!0),compressVertices:defaultValue(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0,_createPickOffsets:!0}}function getStencilDepthRenderState$1(e,t){var i=t?StencilFunction$1.EQUAL:StencilFunction$1.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:i,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.DECREMENT_WRAP,zPass:StencilOperation$1.KEEP},backFunction:i,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.INCREMENT_WRAP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},depthMask:!1}}function getColorRenderState(e){return{stencilTest:{enabled:e,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND}}Object.defineProperties(ClassificationPrimitive.prototype,{vertexCacheOptimize:{get:function(){return this._primitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},compressVertices:{get:function(){return this._primitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},_needs2DShader:{get:function(){return this._hasPlanarExtentsAttributes||this._hasSphericalExtentsAttribute}}}),ClassificationPrimitive.isSupported=function(e){return e.context.stencilBuffer};var pickRenderState$1={stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function createRenderStates$5(e,t,i,r){if(!defined(e._rsStencilDepthPass)){var n=!e.debugShowShadowVolume;e._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState$1(n,!1)),e._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState$1(n,!0)),e._rsColorPass=RenderState.fromCache(getColorRenderState(n)),e._rsPickPass=RenderState.fromCache(pickRenderState$1)}}function modifyForEncodedNormals(e,t){if(!e.compressVertices)return t;if(-1!==t.search(/attribute\s+vec3\s+extrudeDirection;/g)){var i="compressedAttributes",r="attribute vec2 "+i+";",n=t;return n=n.replace(/attribute\s+vec3\s+extrudeDirection;/g,""),[r,"vec3 extrudeDirection;\n",n=ShaderSource.replaceMain(n,"czm_non_compressed_main"),"void main() \n{ \n extrudeDirection = czm_octDecode(compressedAttributes, 65535.0);\n czm_non_compressed_main(); \n}"].join("\n")}}function createShaderProgram$2(e,t){var i=t.context,r=e._primitive,n=ShadowVolumeAppearanceVS;n=e._primitive._batchTable.getVertexShaderCallback()(n),n=Primitive$2._appendDistanceDisplayConditionToShader(r,n),n=Primitive$2._modifyShaderPosition(e,n,t.scene3DOnly),n=Primitive$2._updateColorAttribute(r,n);var a=e._hasPlanarExtentsAttributes,o=a||e._hasSphericalExtentsAttribute;e._extruded&&(n=modifyForEncodedNormals(r,n));var s=e._extruded?"EXTRUDED_GEOMETRY":"",l=new ShaderSource({defines:[s],sources:[n]}),c=new ShaderSource({sources:[ShadowVolumeFS]}),u=e._primitive._attributeLocations,d=new ShadowVolumeAppearance(o,a,e.appearance);if(e._spStencil=ShaderProgram.replaceCache({context:i,shaderProgram:e._spStencil,vertexShaderSource:l,fragmentShaderSource:c,attributeLocations:u}),e._primitive.allowPicking){var h=ShaderSource.createPickVertexShaderSource(n);h=Primitive$2._appendShowToShader(r,h),h=Primitive$2._updatePickColorAttribute(h);var p=d.createPickFragmentShader(!1),f=d.createPickVertexShader([s],h,!1,t.mapProjection);if(e._spPick=ShaderProgram.replaceCache({context:i,shaderProgram:e._spPick,vertexShaderSource:f,fragmentShaderSource:p,attributeLocations:u}),o){var m=i.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!defined(m)){var g=d.createPickFragmentShader(!0),_=d.createPickVertexShader([s],h,!0,t.mapProjection);m=i.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:_,fragmentShaderSource:g,attributeLocations:u})}e._spPick2D=m}}else e._spPick=ShaderProgram.fromCache({context:i,vertexShaderSource:l,fragmentShaderSource:c,attributeLocations:u});l=new ShaderSource({defines:[s],sources:[n=Primitive$2._appendShowToShader(r,n)]}),e._sp=ShaderProgram.replaceCache({context:i,shaderProgram:e._sp,vertexShaderSource:l,fragmentShaderSource:c,attributeLocations:u});var y=d.createFragmentShader(!1),v=d.createVertexShader([s],n,!1,t.mapProjection);if(e._spColor=ShaderProgram.replaceCache({context:i,shaderProgram:e._spColor,vertexShaderSource:v,fragmentShaderSource:y,attributeLocations:u}),o){var C=i.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!defined(C)){var T=d.createFragmentShader(!0),S=d.createVertexShader([s],n,!0,t.mapProjection);C=i.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:S,fragmentShaderSource:T,attributeLocations:u})}e._spColor2D=C}}function createColorCommands$1(e,t){var i,r,n,a=e._primitive,o=2*a._va.length;t.length=o;var s=0,l=a._batchTable.getUniformMapCallback()(e._uniformMap),c=e._needs2DShader;for(i=0;i<o;i+=2){var u=a._va[s++];defined(r=t[i])||(r=t[i]=new DrawCommand({owner:e,primitiveType:a._primitiveType})),r.vertexArray=u,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=l,r.pass=Pass$1.TERRAIN_CLASSIFICATION,(n=DrawCommand.shallowClone(r,r.derivedCommands.tileset)).renderState=e._rsStencilDepthPass3DTiles,n.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=n,defined(r=t[i+1])||(r=t[i+1]=new DrawCommand({owner:e,primitiveType:a._primitiveType})),r.vertexArray=u,r.renderState=e._rsColorPass,r.shaderProgram=e._spColor,r.pass=Pass$1.TERRAIN_CLASSIFICATION;var d=e.appearance.material;if(defined(d)&&(l=combine$2(l,d._uniforms)),r.uniformMap=l,(n=DrawCommand.shallowClone(r,r.derivedCommands.tileset)).pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=n,c){var h=DrawCommand.shallowClone(r,r.derivedCommands.appearance2D);h.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=h,(h=DrawCommand.shallowClone(n,n.derivedCommands.appearance2D)).shaderProgram=e._spColor2D,n.derivedCommands.appearance2D=h}}var p=e._commandsIgnoreShow,f=e._spStencil,m=0;o=p.length=o/2;for(var g=0;g<o;++g){var _=p[g]=DrawCommand.shallowClone(t[m],p[g]);_.shaderProgram=f,_.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,m+=2}}function createPickCommands$1(e,t){var i,r,n,a,o,s=e._usePickOffsets,l=e._primitive,c=2*l._va.length,u=0;s&&(c=2*(i=l._pickOffsets).length),t.length=c;var d=0,h=l._batchTable.getUniformMapCallback()(e._uniformMap),p=e._needs2DShader;for(n=0;n<c;n+=2){var f=l._va[d++];if(s&&(r=i[u++],f=l._va[r.index]),defined(a=t[n])||(a=t[n]=new DrawCommand({owner:e,primitiveType:l._primitiveType,pickOnly:!0})),a.vertexArray=f,a.renderState=e._rsStencilDepthPass,a.shaderProgram=e._sp,a.uniformMap=h,a.pass=Pass$1.TERRAIN_CLASSIFICATION,s&&(a.offset=r.offset,a.count=r.count),(o=DrawCommand.shallowClone(a,a.derivedCommands.tileset)).renderState=e._rsStencilDepthPass3DTiles,o.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,a.derivedCommands.tileset=o,defined(a=t[n+1])||(a=t[n+1]=new DrawCommand({owner:e,primitiveType:l._primitiveType,pickOnly:!0})),a.vertexArray=f,a.renderState=e._rsPickPass,a.shaderProgram=e._spPick,a.uniformMap=h,a.pass=Pass$1.TERRAIN_CLASSIFICATION,s&&(a.offset=r.offset,a.count=r.count),(o=DrawCommand.shallowClone(a,a.derivedCommands.tileset)).pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,a.derivedCommands.tileset=o,p){var m=DrawCommand.shallowClone(a,a.derivedCommands.pick2D);m.shaderProgram=e._spPick2D,a.derivedCommands.pick2D=m,(m=DrawCommand.shallowClone(o,o.derivedCommands.pick2D)).shaderProgram=e._spPick2D,o.derivedCommands.pick2D=m}}}function createCommands$4(e,t,i,r,n,a,o){createColorCommands$1(e,a),createPickCommands$1(e,o)}function boundingVolumeIndex$1(e,t){return Math.floor(e%t/2)}function updateAndQueueRenderCommand$1(e,t,i,r,n,a){e.modelMatrix=i,e.boundingVolume=n,e.cull=r,e.debugShowBoundingVolume=a,t.commandList.push(e)}function updateAndQueuePickCommand$1(e,t,i,r,n){e.modelMatrix=i,e.boundingVolume=n,e.cull=r,t.commandList.push(e)}function updateAndQueueCommands$2(e,t,i,r,n,a,o,s){var l,c=e._primitive;Primitive$2._updateBoundingVolumes(c,t,n),t.mode===SceneMode$1.SCENE3D?l=c._boundingSphereWC:t.mode===SceneMode$1.COLUMBUS_VIEW?l=c._boundingSphereCV:t.mode===SceneMode$1.SCENE2D&&defined(c._boundingSphere2D)?l=c._boundingSphere2D:defined(c._boundingSphereMorph)&&(l=c._boundingSphereMorph);var u,d,h=e.classificationType,p=h!==ClassificationType$1.CESIUM_3D_TILE,f=h!==ClassificationType$1.TERRAIN,m=t.passes;if(m.render){var g=i.length;for(u=0;u<g;++u)d=l[boundingVolumeIndex$1(u,g)],p&&updateAndQueueRenderCommand$1(i[u],t,n,a,d,o),f&&updateAndQueueRenderCommand$1(i[u].derivedCommands.tileset,t,n,a,d,o);if(t.invertClassification){var _=e._commandsIgnoreShow,y=_.length;for(u=0;u<y;++u)d=l[u],updateAndQueueRenderCommand$1(_[u],t,n,a,d,o)}}if(m.pick){var v=r.length,C=c._pickOffsets;for(u=0;u<v;++u){d=l[C[boundingVolumeIndex$1(u,v)].index],p&&updateAndQueuePickCommand$1(r[u],t,n,a,d),f&&updateAndQueuePickCommand$1(r[u].derivedCommands.tileset,t,n,a,d)}}}ClassificationPrimitive.prototype.update=function(e){if(defined(this._primitive)||defined(this.geometryInstances)){var t=this.appearance;defined(t)&&defined(t.material)&&t.material.update(e.context);var i=this,r=this._primitiveOptions;if(!defined(this._primitive)){var n,a,o,s,l=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],c=l.length,u=!1,d=!0,h=!1,p=!1;for(c>0&&(o=l[0].attributes,h=ShadowVolumeAppearance.hasAttributesForSphericalExtents(o),p=ShadowVolumeAppearance.hasAttributesForTextureCoordinatePlanes(o),s=o.color),n=0;n<c;n++){var f=(a=l[n]).attributes.color;defined(f)&&(u=!0),d=d&&defined(f)&&ColorGeometryInstanceAttribute.equals(s,f)}if(!d&&!h&&!p)throw new DeveloperError("All GeometryInstances must have the same color attribute except via GroundPrimitives");u&&!defined(t)&&(t=new PerInstanceColorAppearance({flat:!0}),this.appearance=t),this._usePickOffsets=!h&&!p,this._hasSphericalExtentsAttribute=h,this._hasPlanarExtentsAttributes=p,this._hasPerColorAttribute=u;var m=new Array(c);for(n=0;n<c;++n)a=l[n],m[n]=new GeometryInstance({geometry:a.geometry,attributes:a.attributes,modelMatrix:a.modelMatrix,id:a.id,pickPrimitive:defaultValue(this._pickPrimitive,i)});r.appearance=t,r.geometryInstances=m,defined(this._createBoundingVolumeFunction)&&(r._createBoundingVolumeFunction=function(e,t){i._createBoundingVolumeFunction(e,t)}),r._createRenderStatesFunction=function(e,t,r,n){createRenderStates$5(i)},r._createShaderProgramFunction=function(e,t,r){createShaderProgram$2(i,t)},r._createCommandsFunction=function(e,t,r,n,a,o,s){createCommands$4(i,void 0,void 0,!0,!1,o,s)},defined(this._updateAndQueueCommandsFunction)?r._updateAndQueueCommandsFunction=function(e,t,r,n,a,o,s,l){i._updateAndQueueCommandsFunction(e,t,r,n,a,o,s,l)}:r._updateAndQueueCommandsFunction=function(e,t,r,n,a,o,s,l){updateAndQueueCommands$2(i,t,r,n,a,o,s)},this._primitive=new Primitive$2(r),this._primitive.readyPromise.then((function(e){i._ready=!0,i.releaseGeometryInstances&&(i.geometryInstances=void 0);var t=e._error;defined(t)?i._readyPromise.reject(t):i._readyPromise.resolve(i)}))}this.debugShowShadowVolume&&!this._debugShowShadowVolume&&this._ready?(this._debugShowShadowVolume=!0,this._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState$1(!1,!1)),this._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState$1(!1,!0)),this._rsColorPass=RenderState.fromCache(getColorRenderState(!1))):!this.debugShowShadowVolume&&this._debugShowShadowVolume&&(this._debugShowShadowVolume=!1,this._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState$1(!0,!1)),this._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState$1(!0,!0)),this._rsColorPass=RenderState.fromCache(getColorRenderState(!0))),this._primitive.appearance!==t&&(this._primitive.appearance=t),this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)}},ClassificationPrimitive.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},ClassificationPrimitive.prototype.isDestroyed=function(){return!1},ClassificationPrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._spColor=this._spColor&&this._spColor.destroy(),this._spPick2D=void 0,this._spColor2D=void 0,destroyObject(this)};var GroundPrimitiveUniformMap={u_globeMinimumAltitude:function(){return 55e3}};function GroundPrimitive(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).appearance,i=e.geometryInstances;if(!defined(t)&&defined(i))for(var r=Array.isArray(i)?i:[i],n=r.length,a=0;a<n;a++){var o=r[a].attributes;if(defined(o)&&defined(o.color)){t=new PerInstanceColorAppearance({flat:!0});break}}this.appearance=t,this.geometryInstances=e.geometryInstances,this.show=defaultValue(e.show,!0),this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=defaultValue(e.debugShowShadowVolume,!1),this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1,this._readyPromise=when.defer(),this._primitive=void 0,this._maxHeight=void 0,this._minHeight=void 0,this._maxTerrainHeight=ApproximateTerrainHeights._defaultMaxTerrainHeight,this._minTerrainHeight=ApproximateTerrainHeights._defaultMinTerrainHeight,this._boundingSpheresKeys=[],this._boundingSpheres=[],this._useFragmentCulling=!1,this._zIndex=void 0;this._classificationPrimitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:defaultValue(e.vertexCacheOptimize,!1),interleave:defaultValue(e.interleave,!1),releaseGeometryInstances:defaultValue(e.releaseGeometryInstances,!0),allowPicking:defaultValue(e.allowPicking,!0),asynchronous:defaultValue(e.asynchronous,!0),compressVertices:defaultValue(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_updateAndQueueCommandsFunction:void 0,_pickPrimitive:this,_extruded:!0,_uniformMap:GroundPrimitiveUniformMap}}function getComputeMaximumHeightFunction(e){return function(t,i){var r=i.maximumRadius,n=r/Math.cos(.5*t)-r;return e._maxHeight+n}}function getComputeMinimumHeightFunction(e){return function(t,i){return e._minHeight}}Object.defineProperties(GroundPrimitive.prototype,{vertexCacheOptimize:{get:function(){return this._classificationPrimitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._classificationPrimitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._classificationPrimitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._classificationPrimitiveOptions.allowPicking}},asynchronous:{get:function(){return this._classificationPrimitiveOptions.asynchronous}},compressVertices:{get:function(){return this._classificationPrimitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}}),GroundPrimitive.isSupported=ClassificationPrimitive.isSupported;var scratchBVCartesianHigh=new Cartesian3,scratchBVCartesianLow=new Cartesian3,scratchBVCartesian=new Cartesian3,scratchBVCartographic=new Cartographic,scratchBVRectangle=new Rectangle;function getRectangle(e,t){var i=e.mapProjection.ellipsoid;if(!defined(t.attributes)||!defined(t.attributes.position3DHigh))return defined(t.rectangle)?t.rectangle:void 0;for(var r=t.attributes.position3DHigh.values,n=t.attributes.position3DLow.values,a=r.length,o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=0;u<a;u+=3){var d=Cartesian3.unpack(r,u,scratchBVCartesianHigh),h=Cartesian3.unpack(n,u,scratchBVCartesianLow),p=Cartesian3.add(d,h,scratchBVCartesian),f=i.cartesianToCartographic(p,scratchBVCartographic),m=f.latitude,g=f.longitude;o=Math.min(o,m),s=Math.min(s,g),l=Math.max(l,m),c=Math.max(c,g)}var _=scratchBVRectangle;return _.north=l,_.south=o,_.east=c,_.west=s,_}function setMinMaxTerrainHeights(e,t,i){var r=ApproximateTerrainHeights.getMinimumMaximumHeights(t,i);e._minTerrainHeight=r.minimumTerrainHeight,e._maxTerrainHeight=r.maximumTerrainHeight}function createBoundingVolume(e,t,i){var r=t.mapProjection.ellipsoid,n=getRectangle(t,i),a=OrientedBoundingBox.fromRectangle(n,e._minHeight,e._maxHeight,r);if(e._boundingVolumes.push(a),!t.scene3DOnly){var o=t.mapProjection,s=BoundingSphere.fromRectangleWithHeights2D(n,o,e._maxHeight,e._minHeight);Cartesian3.fromElements(s.center.z,s.center.x,s.center.y,s.center),e._boundingVolumes2D.push(s)}}function boundingVolumeIndex(e,t){return Math.floor(e%t/2)}function updateAndQueueRenderCommand(e,t,i,r,n,a,o){var s=e._primitive;i.mode!==SceneMode$1.SCENE3D&&t.shaderProgram===s._spColor&&s._needs2DShader&&(t=t.derivedCommands.appearance2D),t.owner=e,t.modelMatrix=r,t.boundingVolume=a,t.cull=n,t.debugShowBoundingVolume=o,i.commandList.push(t)}function updateAndQueuePickCommand(e,t,i,r,n,a){var o=e._primitive;i.mode!==SceneMode$1.SCENE3D&&t.shaderProgram===o._spPick&&o._needs2DShader&&(t=t.derivedCommands.pick2D),t.owner=e,t.modelMatrix=r,t.boundingVolume=a,t.cull=n,i.commandList.push(t)}function updateAndQueueCommands$1(e,t,i,r,n,a,o,s){var l;l=t.mode===SceneMode$1.SCENE3D?e._boundingVolumes:e._boundingVolumes2D;var c,u,d=e.classificationType,h=d!==ClassificationType$1.CESIUM_3D_TILE,p=d!==ClassificationType$1.TERRAIN,f=t.passes,m=e._primitive;if(f.render){var g=i.length;for(c=0;c<g;++c)u=l[boundingVolumeIndex(c,g)],h&&updateAndQueueRenderCommand(e,i[c],t,n,a,u,o),p&&updateAndQueueRenderCommand(e,i[c].derivedCommands.tileset,t,n,a,u,o);if(t.invertClassification){var _=m._commandsIgnoreShow,y=_.length;for(c=0;c<y;++c)u=l[c],updateAndQueueRenderCommand(e,_[c],t,n,a,u,o)}}if(f.pick){var v,C=r.length;for(e._useFragmentCulling||(v=m._primitive._pickOffsets),c=0;c<C;++c){if(u=l[boundingVolumeIndex(c,C)],!e._useFragmentCulling)u=l[v[boundingVolumeIndex(c,C)].index];h&&updateAndQueuePickCommand(e,r[c],t,n,a,u),p&&updateAndQueuePickCommand(e,r[c].derivedCommands.tileset,t,n,a,u)}}}function MaterialProperty(){DeveloperError.throwInstantiationError()}function DynamicGeometryUpdater$1(e,t,i){this._primitives=t,this._orderedGroundPrimitives=i,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=e,this._options=e._options,this._entity=e._entity,this._material=void 0}GroundPrimitive.initializeTerrainHeights=function(){return ApproximateTerrainHeights.initialize()},GroundPrimitive.prototype.update=function(e){if(defined(this._primitive)||defined(this.geometryInstances))if(ApproximateTerrainHeights.initialized){var t=this,i=this._classificationPrimitiveOptions;if(!defined(this._primitive)){var r,n,a,o,s,l=e.mapProjection.ellipsoid,c=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],u=c.length,d=new Array(u);for(o=0;o<u;++o){var h=getRectangle(e,n=(r=c[o]).geometry);defined(s)?defined(h)&&Rectangle.union(s,h,s):s=Rectangle.clone(h);var p=r.id;if(defined(p)&&defined(h)){var f=ApproximateTerrainHeights.getBoundingSphere(h,l);this._boundingSpheresKeys.push(p),this._boundingSpheres.push(f)}!defined(a=n.constructor)||defined(a.createShadowVolume)}defined(s)&&setMinMaxTerrainHeights(this,s,l);var m=e.terrainExaggeration,g=e.terrainExaggerationRelativeHeight;this._minHeight=TerrainExaggeration.getHeight(this._minTerrainHeight,m,g),this._maxHeight=TerrainExaggeration.getHeight(this._maxTerrainHeight,m,g);var _=GroundPrimitive._supportsMaterials(e.context);if(this._useFragmentCulling=_,_){var y,v=!0;for(o=0;o<u;++o)if(s=getRectangle(e,n=(r=c[o]).geometry),ShadowVolumeAppearance.shouldUseSphericalCoordinates(s)){v=!1;break}for(o=0;o<u;++o){a=(n=(r=c[o]).geometry).constructor;var C=getRectangle(e,n),T=n.textureCoordinateRotationPoints;y=v?ShadowVolumeAppearance.getPlanarTextureCoordinateAttributes(C,T,l,e.mapProjection,this._maxHeight):ShadowVolumeAppearance.getSphericalExtentGeometryInstanceAttributes(C,T,l,e.mapProjection);var S=r.attributes;for(var A in S)S.hasOwnProperty(A)&&(y[A]=S[A]);d[o]=new GeometryInstance({geometry:a.createShadowVolume(n,getComputeMinimumHeightFunction(this),getComputeMaximumHeightFunction(this)),attributes:y,id:r.id})}}else for(o=0;o<u;++o)a=(n=(r=c[o]).geometry).constructor,d[o]=new GeometryInstance({geometry:a.createShadowVolume(n,getComputeMinimumHeightFunction(this),getComputeMaximumHeightFunction(this)),attributes:r.attributes,id:r.id});i.geometryInstances=d,i.appearance=this.appearance,i._createBoundingVolumeFunction=function(e,i){createBoundingVolume(t,e,i)},i._updateAndQueueCommandsFunction=function(e,i,r,n,a,o,s,l){updateAndQueueCommands$1(t,i,r,n,a,o,s)},this._primitive=new ClassificationPrimitive(i),this._primitive.readyPromise.then((function(e){t._ready=!0,t.releaseGeometryInstances&&(t.geometryInstances=void 0);var i=e._error;defined(i)?t._readyPromise.reject(i):t._readyPromise.resolve(t)}))}this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowShadowVolume=this.debugShowShadowVolume,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)}else GroundPrimitive.initializeTerrainHeights()},GroundPrimitive.prototype.getBoundingSphere=function(e){var t=this._boundingSpheresKeys.indexOf(e);if(-1!==t)return this._boundingSpheres[t]},GroundPrimitive.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},GroundPrimitive.prototype.isDestroyed=function(){return!1},GroundPrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)},GroundPrimitive._supportsMaterials=function(e){return e.depthTexture},GroundPrimitive.supportsMaterials=function(e){return GroundPrimitive._supportsMaterials(e.frameState.context)},Object.defineProperties(MaterialProperty.prototype,{isConstant:{get:DeveloperError.throwInstantiationError},definitionChanged:{get:DeveloperError.throwInstantiationError}}),MaterialProperty.prototype.getType=DeveloperError.throwInstantiationError,MaterialProperty.prototype.getValue=DeveloperError.throwInstantiationError,MaterialProperty.prototype.equals=DeveloperError.throwInstantiationError,MaterialProperty.getValue=function(e,t,i){var r;return defined(t)&&defined(r=t.getType(e))?(defined(i)&&i.type===r||(i=Material$3.fromType(r)),t.getValue(e,i.uniforms),i):(defined(i)&&i.type===Material$3.ColorType||(i=Material$3.fromType(Material$3.ColorType)),Color.clone(Color.WHITE,i.uniforms.color),i)},DynamicGeometryUpdater$1.prototype._isHidden=function(e,t,i){return!e.isShowing||!e.isAvailable(i)||!Property.getValueOrDefault(t.show,i,!0)},DynamicGeometryUpdater$1.prototype._setOptions=DeveloperError.throwInstantiationError,DynamicGeometryUpdater$1.prototype.update=function(e){var t=this._geometryUpdater,i=t._onTerrain,r=this._primitives,n=this._orderedGroundPrimitives;i?n.remove(this._primitive):(r.removeAndDestroy(this._primitive),r.removeAndDestroy(this._outlinePrimitive),this._outlinePrimitive=void 0),this._primitive=void 0;var a=this._entity,o=a[this._geometryUpdater._geometryPropertyName];if(this._setOptions(a,o,e),!this._isHidden(a,o,e)){var s=this._geometryUpdater.shadowsProperty.getValue(e),l=this._options;if(!defined(o.fill)||o.fill.getValue(e)){var c,u=t.fillMaterialProperty,d=u instanceof ColorMaterialProperty,h=t._getIsClosed(l);if(d)c=new PerInstanceColorAppearance({closed:h,flat:i&&!t._supportsMaterialsforEntitiesOnTerrain});else{var p=MaterialProperty.getValue(e,u,this._material);this._material=p,c=new MaterialAppearance({material:p,translucent:p.isTranslucent(),closed:h})}if(i)l.vertexFormat=PerInstanceColorAppearance.VERTEX_FORMAT,this._primitive=n.add(new GroundPrimitive({geometryInstances:this._geometryUpdater.createFillGeometryInstance(e),appearance:c,asynchronous:!1,shadows:s,classificationType:this._geometryUpdater.classificationTypeProperty.getValue(e)}),Property.getValueOrUndefined(this._geometryUpdater.zIndex,e));else{l.vertexFormat=c.vertexFormat;var f=this._geometryUpdater.createFillGeometryInstance(e);d&&(c.translucent=255!==f.attributes.color.value[3]),this._primitive=r.add(new Primitive$2({geometryInstances:f,appearance:c,asynchronous:!1,shadows:s}))}}if(!i&&defined(o.outline)&&o.outline.getValue(e)){var m=this._geometryUpdater.createOutlineGeometryInstance(e),g=Property.getValueOrDefault(o.outlineWidth,e,1);this._outlinePrimitive=r.add(new Primitive$2({geometryInstances:m,appearance:new PerInstanceColorAppearance({flat:!0,translucent:255!==m.attributes.color.value[3],renderState:{lineWidth:t._scene.clampLineWidth(g)}}),asynchronous:!1,shadows:s}))}}},DynamicGeometryUpdater$1.prototype.getBoundingSphere=function(e){var t,i=this._entity,r=this._primitive,n=this._outlinePrimitive;return defined(r)&&r.show&&r.ready&&defined(t=r.getGeometryInstanceAttributes(i))&&defined(t.boundingSphere)||defined(n)&&n.show&&n.ready&&defined(t=n.getGeometryInstanceAttributes(i))&&defined(t.boundingSphere)?(BoundingSphere.clone(t.boundingSphere,e),BoundingSphereState$1.DONE):defined(r)&&!r.ready||defined(n)&&!n.ready?BoundingSphereState$1.PENDING:BoundingSphereState$1.FAILED},DynamicGeometryUpdater$1.prototype.isDestroyed=function(){return!1},DynamicGeometryUpdater$1.prototype.destroy=function(){var e=this._primitives,t=this._orderedGroundPrimitives;this._geometryUpdater._onTerrain?t.remove(this._primitive):e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),destroyObject(this)};var PolylineShadowVolumeFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec4 v_startPlaneNormalEcAndHalfWidth;\nvarying vec4 v_endPlaneNormalEcAndBatchId;\nvarying vec4 v_rightPlaneEC;\nvarying vec4 v_endEcAndStartEcX;\nvarying vec4 v_texcoordNormalizationAndStartEcYZ;\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\nvoid main(void)\n{\nfloat logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));\nvec3 ecStart = vec3(v_endEcAndStartEcX.w, v_texcoordNormalizationAndStartEcYZ.zw);\nif (logDepthOrDepth == 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\neyeCoordinate /= eyeCoordinate.w;\nfloat halfMaxWidth = v_startPlaneNormalEcAndHalfWidth.w * czm_metersPerPixel(eyeCoordinate);\nfloat widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);\nfloat distanceFromStart = czm_planeDistance(v_startPlaneNormalEcAndHalfWidth.xyz, -dot(ecStart, v_startPlaneNormalEcAndHalfWidth.xyz), eyeCoordinate.xyz);\nfloat distanceFromEnd = czm_planeDistance(v_endPlaneNormalEcAndBatchId.xyz, -dot(v_endEcAndStartEcX.xyz, v_endPlaneNormalEcAndBatchId.xyz), eyeCoordinate.xyz);\nif (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\nvec3 alignedPlaneNormal;\nalignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_startPlaneNormalEcAndHalfWidth.xyz);\nalignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));\ndistanceFromStart = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, ecStart), eyeCoordinate.xyz);\nalignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_endPlaneNormalEcAndBatchId.xyz);\nalignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));\ndistanceFromEnd = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, v_endEcAndStartEcX.xyz), eyeCoordinate.xyz);\n#ifdef PER_INSTANCE_COLOR\ngl_FragColor = czm_gammaCorrect(v_color);\n#else // PER_INSTANCE_COLOR\nfloat s = clamp(distanceFromStart / (distanceFromStart + distanceFromEnd), 0.0, 1.0);\ns = (s * v_texcoordNormalizationAndStartEcYZ.x) + v_texcoordNormalizationAndStartEcYZ.y;\nfloat t = (widthwiseDistance + halfMaxWidth) / (2.0 * halfMaxWidth);\nczm_materialInput materialInput;\nmaterialInput.s = s;\nmaterialInput.st = vec2(s, t);\nmaterialInput.str = vec3(s, t, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#endif // PER_INSTANCE_COLOR\ngl_FragColor.rgb *= gl_FragColor.a;\nczm_writeDepthClamp();\n}\n",PolylineShadowVolumeMorphFS="varying vec3 v_forwardDirectionEC;\nvarying vec3 v_texcoordNormalizationAndHalfWidth;\nvarying float v_batchId;\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#else\nvarying vec2 v_alignedPlaneDistances;\nvarying float v_texcoordT;\n#endif\nfloat rayPlaneDistanceUnsafe(vec3 origin, vec3 direction, vec3 planeNormal, float planeDistance) {\nreturn (-planeDistance - dot(planeNormal, origin)) / dot(planeNormal, direction);\n}\nvoid main(void)\n{\nvec4 eyeCoordinate = gl_FragCoord;\neyeCoordinate /= eyeCoordinate.w;\n#ifdef PER_INSTANCE_COLOR\ngl_FragColor = czm_gammaCorrect(v_color);\n#else // PER_INSTANCE_COLOR\nfloat distanceFromStart = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, -v_forwardDirectionEC, v_forwardDirectionEC.xyz, v_alignedPlaneDistances.x);\nfloat distanceFromEnd = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, v_forwardDirectionEC, -v_forwardDirectionEC.xyz, v_alignedPlaneDistances.y);\ndistanceFromStart = max(0.0, distanceFromStart);\ndistanceFromEnd = max(0.0, distanceFromEnd);\nfloat s = distanceFromStart / (distanceFromStart + distanceFromEnd);\ns = (s * v_texcoordNormalizationAndHalfWidth.x) + v_texcoordNormalizationAndHalfWidth.y;\nczm_materialInput materialInput;\nmaterialInput.s = s;\nmaterialInput.st = vec2(s, v_texcoordT);\nmaterialInput.str = vec3(s, v_texcoordT, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#endif // PER_INSTANCE_COLOR\n}\n",PolylineShadowVolumeMorphVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 startHiAndForwardOffsetX;\nattribute vec4 startLoAndForwardOffsetY;\nattribute vec4 startNormalAndForwardOffsetZ;\nattribute vec4 endNormalAndTextureCoordinateNormalizationX;\nattribute vec4 rightNormalAndTextureCoordinateNormalizationY;\nattribute vec4 startHiLo2D;\nattribute vec4 offsetAndRight2D;\nattribute vec4 startEndNormals2D;\nattribute vec2 texcoordNormalization2D;\nattribute float batchId;\nvarying vec3 v_forwardDirectionEC;\nvarying vec3 v_texcoordNormalizationAndHalfWidth;\nvarying float v_batchId;\n#ifdef WIDTH_VARYING\nvarying float v_width;\n#endif\n#ifdef ANGLE_VARYING\nvarying float v_polylineAngle;\n#endif\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#else\nvarying vec2 v_alignedPlaneDistances;\nvarying float v_texcoordT;\n#endif\nvoid main()\n{\nv_batchId = batchId;\nvec4 posRelativeToEye2D = czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw));\nvec4 posRelativeToEye3D = czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz);\nvec4 posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);\nvec3 posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;\nvec3 posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;\nvec3 startEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;\nvec4 startPlane2D;\nvec4 startPlane3D;\nstartPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);\nstartPlane3D.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;\nstartPlane2D.w = -dot(startPlane2D.xyz, posEc2D);\nstartPlane3D.w = -dot(startPlane3D.xyz, posEc3D);\nvec4 rightPlane2D;\nvec4 rightPlane3D;\nrightPlane2D.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);\nrightPlane3D.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;\nrightPlane2D.w = -dot(rightPlane2D.xyz, posEc2D);\nrightPlane3D.w = -dot(rightPlane3D.xyz, posEc3D);\nposRelativeToEye2D = posRelativeToEye2D + vec4(0.0, offsetAndRight2D.xy, 0.0);\nposRelativeToEye3D = posRelativeToEye3D + vec4(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w, 0.0);\nposRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);\nposEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;\nposEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;\nvec3 endEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;\nvec3 forwardEc3D = czm_normal * normalize(vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w));\nvec3 forwardEc2D = czm_normal * normalize(vec3(0.0, offsetAndRight2D.xy));\nvec4 endPlane2D;\nvec4 endPlane3D;\nendPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);\nendPlane3D.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;\nendPlane2D.w = -dot(endPlane2D.xyz, posEc2D);\nendPlane3D.w = -dot(endPlane3D.xyz, posEc3D);\nv_forwardDirectionEC = normalize(endEC - startEC);\nvec2 cleanTexcoordNormalization2D;\ncleanTexcoordNormalization2D.x = abs(texcoordNormalization2D.x);\ncleanTexcoordNormalization2D.y = czm_branchFreeTernary(texcoordNormalization2D.y > 1.0, 0.0, abs(texcoordNormalization2D.y));\nvec2 cleanTexcoordNormalization3D;\ncleanTexcoordNormalization3D.x = abs(endNormalAndTextureCoordinateNormalizationX.w);\ncleanTexcoordNormalization3D.y = rightNormalAndTextureCoordinateNormalizationY.w;\ncleanTexcoordNormalization3D.y = czm_branchFreeTernary(cleanTexcoordNormalization3D.y > 1.0, 0.0, abs(cleanTexcoordNormalization3D.y));\nv_texcoordNormalizationAndHalfWidth.xy = mix(cleanTexcoordNormalization2D, cleanTexcoordNormalization3D, czm_morphTime);\n#ifdef PER_INSTANCE_COLOR\nv_color = czm_batchTable_color(batchId);\n#else // PER_INSTANCE_COLOR\nv_alignedPlaneDistances.x = -dot(v_forwardDirectionEC, startEC);\nv_alignedPlaneDistances.y = -dot(-v_forwardDirectionEC, endEC);\n#endif // PER_INSTANCE_COLOR\n#ifdef WIDTH_VARYING\nfloat width = czm_batchTable_width(batchId);\nfloat halfWidth = width * 0.5;\nv_width = width;\nv_texcoordNormalizationAndHalfWidth.z = halfWidth;\n#else\nfloat halfWidth = 0.5 * czm_batchTable_width(batchId);\nv_texcoordNormalizationAndHalfWidth.z = halfWidth;\n#endif\nvec4 positionEc3D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow);\nfloat absStartPlaneDistance = abs(czm_planeDistance(startPlane3D, positionEc3D.xyz));\nfloat absEndPlaneDistance = abs(czm_planeDistance(endPlane3D, positionEc3D.xyz));\nvec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane3D.xyz, endPlane3D.xyz);\nvec3 upOrDown = normalize(cross(rightPlane3D.xyz, planeDirection));\nvec3 normalEC = normalize(cross(planeDirection, upOrDown));\nvec3 geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc3D));\ngeodeticSurfaceNormal *= float(0.0 <= rightNormalAndTextureCoordinateNormalizationY.w && rightNormalAndTextureCoordinateNormalizationY.w <= 1.0);\ngeodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;\npositionEc3D.xyz += geodeticSurfaceNormal;\nnormalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);\npositionEc3D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc3D)) * normalEC;\nvec4 positionEc2D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nabsStartPlaneDistance = abs(czm_planeDistance(startPlane2D, positionEc2D.xyz));\nabsEndPlaneDistance = abs(czm_planeDistance(endPlane2D, positionEc2D.xyz));\nplaneDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane2D.xyz, endPlane2D.xyz);\nupOrDown = normalize(cross(rightPlane2D.xyz, planeDirection));\nnormalEC = normalize(cross(planeDirection, upOrDown));\ngeodeticSurfaceNormal = normalize(cross(normalEC, forwardEc2D));\ngeodeticSurfaceNormal *= float(0.0 <= texcoordNormalization2D.y && texcoordNormalization2D.y <= 1.0);\ngeodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;\npositionEc2D.xyz += geodeticSurfaceNormal;\nnormalEC *= sign(texcoordNormalization2D.x);\n#ifndef PER_INSTANCE_COLOR\nv_texcoordT = clamp(sign(texcoordNormalization2D.x), 0.0, 1.0);\n#endif\npositionEc2D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc2D)) * normalEC;\ngl_Position = czm_projection * mix(positionEc2D, positionEc3D, czm_morphTime);\n#ifdef ANGLE_VARYING\nvec2 approxLineDirection = normalize(vec2(v_forwardDirectionEC.x, -v_forwardDirectionEC.y));\napproxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);\nv_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);\n#endif\n}\n",PolylineShadowVolumeVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\n#ifndef COLUMBUS_VIEW_2D\nattribute vec4 startHiAndForwardOffsetX;\nattribute vec4 startLoAndForwardOffsetY;\nattribute vec4 startNormalAndForwardOffsetZ;\nattribute vec4 endNormalAndTextureCoordinateNormalizationX;\nattribute vec4 rightNormalAndTextureCoordinateNormalizationY;\n#else\nattribute vec4 startHiLo2D;\nattribute vec4 offsetAndRight2D;\nattribute vec4 startEndNormals2D;\nattribute vec2 texcoordNormalization2D;\n#endif\nattribute float batchId;\nvarying vec4 v_startPlaneNormalEcAndHalfWidth;\nvarying vec4 v_endPlaneNormalEcAndBatchId;\nvarying vec4 v_rightPlaneEC;\nvarying vec4 v_endEcAndStartEcX;\nvarying vec4 v_texcoordNormalizationAndStartEcYZ;\n#ifdef WIDTH_VARYING\nvarying float v_width;\n#endif\n#ifdef ANGLE_VARYING\nvarying float v_polylineAngle;\n#endif\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\nvoid main()\n{\n#ifdef COLUMBUS_VIEW_2D\nvec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw))).xyz;\nvec3 forwardDirectionEC = czm_normal * vec3(0.0, offsetAndRight2D.xy);\nvec3 ecEnd = forwardDirectionEC + ecStart;\nforwardDirectionEC = normalize(forwardDirectionEC);\nv_rightPlaneEC.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);\nv_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);\nvec4 startPlaneEC;\nstartPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);\nstartPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);\nvec4 endPlaneEC;\nendPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);\nendPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);\nv_texcoordNormalizationAndStartEcYZ.x = abs(texcoordNormalization2D.x);\nv_texcoordNormalizationAndStartEcYZ.y = texcoordNormalization2D.y;\n#else // COLUMBUS_VIEW_2D\nvec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz)).xyz;\nvec3 offset = czm_normal * vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w);\nvec3 ecEnd = ecStart + offset;\nvec3 forwardDirectionEC = normalize(offset);\nvec4 startPlaneEC;\nstartPlaneEC.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;\nstartPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);\nvec4 endPlaneEC;\nendPlaneEC.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;\nendPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);\nv_rightPlaneEC.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;\nv_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);\nv_texcoordNormalizationAndStartEcYZ.x = abs(endNormalAndTextureCoordinateNormalizationX.w);\nv_texcoordNormalizationAndStartEcYZ.y = rightNormalAndTextureCoordinateNormalizationY.w;\n#endif // COLUMBUS_VIEW_2D\nv_endEcAndStartEcX.xyz = ecEnd;\nv_endEcAndStartEcX.w = ecStart.x;\nv_texcoordNormalizationAndStartEcYZ.zw = ecStart.yz;\n#ifdef PER_INSTANCE_COLOR\nv_color = czm_batchTable_color(batchId);\n#endif // PER_INSTANCE_COLOR\nvec4 positionRelativeToEye = czm_computePosition();\nvec4 positionEC = czm_modelViewRelativeToEye * positionRelativeToEye;\nfloat absStartPlaneDistance = abs(czm_planeDistance(startPlaneEC, positionEC.xyz));\nfloat absEndPlaneDistance = abs(czm_planeDistance(endPlaneEC, positionEC.xyz));\nvec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlaneEC.xyz, endPlaneEC.xyz);\nvec3 upOrDown = normalize(cross(v_rightPlaneEC.xyz, planeDirection));\nvec3 normalEC = normalize(cross(planeDirection, upOrDown));\nupOrDown = cross(forwardDirectionEC, normalEC);\nupOrDown = float(czm_sceneMode == czm_sceneMode3D) * upOrDown;\nupOrDown = float(v_texcoordNormalizationAndStartEcYZ.y > 1.0 || v_texcoordNormalizationAndStartEcYZ.y < 0.0) * upOrDown;\nupOrDown = min(GLOBE_MINIMUM_ALTITUDE, czm_geometricToleranceOverMeter * length(positionRelativeToEye.xyz)) * upOrDown;\npositionEC.xyz += upOrDown;\nv_texcoordNormalizationAndStartEcYZ.y = czm_branchFreeTernary(v_texcoordNormalizationAndStartEcYZ.y > 1.0, 0.0, abs(v_texcoordNormalizationAndStartEcYZ.y));\nfloat width = czm_batchTable_width(batchId);\n#ifdef WIDTH_VARYING\nv_width = width;\n#endif\nv_startPlaneNormalEcAndHalfWidth.xyz = startPlaneEC.xyz;\nv_startPlaneNormalEcAndHalfWidth.w = width * 0.5;\nv_endPlaneNormalEcAndBatchId.xyz = endPlaneEC.xyz;\nv_endPlaneNormalEcAndBatchId.w = batchId;\nwidth = width * max(0.0, czm_metersPerPixel(positionEC));\nwidth = width / dot(normalEC, v_rightPlaneEC.xyz);\n#ifdef COLUMBUS_VIEW_2D\nnormalEC *= sign(texcoordNormalization2D.x);\n#else\nnormalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);\n#endif\npositionEC.xyz += width * normalEC;\ngl_Position = czm_depthClamp(czm_projection * positionEC);\n#ifdef ANGLE_VARYING\nvec2 approxLineDirection = normalize(vec2(forwardDirectionEC.x, -forwardDirectionEC.y));\napproxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);\nv_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);\n#endif\n}\n",PolylineColorAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec4 color;\nattribute float batchId;\nvarying vec4 v_color;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nfloat angle;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\ngl_Position = czm_viewportOrthographic * positionWC;\nv_color = color;\n}\n",PolylineCommon="void clipLineSegmentToNearPlane(\nvec3 p0,\nvec3 p1,\nout vec4 positionWC,\nout bool clipped,\nout bool culledByNearPlane,\nout vec4 clippedPositionEC)\n{\nculledByNearPlane = false;\nclipped = false;\nvec3 p0ToP1 = p1 - p0;\nfloat magnitude = length(p0ToP1);\nvec3 direction = normalize(p0ToP1);\nfloat endPoint0Distance = czm_currentFrustum.x + p0.z;\nfloat denominator = -direction.z;\nif (endPoint0Distance > 0.0 && abs(denominator) < czm_epsilon7)\n{\nculledByNearPlane = true;\n}\nelse if (endPoint0Distance > 0.0)\n{\nfloat t = endPoint0Distance / denominator;\nif (t < 0.0 || t > magnitude)\n{\nculledByNearPlane = true;\n}\nelse\n{\np0 = p0 + t * direction;\np0.z = min(p0.z, -czm_currentFrustum.x);\nclipped = true;\n}\n}\nclippedPositionEC = vec4(p0, 1.0);\npositionWC = czm_eyeToWindowCoordinates(clippedPositionEC);\n}\nvec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)\n{\n#ifdef POLYLINE_DASH\nvec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);\nvec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);\nvec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);\nvec2 lineDir;\nif (usePrevious) {\nlineDir = normalize(positionWindow.xy - previousWindow.xy);\n}\nelse {\nlineDir = normalize(nextWindow.xy - positionWindow.xy);\n}\nangle = atan(lineDir.x, lineDir.y) - 1.570796327;\nangle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;\n#endif\nvec4 clippedPrevWC, clippedPrevEC;\nbool prevSegmentClipped, prevSegmentCulled;\nclipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, clippedPrevWC, prevSegmentClipped, prevSegmentCulled, clippedPrevEC);\nvec4 clippedNextWC, clippedNextEC;\nbool nextSegmentClipped, nextSegmentCulled;\nclipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, clippedNextWC, nextSegmentClipped, nextSegmentCulled, clippedNextEC);\nbool segmentClipped, segmentCulled;\nvec4 clippedPositionWC, clippedPositionEC;\nclipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, clippedPositionWC, segmentClipped, segmentCulled, clippedPositionEC);\nif (segmentCulled)\n{\nreturn vec4(0.0, 0.0, 0.0, 1.0);\n}\nvec2 directionToPrevWC = normalize(clippedPrevWC.xy - clippedPositionWC.xy);\nvec2 directionToNextWC = normalize(clippedNextWC.xy - clippedPositionWC.xy);\nif (prevSegmentCulled)\n{\ndirectionToPrevWC = -directionToNextWC;\n}\nelse if (nextSegmentCulled)\n{\ndirectionToNextWC = -directionToPrevWC;\n}\nvec2 thisSegmentForwardWC, otherSegmentForwardWC;\nif (usePrevious)\n{\nthisSegmentForwardWC = -directionToPrevWC;\notherSegmentForwardWC = directionToNextWC;\n}\nelse\n{\nthisSegmentForwardWC = directionToNextWC;\notherSegmentForwardWC = -directionToPrevWC;\n}\nvec2 thisSegmentLeftWC = vec2(-thisSegmentForwardWC.y, thisSegmentForwardWC.x);\nvec2 leftWC = thisSegmentLeftWC;\nfloat expandWidth = width * 0.5;\nif (!czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) && !czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1))\n{\nvec2 otherSegmentLeftWC = vec2(-otherSegmentForwardWC.y, otherSegmentForwardWC.x);\nvec2 leftSumWC = thisSegmentLeftWC + otherSegmentLeftWC;\nfloat leftSumLength = length(leftSumWC);\nleftWC = leftSumLength < czm_epsilon6 ? thisSegmentLeftWC : (leftSumWC / leftSumLength);\nvec2 u = -thisSegmentForwardWC;\nvec2 v = leftWC;\nfloat sinAngle = abs(u.x * v.y - u.y * v.x);\nexpandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n}\nvec2 offset = leftWC * expandDirection * expandWidth * czm_pixelRatio;\nreturn vec4(clippedPositionWC.xy + offset, -clippedPositionWC.z, 1.0) * (czm_projection * clippedPositionEC).w;\n}\nvec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)\n{\nvec4 positionEC = czm_modelViewRelativeToEye * position;\nvec4 prevEC = czm_modelViewRelativeToEye * previous;\nvec4 nextEC = czm_modelViewRelativeToEye * next;\nreturn getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);\n}\n",defaultVertexShaderSource$1=PolylineCommon+"\n"+PolylineColorAppearanceVS,defaultFragmentShaderSource$1=PerInstanceFlatColorAppearanceFS;function PolylineColorAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=defaultValue(e.translucent,!0),i=PolylineColorAppearance.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,defaultVertexShaderSource$1),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,defaultFragmentShaderSource$1),this._renderState=Appearance.getDefaultRenderState(t,false,e.renderState),this._closed=false,this._vertexFormat=i}FeatureDetection.isInternetExplorer()||(defaultVertexShaderSource$1="#define CLIP_POLYLINE \n"+defaultVertexShaderSource$1),Object.defineProperties(PolylineColorAppearance.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),PolylineColorAppearance.VERTEX_FORMAT=VertexFormat.POSITION_ONLY,PolylineColorAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,PolylineColorAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,PolylineColorAppearance.prototype.getRenderState=Appearance.prototype.getRenderState;var PolylineMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec2 st;\nattribute float batchId;\nvarying float v_width;\nvarying vec2 v_st;\nvarying float v_polylineAngle;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nfloat angle;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\ngl_Position = czm_viewportOrthographic * positionWC;\nv_width = width;\nv_st.s = st.s;\nv_st.t = czm_writeNonPerspective(st.t, gl_Position.w);\nv_polylineAngle = angle;\n}\n",PolylineFS$1="#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec2 st = v_st;\nst.t = czm_readNonPerspective(st.t, gl_FragCoord.w);\nmaterialInput.s = st.s;\nmaterialInput.st = st;\nmaterialInput.str = vec3(st, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#ifdef VECTOR_TILE\ngl_FragColor *= u_highlightColor;\n#endif\nczm_writeLogDepth();\n}\n",defaultVertexShaderSource=PolylineCommon+"\n"+PolylineMaterialAppearanceVS,defaultFragmentShaderSource=PolylineFS$1;function PolylineMaterialAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=defaultValue(e.translucent,!0),i=PolylineMaterialAppearance.VERTEX_FORMAT;this.material=defined(e.material)?e.material:Material$3.fromType(Material$3.ColorType),this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,defaultVertexShaderSource),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,defaultFragmentShaderSource),this._renderState=Appearance.getDefaultRenderState(t,false,e.renderState),this._closed=false,this._vertexFormat=i}function GroundPolylinePrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;var t=e.appearance;defined(t)||(t=new PolylineMaterialAppearance),this.appearance=t,this.show=defaultValue(e.show,!0),this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowShadowVolume=defaultValue(e.debugShowShadowVolume,!1),this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:defaultValue(e.interleave,!1),releaseGeometryInstances:defaultValue(e.releaseGeometryInstances,!0),allowPicking:defaultValue(e.allowPicking,!0),asynchronous:defaultValue(e.asynchronous,!0),compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1,this._readyPromise=when.defer(),this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=getRenderState$1(!1),this._renderState3DTiles=getRenderState$1(!0),this._renderStateMorph=RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},depthTest:{enabled:!0},blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}function createShaderProgram$1(e,t,i){var r=t.context,n=e._primitive,a=n._attributeLocations,o=n._batchTable.getVertexShaderCallback()(PolylineShadowVolumeVS);o=Primitive$2._appendShowToShader(n,o),o=Primitive$2._appendDistanceDisplayConditionToShader(n,o),o=Primitive$2._modifyShaderPosition(e,o,t.scene3DOnly);var s=n._batchTable.getVertexShaderCallback()(PolylineShadowVolumeMorphVS);s=Primitive$2._appendShowToShader(n,s),s=Primitive$2._appendDistanceDisplayConditionToShader(n,s),s=Primitive$2._modifyShaderPosition(e,s,t.scene3DOnly);var l=n._batchTable.getVertexShaderCallback()(PolylineShadowVolumeFS),c=["GLOBE_MINIMUM_ALTITUDE "+t.mapProjection.ellipsoid.minimumRadius.toFixed(1)],u="",d="";defined(i.material)?(-1!==(d=defined(i.material)?i.material.shaderSource:"").search(/varying\s+float\s+v_polylineAngle;/g)&&c.push("ANGLE_VARYING"),-1!==d.search(/varying\s+float\s+v_width;/g)&&c.push("WIDTH_VARYING")):u="PER_INSTANCE_COLOR",c.push(u);var h=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",u]:[u],p=new ShaderSource({defines:c,sources:[o]}),f=new ShaderSource({defines:h,sources:[d,l]});e._sp=ShaderProgram.replaceCache({context:r,shaderProgram:n._sp,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:a});var m=r.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!defined(m)){var g=new ShaderSource({defines:c.concat(["COLUMBUS_VIEW_2D"]),sources:[o]});m=r.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:r,shaderProgram:e._sp2D,vertexShaderSource:g,fragmentShaderSource:f,attributeLocations:a})}e._sp2D=m;var _=r.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!defined(_)){var y=new ShaderSource({defines:c.concat(["MAX_TERRAIN_HEIGHT "+ApproximateTerrainHeights._defaultMaxTerrainHeight.toFixed(1)]),sources:[s]}),v=new ShaderSource({defines:h,sources:[d,l=n._batchTable.getVertexShaderCallback()(PolylineShadowVolumeMorphFS)]});_=r.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:r,shaderProgram:e._spMorph,vertexShaderSource:y,fragmentShaderSource:v,attributeLocations:a})}e._spMorph=_}function getRenderState$1(e){return RenderState.fromCache({cull:{enabled:!0},blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.EQUAL,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK}})}function createCommands$3(e,t,i,r,n,a){var o=e._primitive,s=o._va.length;n.length=s,a.length=s;for(var l=t instanceof PolylineColorAppearance?{}:i._uniforms,c=o._batchTable.getUniformMapCallback()(l),u=0;u<s;u++){var d=o._va[u],h=n[u];defined(h)||(h=n[u]=new DrawCommand({owner:e,primitiveType:o._primitiveType})),h.vertexArray=d,h.renderState=e._renderState,h.shaderProgram=e._sp,h.uniformMap=c,h.pass=Pass$1.TERRAIN_CLASSIFICATION,h.pickId="czm_batchTable_pickColor(v_endPlaneNormalEcAndBatchId.w)";var p=DrawCommand.shallowClone(h,h.derivedCommands.tileset);p.renderState=e._renderState3DTiles,p.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,h.derivedCommands.tileset=p;var f=DrawCommand.shallowClone(h,h.derivedCommands.color2D);f.shaderProgram=e._sp2D,h.derivedCommands.color2D=f;var m=DrawCommand.shallowClone(p,p.derivedCommands.color2D);m.shaderProgram=e._sp2D,p.derivedCommands.color2D=m;var g=DrawCommand.shallowClone(h,h.derivedCommands.colorMorph);g.renderState=e._renderStateMorph,g.shaderProgram=e._spMorph,g.pickId="czm_batchTable_pickColor(v_batchId)",h.derivedCommands.colorMorph=g}}function updateAndQueueCommand(e,t,i,r,n,a,o){i.mode===SceneMode$1.MORPHING?t=t.derivedCommands.colorMorph:i.mode!==SceneMode$1.SCENE3D&&(t=t.derivedCommands.color2D),t.modelMatrix=r,t.boundingVolume=a,t.cull=n,t.debugShowBoundingVolume=o,i.commandList.push(t)}function updateAndQueueCommands(e,t,i,r,n,a,o){var s,l=e._primitive;Primitive$2._updateBoundingVolumes(l,t,n),t.mode===SceneMode$1.SCENE3D?s=l._boundingSphereWC:t.mode===SceneMode$1.COLUMBUS_VIEW?s=l._boundingSphereCV:t.mode===SceneMode$1.SCENE2D&&defined(l._boundingSphere2D)?s=l._boundingSphere2D:defined(l._boundingSphereMorph)&&(s=l._boundingSphereMorph);var c=t.mode===SceneMode$1.MORPHING,u=e.classificationType,d=u!==ClassificationType$1.CESIUM_3D_TILE,h=u!==ClassificationType$1.TERRAIN&&!c,p=t.passes;if(p.render||p.pick&&l.allowPicking)for(var f=i.length,m=0;m<f;++m){var g=s[m];d&&updateAndQueueCommand(e,i[m],t,n,a,g,o),h&&updateAndQueueCommand(e,i[m].derivedCommands.tileset,t,n,a,g,o)}}FeatureDetection.isInternetExplorer()||(defaultVertexShaderSource="#define CLIP_POLYLINE \n"+defaultVertexShaderSource),Object.defineProperties(PolylineMaterialAppearance.prototype,{vertexShaderSource:{get:function(){var e=this._vertexShaderSource;return-1!==this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g)&&(e="#define POLYLINE_DASH\n"+e),e}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),PolylineMaterialAppearance.VERTEX_FORMAT=VertexFormat.POSITION_AND_ST,PolylineMaterialAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,PolylineMaterialAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,PolylineMaterialAppearance.prototype.getRenderState=Appearance.prototype.getRenderState,Object.defineProperties(GroundPolylinePrimitive.prototype,{interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},debugShowShadowVolume:{get:function(){return this._debugShowShadowVolume}}}),GroundPolylinePrimitive.initializeTerrainHeights=function(){return ApproximateTerrainHeights.initialize()},GroundPolylinePrimitive.prototype.update=function(e){if(defined(this._primitive)||defined(this.geometryInstances))if(ApproximateTerrainHeights.initialized){var t,i=this,r=this._primitiveOptions;if(!defined(this._primitive)){var n,a=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],o=a.length,s=new Array(o);for(t=0;t<o;++t)if(!defined(n=a[t].attributes)||!defined(n.color)){this._hasPerInstanceColors=!1;break}for(t=0;t<o;++t){var l=a[t];n={};var c=l.attributes;for(var u in c)c.hasOwnProperty(u)&&(n[u]=c[u]);defined(n.width)||(n.width=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,value:[l.geometry.width]})),l.geometry._scene3DOnly=e.scene3DOnly,GroundPolylineGeometry.setProjectionAndEllipsoid(l.geometry,e.mapProjection),s[t]=new GeometryInstance({geometry:l.geometry,attributes:n,id:l.id,pickPrimitive:i})}r.geometryInstances=s,r.appearance=this.appearance,r._createShaderProgramFunction=function(e,t,r){createShaderProgram$1(i,t,r)},r._createCommandsFunction=function(e,t,r,n,a,o,s){createCommands$3(i,t,r,n,o,s)},r._updateAndQueueCommandsFunction=function(e,t,r,n,a,o,s,l){updateAndQueueCommands(i,t,r,n,a,o,s)},this._primitive=new Primitive$2(r),this._primitive.readyPromise.then((function(e){i._ready=!0,i.releaseGeometryInstances&&(i.geometryInstances=void 0);var t=e._error;defined(t)?i._readyPromise.reject(t):i._readyPromise.resolve(i)}))}if(this.appearance instanceof PolylineColorAppearance&&!this._hasPerInstanceColors)throw new DeveloperError("All GeometryInstances must have color attributes to use PolylineColorAppearance with GroundPolylinePrimitive.");this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)}else GroundPolylinePrimitive.initializeTerrainHeights()},GroundPolylinePrimitive.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},GroundPolylinePrimitive.isSupported=function(e){return e.frameState.context.depthTexture},GroundPolylinePrimitive.prototype.isDestroyed=function(){return!1},GroundPolylinePrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._sp2D=void 0,this._spMorph=void 0,destroyObject(this)};var defaultRepeat$2=new Cartesian2(1,1),defaultTransparent=!1,defaultColor$7=Color.WHITE;function ImageMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._image=void 0,this._imageSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._transparent=void 0,this._transparentSubscription=void 0,this.image=e.image,this.repeat=e.repeat,this.color=e.color,this.transparent=e.transparent}function createMaterialProperty(e){if(e instanceof Color)return new ColorMaterialProperty(e);if("string"==typeof e||e instanceof Resource||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){var t=new ImageMaterialProperty;return t.image=e,t}}function createMaterialPropertyDescriptor(e,t){return createPropertyDescriptor(e,t,createMaterialProperty)}function BoxGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._dimensions=void 0,this._dimensionsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PositionProperty(){DeveloperError.throwInstantiationError()}Object.defineProperties(ImageMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._image)&&Property.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:createPropertyDescriptor("image"),repeat:createPropertyDescriptor("repeat"),color:createPropertyDescriptor("color"),transparent:createPropertyDescriptor("transparent")}),ImageMaterialProperty.prototype.getType=function(e){return"Image"},ImageMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.image=Property.getValueOrUndefined(this._image,e),t.repeat=Property.getValueOrClonedDefault(this._repeat,e,defaultRepeat$2,t.repeat),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$7,t.color),Property.getValueOrDefault(this._transparent,e,defaultTransparent)&&(t.color.alpha=Math.min(.99,t.color.alpha)),t},ImageMaterialProperty.prototype.equals=function(e){return this===e||e instanceof ImageMaterialProperty&&Property.equals(this._image,e._image)&&Property.equals(this._repeat,e._repeat)&&Property.equals(this._color,e._color)&&Property.equals(this._transparent,e._transparent)},Object.defineProperties(BoxGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),dimensions:createPropertyDescriptor("dimensions"),heightReference:createPropertyDescriptor("heightReference"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),BoxGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.dimensions=this.dimensions,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new BoxGraphics(this)},BoxGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.dimensions=defaultValue(this.dimensions,e.dimensions),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(PositionProperty.prototype,{isConstant:{get:DeveloperError.throwInstantiationError},definitionChanged:{get:DeveloperError.throwInstantiationError},referenceFrame:{get:DeveloperError.throwInstantiationError}}),PositionProperty.prototype.getValue=DeveloperError.throwInstantiationError,PositionProperty.prototype.getValueInReferenceFrame=DeveloperError.throwInstantiationError,PositionProperty.prototype.equals=DeveloperError.throwInstantiationError;var scratchMatrix3$1=new Matrix3;function ConstantPositionProperty(e,t){this._definitionChanged=new Event,this._value=Cartesian3.clone(e),this._referenceFrame=defaultValue(t,ReferenceFrame$1.FIXED)}function CorridorGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function createRawProperty(e){return e}function createRawPropertyDescriptor(e,t){return createPropertyDescriptor(e,t,createRawProperty)}function CylinderGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._length=void 0,this._lengthSubscription=void 0,this._topRadius=void 0,this._topRadiusSubscription=void 0,this._bottomRadius=void 0,this._bottomRadiusSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._slices=void 0,this._slicesSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function EllipseGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._semiMajorAxis=void 0,this._semiMajorAxisSubscription=void 0,this._semiMinorAxis=void 0,this._semiMinorAxisSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function EllipsoidGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._radii=void 0,this._radiiSubscription=void 0,this._innerRadii=void 0,this._innerRadiiSubscription=void 0,this._minimumClock=void 0,this._minimumClockSubscription=void 0,this._maximumClock=void 0,this._maximumClockSubscription=void 0,this._minimumCone=void 0,this._minimumConeSubscription=void 0,this._maximumCone=void 0,this._maximumConeSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._stackPartitions=void 0,this._stackPartitionsSubscription=void 0,this._slicePartitions=void 0,this._slicePartitionsSubscription=void 0,this._subdivisions=void 0,this._subdivisionsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function LabelGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._text=void 0,this._textSubscription=void 0,this._font=void 0,this._fontSubscription=void 0,this._style=void 0,this._styleSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._showBackground=void 0,this._showBackgroundSubscription=void 0,this._backgroundColor=void 0,this._backgroundColorSubscription=void 0,this._backgroundPadding=void 0,this._backgroundPaddingSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fillColor=void 0,this._fillColorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}PositionProperty.convertToReferenceFrame=function(e,t,i,r,n){if(!defined(t))return t;if(defined(n)||(n=new Cartesian3),i===r)return Cartesian3.clone(t,n);var a=Transforms.computeIcrfToFixedMatrix(e,scratchMatrix3$1);return defined(a)||(a=Transforms.computeTemeToPseudoFixedMatrix(e,scratchMatrix3$1)),i===ReferenceFrame$1.INERTIAL?Matrix3.multiplyByVector(a,t,n):i===ReferenceFrame$1.FIXED?Matrix3.multiplyByVector(Matrix3.transpose(a,scratchMatrix3$1),t,n):void 0},Object.defineProperties(ConstantPositionProperty.prototype,{isConstant:{get:function(){return!defined(this._value)||this._referenceFrame===ReferenceFrame$1.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}}),ConstantPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},ConstantPositionProperty.prototype.setValue=function(e,t){var i=!1;Cartesian3.equals(this._value,e)||(i=!0,this._value=Cartesian3.clone(e)),defined(t)&&this._referenceFrame!==t&&(i=!0,this._referenceFrame=t),i&&this._definitionChanged.raiseEvent(this)},ConstantPositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){return PositionProperty.convertToReferenceFrame(e,this._value,this._referenceFrame,t,i)},ConstantPositionProperty.prototype.equals=function(e){return this===e||e instanceof ConstantPositionProperty&&Cartesian3.equals(this._value,e._value)&&this._referenceFrame===e._referenceFrame},Object.defineProperties(CorridorGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),width:createPropertyDescriptor("width"),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),cornerType:createPropertyDescriptor("cornerType"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),CorridorGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.positions=this.positions,e.width=this.width,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.cornerType=this.cornerType,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new CorridorGraphics(this)},CorridorGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.width=defaultValue(this.width,e.width),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.cornerType=defaultValue(this.cornerType,e.cornerType),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(CylinderGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),length:createPropertyDescriptor("length"),topRadius:createPropertyDescriptor("topRadius"),bottomRadius:createPropertyDescriptor("bottomRadius"),heightReference:createPropertyDescriptor("heightReference"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),numberOfVerticalLines:createPropertyDescriptor("numberOfVerticalLines"),slices:createPropertyDescriptor("slices"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),CylinderGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.length=this.length,e.topRadius=this.topRadius,e.bottomRadius=this.bottomRadius,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e.slices=this.slices,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new CylinderGraphics(this)},CylinderGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.length=defaultValue(this.length,e.length),this.topRadius=defaultValue(this.topRadius,e.topRadius),this.bottomRadius=defaultValue(this.bottomRadius,e.bottomRadius),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=defaultValue(this.numberOfVerticalLines,e.numberOfVerticalLines),this.slices=defaultValue(this.slices,e.slices),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(EllipseGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),semiMajorAxis:createPropertyDescriptor("semiMajorAxis"),semiMinorAxis:createPropertyDescriptor("semiMinorAxis"),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),rotation:createPropertyDescriptor("rotation"),stRotation:createPropertyDescriptor("stRotation"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),numberOfVerticalLines:createPropertyDescriptor("numberOfVerticalLines"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),EllipseGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.semiMajorAxis=this.semiMajorAxis,e.semiMinorAxis=this.semiMinorAxis,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.rotation=this.rotation,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new EllipseGraphics(this)},EllipseGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.semiMajorAxis=defaultValue(this.semiMajorAxis,e.semiMajorAxis),this.semiMinorAxis=defaultValue(this.semiMinorAxis,e.semiMinorAxis),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=defaultValue(this.rotation,e.rotation),this.stRotation=defaultValue(this.stRotation,e.stRotation),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=defaultValue(this.numberOfVerticalLines,e.numberOfVerticalLines),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(EllipsoidGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),radii:createPropertyDescriptor("radii"),innerRadii:createPropertyDescriptor("innerRadii"),minimumClock:createPropertyDescriptor("minimumClock"),maximumClock:createPropertyDescriptor("maximumClock"),minimumCone:createPropertyDescriptor("minimumCone"),maximumCone:createPropertyDescriptor("maximumCone"),heightReference:createPropertyDescriptor("heightReference"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),stackPartitions:createPropertyDescriptor("stackPartitions"),slicePartitions:createPropertyDescriptor("slicePartitions"),subdivisions:createPropertyDescriptor("subdivisions"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),EllipsoidGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.radii=this.radii,e.innerRadii=this.innerRadii,e.minimumClock=this.minimumClock,e.maximumClock=this.maximumClock,e.minimumCone=this.minimumCone,e.maximumCone=this.maximumCone,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.stackPartitions=this.stackPartitions,e.slicePartitions=this.slicePartitions,e.subdivisions=this.subdivisions,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new EllipsoidGraphics(this)},EllipsoidGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.radii=defaultValue(this.radii,e.radii),this.innerRadii=defaultValue(this.innerRadii,e.innerRadii),this.minimumClock=defaultValue(this.minimumClock,e.minimumClock),this.maximumClock=defaultValue(this.maximumClock,e.maximumClock),this.minimumCone=defaultValue(this.minimumCone,e.minimumCone),this.maximumCone=defaultValue(this.maximumCone,e.maximumCone),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.stackPartitions=defaultValue(this.stackPartitions,e.stackPartitions),this.slicePartitions=defaultValue(this.slicePartitions,e.slicePartitions),this.subdivisions=defaultValue(this.subdivisions,e.subdivisions),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(LabelGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),text:createPropertyDescriptor("text"),font:createPropertyDescriptor("font"),style:createPropertyDescriptor("style"),scale:createPropertyDescriptor("scale"),showBackground:createPropertyDescriptor("showBackground"),backgroundColor:createPropertyDescriptor("backgroundColor"),backgroundPadding:createPropertyDescriptor("backgroundPadding"),pixelOffset:createPropertyDescriptor("pixelOffset"),eyeOffset:createPropertyDescriptor("eyeOffset"),horizontalOrigin:createPropertyDescriptor("horizontalOrigin"),verticalOrigin:createPropertyDescriptor("verticalOrigin"),heightReference:createPropertyDescriptor("heightReference"),fillColor:createPropertyDescriptor("fillColor"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),translucencyByDistance:createPropertyDescriptor("translucencyByDistance"),pixelOffsetScaleByDistance:createPropertyDescriptor("pixelOffsetScaleByDistance"),scaleByDistance:createPropertyDescriptor("scaleByDistance"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),disableDepthTestDistance:createPropertyDescriptor("disableDepthTestDistance")}),LabelGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.text=this.text,e.font=this.font,e.style=this.style,e.scale=this.scale,e.showBackground=this.showBackground,e.backgroundColor=this.backgroundColor,e.backgroundPadding=this.backgroundPadding,e.pixelOffset=this.pixelOffset,e.eyeOffset=this.eyeOffset,e.horizontalOrigin=this.horizontalOrigin,e.verticalOrigin=this.verticalOrigin,e.heightReference=this.heightReference,e.fillColor=this.fillColor,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.translucencyByDistance=this.translucencyByDistance,e.pixelOffsetScaleByDistance=this.pixelOffsetScaleByDistance,e.scaleByDistance=this.scaleByDistance,e.distanceDisplayCondition=this.distanceDisplayCondition,e.disableDepthTestDistance=this.disableDepthTestDistance,e):new LabelGraphics(this)},LabelGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.text=defaultValue(this.text,e.text),this.font=defaultValue(this.font,e.font),this.style=defaultValue(this.style,e.style),this.scale=defaultValue(this.scale,e.scale),this.showBackground=defaultValue(this.showBackground,e.showBackground),this.backgroundColor=defaultValue(this.backgroundColor,e.backgroundColor),this.backgroundPadding=defaultValue(this.backgroundPadding,e.backgroundPadding),this.pixelOffset=defaultValue(this.pixelOffset,e.pixelOffset),this.eyeOffset=defaultValue(this.eyeOffset,e.eyeOffset),this.horizontalOrigin=defaultValue(this.horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=defaultValue(this.verticalOrigin,e.verticalOrigin),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fillColor=defaultValue(this.fillColor,e.fillColor),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.translucencyByDistance=defaultValue(this.translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=defaultValue(this.pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.scaleByDistance=defaultValue(this.scaleByDistance,e.scaleByDistance),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=defaultValue(this.disableDepthTestDistance,e.disableDepthTestDistance)};var defaultNodeTransformation=new TranslationRotationScale;function NodeTransformationProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._translation=void 0,this._translationSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this.translation=e.translation,this.rotation=e.rotation,this.scale=e.scale}function PropertyBag(e,t){this._propertyNames=[],this._definitionChanged=new Event,defined(e)&&this.merge(e,t)}function createConstantProperty(e){return new ConstantProperty(e)}function propertiesEqual(e,t){var i=e._propertyNames,r=t._propertyNames,n=i.length;if(n!==r.length)return!1;for(var a=0;a<n;++a){var o=i[a];if(-1===r.indexOf(o))return!1;if(!Property.equals(e[o],t[o]))return!1}return!0}function createNodeTransformationProperty(e){return new NodeTransformationProperty(e)}function createNodeTransformationPropertyBag(e){return new PropertyBag(e,createNodeTransformationProperty)}function createArticulationStagePropertyBag(e){return new PropertyBag(e)}function ModelGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._minimumPixelSize=void 0,this._minimumPixelSizeSubscription=void 0,this._maximumScale=void 0,this._maximumScaleSubscription=void 0,this._incrementallyLoadTextures=void 0,this._incrementallyLoadTexturesSubscription=void 0,this._runAnimations=void 0,this._runAnimationsSubscription=void 0,this._clampAnimations=void 0,this._clampAnimationsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._silhouetteColor=void 0,this._silhouetteColorSubscription=void 0,this._silhouetteSize=void 0,this._silhouetteSizeSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._colorBlendMode=void 0,this._colorBlendModeSubscription=void 0,this._colorBlendAmount=void 0,this._colorBlendAmountSubscription=void 0,this._imageBasedLightingFactor=void 0,this._imageBasedLightingFactorSubscription=void 0,this._lightColor=void 0,this._lightColorSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._nodeTransformations=void 0,this._nodeTransformationsSubscription=void 0,this._articulations=void 0,this._articulationsSubscription=void 0,this._clippingPlanes=void 0,this._clippingPlanesSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function Cesium3DTilesetGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._maximumScreenSpaceError=void 0,this._maximumScreenSpaceErrorSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PathGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._leadTime=void 0,this._leadTimeSubscription=void 0,this._trailTime=void 0,this._trailTimeSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._resolution=void 0,this._resolutionSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PlaneGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._dimensions=void 0,this._dimensionsSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PointGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._pixelSize=void 0,this._pixelSizeSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function createPolygonHierarchyProperty(e){return Array.isArray(e)&&(e=new PolygonHierarchy(e)),new ConstantProperty(e)}function PolygonGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._hierarchy=void 0,this._hierarchySubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._perPositionHeight=void 0,this._perPositionHeightSubscription=void 0,this._closeTop=void 0,this._closeTopSubscription=void 0,this._closeBottom=void 0,this._closeBottomSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PolylineGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._depthFailMaterial=void 0,this._depthFailMaterialSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._clampToGround=void 0,this._clampToGroundSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PolylineVolumeGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._shape=void 0,this._shapeSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubsription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function RectangleGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._coordinates=void 0,this._coordinatesSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distancedisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function WallGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._minimumHeights=void 0,this._minimumHeightsSubscription=void 0,this._maximumHeights=void 0,this._maximumHeightsSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}Object.defineProperties(NodeTransformationProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._translation)&&Property.isConstant(this._rotation)&&Property.isConstant(this._scale)}},definitionChanged:{get:function(){return this._definitionChanged}},translation:createPropertyDescriptor("translation"),rotation:createPropertyDescriptor("rotation"),scale:createPropertyDescriptor("scale")}),NodeTransformationProperty.prototype.getValue=function(e,t){return defined(t)||(t=new TranslationRotationScale),t.translation=Property.getValueOrClonedDefault(this._translation,e,defaultNodeTransformation.translation,t.translation),t.rotation=Property.getValueOrClonedDefault(this._rotation,e,defaultNodeTransformation.rotation,t.rotation),t.scale=Property.getValueOrClonedDefault(this._scale,e,defaultNodeTransformation.scale,t.scale),t},NodeTransformationProperty.prototype.equals=function(e){return this===e||e instanceof NodeTransformationProperty&&Property.equals(this._translation,e._translation)&&Property.equals(this._rotation,e._rotation)&&Property.equals(this._scale,e._scale)},Object.defineProperties(PropertyBag.prototype,{propertyNames:{get:function(){return this._propertyNames}},isConstant:{get:function(){for(var e=this._propertyNames,t=0,i=e.length;t<i;t++)if(!Property.isConstant(this[e[t]]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}}),PropertyBag.prototype.hasProperty=function(e){return-1!==this._propertyNames.indexOf(e)},PropertyBag.prototype.addProperty=function(e,t,i){this._propertyNames.push(e),Object.defineProperty(this,e,createPropertyDescriptor(e,!0,defaultValue(i,createConstantProperty))),defined(t)&&(this[e]=t),this._definitionChanged.raiseEvent(this)},PropertyBag.prototype.removeProperty=function(e){var t=this._propertyNames.indexOf(e);this._propertyNames.splice(t,1),delete this[e],this._definitionChanged.raiseEvent(this)},PropertyBag.prototype.getValue=function(e,t){defined(t)||(t={});for(var i=this._propertyNames,r=0,n=i.length;r<n;r++){var a=i[r];t[a]=Property.getValueOrUndefined(this[a],e,t[a])}return t},PropertyBag.prototype.merge=function(e,t){for(var i=this._propertyNames,r=defined(e._propertyNames)?e._propertyNames:Object.keys(e),n=0,a=r.length;n<a;n++){var o=r[n],s=this[o],l=e[o];void 0===s&&-1===i.indexOf(o)&&this.addProperty(o,void 0,t),void 0!==l&&(void 0!==s?defined(s)&&defined(s.merge)&&s.merge(l):defined(l)&&defined(l.merge)&&defined(l.clone)?this[o]=l.clone():this[o]=l)}},PropertyBag.prototype.equals=function(e){return this===e||e instanceof PropertyBag&&propertiesEqual(this,e)},Object.defineProperties(ModelGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),uri:createPropertyDescriptor("uri"),scale:createPropertyDescriptor("scale"),minimumPixelSize:createPropertyDescriptor("minimumPixelSize"),maximumScale:createPropertyDescriptor("maximumScale"),incrementallyLoadTextures:createPropertyDescriptor("incrementallyLoadTextures"),runAnimations:createPropertyDescriptor("runAnimations"),clampAnimations:createPropertyDescriptor("clampAnimations"),shadows:createPropertyDescriptor("shadows"),heightReference:createPropertyDescriptor("heightReference"),silhouetteColor:createPropertyDescriptor("silhouetteColor"),silhouetteSize:createPropertyDescriptor("silhouetteSize"),color:createPropertyDescriptor("color"),colorBlendMode:createPropertyDescriptor("colorBlendMode"),colorBlendAmount:createPropertyDescriptor("colorBlendAmount"),imageBasedLightingFactor:createPropertyDescriptor("imageBasedLightingFactor"),lightColor:createPropertyDescriptor("lightColor"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),nodeTransformations:createPropertyDescriptor("nodeTransformations",void 0,createNodeTransformationPropertyBag),articulations:createPropertyDescriptor("articulations",void 0,createArticulationStagePropertyBag),clippingPlanes:createPropertyDescriptor("clippingPlanes")}),ModelGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.uri=this.uri,e.scale=this.scale,e.minimumPixelSize=this.minimumPixelSize,e.maximumScale=this.maximumScale,e.incrementallyLoadTextures=this.incrementallyLoadTextures,e.runAnimations=this.runAnimations,e.clampAnimations=this.clampAnimations,e.heightReference=this._heightReference,e.silhouetteColor=this.silhouetteColor,e.silhouetteSize=this.silhouetteSize,e.color=this.color,e.colorBlendMode=this.colorBlendMode,e.colorBlendAmount=this.colorBlendAmount,e.imageBasedLightingFactor=this.imageBasedLightingFactor,e.lightColor=this.lightColor,e.distanceDisplayCondition=this.distanceDisplayCondition,e.nodeTransformations=this.nodeTransformations,e.articulations=this.articulations,e.clippingPlanes=this.clippingPlanes,e):new ModelGraphics(this)},ModelGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.uri=defaultValue(this.uri,e.uri),this.scale=defaultValue(this.scale,e.scale),this.minimumPixelSize=defaultValue(this.minimumPixelSize,e.minimumPixelSize),this.maximumScale=defaultValue(this.maximumScale,e.maximumScale),this.incrementallyLoadTextures=defaultValue(this.incrementallyLoadTextures,e.incrementallyLoadTextures),this.runAnimations=defaultValue(this.runAnimations,e.runAnimations),this.clampAnimations=defaultValue(this.clampAnimations,e.clampAnimations),this.shadows=defaultValue(this.shadows,e.shadows),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.silhouetteColor=defaultValue(this.silhouetteColor,e.silhouetteColor),this.silhouetteSize=defaultValue(this.silhouetteSize,e.silhouetteSize),this.color=defaultValue(this.color,e.color),this.colorBlendMode=defaultValue(this.colorBlendMode,e.colorBlendMode),this.colorBlendAmount=defaultValue(this.colorBlendAmount,e.colorBlendAmount),this.imageBasedLightingFactor=defaultValue(this.imageBasedLightingFactor,e.imageBasedLightingFactor),this.lightColor=defaultValue(this.lightColor,e.lightColor),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.clippingPlanes=defaultValue(this.clippingPlanes,e.clippingPlanes);var t=e.nodeTransformations;if(defined(t)){var i=this.nodeTransformations;defined(i)?i.merge(t):this.nodeTransformations=new PropertyBag(t,createNodeTransformationProperty)}var r=e.articulations;if(defined(r)){var n=this.articulations;defined(n)?n.merge(r):this.articulations=new PropertyBag(r)}},Object.defineProperties(Cesium3DTilesetGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),uri:createPropertyDescriptor("uri"),maximumScreenSpaceError:createPropertyDescriptor("maximumScreenSpaceError")}),Cesium3DTilesetGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.uri=this.uri,e.maximumScreenSpaceError=this.maximumScreenSpaceError,e):new Cesium3DTilesetGraphics(this)},Cesium3DTilesetGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.uri=defaultValue(this.uri,e.uri),this.maximumScreenSpaceError=defaultValue(this.maximumScreenSpaceError,e.maximumScreenSpaceError)},Object.defineProperties(PathGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),leadTime:createPropertyDescriptor("leadTime"),trailTime:createPropertyDescriptor("trailTime"),width:createPropertyDescriptor("width"),resolution:createPropertyDescriptor("resolution"),material:createMaterialPropertyDescriptor("material"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),PathGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.leadTime=this.leadTime,e.trailTime=this.trailTime,e.width=this.width,e.resolution=this.resolution,e.material=this.material,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new PathGraphics(this)},PathGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.leadTime=defaultValue(this.leadTime,e.leadTime),this.trailTime=defaultValue(this.trailTime,e.trailTime),this.width=defaultValue(this.width,e.width),this.resolution=defaultValue(this.resolution,e.resolution),this.material=defaultValue(this.material,e.material),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(PlaneGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),plane:createPropertyDescriptor("plane"),dimensions:createPropertyDescriptor("dimensions"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),PlaneGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.plane=this.plane,e.dimensions=this.dimensions,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new PlaneGraphics(this)},PlaneGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.plane=defaultValue(this.plane,e.plane),this.dimensions=defaultValue(this.dimensions,e.dimensions),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(PointGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),pixelSize:createPropertyDescriptor("pixelSize"),heightReference:createPropertyDescriptor("heightReference"),color:createPropertyDescriptor("color"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),scaleByDistance:createPropertyDescriptor("scaleByDistance"),translucencyByDistance:createPropertyDescriptor("translucencyByDistance"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),disableDepthTestDistance:createPropertyDescriptor("disableDepthTestDistance")}),PointGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.pixelSize=this.pixelSize,e.heightReference=this.heightReference,e.color=this.color,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.scaleByDistance=this.scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.distanceDisplayCondition=this.distanceDisplayCondition,e.disableDepthTestDistance=this.disableDepthTestDistance,e):new PointGraphics(this)},PointGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.pixelSize=defaultValue(this.pixelSize,e.pixelSize),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.color=defaultValue(this.color,e.color),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.scaleByDistance=defaultValue(this.scaleByDistance,e.scaleByDistance),this.translucencyByDistance=defaultValue(this._translucencyByDistance,e.translucencyByDistance),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=defaultValue(this.disableDepthTestDistance,e.disableDepthTestDistance)},Object.defineProperties(PolygonGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),hierarchy:createPropertyDescriptor("hierarchy",void 0,createPolygonHierarchyProperty),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),stRotation:createPropertyDescriptor("stRotation"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),perPositionHeight:createPropertyDescriptor("perPositionHeight"),closeTop:createPropertyDescriptor("closeTop"),closeBottom:createPropertyDescriptor("closeBottom"),arcType:createPropertyDescriptor("arcType"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),PolygonGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.hierarchy=this.hierarchy,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.perPositionHeight=this.perPositionHeight,e.closeTop=this.closeTop,e.closeBottom=this.closeBottom,e.arcType=this.arcType,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new PolygonGraphics(this)},PolygonGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.hierarchy=defaultValue(this.hierarchy,e.hierarchy),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.stRotation=defaultValue(this.stRotation,e.stRotation),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.perPositionHeight=defaultValue(this.perPositionHeight,e.perPositionHeight),this.closeTop=defaultValue(this.closeTop,e.closeTop),this.closeBottom=defaultValue(this.closeBottom,e.closeBottom),this.arcType=defaultValue(this.arcType,e.arcType),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(PolylineGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),width:createPropertyDescriptor("width"),granularity:createPropertyDescriptor("granularity"),material:createMaterialPropertyDescriptor("material"),depthFailMaterial:createMaterialPropertyDescriptor("depthFailMaterial"),arcType:createPropertyDescriptor("arcType"),clampToGround:createPropertyDescriptor("clampToGround"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),PolylineGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.positions=this.positions,e.width=this.width,e.granularity=this.granularity,e.material=this.material,e.depthFailMaterial=this.depthFailMaterial,e.arcType=this.arcType,e.clampToGround=this.clampToGround,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new PolylineGraphics(this)},PolylineGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.width=defaultValue(this.width,e.width),this.granularity=defaultValue(this.granularity,e.granularity),this.material=defaultValue(this.material,e.material),this.depthFailMaterial=defaultValue(this.depthFailMaterial,e.depthFailMaterial),this.arcType=defaultValue(this.arcType,e.arcType),this.clampToGround=defaultValue(this.clampToGround,e.clampToGround),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(PolylineVolumeGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),shape:createPropertyDescriptor("shape"),cornerType:createPropertyDescriptor("cornerType"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),PolylineVolumeGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.positions=this.positions,e.shape=this.shape,e.cornerType=this.cornerType,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new PolylineVolumeGraphics(this)},PolylineVolumeGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.shape=defaultValue(this.shape,e.shape),this.cornerType=defaultValue(this.cornerType,e.cornerType),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(RectangleGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),coordinates:createPropertyDescriptor("coordinates"),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),rotation:createPropertyDescriptor("rotation"),stRotation:createPropertyDescriptor("stRotation"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),RectangleGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.coordinates=this.coordinates,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.rotation=this.rotation,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new RectangleGraphics(this)},RectangleGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.coordinates=defaultValue(this.coordinates,e.coordinates),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=defaultValue(this.rotation,e.rotation),this.stRotation=defaultValue(this.stRotation,e.stRotation),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(WallGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),minimumHeights:createPropertyDescriptor("minimumHeights"),maximumHeights:createPropertyDescriptor("maximumHeights"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),WallGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.positions=this.positions,e.minimumHeights=this.minimumHeights,e.maximumHeights=this.maximumHeights,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new WallGraphics(this)},WallGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.minimumHeights=defaultValue(this.minimumHeights,e.minimumHeights),this.maximumHeights=defaultValue(this.maximumHeights,e.maximumHeights),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)};var cartoScratch$1=new Cartographic;function createConstantPositionProperty(e){return new ConstantPositionProperty(e)}function createPositionPropertyDescriptor(e){return createPropertyDescriptor(e,void 0,createConstantPositionProperty)}function createPropertyTypeDescriptor(e,t){return createPropertyDescriptor(e,void 0,(function(e){return e instanceof t?e:new t(e)}))}function Entity(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id;defined(t)||(t=createGuid()),this._availability=void 0,this._id=t,this._definitionChanged=new Event,this._name=e.name,this._show=defaultValue(e.show,!0),this._parent=void 0,this._propertyNames=["billboard","box","corridor","cylinder","description","ellipse","ellipsoid","label","model","tileset","orientation","path","plane","point","polygon","polyline","polylineVolume","position","properties","rectangle","viewFrom","wall"],this._billboard=void 0,this._billboardSubscription=void 0,this._box=void 0,this._boxSubscription=void 0,this._corridor=void 0,this._corridorSubscription=void 0,this._cylinder=void 0,this._cylinderSubscription=void 0,this._description=void 0,this._descriptionSubscription=void 0,this._ellipse=void 0,this._ellipseSubscription=void 0,this._ellipsoid=void 0,this._ellipsoidSubscription=void 0,this._label=void 0,this._labelSubscription=void 0,this._model=void 0,this._modelSubscription=void 0,this._tileset=void 0,this._tilesetSubscription=void 0,this._orientation=void 0,this._orientationSubscription=void 0,this._path=void 0,this._pathSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._point=void 0,this._pointSubscription=void 0,this._polygon=void 0,this._polygonSubscription=void 0,this._polyline=void 0,this._polylineSubscription=void 0,this._polylineVolume=void 0,this._polylineVolumeSubscription=void 0,this._position=void 0,this._positionSubscription=void 0,this._properties=void 0,this._propertiesSubscription=void 0,this._rectangle=void 0,this._rectangleSubscription=void 0,this._viewFrom=void 0,this._viewFromSubscription=void 0,this._wall=void 0,this._wallSubscription=void 0,this._children=[],this.entityCollection=void 0,this.parent=e.parent,this.merge(e)}function updateShow(e,t,i){for(var r=t.length,n=0;n<r;n++){var a=t[n],o=a._show;(!i&&o)!==(i&&o)&&updateShow(a,a._children,i)}e._definitionChanged.raiseEvent(e,"isShowing",i,!i)}Object.defineProperties(Entity.prototype,{availability:createRawPropertyDescriptor("availability"),id:{get:function(){return this._id}},definitionChanged:{get:function(){return this._definitionChanged}},name:createRawPropertyDescriptor("name"),show:{get:function(){return this._show},set:function(e){if(e!==this._show){var t=this.isShowing;this._show=e;var i=this.isShowing;t!==i&&updateShow(this,this._children,i),this._definitionChanged.raiseEvent(this,"show",e,!e)}}},isShowing:{get:function(){return this._show&&(!defined(this.entityCollection)||this.entityCollection.show)&&(!defined(this._parent)||this._parent.isShowing)}},parent:{get:function(){return this._parent},set:function(e){var t=this._parent;if(t!==e){var i=this.isShowing;if(defined(t)){var r=t._children.indexOf(this);t._children.splice(r,1)}this._parent=e,defined(e)&&e._children.push(this);var n=this.isShowing;i!==n&&updateShow(this,this._children,n),this._definitionChanged.raiseEvent(this,"parent",e,t)}}},propertyNames:{get:function(){return this._propertyNames}},billboard:createPropertyTypeDescriptor("billboard",BillboardGraphics),box:createPropertyTypeDescriptor("box",BoxGraphics),corridor:createPropertyTypeDescriptor("corridor",CorridorGraphics),cylinder:createPropertyTypeDescriptor("cylinder",CylinderGraphics),description:createPropertyDescriptor("description"),ellipse:createPropertyTypeDescriptor("ellipse",EllipseGraphics),ellipsoid:createPropertyTypeDescriptor("ellipsoid",EllipsoidGraphics),label:createPropertyTypeDescriptor("label",LabelGraphics),model:createPropertyTypeDescriptor("model",ModelGraphics),tileset:createPropertyTypeDescriptor("tileset",Cesium3DTilesetGraphics),orientation:createPropertyDescriptor("orientation"),path:createPropertyTypeDescriptor("path",PathGraphics),plane:createPropertyTypeDescriptor("plane",PlaneGraphics),point:createPropertyTypeDescriptor("point",PointGraphics),polygon:createPropertyTypeDescriptor("polygon",PolygonGraphics),polyline:createPropertyTypeDescriptor("polyline",PolylineGraphics),polylineVolume:createPropertyTypeDescriptor("polylineVolume",PolylineVolumeGraphics),properties:createPropertyTypeDescriptor("properties",PropertyBag),position:createPositionPropertyDescriptor("position"),rectangle:createPropertyTypeDescriptor("rectangle",RectangleGraphics),viewFrom:createPropertyDescriptor("viewFrom"),wall:createPropertyTypeDescriptor("wall",WallGraphics)}),Entity.prototype.isAvailable=function(e){var t=this._availability;return!defined(t)||t.contains(e)},Entity.prototype.addProperty=function(e){this._propertyNames.push(e),Object.defineProperty(this,e,createRawPropertyDescriptor(e,!0))},Entity.prototype.removeProperty=function(e){var t=this._propertyNames.indexOf(e);this._propertyNames.splice(t,1),delete this[e]},Entity.prototype.merge=function(e){this.name=defaultValue(this.name,e.name),this.availability=defaultValue(this.availability,e.availability);for(var t=this._propertyNames,i=defined(e._propertyNames)?e._propertyNames:Object.keys(e),r=i.length,n=0;n<r;n++){var a=i[n];if("parent"!==a&&"name"!==a&&"availability"!==a){var o=this[a],s=e[a];defined(o)||-1!==t.indexOf(a)||this.addProperty(a),defined(s)&&(defined(o)?defined(o.merge)&&o.merge(s):defined(s.merge)&&defined(s.clone)?this[a]=s.clone():this[a]=s)}}};var matrix3Scratch=new Matrix3,positionScratch$6=new Cartesian3,orientationScratch=new Quaternion;Entity.prototype.computeModelMatrix=function(e,t){var i=Property.getValueOrUndefined(this._position,e,positionScratch$6);if(defined(i)){var r=Property.getValueOrUndefined(this._orientation,e,orientationScratch);return t=defined(r)?Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(r,matrix3Scratch),i,t):Transforms.eastNorthUpToFixedFrame(i,void 0,t)}},Entity.prototype.computeModelMatrixForHeightReference=function(e,t,i,r,n){var a=Property.getValueOrDefault(t,e,HeightReference$1.NONE),o=Property.getValueOrUndefined(this._position,e,positionScratch$6);if(a===HeightReference$1.NONE||!defined(o)||Cartesian3.equalsEpsilon(o,Cartesian3.ZERO,CesiumMath.EPSILON8))return this.computeModelMatrix(e,n);var s=r.cartesianToCartographic(o,cartoScratch$1);a===HeightReference$1.CLAMP_TO_GROUND?s.height=i:s.height+=i,o=r.cartographicToCartesian(s,o);var l=Property.getValueOrUndefined(this._orientation,e,orientationScratch);return n=defined(l)?Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(l,matrix3Scratch),o,n):Transforms.eastNorthUpToFixedFrame(o,void 0,n)},Entity.supportsMaterialsforEntitiesOnTerrain=function(e){return GroundPrimitive.supportsMaterials(e)},Entity.supportsPolylinesOnTerrain=function(e){return GroundPolylinePrimitive.isSupported(e)};var defaultMaterial$2=new ColorMaterialProperty(Color.WHITE),defaultShow$1=new ConstantProperty(!0),defaultFill$1=new ConstantProperty(!0),defaultOutline=new ConstantProperty(!1),defaultOutlineColor$3=new ConstantProperty(Color.BLACK),defaultShadows$2=new ConstantProperty(ShadowMode$1.DISABLED),defaultDistanceDisplayCondition$7=new ConstantProperty(new DistanceDisplayCondition),defaultClassificationType$1=new ConstantProperty(ClassificationType$1.BOTH);function GeometryUpdater(e){var t=e.entity,i=e.geometryPropertyName;this._entity=t,this._scene=e.scene,this._fillEnabled=!1,this._isClosed=!1,this._onTerrain=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new Event,this._showProperty=void 0,this._materialProperty=void 0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._options=e.geometryOptions,this._geometryPropertyName=i,this._id=i+"-"+t.id,this._observedPropertyNames=e.observedPropertyNames,this._supportsMaterialsforEntitiesOnTerrain=Entity.supportsMaterialsforEntitiesOnTerrain(e.scene)}function CallbackProperty(e,t){this._callback=void 0,this._isConstant=void 0,this._definitionChanged=new Event,this.setCallback(e,t)}Object.defineProperties(GeometryUpdater.prototype,{id:{get:function(){return this._id}},entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!defined(this._entity.availability)&&Property.isConstant(this._showProperty)&&Property.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!defined(this._entity.availability)&&Property.isConstant(this._showProperty)&&Property.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},shadowsProperty:{get:function(){return this._shadowsProperty}},distanceDisplayConditionProperty:{get:function(){return this._distanceDisplayConditionProperty}},classificationTypeProperty:{get:function(){return this._classificationTypeProperty}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},onTerrain:{get:function(){return this._onTerrain}},geometryChanged:{get:function(){return this._geometryChanged}}}),GeometryUpdater.prototype.isOutlineVisible=function(e){var t=this._entity;return defaultValue(this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e),!1)},GeometryUpdater.prototype.isFilled=function(e){var t=this._entity;return defaultValue(this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e),!1)},GeometryUpdater.prototype.createFillGeometryInstance=DeveloperError.throwInstantiationError,GeometryUpdater.prototype.createOutlineGeometryInstance=DeveloperError.throwInstantiationError,GeometryUpdater.prototype.isDestroyed=function(){return!1},GeometryUpdater.prototype.destroy=function(){destroyObject(this)},GeometryUpdater.prototype._isHidden=function(e,t){var i=t.show;return defined(i)&&i.isConstant&&!i.getValue(Iso8601.MINIMUM_VALUE)},GeometryUpdater.prototype._isOnTerrain=function(e,t){return!1},GeometryUpdater.prototype._getIsClosed=function(e){return!0},GeometryUpdater.prototype._isDynamic=DeveloperError.throwInstantiationError,GeometryUpdater.prototype._setStaticOptions=DeveloperError.throwInstantiationError,GeometryUpdater.prototype._onEntityPropertyChanged=function(e,t,i,r){if(-1!==this._observedPropertyNames.indexOf(t)){var n=this._entity[this._geometryPropertyName];if(defined(n)){var a=n.fill,o=!defined(a)||!a.isConstant||a.getValue(Iso8601.MINIMUM_VALUE),s=n.outline,l=defined(s);if(l&&s.isConstant&&(l=s.getValue(Iso8601.MINIMUM_VALUE)),o||l){var c=n.show;if(this._isHidden(e,n))(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));else{this._materialProperty=defaultValue(n.material,defaultMaterial$2),this._fillProperty=defaultValue(a,defaultFill$1),this._showProperty=defaultValue(c,defaultShow$1),this._showOutlineProperty=defaultValue(n.outline,defaultOutline),this._outlineColorProperty=l?defaultValue(n.outlineColor,defaultOutlineColor$3):void 0,this._shadowsProperty=defaultValue(n.shadows,defaultShadows$2),this._distanceDisplayConditionProperty=defaultValue(n.distanceDisplayCondition,defaultDistanceDisplayCondition$7),this._classificationTypeProperty=defaultValue(n.classificationType,defaultClassificationType$1),this._fillEnabled=o;var u=this._isOnTerrain(e,n)&&(this._supportsMaterialsforEntitiesOnTerrain||this._materialProperty instanceof ColorMaterialProperty);if(l&&u&&(oneTimeWarning(oneTimeWarning.geometryOutlines),l=!1),this._onTerrain=u,this._outlineEnabled=l,this._isDynamic(e,n))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{this._setStaticOptions(e,n),this._isClosed=this._getIsClosed(this._options);var d=n.outlineWidth;this._outlineWidth=defined(d)?d.getValue(Iso8601.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}}}else(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this))}else(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this))}},GeometryUpdater.prototype.createDynamicUpdater=function(e,t){return new this.constructor.DynamicGeometryUpdater(this,e,t)},Object.defineProperties(CallbackProperty.prototype,{isConstant:{get:function(){return this._isConstant}},definitionChanged:{get:function(){return this._definitionChanged}}}),CallbackProperty.prototype.getValue=function(e,t){return this._callback(e,t)},CallbackProperty.prototype.setCallback=function(e,t){var i=this._callback!==e||this._isConstant!==t;this._callback=e,this._isConstant=t,i&&this._definitionChanged.raiseEvent(this)},CallbackProperty.prototype.equals=function(e){return this===e||e instanceof CallbackProperty&&this._callback===e._callback&&this._isConstant===e._isConstant};var scratchPosition$8=new Cartesian3,scratchCarto$1=new Cartographic;function TerrainOffsetProperty(e,t,i,r){this._scene=e,this._heightReference=i,this._extrudedHeightReference=r,this._positionProperty=t,this._position=new Cartesian3,this._cartographicPosition=new Cartographic,this._normal=new Cartesian3,this._definitionChanged=new Event,this._terrainHeight=0,this._removeCallbackFunc=void 0,this._removeEventListener=void 0,this._removeModeListener=void 0;var n=this;if(defined(e.globe)&&(this._removeEventListener=e.terrainProviderChanged.addEventListener((function(){n._updateClamping()})),this._removeModeListener=e.morphComplete.addEventListener((function(){n._updateClamping()}))),t.isConstant){var a=t.getValue(Iso8601.MINIMUM_VALUE,scratchPosition$8);if(!defined(a)||Cartesian3.equals(a,Cartesian3.ZERO)||!defined(e.globe))return;this._position=Cartesian3.clone(a,this._position),this._updateClamping(),this._normal=e.globe.ellipsoid.geodeticSurfaceNormal(a,this._normal)}}function heightReferenceOnEntityPropertyChanged(e,t,i,r){if(GeometryUpdater.prototype._onEntityPropertyChanged.call(this,e,t,i,r),-1!==this._observedPropertyNames.indexOf(t)){var n=this._entity[this._geometryPropertyName];if(defined(n)){defined(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);var a=n.heightReference;if(defined(a)){var o=new CallbackProperty(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new TerrainOffsetProperty(this._scene,o,a)}}}}Object.defineProperties(TerrainOffsetProperty.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),TerrainOffsetProperty.prototype._updateClamping=function(){defined(this._removeCallbackFunc)&&this._removeCallbackFunc();var e=this._scene,t=e.globe,i=this._position;if(defined(t)&&!Cartesian3.equals(i,Cartesian3.ZERO)){var r=t.ellipsoid,n=t._surface,a=this,o=r.cartesianToCartographic(i,this._cartographicPosition),s=t.getHeight(o);defined(s)?this._terrainHeight=s:this._terrainHeight=0,this._removeCallbackFunc=n.updateHeight(o,(function(t){if(e.mode===SceneMode$1.SCENE3D){var i=r.cartesianToCartographic(t,scratchCarto$1);a._terrainHeight=i.height}else a._terrainHeight=t.x;a.definitionChanged.raiseEvent()}))}else this._terrainHeight=0},TerrainOffsetProperty.prototype.getValue=function(e,t){var i=Property.getValueOrDefault(this._heightReference,e,HeightReference$1.NONE),r=Property.getValueOrDefault(this._extrudedHeightReference,e,HeightReference$1.NONE);if(i===HeightReference$1.NONE&&r!==HeightReference$1.RELATIVE_TO_GROUND)return this._position=Cartesian3.clone(Cartesian3.ZERO,this._position),Cartesian3.clone(Cartesian3.ZERO,t);if(this._positionProperty.isConstant)return Cartesian3.multiplyByScalar(this._normal,this._terrainHeight,t);var n=this._scene,a=this._positionProperty.getValue(e,scratchPosition$8);if(!defined(a)||Cartesian3.equals(a,Cartesian3.ZERO)||!defined(n.globe))return Cartesian3.clone(Cartesian3.ZERO,t);if(Cartesian3.equalsEpsilon(this._position,a,CesiumMath.EPSILON10))return Cartesian3.multiplyByScalar(this._normal,this._terrainHeight,t);this._position=Cartesian3.clone(a,this._position),this._updateClamping();var o=n.globe.ellipsoid.geodeticSurfaceNormal(a,this._normal);return Cartesian3.multiplyByScalar(o,this._terrainHeight,t)},TerrainOffsetProperty.prototype.isDestroyed=function(){return!1},TerrainOffsetProperty.prototype.destroy=function(){return defined(this._removeEventListener)&&this._removeEventListener(),defined(this._removeModeListener)&&this._removeModeListener(),defined(this._removeCallbackFunc)&&this._removeCallbackFunc(),destroyObject(this)};var defaultOffset$a=Cartesian3.ZERO,offsetScratch$9=new Cartesian3,positionScratch$5=new Cartesian3,scratchColor$o=new Color;function BoxGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0,this.offsetAttribute=void 0}function BoxGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new BoxGeometryOptions(e),geometryPropertyName:"box",observedPropertyNames:["availability","position","orientation","box"]}),this._onEntityPropertyChanged(e,"box",e.box,void 0)}function DynamicBoxGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}function ClearCommand(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.color=e.color,this.depth=e.depth,this.stencil=e.stencil,this.renderState=e.renderState,this.framebuffer=e.framebuffer,this.owner=e.owner,this.pass=e.pass}defined(Object.create)&&(BoxGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),BoxGeometryUpdater.prototype.constructor=BoxGeometryUpdater),Object.defineProperties(BoxGeometryUpdater.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),BoxGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n=new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),o={show:n,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a),color:void 0,offset:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$o)),defined(t)||(t=Color.WHITE),o.color=ColorGeometryInstanceAttribute.fromColor(t));return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$a,offsetScratch$9))),new GeometryInstance({id:i,geometry:BoxGeometry.fromDimensions(this._options),modelMatrix:i.computeModelMatrixForHeightReference(e,i.box.heightReference,.5*this._options.dimensions.z,this._scene.mapProjection.ellipsoid),attributes:o})},BoxGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$o),n=this._distanceDisplayConditionProperty.getValue(e),a={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n),offset:void 0};return defined(this._options.offsetAttribute)&&(a.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$a,offsetScratch$9))),new GeometryInstance({id:t,geometry:BoxOutlineGeometry.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,.5*this._options.dimensions.z,this._scene.mapProjection.ellipsoid),attributes:a})},BoxGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},BoxGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.dimensions)||!defined(e.position)||GeometryUpdater.prototype._isHidden.call(this,e,t)},BoxGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.dimensions.isConstant&&Property.isConstant(t.outlineWidth))},BoxGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),r=this._options;r.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,r.dimensions=t.dimensions.getValue(Iso8601.MINIMUM_VALUE,r.dimensions),r.offsetAttribute=i!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},BoxGeometryUpdater.prototype._onEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,BoxGeometryUpdater.DynamicGeometryUpdater=DynamicBoxGeometryUpdater,defined(Object.create)&&(DynamicBoxGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicBoxGeometryUpdater.prototype.constructor=DynamicBoxGeometryUpdater),DynamicBoxGeometryUpdater.prototype._isHidden=function(e,t,i){var r=Property.getValueOrUndefined(e.position,i,positionScratch$5),n=this._options.dimensions;return!defined(r)||!defined(n)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicBoxGeometryUpdater.prototype._setOptions=function(e,t,i){var r=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),n=this._options;n.dimensions=Property.getValueOrUndefined(t.dimensions,i,n.dimensions),n.offsetAttribute=r!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},ClearCommand.ALL=Object.freeze(new ClearCommand({color:new Color(0,0,0,0),depth:1,stencil:0})),ClearCommand.prototype.execute=function(e,t){e.clear(this,t)};var Axis={X:0,Y:1,Z:2};Axis.Y_UP_TO_Z_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationX(CesiumMath.PI_OVER_TWO)),Axis.Z_UP_TO_Y_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationX(-CesiumMath.PI_OVER_TWO)),Axis.X_UP_TO_Z_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationY(-CesiumMath.PI_OVER_TWO)),Axis.Z_UP_TO_X_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationY(CesiumMath.PI_OVER_TWO)),Axis.X_UP_TO_Y_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationZ(CesiumMath.PI_OVER_TWO)),Axis.Y_UP_TO_X_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationZ(-CesiumMath.PI_OVER_TWO)),Axis.fromName=function(e){return Axis[e]};var Axis$1=Object.freeze(Axis),B3dmParser={};B3dmParser._deprecationWarning=deprecationWarning;var sizeOfUint32$6=Uint32Array.BYTES_PER_ELEMENT;function BatchTexture(e){var t,i,r=e.featuresLength;if(this._showAlphaProperties=void 0,this._batchValues=void 0,this._batchValuesDirty=!1,this._batchTexture=void 0,this._defaultTexture=void 0,this._pickTexture=void 0,this._pickIds=[],r>0){var n=Math.min(r,ContextLimits.maximumTextureSize),a=Math.ceil(r/ContextLimits.maximumTextureSize),o=1/n,s=.5*o,l=1/a,c=.5*l;t=new Cartesian2(n,a),i=new Cartesian4(o,s,l,c)}this._translucentFeaturesLength=0,this._featuresLength=r,this._textureDimensions=t,this._textureStep=i,this._owner=e.owner,this._statistics=e.statistics,this._colorChangedCallback=e.colorChangedCallback}function getByteLength(e){var t=e._textureDimensions;return t.x*t.y*4}function getBatchValues(e){if(!defined(e._batchValues)){var t=getByteLength(e),i=new Uint8Array(t);arrayFill(i,255),e._batchValues=i}return e._batchValues}function getShowAlphaProperties(e){if(!defined(e._showAlphaProperties)){var t=2*e._featuresLength,i=new Uint8Array(t);arrayFill(i,255),e._showAlphaProperties=i}return e._showAlphaProperties}B3dmParser.parse=function(e,t){var i=defaultValue(t,0);t=i;var r=new Uint8Array(e),n=new DataView(e);t+=sizeOfUint32$6;var a=n.getUint32(t,!0);if(1!==a)throw new RuntimeError("Only Batched 3D Model version 1 is supported. Version "+a+" is not.");t+=sizeOfUint32$6;var o=n.getUint32(t,!0);t+=sizeOfUint32$6;var s=n.getUint32(t,!0);t+=sizeOfUint32$6;var l=n.getUint32(t,!0);t+=sizeOfUint32$6;var c=n.getUint32(t,!0);t+=sizeOfUint32$6;var u,d,h=n.getUint32(t,!0);t+=sizeOfUint32$6,c>=570425344?(t-=2*sizeOfUint32$6,u=s,c=l,h=0,s=0,l=0,B3dmParser._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchLength] [batchTableByteLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel.")):h>=570425344&&(t-=sizeOfUint32$6,u=c,c=s,h=l,s=0,l=0,B3dmParser._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchTableJsonByteLength] [batchTableBinaryByteLength] [batchLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel.")),0===s?d={BATCH_LENGTH:defaultValue(u,0)}:(d=getJsonFromTypedArray(r,t,s),t+=s);var p,f,m=new Uint8Array(e,t,l);t+=l,c>0&&(p=getJsonFromTypedArray(r,t,c),t+=c,h>0&&(f=new Uint8Array(e,t,h),f=new Uint8Array(f),t+=h));var g,_=i+o-t;if(0===_)throw new RuntimeError("glTF byte length must be greater than 0.");return t%4==0?g=new Uint8Array(e,t,_):(B3dmParser._deprecationWarning("b3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),g=new Uint8Array(r.subarray(t,t+_))),{batchLength:u,featureTableJson:d,featureTableBinary:m,batchTableJson:p,batchTableBinary:f,gltf:g}},Object.defineProperties(BatchTexture.prototype,{translucentFeaturesLength:{get:function(){return this._translucentFeaturesLength}},memorySizeInBytes:{get:function(){var e=0;return defined(this._pickTexture)&&(e+=this._pickTexture.sizeInBytes),defined(this._batchTexture)&&(e+=this._batchTexture.sizeInBytes),e}},textureDimensions:{get:function(){return this._textureDimensions}},textureStep:{get:function(){return this._textureStep}},batchTexture:{get:function(){return this._batchTexture}},defaultTexture:{get:function(){return this._defaultTexture}},pickTexture:{get:function(){return this._pickTexture}}}),BatchTexture.DEFAULT_COLOR_VALUE=Color.WHITE,BatchTexture.DEFAULT_SHOW_VALUE=!0,BatchTexture.prototype.setShow=function(e,t){if(!t||defined(this._showAlphaProperties)){var i=getShowAlphaProperties(this),r=2*e,n=t?255:0;if(i[r]!==n)i[r]=n,getBatchValues(this)[4*e+3]=t?i[r+1]:0,this._batchValuesDirty=!0}},BatchTexture.prototype.setAllShow=function(e){for(var t=this._featuresLength,i=0;i<t;++i)this.setShow(i,e)},BatchTexture.prototype.getShow=function(e){if(!defined(this._showAlphaProperties))return!0;var t=2*e;return 255===this._showAlphaProperties[t]};var scratchColorBytes$1=new Array(4);function createTexture$4(e,t,i){var r=e._textureDimensions;return new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{width:r.x,height:r.y,arrayBufferView:i},flipY:!1,sampler:Sampler.NEAREST})}function createPickTexture(e,t){var i=e._featuresLength;if(!defined(e._pickTexture)&&i>0){for(var r=e._pickIds,n=getByteLength(e),a=new Uint8Array(n),o=e._owner,s=e._statistics,l=0;l<i;++l){var c=t.createPickId(o.getFeature(l));r.push(c);var u=c.color,d=4*l;a[d]=Color.floatToByte(u.red),a[d+1]=Color.floatToByte(u.green),a[d+2]=Color.floatToByte(u.blue),a[d+3]=Color.floatToByte(u.alpha)}e._pickTexture=createTexture$4(e,t,a),defined(s)&&(s.batchTableByteLength+=e._pickTexture.sizeInBytes)}}function updateBatchTexture(e){var t=e._textureDimensions;e._batchTexture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}BatchTexture.prototype.setColor=function(e,t){if(!Color.equals(t,BatchTexture.DEFAULT_COLOR_VALUE)||defined(this._batchValues)){var i=t.toBytes(scratchColorBytes$1),r=i[3],n=getBatchValues(this),a=4*e,o=getShowAlphaProperties(this),s=2*e;if(n[a]!==i[0]||n[a+1]!==i[1]||n[a+2]!==i[2]||o[s+1]!==r){n[a]=i[0],n[a+1]=i[1],n[a+2]=i[2];var l=255!==o[s+1],c=0!==o[s];n[a+3]=c?r:0,o[s+1]=r;var u=255!==r;u&&!l?++this._translucentFeaturesLength:!u&&l&&--this._translucentFeaturesLength,this._batchValuesDirty=!0,defined(this._colorChangedCallback)&&this._colorChangedCallback(e,t)}}},BatchTexture.prototype.setAllColor=function(e){for(var t=this._featuresLength,i=0;i<t;++i)this.setColor(i,e)},BatchTexture.prototype.getColor=function(e,t){if(!defined(this._batchValues))return Color.clone(BatchTexture.DEFAULT_COLOR_VALUE,t);var i=this._batchValues,r=4*e,n=this._showAlphaProperties,a=2*e;return Color.fromBytes(i[r],i[r+1],i[r+2],n[a+1],t)},BatchTexture.prototype.getPickColor=function(e){return this._pickIds[e]},BatchTexture.prototype.update=function(e,t){var i=t.context;this._defaultTexture=i.defaultTexture;var r=t.passes;(r.pick||r.postProcess)&&createPickTexture(this,i),this._batchValuesDirty&&(this._batchValuesDirty=!1,defined(this._batchTexture)||(this._batchTexture=createTexture$4(this,i,this._batchValues),defined(this._statistics)&&(this._statistics.batchTableByteLength+=this._batchTexture.sizeInBytes)),updateBatchTexture(this))},BatchTexture.prototype.isDestroyed=function(){return!1},BatchTexture.prototype.destroy=function(){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),this._pickTexture=this._pickTexture&&this._pickTexture.destroy();for(var e=this._pickIds,t=e.length,i=0;i<t;++i)e[i].destroy();return destroyObject(this)};var ComponentsPerAttribute={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ClassPerType={SCALAR:void 0,VEC2:Cartesian2,VEC3:Cartesian3,VEC4:Cartesian4,MAT2:Matrix2,MAT3:Matrix3,MAT4:Matrix4};function getBinaryAccessor(e){var t,i=e.componentType;t="string"==typeof i?ComponentDatatype$1.fromName(i):i;var r=ComponentsPerAttribute[e.type],n=ClassPerType[e.type];return{componentsPerAttribute:r,classType:n,createArrayBufferView:function(e,i,n){return ComponentDatatype$1.createArrayBufferView(t,e,i,r*n)}}}function BatchTableHierarchy(e){this._classes=void 0,this._classIds=void 0,this._classIndexes=void 0,this._parentCounts=void 0,this._parentIndexes=void 0,this._parentIds=void 0,initialize$f(this,e.extension,e.binaryBody)}function initialize$f(e,t,i){var r,n,a,o=t.instancesLength,s=t.classes,l=t.classIds,c=t.parentCounts,u=t.parentIds,d=o;if(defined(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,ComponentDatatype$1.UNSIGNED_SHORT),l.type=AttributeType$1.SCALAR,l=getBinaryAccessor(l).createArrayBufferView(i.buffer,i.byteOffset+l.byteOffset,o)),defined(c))for(defined(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,ComponentDatatype$1.UNSIGNED_SHORT),c.type=AttributeType$1.SCALAR,c=getBinaryAccessor(c).createArrayBufferView(i.buffer,i.byteOffset+c.byteOffset,o)),a=new Uint16Array(o),d=0,r=0;r<o;++r)a[r]=d,d+=c[r];defined(u)&&defined(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,ComponentDatatype$1.UNSIGNED_SHORT),u.type=AttributeType$1.SCALAR,u=getBinaryAccessor(u).createArrayBufferView(i.buffer,i.byteOffset+u.byteOffset,d));var h=s.length;for(r=0;r<h;++r){var p=s[r].length,f=s[r].instances,m=getBinaryProperties$1(p,f,i);s[r].instances=combine$2(m,f)}var g=arrayFill(new Array(h),0),_=new Uint16Array(o);for(r=0;r<o;++r)n=l[r],_[r]=g[n],++g[n];e._classes=s,e._classIds=l,e._classIndexes=_,e._parentCounts=c,e._parentIndexes=a,e._parentIds=u}function getBinaryProperties$1(e,t,i){var r;for(var n in t)if(t.hasOwnProperty(n)){var a=t[n],o=a.byteOffset;if(defined(o)){var s=a.componentType,l=a.type;if(!defined(s))throw new RuntimeError("componentType is required.");if(!defined(l))throw new RuntimeError("type is required.");if(!defined(i))throw new RuntimeError("Property "+n+" requires a batch table binary.");var c=getBinaryAccessor(a),u=c.componentsPerAttribute,d=c.classType,h=c.createArrayBufferView(i.buffer,i.byteOffset+o,e);defined(r)||(r={}),r[n]={typedArray:h,componentCount:u,type:d}}}return r}var scratchVisited=[],scratchStack$1=[],marker=0;function traverseHierarchyMultipleParents(e,t,i){var r=e._classIds,n=e._parentCounts,a=e._parentIds,o=e._parentIndexes,s=r.length,l=scratchVisited;l.length=Math.max(l.length,s);var c=++marker,u=scratchStack$1;for(u.length=0,u.push(t);u.length>0;)if(l[t=u.pop()]!==c){l[t]=c;var d=i(e,t);if(defined(d))return d;for(var h=n[t],p=o[t],f=0;f<h;++f){var m=a[p+f];m!==t&&u.push(m)}}}function traverseHierarchySingleParent(e,t,i){for(var r=!0;r;){var n=i(e,t);if(defined(n))return n;var a=e._parentIds[t];r=a!==t,t=a}}function traverseHierarchy(e,t,i){var r=e._parentCounts;return defined(e._parentIds)?defined(r)?traverseHierarchyMultipleParents(e,t,i):traverseHierarchySingleParent(e,t,i):i(e,t)}function getBinaryProperty$1(e,t){var i=e.typedArray,r=e.componentCount;return 1===r?i[t]:e.type.unpack(i,t*r)}function setBinaryProperty$1(e,t,i){var r=e.typedArray,n=e.componentCount;1===n?r[t]=i:e.type.pack(i,r,t*n)}BatchTableHierarchy.prototype.hasProperty=function(e,t){var i=traverseHierarchy(this,e,(function(e,i){var r=e._classIds[i];if(defined(e._classes[r].instances[t]))return!0}));return defined(i)},BatchTableHierarchy.prototype.propertyExists=function(e){for(var t=this._classes,i=t.length,r=0;r<i;++r){if(defined(t[r].instances[e]))return!0}return!1},BatchTableHierarchy.prototype.getPropertyIds=function(e,t){return(t=defined(t)?t:[]).length=0,traverseHierarchy(this,e,(function(e,i){var r=e._classIds[i],n=e._classes[r].instances;for(var a in n)n.hasOwnProperty(a)&&-1===t.indexOf(a)&&t.push(a)})),t},BatchTableHierarchy.prototype.getProperty=function(e,t){return traverseHierarchy(this,e,(function(e,i){var r=e._classIds[i],n=e._classes[r],a=e._classIndexes[i],o=n.instances[t];if(defined(o))return defined(o.typedArray)?getBinaryProperty$1(o,a):clone$1(o[a],!0)}))},BatchTableHierarchy.prototype.setProperty=function(e,t,i){var r=traverseHierarchy(this,e,(function(e,r){var n=e._classIds[r],a=e._classes[n],o=e._classIndexes[r],s=a.instances[t];if(defined(s))return defined(s.typedArray)?setBinaryProperty$1(s,o,i):s[o]=clone$1(i,!0),!0}));return defined(r)},BatchTableHierarchy.prototype.isClass=function(e,t){return defined(traverseHierarchy(this,e,(function(e,i){var r=e._classIds[i];if(e._classes[r].name===t)return!0})))},BatchTableHierarchy.prototype.getClassName=function(e){var t=this._classIds[e];return this._classes[t].name};var Cesium3DTileColorBlendMode={HIGHLIGHT:0,REPLACE:1,MIX:2},Cesium3DTileColorBlendMode$1=Object.freeze(Cesium3DTileColorBlendMode),DEFAULT_COLOR_VALUE$3=BatchTexture.DEFAULT_COLOR_VALUE,DEFAULT_SHOW_VALUE$3=BatchTexture.DEFAULT_SHOW_VALUE;function Cesium3DTileBatchTable(e,t,i,r,n){var a;this.featuresLength=t,defined(i)&&(a=i.extensions),this._extensions=defaultValue(a,{});var o=initializeProperties(i);this._properties=o,this._batchTableHierarchy=initializeHierarchy$1(this,i,r),this._batchTableBinaryProperties=getBinaryProperties(t,o,r),this._content=e,this._batchTexture=new BatchTexture({featuresLength:t,colorChangedCallback:n,owner:e,statistics:e.tileset.statistics})}function initializeProperties(e){var t={};if(!defined(e))return t;for(var i in e)e.hasOwnProperty(i)&&"HIERARCHY"!==i&&"extensions"!==i&&"extras"!==i&&(t[i]=clone$1(e[i],!0));return t}function initializeHierarchy$1(e,t,i){if(defined(t)){var r=e._extensions["3DTILES_batch_table_hierarchy"],n=t.HIERARCHY;if(defined(n)&&(Cesium3DTileBatchTable._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),e._extensions["3DTILES_batch_table_hierarchy"]=n,r=n),defined(r))return new BatchTableHierarchy({extension:r,binaryBody:i})}}function getBinaryProperties(e,t,i){var r;for(var n in t)if(t.hasOwnProperty(n)){var a=t[n],o=a.byteOffset;if(defined(o)){var s=a.componentType,l=a.type;if(!defined(s))throw new RuntimeError("componentType is required.");if(!defined(l))throw new RuntimeError("type is required.");if(!defined(i))throw new RuntimeError("Property "+n+" requires a batch table binary.");var c=getBinaryAccessor(a),u=c.componentsPerAttribute,d=c.classType,h=c.createArrayBufferView(i.buffer,i.byteOffset+o,e);defined(r)||(r={}),r[n]={typedArray:h,componentCount:u,type:d}}}return r}Cesium3DTileBatchTable._deprecationWarning=deprecationWarning,Object.defineProperties(Cesium3DTileBatchTable.prototype,{memorySizeInBytes:{get:function(){return this._batchTexture.memorySizeInBytes}}}),Cesium3DTileBatchTable.getBinaryProperties=function(e,t,i){return getBinaryProperties(e,t,i)},Cesium3DTileBatchTable.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)},Cesium3DTileBatchTable.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)},Cesium3DTileBatchTable.prototype.getShow=function(e){return this._batchTexture.getShow(e)},Cesium3DTileBatchTable.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)},Cesium3DTileBatchTable.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)},Cesium3DTileBatchTable.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)},Cesium3DTileBatchTable.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};var scratchColor$n=new Color;function getBinaryProperty(e,t){var i=e.typedArray,r=e.componentCount;return 1===r?i[t]:e.type.unpack(i,t*r)}function setBinaryProperty(e,t,i){var r=e.typedArray,n=e.componentCount;1===n?r[t]=i:e.type.pack(i,r,t*n)}function getGlslComputeSt(e){return 1===e._batchTexture.textureDimensions.y?"uniform vec4 tile_textureStep; \nvec2 computeSt(float batchId) \n{ \n float stepX = tile_textureStep.x; \n float centerX = tile_textureStep.y; \n return vec2(centerX + (batchId * stepX), 0.5); \n} \n":"uniform vec4 tile_textureStep; \nuniform vec2 tile_textureDimensions; \nvec2 computeSt(float batchId) \n{ \n float stepX = tile_textureStep.x; \n float centerX = tile_textureStep.y; \n float stepY = tile_textureStep.z; \n float centerY = tile_textureStep.w; \n float xId = mod(batchId, tile_textureDimensions.x); \n float yId = floor(batchId / tile_textureDimensions.x); \n return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); \n} \n"}function getDefaultShader(e,t){return e=ShaderSource.replaceMain(e,"tile_main"),t?e+"uniform float tile_colorBlend; \nvoid tile_color(vec4 tile_featureColor) \n{ \n tile_main(); \n tile_featureColor = czm_gammaCorrect(tile_featureColor); \n gl_FragColor.a *= tile_featureColor.a; \n float highlight = ceil(tile_colorBlend); \n gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n} \n":e+"void tile_color(vec4 tile_featureColor) \n{ \n tile_main(); \n} \n"}function replaceDiffuseTextureCalls(e,t){for(var i,r="texture2D("+t,n=0,a=e.indexOf(r,n);a>-1;){for(var o=0,s=a;s<e.length;++s){var l=e.charAt(s);if("("===l)++o;else if(")"===l&&0===--o){i=s+1;break}}var c="tile_diffuse_final("+e.slice(a,i)+", tile_diffuse)";e=e.slice(0,a)+c+e.slice(i),n=a+c.length,a=e.indexOf(r,n)}return e}function modifyDiffuse(e,t,i){if(!defined(t))return getDefaultShader(e,i);var r=new RegExp("(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+"+t+";"),n=e.match(r);if(!defined(n))return getDefaultShader(e,i);var a=n[0],o=n[2];e=(e=ShaderSource.replaceMain(e,"tile_main")).replace(a,"");var s;if("vec3"===o||"vec4"===o){var l="vec3"===o?"vec4("+t+", 1.0)":t,c="vec3"===o?"tile_diffuse.xyz":"tile_diffuse";r=new RegExp(t,"g"),e=e.replace(r,c),s=" vec4 source = "+l+"; \n tile_diffuse = tile_diffuse_final(source, tile_featureColor); \n tile_main(); \n"}else"sampler2D"===o&&(e=replaceDiffuseTextureCalls(e,t),s=" tile_diffuse = tile_featureColor; \n tile_main(); \n");return e="uniform float tile_colorBlend; \nvec4 tile_diffuse = vec4(1.0); \nbool isWhite(vec3 color) \n{ \n return all(greaterThan(color, vec3(1.0 - czm_epsilon3))); \n} \nvec4 tile_diffuse_final(vec4 sourceDiffuse, vec4 tileDiffuse) \n{ \n vec4 blendDiffuse = mix(sourceDiffuse, tileDiffuse, tile_colorBlend); \n vec4 diffuse = isWhite(tileDiffuse.rgb) ? sourceDiffuse : blendDiffuse; \n return vec4(diffuse.rgb, sourceDiffuse.a); \n} \n"+a+"\n"+e+"\nvoid tile_color(vec4 tile_featureColor) \n{ \n"+s,i&&(e+=" tile_featureColor = czm_gammaCorrect(tile_featureColor); \n gl_FragColor.a *= tile_featureColor.a; \n float highlight = ceil(tile_colorBlend); \n gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n"),e+="} \n"}function getColorBlend(e){var t=e._content.tileset,i=t.colorBlendMode,r=t.colorBlendAmount;return i===Cesium3DTileColorBlendMode$1.HIGHLIGHT?0:i===Cesium3DTileColorBlendMode$1.REPLACE?1:i===Cesium3DTileColorBlendMode$1.MIX?CesiumMath.clamp(r,CesiumMath.EPSILON4,1):void 0}Cesium3DTileBatchTable.prototype.applyStyle=function(e){if(!defined(e))return this.setAllColor(DEFAULT_COLOR_VALUE$3),void this.setAllShow(DEFAULT_SHOW_VALUE$3);for(var t=this._content,i=this.featuresLength,r=0;r<i;++r){var n=t.getFeature(r),a=defined(e.color)?defaultValue(e.color.evaluateColor(n,scratchColor$n),DEFAULT_COLOR_VALUE$3):DEFAULT_COLOR_VALUE$3,o=defined(e.show)?defaultValue(e.show.evaluate(n),DEFAULT_SHOW_VALUE$3):DEFAULT_SHOW_VALUE$3;this.setColor(r,a),this.setShow(r,o)}},Cesium3DTileBatchTable.prototype.isClass=function(e,t){var i=this._batchTableHierarchy;return!!defined(i)&&i.isClass(e,t)},Cesium3DTileBatchTable.prototype.isExactClass=function(e,t){return this.getExactClassName(e)===t},Cesium3DTileBatchTable.prototype.getExactClassName=function(e){var t=this._batchTableHierarchy;if(defined(t))return t.getClassName(e)},Cesium3DTileBatchTable.prototype.hasProperty=function(e,t){return defined(this._properties[t])||defined(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)},Cesium3DTileBatchTable.prototype.getPropertyNames=function(e,t){(t=defined(t)?t:[]).length=0;var i=Object.keys(this._properties);return t.push.apply(t,i),defined(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,i)),t},Cesium3DTileBatchTable.prototype.getPropertyBySemantic=function(e,t){},Cesium3DTileBatchTable.prototype.getProperty=function(e,t){if(defined(this._batchTableBinaryProperties)){var i=this._batchTableBinaryProperties[t];if(defined(i))return getBinaryProperty(i,e)}var r=this._properties[t];if(defined(r))return clone$1(r[e],!0);if(defined(this._batchTableHierarchy)){var n=this._batchTableHierarchy.getProperty(e,t);if(defined(n))return n}},Cesium3DTileBatchTable.prototype.setProperty=function(e,t,i){var r=this.featuresLength;if(defined(this._batchTableBinaryProperties)){var n=this._batchTableBinaryProperties[t];if(defined(n))return void setBinaryProperty(n,e,i)}if(!defined(this._batchTableHierarchy)||!this._batchTableHierarchy.setProperty(e,t,i)){var a=this._properties[t];defined(a)||(this._properties[t]=new Array(r),a=this._properties[t]),a[e]=clone$1(i,!0)}},Cesium3DTileBatchTable.prototype.getVertexShaderCallback=function(e,t,i){if(0!==this.featuresLength){var r=this;return function(n){var a,o=modifyDiffuse(n,i,!1);return ContextLimits.maximumVertexTextureImageUnits>0?(a="",e&&(a+="uniform bool tile_translucentCommand; \n"),a+="uniform sampler2D tile_batchTexture; \nvarying vec4 tile_featureColor; \nvarying vec2 tile_featureSt; \nvarying vec4 v_elevationPos;void main() \n{ \n vec2 st = computeSt("+t+"); \n vec4 featureProperties = texture2D(tile_batchTexture, st); \n tile_color(featureProperties); \n float show = ceil(featureProperties.a); \n gl_Position *= show; \n",e&&(a+=" bool isStyleTranslucent = (featureProperties.a != 1.0); \n if (czm_pass == czm_passTranslucent) \n { \n if (!isStyleTranslucent && !tile_translucentCommand) \n { \n gl_Position *= 0.0; \n } \n } \n else \n { \n if (isStyleTranslucent) \n { \n gl_Position *= 0.0; \n } \n } \n"),a+=" tile_featureColor = featureProperties; \n tile_featureSt = st; \n v_elevationPos = czm_inverseModelViewProjection * gl_Position;\n}"):a="varying vec2 tile_featureSt; \nvarying vec4 v_elevationPos; \nvoid main() \n{ \n tile_color(vec4(1.0)); \n tile_featureSt = computeSt("+t+"); \n v_elevationPos = czm_inverseModelViewProjection * gl_Position;\n}",o+"\n"+getGlslComputeSt(r)+a}}},Cesium3DTileBatchTable.prototype.getFragmentShaderCallback=function(e,t,i){if(0!==this.featuresLength){if(this._content._tileset._fShader){var r=this;return function(e){var t=ShaderSource.replaceMain(e,"js_custom_main");return t=(t="varying vec4 v_elevationPos;\n"+t)+"\nvoid main() { \n js_custom_main(); \n"+r._content._tileset._fShader+"} \n"}}var n=null;return defined(this._content)&&defined(this._content._tileset)&&(n=defaultValue(this._content._tileset._fShaderBody,"")),function(r){return r=modifyDiffuse(r,t,!0),ContextLimits.maximumVertexTextureImageUnits>0?(r+="uniform sampler2D tile_pickTexture; \nvarying vec2 tile_featureSt; \nvarying vec4 tile_featureColor; \nvarying vec4 v_elevationPos;void main() \n{ \n tile_color(tile_featureColor); \n",defined(n)&&(r+=n),i&&(r+=" gl_FragColor.rgb *= gl_FragColor.a; \n"),r+="}"):(e&&(r+="uniform bool tile_translucentCommand; \n"),r+="uniform sampler2D tile_pickTexture; \nuniform sampler2D tile_batchTexture; \nvarying vec2 tile_featureSt; \nvoid main() \n{ \n vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt); \n if (featureProperties.a == 0.0) { \n discard; \n } \n",e&&(r+=" bool isStyleTranslucent = (featureProperties.a != 1.0); \n if (czm_pass == czm_passTranslucent) \n { \n if (!isStyleTranslucent && !tile_translucentCommand) \n { \n discard; \n } \n } \n else \n { \n if (isStyleTranslucent) \n { \n discard; \n } \n } \n"),r+=" tile_color(featureProperties); \n",i&&(r+=" gl_FragColor.rgb *= gl_FragColor.a; \n"),r+="} \n"),r}}},Cesium3DTileBatchTable.prototype.getClassificationFragmentShaderCallback=function(){if(0!==this.featuresLength)return function(e){return e=ShaderSource.replaceMain(e,"tile_main"),ContextLimits.maximumVertexTextureImageUnits>0?e+="uniform sampler2D tile_pickTexture;\nvarying vec2 tile_featureSt; \nvarying vec4 tile_featureColor; \nvoid main() \n{ \n tile_main(); \n gl_FragColor = tile_featureColor; \n gl_FragColor.rgb *= gl_FragColor.a; \n}":e+="uniform sampler2D tile_batchTexture; \nuniform sampler2D tile_pickTexture;\nvarying vec2 tile_featureSt; \nvoid main() \n{ \n tile_main(); \n vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt); \n if (featureProperties.a == 0.0) { \n discard; \n } \n gl_FragColor = featureProperties; \n gl_FragColor.rgb *= gl_FragColor.a; \n} \n",e}},Cesium3DTileBatchTable.prototype.getUniformMapCallback=function(){if(0!==this.featuresLength){var e=this;return function(t){return combine$2(t,{tile_batchTexture:function(){return defaultValue(e._batchTexture.batchTexture,e._batchTexture.defaultTexture)},tile_textureDimensions:function(){return e._batchTexture.textureDimensions},tile_textureStep:function(){return e._batchTexture.textureStep},tile_colorBlend:function(){return getColorBlend(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}}},Cesium3DTileBatchTable.prototype.getPickId=function(){return"texture2D(tile_pickTexture, tile_featureSt)"};var StyleCommandsNeeded$2={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};function getStyleCommandsNeeded(e){var t=e._batchTexture.translucentFeaturesLength;return 0===t?StyleCommandsNeeded$2.ALL_OPAQUE:t===e.featuresLength?StyleCommandsNeeded$2.ALL_TRANSLUCENT:StyleCommandsNeeded$2.OPAQUE_AND_TRANSLUCENT}function deriveCommand(e){var t=DrawCommand.shallowClone(e),i=t.pass===Pass$1.TRANSLUCENT;return t.uniformMap=defined(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return i},t}function deriveTranslucentCommand$2(e){var t=DrawCommand.shallowClone(e);return t.pass=Pass$1.TRANSLUCENT,t.renderState=getTranslucentRenderState$2(e.renderState),t}function deriveOpaqueCommand(e){var t=DrawCommand.shallowClone(e);return t.renderState=getOpaqueRenderState(e.renderState),t}function getLogDepthPolygonOffsetFragmentShaderProgram(e,t){var i=e.shaderCache.getDerivedShaderProgram(t,"zBackfaceLogDepth");if(!defined(i)){var r=t.fragmentShaderSource.clone();r.defines=defined(r.defines)?r.defines.slice(0):[],r.defines.push("POLYGON_OFFSET"),r.sources.unshift("#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n"),i=e.shaderCache.createDerivedShaderProgram(t,"zBackfaceLogDepth",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:t._attributeLocations})}return i}function deriveZBackfaceCommand(e,t){var i=DrawCommand.shallowClone(t),r=clone$1(i.renderState,!0);r.cull.enabled=!0,r.cull.face=CullFace$1.FRONT,r.colorMask={red:!1,green:!1,blue:!1,alpha:!1},r.polygonOffset={enabled:!0,factor:5,units:5},r.stencilTest=StencilConstants$1.setCesium3DTileBit(),r.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,i.renderState=RenderState.fromCache(r),i.castShadows=!1,i.receiveShadows=!1,i.uniformMap=clone$1(t.uniformMap);var n=new Cartesian2(5,5);return i.uniformMap.u_polygonOffset=function(){return n},i.shaderProgram=getLogDepthPolygonOffsetFragmentShaderProgram(e,t.shaderProgram),i}function deriveStencilCommand(e,t){var i=DrawCommand.shallowClone(e),r=clone$1(i.renderState,!0);return r.stencilTest.enabled=!0,r.stencilTest.mask=StencilConstants$1.SKIP_LOD_MASK,r.stencilTest.reference=StencilConstants$1.CESIUM_3D_TILE_MASK|t<<StencilConstants$1.SKIP_LOD_BIT_SHIFT,r.stencilTest.frontFunction=StencilFunction$1.GREATER_OR_EQUAL,r.stencilTest.frontOperation.zPass=StencilOperation$1.REPLACE,r.stencilTest.backFunction=StencilFunction$1.GREATER_OR_EQUAL,r.stencilTest.backOperation.zPass=StencilOperation$1.REPLACE,r.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK|StencilConstants$1.SKIP_LOD_MASK,i.renderState=RenderState.fromCache(r),i}function getLastSelectionDepth(e){return(e.renderState.stencilTest.reference&StencilConstants$1.SKIP_LOD_MASK)>>>StencilConstants$1.SKIP_LOD_BIT_SHIFT}function getTranslucentRenderState$2(e){var t=clone$1(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=BlendingState$1.ALPHA_BLEND,t.stencilTest=StencilConstants$1.setCesium3DTileBit(),t.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,RenderState.fromCache(t)}function getOpaqueRenderState(e){var t=clone$1(e,!0);return t.stencilTest=StencilConstants$1.setCesium3DTileBit(),t.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,RenderState.fromCache(t)}function Cesium3DTileFeature(e,t){this._content=e,this._batchId=t,this._color=void 0}function Cesium3DTileFeatureTable(e,t){this.json=e,this.buffer=t,this._cachedTypedArrays={},this.featuresLength=0}function getTypedArrayFromBinary(e,t,i,r,n,a){var o=e._cachedTypedArrays,s=o[t];return defined(s)||(s=ComponentDatatype$1.createArrayBufferView(i,e.buffer.buffer,e.buffer.byteOffset+a,n*r),o[t]=s),s}function getTypedArrayFromArray(e,t,i,r){var n=e._cachedTypedArrays,a=n[t];return defined(a)||(a=ComponentDatatype$1.createTypedArray(i,r),n[t]=a),a}function addToArray(e,t,i){if(i=defaultValue(i,!1)){const i=e.indexOf(t);if(i>-1)return i}return e.push(t),e.length-1}function usesExtension(e,t){return defined(e.extensionsUsed)&&e.extensionsUsed.indexOf(t)>=0}function ForEach(){}function numberOfComponentsForType(e){switch(e){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}}function getAccessorByteStride(e,t){const i=t.bufferView;if(defined(i)){const t=e.bufferViews[i];if(defined(t.byteStride)&&t.byteStride>0)return t.byteStride}return ComponentDatatype$1.getSizeInBytes(t.componentType)*numberOfComponentsForType(t.type)}function addDefaults(e){ForEach.accessor(e,(function(e){defined(e.bufferView)&&(e.byteOffset=defaultValue(e.byteOffset,0))})),ForEach.bufferView(e,(function(e){defined(e.buffer)&&(e.byteOffset=defaultValue(e.byteOffset,0))})),ForEach.mesh(e,(function(t){ForEach.meshPrimitive(t,(function(t){if(t.mode=defaultValue(t.mode,WebGLConstants$1.TRIANGLES),!defined(t.material)){defined(e.materials)||(e.materials=[]);const i={name:"default"};t.material=addToArray(e.materials,i)}}))})),ForEach.accessorContainingVertexAttributeData(e,(function(t){const i=e.accessors[t],r=i.bufferView;if(i.normalized=defaultValue(i.normalized,!1),defined(r)){const t=e.bufferViews[r];t.byteStride=getAccessorByteStride(e,i),t.target=WebGLConstants$1.ARRAY_BUFFER}})),ForEach.accessorContainingIndexData(e,(function(t){const i=e.accessors[t].bufferView;if(defined(i)){e.bufferViews[i].target=WebGLConstants$1.ELEMENT_ARRAY_BUFFER}})),ForEach.material(e,(function(e){const t=defaultValue(e.extensions,defaultValue.EMPTY_OBJECT),i=t.KHR_materials_common;if(defined(i)){const e=i.technique,t=defined(i.values)?i.values:{};return i.values=t,t.ambient=defined(t.ambient)?t.ambient:[0,0,0,1],t.emission=defined(t.emission)?t.emission:[0,0,0,1],t.transparency=defaultValue(t.transparency,1),t.transparent=defaultValue(t.transparent,!1),t.doubleSided=defaultValue(t.doubleSided,!1),void("CONSTANT"!==e&&(t.diffuse=defined(t.diffuse)?t.diffuse:[0,0,0,1],"LAMBERT"!==e&&(t.specular=defined(t.specular)?t.specular:[0,0,0,1],t.shininess=defaultValue(t.shininess,0))))}e.emissiveFactor=defaultValue(e.emissiveFactor,[0,0,0]),e.alphaMode=defaultValue(e.alphaMode,"OPAQUE"),e.doubleSided=defaultValue(e.doubleSided,!1),"MASK"===e.alphaMode&&(e.alphaCutoff=defaultValue(e.alphaCutoff,.5));defined(t.KHR_techniques_webgl)&&ForEach.materialValue(e,(function(e){defined(e.index)&&addTextureDefaults(e)})),addTextureDefaults(e.emissiveTexture),addTextureDefaults(e.normalTexture),addTextureDefaults(e.occlusionTexture);const r=e.pbrMetallicRoughness;defined(r)&&(r.baseColorFactor=defaultValue(r.baseColorFactor,[1,1,1,1]),r.metallicFactor=defaultValue(r.metallicFactor,1),r.roughnessFactor=defaultValue(r.roughnessFactor,1),addTextureDefaults(r.baseColorTexture),addTextureDefaults(r.metallicRoughnessTexture));const n=t.KHR_materials_pbrSpecularGlossiness;defined(n)&&(n.diffuseFactor=defaultValue(n.diffuseFactor,[1,1,1,1]),n.specularFactor=defaultValue(n.specularFactor,[1,1,1]),n.glossinessFactor=defaultValue(n.glossinessFactor,1),addTextureDefaults(n.specularGlossinessTexture))})),ForEach.animation(e,(function(e){ForEach.animationSampler(e,(function(e){e.interpolation=defaultValue(e.interpolation,"LINEAR")}))}));const t=getAnimatedNodes(e);return ForEach.node(e,(function(e,i){defined(t[i])||defined(e.translation)||defined(e.rotation)||defined(e.scale)?(e.translation=defaultValue(e.translation,[0,0,0]),e.rotation=defaultValue(e.rotation,[0,0,0,1]),e.scale=defaultValue(e.scale,[1,1,1])):e.matrix=defaultValue(e.matrix,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])})),ForEach.sampler(e,(function(e){e.wrapS=defaultValue(e.wrapS,WebGLConstants$1.REPEAT),e.wrapT=defaultValue(e.wrapT,WebGLConstants$1.REPEAT)})),defined(e.scenes)&&!defined(e.scene)&&(e.scene=0),e}function getAnimatedNodes(e){const t={};return ForEach.animation(e,(function(e){ForEach.animationChannel(e,(function(e){const i=e.target,r=i.node,n=i.path;"translation"!==n&&"rotation"!==n&&"scale"!==n||(t[r]=!0)}))})),t}function addTextureDefaults(e){defined(e)&&(e.texCoord=defaultValue(e.texCoord,0))}function addPipelineExtras(e){return ForEach.shader(e,(function(e){addExtras(e)})),ForEach.buffer(e,(function(e){addExtras(e)})),ForEach.image(e,(function(e){addExtras(e)})),addExtras(e),e}function addExtras(e){e.extras=defined(e.extras)?e.extras:{},e.extras._pipeline=defined(e.extras._pipeline)?e.extras._pipeline:{}}function removeExtensionsRequired(e,t){const i=e.extensionsRequired;if(defined(i)){const r=i.indexOf(t);r>=0&&i.splice(r,1),0===i.length&&delete e.extensionsRequired}}function removeExtensionsUsed(e,t){const i=e.extensionsUsed;if(defined(i)){const r=i.indexOf(t);r>=0&&i.splice(r,1),removeExtensionsRequired(e,t),0===i.length&&delete e.extensionsUsed}}Cesium3DTileBatchTable.prototype.addDerivedCommands=function(e,t){for(var i=e.commandList,r=i.length,n=this._content._tile,a=n._finalResolution,o=n.tileset,s=o._skipLevelOfDetail&&o._hasMixedContent&&e.context.stencilBuffer,l=getStyleCommandsNeeded(this),c=t;c<r;++c){var u=i[c],d=u.derivedCommands.tileset;defined(d)&&!u.dirty||(d={},u.derivedCommands.tileset=d,d.originalCommand=deriveCommand(u),u.dirty=!1);var h=d.originalCommand;l!==StyleCommandsNeeded$2.ALL_OPAQUE&&u.pass!==Pass$1.TRANSLUCENT&&(defined(d.translucent)||(d.translucent=deriveTranslucentCommand$2(h))),l!==StyleCommandsNeeded$2.ALL_TRANSLUCENT&&u.pass!==Pass$1.TRANSLUCENT&&(defined(d.opaque)||(d.opaque=deriveOpaqueCommand(h)),s&&(a||(defined(d.zback)||(d.zback=deriveZBackfaceCommand(e.context,h)),o._backfaceCommands.push(d.zback)),defined(d.stencil)&&n._selectionDepth===getLastSelectionDepth(d.stencil)||(u.renderState.depthMask?d.stencil=deriveStencilCommand(h,n._selectionDepth):d.stencil=d.opaque)));var p=s?d.stencil:d.opaque,f=d.translucent;u.pass!==Pass$1.TRANSLUCENT?(l===StyleCommandsNeeded$2.ALL_OPAQUE&&(i[c]=p),l===StyleCommandsNeeded$2.ALL_TRANSLUCENT&&(i[c]=f),l===StyleCommandsNeeded$2.OPAQUE_AND_TRANSLUCENT&&(i[c]=p,i.push(f))):i[c]=h}},Cesium3DTileBatchTable.prototype.update=function(e,t){this._batchTexture.update(e,t)},Cesium3DTileBatchTable.prototype.isDestroyed=function(){return!1},Cesium3DTileBatchTable.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),destroyObject(this)},Object.defineProperties(Cesium3DTileFeature.prototype,{show:{get:function(){return this._content.batchTable.getShow(this._batchId)},set:function(e){this._content.batchTable.setShow(this._batchId,e)}},color:{get:function(){return defined(this._color)||(this._color=new Color),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},polylinePositions:{get:function(){if(defined(this._content.getPolylinePositions))return this._content.getPolylinePositions(this._batchId)}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},pickId:{get:function(){return this._content.batchTable.getPickColor(this._batchId)}}}),Cesium3DTileFeature.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)},Cesium3DTileFeature.prototype.getPropertyNames=function(e){return this._content.batchTable.getPropertyNames(this._batchId,e)},Cesium3DTileFeature.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)},Cesium3DTileFeature.getPropertyInherited=function(e,t,i){var r,n=e.batchTable;if(defined(n)){if(defined(r=n.getPropertyBySemantic(t,i)))return r;if(defined(r=n.getProperty(t,i)))return r}var a=e.tile.metadata;if(defined(a)){if(defined(r=a.getPropertyBySemantic(i)))return r;if(defined(r=a.getProperty(i)))return r}var o=e.groupMetadata;if(defined(o)){if(defined(r=o.getPropertyBySemantic(i)))return r;if(defined(r=o.getProperty(i)))return r}var s=e.tileset.metadata;if(defined(s)&&defined(s.tileset)){if(defined(r=(s=s.tileset).getPropertyBySemantic(i)))return r;if(defined(r=s.getProperty(i)))return r}},Cesium3DTileFeature.prototype.getPropertyInherited=function(e){return Cesium3DTileFeature.getPropertyInherited(this._content,this._batchId,e)},Cesium3DTileFeature.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0},Cesium3DTileFeature.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)},Cesium3DTileFeature.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)},Cesium3DTileFeature.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)},Cesium3DTileFeatureTable.prototype.getGlobalProperty=function(e,t,i){var r=this.json[e];if(defined(r))return defined(r.byteOffset)?getTypedArrayFromBinary(this,e,t=defaultValue(t,ComponentDatatype$1.UNSIGNED_INT),i=defaultValue(i,1),1,r.byteOffset):r},Cesium3DTileFeatureTable.prototype.getPropertyArray=function(e,t,i){var r=this.json[e];if(defined(r))return defined(r.byteOffset)?(defined(r.componentType)&&(t=ComponentDatatype$1.fromName(r.componentType)),getTypedArrayFromBinary(this,e,t,i,this.featuresLength,r.byteOffset)):getTypedArrayFromArray(this,e,t,r)},Cesium3DTileFeatureTable.prototype.getProperty=function(e,t,i,r,n){if(defined(this.json[e])){var a=this.getPropertyArray(e,t,i);if(1===i)return a[r];for(var o=0;o<i;++o)n[o]=a[i*r+o];return n}},ForEach.objectLegacy=function(e,t){if(defined(e))for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const r=t(e[i],i);if(defined(r))return r}},ForEach.object=function(e,t){if(defined(e)){const i=e.length;for(let r=0;r<i;r++){const i=t(e[r],r);if(defined(i))return i}}},ForEach.topLevel=function(e,t,i){const r=e[t];return defined(r)&&!Array.isArray(r)?ForEach.objectLegacy(r,i):ForEach.object(r,i)},ForEach.accessor=function(e,t){return ForEach.topLevel(e,"accessors",t)},ForEach.accessorWithSemantic=function(e,t,i){const r={};return ForEach.mesh(e,(function(e){return ForEach.meshPrimitive(e,(function(e){const n=ForEach.meshPrimitiveAttribute(e,(function(e,n){if(0===n.indexOf(t)&&!defined(r[e])){r[e]=!0;const t=i(e);if(defined(t))return t}}));return defined(n)?n:ForEach.meshPrimitiveTarget(e,(function(e){return ForEach.meshPrimitiveTargetAttribute(e,(function(e,n){if(0===n.indexOf(t)&&!defined(r[e])){r[e]=!0;const t=i(e);if(defined(t))return t}}))}))}))}))},ForEach.accessorContainingVertexAttributeData=function(e,t){const i={};return ForEach.mesh(e,(function(e){return ForEach.meshPrimitive(e,(function(e){const r=ForEach.meshPrimitiveAttribute(e,(function(e){if(!defined(i[e])){i[e]=!0;const r=t(e);if(defined(r))return r}}));return defined(r)?r:ForEach.meshPrimitiveTarget(e,(function(e){return ForEach.meshPrimitiveTargetAttribute(e,(function(e){if(!defined(i[e])){i[e]=!0;const r=t(e);if(defined(r))return r}}))}))}))}))},ForEach.accessorContainingIndexData=function(e,t){const i={};return ForEach.mesh(e,(function(e){return ForEach.meshPrimitive(e,(function(e){const r=e.indices;if(defined(r)&&!defined(i[r])){i[r]=!0;const e=t(r);if(defined(e))return e}}))}))},ForEach.animation=function(e,t){return ForEach.topLevel(e,"animations",t)},ForEach.animationChannel=function(e,t){const i=e.channels;return ForEach.object(i,t)},ForEach.animationSampler=function(e,t){const i=e.samplers;return ForEach.object(i,t)},ForEach.buffer=function(e,t){return ForEach.topLevel(e,"buffers",t)},ForEach.bufferView=function(e,t){return ForEach.topLevel(e,"bufferViews",t)},ForEach.camera=function(e,t){return ForEach.topLevel(e,"cameras",t)},ForEach.image=function(e,t){return ForEach.topLevel(e,"images",t)},ForEach.material=function(e,t){return ForEach.topLevel(e,"materials",t)},ForEach.materialValue=function(e,t){let i=e.values;defined(e.extensions)&&defined(e.extensions.KHR_techniques_webgl)&&(i=e.extensions.KHR_techniques_webgl.values);for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const r=t(i[e],e);if(defined(r))return r}},ForEach.mesh=function(e,t){return ForEach.topLevel(e,"meshes",t)},ForEach.meshPrimitive=function(e,t){const i=e.primitives;if(defined(i)){const e=i.length;for(let r=0;r<e;r++){const e=t(i[r],r);if(defined(e))return e}}},ForEach.meshPrimitiveAttribute=function(e,t){const i=e.attributes;for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const r=t(i[e],e);if(defined(r))return r}},ForEach.meshPrimitiveTarget=function(e,t){const i=e.targets;if(defined(i)){const e=i.length;for(let r=0;r<e;++r){const e=t(i[r],r);if(defined(e))return e}}},ForEach.meshPrimitiveTargetAttribute=function(e,t){for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const r=t(e[i],i);if(defined(r))return r}},ForEach.node=function(e,t){return ForEach.topLevel(e,"nodes",t)},ForEach.nodeInTree=function(e,t,i){const r=e.nodes;if(defined(r)){const n=t.length;for(let a=0;a<n;a++){const n=t[a],o=r[n];if(defined(o)){let t=i(o,n);if(defined(t))return t;const r=o.children;if(defined(r)&&(t=ForEach.nodeInTree(e,r,i),defined(t)))return t}}}},ForEach.nodeInScene=function(e,t,i){const r=t.nodes;if(defined(r))return ForEach.nodeInTree(e,r,i)},ForEach.program=function(e,t){return usesExtension(e,"KHR_techniques_webgl")?ForEach.object(e.extensions.KHR_techniques_webgl.programs,t):ForEach.topLevel(e,"programs",t)},ForEach.sampler=function(e,t){return ForEach.topLevel(e,"samplers",t)},ForEach.scene=function(e,t){return ForEach.topLevel(e,"scenes",t)},ForEach.shader=function(e,t){return usesExtension(e,"KHR_techniques_webgl")?ForEach.object(e.extensions.KHR_techniques_webgl.shaders,t):ForEach.topLevel(e,"shaders",t)},ForEach.skin=function(e,t){return ForEach.topLevel(e,"skins",t)},ForEach.skinJoint=function(e,t){const i=e.joints;if(defined(i)){const e=i.length;for(let r=0;r<e;r++){const e=t(i[r]);if(defined(e))return e}}},ForEach.techniqueAttribute=function(e,t){const i=e.attributes;for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const r=t(i[e],e);if(defined(r))return r}},ForEach.techniqueUniform=function(e,t){const i=e.uniforms;for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const r=t(i[e],e);if(defined(r))return r}},ForEach.techniqueParameter=function(e,t){const i=e.parameters;for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const r=t(i[e],e);if(defined(r))return r}},ForEach.technique=function(e,t){return usesExtension(e,"KHR_techniques_webgl")?ForEach.object(e.extensions.KHR_techniques_webgl.techniques,t):ForEach.topLevel(e,"techniques",t)},ForEach.texture=function(e,t){return ForEach.topLevel(e,"textures",t)};const sizeOfUint32$5=4;function parseGlb(e){if("glTF"!==getMagic(e))throw new RuntimeError("File is not valid binary glTF");const t=readHeader(e,0,5),i=t[1];if(1!==i&&2!==i)throw new RuntimeError("Binary glTF version is not 1 or 2");return 1===i?parseGlbVersion1(e,t):parseGlbVersion2(e,t)}function readHeader(e,t,i){const r=new DataView(e.buffer),n=new Array(i);for(let a=0;a<i;++a)n[a]=r.getUint32(e.byteOffset+t+a*sizeOfUint32$5,!0);return n}function parseGlbVersion1(e,t){const i=t[2],r=t[3];if(0!==t[4])throw new RuntimeError("Binary glTF scene format is not JSON");const n=20+r,a=getStringFromTypedArray(e,20,r),o=JSON.parse(a);addPipelineExtras(o);const s=e.subarray(n,i),l=o.buffers;if(defined(l)&&Object.keys(l).length>0){const e=defaultValue(l.binary_glTF,l.KHR_binary_glTF);defined(e)&&(e.extras._pipeline.source=s,delete e.uri)}return removeExtensionsUsed(o,"KHR_binary_glTF"),o}function parseGlbVersion2(e,t){const i=t[2];let r,n,a=12;for(;a<i;){const t=readHeader(e,a,2),i=t[0],o=t[1];a+=8;const s=e.subarray(a,a+i);if(a+=i,1313821514===o){const e=getStringFromTypedArray(s);r=JSON.parse(e),addPipelineExtras(r)}else 5130562===o&&(n=s)}if(defined(r)&&defined(n)){const e=r.buffers;if(defined(e)&&e.length>0){e[0].extras._pipeline.source=n}}return r}function addExtensionsUsed(e,t){let i=e.extensionsUsed;defined(i)||(i=[],e.extensionsUsed=i),addToArray(i,t,!0)}function getComponentReader(e){switch(e){case ComponentDatatype$1.BYTE:return function(e,t,i,r,n){for(let a=0;a<i;++a)n[a]=e.getInt8(t+a*r)};case ComponentDatatype$1.UNSIGNED_BYTE:return function(e,t,i,r,n){for(let a=0;a<i;++a)n[a]=e.getUint8(t+a*r)};case ComponentDatatype$1.SHORT:return function(e,t,i,r,n){for(let a=0;a<i;++a)n[a]=e.getInt16(t+a*r,!0)};case ComponentDatatype$1.UNSIGNED_SHORT:return function(e,t,i,r,n){for(let a=0;a<i;++a)n[a]=e.getUint16(t+a*r,!0)};case ComponentDatatype$1.INT:return function(e,t,i,r,n){for(let a=0;a<i;++a)n[a]=e.getInt32(t+a*r,!0)};case ComponentDatatype$1.UNSIGNED_INT:return function(e,t,i,r,n){for(let a=0;a<i;++a)n[a]=e.getUint32(t+a*r,!0)};case ComponentDatatype$1.FLOAT:return function(e,t,i,r,n){for(let a=0;a<i;++a)n[a]=e.getFloat32(t+a*r,!0)};case ComponentDatatype$1.DOUBLE:return function(e,t,i,r,n){for(let a=0;a<i;++a)n[a]=e.getFloat64(t+a*r,!0)}}}function findAccessorMinMax(e,t){const i=e.bufferViews,r=e.buffers,n=t.bufferView,a=numberOfComponentsForType(t.type);if(!defined(t.bufferView))return{min:arrayFill(new Array(a),0),max:arrayFill(new Array(a),0)};const o=arrayFill(new Array(a),Number.POSITIVE_INFINITY),s=arrayFill(new Array(a),Number.NEGATIVE_INFINITY),l=i[n],c=r[l.buffer].extras._pipeline.source,u=t.count,d=getAccessorByteStride(e,t);let h=t.byteOffset+l.byteOffset+c.byteOffset;const p=t.componentType,f=ComponentDatatype$1.getSizeInBytes(p),m=new DataView(c.buffer),g=new Array(a),_=getComponentReader(p);for(let e=0;e<u;e++){_(m,h,a,f,g);for(let e=0;e<a;e++){const t=g[e];o[e]=Math.min(o[e],t),s[e]=Math.max(s[e],t)}h+=d}return{min:o,max:s}}const defaultBlendEquation=[WebGLConstants$1.FUNC_ADD,WebGLConstants$1.FUNC_ADD],defaultBlendFactors=[WebGLConstants$1.ONE,WebGLConstants$1.ZERO,WebGLConstants$1.ONE,WebGLConstants$1.ZERO];function isStateEnabled(e,t){const i=e.enable;return!!defined(i)&&i.indexOf(t)>-1}const supportedBlendFactors=[WebGLConstants$1.ZERO,WebGLConstants$1.ONE,WebGLConstants$1.SRC_COLOR,WebGLConstants$1.ONE_MINUS_SRC_COLOR,WebGLConstants$1.SRC_ALPHA,WebGLConstants$1.ONE_MINUS_SRC_ALPHA,WebGLConstants$1.DST_ALPHA,WebGLConstants$1.ONE_MINUS_DST_ALPHA,WebGLConstants$1.DST_COLOR,WebGLConstants$1.ONE_MINUS_DST_COLOR];function getSupportedBlendFactors(e,t){if(!defined(e))return t;for(let i=0;i<4;i++)if(-1===supportedBlendFactors.indexOf(e[i]))return t;return e}function moveTechniqueRenderStates(e){const t={},i={};return defined(e.techniques)?(ForEach.technique(e,(function(e,r){const n=e.states;if(defined(n)){const a=i[r]={};if(isStateEnabled(n,WebGLConstants$1.BLEND)){a.alphaMode="BLEND";const e=n.functions;defined(e)&&(defined(e.blendEquationSeparate)||defined(e.blendFuncSeparate))&&(t[r]={blendEquation:defaultValue(e.blendEquationSeparate,defaultBlendEquation),blendFactors:getSupportedBlendFactors(e.blendFuncSeparate,defaultBlendFactors)})}isStateEnabled(n,WebGLConstants$1.CULL_FACE)||(a.doubleSided=!0),delete e.states}})),Object.keys(t).length>0&&(defined(e.extensions)||(e.extensions={}),addExtensionsUsed(e,"KHR_blend")),ForEach.material(e,(function(e){if(defined(e.technique)){const r=i[e.technique];ForEach.objectLegacy(r,(function(t,i){e[i]=t}));const n=t[e.technique];defined(n)&&(defined(e.extensions)||(e.extensions={}),e.extensions.KHR_blend=n)}})),e):e}function addExtensionsRequired(e,t){let i=e.extensionsRequired;defined(i)||(i=[],e.extensionsRequired=i),addToArray(i,t,!0),addExtensionsUsed(e,t)}function moveTechniquesToExtension(e){const t=e.techniques,i={},r={},n={};if(defined(t)){const t={programs:[],shaders:[],techniques:[]},a=e.glExtensionsUsed;delete e.glExtensionsUsed,ForEach.technique(e,(function(o,s){const l={name:o.name,program:void 0,attributes:{},uniforms:{}};let c;if(ForEach.techniqueAttribute(o,(function(e,t){c=o.parameters[e],l.attributes[t]={semantic:c.semantic}})),ForEach.techniqueUniform(o,(function(e,t){c=o.parameters[e],l.uniforms[t]={count:c.count,node:c.node,type:c.type,semantic:c.semantic,value:c.value},defined(i[s])||(i[s]={}),i[s][e]=t})),defined(n[o.program]))l.program=n[o.program];else{const i=e.programs[o.program],r={name:i.name,fragmentShader:void 0,vertexShader:void 0,glExtensions:a},s=e.shaders[i.fragmentShader];r.fragmentShader=addToArray(t.shaders,s,!0);const c=e.shaders[i.vertexShader];r.vertexShader=addToArray(t.shaders,c,!0),l.program=addToArray(t.programs,r),n[o.program]=l.program}r[s]=addToArray(t.techniques,l)})),t.techniques.length>0&&(defined(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=t,addExtensionsUsed(e,"KHR_techniques_webgl"),addExtensionsRequired(e,"KHR_techniques_webgl"))}return ForEach.material(e,(function(e){if(defined(e.technique)){const t={technique:r[e.technique]};ForEach.objectLegacy(e.values,(function(r,n){defined(t.values)||(t.values={});const a=i[e.technique][n];t.values[a]=r})),defined(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=t}delete e.technique,delete e.values})),delete e.techniques,delete e.programs,delete e.shaders,e}function forEachTextureInMaterial(e,t){Check.typeOf.object("material",e),Check.defined("handler",t);const i=e.pbrMetallicRoughness;if(defined(i)){if(defined(i.baseColorTexture)){const e=i.baseColorTexture,r=t(e.index,e);if(defined(r))return r}if(defined(i.metallicRoughnessTexture)){const e=i.metallicRoughnessTexture,r=t(e.index,e);if(defined(r))return r}}if(defined(e.extensions)){const i=e.extensions.KHR_materials_pbrSpecularGlossiness;if(defined(i)){if(defined(i.diffuseTexture)){const e=i.diffuseTexture,r=t(e.index,e);if(defined(r))return r}if(defined(i.specularGlossinessTexture)){const e=i.specularGlossinessTexture,r=t(e.index,e);if(defined(r))return r}}const r=e.extensions.KHR_materials_common;if(defined(r)){const e=r.values.diffuse,i=r.values.ambient,n=r.values.emission,a=r.values.specular;if(defined(e)&&defined(e.index)){const i=t(e.index,e);if(defined(i))return i}if(defined(i)&&defined(i.index)){const e=t(i.index,i);if(defined(e))return e}if(defined(n)&&defined(n.index)){const e=t(n.index,n);if(defined(e))return e}if(defined(a)&&defined(a.index)){const e=t(a.index,a);if(defined(e))return e}}}const r=ForEach.materialValue(e,(function(e){if(defined(e.index)){const i=t(e.index,e);if(defined(i))return i}}));if(defined(r))return r;if(defined(e.emissiveTexture)){const i=e.emissiveTexture,r=t(i.index,i);if(defined(r))return r}if(defined(e.normalTexture)){const i=e.normalTexture,r=t(i.index,i);if(defined(r))return r}if(defined(e.occlusionTexture)){const i=e.occlusionTexture,r=t(i.index,i);if(defined(r))return r}}const allElementTypes=["mesh","node","material","accessor","bufferView","buffer","texture","sampler","image"];function removeUnusedElements(e,t){return t=defaultValue(t,allElementTypes),allElementTypes.forEach((function(i){t.indexOf(i)>-1&&removeUnusedElementsByType(e,i)})),e}const TypeToGltfElementName={accessor:"accessors",buffer:"buffers",bufferView:"bufferViews",image:"images",node:"nodes",material:"materials",mesh:"meshes",sampler:"samplers",texture:"textures"};function removeUnusedElementsByType(e,t){const i=e[TypeToGltfElementName[t]];if(defined(i)){let r=0;const n=getListOfElementsIdsInUse[t](e),a=i.length;for(let i=0;i<a;++i)n[i]||(Remove[t](e,i-r),r++)}}function Remove(){}function getListOfElementsIdsInUse(){}function nodeIsEmpty(e,t,i){const r=e.nodes[t];return!(defined(r.mesh)||defined(r.camera)||defined(r.skin)||defined(r.weights)||defined(r.extras)||defined(r.extensions)&&0!==Object.keys(r.extensions).length||defined(i[t]))&&(!defined(r.children)||0===r.children.filter((function(t){return!nodeIsEmpty(e,t,i)})).length)}function addBuffer(e,t){const i={byteLength:t.length,extras:{_pipeline:{source:t}}},r={buffer:addToArray(e.buffers,i),byteOffset:0,byteLength:t.length};return addToArray(e.bufferViews,r)}function readAccessorPacked(e,t){const i=getAccessorByteStride(e,t),r=ComponentDatatype$1.getSizeInBytes(t.componentType),n=numberOfComponentsForType(t.type),a=t.count,o=new Array(n*a);if(!defined(t.bufferView))return arrayFill(o,0),o;const s=e.bufferViews[t.bufferView],l=e.buffers[s.buffer].extras._pipeline.source;let c=t.byteOffset+s.byteOffset+l.byteOffset;const u=new DataView(l.buffer),d=new Array(n),h=getComponentReader(t.componentType);for(let e=0;e<a;++e){h(u,c,n,r,d);for(let t=0;t<n;++t)o[e*n+t]=d[t];c+=i}return o}function updateAccessorComponentTypes(e){let t;return ForEach.accessorWithSemantic(e,"JOINTS_0",(function(i){const r=e.accessors[i];t=r.componentType,t===WebGLConstants$1.BYTE?convertType(e,r,ComponentDatatype$1.UNSIGNED_BYTE):t!==WebGLConstants$1.UNSIGNED_BYTE&&t!==WebGLConstants$1.UNSIGNED_SHORT&&convertType(e,r,ComponentDatatype$1.UNSIGNED_SHORT)})),ForEach.accessorWithSemantic(e,"WEIGHTS_0",(function(i){const r=e.accessors[i];t=r.componentType,t===WebGLConstants$1.BYTE?convertType(e,r,ComponentDatatype$1.UNSIGNED_BYTE):t===WebGLConstants$1.SHORT&&convertType(e,r,ComponentDatatype$1.UNSIGNED_SHORT)})),e}function convertType(e,t,i){const r=ComponentDatatype$1.createTypedArray(i,readAccessorPacked(e,t)),n=new Uint8Array(r.buffer);t.bufferView=addBuffer(e,n),t.componentType=i,t.byteOffset=0}Remove.accessor=function(e,t){e.accessors.splice(t,1),ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){ForEach.meshPrimitiveAttribute(e,(function(i,r){i>t&&e.attributes[r]--})),ForEach.meshPrimitiveTarget(e,(function(e){ForEach.meshPrimitiveTargetAttribute(e,(function(i,r){i>t&&e[r]--}))}));const i=e.indices;defined(i)&&i>t&&e.indices--}))})),ForEach.skin(e,(function(e){defined(e.inverseBindMatrices)&&e.inverseBindMatrices>t&&e.inverseBindMatrices--})),ForEach.animation(e,(function(e){ForEach.animationSampler(e,(function(e){defined(e.input)&&e.input>t&&e.input--,defined(e.output)&&e.output>t&&e.output--}))}))},Remove.buffer=function(e,t){e.buffers.splice(t,1),ForEach.bufferView(e,(function(e){defined(e.buffer)&&e.buffer>t&&e.buffer--,defined(e.extensions)&&defined(e.extensions.EXT_meshopt_compression)&&e.extensions.EXT_meshopt_compression.buffer--}))},Remove.bufferView=function(e,t){if(e.bufferViews.splice(t,1),ForEach.accessor(e,(function(e){defined(e.bufferView)&&e.bufferView>t&&e.bufferView--})),ForEach.shader(e,(function(e){defined(e.bufferView)&&e.bufferView>t&&e.bufferView--})),ForEach.image(e,(function(e){defined(e.bufferView)&&e.bufferView>t&&e.bufferView--})),usesExtension(e,"KHR_draco_mesh_compression")&&ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.extensions)&&defined(e.extensions.KHR_draco_mesh_compression)&&e.extensions.KHR_draco_mesh_compression.bufferView>t&&e.extensions.KHR_draco_mesh_compression.bufferView--}))})),usesExtension(e,"EXT_feature_metadata")){const i=e.extensions.EXT_feature_metadata.featureTables;for(const e in i)if(i.hasOwnProperty(e)){const r=i[e].properties;if(defined(r))for(const e in r)if(r.hasOwnProperty(e)){const i=r[e];defined(i.bufferView)&&i.bufferView>t&&i.bufferView--,defined(i.arrayOffsetBufferView)&&i.arrayOffsetBufferView>t&&i.arrayOffsetBufferView--,defined(i.stringOffsetBufferView)&&i.stringOffsetBufferView>t&&i.stringOffsetBufferView--}}}},Remove.image=function(e,t){e.images.splice(t,1),ForEach.texture(e,(function(e){defined(e.source)&&e.source>t&&--e.source;const i=e.extensions;defined(i)&&defined(i.EXT_texture_webp)&&i.EXT_texture_webp.source>t?--e.extensions.EXT_texture_webp.source:defined(i)&&defined(i.KHR_texture_basisu)&&i.KHR_texture_basisu.source>t&&--e.extensions.KHR_texture_basisu.source}))},Remove.mesh=function(e,t){e.meshes.splice(t,1),ForEach.node(e,(function(e){defined(e.mesh)&&(e.mesh>t?e.mesh--:e.mesh===t&&delete e.mesh)}))},Remove.node=function(e,t){e.nodes.splice(t,1),ForEach.skin(e,(function(e){defined(e.skeleton)&&e.skeleton>t&&e.skeleton--,e.joints=e.joints.map((function(e){return e>t?e-1:e}))})),ForEach.animation(e,(function(e){ForEach.animationChannel(e,(function(e){defined(e.target)&&defined(e.target.node)&&e.target.node>t&&e.target.node--}))})),ForEach.technique(e,(function(e){ForEach.techniqueUniform(e,(function(e){defined(e.node)&&e.node>t&&e.node--}))})),ForEach.node(e,(function(e){defined(e.children)&&(e.children=e.children.filter((function(e){return e!==t})).map((function(e){return e>t?e-1:e})))})),ForEach.scene(e,(function(e){e.nodes=e.nodes.filter((function(e){return e!==t})).map((function(e){return e>t?e-1:e}))}))},Remove.material=function(e,t){e.materials.splice(t,1),ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.material)&&e.material>t&&e.material--}))}))},Remove.sampler=function(e,t){e.samplers.splice(t,1),ForEach.texture(e,(function(e){defined(e.sampler)&&e.sampler>t&&--e.sampler}))},Remove.texture=function(e,t){if(e.textures.splice(t,1),ForEach.material(e,(function(e){forEachTextureInMaterial(e,(function(e,i){i.index>t&&--i.index}))})),usesExtension(e,"EXT_feature_metadata")){ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){const i=e.extensions;if(defined(i)&&defined(i.EXT_feature_metadata)){const e=i.EXT_feature_metadata.featureIdTextures;if(defined(e)){const i=e.length;for(let r=0;r<i;++r){const i=e[r].featureIds.texture;i.index>t&&--i.index}}}}))}));const i=e.extensions.EXT_feature_metadata.featureTextures;for(const e in i)if(i.hasOwnProperty(e)){const r=i[e].properties;if(defined(r))for(const e in r)if(r.hasOwnProperty(e)){const i=r[e].texture;i.index>t&&--i.index}}}},getListOfElementsIdsInUse.accessor=function(e){const t={};return ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){ForEach.meshPrimitiveAttribute(e,(function(e){t[e]=!0})),ForEach.meshPrimitiveTarget(e,(function(e){ForEach.meshPrimitiveTargetAttribute(e,(function(e){t[e]=!0}))}));const i=e.indices;defined(i)&&(t[i]=!0)}))})),ForEach.skin(e,(function(e){defined(e.inverseBindMatrices)&&(t[e.inverseBindMatrices]=!0)})),ForEach.animation(e,(function(e){ForEach.animationSampler(e,(function(e){defined(e.input)&&(t[e.input]=!0),defined(e.output)&&(t[e.output]=!0)}))})),usesExtension(e,"EXT_mesh_gpu_instancing")&&ForEach.node(e,(function(e){defined(e.extensions)&&defined(e.extensions.EXT_mesh_gpu_instancing)&&Object.keys(e.extensions.EXT_mesh_gpu_instancing.attributes).forEach((function(i){const r=e.extensions.EXT_mesh_gpu_instancing.attributes[i];t[r]=!0}))})),t},getListOfElementsIdsInUse.buffer=function(e){const t={};return ForEach.bufferView(e,(function(e){defined(e.buffer)&&(t[e.buffer]=!0),defined(e.extensions)&&defined(e.extensions.EXT_meshopt_compression)&&(t[e.extensions.EXT_meshopt_compression.buffer]=!0)})),t},getListOfElementsIdsInUse.bufferView=function(e){const t={};if(ForEach.accessor(e,(function(e){defined(e.bufferView)&&(t[e.bufferView]=!0)})),ForEach.shader(e,(function(e){defined(e.bufferView)&&(t[e.bufferView]=!0)})),ForEach.image(e,(function(e){defined(e.bufferView)&&(t[e.bufferView]=!0)})),usesExtension(e,"KHR_draco_mesh_compression")&&ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.extensions)&&defined(e.extensions.KHR_draco_mesh_compression)&&(t[e.extensions.KHR_draco_mesh_compression.bufferView]=!0)}))})),usesExtension(e,"EXT_feature_metadata")){const i=e.extensions.EXT_feature_metadata.featureTables;for(const e in i)if(i.hasOwnProperty(e)){const r=i[e].properties;if(defined(r))for(const e in r)if(r.hasOwnProperty(e)){const i=r[e];defined(i.bufferView)&&(t[i.bufferView]=!0),defined(i.arrayOffsetBufferView)&&(t[i.arrayOffsetBufferView]=!0),defined(i.stringOffsetBufferView)&&(t[i.stringOffsetBufferView]=!0)}}}return t},getListOfElementsIdsInUse.image=function(e){const t={};return ForEach.texture(e,(function(e){defined(e.source)&&(t[e.source]=!0),defined(e.extensions)&&defined(e.extensions.EXT_texture_webp)?t[e.extensions.EXT_texture_webp.source]=!0:defined(e.extensions)&&defined(e.extensions.KHR_texture_basisu)&&(t[e.extensions.KHR_texture_basisu.source]=!0)})),t},getListOfElementsIdsInUse.mesh=function(e){const t={};return ForEach.node(e,(function(i){if(defined(i.mesh&&defined(e.meshes))){const r=e.meshes[i.mesh];defined(r)&&defined(r.primitives)&&r.primitives.length>0&&(t[i.mesh]=!0)}})),t},getListOfElementsIdsInUse.node=function(e){const t={};return ForEach.skin(e,(function(e){defined(e.skeleton)&&(t[e.skeleton]=!0),ForEach.skinJoint(e,(function(e){t[e]=!0}))})),ForEach.animation(e,(function(e){ForEach.animationChannel(e,(function(e){defined(e.target)&&defined(e.target.node)&&(t[e.target.node]=!0)}))})),ForEach.technique(e,(function(e){ForEach.techniqueUniform(e,(function(e){defined(e.node)&&(t[e.node]=!0)}))})),ForEach.node(e,(function(i,r){nodeIsEmpty(e,r,t)||(t[r]=!0)})),t},getListOfElementsIdsInUse.material=function(e){const t={};return ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.material)&&(t[e.material]=!0)}))})),t},getListOfElementsIdsInUse.texture=function(e){const t={};if(ForEach.material(e,(function(e){forEachTextureInMaterial(e,(function(e){t[e]=!0}))})),usesExtension(e,"EXT_feature_metadata")){ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){const i=e.extensions;if(defined(i)&&defined(i.EXT_feature_metadata)){const e=i.EXT_feature_metadata.featureIdTextures;if(defined(e)){const i=e.length;for(let r=0;r<i;++r){const i=e[r].featureIds.texture;t[i.index]=!0}}}}))}));const i=e.extensions.EXT_feature_metadata.featureTextures;for(const e in i)if(i.hasOwnProperty(e)){const r=i[e].properties;if(defined(r))for(const e in r)if(r.hasOwnProperty(e)){const i=r[e].texture;t[i.index]=!0}}}return t},getListOfElementsIdsInUse.sampler=function(e){const t={};return ForEach.texture(e,(function(e){defined(e.sampler)&&(t[e.sampler]=!0)})),t};const updateFunctions={.8:glTF08to10,"1.0":glTF10to20,"2.0":void 0};function updateVersion(e,t){const i=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).targetVersion;let r=e.version;e.asset=defaultValue(e.asset,{version:"1.0"}),e.asset.version=defaultValue(e.asset.version,"1.0"),r=defaultValue(r,e.asset.version).toString(),Object.prototype.hasOwnProperty.call(updateFunctions,r)||(defined(r)&&(r=r.substring(0,3)),Object.prototype.hasOwnProperty.call(updateFunctions,r)||(r="1.0"));let n=updateFunctions[r];for(;defined(n)&&r!==i;)n(e,t),r=e.asset.version,n=updateFunctions[r];return e}function updateInstanceTechniques(e){const t=e.materials;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const i=t[e],r=i.instanceTechnique;defined(r)&&(i.technique=r.technique,i.values=r.values,delete i.instanceTechnique)}}function setPrimitiveModes(e){const t=e.meshes;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const i=t[e].primitives;if(defined(i)){const e=i.length;for(let t=0;t<e;++t){const e=i[t],r=defaultValue(e.primitive,WebGLConstants$1.TRIANGLES);e.mode=defaultValue(e.mode,r),delete e.primitive}}}}function updateNodes(e){const t=e.nodes,i=new Cartesian3,r=new Quaternion;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];if(defined(n.rotation)){const e=n.rotation;Cartesian3.fromArray(e,0,i),Quaternion.fromAxisAngle(i,e[3],r),n.rotation=[r.x,r.y,r.z,r.w]}const a=n.instanceSkin;defined(a)&&(n.skeletons=a.skeletons,n.skin=a.skin,n.meshes=a.meshes,delete n.instanceSkin)}}function updateAnimations(e){const t=e.animations,i=e.accessors,r=e.bufferViews,n=e.buffers,a={},o=new Cartesian3,s=new Quaternion;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const l=t[e],c=l.channels,u=l.parameters,d=l.samplers;if(defined(c)){const e=c.length;for(let t=0;t<e;++t){const e=c[t];if("rotation"===e.target.path){const t=u[d[e.sampler].output];if(defined(a[t]))continue;a[t]=!0;const l=i[t],c=r[l.bufferView],h=n[c.buffer].extras._pipeline.source,p=h.byteOffset+c.byteOffset+l.byteOffset,f=l.componentType,m=l.count,g=numberOfComponentsForType(l.type),_=l.count*g,y=ComponentDatatype$1.createArrayBufferView(f,h.buffer,p,_);for(let e=0;e<m;e++){const t=e*g;Cartesian3.unpack(y,t,o);const i=y[t+3];Quaternion.fromAxisAngle(o,i,s),Quaternion.pack(s,y,t)}}}}}}function removeTechniquePasses(e){const t=e.techniques;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const i=t[e],r=i.passes;if(defined(r)){const e=defaultValue(i.pass,"defaultPass");if(Object.prototype.hasOwnProperty.call(r,e)){const t=r[e],n=t.instanceProgram;i.attributes=defaultValue(i.attributes,n.attributes),i.program=defaultValue(i.program,n.program),i.uniforms=defaultValue(i.uniforms,n.uniforms),i.states=defaultValue(i.states,t.states)}delete i.passes,delete i.pass}}}function glTF08to10(e){defined(e.asset)||(e.asset={});const t=e.asset;if(t.version="1.0","string"==typeof t.profile){const e=t.profile.split(" ");t.profile={api:e[0],version:e[1]}}else t.profile={};if(defined(e.version)&&delete e.version,updateInstanceTechniques(e),setPrimitiveModes(e),updateNodes(e),updateAnimations(e),removeTechniquePasses(e),defined(e.allExtensions)&&(e.extensionsUsed=e.allExtensions,delete e.allExtensions),defined(e.lights)){const t=defaultValue(e.extensions,{});e.extensions=t;const i=defaultValue(t.KHR_materials_common,{});t.KHR_materials_common=i,i.lights=e.lights,delete e.lights,addExtensionsUsed(e,"KHR_materials_common")}}function removeAnimationSamplersIndirection(e){const t=e.animations;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const i=t[e],r=i.parameters;if(defined(r)){const e=i.samplers;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t];i.input=r[i.input],i.output=r[i.output]}delete i.parameters}}}function objectToArray(e,t){const i=[];for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=e[r];t[r]=i.length,i.push(n),defined(n.name)||(n.name=r)}return i}function objectsToArrays(e){let t;const i={accessors:{},animations:{},buffers:{},bufferViews:{},cameras:{},images:{},materials:{},meshes:{},nodes:{},programs:{},samplers:{},scenes:{},shaders:{},skins:{},textures:{},techniques:{}};let r;const n={},a=e.nodes;for(const e in a)Object.prototype.hasOwnProperty.call(a,e)&&(r=a[e].jointName,defined(r)&&(n[r]=e));for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&defined(i[t])){const r={},n=e[t];e[t]=objectToArray(n,r),i[t]=r}for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=i.nodes[n[r]]);defined(e.scene)&&(e.scene=i.scenes[e.scene]),ForEach.bufferView(e,(function(e){defined(e.buffer)&&(e.buffer=i.buffers[e.buffer])})),ForEach.accessor(e,(function(e){defined(e.bufferView)&&(e.bufferView=i.bufferViews[e.bufferView])})),ForEach.shader(e,(function(e){const t=e.extensions;if(defined(t)){const r=t.KHR_binary_glTF;defined(r)&&(e.bufferView=i.bufferViews[r.bufferView],delete t.KHR_binary_glTF),0===Object.keys(t).length&&delete e.extensions}})),ForEach.program(e,(function(e){defined(e.vertexShader)&&(e.vertexShader=i.shaders[e.vertexShader]),defined(e.fragmentShader)&&(e.fragmentShader=i.shaders[e.fragmentShader])})),ForEach.technique(e,(function(e){defined(e.program)&&(e.program=i.programs[e.program]),ForEach.techniqueParameter(e,(function(e){defined(e.node)&&(e.node=i.nodes[e.node]);const t=e.value;"string"==typeof t&&(e.value={index:i.textures[t]})}))})),ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.indices)&&(e.indices=i.accessors[e.indices]),ForEach.meshPrimitiveAttribute(e,(function(t,r){e.attributes[r]=i.accessors[t]})),defined(e.material)&&(e.material=i.materials[e.material])}))})),ForEach.node(e,(function(r){let n=r.children;if(defined(n)){const e=n.length;for(t=0;t<e;++t)n[t]=i.nodes[n[t]]}if(defined(r.meshes)){const a=r.meshes,o=a.length;if(o>0)for(r.mesh=i.meshes[a[0]],t=1;t<o;++t){const o={mesh:i.meshes[a[t]]},s=addToArray(e.nodes,o);defined(n)||(n=[],r.children=n),n.push(s)}delete r.meshes}if(defined(r.camera)&&(r.camera=i.cameras[r.camera]),defined(r.skin)&&(r.skin=i.skins[r.skin]),defined(r.skeletons)){const t=r.skeletons;if(t.length>0&&defined(r.skin)){e.skins[r.skin].skeleton=i.nodes[t[0]]}delete r.skeletons}defined(r.jointName)&&delete r.jointName})),ForEach.skin(e,(function(e){defined(e.inverseBindMatrices)&&(e.inverseBindMatrices=i.accessors[e.inverseBindMatrices]);const r=e.jointNames;if(defined(r)){const i=[],a=r.length;for(t=0;t<a;++t)i[t]=n[r[t]];e.joints=i,delete e.jointNames}})),ForEach.scene(e,(function(e){const r=e.nodes;if(defined(r)){const e=r.length;for(t=0;t<e;++t)r[t]=i.nodes[r[t]]}})),ForEach.animation(e,(function(e){const t={};e.samplers=objectToArray(e.samplers,t),ForEach.animationSampler(e,(function(e){e.input=i.accessors[e.input],e.output=i.accessors[e.output]})),ForEach.animationChannel(e,(function(e){e.sampler=t[e.sampler];const r=e.target;defined(r)&&(r.node=i.nodes[r.id],delete r.id)}))})),ForEach.material(e,(function(e){defined(e.technique)&&(e.technique=i.techniques[e.technique]),ForEach.materialValue(e,(function(t,r){"string"==typeof t&&(e.values[r]={index:i.textures[t]})}));const t=e.extensions;if(defined(t)){const e=t.KHR_materials_common;defined(e)&&ForEach.materialValue(e,(function(t,r){"string"==typeof t&&(e.values[r]={index:i.textures[t]})}))}})),ForEach.image(e,(function(e){const t=e.extensions;if(defined(t)){const r=t.KHR_binary_glTF;defined(r)&&(e.bufferView=i.bufferViews[r.bufferView],e.mimeType=r.mimeType,delete t.KHR_binary_glTF),0===Object.keys(t).length&&delete e.extensions}})),ForEach.texture(e,(function(e){defined(e.sampler)&&(e.sampler=i.samplers[e.sampler]),defined(e.source)&&(e.source=i.images[e.source])}))}function removeAnimationSamplerNames(e){ForEach.animation(e,(function(e){ForEach.animationSampler(e,(function(e){delete e.name}))}))}function removeEmptyArrays(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t];Array.isArray(i)&&0===i.length&&delete e[t]}ForEach.node(e,(function(e){defined(e.children)&&0===e.children.length&&delete e.children}))}function stripAsset(e){const t=e.asset;delete t.profile,delete t.premultipliedAlpha}const knownExtensions={CESIUM_RTC:!0,KHR_materials_common:!0,WEB3D_quantized_attributes:!0};function requireKnownExtensions(e){const t=e.extensionsUsed;if(e.extensionsRequired=defaultValue(e.extensionsRequired,[]),defined(t)){const i=t.length;for(let r=0;r<i;++r){const i=t[r];defined(knownExtensions[i])&&e.extensionsRequired.push(i)}}}function removeBufferType(e){ForEach.buffer(e,(function(e){delete e.type}))}function removeTextureProperties(e){ForEach.texture(e,(function(e){delete e.format,delete e.internalFormat,delete e.target,delete e.type}))}function requireAttributeSetIndex(e){ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){ForEach.meshPrimitiveAttribute(e,(function(t,i){"TEXCOORD"===i?e.attributes.TEXCOORD_0=t:"COLOR"===i&&(e.attributes.COLOR_0=t)})),delete e.attributes.TEXCOORD,delete e.attributes.COLOR}))})),ForEach.technique(e,(function(e){ForEach.techniqueParameter(e,(function(e){const t=e.semantic;defined(t)&&("TEXCOORD"===t?e.semantic="TEXCOORD_0":"COLOR"===t&&(e.semantic="COLOR_0"))}))}))}const knownSemantics={POSITION:!0,NORMAL:!0,TANGENT:!0},indexedSemantics={COLOR:"COLOR",JOINT:"JOINTS",JOINTS:"JOINTS",TEXCOORD:"TEXCOORD",WEIGHT:"WEIGHTS",WEIGHTS:"WEIGHTS"};function underscoreApplicationSpecificSemantics(e){const t={};ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){ForEach.meshPrimitiveAttribute(e,(function(e,i){if("_"!==i.charAt(0)){const e=i.search(/_[0-9]+/g);let r,n=i,a="_0";e>=0&&(n=i.substring(0,e),a=i.substring(e));const o=indexedSemantics[n];defined(o)?(r=o+a,t[i]=r):defined(knownSemantics[n])||(r="_"+i,t[i]=r)}}));for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const r=t[i],n=e.attributes[i];defined(n)&&(delete e.attributes[i],e.attributes[r]=n)}}))})),ForEach.technique(e,(function(e){ForEach.techniqueParameter(e,(function(e){const i=t[e.semantic];defined(i)&&(e.semantic=i)}))}))}function clampCameraParameters(e){ForEach.camera(e,(function(e){const t=e.perspective;if(defined(t)){const e=t.aspectRatio;defined(e)&&0===e&&delete t.aspectRatio;const i=t.yfov;defined(i)&&0===i&&(t.yfov=1)}}))}function computeAccessorByteStride(e,t){return defined(t.byteStride)&&0!==t.byteStride?t.byteStride:getAccessorByteStride(e,t)}function requireByteLength(e){ForEach.buffer(e,(function(e){defined(e.byteLength)||(e.byteLength=e.extras._pipeline.source.length)})),ForEach.accessor(e,(function(t){const i=t.bufferView;if(defined(i)){const r=e.bufferViews[i],n=computeAccessorByteStride(e,t),a=t.byteOffset+t.count*n;r.byteLength=Math.max(defaultValue(r.byteLength,0),a)}}))}function moveByteStrideToBufferView(e){let t,i,r;const n=e.bufferViews,a={};ForEach.accessorContainingVertexAttributeData(e,(function(t){const i=e.accessors[t];defined(i.bufferView)&&(a[i.bufferView]=!0)}));const o={};ForEach.accessor(e,(function(e){defined(e.bufferView)&&(o[e.bufferView]=defaultValue(o[e.bufferView],[]),o[e.bufferView].push(e))}));for(const s in o)if(Object.prototype.hasOwnProperty.call(o,s)){r=n[s];const l=o[s];l.sort((function(e,t){return e.byteOffset-t.byteOffset}));let c=0,u=0;const d=l.length;for(t=0;t<d;++t){let o=l[t];const h=computeAccessorByteStride(e,o),p=o.byteOffset,f=o.count*h;delete o.byteStride;const m=t<d-1;if(h!==(m?computeAccessorByteStride(e,l[t+1]):void 0)){const e=clone$1(r,!0);a[s]&&(e.byteStride=h),e.byteOffset+=c,e.byteLength=p+f-c;const d=addToArray(n,e);for(i=u;i<=t;++i)o=l[i],o.bufferView=d,o.byteOffset=o.byteOffset-c;c=m?l[t+1].byteOffset:void 0,u=t+1}}}removeUnusedElements(e,["accessor","bufferView","buffer"])}function requirePositionAccessorMinMax(e){ForEach.accessorWithSemantic(e,"POSITION",(function(t){const i=e.accessors[t];if(!defined(i.min)||!defined(i.max)){const t=findAccessorMinMax(e,i);i.min=t.min,i.max=t.max}}))}function isNodeEmpty(e){return(!defined(e.children)||0===e.children.length)&&(!defined(e.meshes)||0===e.meshes.length)&&!defined(e.camera)&&!defined(e.skin)&&!defined(e.skeletons)&&!defined(e.jointName)&&(!defined(e.translation)||Cartesian3.fromArray(e.translation).equals(Cartesian3.ZERO))&&(!defined(e.scale)||Cartesian3.fromArray(e.scale).equals(new Cartesian3(1,1,1)))&&(!defined(e.rotation)||Cartesian4.fromArray(e.rotation).equals(new Cartesian4(0,0,0,1)))&&(!defined(e.matrix)||Matrix4.fromColumnMajorArray(e.matrix).equals(Matrix4.IDENTITY))&&!defined(e.extensions)&&!defined(e.extras)}function deleteNode(e,t){ForEach.scene(e,(function(e){const i=e.nodes;if(defined(i)){for(let e=i.length;e>=0;--e)if(i[e]===t)return void i.splice(e,1)}})),ForEach.node(e,(function(i,r){if(defined(i.children)){const n=i.children.indexOf(t);n>-1&&(i.children.splice(n,1),isNodeEmpty(i)&&deleteNode(e,r))}})),delete e.nodes[t]}function removeEmptyNodes(e){return ForEach.node(e,(function(t,i){isNodeEmpty(t)&&deleteNode(e,i)})),e}function requireAnimationAccessorMinMax(e){ForEach.animation(e,(function(t){ForEach.animationSampler(t,(function(t){const i=e.accessors[t.input];if(!defined(i.min)||!defined(i.max)){const t=findAccessorMinMax(e,i);i.min=t.min,i.max=t.max}}))}))}function glTF10to20(e){e.asset=defaultValue(e.asset,{}),e.asset.version="2.0",updateInstanceTechniques(e),removeAnimationSamplersIndirection(e),removeEmptyNodes(e),objectsToArrays(e),removeAnimationSamplerNames(e),stripAsset(e),requireKnownExtensions(e),requireByteLength(e),moveByteStrideToBufferView(e),requirePositionAccessorMinMax(e),requireAnimationAccessorMinMax(e),removeBufferType(e),removeTextureProperties(e),requireAttributeSetIndex(e),underscoreApplicationSpecificSemantics(e),updateAccessorComponentTypes(e),clampCameraParameters(e),moveTechniqueRenderStates(e),moveTechniquesToExtension(e),removeEmptyArrays(e)}function ModelLoadResources(){this.initialized=!1,this.resourcesParsed=!1,this.vertexBuffersToCreate=new Queue,this.indexBuffersToCreate=new Queue,this.buffers={},this.pendingBufferLoads=0,this.programsToCreate=new Queue,this.shaders={},this.pendingShaderLoads=0,this.texturesToCreate=new Queue,this.pendingTextureLoads=0,this.texturesToCreateFromBufferView=new Queue,this.pendingBufferViewToImage=0,this.createSamplers=!0,this.createSkins=!0,this.createRuntimeAnimations=!0,this.createVertexArrays=!0,this.createRenderStates=!0,this.createUniformMaps=!0,this.createRuntimeNodes=!0,this.createdBufferViews={},this.primitivesToDecode=new Queue,this.activeDecodingTasks=0,this.pendingDecodingCache=!1,this.skinnedNodesIds=[]}function getSubarray(e,t,i){return e.subarray(t,t+i)}ModelLoadResources.prototype.getBuffer=function(e){return getSubarray(this.buffers[e.buffer],e.byteOffset,e.byteLength)},ModelLoadResources.prototype.finishedPendingBufferLoads=function(){return 0===this.pendingBufferLoads},ModelLoadResources.prototype.finishedBuffersCreation=function(){return 0===this.pendingBufferLoads&&0===this.vertexBuffersToCreate.length&&0===this.indexBuffersToCreate.length},ModelLoadResources.prototype.finishedProgramCreation=function(){return 0===this.pendingShaderLoads&&0===this.programsToCreate.length},ModelLoadResources.prototype.finishedTextureCreation=function(){var e=0===this.pendingTextureLoads,t=0===this.texturesToCreate.length&&0===this.texturesToCreateFromBufferView.length;return e&&t},ModelLoadResources.prototype.finishedEverythingButTextureCreation=function(){var e=0===this.pendingBufferLoads&&0===this.pendingShaderLoads,t=0===this.vertexBuffersToCreate.length&&0===this.indexBuffersToCreate.length&&0===this.programsToCreate.length&&0===this.pendingBufferViewToImage;return this.finishedDecoding()&&e&&t},ModelLoadResources.prototype.finishedDecoding=function(){return 0===this.primitivesToDecode.length&&0===this.activeDecodingTasks&&!this.pendingDecodingCache},ModelLoadResources.prototype.finished=function(){return this.finishedDecoding()&&this.finishedTextureCreation()&&this.finishedEverythingButTextureCreation()};var ModelUtility={updateForwardAxis:function(e){var t=e.gltf.extras.sourceVersion;(defined(t)&&"2.0"!==t||"2.0"!==ModelUtility.getAssetVersion(e.gltf))&&(e._gltfForwardAxis=Axis$1.X)},getAssetVersion:function(e){return defined(e.asset)&&defined(e.asset.version)?e.asset.version:"1.0"},splitIncompatibleMaterials:function(e){var t=e.accessors,i=e.materials,r={};return ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){var n,a,o=e.material,s=i[o],l=e.attributes.JOINTS_0;if(defined(l)){var c=t[l];n=c.componentType,a=c.type}var u=defined(l)&&"VEC4"===a,d=defined(e.attributes.COLOR_0),h=defined(e.targets),p=defined(e.attributes.NORMAL),f=defined(e.attributes.TANGENT),m=defined(e.attributes.TEXCOORD_0),g=m&&defined(e.attributes.TEXCOORD_1),_=defined(e.extensions)&&defined(e.extensions.CESIUM_primitive_outline),y=r[o];if(defined(y)){if(y.skinning.skinned!==u||y.hasVertexColors!==d||y.hasMorphTargets!==h||y.hasNormals!==p||y.hasTangents!==f||y.hasTexCoords!==m||y.hasTexCoord1!==g||y.hasOutline!==_){var v=clone$1(s,!0);o=addToArray(i,v),e.material=o,r[o]={skinning:{skinned:u,componentType:n},hasVertexColors:d,hasMorphTargets:h,hasNormals:p,hasTangents:f,hasTexCoords:m,hasTexCoord1:g,hasOutline:_}}}else r[o]={skinning:{skinned:u,componentType:n},hasVertexColors:d,hasMorphTargets:h,hasNormals:p,hasTangents:f,hasTexCoords:m,hasTexCoord1:g,hasOutline:_}}))})),r},getShaderVariable:function(e){return"SCALAR"===e?"float":e.toLowerCase()},ModelState:{NEEDS_LOAD:0,LOADING:1,LOADED:2,FAILED:3},getFailedLoadFunction:function(e,t,i){return function(r){e._state=ModelUtility.ModelState.FAILED;var n="Failed to load "+t+": "+i;defined(r)&&(n+="\n"+r.message),e._readyPromise.reject(new RuntimeError(n))}},parseBuffers:function(e,t){var i=e._loadResources;ForEach.buffer(e.gltf,(function(r,n){if(defined(r.extras._pipeline.source))i.buffers[n]=r.extras._pipeline.source;else if(defined(t)){var a=e._resource.getDerivedResource({url:r.uri});++i.pendingBufferLoads,a.fetchArrayBuffer().then(t(e,n)).otherwise(ModelUtility.getFailedLoadFunction(e,"buffer",a.url))}}))}},aMinScratch=new Cartesian3,aMaxScratch=new Cartesian3;function techniqueAttributeForSemantic(e,t){return ForEach.techniqueAttribute(e,(function(e,i){if(e.semantic===t)return i}))}function ensureSemanticExistenceForPrimitive(e,t){var i=e.accessors,r=e.materials,n=e.extensions.KHR_techniques_webgl,a=n.techniques,o=n.programs,s=n.shaders,l=t.targets,c=t.attributes;for(var u in l)if(l.hasOwnProperty(u)){var d=l[u];for(var h in d)"extras"!==h&&(c[h+"_"+u]=d[h])}var p=a[r[t.material].extensions.KHR_techniques_webgl.technique],f=s[o[p.program].vertexShader];for(var m in c)if(c.hasOwnProperty(m)&&!defined(techniqueAttributeForSemantic(p,m))){var g=i[c[m]],_=m.toLowerCase();"_"===_.charAt(0)&&(_=_.slice(1));var y="a_"+_;p.attributes[y]={semantic:m,type:g.componentType};var v=f.extras._pipeline,C=v.source;C="attribute "+ModelUtility.getShaderVariable(g.type)+" "+y+";\n"+C,v.source=C}}function getTechniqueAttributeOrUniformFunction(e,t,i,r){return usesExtension(e,"KHR_techniques_webgl")?function(e,t){if(!(e.semantic!==i||r&&defined(e.node)))return t}:function(e,n){var a=t.parameters[e];if(!(a.semantic!==i||r&&defined(a.node)))return n}}ModelUtility.computeBoundingSphere=function(e){for(var t=e.gltf,i=t.nodes,r=t.meshes,n=t.scenes[t.scene].nodes,a=n.length,o=[],s=new Cartesian3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),l=new Cartesian3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),c=0;c<a;++c){var u=i[n[c]];for(u._transformToRoot=ModelUtility.getTransform(u),o.push(u);o.length>0;){var d=(u=o.pop())._transformToRoot,h=u.mesh;if(defined(h))for(var p=r[h].primitives,f=p.length,m=0;m<f;++m){var g=p[m].attributes.POSITION;if(defined(g)){var _=ModelUtility.getAccessorMinMax(t,g);if(defined(_.min)&&defined(_.max)){var y=Cartesian3.fromArray(_.min,0,aMinScratch),v=Cartesian3.fromArray(_.max,0,aMaxScratch);Matrix4.multiplyByPoint(d,y,y),Matrix4.multiplyByPoint(d,v,v),Cartesian3.minimumByComponent(s,y,s),Cartesian3.maximumByComponent(l,v,l)}}}var C=u.children;if(defined(C))for(var T=C.length,S=0;S<T;++S){var A=i[C[S]];A._transformToRoot=ModelUtility.getTransform(A),Matrix4.multiplyTransformation(d,A._transformToRoot,A._transformToRoot),o.push(A)}delete u._transformToRoot}}var x=BoundingSphere.fromCornerPoints(s,l);return e._forwardAxis===Axis$1.Z&&BoundingSphere.transformWithoutScale(x,Axis$1.Z_UP_TO_X_UP,x),e._upAxis===Axis$1.Y?BoundingSphere.transformWithoutScale(x,Axis$1.Y_UP_TO_Z_UP,x):e._upAxis===Axis$1.X&&BoundingSphere.transformWithoutScale(x,Axis$1.X_UP_TO_Z_UP,x),x},ModelUtility.ensureSemanticExistence=function(e){return ForEach.mesh(e,(function(t){ForEach.meshPrimitive(t,(function(t){ensureSemanticExistenceForPrimitive(e,t)}))})),e},ModelUtility.createAttributeLocations=function(e,t){var i={},r=!1,n=1;if(ForEach.techniqueAttribute(e,(function(e,t){/pos/i.test(t)&&!r?(i[t]=0,r=!0):i[t]=n++})),defined(t))for(var a in t)t.hasOwnProperty(a)&&(i[a]=n++);return i},ModelUtility.getAccessorMinMax=function(e,t){var i=e.accessors[t],r=i.extensions,n=i.min,a=i.max;if(defined(r)){var o=r.WEB3D_quantized_attributes;defined(o)&&(n=o.decodedMin,a=o.decodedMax)}return{min:n,max:a}},ModelUtility.getAttributeOrUniformBySemantic=function(e,t,i,r){return ForEach.technique(e,(function(n){if(!defined(i)||n.program===i){var a=ForEach.techniqueAttribute(n,getTechniqueAttributeOrUniformFunction(e,n,t,r));return defined(a)?a:ForEach.techniqueUniform(n,getTechniqueAttributeOrUniformFunction(e,n,t,r))}}))},ModelUtility.getDiffuseAttributeOrUniform=function(e,t){var i=ModelUtility.getAttributeOrUniformBySemantic(e,"COLOR_0",t);return defined(i)||(i=ModelUtility.getAttributeOrUniformBySemantic(e,"_3DTILESDIFFUSE",t)),i};var nodeTranslationScratch=new Cartesian3,nodeQuaternionScratch=new Quaternion,nodeScaleScratch=new Cartesian3;function replaceAllButFirstInString(e,t,i){t+="(?!\\w)",t=new RegExp(t,"g");var r=e.search(t);return e.replace(t,(function(e,t){return r===t?e:i}))}function getQuantizedAttributes(e,t){var i=e.accessors[t].extensions;if(defined(i))return i.WEB3D_quantized_attributes}function getAttributeVariableName(e,t,i){var r=t.material,n=e.materials[r];if(usesExtension(e,"KHR_techniques_webgl")&&defined(n.extensions)&&defined(n.extensions.KHR_techniques_webgl)){var a=n.extensions.KHR_techniques_webgl.technique,o=e.extensions.KHR_techniques_webgl.techniques[a];return ForEach.techniqueAttribute(o,(function(e,t){if(e.semantic===i)return t}))}}function getScalarUniformFunction(e){var t={value:e,clone:function(e,t){return e},func:function(){return t.value}};return t}function getVec2UniformFunction(e){var t={value:Cartesian2.fromArray(e),clone:Cartesian2.clone,func:function(){return t.value}};return t}function getVec3UniformFunction(e){var t={value:Cartesian3.fromArray(e),clone:Cartesian3.clone,func:function(){return t.value}};return t}function getVec4UniformFunction(e){var t={value:Cartesian4.fromArray(e),clone:Cartesian4.clone,func:function(){return t.value}};return t}function getMat2UniformFunction(e){var t={value:Matrix2.fromColumnMajorArray(e),clone:Matrix2.clone,func:function(){return t.value}};return t}function getMat3UniformFunction(e){var t={value:Matrix3.fromColumnMajorArray(e),clone:Matrix3.clone,func:function(){return t.value}};return t}function getMat4UniformFunction(e){var t={value:Matrix4.fromColumnMajorArray(e),clone:Matrix4.clone,func:function(){return t.value}};return t}function DelayLoadedTextureUniform(e,t,i){this._value=void 0,this._textureId=e.index,this._textures=t,this._defaultTexture=i}function getTextureUniformFunction(e,t,i){var r=new DelayLoadedTextureUniform(e,t,i);return r.func=function(){return r.value},r}ModelUtility.getTransform=function(e,t){return defined(e.matrix)?Matrix4.fromColumnMajorArray(e.matrix,t):Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.fromArray(e.translation,0,nodeTranslationScratch),Quaternion.unpack(e.rotation,0,nodeQuaternionScratch),Cartesian3.fromArray(e.scale,0,nodeScaleScratch),t)},ModelUtility.getUsedExtensions=function(e){var t=e.extensionsUsed,i={};if(defined(t))for(var r=t.length,n=0;n<r;n++){i[t[n]]=!0}return i},ModelUtility.getRequiredExtensions=function(e){var t=e.extensionsRequired,i={};if(defined(t))for(var r=t.length,n=0;n<r;n++){i[t[n]]=!0}return i},ModelUtility.supportedExtensions={AGI_articulations:!0,CESIUM_RTC:!0,EXT_texture_webp:!0,KHR_blend:!0,KHR_binary_glTF:!0,KHR_texture_basisu:!0,KHR_draco_mesh_compression:!0,KHR_materials_common:!0,KHR_techniques_webgl:!0,KHR_materials_unlit:!0,KHR_materials_pbrSpecularGlossiness:!0,KHR_texture_transform:!0,WEB3D_quantized_attributes:!0},ModelUtility.checkSupportedExtensions=function(e,t){for(var i in e)if(e.hasOwnProperty(i)){if(!ModelUtility.supportedExtensions[i])throw new RuntimeError("Unsupported glTF Extension: "+i);if("EXT_texture_webp"===i&&!1===t)throw new RuntimeError("Loaded model requires WebP but browser does not support it.")}},ModelUtility.checkSupportedGlExtensions=function(e,t){if(defined(e))for(var i=e.length,r=0;r<i;r++){var n=e[r];if("OES_element_index_uint"!==n)throw new RuntimeError("Unsupported WebGL Extension: "+n);if(!t.elementIndexUint)throw new RuntimeError("OES_element_index_uint WebGL extension is not enabled.")}},ModelUtility.modifyShaderForDracoQuantizedAttributes=function(e,t,i,r){var n={};for(var a in r)if(r.hasOwnProperty(a)){var o=r[a],s=o.quantization;if(!defined(s))continue;var l=getAttributeVariableName(e,t,a);"_"===a.charAt(0)&&(a=a.substring(1));var c="gltf_u_dec_"+a.toLowerCase();if(!defined(n[c])){var u,d="gltf_decoded_"+a,h=l.replace("a_","gltf_a_dec_"),p=o.componentsPerAttribute;i=replaceAllButFirstInString(i,l,h),i=(u=s.octEncoded?"vec3":p>1?"vec"+p:"float")+" "+h+";\n"+i;var f=3===p&&"COLOR_0"===a;f&&(i=replaceAllButFirstInString(i,h,"vec4("+h+", 1.0)"));var m="";if(s.octEncoded){var g=c+"_rangeConstant";i="uniform float "+g+";\n"+i,m="\nvoid main() {\n "+h+" = czm_octDecode("+l+".xy, "+g+").zxy;\n "+d+"();\n}\n"}else{var _=c+"_normConstant",y=c+"_min";i="uniform float "+_+";\nuniform "+u+" "+y+";\n"+i,m="\nvoid main() {\n "+h+" = "+y+" + "+l+(f?".xyz":"")+" * "+_+";\n "+d+"();\n}\n"}i=ShaderSource.replaceMain(i,d),i+=m}}return{shader:i}},ModelUtility.modifyShaderForQuantizedAttributes=function(e,t,i){var r={},n=t.attributes;for(var a in n)if(n.hasOwnProperty(a)){var o=getAttributeVariableName(e,t,a),s=t.attributes[a];"_"===a.charAt(0)&&(a=a.substring(1));var l="gltf_u_dec_"+a.toLowerCase(),c=l+"_scale",u=l+"_translate";if(!defined(r[l])&&!defined(r[c])){var d=getQuantizedAttributes(e,s);if(defined(d)){var h,p=d.decodeMatrix,f="gltf_decoded_"+a,m=o.replace("a_","gltf_a_dec_"),g=Math.floor(Math.sqrt(p.length));i=(h=g>2?"vec"+(g-1):"float")+" "+m+";\n"+(i=replaceAllButFirstInString(i,o,m));var _="";5===g?(i="uniform vec4 "+u+";\n"+(i="uniform mat4 "+c+";\n"+i),_="\nvoid main() {\n "+m+" = "+c+" * "+o+" + "+u+";\n "+f+"();\n}\n",r[c]={mat:4},r[u]={vec:4}):(i="uniform mat"+g+" "+l+";\n"+i,_="\nvoid main() {\n "+m+" = "+h+"("+l+" * vec"+g+"("+o+",1.0));\n "+f+"();\n}\n",r[l]={mat:g}),i=ShaderSource.replaceMain(i,f),i+=_}}}return{shader:i,uniforms:r}},Object.defineProperties(DelayLoadedTextureUniform.prototype,{value:{get:function(){if(!defined(this._value)){var e=this._textures[this._textureId];if(!defined(e))return this._defaultTexture;this._value=e}return this._value},set:function(e){this._value=e}}}),DelayLoadedTextureUniform.prototype.clone=function(e){return e},DelayLoadedTextureUniform.prototype.func=void 0;var gltfUniformFunctions={};function scaleFromMatrix5Array(e){return[e[0],e[1],e[2],e[3],e[5],e[6],e[7],e[8],e[10],e[11],e[12],e[13],e[15],e[16],e[17],e[18]]}function translateFromMatrix5Array(e){return[e[20],e[21],e[22],e[23]]}gltfUniformFunctions[WebGLConstants$1.FLOAT]=getScalarUniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_VEC2]=getVec2UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_VEC3]=getVec3UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_VEC4]=getVec4UniformFunction,gltfUniformFunctions[WebGLConstants$1.INT]=getScalarUniformFunction,gltfUniformFunctions[WebGLConstants$1.INT_VEC2]=getVec2UniformFunction,gltfUniformFunctions[WebGLConstants$1.INT_VEC3]=getVec3UniformFunction,gltfUniformFunctions[WebGLConstants$1.INT_VEC4]=getVec4UniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL]=getScalarUniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL_VEC2]=getVec2UniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL_VEC3]=getVec3UniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL_VEC4]=getVec4UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_MAT2]=getMat2UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_MAT3]=getMat3UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_MAT4]=getMat4UniformFunction,gltfUniformFunctions[WebGLConstants$1.SAMPLER_2D]=getTextureUniformFunction,ModelUtility.createUniformFunction=function(e,t,i,r){return gltfUniformFunctions[e](t,i,r)},ModelUtility.createUniformsForDracoQuantizedAttributes=function(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i],n=r.quantization;if(!defined(n))continue;"_"===i.charAt(0)&&(i=i.substring(1));var a="gltf_u_dec_"+i.toLowerCase();if(n.octEncoded){var o=a+"_rangeConstant",s=(1<<n.quantizationBits)-1;t[o]=getScalarUniformFunction(s).func;continue}var l=a+"_normConstant",c=n.range/(1<<n.quantizationBits);t[l]=getScalarUniformFunction(c).func;var u=a+"_min";switch(r.componentsPerAttribute){case 1:t[u]=getScalarUniformFunction(n.minValues).func;break;case 2:t[u]=getVec2UniformFunction(n.minValues).func;break;case 3:t[u]=getVec3UniformFunction(n.minValues).func;break;case 4:t[u]=getVec4UniformFunction(n.minValues).func}}return t},ModelUtility.createUniformsForQuantizedAttributes=function(e,t,i){var r=e.accessors,n={},a={},o=t.attributes;for(var s in o)if(o.hasOwnProperty(s)){var l=r[o[s]],c=l.extensions;if("_"===s.charAt(0)&&(s=s.substring(1)),defined(c)){var u=c.WEB3D_quantized_attributes;if(defined(u)){var d=u.decodeMatrix,h="gltf_u_dec_"+s.toLowerCase();switch(l.type){case AttributeType$1.SCALAR:a[h]=getMat2UniformFunction(d).func,n[h]=!0;break;case AttributeType$1.VEC2:a[h]=getMat3UniformFunction(d).func,n[h]=!0;break;case AttributeType$1.VEC3:a[h]=getMat4UniformFunction(d).func,n[h]=!0;break;case AttributeType$1.VEC4:var p=h+"_scale",f=h+"_translate";a[p]=getMat4UniformFunction(scaleFromMatrix5Array(d)).func,a[f]=getVec4UniformFunction(translateFromMatrix5Array(d)).func,n[p]=!0,n[f]=!0}}}}for(var m in i)if(i.hasOwnProperty(m)&&!n[m]){var g=i[m];defined(g.mat)&&(2===g.mat?a[m]=getMat2UniformFunction(Matrix2.IDENTITY).func:3===g.mat?a[m]=getMat3UniformFunction(Matrix3.IDENTITY).func:4===g.mat&&(a[m]=getMat4UniformFunction(Matrix4.IDENTITY).func)),defined(g.vec)&&4===g.vec&&(a[m]=getVec4UniformFunction([0,0,0,0]).func)}return a};var scratchTranslationRtc=new Cartesian3,gltfSemanticUniforms$1={MODEL:function(e,t){return function(){return e.model}},VIEW:function(e,t){return function(){return e.view}},PROJECTION:function(e,t){return function(){return e.projection}},MODELVIEW:function(e,t){return function(){return e.modelView}},CESIUM_RTC_MODELVIEW:function(e,t){var i=new Matrix4;return function(){return defined(t._rtcCenter)?(Matrix4.getTranslation(e.model,scratchTranslationRtc),Cartesian3.add(scratchTranslationRtc,t._rtcCenter,scratchTranslationRtc),Matrix4.multiplyByPoint(e.view,scratchTranslationRtc,scratchTranslationRtc),Matrix4.setTranslation(e.modelView,scratchTranslationRtc,i)):e.modelView}},MODELVIEWPROJECTION:function(e,t){return function(){return e.modelViewProjection}},MODELINVERSE:function(e,t){return function(){return e.inverseModel}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t){return function(){return e.inverseModelView}},MODELVIEWPROJECTIONINVERSE:function(e,t){return function(){return e.inverseModelViewProjection}},MODELINVERSETRANSPOSE:function(e,t){return function(){return e.inverseTransposeModel}},MODELVIEWINVERSETRANSPOSE:function(e,t){return function(){return e.normal}},VIEWPORT:function(e,t){return function(){return e.viewportCartesian4}}};function processModelMaterialsCommon(e,t){if(t=defaultValue(t,defaultValue.EMPTY_OBJECT),defined(e)&&usesExtension(e,"KHR_materials_common")){usesExtension(e,"KHR_techniques_webgl")||(defined(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl={programs:[],shaders:[],techniques:[]},e.extensionsUsed.push("KHR_techniques_webgl"),e.extensionsRequired.push("KHR_techniques_webgl"));var i=e.extensions.KHR_techniques_webgl;lightDefaults(e);var r=generateLightParameters(e),n=ModelUtility.splitIncompatibleMaterials(e),a={},o=!1;return ForEach.material(e,(function(s,l){if(defined(s.extensions)&&defined(s.extensions.KHR_materials_common)){var c=s.extensions.KHR_materials_common,u=n[l],d=getTechniqueKey(c,u),h=a[d];defined(h)||(h=generateTechnique$1(e,i,u,c,r,t.addBatchIdToGeneratedShaders),a[d]=h,o=!0);var p={},f=c.values;for(var m in f)f.hasOwnProperty(m)&&"transparent"!==m&&"doubleSided"!==m&&(p["u_"+m.toLowerCase()]=f[m]);s.extensions.KHR_techniques_webgl={technique:h,values:p},s.alphaMode="OPAQUE",c.transparent&&(s.alphaMode="BLEND"),c.doubleSided&&(s.doubleSided=!0)}})),o?(ModelUtility.ensureSemanticExistence(e),e):e}}function generateLightParameters(e){var t,i={};if(defined(e.extensions)&&defined(e.extensions.KHR_materials_common)&&(t=e.extensions.KHR_materials_common.lights),defined(t)){var r=e.nodes;for(var n in r)if(r.hasOwnProperty(n)){var a=r[n];if(defined(a.extensions)&&defined(a.extensions.KHR_materials_common)){var o=a.extensions.KHR_materials_common.light;defined(o)&&defined(t[o])&&(t[o].node=n),delete a.extensions.KHR_materials_common}}var s=0;for(var l in t)if(t.hasOwnProperty(l)){var c=t[l],u=c.type;if("ambient"!==u&&!defined(c.node)){delete t[l];continue}var d="light"+s.toString();switch(c.baseName=d,u){case"ambient":var h=c.ambient;i[d+"Color"]={type:WebGLConstants$1.FLOAT_VEC3,value:h.color};break;case"directional":var p=c.directional;i[d+"Color"]={type:WebGLConstants$1.FLOAT_VEC3,value:p.color},defined(c.node)&&(i[d+"Transform"]={node:c.node,semantic:"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4});break;case"point":var f=c.point;i[d+"Color"]={type:WebGLConstants$1.FLOAT_VEC3,value:f.color},defined(c.node)&&(i[d+"Transform"]={node:c.node,semantic:"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4}),i[d+"Attenuation"]={type:WebGLConstants$1.FLOAT_VEC3,value:[f.constantAttenuation,f.linearAttenuation,f.quadraticAttenuation]};break;case"spot":var m=c.spot;i[d+"Color"]={type:WebGLConstants$1.FLOAT_VEC3,value:m.color},defined(c.node)&&(i[d+"Transform"]={node:c.node,semantic:"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4},i[d+"InverseTransform"]={node:c.node,semantic:"MODELVIEWINVERSE",type:WebGLConstants$1.FLOAT_MAT4,useInFragment:!0}),i[d+"Attenuation"]={type:WebGLConstants$1.FLOAT_VEC3,value:[m.constantAttenuation,m.linearAttenuation,m.quadraticAttenuation]},i[d+"FallOff"]={type:WebGLConstants$1.FLOAT_VEC2,value:[m.fallOffAngle,m.fallOffExponent]}}++s}}return i}function generateTechnique$1(e,t,i,r,n,a){defined(r)||(r={}),a=defaultValue(a,!1);var o,s=t.techniques,l=t.shaders,c=t.programs,u=r.technique.toUpperCase();defined(e.extensions)&&defined(e.extensions.KHR_materials_common)&&(o=e.extensions.KHR_materials_common.lights);var d=r.values,h=defaultValue(r.jointCount,0),p=!1,f=!1;defined(i)&&(p=i.skinning.skinned,f=i.hasVertexColors);var m,g="precision highp float;\n",_="precision highp float;\n",y="CONSTANT"!==u,v={u_modelViewMatrix:{semantic:usesExtension(e,"CESIUM_RTC")?"CESIUM_RTC_MODELVIEW":"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4},u_projectionMatrix:{semantic:"PROJECTION",type:WebGLConstants$1.FLOAT_MAT4}};y&&(v.u_normalMatrix={semantic:"MODELVIEWINVERSETRANSPOSE",type:WebGLConstants$1.FLOAT_MAT3}),p&&(v.u_jointMatrix={count:h,semantic:"JOINTMATRIX",type:WebGLConstants$1.FLOAT_MAT4});var C=!1;for(var T in d)if(d.hasOwnProperty(T)&&"transparent"!==T&&"doubleSided"!==T){var S=getKHRMaterialsCommonValueType(T,d[T]);m="u_"+T.toLowerCase(),C||S!==WebGLConstants$1.SAMPLER_2D||(C=!0),v[m]={type:S}}if(defined(v.u_diffuse)&&(v.u_diffuse.semantic="_3DTILESDIFFUSE"),defined(n))for(var A in n)n.hasOwnProperty(A)&&(v[m="u_"+A]=n[A]);for(m in v)if(v.hasOwnProperty(m)){var x=v[m],E=defined(x.count)?"["+x.count+"]":"";x.type!==WebGLConstants$1.FLOAT_MAT3&&x.type!==WebGLConstants$1.FLOAT_MAT4||x.useInFragment?(_+="uniform "+webGLConstantToGlslType(x.type)+" "+m+E+";\n",delete x.useInFragment):g+="uniform "+webGLConstantToGlslType(x.type)+" "+m+E+";\n"}var b="";p&&(b+=" mat4 skinMatrix =\n a_weight.x * u_jointMatrix[int(a_joint.x)] +\n a_weight.y * u_jointMatrix[int(a_joint.y)] +\n a_weight.z * u_jointMatrix[int(a_joint.z)] +\n a_weight.w * u_jointMatrix[int(a_joint.w)];\n");var P,D={a_position:{semantic:"POSITION"}};g+="attribute vec3 a_position;\n",g+="varying vec3 v_positionEC;\n",b+=p?" vec4 pos = u_modelViewMatrix * skinMatrix * vec4(a_position,1.0);\n":" vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);\n",b+=" v_positionEC = pos.xyz;\n",b+=" gl_Position = u_projectionMatrix * pos;\n",_+="varying vec3 v_positionEC;\n",y&&(D.a_normal={semantic:"NORMAL"},g+="attribute vec3 a_normal;\n",g+="varying vec3 v_normal;\n",b+=p?" v_normal = u_normalMatrix * mat3(skinMatrix) * a_normal;\n":" v_normal = u_normalMatrix * a_normal;\n",_+="varying vec3 v_normal;\n"),C&&(D.a_texcoord_0={semantic:"TEXCOORD_0"},g+="attribute vec2 a_texcoord_0;\n",g+="varying vec2 "+(P="v_texcoord_0")+";\n",b+=" "+P+" = a_texcoord_0;\n",_+="varying vec2 "+P+";\n"),p&&(D.a_joint={semantic:"JOINTS_0"},D.a_weight={semantic:"WEIGHTS_0"},g+="attribute vec4 a_joint;\n",g+="attribute vec4 a_weight;\n"),f&&(D.a_vertexColor={semantic:"COLOR_0"},g+="attribute vec4 a_vertexColor;\n",g+="varying vec4 v_vertexColor;\n",b+=" v_vertexColor = a_vertexColor;\n",_+="varying vec4 v_vertexColor;\n"),a&&(D.a_batchId={semantic:"_BATCHID"},g+="attribute float a_batchId;\n");var w=y&&("BLINN"===u||"PHONG"===u)&&defined(v.u_specular)&&defined(v.u_shininess)&&v.u_shininess>0,M=!1,I=!1,R="";for(var O in o)if(o.hasOwnProperty(O)){var B=o[O],L=B.type.toLowerCase(),F=B.baseName;R+=" {\n";var N,V,k="u_"+F+"Color";"ambient"===L?(I=!0,R+=" ambientLight += "+k+";\n"):y&&(M=!0,N="v_"+F+"Direction",V="v_"+F+"Position","point"!==L&&(g+="varying vec3 "+N+";\n",_+="varying vec3 "+N+";\n",b+=" "+N+" = mat3(u_"+F+"Transform) * vec3(0.,0.,1.);\n","directional"===L&&(R+=" vec3 l = normalize("+N+");\n")),"directional"!==L?(g+="varying vec3 "+V+";\n",_+="varying vec3 "+V+";\n",b+=" "+V+" = u_"+F+"Transform[3].xyz;\n",R+=" vec3 VP = "+V+" - v_positionEC;\n",R+=" vec3 l = normalize(VP);\n",R+=" float range = length(VP);\n",R+=" float attenuation = 1.0 / (u_"+F+"Attenuation.x + ",R+="(u_"+F+"Attenuation.y * range) + ",R+="(u_"+F+"Attenuation.z * range * range));\n"):R+=" float attenuation = 1.0;\n","spot"===L&&(R+=" float spotDot = dot(l, normalize("+N+"));\n",R+=" if (spotDot < cos(u_"+F+"FallOff.x * 0.5))\n",R+=" {\n",R+=" attenuation = 0.0;\n",R+=" }\n",R+=" else\n",R+=" {\n",R+=" attenuation *= max(0.0, pow(spotDot, u_"+F+"FallOff.y));\n",R+=" }\n"),R+=" diffuseLight += "+k+"* max(dot(normal,l), 0.) * attenuation;\n",w&&("BLINN"===u?(R+=" vec3 h = normalize(l + viewDir);\n",R+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess)) * attenuation;\n"):(R+=" vec3 reflectDir = reflect(-l, normal);\n",R+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation;\n"),R+=" specularLight += "+k+" * specularIntensity;\n")),R+=" }\n"}if(I||(R+=" ambientLight += vec3(0.2, 0.2, 0.2);\n"),!M&&"CONSTANT"!==u){_+="#ifdef USE_CUSTOM_LIGHT_COLOR \n",_+="uniform vec3 gltf_lightColor; \n",_+="#endif \n",R+="#ifndef USE_CUSTOM_LIGHT_COLOR \n",R+=" vec3 lightColor = czm_lightColor;\n",R+="#else \n",R+=" vec3 lightColor = gltf_lightColor;\n",R+="#endif \n",R+=" vec3 l = normalize(czm_lightDirectionEC);\n";R+=" diffuseLight += lightColor * max(dot(normal,l), 0.2);\n",w&&("BLINN"===u?(R+=" vec3 h = normalize(l + viewDir);\n",R+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess));\n"):(R+=" vec3 reflectDir = reflect(-l, normal);\n",R+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess));\n"),R+=" specularLight += lightColor * specularIntensity;\n")}g+="void main(void) {\n",g+=b,g+="}\n",_+="void main(void) {\n";var U,G=" vec3 color = vec3(0.0, 0.0, 0.0);\n";y&&(_+=" vec3 normal = normalize(v_normal);\n",r.doubleSided&&(_+=" if (czm_backFacing())\n",_+=" {\n",_+=" normal = -normal;\n",_+=" }\n")),"CONSTANT"!==u?(defined(v.u_diffuse)&&(v.u_diffuse.type===WebGLConstants$1.SAMPLER_2D?_+=" vec4 diffuse = texture2D(u_diffuse, "+P+");\n":_+=" vec4 diffuse = u_diffuse;\n",_+=" vec3 diffuseLight = vec3(0.0, 0.0, 0.0);\n",G+=" color += diffuse.rgb * diffuseLight;\n"),w&&(v.u_specular.type===WebGLConstants$1.SAMPLER_2D?_+=" vec3 specular = texture2D(u_specular, "+P+").rgb;\n":_+=" vec3 specular = u_specular.rgb;\n",_+=" vec3 specularLight = vec3(0.0, 0.0, 0.0);\n",G+=" color += specular * specularLight;\n"),U=defined(v.u_transparency)?" gl_FragColor = vec4(color * diffuse.a * u_transparency, diffuse.a * u_transparency);\n":" gl_FragColor = vec4(color * diffuse.a, diffuse.a);\n"):U=defined(v.u_transparency)?" gl_FragColor = vec4(color * u_transparency, u_transparency);\n":" gl_FragColor = vec4(color, 1.0);\n",f&&(G+=" color *= v_vertexColor.rgb;\n"),defined(v.u_emission)&&(v.u_emission.type===WebGLConstants$1.SAMPLER_2D?_+=" vec3 emission = texture2D(u_emission, "+P+").rgb;\n":_+=" vec3 emission = u_emission.rgb;\n",G+=" color += emission;\n"),(defined(v.u_ambient)||"CONSTANT"!==u)&&(defined(v.u_ambient)?v.u_ambient.type===WebGLConstants$1.SAMPLER_2D?_+=" vec3 ambient = texture2D(u_ambient, "+P+").rgb;\n":_+=" vec3 ambient = u_ambient.rgb;\n":_+=" vec3 ambient = diffuse.rgb;\n",G+=" color += ambient * ambientLight;\n"),_+=" vec3 viewDir = -normalize(v_positionEC);\n",_+=" vec3 ambientLight = vec3(0.0, 0.0, 0.0);\n",_+=R,_+=G,_+=U,_+="}\n";var $=addToArray(l,{type:WebGLConstants$1.VERTEX_SHADER,extras:{_pipeline:{source:g,extension:".glsl"}}}),z=addToArray(l,{type:WebGLConstants$1.FRAGMENT_SHADER,extras:{_pipeline:{source:_,extension:".glsl"}}}),H=addToArray(c,{fragmentShader:z,vertexShader:$});return addToArray(s,{attributes:D,program:H,uniforms:v})}function getKHRMaterialsCommonValueType(e,t){var i;switch(i=defined(t.value)?t.value:defined(t.index)?[t.index]:t,e){case"ambient":case"diffuse":case"emission":case"specular":return 1===i.length?WebGLConstants$1.SAMPLER_2D:WebGLConstants$1.FLOAT_VEC4;case"shininess":case"transparency":return WebGLConstants$1.FLOAT;case"transparent":case"doubleSided":return WebGLConstants$1.BOOL}}function getTechniqueKey(e,t){var i="";i+="technique:"+e.technique+";";for(var r=e.values,n=Object.keys(r).sort(),a=n.length,o=0;o<a;++o){var s=n[o];r.hasOwnProperty(s)&&(i+=s+":"+getKHRMaterialsCommonValueType(s,r[s]),i+=";")}var l=defaultValue(e.jointCount,0);if(i+=l.toString()+";",defined(t)){var c=t.skinning;l>0&&(i+=c.type+";"),i+=t.hasVertexColors}return i}function lightDefaults(e){var t=e.extensions.KHR_materials_common;if(defined(t)&&defined(t.lights))for(var i=t.lights,r=i.length,n=0;n<r;n++){var a=i[n];if("ambient"===a.type){defined(a.ambient)||(a.ambient={});var o=a.ambient;defined(o.color)||(o.color=[1,1,1])}else if("directional"===a.type){defined(a.directional)||(a.directional={});var s=a.directional;defined(s.color)||(s.color=[1,1,1])}else if("point"===a.type){defined(a.point)||(a.point={});var l=a.point;defined(l.color)||(l.color=[1,1,1]),l.constantAttenuation=defaultValue(l.constantAttenuation,1),l.linearAttenuation=defaultValue(l.linearAttenuation,0),l.quadraticAttenuation=defaultValue(l.quadraticAttenuation,0)}else if("spot"===a.type){defined(a.spot)||(a.spot={});var c=a.spot;defined(c.color)||(c.color=[1,1,1]),c.constantAttenuation=defaultValue(c.constantAttenuation,1),c.fallOffAngle=defaultValue(c.fallOffAngle,3.14159265),c.fallOffExponent=defaultValue(c.fallOffExponent,0),c.linearAttenuation=defaultValue(c.linearAttenuation,0),c.quadraticAttenuation=defaultValue(c.quadraticAttenuation,0)}}}function processPbrMaterials(e,t){if(t=defaultValue(t,defaultValue.EMPTY_OBJECT),usesExtension(e,"KHR_techniques_webgl"))return e;if(!defined(e.materials)||0===e.materials.length)return e;defined(e.extensions)||(e.extensions={}),defined(e.extensionsUsed)||(e.extensionsUsed=[]),defined(e.extensionsRequired)||(e.extensionsRequired=[]),e.extensions.KHR_techniques_webgl={programs:[],shaders:[],techniques:[]},e.extensionsUsed.push("KHR_techniques_webgl"),e.extensionsRequired.push("KHR_techniques_webgl");var i=ModelUtility.splitIncompatibleMaterials(e);return ForEach.material(e,(function(r,n){var a={},o=generateTechnique(e,r,n,a,i,t);defined(r.extensions)||(r.extensions={}),r.extensions.KHR_techniques_webgl={values:a,technique:o}})),ModelUtility.ensureSemanticExistence(e),e}function isSpecularGlossinessMaterial(e){return defined(e.extensions)&&defined(e.extensions.KHR_materials_pbrSpecularGlossiness)}function addTextureCoordinates(e,t,i,r,n){var a,o=i[t];return defined(o)&&defined(o.texCoord)&&1===o.texCoord&&(r=r.replace("0","1")),defined(i[t+"Offset"])?(a=t+"Coord",n.fragmentShaderMain+=" vec2 "+a+" = computeTexCoord("+r+", "+t+"Offset, "+t+"Rotation, "+t+"Scale);\n"):a=r,a}ModelUtility.getGltfSemanticUniforms=function(){return gltfSemanticUniforms$1};var DEFAULT_TEXTURE_OFFSET=[0,0],DEFAULT_TEXTURE_ROTATION=[0],DEFAULT_TEXTURE_SCALE=[1,1];function handleKHRTextureTransform(e,t,i){if(-1!==e.indexOf("Texture")&&defined(t.extensions)&&defined(t.extensions.KHR_texture_transform)){var r="u_"+e,n=t.extensions.KHR_texture_transform;i[r+"Offset"]=defaultValue(n.offset,DEFAULT_TEXTURE_OFFSET),i[r+"Rotation"]=defaultValue(n.rotation,DEFAULT_TEXTURE_ROTATION),i[r+"Scale"]=defaultValue(n.scale,DEFAULT_TEXTURE_SCALE),defined(t.texCoord)&&defined(n.texCoord)&&(i[r].texCoord=n.texCoord)}}function generateTechnique(e,t,i,r,n,a){var o,s,l,c=defaultValue(a.addBatchIdToGeneratedShaders,!1),u=e.extensions.KHR_techniques_webgl,d=u.techniques,h=u.shaders,p=u.programs,f=isSpecularGlossinessMaterial(t),m=t.pbrMetallicRoughness;if(defined(m)&&!f)for(s in m)m.hasOwnProperty(s)&&(l=m[s],r[o="u_"+s]=l,handleKHRTextureTransform(s,l,r));if(f){var g=t.extensions.KHR_materials_pbrSpecularGlossiness;for(s in g)g.hasOwnProperty(s)&&(l=g[s],r[o="u_"+s]=l,handleKHRTextureTransform(s,l,r))}for(var _ in t)t.hasOwnProperty(_)&&(_.indexOf("Texture")>=0||_.indexOf("Factor")>=0)&&(l=t[_],r[o="u_"+_]=l,handleKHRTextureTransform(_,l,r));var y,v="precision highp float;\n",C="precision highp float;\n";defined(e.skins)&&(y=e.skins[0]);var T,S=defined(y)?y.joints:[],A=S.length,x=n[i],E=!1,b=!1,P=!1,D=!1,w=!1,M=!1,I=!1,R=!1,O=!1;defined(x)&&(E=x.skinning.skinned&&S.length>0,b=x.hasVertexColors,P=x.hasMorphTargets,D=x.hasNormals,w=x.hasTangents,M=x.hasTexCoords,I=x.hasTexCoord1,R=x.hasOutline),P&&ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){if(e.material===i){var t=e.targets;defined(t)&&(T=t)}}))}));var B={u_modelViewMatrix:{semantic:usesExtension(e,"CESIUM_RTC")?"CESIUM_RTC_MODELVIEW":"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4},u_projectionMatrix:{semantic:"PROJECTION",type:WebGLConstants$1.FLOAT_MAT4}};defined(t.extensions)&&defined(t.extensions.KHR_materials_unlit)&&(O=!0),D&&(B.u_normalMatrix={semantic:"MODELVIEWINVERSETRANSPOSE",type:WebGLConstants$1.FLOAT_MAT3}),E&&(B.u_jointMatrix={count:A,semantic:"JOINTMATRIX",type:WebGLConstants$1.FLOAT_MAT4}),P&&(B.u_morphWeights={count:T.length,semantic:"MORPHWEIGHTS",type:WebGLConstants$1.FLOAT});var L=t.alphaMode;for(o in defined(L)&&"MASK"===L&&(B.u_alphaCutoff={semantic:"ALPHACUTOFF",type:WebGLConstants$1.FLOAT}),r)r.hasOwnProperty(o)&&(B[o]={type:getPBRValueType(o)});var F=defaultValue(B.u_baseColorTexture,B.u_baseColorFactor);for(o in defined(F)&&(F.semantic="_3DTILESDIFFUSE"),B)if(B.hasOwnProperty(o)){var N=B[o],V=defined(N.count)?"["+N.count+"]":"";N.type!==WebGLConstants$1.FLOAT_MAT3&&N.type!==WebGLConstants$1.FLOAT_MAT4&&"u_morphWeights"!==o||N.useInFragment?(C+="uniform "+webGLConstantToGlslType(N.type)+" "+o+V+";\n",delete N.useInFragment):v+="uniform "+webGLConstantToGlslType(N.type)+" "+o+V+";\n"}R&&(C+="uniform sampler2D u_outlineTexture;\n");var k="";E&&(k+=" mat4 skinMatrix =\n a_weight.x * u_jointMatrix[int(a_joint.x)] +\n a_weight.y * u_jointMatrix[int(a_joint.y)] +\n a_weight.z * u_jointMatrix[int(a_joint.z)] +\n a_weight.w * u_jointMatrix[int(a_joint.w)];\n");var U={a_position:{semantic:"POSITION"}};if(R&&(U.a_outlineCoordinates={semantic:"_OUTLINE_COORDINATES"}),v+="attribute vec3 a_position;\n",D&&(v+="varying vec3 v_positionEC;\n"),R&&(v+="attribute vec3 a_outlineCoordinates;\n",v+="varying vec3 v_outlineCoordinates;\n"),k+=" vec3 weightedPosition = a_position;\n",D&&(k+=" vec3 weightedNormal = a_normal;\n"),w&&(k+=" vec4 weightedTangent = a_tangent;\n"),P)for(var G=0;G<T.length;G++){var $=T[G];for(var z in $)if($.hasOwnProperty(z)&&"extras"!==z){var H="a_"+z+"_"+G;U[H]={semantic:z+"_"+G},v+="attribute vec3 "+H+";\n","POSITION"===z?k+=" weightedPosition += u_morphWeights["+G+"] * "+H+";\n":"NORMAL"===z?k+=" weightedNormal += u_morphWeights["+G+"] * "+H+";\n":w&&"TANGENT"===z&&(k+=" weightedTangent.xyz += u_morphWeights["+G+"] * "+H+";\n")}}k+=E?" vec4 position = skinMatrix * vec4(weightedPosition, 1.0);\n":" vec4 position = vec4(weightedPosition, 1.0);\n",k+=" position = u_modelViewMatrix * position;\n",D&&(k+=" v_positionEC = position.xyz;\n"),k+=" gl_Position = u_projectionMatrix * position;\n",R&&(k+=" v_outlineCoordinates = a_outlineCoordinates;\n"),D&&(U.a_normal={semantic:"NORMAL"},v+="attribute vec3 a_normal;\n",O||(v+="varying vec3 v_normal;\n",k+=E?" v_normal = u_normalMatrix * mat3(skinMatrix) * weightedNormal;\n":" v_normal = u_normalMatrix * weightedNormal;\n",C+="varying vec3 v_normal;\n"),C+="varying vec3 v_positionEC;\n"),w&&(U.a_tangent={semantic:"TANGENT"},v+="attribute vec4 a_tangent;\n",v+="varying vec4 v_tangent;\n",k+=" v_tangent.xyz = u_normalMatrix * weightedTangent.xyz;\n",k+=" v_tangent.w = weightedTangent.w;\n",C+="varying vec4 v_tangent;\n"),R&&(C+="varying vec3 v_outlineCoordinates;\n");var W,j,q,X,Y,K,J,Q,Z="";if(M){if(U.a_texcoord_0={semantic:"TEXCOORD_0"},W="v_texcoord_0",v+="attribute vec2 a_texcoord_0;\n",v+="varying vec2 v_texcoord_0;\n",k+=" v_texcoord_0 = a_texcoord_0;\n",C+="varying vec2 v_texcoord_0;\n",I){U.a_texcoord_1={semantic:"TEXCOORD_1"};var ee=W.replace("0","1");v+="attribute vec2 a_texcoord_1;\n",v+="varying vec2 "+ee+";\n",k+=" "+ee+" = a_texcoord_1;\n",C+="varying vec2 "+ee+";\n"}var te={fragmentShaderMain:Z};j=addTextureCoordinates(e,"u_normalTexture",r,W,te),q=addTextureCoordinates(e,"u_baseColorTexture",r,W,te),X=addTextureCoordinates(e,"u_specularGlossinessTexture",r,W,te),Y=addTextureCoordinates(e,"u_diffuseTexture",r,W,te),K=addTextureCoordinates(e,"u_metallicRoughnessTexture",r,W,te),J=addTextureCoordinates(e,"u_occlusionTexture",r,W,te),Q=addTextureCoordinates(e,"u_emissiveTexture",r,W,te),Z=te.fragmentShaderMain}E&&(U.a_joint={semantic:"JOINTS_0"},U.a_weight={semantic:"WEIGHTS_0"},v+="attribute vec4 a_joint;\n",v+="attribute vec4 a_weight;\n"),b&&(U.a_vertexColor={semantic:"COLOR_0"},v+="attribute vec4 a_vertexColor;\n",v+="varying vec4 v_vertexColor;\n",k+=" v_vertexColor = a_vertexColor;\n",C+="varying vec4 v_vertexColor;\n"),c&&(U.a_batchId={semantic:"_BATCHID"},v+="attribute float a_batchId;\n"),v+="void main(void) \n{\n",v+=k,v+="}\n",D&&!O&&(C+="const float M_PI = 3.141592653589793;\n",C+="vec3 lambertianDiffuse(vec3 diffuseColor) \n{\n return diffuseColor / M_PI;\n}\n\n",C+="vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH) \n{\n return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n}\n\n",C+="vec3 fresnelSchlick(float metalness, float VdotH) \n{\n return metalness + (vec3(1.0) - metalness) * pow(1.0 - VdotH, 5.0);\n}\n\n",C+="float smithVisibilityG1(float NdotV, float roughness) \n{\n float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\n return NdotV / (NdotV * (1.0 - k) + k);\n}\n\n",C+="float smithVisibilityGGX(float roughness, float NdotL, float NdotV) \n{\n return smithVisibilityG1(NdotL, roughness) * smithVisibilityG1(NdotV, roughness);\n}\n\n",C+="float GGX(float roughness, float NdotH) \n{\n float roughnessSquared = roughness * roughness;\n float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\n return roughnessSquared / (M_PI * f * f);\n}\n\n"),C+="vec3 SRGBtoLINEAR3(vec3 srgbIn) \n{\n return pow(srgbIn, vec3(2.2));\n}\n\n",C+="vec4 SRGBtoLINEAR4(vec4 srgbIn) \n{\n vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\n return vec4(linearOut, srgbIn.a);\n}\n\n",C+="vec3 applyTonemapping(vec3 linearIn) \n{\n#ifndef HDR \n return czm_acesTonemapping(linearIn);\n#else \n return linearIn;\n#endif \n}\n\n",C+="vec3 LINEARtoSRGB(vec3 linearIn) \n{\n#ifndef HDR \n return pow(linearIn, vec3(1.0/2.2));\n#else \n return linearIn;\n#endif \n}\n\n",C+="vec2 computeTexCoord(vec2 texCoords, vec2 offset, float rotation, vec2 scale) \n{\n rotation = -rotation; \n mat3 transform = mat3(\n cos(rotation) * scale.x, sin(rotation) * scale.x, 0.0, \n -sin(rotation) * scale.y, cos(rotation) * scale.y, 0.0, \n offset.x, offset.y, 1.0); \n vec2 transformedTexCoords = (transform * vec3(fract(texCoords), 1.0)).xy; \n return transformedTexCoords; \n}\n\n",C+="#ifdef USE_IBL_LIGHTING \n",C+="uniform vec2 gltf_iblFactor; \n",C+="#endif \n",C+="#ifdef USE_CUSTOM_LIGHT_COLOR \n",C+="uniform vec3 gltf_lightColor; \n",C+="#endif \n",C+="void main(void) \n{\n",C+=Z,D&&!O&&(C+=" vec3 ng = normalize(v_normal);\n",C+=" vec3 positionWC = vec3(czm_inverseView * vec4(v_positionEC, 1.0));\n",defined(r.u_normalTexture)?w?(C+=" vec3 t = normalize(v_tangent.xyz);\n",C+=" vec3 b = normalize(cross(ng, t) * v_tangent.w);\n",C+=" mat3 tbn = mat3(t, b, ng);\n",C+=" vec3 n = texture2D(u_normalTexture, "+j+").rgb;\n",C+=" n = normalize(tbn * (2.0 * n - 1.0));\n"):(C="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n"+C,C+="#ifdef GL_OES_standard_derivatives\n",C+=" vec3 pos_dx = dFdx(v_positionEC);\n",C+=" vec3 pos_dy = dFdy(v_positionEC);\n",C+=" vec3 tex_dx = dFdx(vec3("+j+",0.0));\n",C+=" vec3 tex_dy = dFdy(vec3("+j+",0.0));\n",C+=" vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n",C+=" t = normalize(t - ng * dot(ng, t));\n",C+=" vec3 b = normalize(cross(ng, t));\n",C+=" mat3 tbn = mat3(t, b, ng);\n",C+=" vec3 n = texture2D(u_normalTexture, "+j+").rgb;\n",C+=" n = normalize(tbn * (2.0 * n - 1.0));\n",C+="#else\n",C+=" vec3 n = ng;\n",C+="#endif\n"):C+=" vec3 n = ng;\n",t.doubleSided&&(C+=" if (czm_backFacing())\n",C+=" {\n",C+=" n = -n;\n",C+=" }\n")),defined(r.u_baseColorTexture)?(C+=" vec4 baseColorWithAlpha = SRGBtoLINEAR4(texture2D(u_baseColorTexture, "+q+"));\n",defined(r.u_baseColorFactor)&&(C+=" baseColorWithAlpha *= u_baseColorFactor;\n")):defined(r.u_baseColorFactor)?C+=" vec4 baseColorWithAlpha = u_baseColorFactor;\n":C+=" vec4 baseColorWithAlpha = vec4(1.0);\n",b&&(C+=" baseColorWithAlpha *= v_vertexColor;\n"),C+=" vec3 baseColor = baseColorWithAlpha.rgb;\n",D&&!O?(f?(defined(r.u_specularGlossinessTexture)?(C+=" vec4 specularGlossiness = SRGBtoLINEAR4(texture2D(u_specularGlossinessTexture, "+X+"));\n",C+=" vec3 specular = specularGlossiness.rgb;\n",C+=" float glossiness = specularGlossiness.a;\n",defined(r.u_specularFactor)&&(C+=" specular *= u_specularFactor;\n"),defined(r.u_glossinessFactor)&&(C+=" glossiness *= u_glossinessFactor;\n")):(defined(r.u_specularFactor)?C+=" vec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));\n":C+=" vec3 specular = vec3(1.0);\n",defined(r.u_glossinessFactor)?C+=" float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);\n":C+=" float glossiness = 1.0;\n"),defined(r.u_diffuseTexture)?(C+=" vec4 diffuse = SRGBtoLINEAR4(texture2D(u_diffuseTexture, "+Y+"));\n",defined(r.u_diffuseFactor)&&(C+=" diffuse *= u_diffuseFactor;\n")):defined(r.u_diffuseFactor)?C+=" vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));\n":C+=" vec4 diffuse = vec4(1.0);\n",C+=" baseColorWithAlpha.a = diffuse.a;\n"):defined(r.u_metallicRoughnessTexture)?(C+=" vec3 metallicRoughness = texture2D(u_metallicRoughnessTexture, "+K+").rgb;\n",C+=" float metalness = clamp(metallicRoughness.b, 0.0, 1.0);\n",C+=" float roughness = clamp(metallicRoughness.g, 0.04, 1.0);\n",defined(r.u_metallicFactor)&&(C+=" metalness *= u_metallicFactor;\n"),defined(r.u_roughnessFactor)&&(C+=" roughness *= u_roughnessFactor;\n")):(defined(r.u_metallicFactor)?C+=" float metalness = clamp(u_metallicFactor, 0.0, 1.0);\n":C+=" float metalness = 1.0;\n",defined(r.u_roughnessFactor)?C+=" float roughness = clamp(u_roughnessFactor, 0.04, 1.0);\n":C+=" float roughness = 1.0;\n"),C+=" vec3 v = -normalize(v_positionEC);\n",C+="#ifndef USE_CUSTOM_LIGHT_COLOR \n",C+=" vec3 lightColorHdr = czm_lightColorHdr;\n",C+="#else \n",C+=" vec3 lightColorHdr = gltf_lightColor;\n",C+="#endif \n",C+=" vec3 l = normalize(czm_lightDirectionEC);\n",C+=" vec3 h = normalize(v + l);\n",C+=" float NdotL = clamp(dot(n, l), 0.001, 1.0);\n",C+=" float NdotV = abs(dot(n, v)) + 0.001;\n",C+=" float NdotH = clamp(dot(n, h), 0.0, 1.0);\n",C+=" float LdotH = clamp(dot(l, h), 0.0, 1.0);\n",C+=" float VdotH = clamp(dot(v, h), 0.0, 1.0);\n",C+=" vec3 f0 = vec3(0.04);\n",f?(C+=" float roughness = 1.0 - glossiness;\n",C+=" vec3 diffuseColor = diffuse.rgb * (1.0 - max(max(specular.r, specular.g), specular.b));\n",C+=" vec3 specularColor = specular;\n"):(C+=" vec3 diffuseColor = baseColor * (1.0 - metalness) * (1.0 - f0);\n",C+=" vec3 specularColor = mix(f0, baseColor, metalness);\n"),C+=" float alpha = roughness * roughness;\n",C+=" float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n",C+=" vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\n",C+=" vec3 r0 = specularColor.rgb;\n",C+=" vec3 F = fresnelSchlick2(r0, r90, VdotH);\n",C+=" float G = smithVisibilityGGX(alpha, NdotL, NdotV);\n",C+=" float D = GGX(alpha, NdotH);\n",C+=" vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);\n",C+=" vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);\n",C+=" vec3 color = NdotL * lightColorHdr * (diffuseContribution + specularContribution);\n",C+="#if defined(USE_IBL_LIGHTING) && !defined(DIFFUSE_IBL) && !defined(SPECULAR_IBL) \n",C+=" vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));\n",C+=" float vertexRadius = length(positionWC);\n",C+=" float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);\n",C+=" float reflectionDotNadir = dot(r, normalize(positionWC));\n",C+=" r.x = -r.x;\n",C+=" r = -normalize(czm_temeToPseudoFixed * r);\n",C+=" r.x = -r.x;\n",C+=" float inverseRoughness = 1.04 - roughness;\n",C+=" inverseRoughness *= inverseRoughness;\n",C+=" vec3 sceneSkyBox = textureCube(czm_environmentMap, r).rgb * inverseRoughness;\n",C+=" float atmosphereHeight = 0.05;\n",C+=" float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);\n",C+=" float blendRegionOffset = roughness * -1.0;\n",C+=" float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);\n",C+=" float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);\n",C+=" float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);\n",C+=" float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);\n",C+=" vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);\n",C+=" vec3 nadirColor = belowHorizonColor * 0.5;\n",C+=" vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);\n",C+=" vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);\n",C+=" vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);\n",C+=" vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9);\n",C+=" float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight;\n",C+=" float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));\n",C+=" vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);\n",C+=" float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);\n",C+=" vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);\n",C+=" specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);\n",C+=" specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);\n",C+="#ifdef USE_SUN_LUMINANCE \n",C+=" float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), normalize(positionWC * -1.0)), 0.001, 1.0);\n",C+=" float S = acos(LdotZenith);\n",C+=" float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), normalize(positionWC * -1.0)), 0.001, 1.0);\n",C+=" float gamma = acos(NdotL);\n",C+=" float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));\n",C+=" float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));\n",C+=" float luminance = gltf_luminanceAtZenith * (numerator / denominator);\n",C+="#endif \n",C+=" vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n",C+=" vec3 IBLColor = (diffuseIrradiance * diffuseColor * gltf_iblFactor.x) + (specularIrradiance * SRGBtoLINEAR3(specularColor * brdfLut.x + brdfLut.y) * gltf_iblFactor.y);\n",C+=" float maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z);\n",C+=" vec3 lightColor = lightColorHdr / max(maximumComponent, 1.0);\n",C+=" IBLColor *= lightColor;\n",C+="#ifdef USE_SUN_LUMINANCE \n",C+=" color += IBLColor * luminance;\n",C+="#else \n",C+=" color += IBLColor; \n",C+="#endif \n",C+="#elif defined(DIFFUSE_IBL) || defined(SPECULAR_IBL) \n",C+=" const mat3 yUpToZUp = mat3(-1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0); \n",C+=" vec3 cubeDir = normalize(yUpToZUp * gltf_iblReferenceFrameMatrix * normalize(reflect(-v, n))); \n",C+="#ifdef DIFFUSE_IBL \n",C+="#ifdef CUSTOM_SPHERICAL_HARMONICS \n",C+=" vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, gltf_sphericalHarmonicCoefficients); \n",C+="#else \n",C+=" vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients); \n",C+="#endif \n",C+="#else \n",C+=" vec3 diffuseIrradiance = vec3(0.0); \n",C+="#endif \n",C+="#ifdef SPECULAR_IBL \n",C+=" vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n",C+="#ifdef CUSTOM_SPECULAR_IBL \n",C+=" vec3 specularIBL = czm_sampleOctahedralProjection(gltf_specularMap, gltf_specularMapSize, cubeDir, roughness * gltf_maxSpecularLOD, gltf_maxSpecularLOD);\n",C+="#else \n",C+=" vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);\n",C+="#endif \n",C+=" specularIBL *= F * brdfLut.x + brdfLut.y;\n",C+="#else \n",C+=" vec3 specularIBL = vec3(0.0); \n",C+="#endif \n",C+=" color += diffuseIrradiance * diffuseColor + specularColor * specularIBL;\n",C+="#endif \n"):C+=" vec3 color = baseColor;\n",O||(defined(r.u_occlusionTexture)&&(C+=" color *= texture2D(u_occlusionTexture, "+J+").r;\n"),defined(r.u_emissiveTexture)?(C+=" vec3 emissive = SRGBtoLINEAR3(texture2D(u_emissiveTexture, "+Q+").rgb);\n",defined(r.u_emissiveFactor)&&(C+=" emissive *= u_emissiveFactor;\n"),C+=" color += emissive;\n"):defined(r.u_emissiveFactor)&&(C+=" color += u_emissiveFactor;\n")),O||(C+=" color = applyTonemapping(color);\n"),C+=" color = LINEARtoSRGB(color);\n",R&&(C+=" float outlineness = max(\n",C+=" texture2D(u_outlineTexture, vec2(v_outlineCoordinates.x, 0.5)).r,\n",C+=" max(\n",C+=" texture2D(u_outlineTexture, vec2(v_outlineCoordinates.y, 0.5)).r,\n",C+=" texture2D(u_outlineTexture, vec2(v_outlineCoordinates.z, 0.5)).r));\n",C+=" color = mix(color, vec3(0.0, 0.0, 0.0), outlineness);\n"),defined(L)?"MASK"===L?(C+=" if (baseColorWithAlpha.a < u_alphaCutoff) {\n",C+=" discard;\n",C+=" }\n",C+=" gl_FragColor = vec4(color, 1.0);\n"):C+="BLEND"===L?" gl_FragColor = vec4(color, baseColorWithAlpha.a);\n":" gl_FragColor = vec4(color, 1.0);\n":C+=" gl_FragColor = vec4(color, 1.0);\n",C+="}\n";var ie=addToArray(h,{type:WebGLConstants$1.VERTEX_SHADER,extras:{_pipeline:{source:v,extension:".glsl"}}}),re=addToArray(h,{type:WebGLConstants$1.FRAGMENT_SHADER,extras:{_pipeline:{source:C,extension:".glsl"}}}),ne=addToArray(p,{fragmentShader:re,vertexShader:ie});return addToArray(d,{attributes:U,program:ne,uniforms:B})}function getPBRValueType(e){if(-1!==e.indexOf("Offset"))return WebGLConstants$1.FLOAT_VEC2;if(-1!==e.indexOf("Rotation"))return WebGLConstants$1.FLOAT;if(-1!==e.indexOf("Scale"))return WebGLConstants$1.FLOAT_VEC2;if(-1!==e.indexOf("Texture"))return WebGLConstants$1.SAMPLER_2D;switch(e){case"u_baseColorFactor":case"u_diffuseFactor":return WebGLConstants$1.FLOAT_VEC4;case"u_metallicFactor":case"u_roughnessFactor":case"u_glossinessFactor":return WebGLConstants$1.FLOAT;case"u_emissiveFactor":case"u_specularFactor":return WebGLConstants$1.FLOAT_VEC3}}function Vector3DTileBatch(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}var VectorTileVS="attribute vec3 position;\nattribute float a_batchId;\nuniform mat4 u_modifiedModelViewProjection;\nvoid main()\n{\ngl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));\n}\n",jsep=createCommonjsModule((function(e,t){!function(i){var r="Compound",n="MemberExpression",a="Literal",o=function(e,t){var i=new Error(e+" at character "+t);throw i.index=t,i.description=e,i},s=!0,l={"-":s,"!":s,"~":s,"+":s},c={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},u=function(e){var t,i=0;for(var r in e)(t=r.length)>i&&e.hasOwnProperty(r)&&(i=t);return i},d=u(l),h=u(c),p={true:!0,false:!1,null:null},f=function(e){return c[e]||0},m=function(e,t,i){return{type:"||"===e||"&&"===e?"LogicalExpression":"BinaryExpression",operator:e,left:t,right:i}},g=function(e){return e>=48&&e<=57},_=function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=128&&!c[String.fromCharCode(e)]},y=function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e>=128&&!c[String.fromCharCode(e)]},v=function(e){for(var t,i,s=0,u=e.charAt,v=e.charCodeAt,C=function(t){return u.call(e,t)},T=function(t){return v.call(e,t)},S=e.length,A=function(){for(var e=T(s);32===e||9===e||10===e||13===e;)e=T(++s)},x=function(){var e,t,i=b();return A(),63!==T(s)?i:(s++,(e=x())||o("Expected expression",s),A(),58===T(s)?(s++,(t=x())||o("Expected expression",s),{type:"ConditionalExpression",test:i,consequent:e,alternate:t}):void o("Expected :",s))},E=function(){A();for(var t=e.substr(s,h),i=t.length;i>0;){if(c.hasOwnProperty(t)&&(!_(T(s))||s+t.length<e.length&&!y(T(s+t.length))))return s+=i,t;t=t.substr(0,--i)}return!1},b=function(){var e,t,i,r,n,a,l,c,u;if(a=P(),!(t=E()))return a;for(n={value:t,prec:f(t)},(l=P())||o("Expected expression after "+t,s),r=[a,n,l];(t=E())&&0!==(i=f(t));){for(n={value:t,prec:i},u=t;r.length>2&&i<=r[r.length-2].prec;)l=r.pop(),t=r.pop().value,a=r.pop(),e=m(t,a,l),r.push(e);(e=P())||o("Expected expression after "+u,s),r.push(n,e)}for(e=r[c=r.length-1];c>1;)e=m(r[c-1].value,r[c-2],e),c-=2;return e},P=function(){var t,i,r;if(A(),t=T(s),g(t)||46===t)return D();if(39===t||34===t)return w();if(91===t)return B();for(r=(i=e.substr(s,d)).length;r>0;){if(l.hasOwnProperty(i)&&(!_(T(s))||s+i.length<e.length&&!y(T(s+i.length))))return s+=r,{type:"UnaryExpression",operator:i,argument:P(),prefix:!0};i=i.substr(0,--r)}return!(!_(t)&&40!==t)&&R()},D=function(){for(var e,t,i="";g(T(s));)i+=C(s++);if(46===T(s))for(i+=C(s++);g(T(s));)i+=C(s++);if("e"===(e=C(s))||"E"===e){for(i+=C(s++),"+"!==(e=C(s))&&"-"!==e||(i+=C(s++));g(T(s));)i+=C(s++);g(T(s-1))||o("Expected exponent ("+i+C(s)+")",s)}return t=T(s),_(t)?o("Variable names cannot start with a number ("+i+C(s)+")",s):46===t&&o("Unexpected period",s),{type:a,value:parseFloat(i),raw:i}},w=function(){for(var e,t="",i=C(s++),r=!1;s<S;){if((e=C(s++))===i){r=!0;break}if("\\"===e)switch(e=C(s++)){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=e}else t+=e}return r||o('Unclosed quote after "'+t+'"',s),{type:a,value:t,raw:i+t+i}},M=function(){var t,i=T(s),r=s;for(_(i)?s++:o("Unexpected "+C(s),s);s<S&&(i=T(s),y(i));)s++;return t=e.slice(r,s),p.hasOwnProperty(t)?{type:a,value:p[t],raw:t}:"this"===t?{type:"ThisExpression"}:{type:"Identifier",name:t}},I=function(e){for(var t,i,n=[],a=!1,l=0;s<S;){if(A(),(t=T(s))===e){a=!0,s++,41===e&&l&&l>=n.length&&o("Unexpected token "+String.fromCharCode(e),s);break}if(44===t){if(s++,++l!==n.length)if(41===e)o("Unexpected token ,",s);else if(93===e)for(var c=n.length;c<l;c++)n.push(null)}else(i=x())&&i.type!==r||o("Expected comma",s),n.push(i)}return a||o("Expected "+String.fromCharCode(e),s),n},R=function(){var e,t;for(t=40===(e=T(s))?O():M(),A(),e=T(s);46===e||91===e||40===e;)s++,46===e?(A(),t={type:n,computed:!1,object:t,property:M()}):91===e?(t={type:n,computed:!0,object:t,property:x()},A(),93!==(e=T(s))&&o("Unclosed [",s),s++):40===e&&(t={type:"CallExpression",arguments:I(41),callee:t}),A(),e=T(s);return t},O=function(){s++;var e=x();if(A(),41===T(s))return s++,e;o("Unclosed (",s)},B=function(){return s++,{type:"ArrayExpression",elements:I(93)}},L=[];s<S;)59===(t=T(s))||44===t?s++:(i=x())?L.push(i):s<S&&o('Unexpected "'+C(s)+'"',s);return 1===L.length?L[0]:{type:r,body:L}};v.version="0.3.5",v.toString=function(){return"JavaScript Expression Parser (JSEP) v"+v.version},v.addUnaryOp=function(e){return d=Math.max(e.length,d),l[e]=s,this},v.addBinaryOp=function(e,t){return h=Math.max(e.length,h),c[e]=t,this},v.addLiteral=function(e,t){return p[e]=t,this},v.removeUnaryOp=function(e){return delete l[e],e.length===d&&(d=u(l)),this},v.removeAllUnaryOps=function(){return l={},d=0,this},v.removeBinaryOp=function(e){return delete c[e],e.length===h&&(h=u(c)),this},v.removeAllBinaryOps=function(){return c={},h=0,this},v.removeLiteral=function(e){return delete p[e],this},v.removeAllLiterals=function(){return p={},this},e.exports?t=e.exports=v:t.parse=v}()})),ExpressionNodeType={VARIABLE:0,UNARY:1,BINARY:2,TERNARY:3,CONDITIONAL:4,MEMBER:5,FUNCTION_CALL:6,ARRAY:7,REGEX:8,VARIABLE_IN_STRING:9,LITERAL_NULL:10,LITERAL_BOOLEAN:11,LITERAL_NUMBER:12,LITERAL_STRING:13,LITERAL_COLOR:14,LITERAL_VECTOR:15,LITERAL_REGEX:16,LITERAL_UNDEFINED:17,BUILTIN_VARIABLE:18},ExpressionNodeType$1=Object.freeze(ExpressionNodeType);function Expression(e,t){var i;this._expression=e,e=replaceVariables(removeBackslashes(e=replaceDefines(e,t))),jsep.addBinaryOp("=~",0),jsep.addBinaryOp("!~",0);try{i=jsep(e)}catch(e){throw new RuntimeError(e)}this._runtimeAst=createRuntimeAst(this,i)}Object.defineProperties(Expression.prototype,{expression:{get:function(){return this._expression}}});var scratchStorage={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new Cartesian2],cartesian3Array:[new Cartesian3],cartesian4Array:[new Cartesian4],reset:function(){this.arrayIndex=0,this.cartesian2Index=0,this.cartesian3Index=0,this.cartesian4Index=0},getArray:function(){this.arrayIndex>=this.arrayArray.length&&this.arrayArray.push([]);var e=this.arrayArray[this.arrayIndex++];return e.length=0,e},getCartesian2:function(){return this.cartesian2Index>=this.cartesian2Array.length&&this.cartesian2Array.push(new Cartesian2),this.cartesian2Array[this.cartesian2Index++]},getCartesian3:function(){return this.cartesian3Index>=this.cartesian3Array.length&&this.cartesian3Array.push(new Cartesian3),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new Cartesian4),this.cartesian4Array[this.cartesian4Index++]}};Expression.prototype.evaluate=function(e,t){scratchStorage.reset();var i=this._runtimeAst.evaluate(e);return t instanceof Color&&i instanceof Cartesian4?Color.fromCartesian4(i,t):i instanceof Cartesian2||i instanceof Cartesian3||i instanceof Cartesian4?i.clone(t):i},Expression.prototype.evaluateColor=function(e,t){scratchStorage.reset();var i=this._runtimeAst.evaluate(e);return Color.fromCartesian4(i,t)},Expression.prototype.getShaderFunction=function(e,t,i,r){var n=this.getShaderExpression(t,i);return n=r+" "+e+"\n{\n return "+n+";\n}\n"},Expression.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)},Expression.prototype.getVariables=function(){var e=[];return this._runtimeAst.getVariables(e),e=e.filter((function(e,t,i){return i.indexOf(e)===t})),e};var unaryOperators=["!","-","+"],binaryOperators=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],variableRegex=/\${(.*?)}/g,backslashRegex=/\\/g,backslashReplacement="@#%",replacementRegex=/@#%/g,scratchColor$m=new Color,unaryFunctions={abs:getEvaluateUnaryComponentwise(Math.abs),sqrt:getEvaluateUnaryComponentwise(Math.sqrt),cos:getEvaluateUnaryComponentwise(Math.cos),sin:getEvaluateUnaryComponentwise(Math.sin),tan:getEvaluateUnaryComponentwise(Math.tan),acos:getEvaluateUnaryComponentwise(Math.acos),asin:getEvaluateUnaryComponentwise(Math.asin),atan:getEvaluateUnaryComponentwise(Math.atan),radians:getEvaluateUnaryComponentwise(CesiumMath.toRadians),degrees:getEvaluateUnaryComponentwise(CesiumMath.toDegrees),sign:getEvaluateUnaryComponentwise(CesiumMath.sign),floor:getEvaluateUnaryComponentwise(Math.floor),ceil:getEvaluateUnaryComponentwise(Math.ceil),round:getEvaluateUnaryComponentwise(Math.round),exp:getEvaluateUnaryComponentwise(Math.exp),exp2:getEvaluateUnaryComponentwise(exp2),log:getEvaluateUnaryComponentwise(Math.log),log2:getEvaluateUnaryComponentwise(log2),fract:getEvaluateUnaryComponentwise(fract),length:length$1,normalize:normalize$1},binaryFunctions={atan2:getEvaluateBinaryComponentwise(Math.atan2,!1),pow:getEvaluateBinaryComponentwise(Math.pow,!1),min:getEvaluateBinaryComponentwise(Math.min,!0),max:getEvaluateBinaryComponentwise(Math.max,!0),distance:distance,dot:dot,cross:cross},ternaryFunctions={clamp:getEvaluateTernaryComponentwise(CesiumMath.clamp,!0),mix:getEvaluateTernaryComponentwise(CesiumMath.lerp,!0)};function fract(e){return e-Math.floor(e)}function exp2(e){return Math.pow(2,e)}function log2(e){return CesiumMath.log2(e)}function getEvaluateUnaryComponentwise(e){return function(t,i){if("number"==typeof i)return e(i);if(i instanceof Cartesian2)return Cartesian2.fromElements(e(i.x),e(i.y),scratchStorage.getCartesian2());if(i instanceof Cartesian3)return Cartesian3.fromElements(e(i.x),e(i.y),e(i.z),scratchStorage.getCartesian3());if(i instanceof Cartesian4)return Cartesian4.fromElements(e(i.x),e(i.y),e(i.z),e(i.w),scratchStorage.getCartesian4());throw new RuntimeError('Function "'+t+'" requires a vector or number argument. Argument is '+i+".")}}function getEvaluateBinaryComponentwise(e,t){return function(i,r,n){if(t&&"number"==typeof n){if("number"==typeof r)return e(r,n);if(r instanceof Cartesian2)return Cartesian2.fromElements(e(r.x,n),e(r.y,n),scratchStorage.getCartesian2());if(r instanceof Cartesian3)return Cartesian3.fromElements(e(r.x,n),e(r.y,n),e(r.z,n),scratchStorage.getCartesian3());if(r instanceof Cartesian4)return Cartesian4.fromElements(e(r.x,n),e(r.y,n),e(r.z,n),e(r.w,n),scratchStorage.getCartesian4())}if("number"==typeof r&&"number"==typeof n)return e(r,n);if(r instanceof Cartesian2&&n instanceof Cartesian2)return Cartesian2.fromElements(e(r.x,n.x),e(r.y,n.y),scratchStorage.getCartesian2());if(r instanceof Cartesian3&&n instanceof Cartesian3)return Cartesian3.fromElements(e(r.x,n.x),e(r.y,n.y),e(r.z,n.z),scratchStorage.getCartesian3());if(r instanceof Cartesian4&&n instanceof Cartesian4)return Cartesian4.fromElements(e(r.x,n.x),e(r.y,n.y),e(r.z,n.z),e(r.w,n.w),scratchStorage.getCartesian4());throw new RuntimeError('Function "'+i+'" requires vector or number arguments of matching types. Arguments are '+r+" and "+n+".")}}function getEvaluateTernaryComponentwise(e,t){return function(i,r,n,a){if(t&&"number"==typeof a){if("number"==typeof r&&"number"==typeof n)return e(r,n,a);if(r instanceof Cartesian2&&n instanceof Cartesian2)return Cartesian2.fromElements(e(r.x,n.x,a),e(r.y,n.y,a),scratchStorage.getCartesian2());if(r instanceof Cartesian3&&n instanceof Cartesian3)return Cartesian3.fromElements(e(r.x,n.x,a),e(r.y,n.y,a),e(r.z,n.z,a),scratchStorage.getCartesian3());if(r instanceof Cartesian4&&n instanceof Cartesian4)return Cartesian4.fromElements(e(r.x,n.x,a),e(r.y,n.y,a),e(r.z,n.z,a),e(r.w,n.w,a),scratchStorage.getCartesian4())}if("number"==typeof r&&"number"==typeof n&&"number"==typeof a)return e(r,n,a);if(r instanceof Cartesian2&&n instanceof Cartesian2&&a instanceof Cartesian2)return Cartesian2.fromElements(e(r.x,n.x,a.x),e(r.y,n.y,a.y),scratchStorage.getCartesian2());if(r instanceof Cartesian3&&n instanceof Cartesian3&&a instanceof Cartesian3)return Cartesian3.fromElements(e(r.x,n.x,a.x),e(r.y,n.y,a.y),e(r.z,n.z,a.z),scratchStorage.getCartesian3());if(r instanceof Cartesian4&&n instanceof Cartesian4&&a instanceof Cartesian4)return Cartesian4.fromElements(e(r.x,n.x,a.x),e(r.y,n.y,a.y),e(r.z,n.z,a.z),e(r.w,n.w,a.w),scratchStorage.getCartesian4());throw new RuntimeError('Function "'+i+'" requires vector or number arguments of matching types. Arguments are '+r+", "+n+", and "+a+".")}}function length$1(e,t){if("number"==typeof t)return Math.abs(t);if(t instanceof Cartesian2)return Cartesian2.magnitude(t);if(t instanceof Cartesian3)return Cartesian3.magnitude(t);if(t instanceof Cartesian4)return Cartesian4.magnitude(t);throw new RuntimeError('Function "'+e+'" requires a vector or number argument. Argument is '+t+".")}function normalize$1(e,t){if("number"==typeof t)return 1;if(t instanceof Cartesian2)return Cartesian2.normalize(t,scratchStorage.getCartesian2());if(t instanceof Cartesian3)return Cartesian3.normalize(t,scratchStorage.getCartesian3());if(t instanceof Cartesian4)return Cartesian4.normalize(t,scratchStorage.getCartesian4());throw new RuntimeError('Function "'+e+'" requires a vector or number argument. Argument is '+t+".")}function distance(e,t,i){if("number"==typeof t&&"number"==typeof i)return Math.abs(t-i);if(t instanceof Cartesian2&&i instanceof Cartesian2)return Cartesian2.distance(t,i);if(t instanceof Cartesian3&&i instanceof Cartesian3)return Cartesian3.distance(t,i);if(t instanceof Cartesian4&&i instanceof Cartesian4)return Cartesian4.distance(t,i);throw new RuntimeError('Function "'+e+'" requires vector or number arguments of matching types. Arguments are '+t+" and "+i+".")}function dot(e,t,i){if("number"==typeof t&&"number"==typeof i)return t*i;if(t instanceof Cartesian2&&i instanceof Cartesian2)return Cartesian2.dot(t,i);if(t instanceof Cartesian3&&i instanceof Cartesian3)return Cartesian3.dot(t,i);if(t instanceof Cartesian4&&i instanceof Cartesian4)return Cartesian4.dot(t,i);throw new RuntimeError('Function "'+e+'" requires vector or number arguments of matching types. Arguments are '+t+" and "+i+".")}function cross(e,t,i){if(t instanceof Cartesian3&&i instanceof Cartesian3)return Cartesian3.cross(t,i,scratchStorage.getCartesian3());throw new RuntimeError('Function "'+e+'" requires vec3 arguments. Arguments are '+t+" and "+i+".")}function Node$3(e,t,i,r,n){this._type=e,this._value=t,this._left=i,this._right=r,this._test=n,this.evaluate=void 0,setEvaluateFunction(this)}function replaceDefines(e,t){if(!defined(t))return e;for(var i in t)if(t.hasOwnProperty(i)){var r=new RegExp("\\$\\{"+i+"\\}","g"),n="("+t[i]+")";defined(n)&&(e=e.replace(r,n))}return e}function removeBackslashes(e){return e.replace(backslashRegex,backslashReplacement)}function replaceBackslashes(e){return e.replace(replacementRegex,"\\")}function replaceVariables(e){for(var t=e,i="",r=t.indexOf("${");r>=0;){var n,a=t.indexOf("'"),o=t.indexOf('"');if(a>=0&&a<r)n=t.indexOf("'",a+1),i+=t.substr(0,n+1),r=(t=t.substr(n+1)).indexOf("${");else if(o>=0&&o<r)n=t.indexOf('"',o+1),i+=t.substr(0,n+1),r=(t=t.substr(n+1)).indexOf("${");else{i+=t.substr(0,r);var s=t.indexOf("}");if(s<0)throw new RuntimeError("Unmatched {.");i+="czm_"+t.substr(r+2,s-(r+2)),r=(t=t.substr(s+1)).indexOf("${")}}return i+=t}function parseLiteral(e){var t=typeof e.value;return null===e.value?new Node$3(ExpressionNodeType$1.LITERAL_NULL,null):"boolean"===t?new Node$3(ExpressionNodeType$1.LITERAL_BOOLEAN,e.value):"number"===t?new Node$3(ExpressionNodeType$1.LITERAL_NUMBER,e.value):"string"===t?e.value.indexOf("${")>=0?new Node$3(ExpressionNodeType$1.VARIABLE_IN_STRING,e.value):new Node$3(ExpressionNodeType$1.LITERAL_STRING,replaceBackslashes(e.value)):void 0}function parseCall(e,t){var i,r,n,a,o=t.arguments,s=o.length;if("MemberExpression"===t.callee.type){i=t.callee.property.name;var l=t.callee.object;if("test"===i||"exec"===i){if("regExp"!==l.callee.name)throw new RuntimeError(i+" is not a function.");return 0===s?"test"===i?new Node$3(ExpressionNodeType$1.LITERAL_BOOLEAN,!1):new Node$3(ExpressionNodeType$1.LITERAL_NULL,null):(n=createRuntimeAst(e,l),a=createRuntimeAst(e,o[0]),new Node$3(ExpressionNodeType$1.FUNCTION_CALL,i,n,a))}if("toString"===i)return r=createRuntimeAst(e,l),new Node$3(ExpressionNodeType$1.FUNCTION_CALL,i,r);throw new RuntimeError('Unexpected function call "'+i+'".')}if("color"===(i=t.callee.name)){if(0===s)return new Node$3(ExpressionNodeType$1.LITERAL_COLOR,i);if(r=createRuntimeAst(e,o[0]),defined(o[1])){var c=createRuntimeAst(e,o[1]);return new Node$3(ExpressionNodeType$1.LITERAL_COLOR,i,[r,c])}return new Node$3(ExpressionNodeType$1.LITERAL_COLOR,i,[r])}if("rgb"===i||"hsl"===i){if(s<3)throw new RuntimeError(i+" requires three arguments.");return r=[createRuntimeAst(e,o[0]),createRuntimeAst(e,o[1]),createRuntimeAst(e,o[2])],new Node$3(ExpressionNodeType$1.LITERAL_COLOR,i,r)}if("rgba"===i||"hsla"===i){if(s<4)throw new RuntimeError(i+" requires four arguments.");return r=[createRuntimeAst(e,o[0]),createRuntimeAst(e,o[1]),createRuntimeAst(e,o[2]),createRuntimeAst(e,o[3])],new Node$3(ExpressionNodeType$1.LITERAL_COLOR,i,r)}if("vec2"===i||"vec3"===i||"vec4"===i){r=new Array(s);for(var u=0;u<s;++u)r[u]=createRuntimeAst(e,o[u]);return new Node$3(ExpressionNodeType$1.LITERAL_VECTOR,i,r)}if("isNaN"===i||"isFinite"===i)return 0===s?new Node$3(ExpressionNodeType$1.LITERAL_BOOLEAN,"isNaN"===i):(r=createRuntimeAst(e,o[0]),new Node$3(ExpressionNodeType$1.UNARY,i,r));if("isExactClass"===i||"isClass"===i){if(s<1||s>1)throw new RuntimeError(i+" requires exactly one argument.");return r=createRuntimeAst(e,o[0]),new Node$3(ExpressionNodeType$1.UNARY,i,r)}if("getExactClassName"===i){if(s>0)throw new RuntimeError(i+" does not take any argument.");return new Node$3(ExpressionNodeType$1.UNARY,i)}if(defined(unaryFunctions[i])){if(1!==s)throw new RuntimeError(i+" requires exactly one argument.");return r=createRuntimeAst(e,o[0]),new Node$3(ExpressionNodeType$1.UNARY,i,r)}if(defined(binaryFunctions[i])){if(2!==s)throw new RuntimeError(i+" requires exactly two arguments.");return n=createRuntimeAst(e,o[0]),a=createRuntimeAst(e,o[1]),new Node$3(ExpressionNodeType$1.BINARY,i,n,a)}if(defined(ternaryFunctions[i])){if(3!==s)throw new RuntimeError(i+" requires exactly three arguments.");n=createRuntimeAst(e,o[0]),a=createRuntimeAst(e,o[1]);var d=createRuntimeAst(e,o[2]);return new Node$3(ExpressionNodeType$1.TERNARY,i,n,a,d)}if("Boolean"===i)return 0===s?new Node$3(ExpressionNodeType$1.LITERAL_BOOLEAN,!1):(r=createRuntimeAst(e,o[0]),new Node$3(ExpressionNodeType$1.UNARY,i,r));if("Number"===i)return 0===s?new Node$3(ExpressionNodeType$1.LITERAL_NUMBER,0):(r=createRuntimeAst(e,o[0]),new Node$3(ExpressionNodeType$1.UNARY,i,r));if("String"===i)return 0===s?new Node$3(ExpressionNodeType$1.LITERAL_STRING,""):(r=createRuntimeAst(e,o[0]),new Node$3(ExpressionNodeType$1.UNARY,i,r));if("regExp"===i)return parseRegex(e,t);throw new RuntimeError('Unexpected function call "'+i+'".')}function parseRegex(e,t){var i=t.arguments;if(0===i.length)return new Node$3(ExpressionNodeType$1.LITERAL_REGEX,new RegExp);var r,n=createRuntimeAst(e,i[0]);if(i.length>1){var a=createRuntimeAst(e,i[1]);if(isLiteralType(n)&&isLiteralType(a)){try{r=new RegExp(replaceBackslashes(String(n._value)),a._value)}catch(e){throw new RuntimeError(e)}return new Node$3(ExpressionNodeType$1.LITERAL_REGEX,r)}return new Node$3(ExpressionNodeType$1.REGEX,n,a)}if(isLiteralType(n)){try{r=new RegExp(replaceBackslashes(String(n._value)))}catch(e){throw new RuntimeError(e)}return new Node$3(ExpressionNodeType$1.LITERAL_REGEX,r)}return new Node$3(ExpressionNodeType$1.REGEX,n)}function parseKeywordsAndVariables(e){if(isVariable(e.name)){var t=getPropertyName(e.name);return"tiles3d_"===t.substr(0,8)?new Node$3(ExpressionNodeType$1.BUILTIN_VARIABLE,t):new Node$3(ExpressionNodeType$1.VARIABLE,t)}if("NaN"===e.name)return new Node$3(ExpressionNodeType$1.LITERAL_NUMBER,NaN);if("Infinity"===e.name)return new Node$3(ExpressionNodeType$1.LITERAL_NUMBER,1/0);if("undefined"===e.name)return new Node$3(ExpressionNodeType$1.LITERAL_UNDEFINED,void 0);throw new RuntimeError(e.name+" is not defined.")}function parseMathConstant(e){var t=e.property.name;return"PI"===t?new Node$3(ExpressionNodeType$1.LITERAL_NUMBER,Math.PI):"E"===t?new Node$3(ExpressionNodeType$1.LITERAL_NUMBER,Math.E):void 0}function parseNumberConstant(e){if("POSITIVE_INFINITY"===e.property.name)return new Node$3(ExpressionNodeType$1.LITERAL_NUMBER,Number.POSITIVE_INFINITY)}function parseMemberExpression(e,t){if("Math"===t.object.name)return parseMathConstant(t);if("Number"===t.object.name)return parseNumberConstant(t);var i,r=createRuntimeAst(e,t.object);return t.computed?(i=createRuntimeAst(e,t.property),new Node$3(ExpressionNodeType$1.MEMBER,"brackets",r,i)):(i=new Node$3(ExpressionNodeType$1.LITERAL_STRING,t.property.name),new Node$3(ExpressionNodeType$1.MEMBER,"dot",r,i))}function isLiteralType(e){return e._type>=ExpressionNodeType$1.LITERAL_NULL}function isVariable(e){return"czm_"===e.substr(0,4)}function getPropertyName(e){return e.substr(4)}function createRuntimeAst(e,t){var i,r,n,a;if("Literal"===t.type)i=parseLiteral(t);else if("CallExpression"===t.type)i=parseCall(e,t);else if("Identifier"===t.type)i=parseKeywordsAndVariables(t);else if("UnaryExpression"===t.type){r=t.operator;var o=createRuntimeAst(e,t.argument);if(!(unaryOperators.indexOf(r)>-1))throw new RuntimeError('Unexpected operator "'+r+'".');i=new Node$3(ExpressionNodeType$1.UNARY,r,o)}else if("BinaryExpression"===t.type){if(r=t.operator,n=createRuntimeAst(e,t.left),a=createRuntimeAst(e,t.right),!(binaryOperators.indexOf(r)>-1))throw new RuntimeError('Unexpected operator "'+r+'".');i=new Node$3(ExpressionNodeType$1.BINARY,r,n,a)}else if("LogicalExpression"===t.type)r=t.operator,n=createRuntimeAst(e,t.left),a=createRuntimeAst(e,t.right),binaryOperators.indexOf(r)>-1&&(i=new Node$3(ExpressionNodeType$1.BINARY,r,n,a));else if("ConditionalExpression"===t.type){var s=createRuntimeAst(e,t.test);n=createRuntimeAst(e,t.consequent),a=createRuntimeAst(e,t.alternate),i=new Node$3(ExpressionNodeType$1.CONDITIONAL,"?",n,a,s)}else if("MemberExpression"===t.type)i=parseMemberExpression(e,t);else{if("ArrayExpression"!==t.type)throw"Compound"===t.type?new RuntimeError("Provide exactly one expression."):new RuntimeError("Cannot parse expression.");for(var l=[],c=0;c<t.elements.length;c++)l[c]=createRuntimeAst(e,t.elements[c]);i=new Node$3(ExpressionNodeType$1.ARRAY,l)}return i}function setEvaluateFunction(e){e._type===ExpressionNodeType$1.CONDITIONAL?e.evaluate=e._evaluateConditional:e._type===ExpressionNodeType$1.FUNCTION_CALL?"test"===e._value?e.evaluate=e._evaluateRegExpTest:"exec"===e._value?e.evaluate=e._evaluateRegExpExec:"toString"===e._value&&(e.evaluate=e._evaluateToString):e._type===ExpressionNodeType$1.UNARY?"!"===e._value?e.evaluate=e._evaluateNot:"-"===e._value?e.evaluate=e._evaluateNegative:"+"===e._value?e.evaluate=e._evaluatePositive:"isNaN"===e._value?e.evaluate=e._evaluateNaN:"isFinite"===e._value?e.evaluate=e._evaluateIsFinite:"isExactClass"===e._value?e.evaluate=e._evaluateIsExactClass:"isClass"===e._value?e.evaluate=e._evaluateIsClass:"getExactClassName"===e._value?e.evaluate=e._evaluateGetExactClassName:"Boolean"===e._value?e.evaluate=e._evaluateBooleanConversion:"Number"===e._value?e.evaluate=e._evaluateNumberConversion:"String"===e._value?e.evaluate=e._evaluateStringConversion:defined(unaryFunctions[e._value])&&(e.evaluate=getEvaluateUnaryFunction(e._value)):e._type===ExpressionNodeType$1.BINARY?"+"===e._value?e.evaluate=e._evaluatePlus:"-"===e._value?e.evaluate=e._evaluateMinus:"*"===e._value?e.evaluate=e._evaluateTimes:"/"===e._value?e.evaluate=e._evaluateDivide:"%"===e._value?e.evaluate=e._evaluateMod:"==="===e._value?e.evaluate=e._evaluateEqualsStrict:"!=="===e._value?e.evaluate=e._evaluateNotEqualsStrict:"<"===e._value?e.evaluate=e._evaluateLessThan:"<="===e._value?e.evaluate=e._evaluateLessThanOrEquals:">"===e._value?e.evaluate=e._evaluateGreaterThan:">="===e._value?e.evaluate=e._evaluateGreaterThanOrEquals:"&&"===e._value?e.evaluate=e._evaluateAnd:"||"===e._value?e.evaluate=e._evaluateOr:"=~"===e._value?e.evaluate=e._evaluateRegExpMatch:"!~"===e._value?e.evaluate=e._evaluateRegExpNotMatch:defined(binaryFunctions[e._value])&&(e.evaluate=getEvaluateBinaryFunction(e._value)):e._type===ExpressionNodeType$1.TERNARY?e.evaluate=getEvaluateTernaryFunction(e._value):e._type===ExpressionNodeType$1.MEMBER?"brackets"===e._value?e.evaluate=e._evaluateMemberBrackets:e.evaluate=e._evaluateMemberDot:e._type===ExpressionNodeType$1.ARRAY?e.evaluate=e._evaluateArray:e._type===ExpressionNodeType$1.VARIABLE?e.evaluate=e._evaluateVariable:e._type===ExpressionNodeType$1.VARIABLE_IN_STRING?e.evaluate=e._evaluateVariableString:e._type===ExpressionNodeType$1.LITERAL_COLOR?e.evaluate=e._evaluateLiteralColor:e._type===ExpressionNodeType$1.LITERAL_VECTOR?e.evaluate=e._evaluateLiteralVector:e._type===ExpressionNodeType$1.LITERAL_STRING?e.evaluate=e._evaluateLiteralString:e._type===ExpressionNodeType$1.REGEX?e.evaluate=e._evaluateRegExp:e._type===ExpressionNodeType$1.BUILTIN_VARIABLE?"tiles3d_tileset_time"===e._value&&(e.evaluate=evaluateTilesetTime):e.evaluate=e._evaluateLiteral}function evaluateTilesetTime(e){return defined(e)?e.content.tileset.timeSinceLoad:0}function getEvaluateUnaryFunction(e){var t=unaryFunctions[e];return function(i){var r=this._left.evaluate(i);return t(e,r)}}function getEvaluateBinaryFunction(e){var t=binaryFunctions[e];return function(i){var r=this._left.evaluate(i),n=this._right.evaluate(i);return t(e,r,n)}}function getEvaluateTernaryFunction(e){var t=ternaryFunctions[e];return function(i){var r=this._left.evaluate(i),n=this._right.evaluate(i),a=this._test.evaluate(i);return t(e,r,n,a)}}function getFeatureProperty(e,t){if(defined(e))return e.getPropertyInherited(t)}function checkFeature(e){return"feature"===e._value}function convertHSLToRGB(e){for(var t=e._left,i=t.length,r=0;r<i;++r)if(t[r]._type!==ExpressionNodeType$1.LITERAL_NUMBER)return;var n=t[0]._value,a=t[1]._value,o=t[2]._value,s=4===i?t[3]._value:1;return Color.fromHsl(n,a,o,s,scratchColor$m)}function convertRGBToColor(e){for(var t=e._left,i=t.length,r=0;r<i;++r)if(t[r]._type!==ExpressionNodeType$1.LITERAL_NUMBER)return;var n=scratchColor$m;return n.red=t[0]._value/255,n.green=t[1]._value/255,n.blue=t[2]._value/255,n.alpha=4===i?t[3]._value:1,n}function numberToString(e){return e%1==0?e.toFixed(1):e.toString()}function colorToVec3(e){return"vec3("+numberToString(e.red)+", "+numberToString(e.green)+", "+numberToString(e.blue)+")"}function colorToVec4(e){return"vec4("+numberToString(e.red)+", "+numberToString(e.green)+", "+numberToString(e.blue)+", "+numberToString(e.alpha)+")"}function getExpressionArray(e,t,i,r){for(var n=e.length,a=new Array(n),o=0;o<n;++o)a[o]=e[o].getShaderExpression(t,i,r);return a}function getVariableName(e,t){return defined(t[e])?t[e]:Expression.NULL_SENTINEL}function Vector3DTilePrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._positions=e.positions,this._vertexBatchIds=e.vertexBatchIds,this._indices=e.indices,this._indexCounts=e.indexCounts,this._indexOffsets=e.indexOffsets,this._batchedIndices=e.batchedIndices,this._boundingVolume=e.boundingVolume,this._boundingVolumes=e.boundingVolumes,this._center=defaultValue(e.center,Cartesian3.ZERO),this._va=void 0,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._uniformMap=void 0,this._vaSwap=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._rsWireframe=void 0,this._commands=[],this._commandsIgnoreShow=[],this._pickCommands=[],this._constantColor=Color.clone(Color.WHITE),this._highlightColor=this._constantColor,this._batchDirty=!0,this._pickCommandsDirty=!0,this._framesSinceLastRebatch=0,this._updatingAllCommands=!1,this._trianglesLength=this._indices.length/3,this._geometryByteLength=this._indices.byteLength+this._positions.byteLength+this._vertexBatchIds.byteLength,this.debugWireframe=!1,this._debugWireframe=this.debugWireframe,this._wireframeDirty=!1,this.forceRebatch=!1,this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this._vertexShaderSource=e._vertexShaderSource,this._fragmentShaderSource=e._fragmentShaderSource,this._attributeLocations=e._attributeLocations,this._uniformMap=e._uniformMap,this._pickId=e._pickId,this._modelMatrix=e._modelMatrix,this._boundingSphere=e._boundingSphere,this._batchIdLookUp={};for(var t=this._batchIds.length,i=0;i<t;++i){var r=this._batchIds[i];this._batchIdLookUp[r]=i}}Node$3.prototype._evaluateLiteral=function(){return this._value},Node$3.prototype._evaluateLiteralColor=function(e){var t=scratchColor$m,i=this._left;if("color"===this._value)defined(i)?i.length>1?(Color.fromCssColorString(i[0].evaluate(e),t),t.alpha=i[1].evaluate(e)):Color.fromCssColorString(i[0].evaluate(e),t):Color.fromBytes(255,255,255,255,t);else if("rgb"===this._value)Color.fromBytes(i[0].evaluate(e),i[1].evaluate(e),i[2].evaluate(e),255,t);else if("rgba"===this._value){var r=255*i[3].evaluate(e);Color.fromBytes(i[0].evaluate(e),i[1].evaluate(e),i[2].evaluate(e),r,t)}else"hsl"===this._value?Color.fromHsl(i[0].evaluate(e),i[1].evaluate(e),i[2].evaluate(e),1,t):"hsla"===this._value&&Color.fromHsl(i[0].evaluate(e),i[1].evaluate(e),i[2].evaluate(e),i[3].evaluate(e),t);return Cartesian4.fromColor(t,scratchStorage.getCartesian4())},Node$3.prototype._evaluateLiteralVector=function(e){for(var t=scratchStorage.getArray(),i=this._value,r=this._left,n=r.length,a=0;a<n;++a){var o=r[a].evaluate(e);if("number"==typeof o)t.push(o);else if(o instanceof Cartesian2)t.push(o.x,o.y);else if(o instanceof Cartesian3)t.push(o.x,o.y,o.z);else{if(!(o instanceof Cartesian4))throw new RuntimeError(i+" argument must be a vector or number. Argument is "+o+".");t.push(o.x,o.y,o.z,o.w)}}var s=t.length,l=parseInt(i.charAt(3));if(0===s)throw new RuntimeError("Invalid "+i+" constructor. No valid arguments.");if(s<l&&s>1)throw new RuntimeError("Invalid "+i+" constructor. Not enough arguments.");if(s>l&&n>1)throw new RuntimeError("Invalid "+i+" constructor. Too many arguments.");if(1===s){var c=t[0];t.push(c,c,c)}return"vec2"===i?Cartesian2.fromArray(t,0,scratchStorage.getCartesian2()):"vec3"===i?Cartesian3.fromArray(t,0,scratchStorage.getCartesian3()):"vec4"===i?Cartesian4.fromArray(t,0,scratchStorage.getCartesian4()):void 0},Node$3.prototype._evaluateLiteralString=function(){return this._value},Node$3.prototype._evaluateVariableString=function(e){for(var t=this._value,i=variableRegex.exec(t);null!==i;){var r=i[0],n=getFeatureProperty(e,i[1]);defined(n)||(n=""),t=t.replace(r,n),i=variableRegex.exec(t)}return t},Node$3.prototype._evaluateVariable=function(e){return getFeatureProperty(e,this._value)},Node$3.prototype._evaluateMemberDot=function(e){if(checkFeature(this._left))return getFeatureProperty(e,this._right.evaluate(e));var t=this._left.evaluate(e);if(defined(t)){var i=this._right.evaluate(e);if(t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4){if("r"===i)return t.x;if("g"===i)return t.y;if("b"===i)return t.z;if("a"===i)return t.w}return t[i]}},Node$3.prototype._evaluateMemberBrackets=function(e){if(checkFeature(this._left))return getFeatureProperty(e,this._right.evaluate(e));var t=this._left.evaluate(e);if(defined(t)){var i=this._right.evaluate(e);if(t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4){if(0===i||"r"===i)return t.x;if(1===i||"g"===i)return t.y;if(2===i||"b"===i)return t.z;if(3===i||"a"===i)return t.w}return t[i]}},Node$3.prototype._evaluateArray=function(e){for(var t=[],i=0;i<this._value.length;i++)t[i]=this._value[i].evaluate(e);return t},Node$3.prototype._evaluateNot=function(e){var t=this._left.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError('Operator "!" requires a boolean argument. Argument is '+t+".");return!t},Node$3.prototype._evaluateNegative=function(e){var t=this._left.evaluate(e);if(t instanceof Cartesian2)return Cartesian2.negate(t,scratchStorage.getCartesian2());if(t instanceof Cartesian3)return Cartesian3.negate(t,scratchStorage.getCartesian3());if(t instanceof Cartesian4)return Cartesian4.negate(t,scratchStorage.getCartesian4());if("number"==typeof t)return-t;throw new RuntimeError('Operator "-" requires a vector or number argument. Argument is '+t+".")},Node$3.prototype._evaluatePositive=function(e){var t=this._left.evaluate(e);if(!(t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4||"number"==typeof t))throw new RuntimeError('Operator "+" requires a vector or number argument. Argument is '+t+".");return t},Node$3.prototype._evaluateLessThan=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof i)throw new RuntimeError('Operator "<" requires number arguments. Arguments are '+t+" and "+i+".");return t<i},Node$3.prototype._evaluateLessThanOrEquals=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof i)throw new RuntimeError('Operator "<=" requires number arguments. Arguments are '+t+" and "+i+".");return t<=i},Node$3.prototype._evaluateGreaterThan=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof i)throw new RuntimeError('Operator ">" requires number arguments. Arguments are '+t+" and "+i+".");return t>i},Node$3.prototype._evaluateGreaterThanOrEquals=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof i)throw new RuntimeError('Operator ">=" requires number arguments. Arguments are '+t+" and "+i+".");return t>=i},Node$3.prototype._evaluateOr=function(e){var t=this._left.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError('Operator "||" requires boolean arguments. First argument is '+t+".");if(t)return!0;var i=this._right.evaluate(e);if("boolean"!=typeof i)throw new RuntimeError('Operator "||" requires boolean arguments. Second argument is '+i+".");return t||i},Node$3.prototype._evaluateAnd=function(e){var t=this._left.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError('Operator "&&" requires boolean arguments. First argument is '+t+".");if(!t)return!1;var i=this._right.evaluate(e);if("boolean"!=typeof i)throw new RuntimeError('Operator "&&" requires boolean arguments. Second argument is '+i+".");return t&&i},Node$3.prototype._evaluatePlus=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.add(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.add(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.add(t,i,scratchStorage.getCartesian4());if("string"==typeof t||"string"==typeof i)return t+i;if("number"==typeof t&&"number"==typeof i)return t+i;throw new RuntimeError('Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are '+t+" and "+i+".")},Node$3.prototype._evaluateMinus=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.subtract(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.subtract(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.subtract(t,i,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof i)return t-i;throw new RuntimeError('Operator "-" requires vector or number arguments of matching types. Arguments are '+t+" and "+i+".")},Node$3.prototype._evaluateTimes=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.multiplyComponents(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian2&&"number"==typeof t)return Cartesian2.multiplyByScalar(i,t,scratchStorage.getCartesian2());if(t instanceof Cartesian2&&"number"==typeof i)return Cartesian2.multiplyByScalar(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.multiplyComponents(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian3&&"number"==typeof t)return Cartesian3.multiplyByScalar(i,t,scratchStorage.getCartesian3());if(t instanceof Cartesian3&&"number"==typeof i)return Cartesian3.multiplyByScalar(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.multiplyComponents(t,i,scratchStorage.getCartesian4());if(i instanceof Cartesian4&&"number"==typeof t)return Cartesian4.multiplyByScalar(i,t,scratchStorage.getCartesian4());if(t instanceof Cartesian4&&"number"==typeof i)return Cartesian4.multiplyByScalar(t,i,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof i)return t*i;throw new RuntimeError('Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are '+t+" and "+i+".")},Node$3.prototype._evaluateDivide=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.divideComponents(t,i,scratchStorage.getCartesian2());if(t instanceof Cartesian2&&"number"==typeof i)return Cartesian2.divideByScalar(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.divideComponents(t,i,scratchStorage.getCartesian3());if(t instanceof Cartesian3&&"number"==typeof i)return Cartesian3.divideByScalar(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.divideComponents(t,i,scratchStorage.getCartesian4());if(t instanceof Cartesian4&&"number"==typeof i)return Cartesian4.divideByScalar(t,i,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof i)return t/i;throw new RuntimeError('Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are '+t+" and "+i+".")},Node$3.prototype._evaluateMod=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.fromElements(t.x%i.x,t.y%i.y,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.fromElements(t.x%i.x,t.y%i.y,t.z%i.z,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.fromElements(t.x%i.x,t.y%i.y,t.z%i.z,t.w%i.w,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof i)return t%i;throw new RuntimeError('Operator "%" requires vector or number arguments of matching types. Arguments are '+t+" and "+i+".")},Node$3.prototype._evaluateEqualsStrict=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);return i instanceof Cartesian2&&t instanceof Cartesian2||i instanceof Cartesian3&&t instanceof Cartesian3||i instanceof Cartesian4&&t instanceof Cartesian4?t.equals(i):t===i},Node$3.prototype._evaluateNotEqualsStrict=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);return i instanceof Cartesian2&&t instanceof Cartesian2||i instanceof Cartesian3&&t instanceof Cartesian3||i instanceof Cartesian4&&t instanceof Cartesian4?!t.equals(i):t!==i},Node$3.prototype._evaluateConditional=function(e){var t=this._test.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError("Conditional argument of conditional expression must be a boolean. Argument is "+t+".");return t?this._left.evaluate(e):this._right.evaluate(e)},Node$3.prototype._evaluateNaN=function(e){return isNaN(this._left.evaluate(e))},Node$3.prototype._evaluateIsFinite=function(e){return isFinite(this._left.evaluate(e))},Node$3.prototype._evaluateIsExactClass=function(e){return!!defined(e)&&e.isExactClass(this._left.evaluate(e))},Node$3.prototype._evaluateIsClass=function(e){return!!defined(e)&&e.isClass(this._left.evaluate(e))},Node$3.prototype._evaluateGetExactClassName=function(e){if(defined(e))return e.getExactClassName()},Node$3.prototype._evaluateBooleanConversion=function(e){return Boolean(this._left.evaluate(e))},Node$3.prototype._evaluateNumberConversion=function(e){return Number(this._left.evaluate(e))},Node$3.prototype._evaluateStringConversion=function(e){return String(this._left.evaluate(e))},Node$3.prototype._evaluateRegExp=function(e){var t,i=this._value.evaluate(e),r="";defined(this._left)&&(r=this._left.evaluate(e));try{t=new RegExp(i,r)}catch(e){throw new RuntimeError(e)}return t},Node$3.prototype._evaluateRegExpTest=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(!(t instanceof RegExp&&"string"==typeof i))throw new RuntimeError("RegExp.test requires the first argument to be a RegExp and the second argument to be a string. Arguments are "+t+" and "+i+".");return t.test(i)},Node$3.prototype._evaluateRegExpMatch=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(t instanceof RegExp&&"string"==typeof i)return t.test(i);if(i instanceof RegExp&&"string"==typeof t)return i.test(t);throw new RuntimeError('Operator "=~" requires one RegExp argument and one string argument. Arguments are '+t+" and "+i+".")},Node$3.prototype._evaluateRegExpNotMatch=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(t instanceof RegExp&&"string"==typeof i)return!t.test(i);if(i instanceof RegExp&&"string"==typeof t)return!i.test(t);throw new RuntimeError('Operator "!~" requires one RegExp argument and one string argument. Arguments are '+t+" and "+i+".")},Node$3.prototype._evaluateRegExpExec=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(!(t instanceof RegExp&&"string"==typeof i))throw new RuntimeError("RegExp.exec requires the first argument to be a RegExp and the second argument to be a string. Arguments are "+t+" and "+i+".");var r=t.exec(i);return defined(r)?r[1]:null},Node$3.prototype._evaluateToString=function(e){var t=this._left.evaluate(e);if(t instanceof RegExp||t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4)return String(t);throw new RuntimeError('Unexpected function call "'+this._value+'".')},Expression.NULL_SENTINEL="czm_infinity",Node$3.prototype.getShaderExpression=function(e,t,i){var r,n,a,o,s=this._type,l=this._value;switch(defined(this._left)&&(n=Array.isArray(this._left)?getExpressionArray(this._left,e,t,this):this._left.getShaderExpression(e,t,this)),defined(this._right)&&(a=this._right.getShaderExpression(e,t,this)),defined(this._test)&&(o=this._test.getShaderExpression(e,t,this)),Array.isArray(this._value)&&(l=getExpressionArray(this._value,e,t,this)),s){case ExpressionNodeType$1.VARIABLE:if(checkFeature(this))return;return getVariableName(l,e);case ExpressionNodeType$1.UNARY:if("Boolean"===l)return"bool("+n+")";if("Number"===l)return"float("+n+")";if("round"===l)return"floor("+n+" + 0.5)";if(defined(unaryFunctions[l]))return l+"("+n+")";if("isNaN"===l)return"("+n+" != "+n+")";if("isFinite"===l)return"(abs("+n+") < czm_infinity)";if("String"===l||"isExactClass"===l||"isClass"===l||"getExactClassName"===l)throw new RuntimeError('Error generating style shader: "'+l+'" is not supported.');return l+n;case ExpressionNodeType$1.BINARY:return"%"===l?"mod("+n+", "+a+")":"==="===l?"("+n+" == "+a+")":"!=="===l?"("+n+" != "+a+")":"atan2"===l?"atan("+n+", "+a+")":defined(binaryFunctions[l])?l+"("+n+", "+a+")":"("+n+" "+l+" "+a+")";case ExpressionNodeType$1.TERNARY:if(defined(ternaryFunctions[l]))return l+"("+n+", "+a+", "+o+")";break;case ExpressionNodeType$1.CONDITIONAL:return"("+o+" ? "+n+" : "+a+")";case ExpressionNodeType$1.MEMBER:return checkFeature(this._left)?getVariableName(a,e):"r"===a||"x"===a||"0.0"===a?n+"[0]":"g"===a||"y"===a||"1.0"===a?n+"[1]":"b"===a||"z"===a||"2.0"===a?n+"[2]":"a"===a||"w"===a||"3.0"===a?n+"[3]":n+"[int("+a+")]";case ExpressionNodeType$1.FUNCTION_CALL:throw new RuntimeError('Error generating style shader: "'+l+'" is not supported.');case ExpressionNodeType$1.ARRAY:if(4===l.length)return"vec4("+l[0]+", "+l[1]+", "+l[2]+", "+l[3]+")";if(3===l.length)return"vec3("+l[0]+", "+l[1]+", "+l[2]+")";if(2===l.length)return"vec2("+l[0]+", "+l[1]+")";throw new RuntimeError("Error generating style shader: Invalid array length. Array length should be 2, 3, or 4.");case ExpressionNodeType$1.REGEX:throw new RuntimeError("Error generating style shader: Regular expressions are not supported.");case ExpressionNodeType$1.VARIABLE_IN_STRING:throw new RuntimeError("Error generating style shader: Converting a variable to a string is not supported.");case ExpressionNodeType$1.LITERAL_NULL:return Expression.NULL_SENTINEL;case ExpressionNodeType$1.LITERAL_BOOLEAN:return l?"true":"false";case ExpressionNodeType$1.LITERAL_NUMBER:return numberToString(l);case ExpressionNodeType$1.LITERAL_STRING:if(defined(i)&&i._type===ExpressionNodeType$1.MEMBER&&("r"===l||"g"===l||"b"===l||"a"===l||"x"===l||"y"===l||"z"===l||"w"===l||checkFeature(i._left)))return l;if(defined(r=Color.fromCssColorString(l,scratchColor$m)))return colorToVec3(r);throw new RuntimeError("Error generating style shader: String literals are not supported.");case ExpressionNodeType$1.LITERAL_COLOR:var c=n;if("color"===l){if(!defined(c))return"vec4(1.0)";if(c.length>1){var u=c[0],d=c[1];return"1.0"!==d&&(t.translucent=!0),"vec4("+u+", "+d+")"}return"vec4("+c[0]+", 1.0)"}if("rgb"===l)return defined(r=convertRGBToColor(this))?colorToVec4(r):"vec4("+c[0]+" / 255.0, "+c[1]+" / 255.0, "+c[2]+" / 255.0, 1.0)";if("rgba"===l)return"1.0"!==c[3]&&(t.translucent=!0),defined(r=convertRGBToColor(this))?colorToVec4(r):"vec4("+c[0]+" / 255.0, "+c[1]+" / 255.0, "+c[2]+" / 255.0, "+c[3]+")";if("hsl"===l)return defined(r=convertHSLToRGB(this))?colorToVec4(r):"vec4(czm_HSLToRGB(vec3("+c[0]+", "+c[1]+", "+c[2]+")), 1.0)";if("hsla"===l)return defined(r=convertHSLToRGB(this))?(1!==r.alpha&&(t.translucent=!0),colorToVec4(r)):("1.0"!==c[3]&&(t.translucent=!0),"vec4(czm_HSLToRGB(vec3("+c[0]+", "+c[1]+", "+c[2]+")), "+c[3]+")");break;case ExpressionNodeType$1.LITERAL_VECTOR:for(var h=n.length,p=l+"(",f=0;f<h;++f)p+=n[f],f<h-1&&(p+=", ");return p+=")";case ExpressionNodeType$1.LITERAL_REGEX:throw new RuntimeError("Error generating style shader: Regular expressions are not supported.");case ExpressionNodeType$1.LITERAL_UNDEFINED:return Expression.NULL_SENTINEL;case ExpressionNodeType$1.BUILTIN_VARIABLE:if("tiles3d_tileset_time"===l)return"u_time"}},Node$3.prototype.getVariables=function(e,t){var i,r,n,a=this._type,o=this._value;if(defined(this._left))if(Array.isArray(this._left))for(r=(i=this._left).length,n=0;n<r;++n)i[n].getVariables(e,this);else this._left.getVariables(e,this);if(defined(this._right)&&this._right.getVariables(e,this),defined(this._test)&&this._test.getVariables(e,this),Array.isArray(this._value))for(r=(i=this._value).length,n=0;n<r;++n)i[n].getVariables(e,this);switch(a){case ExpressionNodeType$1.VARIABLE:checkFeature(this)||e.push(o);break;case ExpressionNodeType$1.VARIABLE_IN_STRING:for(var s=variableRegex.exec(o);null!==s;)e.push(s[1]),s=variableRegex.exec(o);break;case ExpressionNodeType$1.LITERAL_STRING:defined(t)&&t._type===ExpressionNodeType$1.MEMBER&&checkFeature(t._left)&&e.push(o)}},Object.defineProperties(Vector3DTilePrimitive.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}}});var defaultAttributeLocations={position:0,a_batchId:1};function createVertexArray$5(e,t){if(!defined(e._va)){var i=Buffer$1.createVertexBuffer({context:t,typedArray:e._positions,usage:BufferUsage$1.STATIC_DRAW}),r=Buffer$1.createVertexBuffer({context:t,typedArray:e._vertexBatchIds,usage:BufferUsage$1.STATIC_DRAW}),n=Buffer$1.createIndexBuffer({context:t,typedArray:e._indices,usage:BufferUsage$1.DYNAMIC_DRAW,indexDatatype:2===e._indices.BYTES_PER_ELEMENT?IndexDatatype$1.UNSIGNED_SHORT:IndexDatatype$1.UNSIGNED_INT}),a=[{index:0,vertexBuffer:i,componentDatatype:ComponentDatatype$1.fromTypedArray(e._positions),componentsPerAttribute:3},{index:1,vertexBuffer:r,componentDatatype:ComponentDatatype$1.fromTypedArray(e._vertexBatchIds),componentsPerAttribute:1}];e._va=new VertexArray({context:t,attributes:a,indexBuffer:n}),t.webgl2&&(e._vaSwap=new VertexArray({context:t,attributes:a,indexBuffer:Buffer$1.createIndexBuffer({context:t,sizeInBytes:n.sizeInBytes,usage:BufferUsage$1.DYNAMIC_DRAW,indexDatatype:n.indexDatatype})})),e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._verticesPromise=void 0}}function createShaders$3(e,t){if(!defined(e._sp)){var i=e._batchTable,r=defaultValue(e._attributeLocations,defaultAttributeLocations),n=e._pickId,a=e._vertexShaderSource,o=e._fragmentShaderSource;if(defined(a))return e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:r}),e._spStencil=e._sp,o=(o=ShaderSource.replaceMain(o,"czm_non_pick_main"))+"void main() \n{ \n czm_non_pick_main(); \n gl_FragColor = "+n+"; \n} \n",void(e._spPick=ShaderProgram.fromCache({context:t,vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:r}));var s=i.getVertexShaderCallback(!1,"a_batchId",void 0)(VectorTileVS),l=i.getFragmentShaderCallback(!1,void 0,!0)(ShadowVolumeFS);n=i.getPickId();var c=new ShaderSource({sources:[s]}),u=new ShaderSource({defines:["VECTOR_TILE"],sources:[l]});e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:r}),c=new ShaderSource({sources:[VectorTileVS]}),u=new ShaderSource({defines:["VECTOR_TILE"],sources:[ShadowVolumeFS]}),e._spStencil=ShaderProgram.fromCache({context:t,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:r}),l=(l=ShaderSource.replaceMain(l,"czm_non_pick_main"))+"\nvoid main() \n{ \n czm_non_pick_main(); \n gl_FragColor = "+n+"; \n} \n";var d=new ShaderSource({sources:[s]}),h=new ShaderSource({defines:["VECTOR_TILE"],sources:[l]});e._spPick=ShaderProgram.fromCache({context:t,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:r})}}function getStencilDepthRenderState(e){var t=e?StencilFunction$1.EQUAL:StencilFunction$1.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.DECREMENT_WRAP,zPass:StencilOperation$1.KEEP},backFunction:t,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.INCREMENT_WRAP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},depthMask:!1}}var colorRenderState={stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND},pickRenderState={stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function createRenderStates$4(e){defined(e._rsStencilDepthPass)||(e._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState(!1)),e._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState(!0)),e._rsColorPass=RenderState.fromCache(colorRenderState),e._rsPickPass=RenderState.fromCache(pickRenderState))}var modifiedModelViewScratch$3=new Matrix4,rtcScratch$3=new Cartesian3;function createUniformMap$6(e,t){if(!defined(e._uniformMap)){var i={u_modifiedModelViewProjection:function(){var i=t.uniformState.view,r=t.uniformState.projection;return Matrix4.clone(i,modifiedModelViewScratch$3),Matrix4.multiplyByPoint(modifiedModelViewScratch$3,e._center,rtcScratch$3),Matrix4.setTranslation(modifiedModelViewScratch$3,rtcScratch$3,modifiedModelViewScratch$3),Matrix4.multiply(r,modifiedModelViewScratch$3,modifiedModelViewScratch$3),modifiedModelViewScratch$3},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(i)}}function copyIndicesCPU(e,t,i,r,n,a,o){for(var s=e.constructor.BYTES_PER_ELEMENT,l=a.length,c=0;c<l;++c){var u=o[a[c]],d=r[u],h=n[u],p=new e.constructor(e.buffer,s*d,h);t.set(p,i),r[u]=i,i+=h}return i}function rebatchCPU(e,t){var i=e._indices,r=e._indexOffsets,n=e._indexCounts,a=e._batchIdLookUp,o=new i.constructor(i.length),s=t.pop(),l=[s],c=copyIndicesCPU(i,o,0,r,n,s.batchIds,a);for(s.offset=0,s.count=c;t.length>0;){var u=t.pop();if(Color.equals(u.color,s.color))c=copyIndicesCPU(i,o,c,r,n,u.batchIds,a),s.batchIds=s.batchIds.concat(u.batchIds),s.count=c-s.offset;else{var d=c;c=copyIndicesCPU(i,o,c,r,n,u.batchIds,a),u.offset=d,u.count=c-d,l.push(u),s=u}}e._va.indexBuffer.copyFromArrayView(o),e._indices=o,e._batchedIndices=l}function copyIndicesGPU(e,t,i,r,n,a,o){for(var s=e.bytesPerIndex,l=a.length,c=0;c<l;++c){var u=o[a[c]],d=r[u],h=n[u];t.copyFromBuffer(e,d*s,i*s,h*s),r[u]=i,i+=h}return i}function rebatchGPU(e,t){var i=e._indexOffsets,r=e._indexCounts,n=e._batchIdLookUp,a=t.pop(),o=[a],s=e._va.indexBuffer,l=e._vaSwap.indexBuffer,c=copyIndicesGPU(s,l,0,i,r,a.batchIds,n);for(a.offset=0,a.count=c;t.length>0;){var u=t.pop();if(Color.equals(u.color,a.color))c=copyIndicesGPU(s,l,c,i,r,u.batchIds,n),a.batchIds=a.batchIds.concat(u.batchIds),a.count=c-a.offset;else{var d=c;c=copyIndicesGPU(s,l,c,i,r,u.batchIds,n),u.offset=d,u.count=c-d,o.push(u),a=u}}var h=e._va;e._va=e._vaSwap,e._vaSwap=h,e._batchedIndices=o}function compareColors(e,t){return t.color.toRgba()-e.color.toRgba()}function rebatchCommands(e,t){if(!e._batchDirty)return!1;for(var i=e._batchedIndices,r=i.length,n=!1,a={},o=0;o<r;++o){var s=i[o].color.toRgba();if(defined(a[s])){n=!0;break}a[s]=!0}return n?n&&!e.forceRebatch&&e._framesSinceLastRebatch<120?void++e._framesSinceLastRebatch:(i.sort(compareColors),t.webgl2?rebatchGPU(e,i):rebatchCPU(e,i),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0):(e._batchDirty=!1,!1)}function createColorCommands(e,t){var i=rebatchCommands(e,t),r=e._commands,n=e._batchedIndices,a=n.length,o=2*a;if(!defined(r)||i||r.length!==o){r.length=o;for(var s=e._va,l=e._sp,c=defaultValue(e._modelMatrix,Matrix4.IDENTITY),u=e._uniformMap,d=e._boundingVolume,h=0;h<a;++h){var p=n[h].offset,f=n[h].count,m=r[2*h];defined(m)||(m=r[2*h]=new DrawCommand({owner:e})),m.vertexArray=s,m.modelMatrix=c,m.offset=p,m.count=f,m.renderState=e._rsStencilDepthPass,m.shaderProgram=l,m.uniformMap=u,m.boundingVolume=d,m.cull=!1,m.pass=Pass$1.TERRAIN_CLASSIFICATION;var g=DrawCommand.shallowClone(m,m.derivedCommands.tileset);g.renderState=e._rsStencilDepthPass3DTiles,g.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,m.derivedCommands.tileset=g;var _=r[2*h+1];defined(_)||(_=r[2*h+1]=new DrawCommand({owner:e})),_.vertexArray=s,_.modelMatrix=c,_.offset=p,_.count=f,_.renderState=e._rsColorPass,_.shaderProgram=l,_.uniformMap=u,_.boundingVolume=d,_.cull=!1,_.pass=Pass$1.TERRAIN_CLASSIFICATION;var y=DrawCommand.shallowClone(_,_.derivedCommands.tileset);y.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,_.derivedCommands.tileset=y}e._commandsDirty=!0}}function createColorCommandsIgnoreShow(e,t){if(e.classificationType!==ClassificationType$1.TERRAIN&&t.invertClassification&&(!defined(e._commandsIgnoreShow)||e._commandsDirty)){for(var i=e._commands,r=e._commandsIgnoreShow,n=e._spStencil,a=i.length,o=r.length=a/2,s=0,l=0;l<o;++l){var c=r[l]=DrawCommand.shallowClone(i[s],r[l]);c.shaderProgram=n,c.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,s+=2}e._commandsDirty=!1}}function createPickCommands(e){if(e._pickCommandsDirty){var t=e._indexOffsets.length,i=e._pickCommands;i.length=2*t;for(var r=e._va,n=e._spStencil,a=e._spPick,o=defaultValue(e._modelMatrix,Matrix4.IDENTITY),s=e._uniformMap,l=0;l<t;++l){var c=e._indexOffsets[l],u=e._indexCounts[l],d=defined(e._boundingVolumes)?e._boundingVolumes[l]:e.boundingVolume,h=i[2*l];defined(h)||(h=i[2*l]=new DrawCommand({owner:e,pickOnly:!0})),h.vertexArray=r,h.modelMatrix=o,h.offset=c,h.count=u,h.renderState=e._rsStencilDepthPass,h.shaderProgram=n,h.uniformMap=s,h.boundingVolume=d,h.pass=Pass$1.TERRAIN_CLASSIFICATION;var p=DrawCommand.shallowClone(h,h.derivedCommands.tileset);p.renderState=e._rsStencilDepthPass3DTiles,p.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,h.derivedCommands.tileset=p;var f=i[2*l+1];defined(f)||(f=i[2*l+1]=new DrawCommand({owner:e,pickOnly:!0})),f.vertexArray=r,f.modelMatrix=o,f.offset=c,f.count=u,f.renderState=e._rsPickPass,f.shaderProgram=a,f.uniformMap=s,f.boundingVolume=d,f.pass=Pass$1.TERRAIN_CLASSIFICATION;var m=DrawCommand.shallowClone(f,f.derivedCommands.tileset);m.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,f.derivedCommands.tileset=m}e._pickCommandsDirty=!1}}function clearStyle$3(e,t){e._updatingAllCommands=!0;var i,r=e._batchIds,n=r.length;for(i=0;i<n;++i){var a=t[r[i]];a.show=!0,a.color=Color.WHITE}var o=e._batchedIndices;for(n=o.length,i=0;i<n;++i)o[i].color=Color.clone(Color.WHITE);e._updatingAllCommands=!1,e._batchDirty=!0}Vector3DTilePrimitive.prototype.createFeatures=function(e,t){for(var i=this._batchIds,r=i.length,n=0;n<r;++n){var a=i[n];t[a]=new Cesium3DTileFeature(e,a)}},Vector3DTilePrimitive.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};var scratchColor$l=new Color,DEFAULT_COLOR_VALUE$2=Color.WHITE,DEFAULT_SHOW_VALUE$2=!0,complexExpressionReg=/\$/;function queueCommands$2(e,t,i,r){var n,a,o=e.classificationType,s=o!==ClassificationType$1.CESIUM_3D_TILE,l=o!==ClassificationType$1.TERRAIN,c=t.commandList,u=i.length;for(a=0;a<u;++a)s&&((n=i[a]).pass=Pass$1.TERRAIN_CLASSIFICATION,c.push(n)),l&&((n=i[a].derivedCommands.tileset).pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,c.push(n));if(t.invertClassification&&defined(r))for(u=r.length,a=0;a<u;++a)c.push(r[a])}function queueWireframeCommands(e,t){for(var i=e.commandList,r=t.length,n=0;n<r;n+=2){var a=t[n+1];a.pass=Pass$1.OPAQUE,i.push(a)}}function updateWireframe$2(e){var t=e.debugWireframe===e._debugWireframe;if(!(t=t&&!(e.debugWireframe&&e._wireframeDirty))){var i,r;defined(e._rsWireframe)||(e._rsWireframe=RenderState.fromCache({})),e.debugWireframe?(i=e._rsWireframe,r=PrimitiveType$1.LINES):(i=e._rsColorPass,r=PrimitiveType$1.TRIANGLES);for(var n=e._commands,a=n.length,o=0;o<a;o+=2){var s=n[o+1];s.renderState=i,s.primitiveType=r}e._debugWireframe=e.debugWireframe,e._wireframeDirty=!1}}Vector3DTilePrimitive.prototype.applyStyle=function(e,t){if(defined(e)){var i=e.color,r=i instanceof Expression&&!complexExpressionReg.test(i.expression);this._updatingAllCommands=r;var n,a=this._batchIds,o=a.length;for(n=0;n<o;++n){var s=t[a[n]];s.color=defined(e.color)?e.color.evaluateColor(s,scratchColor$l):DEFAULT_COLOR_VALUE$2,s.show=defined(e.show)?e.show.evaluate(s):DEFAULT_SHOW_VALUE$2}if(r){var l=this._batchedIndices;for(o=l.length,n=0;n<o;++n)l[n].color=Color.clone(Color.WHITE);this._updatingAllCommands=!1,this._batchDirty=!0}}else clearStyle$3(this,t)},Vector3DTilePrimitive.prototype.updateCommands=function(e,t){if(!this._updatingAllCommands){var i=this._batchIdLookUp,r=i[e];if(defined(r)){var n,a=this._indexOffsets,o=this._indexCounts,s=a[r],l=o[r],c=this._batchedIndices,u=c.length;for(n=0;n<u;++n){var d=c[n].offset,h=c[n].count;if(s>=d&&s<d+h)break}c.push(new Vector3DTileBatch({color:Color.clone(t),offset:s,count:l,batchIds:[e]}));for(var p=[],f=[],m=c[n].batchIds,g=m.length,_=0;_<g;++_){var y=m[_];if(y!==e)a[i[y]]<s?p.push(y):f.push(y)}0!==f.length&&c.push(new Vector3DTileBatch({color:Color.clone(c[n].color),offset:s+l,count:c[n].offset+c[n].count-(s+l),batchIds:f})),0!==p.length?(c[n].count=s-c[n].offset,c[n].batchIds=p):c.splice(n,1),this._batchDirty=!0}}},Vector3DTilePrimitive.prototype.update=function(e){var t=e.context;createVertexArray$5(this,t),createShaders$3(this,t),createRenderStates$4(this),createUniformMap$6(this,t);var i=e.passes;i.render&&(createColorCommands(this,t),createColorCommandsIgnoreShow(this,e),updateWireframe$2(this),this._debugWireframe?queueWireframeCommands(e,this._commands):queueCommands$2(this,e,this._commands,this._commandsIgnoreShow)),i.pick&&(createPickCommands(this),queueCommands$2(this,e,this._pickCommands))},Vector3DTilePrimitive.prototype.isDestroyed=function(){return!1},Vector3DTilePrimitive.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaSwap=this._vaSwap&&this._vaSwap.destroy(),destroyObject(this)};var boundingSphereCartesian3Scratch$1=new Cartesian3,ModelState$1=ModelUtility.ModelState;function ClassificationModel(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf;if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),!(t instanceof Uint8Array))throw new RuntimeError("Only binary glTF is supported as a classifier.");updateVersion(t=parseGlb(t)),addDefaults(t),processModelMaterialsCommon(t),processPbrMaterials(t),ForEach.buffer(t,(function(e){if(!defined(e.extras._pipeline.source))throw new RuntimeError("Buffer data must be embedded in the binary gltf.")}));var i=t.nodes,r=t.meshes,n=i[0].mesh;if(1!==i.length||!defined(n))throw new RuntimeError("Only one node is supported for classification and it must have a mesh.");if(1!==r.length)throw new RuntimeError("Only one mesh is supported when using b3dm for classification.");var a=r[0].primitives;if(1!==a.length)throw new RuntimeError("Only one primitive per mesh is supported when using b3dm for classification.");if(!defined(a[0].attributes.POSITION))throw new RuntimeError("The mesh must have a position attribute.");if(!defined(a[0].attributes._BATCHID))throw new RuntimeError("The mesh must have a batch id attribute.");this._gltf=t,this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._ready=!1,this._readyPromise=when.defer(),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=defaultValue(e.debugWireframe,!1),this._debugWireframe=!1,this._classificationType=e.classificationType,this._vertexShaderLoaded=e.vertexShaderLoaded,this._classificationShaderLoaded=e.classificationShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._pickIdLoaded=e.pickIdLoaded,this._ignoreCommands=defaultValue(e.ignoreCommands,!1),this._upAxis=defaultValue(e.upAxis,Axis$1.Y),this._batchTable=e.batchTable,this._computedModelMatrix=new Matrix4,this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new BoundingSphere,this._state=ModelState$1.NEEDS_LOAD,this._loadResources=void 0,this._mode=void 0,this._dirty=!1,this._nodeMatrix=new Matrix4,this._primitive=void 0,this._extensionsUsed=void 0,this._extensionsRequired=void 0,this._quantizedUniforms=void 0,this._buffers={},this._vertexArray=void 0,this._shaderProgram=void 0,this._uniformMap=void 0,this._geometryByteLength=0,this._trianglesLength=0,this._rtcCenter=void 0,this._rtcCenterEye=void 0,this._rtcCenter3D=void 0,this._rtcCenter2D=void 0}function addBuffersToLoadResources$1(e){var t=e.gltf,i=e._loadResources;ForEach.buffer(t,(function(e,t){i.buffers[t]=e.extras._pipeline.source}))}function parseBufferViews$1(e){var t=e.gltf.bufferViews,i=e._loadResources.vertexBuffersToCreate;ForEach.bufferView(e.gltf,(function(e,t){e.target===WebGLConstants$1.ARRAY_BUFFER&&i.enqueue(t)}));var r=e._loadResources.indexBuffersToCreate,n={};ForEach.accessor(e.gltf,(function(e){var i=e.bufferView;t[i].target!==WebGLConstants$1.ELEMENT_ARRAY_BUFFER||defined(n[i])||(n[i]=!0,r.enqueue({id:i,componentType:e.componentType}))}))}function createVertexBuffer$3(e,t){var i=t._loadResources,r=t.gltf.bufferViews[e],n=i.getBuffer(r);t._buffers[e]=n,t._geometryByteLength+=n.byteLength}function createIndexBuffer$2(e,t,i){var r=i._loadResources,n=i.gltf.bufferViews[e],a={typedArray:r.getBuffer(n),indexDatatype:t};i._buffers[e]=a,i._geometryByteLength+=a.typedArray.byteLength}function createBuffers$1(e){var t=e._loadResources;if(0===t.pendingBufferLoads){for(var i=t.vertexBuffersToCreate,r=t.indexBuffersToCreate;i.length>0;)createVertexBuffer$3(i.dequeue(),e);for(;r.length>0;){var n=r.dequeue();createIndexBuffer$2(n.id,n.componentType,e)}}}function modifyShaderForQuantizedAttributes$1(e,t){var i=t.gltf.meshes[0].primitives[0],r=ModelUtility.modifyShaderForQuantizedAttributes(t.gltf,i,e);return t._quantizedUniforms=r.uniforms,r.shader}function modifyShader$1(e,t){return defined(t)&&(e=t(e)),e}function createProgram$1(e){var t=e.gltf,i=ModelUtility.getAttributeOrUniformBySemantic(t,"POSITION"),r=ModelUtility.getAttributeOrUniformBySemantic(t,"_BATCHID"),n={};n[i]=0,n[r]=1;var a,o,s=ModelUtility.getAttributeOrUniformBySemantic(t,"MODELVIEWPROJECTION");if(defined(s))a="uniform mat4 "+s+";\n",o=s+" * vec4("+i+", 1.0)";else{var l=ModelUtility.getAttributeOrUniformBySemantic(t,"PROJECTION"),c=ModelUtility.getAttributeOrUniformBySemantic(t,"MODELVIEW");defined(c)||(c=ModelUtility.getAttributeOrUniformBySemantic(t,"CESIUM_RTC_MODELVIEW")),a="uniform mat4 "+c+";\nuniform mat4 "+l+";\n",o=l+" * "+c+" * vec4("+i+", 1.0)"}var u="attribute vec3 "+i+";\nattribute float "+r+";\n"+a+"void main() {\n"+(" vec4 positionInClipCoords = "+o+";\n")+" gl_Position = czm_depthClamp(positionInClipCoords);\n}\n";e.extensionsUsed.WEB3D_quantized_attributes&&(u=modifyShaderForQuantizedAttributes$1(u,e));var d=modifyShader$1(u,e._vertexShaderLoaded),h=modifyShader$1("#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main() \n{ \n gl_FragColor = vec4(1.0); \n czm_writeDepthClamp();\n}\n",e._classificationShaderLoaded);e._shaderProgram={vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:n}}function getAttributeLocations$2(){return{POSITION:0,_BATCHID:1}}function createVertexArray$4(e){if(e._loadResources.finishedBuffersCreation()&&!defined(e._vertexArray)){var t,i=e._buffers,r=e.gltf,n=r.accessors,a=r.meshes[0].primitives[0],o=getAttributeLocations$2(),s={};if(ForEach.meshPrimitiveAttribute(a,(function(e,t){var a=o[t];if(defined(a)){var l=n[e];s[t]={index:a,vertexBuffer:i[l.bufferView],componentsPerAttribute:numberOfComponentsForType(l.type),componentDatatype:l.componentType,offsetInBytes:l.byteOffset,strideInBytes:getAccessorByteStride(r,l)}}})),defined(a.indices)){var l=n[a.indices];t=i[l.bufferView]}e._vertexArray={attributes:s,indexBuffer:t}}}Object.defineProperties(ClassificationModel.prototype,{gltf:{get:function(){return this._gltf}},boundingSphere:{get:function(){var e=this.modelMatrix,t=Matrix4.getScale(e,boundingSphereCartesian3Scratch$1),i=this._scaledBoundingSphere;return i.center=Cartesian3.multiplyComponents(this._boundingSphere.center,t,i.center),i.radius=Cartesian3.maximumComponent(t)*this._initialRadius,defined(this._rtcCenter)&&Cartesian3.add(this._rtcCenter,i.center,i.center),i}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},dirty:{get:function(){return this._dirty}},extensionsUsed:{get:function(){return defined(this._extensionsUsed)||(this._extensionsUsed=ModelUtility.getUsedExtensions(this.gltf)),this._extensionsUsed}},extensionsRequired:{get:function(){return defined(this._extensionsRequired)||(this._extensionsRequired=ModelUtility.getRequiredExtensions(this.gltf)),this._extensionsRequired}},upAxis:{get:function(){return this._upAxis}},trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},texturesByteLength:{get:function(){return 0}},classificationType:{get:function(){return this._classificationType}}});var gltfSemanticUniforms={PROJECTION:function(e,t){return ModelUtility.getGltfSemanticUniforms().PROJECTION(e,t)},MODELVIEW:function(e,t){return ModelUtility.getGltfSemanticUniforms().MODELVIEW(e,t)},CESIUM_RTC_MODELVIEW:function(e,t){return ModelUtility.getGltfSemanticUniforms().CESIUM_RTC_MODELVIEW(e,t)},MODELVIEWPROJECTION:function(e,t){return ModelUtility.getGltfSemanticUniforms().MODELVIEWPROJECTION(e,t)}};function createUniformMap$5(e,t){if(!defined(e._uniformMap)){var i={};ForEach.technique(e.gltf,(function(r){ForEach.techniqueUniform(r,(function(r,n){defined(r.semantic)&&defined(gltfSemanticUniforms[r.semantic])&&(i[n]=gltfSemanticUniforms[r.semantic](t.uniformState,e))}))})),e._uniformMap=i}}function createUniformsForQuantizedAttributes$1(e,t){return ModelUtility.createUniformsForQuantizedAttributes(e.gltf,t,e._quantizedUniforms)}function triangleCountFromPrimitiveIndices$1(e,t){switch(e.mode){case PrimitiveType$1.TRIANGLES:return t/3;case PrimitiveType$1.TRIANGLE_STRIP:case PrimitiveType$1.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function createPrimitive$2(e){var t,i,r=e._batchTable,n=e._uniformMap,a=e._vertexArray,o=e.gltf,s=o.accessors,l=o.meshes[0].primitives[0],c=s[l.indices],u=l.attributes.POSITION,d=ModelUtility.getAccessorMinMax(o,u),h=BoundingSphere.fromCornerPoints(Cartesian3.fromArray(d.min),Cartesian3.fromArray(d.max));defined(c)?(i=c.count,t=c.byteOffset/IndexDatatype$1.getSizeInBytes(c.componentType)):(i=s[l.attributes.POSITION].count,t=0);(e._trianglesLength+=triangleCountFromPrimitiveIndices$1(l,i),defined(e._uniformMapLoaded)&&(n=e._uniformMapLoaded(n)),e.extensionsUsed.WEB3D_quantized_attributes)&&(n=combine$2(n,createUniformsForQuantizedAttributes$1(e,l)));var p=a.attributes.POSITION,f=p.componentDatatype,m=p.vertexBuffer,g=m.byteOffset,_=m.byteLength/ComponentDatatype$1.getSizeInBytes(f),y=ComponentDatatype$1.createArrayBufferView(f,m.buffer,g,_);f=(p=a.attributes._BATCHID).componentDatatype,g=(m=p.vertexBuffer).byteOffset,_=m.byteLength/ComponentDatatype$1.getSizeInBytes(f);var v,C=ComponentDatatype$1.createArrayBufferView(f,m.buffer,g,_),T=a.indexBuffer.typedArray;v=a.indexBuffer.indexDatatype===IndexDatatype$1.UNSIGNED_SHORT?new Uint16Array(T.buffer,T.byteOffset,T.byteLength/Uint16Array.BYTES_PER_ELEMENT):new Uint32Array(T.buffer,T.byteOffset,T.byteLength/Uint32Array.BYTES_PER_ELEMENT),y=arraySlice(y);var S,A,x,E=[],b=[],P=[],D=[],w=(C=arraySlice(C))[(v=arraySlice(v,t,t+i))[0]];E.push(w),P.push(0);for(var M=v.length,I=1;I<M;++I)(S=C[v[I]])!==w&&(x=I-(A=P[P.length-1]),E.push(S),b.push(x),P.push(I),D.push(new Vector3DTileBatch({offset:A,count:x,batchIds:[w],color:Color.WHITE})),w=S);x=M-(A=P[P.length-1]),b.push(x),D.push(new Vector3DTileBatch({offset:A,count:x,batchIds:[w],color:Color.WHITE}));var R=e._shaderProgram,O=R.vertexShaderSource,B=R.fragmentShaderSource,L=R.attributeLocations,F=defined(e._pickIdLoaded)?e._pickIdLoaded():void 0;e._primitive=new Vector3DTilePrimitive({classificationType:e._classificationType,positions:y,indices:v,indexOffsets:P,indexCounts:b,batchIds:E,vertexBatchIds:C,batchedIndices:D,batchTable:r,boundingVolume:new BoundingSphere,_vertexShaderSource:O,_fragmentShaderSource:B,_attributeLocations:L,_uniformMap:n,_pickId:F,_modelMatrix:new Matrix4,_boundingSphere:h}),e._buffers=void 0,e._vertexArray=void 0,e._shaderProgram=void 0,e._uniformMap=void 0}function createRuntimeNodes$1(e){if(e._loadResources.finished()&&!defined(e._primitive)){var t=e.gltf.nodes[0];e._nodeMatrix=ModelUtility.getTransform(t,e._nodeMatrix),createPrimitive$2(e)}}function createResources$6(e,t){var i=t.context;ModelUtility.checkSupportedGlExtensions(e.gltf.glExtensionsUsed,i),createBuffers$1(e),createProgram$1(e),createVertexArray$4(e),createUniformMap$5(e,i),createRuntimeNodes$1(e)}var scratchComputedTranslation$2=new Cartesian4,scratchComputedMatrixIn2D$1=new Matrix4;function updateNodeModelMatrix(e,t,i,r){var n=e._computedModelMatrix;if(e._mode!==SceneMode$1.SCENE3D&&!e._ignoreCommands){var a=Matrix4.getColumn(n,3,scratchComputedTranslation$2);if(Cartesian4.equals(a,Cartesian4.UNIT_W)){var o=e.boundingSphere.center,s=Transforms.wgs84To2DModelMatrix(r,o,scratchComputedMatrixIn2D$1);n=Matrix4.multiply(s,n,scratchComputedMatrixIn2D$1),defined(e._rtcCenter)&&(Matrix4.setTranslation(n,Cartesian4.UNIT_W,n),e._rtcCenter=e._rtcCenter2D)}else n=Transforms.basisTo2D(r,n,scratchComputedMatrixIn2D$1),e._rtcCenter=e._rtcCenter3D}var l=e._primitive;(t||i)&&(Matrix4.multiplyTransformation(n,e._nodeMatrix,l._modelMatrix),BoundingSphere.transform(l._boundingSphere,l._modelMatrix,l._boundingVolume),defined(e._rtcCenter)&&Cartesian3.add(e._rtcCenter,l._boundingVolume.center,l._boundingVolume.center))}function ClippingPlane(e,t){this._distance=t,this._normal=new UpdateChangedCartesian3(e,this),this.onChangeCallback=void 0,this.index=-1}function UpdateChangedCartesian3(e,t){this._clippingPlane=t,this._cartesian3=Cartesian3.clone(e)}function ClippingPlaneCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._planes=[],this._dirtyIndex=-1,this._multipleDirtyPlanes=!1,this._enabled=defaultValue(e.enabled,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.edgeColor=Color.clone(defaultValue(e.edgeColor,Color.WHITE)),this.edgeWidth=defaultValue(e.edgeWidth,0),this.planeAdded=new Event,this.planeRemoved=new Event,this._owner=void 0;var t=defaultValue(e.unionClippingRegions,!1);this._unionClippingRegions=t,this._testIntersection=t?unionIntersectFunction:defaultIntersectFunction,this._uint8View=void 0,this._float32View=void 0,this._clippingPlanesTexture=void 0;var i=e.planes;if(defined(i))for(var r=i.length,n=0;n<r;++n)this.add(i[n])}function unionIntersectFunction(e){return e===Intersect$1.OUTSIDE}function defaultIntersectFunction(e){return e===Intersect$1.INSIDE}function setIndexDirty(e,t){e._multipleDirtyPlanes=e._multipleDirtyPlanes||-1!==e._dirtyIndex&&e._dirtyIndex!==t,e._dirtyIndex=t}function indexOf$1(e,t){for(var i=e.length,r=0;r<i;++r)if(Plane.equals(e[r],t))return r;return-1}ClassificationModel.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},ClassificationModel.prototype.update=function(e){if(e.mode!==SceneMode$1.MORPHING)if(FeatureDetection.supportsWebP.initialized){var t=FeatureDetection.supportsWebP();if(this._state===ModelState$1.NEEDS_LOAD&&defined(this.gltf)&&(this._state=ModelState$1.LOADING,this._state!==ModelState$1.FAILED)){var i=this.gltf.extensions;if(defined(i)&&defined(i.CESIUM_RTC)){var r=Cartesian3.fromArray(i.CESIUM_RTC.center);if(!Cartesian3.equals(r,Cartesian3.ZERO)){this._rtcCenter3D=r;var n=e.mapProjection,a=n.ellipsoid.cartesianToCartographic(this._rtcCenter3D),o=n.project(a);Cartesian3.fromElements(o.z,o.x,o.y,o),this._rtcCenter2D=o,this._rtcCenterEye=new Cartesian3,this._rtcCenter=this._rtcCenter3D}}this._loadResources=new ModelLoadResources,ModelUtility.parseBuffers(this)}var s=this._loadResources,l=!1;this._state===ModelState$1.LOADING&&(0===s.pendingBufferLoads&&(ModelUtility.checkSupportedExtensions(this.extensionsRequired,t),addBuffersToLoadResources$1(this),parseBufferViews$1(this),this._boundingSphere=ModelUtility.computeBoundingSphere(this),this._initialRadius=this._boundingSphere.radius,createResources$6(this,e)),s.finished()&&(this._state=ModelState$1.LOADED,l=!0)),defined(s)&&this._state===ModelState$1.LOADED&&(l||createResources$6(this,e),s.finished()&&(this._loadResources=void 0));var c=this.show;if(c&&this._state===ModelState$1.LOADED||l){this._dirty=!1;var u=this.modelMatrix,d=e.mode!==this._mode;this._mode=e.mode;var h=!Matrix4.equals(this._modelMatrix,u)||d;if(h||l){Matrix4.clone(u,this._modelMatrix);var p=this._computedModelMatrix;Matrix4.clone(u,p),this._upAxis===Axis$1.Y?Matrix4.multiplyTransformation(p,Axis$1.Y_UP_TO_Z_UP,p):this._upAxis===Axis$1.X&&Matrix4.multiplyTransformation(p,Axis$1.X_UP_TO_Z_UP,p)}(h||l)&&(updateNodeModelMatrix(this,h,l,e.mapProjection),this._dirty=!0)}if(l){var f=this;e.afterRender.push((function(){f._ready=!0,f._readyPromise.resolve(f)}))}else c&&!this._ignoreCommands&&(this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.debugWireframe=this.debugWireframe,this._primitive.update(e))}else FeatureDetection.supportsWebP.initialize()},ClassificationModel.prototype.isDestroyed=function(){return!1},ClassificationModel.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)},Object.defineProperties(ClippingPlane.prototype,{distance:{get:function(){return this._distance},set:function(e){defined(this.onChangeCallback)&&e!==this._distance&&this.onChangeCallback(this.index),this._distance=e}},normal:{get:function(){return this._normal},set:function(e){defined(this.onChangeCallback)&&!Cartesian3.equals(this._normal._cartesian3,e)&&this.onChangeCallback(this.index),Cartesian3.clone(e,this._normal._cartesian3)}}}),ClippingPlane.fromPlane=function(e,t){return defined(t)?(t.normal=e.normal,t.distance=e.distance):t=new ClippingPlane(e.normal,e.distance),t},ClippingPlane.clone=function(e,t){return defined(t)?(t.normal=e.normal,t.distance=e.distance,t):new ClippingPlane(e.normal,e.distance)},Object.defineProperties(UpdateChangedCartesian3.prototype,{x:{get:function(){return this._cartesian3.x},set:function(e){defined(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.x&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.x=e}},y:{get:function(){return this._cartesian3.y},set:function(e){defined(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.y&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.y=e}},z:{get:function(){return this._cartesian3.z},set:function(e){defined(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.z&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.z=e}}}),Object.defineProperties(ClippingPlaneCollection.prototype,{length:{get:function(){return this._planes.length}},unionClippingRegions:{get:function(){return this._unionClippingRegions},set:function(e){this._unionClippingRegions!==e&&(this._unionClippingRegions=e,this._testIntersection=e?unionIntersectFunction:defaultIntersectFunction)}},enabled:{get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e)}},texture:{get:function(){return this._clippingPlanesTexture}},owner:{get:function(){return this._owner}},clippingPlanesState:{get:function(){return this._unionClippingRegions?this._planes.length:-this._planes.length}}}),ClippingPlaneCollection.prototype.add=function(e){var t=this._planes.length,i=this;e.onChangeCallback=function(e){setIndexDirty(i,e)},e.index=t,setIndexDirty(this,t),this._planes.push(e),this.planeAdded.raiseEvent(e,t)},ClippingPlaneCollection.prototype.get=function(e){return this._planes[e]},ClippingPlaneCollection.prototype.contains=function(e){return-1!==indexOf$1(this._planes,e)},ClippingPlaneCollection.prototype.remove=function(e){var t=this._planes,i=indexOf$1(t,e);if(-1===i)return!1;e instanceof ClippingPlane&&(e.onChangeCallback=void 0,e.index=-1);for(var r=t.length-1,n=i;n<r;++n){var a=t[n+1];t[n]=a,a instanceof ClippingPlane&&(a.index=n)}return this._multipleDirtyPlanes=!0,t.length=r,this.planeRemoved.raiseEvent(e,i),!0},ClippingPlaneCollection.prototype.removeAll=function(){for(var e=this._planes,t=e.length,i=0;i<t;++i){var r=e[i];r instanceof ClippingPlane&&(r.onChangeCallback=void 0,r.index=-1),this.planeRemoved.raiseEvent(r,i)}this._multipleDirtyPlanes=!0,this._planes=[]};var distanceEncodeScratch=new Cartesian4,oct32EncodeScratch=new Cartesian4;function packPlanesAsUint8(e,t,i){for(var r=e._uint8View,n=e._planes,a=0,o=t;o<i;++o){var s=n[o],l=AttributeCompression.octEncodeToCartesian4(s.normal,oct32EncodeScratch);r[a]=l.x,r[a+1]=l.y,r[a+2]=l.z,r[a+3]=l.w;var c=Cartesian4.packFloat(s.distance,distanceEncodeScratch);r[a+4]=c.x,r[a+5]=c.y,r[a+6]=c.z,r[a+7]=c.w,a+=8}}function packPlanesAsFloats(e,t,i){for(var r=e._float32View,n=e._planes,a=0,o=t;o<i;++o){var s=n[o],l=s.normal;r[a]=l.x,r[a+1]=l.y,r[a+2]=l.z,r[a+3]=s.distance,a+=4}}function computeTextureResolution(e,t){var i=ContextLimits.maximumTextureSize;return t.x=Math.min(e,i),t.y=Math.ceil(e/t.x),t}var textureResolutionScratch$1=new Cartesian2;ClippingPlaneCollection.prototype.update=function(e){var t=this._clippingPlanesTexture,i=e.context,r=ClippingPlaneCollection.useFloatTexture(i),n=r?this.length:2*this.length;if(defined(t)){var a=t.width*t.height;(a<n||n<.25*a)&&(t.destroy(),t=void 0,this._clippingPlanesTexture=void 0)}if(0!==this.length){if(!defined(t)){var o=computeTextureResolution(n,textureResolutionScratch$1);o.y*=2,r?(t=new Texture({context:i,width:o.x,height:o.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT,sampler:Sampler.NEAREST,flipY:!1}),this._float32View=new Float32Array(o.x*o.y*4)):(t=new Texture({context:i,width:o.x,height:o.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST,flipY:!1}),this._uint8View=new Uint8Array(o.x*o.y*4)),this._clippingPlanesTexture=t,this._multipleDirtyPlanes=!0}var s=this._dirtyIndex;if(this._multipleDirtyPlanes||-1!==s){if(this._multipleDirtyPlanes)r?(packPlanesAsFloats(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._float32View}})):(packPlanesAsUint8(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._uint8View}}));else{var l=0,c=0;r?(c=Math.floor(s/t.width),l=Math.floor(s-c*t.width),packPlanesAsFloats(this,s,s+1),t.copyFrom({source:{width:1,height:1,arrayBufferView:this._float32View},xOffset:l,yOffset:c})):(c=Math.floor(2*s/t.width),l=Math.floor(2*s-c*t.width),packPlanesAsUint8(this,s,s+1),t.copyFrom({source:{width:2,height:1,arrayBufferView:this._uint8View},xOffset:l,yOffset:c}))}this._multipleDirtyPlanes=!1,this._dirtyIndex=-1}}};var scratchMatrix$4=new Matrix4,scratchPlane=new Plane(Cartesian3.UNIT_X,0);ClippingPlaneCollection.prototype.computeIntersectionWithBoundingVolume=function(e,t){var i=this._planes,r=i.length,n=this.modelMatrix;defined(t)&&(n=Matrix4.multiply(t,n,scratchMatrix$4));var a=Intersect$1.INSIDE;!this.unionClippingRegions&&r>0&&(a=Intersect$1.OUTSIDE);for(var o=0;o<r;++o){var s=i[o];Plane.transform(s,n,scratchPlane);var l=e.intersectPlane(scratchPlane);if(l===Intersect$1.INTERSECTING)a=l;else if(this._testIntersection(l))return l}return a},ClippingPlaneCollection.setOwner=function(e,t,i){e!==t[i]&&(t[i]=t[i]&&t[i].destroy(),defined(e)&&(e._owner=t,t[i]=e))},ClippingPlaneCollection.useFloatTexture=function(e){return e.floatingPointTexture},ClippingPlaneCollection.getTextureResolution=function(e,t,i){var r=e.texture;if(defined(r))return i.x=r.width,i.y=r.height,i;var n=computeTextureResolution(ClippingPlaneCollection.useFloatTexture(t)?e.length:2*e.length,i);return n.y*=2,n},ClippingPlaneCollection.prototype.isDestroyed=function(){return!1},ClippingPlaneCollection.prototype.destroy=function(){return this._clippingPlanesTexture=this._clippingPlanesTexture&&this._clippingPlanesTexture.destroy(),destroyObject(this)};var ColorBlendMode={HIGHLIGHT:0,REPLACE:1,MIX:2,getColorBlend:function(e,t){return e===ColorBlendMode.HIGHLIGHT?0:e===ColorBlendMode.REPLACE?1:e===ColorBlendMode.MIX?CesiumMath.clamp(t,CesiumMath.EPSILON4,1):void 0}},ColorBlendMode$1=Object.freeze(ColorBlendMode);function DracoLoader(){}function addBufferToLoadResources(e,t){var i="runtime."+Object.keys(e.createdBufferViews).length,r=e.buffers,n=Object.keys(r).length;return r[n]=t,e.createdBufferViews[i]={buffer:n,byteOffset:0,byteLength:t.byteLength},i}function addNewVertexBuffer(e,t,i){var r=t._loadResources,n=addBufferToLoadResources(r,e);return r.vertexBuffersToCreate.enqueue(n),n}function addNewIndexBuffer(e,t,i){var r=e.typedArray,n=t._loadResources,a=addBufferToLoadResources(n,r);return n.indexBuffersToCreate.enqueue({id:a,componentType:ComponentDatatype$1.fromTypedArray(r)}),{bufferViewId:a,numberOfIndices:e.numberOfIndices}}function scheduleDecodingTask(e,t,i,r){if(DracoLoader._taskProcessorReady){var n=i.primitivesToDecode.peek();if(defined(n)){var a=e.scheduleTask(n,[n.array.buffer]);if(defined(a))return i.activeDecodingTasks++,i.primitivesToDecode.dequeue(),a.then((function(e){i.activeDecodingTasks--;var r=addNewIndexBuffer(e.indexArray,t),a={},o=e.attributeData;for(var s in o)if(o.hasOwnProperty(s)){var l=o[s],c=addNewVertexBuffer(l.array,t),u=l.data;u.bufferView=c,a[s]=u}t._decodedData[n.mesh+".primitive."+n.primitive]={bufferView:r.bufferViewId,numberOfIndices:r.numberOfIndices,attributes:a}}))}}}function getClipAndStyleCode(e,t,i){return" float clipDistance = clip(gl_FragCoord, "+e+", "+t+"); \n vec4 clippingPlanesEdgeColor = vec4(1.0); \n clippingPlanesEdgeColor.rgb = "+i+".rgb; \n float clippingPlanesEdgeWidth = "+i+".a; \n if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) \n { \n gl_FragColor = clippingPlanesEdgeColor;\n } \n"}DracoLoader._maxDecodingConcurrency=Math.max(FeatureDetection.hardwareConcurrency-1,1),DracoLoader._decoderTaskProcessor=void 0,DracoLoader._taskProcessorReady=!1,DracoLoader._getDecoderTaskProcessor=function(){if(!defined(DracoLoader._decoderTaskProcessor)){var e=new TaskProcessor("decodeDraco",DracoLoader._maxDecodingConcurrency);e.initWebAssemblyModule({modulePath:"ThirdParty/Workers/draco_decoder_nodejs.js",wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}).then((function(){DracoLoader._taskProcessorReady=!0})),DracoLoader._decoderTaskProcessor=e}return DracoLoader._decoderTaskProcessor},DracoLoader.hasExtension=function(e){return defined(e.extensionsRequired.KHR_draco_mesh_compression)||defined(e.extensionsUsed.KHR_draco_mesh_compression)},DracoLoader._decodedModelResourceCache=void 0,DracoLoader.parse=function(e,t){if(DracoLoader.hasExtension(e)){var i=e._loadResources,r=e.cacheKey;if(defined(r)){defined(DracoLoader._decodedModelResourceCache)||(defined(t.cache.modelDecodingCache)||(t.cache.modelDecodingCache={}),DracoLoader._decodedModelResourceCache=t.cache.modelDecodingCache);var n=DracoLoader._decodedModelResourceCache[r];if(defined(n))return n.count++,void(i.pendingDecodingCache=!0)}var a=e._dequantizeInShader,o=e.gltf;ForEach.mesh(o,(function(e,t){ForEach.meshPrimitive(e,(function(e,r){if(defined(e.extensions)){var n=e.extensions.KHR_draco_mesh_compression;if(defined(n)){var s=o.bufferViews[n.bufferView],l=arraySlice(o.buffers[s.buffer].extras._pipeline.source,s.byteOffset,s.byteOffset+s.byteLength);i.primitivesToDecode.enqueue({mesh:t,primitive:r,array:l,bufferView:s,compressedAttributes:n.attributes,dequantizeInShader:a})}}}))}))}},DracoLoader.decodeModel=function(e,t){if(!DracoLoader.hasExtension(e))return when.resolve();var i=e._loadResources,r=e.cacheKey;if(defined(r)&&defined(DracoLoader._decodedModelResourceCache)){var n=DracoLoader._decodedModelResourceCache[r];if(defined(n)&&i.pendingDecodingCache)return when(n.ready,(function(){e._decodedData=n.data,i.pendingDecodingCache=!1}));DracoLoader._decodedModelResourceCache[r]={ready:!1,count:1,data:void 0}}if(0===i.primitivesToDecode.length)return when.resolve();for(var a=DracoLoader._getDecoderTaskProcessor(),o=[],s=scheduleDecodingTask(a,e,i);defined(s);)o.push(s),s=scheduleDecodingTask(a,e,i);return when.all(o)},DracoLoader.decodePointCloud=function(e){var t=DracoLoader._getDecoderTaskProcessor();if(DracoLoader._taskProcessorReady)return t.scheduleTask(e,[e.buffer.buffer])},DracoLoader.decodeBufferView=function(e){var t=DracoLoader._getDecoderTaskProcessor();if(DracoLoader._taskProcessorReady)return t.scheduleTask(e,[e.array.buffer])},DracoLoader.cacheDataForModel=function(e){var t=e.cacheKey;if(defined(t)&&defined(DracoLoader._decodedModelResourceCache)){var i=DracoLoader._decodedModelResourceCache[t];defined(i)&&(i.ready=!0,i.data=e._decodedData)}},DracoLoader.destroyCachedDataForModel=function(e){var t=e.cacheKey;if(defined(t)&&defined(DracoLoader._decodedModelResourceCache)){var i=DracoLoader._decodedModelResourceCache[t];defined(i)&&0==--i.count&&delete DracoLoader._decodedModelResourceCache[t]}};var textureResolutionScratch=new Cartesian2;function getClippingFunction(e,t){var i=e.unionClippingRegions,r=e.length,n=ClippingPlaneCollection.useFloatTexture(t),a=ClippingPlaneCollection.getTextureResolution(e,t,textureResolutionScratch),o=a.x,s=a.y,l=n?getClippingPlaneFloat$1(o,s):getClippingPlaneUint8$1(o,s);return l+="\n",l+=i?clippingFunctionUnion(r):clippingFunctionIntersect$1(r)}function clippingFunctionUnion(e){return"float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)\n{\n vec4 position = czm_windowToEyeCoordinates(fragCoord);\n vec3 clipNormal = vec3(0.0);\n vec3 clipPosition = vec3(0.0);\n float clipAmount;\n float pixelWidth = czm_metersPerPixel(position);\n bool breakAndDiscard = false;\n for (int i = 0; i < "+e+"; ++i)\n {\n vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);\n clipNormal = clippingPlane.xyz;\n clipPosition = -clippingPlane.w * clipNormal;\n float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;\n clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));\n if (amount <= 0.0)\n {\n breakAndDiscard = true;\n break;\n }\n }\n if (breakAndDiscard) {\n discard;\n }\n return clipAmount;\n}\n"}function clippingFunctionIntersect$1(e){return"float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)\n{\n bool clipped = true;\n vec4 position = czm_windowToEyeCoordinates(fragCoord);\n vec3 clipNormal = vec3(0.0);\n vec3 clipPosition = vec3(0.0);\n float clipAmount = 0.0;\n float pixelWidth = czm_metersPerPixel(position);\n for (int i = 0; i < "+e+"; ++i)\n {\n vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);\n clipNormal = clippingPlane.xyz;\n clipPosition = -clippingPlane.w * clipNormal;\n float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;\n clipAmount = max(amount, clipAmount);\n clipped = clipped && (amount <= 0.0);\n }\n if (clipped)\n {\n discard;\n }\n return clipAmount;\n}\n"}function getClippingPlaneFloat$1(e,t){var i=1/t,r=1/e+"";-1===r.indexOf(".")&&(r+=".0");var n=i+"";return-1===n.indexOf(".")&&(n+=".0"),"vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n int pixY = clippingPlaneNumber / "+e+";\n int pixX = clippingPlaneNumber - (pixY * "+e+");\n float u = (float(pixX) + 0.5) * "+r+";\n float v = (float(pixY) + 0.5) * "+n+";\n vec4 plane = texture2D(packedClippingPlanes, vec2(u, v));\n return czm_transformPlane(plane, transform);\n}\n"}function getClippingPlaneUint8$1(e,t){var i=1/t,r=1/e+"";-1===r.indexOf(".")&&(r+=".0");var n=i+"";return-1===n.indexOf(".")&&(n+=".0"),"vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n int clippingPlaneStartIndex = clippingPlaneNumber * 2;\n int pixY = clippingPlaneStartIndex / "+e+";\n int pixX = clippingPlaneStartIndex - (pixY * "+e+");\n float u = (float(pixX) + 0.5) * "+r+";\n float v = (float(pixY) + 0.5) * "+n+";\n vec4 oct32 = texture2D(packedClippingPlanes, vec2(u, v)) * 255.0;\n vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);\n vec4 plane;\n plane.xyz = czm_octDecode(oct, 65535.0);\n plane.w = czm_unpackFloat(texture2D(packedClippingPlanes, vec2(u + "+r+", v)));\n return czm_transformPlane(plane, transform);\n}\n"}var JobType={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3},JobType$1=Object.freeze(JobType);function ModelAnimationCache(){}var dataUriRegex=/^data\:/i;function getAccessorKey(e,t){var i=e.gltf,r=i.buffers,n=i.bufferViews[t.bufferView],a=r[n.buffer],o=n.byteOffset+t.byteOffset,s=t.count*numberOfComponentsForType(t.type),l=dataUriRegex.test(a.uri)?"":a.uri;return e.cacheKey+"//"+l+"/"+o+"/"+s}var cachedAnimationParameters={};ModelAnimationCache.getAnimationParameterValues=function(e,t){var i=getAccessorKey(e,t),r=cachedAnimationParameters[i];if(!defined(r)){var n=e.gltf,a=n.buffers,o=n.bufferViews[t.bufferView],s=a[o.buffer].extras._pipeline.source,l=t.componentType,c=t.type,u=numberOfComponentsForType(c),d=t.count,h=getAccessorByteStride(n,t);r=new Array(d);for(var p=defaultValue(t.byteOffset,0),f=o.byteOffset+p,m=0;m<d;m++){var g=ComponentDatatype$1.createArrayBufferView(l,s.buffer,s.byteOffset+f,u);"SCALAR"===c?r[m]=g[0]:"VEC3"===c?r[m]=Cartesian3.fromArray(g):"VEC4"===c&&(r[m]=Quaternion.unpack(g)),f+=h}defined(e.cacheKey)&&(cachedAnimationParameters[i]=r)}return r};var cachedAnimationSplines={};function getAnimationSplineKey(e,t,i){return e.cacheKey+"//"+t+"/"+i}function ConstantSpline(e){this._value=e}function SteppedSpline(e){this._spline=e,this._lastTimeIndex=0}ConstantSpline.prototype.evaluate=function(e,t){return this._value},ConstantSpline.prototype.wrapTime=function(e){return 0},ConstantSpline.prototype.clampTime=function(e){return 0},SteppedSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,SteppedSpline.prototype.evaluate=function(e,t){var i=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),r=this._spline.times,n=e>=r[i+1]?r[i+1]:r[i];return this._spline.evaluate(n,t)},Object.defineProperties(SteppedSpline.prototype,{times:{get:function(){return this._spline.times}}}),SteppedSpline.prototype.wrapTime=function(e){return this._spline.wrapTime(e)},SteppedSpline.prototype.clampTime=function(e){return this._spline.clampTime(e)},ModelAnimationCache.getAnimationSpline=function(e,t,i,r,n,a,o,s){var l=getAnimationSplineKey(e,t,r),c=cachedAnimationSplines[l];if(!defined(c)){var u=a,d=s;1===u.length&&1===d.length?c=new ConstantSpline(d[0]):"LINEAR"!==n.interpolation&&"STEP"!==n.interpolation||("translation"===o||"scale"===o?c=new LinearSpline({times:u,points:d}):"rotation"===o?c=new QuaternionSpline({times:u,points:d}):"weights"===o&&(c=new WeightSpline({times:u,weights:d})),defined(c)&&"STEP"===n.interpolation&&(c=new SteppedSpline(c))),defined(e.cacheKey)&&(cachedAnimationSplines[l]=c)}return c};var cachedSkinInverseBindMatrices={};ModelAnimationCache.getSkinInverseBindMatrices=function(e,t){var i=getAccessorKey(e,t),r=cachedSkinInverseBindMatrices[i];if(!defined(r)){var n=e.gltf,a=n.buffers,o=n.bufferViews[t.bufferView],s=a[o.buffer].extras._pipeline.source,l=t.componentType,c=t.type,u=t.count,d=getAccessorByteStride(n,t),h=o.byteOffset+t.byteOffset,p=numberOfComponentsForType(c);if(r=new Array(u),l===WebGLConstants$1.FLOAT&&c===AttributeType$1.MAT4)for(var f=0;f<u;++f){var m=ComponentDatatype$1.createArrayBufferView(l,s.buffer,s.byteOffset+h,p);r[f]=Matrix4.fromArray(m),h+=d}cachedSkinInverseBindMatrices[i]=r}return r};var ModelAnimationLoop={NONE:0,REPEAT:1,MIRRORED_REPEAT:2},ModelAnimationLoop$1=Object.freeze(ModelAnimationLoop),ModelAnimationState=Object.freeze({STOPPED:0,ANIMATING:1});function ModelAnimation(e,t,i){this._name=i.name,this._startTime=JulianDate.clone(e.startTime),this._delay=defaultValue(e.delay,0),this._stopTime=e.stopTime,this.removeOnStop=defaultValue(e.removeOnStop,!1),this._multiplier=defaultValue(e.multiplier,1),this._reverse=defaultValue(e.reverse,!1),this._loop=defaultValue(e.loop,ModelAnimationLoop$1.NONE),this.start=new Event,this.update=new Event,this.stop=new Event,this._state=ModelAnimationState.STOPPED,this._runtimeAnimation=i,this._computedStartTime=void 0,this._duration=void 0;var r=this;this._raiseStartEvent=function(){r.start.raiseEvent(t,r)},this._updateEventTime=0,this._raiseUpdateEvent=function(){r.update.raiseEvent(t,r,r._updateEventTime)},this._raiseStopEvent=function(){r.stop.raiseEvent(t,r)}}function ModelAnimationCollection(e){this.animationAdded=new Event,this.animationRemoved=new Event,this._model=e,this._scheduledAnimations=[],this._previousTime=void 0}function add(e,t,i){var r=e._model,n=new ModelAnimation(i,r,r._runtime.animations[t]);return e._scheduledAnimations.push(n),e.animationAdded.raiseEvent(r,n),n}function animateChannels(e,t){for(var i=e.channelEvaluators,r=i.length,n=0;n<r;++n)i[n](t)}Object.defineProperties(ModelAnimation.prototype,{name:{get:function(){return this._name}},startTime:{get:function(){return this._startTime}},delay:{get:function(){return this._delay}},stopTime:{get:function(){return this._stopTime}},multiplier:{get:function(){return this._multiplier}},reverse:{get:function(){return this._reverse}},loop:{get:function(){return this._loop}}}),Object.defineProperties(ModelAnimationCollection.prototype,{length:{get:function(){return this._scheduledAnimations.length}}}),ModelAnimationCollection.prototype.add=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t,i=this._model._runtime.animations;if(defined(e.index))return add(this,e.index,e);for(var r=i.length,n=0;n<r;++n)if(i[n].name===e.name){t=n;break}return add(this,t,e)},ModelAnimationCollection.prototype.addAll=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);for(var t=[],i=this._model._runtime.animations.length,r=0;r<i;++r)t.push(add(this,r,e));return t},ModelAnimationCollection.prototype.remove=function(e){if(defined(e)){var t=this._scheduledAnimations,i=t.indexOf(e);if(-1!==i)return t.splice(i,1),this.animationRemoved.raiseEvent(this._model,e),!0}return!1},ModelAnimationCollection.prototype.removeAll=function(){var e=this._model,t=this._scheduledAnimations,i=t.length;this._scheduledAnimations=[];for(var r=0;r<i;++r)this.animationRemoved.raiseEvent(e,t[r])},ModelAnimationCollection.prototype.contains=function(e){return!!defined(e)&&-1!==this._scheduledAnimations.indexOf(e)},ModelAnimationCollection.prototype.get=function(e){return this._scheduledAnimations[e]};var animationsToRemove=[];function createAnimationRemovedFunction(e,t,i){return function(){e.animationRemoved.raiseEvent(t,i)}}function ModelMaterial(e,t,i){this._name=t.name,this._id=i,this._uniformMap=e._uniformMaps[i],this._technique=void 0,this._program=void 0,this._values=void 0}function ModelMesh(e,t,i){for(var r=[],n=e.primitives,a=n.length,o=0;o<a;++o){var s=n[o];r[o]=t[s.material]}this._name=e.name,this._materials=r,this._id=i}function ModelNode(e,t,i,r,n){this._model=e,this._runtimeNode=i,this._name=t.name,this._id=r,this.useMatrix=!1,this._show=!0,this._matrix=Matrix4.clone(n),this._originalMatrix=Matrix4.clone(n)}ModelAnimationCollection.prototype.update=function(e){var t=this._scheduledAnimations,i=t.length;if(0===i)return this._previousTime=void 0,!1;if(JulianDate.equals(e.time,this._previousTime))return!1;this._previousTime=JulianDate.clone(e.time,this._previousTime);for(var r=!1,n=e.time,a=this._model,o=0;o<i;++o){var s=t[o],l=s._runtimeAnimation;defined(s._computedStartTime)||(s._computedStartTime=JulianDate.addSeconds(defaultValue(s.startTime,n),s.delay,new JulianDate)),defined(s._duration)||(s._duration=l.stopTime*(1/s.multiplier));var c=s._computedStartTime,u=s._duration,d=s.stopTime,h=0!==u?JulianDate.secondsDifference(n,c)/u:0;0!==u&&defined(d)&&JulianDate.greaterThan(n,d)&&(h=JulianDate.secondsDifference(d,c)/u);var p=h>=0,f=s.loop===ModelAnimationLoop$1.REPEAT||s.loop===ModelAnimationLoop$1.MIRRORED_REPEAT,m=(p||f&&!defined(s.startTime))&&(h<=1||f)&&(!defined(d)||JulianDate.lessThanOrEquals(n,d));if(m||s._state===ModelAnimationState.ANIMATING){if(m&&s._state===ModelAnimationState.STOPPED&&(s._state=ModelAnimationState.ANIMATING,s.start.numberOfListeners>0&&e.afterRender.push(s._raiseStartEvent)),s.loop===ModelAnimationLoop$1.REPEAT)h-=Math.floor(h);else if(s.loop===ModelAnimationLoop$1.MIRRORED_REPEAT){var g=Math.floor(h),_=h-g;h=g%2==1?1-_:_}s.reverse&&(h=1-h);var y=h*u*s.multiplier;animateChannels(l,y=CesiumMath.clamp(y,l.startTime,l.stopTime)),s.update.numberOfListeners>0&&(s._updateEventTime=y,e.afterRender.push(s._raiseUpdateEvent)),r=!0,m||(s._state=ModelAnimationState.STOPPED,s.stop.numberOfListeners>0&&e.afterRender.push(s._raiseStopEvent),s.removeOnStop&&animationsToRemove.push(s))}}i=animationsToRemove.length;for(var v=0;v<i;++v){var C=animationsToRemove[v];t.splice(t.indexOf(C),1),e.afterRender.push(createAnimationRemovedFunction(this,a,C))}return animationsToRemove.length=0,r},Object.defineProperties(ModelMaterial.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}}}),ModelMaterial.prototype.setValue=function(e,t){var i="u_"+e,r=this._uniformMap.values[i];r.value=r.clone(t,r.value)},ModelMaterial.prototype.getValue=function(e){var t="u_"+e,i=this._uniformMap.values[t];if(defined(i))return i.value},Object.defineProperties(ModelMesh.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},materials:{get:function(){return this._materials}}}),Object.defineProperties(ModelNode.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,this._model._perNodeShowDirty=!0)}},matrix:{get:function(){return this._matrix},set:function(e){this._matrix=Matrix4.clone(e,this._matrix),this.useMatrix=!0;var t=this._model;t._cesiumAnimationsDirty=!0,this._runtimeNode.dirtyNumber=t._maxDirtyNumber}},originalMatrix:{get:function(){return this._originalMatrix}}}),ModelNode.prototype.setMatrix=function(e){Matrix4.clone(e,this._matrix)};var MAX_GLTF_UINT16_INDEX=65534;function ModelOutlineLoader(){}function addOutline(e,t,i,r,n){var a,o=n.vertexCopies,s=n.extraVertices,l=n.outlineCoordinates,c=e.gltf,u=c.meshes[t].primitives[i],d=c.accessors,h=c.bufferViews;for(var p in u.attributes)if(u.attributes.hasOwnProperty(p)){var f=d[u.attributes[p]];if(defined(f)){a=f.count;break}}if(defined(a)){var m,g=d[u.indices],_=h[g.bufferView],y=d[r],v=h[y.bufferView],C=e._loadResources,T=C.getBuffer(_),S=C.getBuffer(v),A=5123===g.componentType?new Uint16Array(T.buffer,T.byteOffset+g.byteOffset,g.count):new Uint32Array(T.buffer,T.byteOffset+g.byteOffset,g.count),x=5123===y.componentType?new Uint16Array(S.buffer,S.byteOffset+y.byteOffset,y.count):new Uint32Array(S.buffer,S.byteOffset+y.byteOffset,y.count),E=a,b=[E];for(m=0;m<x.length;m+=2){var P=x[m],D=x[m+1];b[Math.min(P,D)*E+Math.max(P,D)]=1}for(m=0;m<A.length;m+=3)for(var w=A[m],M=A[m+1],I=A[m+2],R=isHighlighted(b,w,M),O=isHighlighted(b,M,I),B=isHighlighted(b,I,w),L=matchAndStoreCoordinates(l,w,M,I,R,O,B);L>=0;){var F;if(void 0===(F=L===w?o[w]:L===M?o[M]:o[I])){F=a+s.length;for(var N=L;N>=a;)N=s[N-a];s.push(N),o[L]=F}F>MAX_GLTF_UINT16_INDEX&&A instanceof Uint16Array&&(A=new Uint32Array(A),g.componentType=5125,_.buffer=c.buffers.push({byteLength:A.byteLength,extras:{_pipeline:{source:A.buffer}}})-1,_.byteLength=A.byteLength,_.byteOffset=0,e._loadResources.buffers[_.buffer]=new Uint8Array(A.buffer,0,A.byteLength),C.indexBuffersToCreate._array.forEach((function(e){e.id===g.bufferView&&(e.componentType=g.componentType)}))),L===w?(w=F,A[m]=F):L===M?(M=F,A[m+1]=F):(I=F,A[m+2]=F),defined(g.max)&&(g.max[0]=Math.max(g.max[0],F)),L=matchAndStoreCoordinates(l,w,M,I,R,O,B)}}}function computeOrderMask(e,t,i,r,n){var a=3*t,o=e[a],s=e[a+1],l=e[a+2];return void 0===o?63:((o===i&&s===r&&l===n)<<0)+((o===i&&s===n&&l===r)<<1)+((o===r&&s===i&&l===n)<<2)+((o===r&&s===n&&l===i)<<3)+((o===n&&s===i&&l===r)<<4)+((o===n&&s===r&&l===i)<<5)}function popcount0to63(e){return(1&e)+(e>>1&1)+(e>>2&1)+(e>>3&1)+(e>>4&1)+(e>>5&1)}function matchAndStoreCoordinates(e,t,i,r,n,a,o){var s=o?1:0,l=n?1:0,c=computeOrderMask(e,t,s,l,0);if(0===c)return t;var u=n?1:0,d=a?1:0,h=computeOrderMask(e,i,0,u,d);if(0===h)return i;var p=o?1:0,f=a?1:0,m=computeOrderMask(e,r,p,0,f);if(0===m)return r;var g,_,y,v=c&h&m;if(1&v)g=0,_=1,y=2;else if(2&v)g=0,y=1,_=2;else if(4&v)_=0,g=1,y=2;else if(8&v)_=0,y=1,g=2;else if(16&v)y=0,g=1,_=2;else{if(!(32&v)){var C=popcount0to63(c),T=popcount0to63(h),S=popcount0to63(m);return C<T&&C<S?t:T<S?i:r}y=0,_=1,g=2}var A=3*t;e[A+g]=s,e[A+_]=l,e[A+y]=0;var x=3*i;e[x+g]=0,e[x+_]=u,e[x+y]=d;var E=3*r;return e[E+g]=p,e[E+_]=0,e[E+y]=f,-1}function isHighlighted(e,t,i){var r=e[0];return 1===e[Math.min(t,i)*r+Math.max(t,i)]}function createTexture$3(e){var t=new Uint8Array(e);return t[e-1]=192,8===e?t[e-1]=96:4===e?t[e-1]=48:2===e?t[e-1]=24:1===e&&(t[e-1]=12),t}function updateBufferViewsWithNewVertices(e,t){var i,r,n=e.gltf,a=e._loadResources;for(i=0;i<t.length;++i){var o=t[i],s=o.extras._pipeline.vertexNumberingScope;o.extras._pipeline.vertexNumberingScope=void 0;var l=s.extraVertices,c=a.getBuffer(o),u=o.byteStride||4,d=l.length,h=new Uint8Array(c.byteLength+d*u);for(h.set(c),r=0;r<d;++r)for(var p=l[r]*u,f=c.length+r*u,m=0;m<u;++m)h[f+m]=h[p+m];o.byteOffset=0,o.byteLength=h.byteLength;var g=n.buffers.push({byteLength:h.byteLength,extras:{_pipeline:{source:h.buffer}}})-1;o.buffer=g,a.buffers[g]=h;var _=s.accessors;for(r=0;r<_.length;++r){var y=_[r];n.accessors[y].count+=d}if(!s.createdOutlines){var v=s.outlineCoordinates,C=new Float32Array(v),T=e.gltf.buffers.push({byteLength:C.byteLength,extras:{_pipeline:{source:C.buffer}}})-1;a.buffers[T]=new Uint8Array(C.buffer,0,C.byteLength);var S=e.gltf.bufferViews.push({buffer:T,byteLength:C.byteLength,byteOffset:0,byteStride:3*Float32Array.BYTES_PER_ELEMENT,target:34962})-1,A=e.gltf.accessors.push({bufferView:S,byteOffset:0,componentType:5126,count:C.length/3,type:"VEC3",min:[0,0,0],max:[1,1,1]})-1,x=s.primitives;for(r=0;r<x.length;++r)x[r].attributes._OUTLINE_COORDINATES=A;a.vertexBuffersToCreate.enqueue(S),s.createdOutlines=!0}}}function compactBuffers(e){var t,i=e.gltf,r=e._loadResources;for(t=0;t<i.buffers.length;++t){var n=i.buffers[t],a=i.bufferViews.filter(usesBuffer.bind(void 0,t)),o=a.reduce((function(e,t){return e+t.byteLength}),0);if(o!==n.byteLength){for(var s=new Uint8Array(o),l=0,c=0;c<a.length;++c){var u=a[c],d=r.getBuffer(u);s.set(d,l),u.byteOffset=l,l+=d.byteLength}r.buffers[t]=s,n.extras._pipeline.source=s.buffer,n.byteLength=o}}}function usesBuffer(e,t){return t.buffer===e}function getVertexNumberingScope(e,t){var i=t.attributes;if(void 0!==i){var r,n=e.gltf;for(var a in i)if(i.hasOwnProperty(a)){var o=i[a],s=n.accessors[o].bufferView,l=n.bufferViews[s];if(defined(l.extras)||(l.extras={}),defined(l.extras._pipeline)||(l.extras._pipeline={}),defined(l.extras._pipeline.vertexNumberingScope)){if(void 0!==r&&l.extras._pipeline.vertexNumberingScope!==r)return}else l.extras._pipeline.vertexNumberingScope=r||{vertexCopies:[],extraVertices:[],outlineCoordinates:[],accessors:[],bufferViews:[],primitives:[],createdOutlines:!1};(r=l.extras._pipeline.vertexNumberingScope).bufferViews.indexOf(l)<0&&r.bufferViews.push(l),r.accessors.indexOf(o)<0&&r.accessors.push(o)}return r.primitives.push(t),r}}function ComputeCommand(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.vertexArray=e.vertexArray,this.fragmentShaderSource=e.fragmentShaderSource,this.shaderProgram=e.shaderProgram,this.uniformMap=e.uniformMap,this.outputTexture=e.outputTexture,this.preExecute=e.preExecute,this.postExecute=e.postExecute,this.canceled=e.canceled,this.persists=defaultValue(e.persists,!1),this.pass=Pass$1.COMPUTE,this.owner=e.owner}ModelOutlineLoader.hasExtension=function(e){return defined(e.extensionsRequired.CESIUM_primitive_outline)||defined(e.extensionsUsed.CESIUM_primitive_outline)},ModelOutlineLoader.outlinePrimitives=function(e){if(ModelOutlineLoader.hasExtension(e)){var t=e.gltf,i=[];ForEach.mesh(t,(function(t,r){ForEach.meshPrimitive(t,(function(t,n){if(defined(t.extensions)){var a=t.extensions.CESIUM_primitive_outline;if(defined(a)){var o=getVertexNumberingScope(e,t);void 0!==o&&(i.indexOf(o)<0&&i.push(o),addOutline(e,r,n,a.indices,o))}}}))}));for(var r=0;r<i.length;++r)updateBufferViewsWithNewVertices(e,i[r].bufferViews);compactBuffers(e)}},ModelOutlineLoader.createTexture=function(e,t){var i=t.cache.modelOutliningCache;if(defined(i)||(i=t.cache.modelOutliningCache={}),defined(i.outlineTexture))return i.outlineTexture;for(var r=Math.min(4096,ContextLimits.maximumTextureSize),n=r,a=createTexture$3(n),o=[];n>1;)n>>=1,o.push(createTexture$3(n));var s=new Texture({context:t,source:{arrayBufferView:a,mipLevels:o},width:r,height:1,pixelFormat:PixelFormat$1.LUMINANCE,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})});return i.outlineTexture=s,s},ComputeCommand.prototype.execute=function(e){e.execute(this)};var OctahedralProjectionAtlasFS="varying vec2 v_textureCoordinates;\nuniform float originalSize;\nuniform sampler2D texture0;\nuniform sampler2D texture1;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\nconst float yMipLevel1 = 1.0 - (1.0 / pow(2.0, 1.0));\nconst float yMipLevel2 = 1.0 - (1.0 / pow(2.0, 2.0));\nconst float yMipLevel3 = 1.0 - (1.0 / pow(2.0, 3.0));\nconst float yMipLevel4 = 1.0 - (1.0 / pow(2.0, 4.0));\nvoid main()\n{\nvec2 uv = v_textureCoordinates;\nvec2 textureSize = vec2(originalSize * 1.5 + 2.0, originalSize);\nvec2 pixel = 1.0 / textureSize;\nfloat mipLevel = 0.0;\nif (uv.x - pixel.x > (textureSize.y / textureSize.x))\n{\nmipLevel = 1.0;\nif (uv.y - pixel.y > yMipLevel1)\n{\nmipLevel = 2.0;\nif (uv.y - pixel.y * 3.0 > yMipLevel2)\n{\nmipLevel = 3.0;\nif (uv.y - pixel.y * 5.0 > yMipLevel3)\n{\nmipLevel = 4.0;\nif (uv.y - pixel.y * 7.0 > yMipLevel4)\n{\nmipLevel = 5.0;\n}\n}\n}\n}\n}\nif (mipLevel > 0.0)\n{\nfloat scale = pow(2.0, mipLevel);\nuv.y -= (pixel.y * (mipLevel - 1.0) * 2.0);\nuv.x *= ((textureSize.x - 2.0) / textureSize.y);\nuv.x -= 1.0 + pixel.x;\nuv.y -= (1.0 - (1.0 / pow(2.0, mipLevel - 1.0)));\nuv *= scale;\n}\nelse\n{\nuv.x *= (textureSize.x / textureSize.y);\n}\nif(mipLevel == 0.0)\n{\ngl_FragColor = texture2D(texture0, uv);\n}\nelse if(mipLevel == 1.0)\n{\ngl_FragColor = texture2D(texture1, uv);\n}\nelse if(mipLevel == 2.0)\n{\ngl_FragColor = texture2D(texture2, uv);\n}\nelse if(mipLevel == 3.0)\n{\ngl_FragColor = texture2D(texture3, uv);\n}\nelse if(mipLevel == 4.0)\n{\ngl_FragColor = texture2D(texture4, uv);\n}\nelse if(mipLevel == 5.0)\n{\ngl_FragColor = texture2D(texture5, uv);\n}\nelse\n{\ngl_FragColor = vec4(0.0);\n}\n}\n",OctahedralProjectionFS="varying vec3 v_cubeMapCoordinates;\nuniform samplerCube cubeMap;\nvoid main()\n{\nvec4 rgba = textureCube(cubeMap, v_cubeMapCoordinates);\n#ifdef RGBA_NORMALIZED\ngl_FragColor = vec4(rgba.rgb, 1.0);\n#else\nfloat m = rgba.a * 16.0;\nvec3 r = rgba.rgb * m;\ngl_FragColor = vec4(r * r, 1.0);\n#endif\n}\n",OctahedralProjectionVS="attribute vec4 position;\nattribute vec3 cubeMapCoordinates;\nvarying vec3 v_cubeMapCoordinates;\nvoid main()\n{\ngl_Position = position;\nv_cubeMapCoordinates = cubeMapCoordinates;\n}\n";function OctahedralProjectedCubeMap(e){this._url=e,this._cubeMapBuffers=void 0,this._cubeMaps=void 0,this._texture=void 0,this._mipTextures=void 0,this._va=void 0,this._sp=void 0,this._maximumMipmapLevel=void 0,this._loading=!1,this._ready=!1,this._readyPromise=when.defer()}Object.defineProperties(OctahedralProjectedCubeMap.prototype,{url:{get:function(){return this._url}},texture:{get:function(){return this._texture}},maximumMipmapLevel:{get:function(){return this._maximumMipmapLevel}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}}),OctahedralProjectedCubeMap.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};for(var v1=new Cartesian3(1,0,0),v2=new Cartesian3(0,0,1),v3=new Cartesian3(-1,0,0),v4=new Cartesian3(0,0,-1),v5=new Cartesian3(0,1,0),v6=new Cartesian3(0,-1,0),cubeMapCoordinates=[v5,v3,v2,v6,v1,v5,v4,v5,v5],length=cubeMapCoordinates.length,flatCubeMapCoordinates=new Float32Array(3*length),offset=0,i$5=0;i$5<length;++i$5,offset+=3)Cartesian3.pack(cubeMapCoordinates[i$5],flatCubeMapCoordinates,offset);var flatPositions=new Float32Array([-1,1,-1,0,0,1,0,0,1,0,1,1,0,-1,-1,-1,1,-1]),indices=new Uint16Array([0,1,2,2,3,1,7,6,1,3,6,1,2,5,4,3,4,2,4,8,6,3,4,6]);function createVertexArray$3(e){var t=Buffer$1.createVertexBuffer({context:e,typedArray:flatPositions,usage:BufferUsage$1.STATIC_DRAW}),i=Buffer$1.createVertexBuffer({context:e,typedArray:flatCubeMapCoordinates,usage:BufferUsage$1.STATIC_DRAW}),r=Buffer$1.createIndexBuffer({context:e,typedArray:indices,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});return new VertexArray({context:e,attributes:[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT},{index:1,vertexBuffer:i,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT}],indexBuffer:r})}function createUniformTexture(e){return function(){return e}}function cleanupResources(e){var t,i;e._va=e._va&&e._va.destroy(),e._sp=e._sp&&e._sp.destroy();var r=e._cubeMaps;if(defined(r))for(i=r.length,t=0;t<i;++t)r[t].destroy();var n=e._mipTextures;if(defined(n))for(i=n.length,t=0;t<i;++t)n[t].destroy();e._va=void 0,e._sp=void 0,e._cubeMaps=void 0,e._cubeMapBuffers=void 0,e._mipTextures=void 0}function hasExtension(e,t){return defined(e)&&defined(e.extensions)&&defined(e.extensions[t])}OctahedralProjectedCubeMap.prototype.update=function(e){var t=e.context;if(OctahedralProjectedCubeMap.isSupported(t)&&(defined(this._texture)&&defined(this._va)&&cleanupResources(this),!defined(this._texture))){if(!defined(this._texture)&&!this._loading){var i=t.textureCache.getTexture(this._url);if(defined(i))return cleanupResources(this),this._texture=i,this._maximumMipmapLevel=this._texture.maximumMipmapLevel,this._ready=!0,void this._readyPromise.resolve()}var r=this._cubeMapBuffers;if(!defined(r)&&!this._loading){var n=this;loadKTX2(this._url).then((function(e){n._cubeMapBuffers=e,n._loading=!1})).otherwise(this._readyPromise.reject),this._loading=!0}if(defined(this._cubeMapBuffers)){var a=[],o=r[0].positiveX.pixelDatatype;defined(o)?a.push("RGBA_NORMALIZED"):o=t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT;var s=PixelFormat$1.RGBA,l=new ShaderSource({defines:a,sources:[OctahedralProjectionFS]});this._va=createVertexArray$3(t),this._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:OctahedralProjectionVS,fragmentShaderSource:l,attributeLocations:{position:0,cubeMapCoordinates:1}});var c=Math.min(r.length,6);this._maximumMipmapLevel=c-1;for(var u=this._cubeMaps=new Array(c),d=this._mipTextures=new Array(c),h=2*r[0].positiveX.width,p={originalSize:function(){return h}},f=0;f<c;++f){var m=r[f].positiveY;r[f].positiveY=r[f].negativeY,r[f].negativeY=m;var g=u[f]=new CubeMap({context:t,source:r[f],pixelDatatype:o}),_=2*u[f].width,y=d[f]=new Texture({context:t,width:_,height:_,pixelDatatype:o,pixelFormat:s}),v=new ComputeCommand({vertexArray:this._va,shaderProgram:this._sp,uniformMap:{cubeMap:createUniformTexture(g)},outputTexture:y,persists:!0,owner:this});e.commandList.push(v),p["texture"+f]=createUniformTexture(y)}this._texture=new Texture({context:t,width:1.5*h+2,height:h,pixelDatatype:o,pixelFormat:s}),this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture);var C=new ComputeCommand({fragmentShaderSource:OctahedralProjectionAtlasFS,uniformMap:p,outputTexture:this._texture,persists:!1,owner:this});e.commandList.push(C),this._ready=!0,this._readyPromise.resolve()}}},OctahedralProjectedCubeMap.prototype.isDestroyed=function(){return!1},OctahedralProjectedCubeMap.prototype.destroy=function(){return cleanupResources(this),this._texture=this._texture&&this._texture.destroy(),destroyObject(this)};var boundingSphereCartesian3Scratch=new Cartesian3,ModelState=ModelUtility.ModelState,defaultModelAccept="model/gltf-binary,model/gltf+json;q=0.8,application/json;q=0.2,*/*;q=0.01",articulationEpsilon=CesiumMath.EPSILON16;function setCachedGltf(e,t){e._cachedGltf=t}function CachedGltf(e){this._gltf=e.gltf,this.ready=e.ready,this.modelsToLoad=[],this.count=0}Object.defineProperties(CachedGltf.prototype,{gltf:{set:function(e){this._gltf=e},get:function(){return this._gltf}}}),CachedGltf.prototype.makeReady=function(e){this.gltf=e;for(var t=this.modelsToLoad,i=t.length,r=0;r<i;++r){var n=t[r];n.isDestroyed()||setCachedGltf(n,this)}this.modelsToLoad=void 0,this.ready=!0};var gltfCache={},uriToGuid={};function Model(e){var t,i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).cacheKey;if(this._cacheKey=i,this._cachedGltf=void 0,this._releaseGltfJson=defaultValue(e.releaseGltfJson,!1),defined(i)&&defined(gltfCache[i])&&gltfCache[i].ready)++(t=gltfCache[i]).count;else{var r=e.gltf;if(defined(r)){if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),r instanceof Uint8Array)t=new CachedGltf({gltf:parseGlb(r),ready:!0});else t=new CachedGltf({gltf:e.gltf,ready:!0});t.count=1,defined(i)&&(gltfCache[i]=t)}}setCachedGltf(this,t);var n=defaultValue(e.basePath,"");this._resource=Resource.createIfNeeded(n);var a=e.credit;"string"==typeof a&&(a=new Credit(a)),this._credit=a,this._resourceCredits=[],this.show=defaultValue(e.show,!0),this.silhouetteColor=defaultValue(e.silhouetteColor,Color.RED),this._silhouetteColor=new Color,this._silhouetteColorPreviousAlpha=1,this._normalAttributeName=void 0,this.silhouetteSize=defaultValue(e.silhouetteSize,0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._clampedModelMatrix=void 0,this.scale=defaultValue(e.scale,1),this._scale=this.scale,this.minimumPixelSize=defaultValue(e.minimumPixelSize,0),this._minimumPixelSize=this.minimumPixelSize,this.maximumScale=e.maximumScale,this._maximumScale=this.maximumScale,this.id=e.id,this._id=e.id,this.heightReference=defaultValue(e.heightReference,HeightReference$1.NONE),this._heightReference=this.heightReference,this._heightChanged=!1,this._removeUpdateHeightCallback=void 0;var o=e.scene;this._scene=o,defined(o)&&defined(o.terrainProviderChanged)&&(this._terrainProviderChangedCallback=o.terrainProviderChanged.addEventListener((function(){this._heightChanged=!0}),this)),this._pickObject=e.pickObject,this._allowPicking=defaultValue(e.allowPicking,!0),this._ready=!1,this._readyPromise=when.defer(),this.activeAnimations=new ModelAnimationCollection(this),this.clampAnimations=defaultValue(e.clampAnimations,!0),this._defaultTexture=void 0,this._incrementallyLoadTextures=defaultValue(e.incrementallyLoadTextures,!0),this._asynchronous=defaultValue(e.asynchronous,!0),this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this._shadows=this.shadows,this.color=Color.clone(defaultValue(e.color,Color.WHITE)),this._colorPreviousAlpha=1,this.colorBlendMode=defaultValue(e.colorBlendMode,ColorBlendMode$1.HIGHLIGHT),this.colorBlendAmount=defaultValue(e.colorBlendAmount,.5),this._colorShadingEnabled=!1,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._clippingPlanesState=0,this.referenceMatrix=void 0,this.backFaceCulling=defaultValue(e.backFaceCulling,!0),this.showOutline=defaultValue(e.showOutline,!0),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=defaultValue(e.debugWireframe,!1),this._debugWireframe=!1,this._distanceDisplayCondition=e.distanceDisplayCondition,this._addBatchIdToGeneratedShaders=e.addBatchIdToGeneratedShaders,this._precreatedAttributes=e.precreatedAttributes,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._pickIdLoaded=e.pickIdLoaded,this._ignoreCommands=defaultValue(e.ignoreCommands,!1),this._requestType=e.requestType,this._upAxis=defaultValue(e.upAxis,Axis$1.Y),this._gltfForwardAxis=Axis$1.Z,this._forwardAxis=e.forwardAxis,this.cull=defaultValue(e.cull,!0),this.opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._computedModelMatrix=new Matrix4,this._clippingPlanesMatrix=Matrix4.clone(Matrix4.IDENTITY),this._iblReferenceFrameMatrix=Matrix3.clone(Matrix3.IDENTITY),this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new BoundingSphere,this._state=ModelState.NEEDS_LOAD,this._loadResources=void 0,this._mode=void 0,this._perNodeShowDirty=!1,this._cesiumAnimationsDirty=!1,this._dirty=!1,this._maxDirtyNumber=0,this._runtime={animations:void 0,articulationsByName:void 0,articulationsByStageKey:void 0,stagesByKey:void 0,rootNodes:void 0,nodes:void 0,nodesByName:void 0,skinnedNodes:void 0,meshesByName:void 0,materialsByName:void 0,materialsById:void 0},this._uniformMaps={},this._extensionsUsed=void 0,this._extensionsRequired=void 0,this._quantizedUniforms={},this._programPrimitives={},this._rendererResources={buffers:{},vertexArrays:{},programs:{},sourceShaders:{},silhouettePrograms:{},textures:{},samplers:{},renderStates:{}},this._cachedRendererResources=void 0,this._loadRendererResourcesFromCache=!1,this._dequantizeInShader=defaultValue(e.dequantizeInShader,!0),this._decodedData={},this._cachedGeometryByteLength=0,this._cachedTexturesByteLength=0,this._geometryByteLength=0,this._texturesByteLength=0,this._trianglesLength=0,this._pointsLength=0,this._sourceTechniques={},this._sourcePrograms={},this._quantizedVertexShaders={},this._nodeCommands=[],this._pickIds=[],this._rtcCenter=void 0,this._rtcCenterEye=void 0,this._rtcCenter3D=void 0,this._rtcCenter2D=void 0,this._sourceVersion=void 0,this._sourceKHRTechniquesWebGL=void 0,this._imageBasedLightingFactor=new Cartesian2(1,1),Cartesian2.clone(e.imageBasedLightingFactor,this._imageBasedLightingFactor),this._lightColor=Cartesian3.clone(e.lightColor),this._luminanceAtZenith=void 0,this.luminanceAtZenith=defaultValue(e.luminanceAtZenith,.2),this._sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._shouldUpdateSpecularMapAtlas=!0,this._specularEnvironmentMapAtlas=void 0,this._useDefaultSphericalHarmonics=!1,this._useDefaultSpecularMaps=!1,this._shouldRegenerateShaders=!1}function silhouetteSupported(e){return e.stencilBuffer}function isColorShadingEnabled(e){return!Color.equals(e.color,Color.WHITE)||e.colorBlendMode!==ColorBlendMode$1.HIGHLIGHT}function isClippingEnabled(e){var t=e._clippingPlanes;return defined(t)&&t.enabled&&0!==t.length}function containsGltfMagic(e){return"glTF"===getMagic(e)}function getRuntime(e,t,i){return e._runtime[t][i]}Object.defineProperties(Model.prototype,{gltf:{get:function(){return defined(this._cachedGltf)?this._cachedGltf.gltf:void 0}},releaseGltfJson:{get:function(){return this._releaseGltfJson}},cacheKey:{get:function(){return this._cacheKey}},basePath:{get:function(){return this._resource.url}},boundingSphere:{get:function(){var e=this.modelMatrix;this.heightReference!==HeightReference$1.NONE&&this._clampedModelMatrix&&(e=this._clampedModelMatrix);var t=Matrix4.getScale(e,boundingSphereCartesian3Scratch),i=defined(this.maximumScale)?Math.min(this.maximumScale,this.scale):this.scale;Cartesian3.multiplyByScalar(t,i,t);var r=this._scaledBoundingSphere;return r.center=Cartesian3.multiplyComponents(this._boundingSphere.center,t,r.center),r.radius=Cartesian3.maximumComponent(t)*this._initialRadius,defined(this._rtcCenter)&&Cartesian3.add(this._rtcCenter,r.center,r.center),r}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},asynchronous:{get:function(){return this._asynchronous}},allowPicking:{get:function(){return this._allowPicking}},incrementallyLoadTextures:{get:function(){return this._incrementallyLoadTextures}},pendingTextureLoads:{get:function(){return defined(this._loadResources)?this._loadResources.pendingTextureLoads:0}},dirty:{get:function(){return this._dirty}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition)}},extensionsUsed:{get:function(){return defined(this._extensionsUsed)||(this._extensionsUsed=ModelUtility.getUsedExtensions(this.gltf)),this._extensionsUsed}},extensionsRequired:{get:function(){return defined(this._extensionsRequired)||(this._extensionsRequired=ModelUtility.getRequiredExtensions(this.gltf)),this._extensionsRequired}},upAxis:{get:function(){return this._upAxis}},forwardAxis:{get:function(){return defined(this._forwardAxis)?this._forwardAxis:this._gltfForwardAxis}},trianglesLength:{get:function(){return this._trianglesLength}},pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},texturesByteLength:{get:function(){return this._texturesByteLength}},cachedGeometryByteLength:{get:function(){return this._cachedGeometryByteLength}},cachedTexturesByteLength:{get:function(){return this._cachedTexturesByteLength}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){e!==this._clippingPlanes&&ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}},pickIds:{get:function(){return this._pickIds}},imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){var t=this._imageBasedLightingFactor;e===t||Cartesian2.equals(e,t)||(this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._imageBasedLightingFactor.x>0&&0===e.x||0===this._imageBasedLightingFactor.x&&e.x>0,this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._imageBasedLightingFactor.y>0&&0===e.y||0===this._imageBasedLightingFactor.y&&e.y>0,Cartesian2.clone(e,this._imageBasedLightingFactor))}},lightColor:{get:function(){return this._lightColor},set:function(e){var t=this._lightColor;e===t||Cartesian3.equals(e,t)||(this._shouldRegenerateShaders=this._shouldRegenerateShaders||defined(t)&&!defined(e)||defined(e)&&!defined(t),this._lightColor=Cartesian3.clone(e,t))}},luminanceAtZenith:{get:function(){return this._luminanceAtZenith},set:function(e){var t=this._luminanceAtZenith;e!==t&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||defined(t)&&!defined(e)||defined(e)&&!defined(t),this._luminanceAtZenith=e)}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients},set:function(e){e!==this._sphericalHarmonicCoefficients&&(this._sphericalHarmonicCoefficients=e,this._shouldRegenerateShaders=!0)}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps},set:function(e){this._shouldUpdateSpecularMapAtlas=this._shouldUpdateSpecularMapAtlas||e!==this._specularEnvironmentMaps,this._specularEnvironmentMaps=e}},credit:{get:function(){return this._credit}}}),Model.silhouetteSupported=function(e){return silhouetteSupported(e.context)},Model.fromGltf=function(e){var t=e.url;e=clone$1(e);var i=Resource.createIfNeeded(t),r=defaultValue(e.basePath,i.clone()),n=Resource.createIfNeeded(r),a=defaultValue(e.cacheKey,uriToGuid[getAbsoluteUri(i.url)]);defined(a)||(a=createGuid(),uriToGuid[getAbsoluteUri(i.url)]=a),defined(e.basePath)&&!defined(e.cacheKey)&&(a+=n.url),e.cacheKey=a,e.basePath=n;var o=new Model(e),s=gltfCache[a];return defined(s)?s.ready||(++s.count,s.modelsToLoad.push(o)):((s=new CachedGltf({ready:!1})).count=1,s.modelsToLoad.push(o),setCachedGltf(o,s),gltfCache[a]=s,defined(i.headers.Accept)||(i.headers.Accept=defaultModelAccept),i.fetchArrayBuffer().then((function(e){var t=new Uint8Array(e);if(containsGltfMagic(t)){var r=parseGlb(t);s.makeReady(r)}else{var n=getJsonFromTypedArray(t);s.makeReady(n)}var a=o._resourceCredits,l=i.credits;if(defined(l))for(var c=l.length,u=0;u<c;u++)a.push(l[u])})).otherwise(ModelUtility.getFailedLoadFunction(o,"model",i.url))),o},Model._gltfCache=gltfCache,Model.prototype.getNode=function(e){var t=getRuntime(this,"nodesByName",e);return defined(t)?t.publicNode:void 0},Model.prototype.getMesh=function(e){return getRuntime(this,"meshesByName",e)},Model.prototype.getMaterial=function(e){return getRuntime(this,"materialsByName",e)},Model.prototype.setArticulationStage=function(e,t){var i=getRuntime(this,"stagesByKey",e),r=getRuntime(this,"articulationsByStageKey",e);defined(i)&&defined(r)&&(t=CesiumMath.clamp(t,i.minimumValue,i.maximumValue),CesiumMath.equalsEpsilon(i.currentValue,t,articulationEpsilon)||(i.currentValue=t,r.isDirty=!0))};var scratchArticulationCartesian=new Cartesian3,scratchArticulationRotation=new Matrix3;function applyArticulationStageMatrix(e,t){var i,r=e.currentValue,n=scratchArticulationCartesian;switch(e.type){case"xRotate":i=Matrix3.fromRotationX(CesiumMath.toRadians(r),scratchArticulationRotation),Matrix4.multiplyByMatrix3(t,i,t);break;case"yRotate":i=Matrix3.fromRotationY(CesiumMath.toRadians(r),scratchArticulationRotation),Matrix4.multiplyByMatrix3(t,i,t);break;case"zRotate":i=Matrix3.fromRotationZ(CesiumMath.toRadians(r),scratchArticulationRotation),Matrix4.multiplyByMatrix3(t,i,t);break;case"xTranslate":n.x=r,n.y=0,n.z=0,Matrix4.multiplyByTranslation(t,n,t);break;case"yTranslate":n.x=0,n.y=r,n.z=0,Matrix4.multiplyByTranslation(t,n,t);break;case"zTranslate":n.x=0,n.y=0,n.z=r,Matrix4.multiplyByTranslation(t,n,t);break;case"xScale":n.x=r,n.y=1,n.z=1,Matrix4.multiplyByScale(t,n,t);break;case"yScale":n.x=1,n.y=r,n.z=1,Matrix4.multiplyByScale(t,n,t);break;case"zScale":n.x=1,n.y=1,n.z=r,Matrix4.multiplyByScale(t,n,t);break;case"uniformScale":Matrix4.multiplyByUniformScale(t,r,t)}return t}var scratchApplyArticulationTransform=new Matrix4;function addBuffersToLoadResources(e){var t=e.gltf,i=e._loadResources;ForEach.buffer(t,(function(e,t){i.buffers[t]=e.extras._pipeline.source}))}function bufferLoad(e,t){return function(i){var r=e._loadResources,n=new Uint8Array(i);--r.pendingBufferLoads,e.gltf.buffers[t].extras._pipeline.source=n}}function parseBufferViews(e){var t=e.gltf.bufferViews,i=e._loadResources.vertexBuffersToCreate;ForEach.bufferView(e.gltf,(function(e,t){e.target===WebGLConstants$1.ARRAY_BUFFER&&i.enqueue(t)}));var r=e._loadResources.indexBuffersToCreate,n={};ForEach.accessor(e.gltf,(function(e){var i=e.bufferView;defined(i)&&(t[i].target!==WebGLConstants$1.ELEMENT_ARRAY_BUFFER||defined(n[i])||(n[i]=!0,r.enqueue({id:i,componentType:e.componentType})))}))}function parseTechniques(e){var t=e.gltf;if(usesExtension(t,"KHR_techniques_webgl")){var i=e._sourcePrograms,r=e._sourceTechniques,n=t.extensions.KHR_techniques_webgl.programs;ForEach.technique(t,(function(e,t){r[t]=clone$1(e);var a=e.program;defined(i[a])||(i[a]=clone$1(n[a]))}))}}function shaderLoad(e,t,i){return function(r){var n=e._loadResources;n.shaders[i]={source:r,type:t,bufferView:void 0},--n.pendingShaderLoads,e._rendererResources.sourceShaders[i]=r}}function parseShaders(e){var t=e.gltf,i=t.buffers,r=t.bufferViews,n=e._rendererResources.sourceShaders;ForEach.shader(t,(function(t,a){if(defined(t.bufferView)){var o=t.bufferView,s=r[o],l=s.buffer,c=getStringFromTypedArray(i[l].extras._pipeline.source,s.byteOffset,s.byteLength);t.type==WebGLConstants$1.VERTEX_SHADER&&(c=shaderAddFlatten(c)),n[a]=c}else if(defined(t.extras._pipeline.source))n[a]=t.extras._pipeline.source;else{++e._loadResources.pendingShaderLoads;var u=e._resource.getDerivedResource({url:t.uri});u.fetchText().then(shaderLoad(e,t.type,a)).otherwise(ModelUtility.getFailedLoadFunction(e,"shader",u.url))}}))}function parsePrograms(e){var t=e._sourceTechniques;for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];e._loadResources.programsToCreate.enqueue({programId:r.program,techniqueId:i})}}function parseArticulations(e){var t={},i={},r={};e._runtime.articulationsByName=t,e._runtime.articulationsByStageKey=i,e._runtime.stagesByKey=r;var n=e.gltf;if(usesExtension(n,"AGI_articulations")&&defined(n.extensions)&&defined(n.extensions.AGI_articulations)){var a=n.extensions.AGI_articulations.articulations;if(defined(a))for(var o=a.length,s=0;s<o;++s){var l=clone$1(a[s]);l.nodes=[],l.isDirty=!0,t[l.name]=l;for(var c=l.stages.length,u=0;u<c;++u){var d=l.stages[u];d.currentValue=d.initialValue;var h=l.name+" "+d.name;i[h]=l,r[h]=d}}}}function imageLoad(e,t){return function(i){var r,n=e._loadResources;--n.pendingTextureLoads,Array.isArray(i)&&(r=i.slice(1,i.length).map((function(e){return e.bufferView})),i=i[0]),n.texturesToCreate.enqueue({id:t,image:i,bufferView:i.bufferView,width:i.width,height:i.height,internalFormat:i.internalFormat,mipLevels:r})}}Model.prototype.applyArticulations=function(){var e=this._runtime.articulationsByName;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];if(i.isDirty){i.isDirty=!1;for(var r=i.nodes.length,n=0;n<r;++n){for(var a=i.nodes[n],o=Matrix4.clone(a.originalMatrix,scratchApplyArticulationTransform),s=i.stages.length,l=0;l<s;++l){o=applyArticulationStageMatrix(i.stages[l],o)}a.matrix=o}}}};var ktx2Regex$2=/(^data:image\/ktx2)|(\.ktx2$)/i;function parseTextures(e,t,i){var r,n=e.gltf,a=n.images;ForEach.texture(n,(function(n,o){var s=n.source;defined(n.extensions)&&defined(n.extensions.EXT_texture_webp)&&i?s=n.extensions.EXT_texture_webp.source:defined(n.extensions)&&defined(n.extensions.KHR_texture_basisu)&&t.supportsBasis&&(s=n.extensions.KHR_texture_basisu.source);var l=a[s],c=l.bufferView,u=l.mimeType;if(r=l.uri,defined(c))e._loadResources.texturesToCreateFromBufferView.enqueue({id:o,image:void 0,bufferView:c,mimeType:u});else{++e._loadResources.pendingTextureLoads;var d=e._resource.getDerivedResource({url:r});(ktx2Regex$2.test(r)?loadKTX2(d):d.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0})).then(imageLoad(e,o)).otherwise(ModelUtility.getFailedLoadFunction(e,"image",d.url))}}))}var scratchArticulationStageInitialTransform=new Matrix4;function parseNodes(e){var t={},i={},r=[],n=e._loadResources.skinnedNodesIds,a=e._runtime.articulationsByName;ForEach.node(e.gltf,(function(o,s){var l={matrix:void 0,translation:void 0,rotation:void 0,scale:void 0,computedShow:!0,transformToRoot:new Matrix4,computedMatrix:new Matrix4,dirtyNumber:0,commands:[],inverseBindMatrices:void 0,bindShapeMatrix:void 0,joints:[],computedJointMatrices:[],jointName:o.jointName,weights:[],children:[],parents:[],publicNode:void 0};if(l.publicNode=new ModelNode(e,o,l,s,ModelUtility.getTransform(o)),t[s]=l,i[o.name]=l,defined(o.skin)&&(n.push(s),r.push(l)),defined(o.extensions)&&defined(o.extensions.AGI_articulations)){var c=o.extensions.AGI_articulations.articulationName;if(defined(c)){var u=Matrix4.clone(l.publicNode.originalMatrix,scratchArticulationStageInitialTransform),d=a[c];d.nodes.push(l.publicNode);for(var h=d.stages.length,p=0;p<h;++p){u=applyArticulationStageMatrix(d.stages[p],u)}l.publicNode.matrix=u}}})),e._runtime.nodes=t,e._runtime.nodesByName=i,e._runtime.skinnedNodes=r}function parseMaterials(e){var t=e.gltf,i=e._sourceTechniques,r={},n={},a=e._uniformMaps;ForEach.material(t,(function(t,o){a[o]={uniformMap:void 0,values:void 0,jointMatrixUniformName:void 0,morphWeightsUniformName:void 0};var s=new ModelMaterial(e,t,o);if(defined(t.extensions)&&defined(t.extensions.KHR_techniques_webgl)){var l=t.extensions.KHR_techniques_webgl.technique;s._technique=l,s._program=i[l].program,ForEach.materialValue(t,(function(e,t){defined(s._values)||(s._values={}),s._values[t]=clone$1(e)}))}r[t.name]=s,n[o]=s})),e._runtime.materialsByName=r,e._runtime.materialsById=n}function parseMeshes(e){var t={},i=e._runtime.materialsById;ForEach.mesh(e.gltf,(function(r,n){t[r.name]=new ModelMesh(r,i,n),(defined(e.extensionsUsed.WEB3D_quantized_attributes)||e._dequantizeInShader)&&ForEach.meshPrimitive(r,(function(t,i){var r=getProgramForPrimitive(e,t),a=e._programPrimitives[r];defined(a)||(a={},e._programPrimitives[r]=a),a[n+".primitive."+i]=t}))})),e._runtime.meshesByName=t}var CreateVertexBufferJob$1=function(){this.id=void 0,this.model=void 0,this.context=void 0};function modelAndPolygonIntersection(e,t){var i=Rectangle.fromCartesianArray(t),r=e._pickObject.content.tile._boundingVolume,n=r.rectangle;if(void 0!==n){if(Rectangle.intersection(n,i))return!0}else{var a=obb2Brect(r.boundingVolume);if(Rectangle.intersection(a,i))return!0}return!1}CreateVertexBufferJob$1.prototype.set=function(e,t,i){this.id=e,this.model=t,this.context=i},CreateVertexBufferJob$1.prototype.execute=function(){createVertexBuffer$2(this.id,this.model,this.context)};var boundingVolumeCenter=null;function obb2Brect(e){boundingVolumeCenter=new Cartesian3;for(var t=[],i=Cartesian3.clone(e.center,boundingVolumeCenter),r=e.halfAxes,n=[i.x,i.y,i.z],a=0;a<8;a++){for(var o=[],s=0;s<3;s++)o.push(n[s]+ +r[s+0]*(1&a?1:-1)+r[s+3]*(2&a?1:-1)+r[s+6]*(4&a?1:-1));t.push(Cartesian3.fromElements(o[0],o[1],o[2]))}return Rectangle.fromCartesianArray(t)}var createPolygonCanvas=function(e,t,i){i=defaultValue(i,1024);var r=new Rectangle(180*e.west/Math.PI,180*e.south/Math.PI,180*e.east/Math.PI,180*e.north/Math.PI),n=convertToXYVertices(t,r,i,i);return drawPolygonOnCanvas(n,"#FF0000",i,i)},convertToXYVertices=function(e,t,i,r){var n=[],a=void 0!==e[0].longitude;return e.forEach((function(e){var o=[],s=a?e:Ellipsoid.WGS84.cartesianToCartographic(e);s=getPointRelativePosition(s,t,i,r),o.push(s.normalizedLongitude),o.push(s.normalizedLatitude),n.push(o)})),n},drawPolygonOnCanvas=function(e,t,i,r,n){void 0===n&&((n=document.createElement("canvas")).width=i,n.height=r);var a=n.getContext("2d");if(!(e.length<=0)){a.moveTo(e[0][0],e[0][1]);for(var o=0;o<e.length;o++)a.lineTo(e[o][0],e[o][1]);return null!=t&&null!=t&&(a.fillStyle=t,a.fill()),n}},getPointRelativePosition=function(e,t,i,r){var n=t.west,a=t.east,o=t.south,s=a-n,l=t.north-o,c=180*e.longitude/Math.PI,u=180*e.latitude/Math.PI;return e.normalizedLongitude=(c-n)/s*i,e.normalizedLatitude=(u-o)/l*r,e};function modifyVertices(e,t){var i=t._pickObject.primitive.modifyB3dmObjects,r=null,n=null,a=t._pickObject.content.tile._boundingVolume,o=a.rectangle;if(null==o&&(o=obb2Brect(a.boundingVolume)),i.forEach((function(e){e.show&&(modelAndPolygonIntersection(t,e.polygon)&&(n=e,r=createPolygonCanvas(o,e.polygon,1024)))})),n&&r){var s,l=r.getContext("2d").getImageData(0,0,r.width,r.height).data,c=new ArrayBuffer(e.byteLength),u=new DataView(c),d=new Rectangle(180*o.west/Math.PI,180*o.south/Math.PI,180*o.east/Math.PI,180*o.north/Math.PI),h=Float32Array.BYTES_PER_ELEMENT,p=0,f=[],m=new ArrayBuffer(e.byteLength),g=new Cartographic,_=Ellipsoid.WGS84,y=t._rtcCenter;for(s=0,w=e.byteLength;s<w;s++)u.setUint8(s,e[s]);for(s=0,w=e.length;s<w;s+=12){var v=u.getFloat32(p,!0);p+=h;var C=u.getFloat32(p,!0);p+=h;var T=u.getFloat32(p,!0);p+=h;var S=new Cartesian3(v,C,T);Cartesian3.add(S,y,S);var A,x=Cartographic.fromCartesian(S,_,g),E=getPointRelativePosition(x,d,1024,1024),b=0;b=0!==isVertexInPolygon(l,{x:E.normalizedLongitude,y:E.normalizedLatitude})?n.heights[0]+.001*x.height:x.height,A=Cartesian3.fromRadians(x.longitude,x.latitude,b),Cartesian3.subtract(A,y,A),f.push(A.x),f.push(A.y),f.push(A.z)}for(var P=new DataView(m),D=0,w=f.length;D<w;D++)P.setFloat32(D*h,f[D],!0);for(var M=m.byteLength,I=new Uint8Array(M),R=0;R<M;R++)I[R]=P.getUint8(R);return I}return e}function isVertexInPolygon(e,t){var i=Math.floor(t.x);return e[4*(1024*Math.floor(t.y)+i)]}function createVertexBuffer$2(e,t,i){var r=t._loadResources,n=t.gltf.bufferViews[e];defined(n)||(n=r.createdBufferViews[e]);var a=r.getBuffer(n);t._pickObject&&t._pickObject.primitive&&"bufferView_1"===n.name&&t._pickObject.primitive.modifyB3dmObjects&&modifyVertices&&(a=modifyVertices(a,t));var o=Buffer$1.createVertexBuffer({context:i,typedArray:a,usage:BufferUsage$1.STATIC_DRAW});o.vertexArrayDestroyable=!1,t._rendererResources.buffers[e]=o,t._geometryByteLength+=o.sizeInBytes}var CreateIndexBufferJob$1=function(){this.id=void 0,this.componentType=void 0,this.model=void 0,this.context=void 0};function createIndexBuffer$1(e,t,i,r){var n=i._loadResources,a=i.gltf.bufferViews[e];defined(a)||(a=n.createdBufferViews[e]);var o=Buffer$1.createIndexBuffer({context:r,typedArray:n.getBuffer(a),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:t});o.vertexArrayDestroyable=!1,i._rendererResources.buffers[e]=o,i._geometryByteLength+=o.sizeInBytes}CreateIndexBufferJob$1.prototype.set=function(e,t,i,r){this.id=e,this.componentType=t,this.model=i,this.context=r},CreateIndexBufferJob$1.prototype.execute=function(){createIndexBuffer$1(this.id,this.componentType,this.model,this.context)};var scratchVertexBufferJob$1=new CreateVertexBufferJob$1,scratchIndexBufferJob$1=new CreateIndexBufferJob$1;function createBuffers(e,t){var i=e._loadResources;if(0===i.pendingBufferLoads){var r,n=t.context,a=i.vertexBuffersToCreate,o=i.indexBuffersToCreate;if(e.asynchronous){for(;a.length>0&&(scratchVertexBufferJob$1.set(a.peek(),e,n),t.jobScheduler.execute(scratchVertexBufferJob$1,JobType$1.BUFFER));)a.dequeue();for(;o.length>0&&(r=o.peek(),scratchIndexBufferJob$1.set(r.id,r.componentType,e,n),t.jobScheduler.execute(scratchIndexBufferJob$1,JobType$1.BUFFER));)o.dequeue()}else{for(;a.length>0;)createVertexBuffer$2(a.dequeue(),e,n);for(;o.length>0;)createIndexBuffer$1((r=o.dequeue()).id,r.componentType,e,n)}}}function getProgramForPrimitive(e,t){var i=e._runtime.materialsById[t.material];if(defined(i))return i._program}function modifyShaderForQuantizedAttributes(e,t,i){var r,n,a,o=i._programPrimitives[t];if(!defined(o))return e;for(n in o)if(o.hasOwnProperty(n)&&getProgramForPrimitive(i,r=o[n])===t)break;if(i._programPrimitives[t]=void 0,i.extensionsUsed.WEB3D_quantized_attributes)a=ModelUtility.modifyShaderForQuantizedAttributes(i.gltf,r,e),i._quantizedUniforms[t]=a.uniforms;else{var s=i._decodedData[n];if(!defined(s))return e;a=ModelUtility.modifyShaderForDracoQuantizedAttributes(i.gltf,r,e,s.attributes)}return a.shader}function modifyShaderForColor(e){return e=ShaderSource.replaceMain(e,"gltf_blend_main"),e+="uniform vec4 gltf_color; \nuniform float gltf_colorBlend; \nvoid main() \n{ \n gltf_blend_main(); \n gl_FragColor.rgb = mix(gl_FragColor.rgb, gltf_color.rgb, gltf_colorBlend); \n float highlight = ceil(gltf_colorBlend); \n gl_FragColor.rgb *= mix(gltf_color.rgb, vec3(1.0), highlight); \n gl_FragColor.a *= gltf_color.a; \n} \n"}function modifyShader(e,t,i){return defined(i)&&(e=i(e,t)),e}var CreateProgramJob=function(){this.programToCreate=void 0,this.model=void 0,this.context=void 0};function createProgram(e,t,i){var r=e.programId,n=e.techniqueId,a=t._sourcePrograms[r],o=t._rendererResources.sourceShaders,s=o[a.vertexShader],l=o[a.fragmentShader],c=t._quantizedVertexShaders;if(t.extensionsUsed.WEB3D_quantized_attributes||t._dequantizeInShader){var u=c[r];defined(u)||(u=modifyShaderForQuantizedAttributes(s,r,t),c[r]=u),s=u}var d=modifyShader(s,r,t._vertexShaderLoaded),h=modifyShader(l,r,t._fragmentShaderLoaded);defined(t._uniformMapLoaded)||(h="uniform vec4 czm_pickColor;\n"+h);var p=t._imageBasedLightingFactor.x>0||t._imageBasedLightingFactor.y>0;if(p&&(h="#define USE_IBL_LIGHTING \n\n"+h),defined(t._lightColor)&&(h="#define USE_CUSTOM_LIGHT_COLOR \n\n"+h),("2.0"!==t._sourceVersion||t._sourceKHRTechniquesWebGL)&&(h=ShaderSource.replaceMain(h,"non_gamma_corrected_main"),h+="\nvoid main() { \n non_gamma_corrected_main(); \n gl_FragColor = czm_gammaCorrect(gl_FragColor); \n} \n"),OctahedralProjectedCubeMap.isSupported(i)){var f=defined(t._sphericalHarmonicCoefficients)||t._useDefaultSphericalHarmonics,m=defined(t._specularEnvironmentMapAtlas)&&t._specularEnvironmentMapAtlas.ready||t._useDefaultSpecularMaps;(f||m||p)&&(h="uniform mat3 gltf_iblReferenceFrameMatrix; \n"+h),defined(t._sphericalHarmonicCoefficients)?h="#define DIFFUSE_IBL \n#define CUSTOM_SPHERICAL_HARMONICS \nuniform vec3 gltf_sphericalHarmonicCoefficients[9]; \n"+h:t._useDefaultSphericalHarmonics&&(h="#define DIFFUSE_IBL \n"+h),defined(t._specularEnvironmentMapAtlas)&&t._specularEnvironmentMapAtlas.ready?h="#define SPECULAR_IBL \n#define CUSTOM_SPECULAR_IBL \nuniform sampler2D gltf_specularMap; \nuniform vec2 gltf_specularMapSize; \nuniform float gltf_maxSpecularLOD; \n"+h:t._useDefaultSpecularMaps&&(h="#define SPECULAR_IBL \n"+h)}defined(t._luminanceAtZenith)&&(h="#define USE_SUN_LUMINANCE \nuniform float gltf_luminanceAtZenith;\n"+h),createAttributesAndProgram(r,n,h,d,t,i)}function recreateProgram(e,t,i){var r=e.programId,n=e.techniqueId,a=t._sourcePrograms[r],o=t._rendererResources.sourceShaders,s=t._quantizedVertexShaders,l=t.clippingPlanes,c=isClippingEnabled(t),u=o[a.vertexShader],d=o[a.fragmentShader];(t.extensionsUsed.WEB3D_quantized_attributes||t._dequantizeInShader)&&(u=s[r]);var h=d;isColorShadingEnabled(t)&&(h=Model._modifyShaderForColor(h)),c&&(h=modifyShaderForClippingPlanes(h,l,i));var p=modifyShader(u,r,t._vertexShaderLoaded),f=modifyShader(h,r,t._fragmentShaderLoaded);defined(t._uniformMapLoaded)||(f="uniform vec4 czm_pickColor;\n"+f);var m=t._imageBasedLightingFactor.x>0||t._imageBasedLightingFactor.y>0;if(m&&(f="#define USE_IBL_LIGHTING \n\n"+f),defined(t._lightColor)&&(f="#define USE_CUSTOM_LIGHT_COLOR \n\n"+f),("2.0"!==t._sourceVersion||t._sourceKHRTechniquesWebGL)&&(f=ShaderSource.replaceMain(f,"non_gamma_corrected_main"),f+="\nvoid main() { \n non_gamma_corrected_main(); \n gl_FragColor = czm_gammaCorrect(gl_FragColor); \n} \n"),OctahedralProjectedCubeMap.isSupported(i)){var g=defined(t._sphericalHarmonicCoefficients)||t._useDefaultSphericalHarmonics,_=defined(t._specularEnvironmentMapAtlas)&&t._specularEnvironmentMapAtlas.ready||t._useDefaultSpecularMaps;(g||_||m)&&(f="uniform mat3 gltf_iblReferenceFrameMatrix; \n"+f),defined(t._sphericalHarmonicCoefficients)?f="#define DIFFUSE_IBL \n#define CUSTOM_SPHERICAL_HARMONICS \nuniform vec3 gltf_sphericalHarmonicCoefficients[9]; \n"+f:t._useDefaultSphericalHarmonics&&(f="#define DIFFUSE_IBL \n"+f),defined(t._specularEnvironmentMapAtlas)&&t._specularEnvironmentMapAtlas.ready?f="#define SPECULAR_IBL \n#define CUSTOM_SPECULAR_IBL \nuniform sampler2D gltf_specularMap; \nuniform vec2 gltf_specularMapSize; \nuniform float gltf_maxSpecularLOD; \n"+f:t._useDefaultSpecularMaps&&(f="#define SPECULAR_IBL \n"+f)}defined(t._luminanceAtZenith)&&(f="#define USE_SUN_LUMINANCE \nuniform float gltf_luminanceAtZenith;\n"+f),createAttributesAndProgram(r,n,f,p,t,i)}function createAttributesAndProgram(e,t,i,r,n,a){var o=n._sourceTechniques[t],s=ModelUtility.createAttributeLocations(o,n._precreatedAttributes);n._rendererResources.programs[e]=ShaderProgram.fromCache({context:a,vertexShaderSource:r,fragmentShaderSource:i,attributeLocations:s})}CreateProgramJob.prototype.set=function(e,t,i){this.programToCreate=e,this.model=t,this.context=i},CreateProgramJob.prototype.execute=function(){createProgram(this.programToCreate,this.model,this.context)};var scratchCreateProgramJob=new CreateProgramJob;function createPrograms(e,t){var i=e._loadResources,r=i.programsToCreate;if(0===i.pendingShaderLoads&&0===i.pendingBufferLoads){var n=t.context;if(e.asynchronous)for(;r.length>0&&(scratchCreateProgramJob.set(r.peek(),e,n),t.jobScheduler.execute(scratchCreateProgramJob,JobType$1.PROGRAM));)r.dequeue();else for(;r.length>0;)createProgram(r.dequeue(),e,n)}}function getOnImageCreatedFromTypedArray(e,t){return function(i){e.texturesToCreate.enqueue({id:t.id,image:i,bufferView:void 0}),--e.pendingBufferViewToImage}}function loadTexturesFromBufferViews(e){var t=e._loadResources;if(0===t.pendingBufferLoads)for(;t.texturesToCreateFromBufferView.length>0;){var i=t.texturesToCreateFromBufferView.dequeue(),r=e.gltf,n=r.bufferViews[i.bufferView];r.textures[i.id].source;var a=ModelUtility.getFailedLoadFunction(e,"image","id: "+i.id+", bufferView: "+i.bufferView);if("image/ktx2"===i.mimeType){loadKTX2(new Uint8Array(t.getBuffer(n))).then(imageLoad(e,i.id)).otherwise(a),++e._loadResources.pendingTextureLoads}else{var o=getOnImageCreatedFromTypedArray(t,i);loadImageFromTypedArray({uint8Array:t.getBuffer(n),format:i.mimeType,flipY:!1,skipColorSpaceConversion:!0}).then(o).otherwise(a),++t.pendingBufferViewToImage}}}function createSamplers(e){var t=e._loadResources;if(t.createSamplers){t.createSamplers=!1;var i=e._rendererResources.samplers;ForEach.sampler(e.gltf,(function(e,t){i[t]=new Sampler({wrapS:e.wrapS,wrapT:e.wrapT,minificationFilter:e.minFilter,magnificationFilter:e.magFilter})}))}}var CreateTextureJob$1=function(){this.gltfTexture=void 0,this.model=void 0,this.context=void 0};function createTexture$2(e,t,i){var r=t.gltf.textures[e.id],n=t._rendererResources.samplers[r.sampler];defined(n)||(n=new Sampler({wrapS:TextureWrap$1.REPEAT,wrapT:TextureWrap$1.REPEAT}));for(var a=!1,o=t.gltf.materials,s=o.length,l=0;l<s;++l){var c=o[l];if(defined(c.extensions)&&defined(c.extensions.KHR_techniques_webgl)){var u=c.extensions.KHR_techniques_webgl.values;for(var d in u)if(u.hasOwnProperty(d)&&-1!==d.indexOf("Texture")){var h=u[d];if(h.index===e.id&&defined(h.extensions)&&defined(h.extensions.KHR_texture_transform)){a=!0;break}}}if(a)break}var p=n.wrapS,f=n.wrapT,m=n.minificationFilter;a&&m!==TextureMinificationFilter$1.LINEAR&&m!==TextureMinificationFilter$1.NEAREST&&(m=m===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||m===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR?TextureMinificationFilter$1.NEAREST:TextureMinificationFilter$1.LINEAR,n=new Sampler({wrapS:n.wrapS,wrapT:n.wrapT,minificationFilter:m,magnificationFilter:n.magnificationFilter}));var g,_,y=e.internalFormat,v=!(defined(y)&&PixelFormat$1.isCompressedFormat(y)||m!==TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST&&m!==TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR&&m!==TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST&&m!==TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR),C=v||p===TextureWrap$1.REPEAT||p===TextureWrap$1.MIRRORED_REPEAT||f===TextureWrap$1.REPEAT||f===TextureWrap$1.MIRRORED_REPEAT,T=e.image;if(defined(y)){g=!CesiumMath.isPowerOfTwo(e.width)||!CesiumMath.isPowerOfTwo(e.height),!i.webgl2&&PixelFormat$1.isCompressedFormat(y)&&g&&C&&console.warn("Compressed texture uses REPEAT or MIRRORED_REPEAT texture wrap mode and dimensions are not powers of two. The texture may be rendered incorrectly. See the Model.js constructor documentation for more information.");var S=n.minificationFilter;defined(e.mipLevels)||m!==TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST&&m!==TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR?defined(e.mipLevels)||m!==TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST&&m!==TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR||(S=TextureMinificationFilter$1.LINEAR):S=TextureMinificationFilter$1.NEAREST,n=new Sampler({wrapS:n.wrapS,wrapT:n.wrapT,minificationFilter:S,magnificationFilter:n.magnificationFilter}),_=new Texture({context:i,source:{arrayBufferView:e.bufferView,mipLevels:e.mipLevels},width:e.width,height:e.height,pixelFormat:y,sampler:n})}else if(defined(T)){if(g=!CesiumMath.isPowerOfTwo(T.width)||!CesiumMath.isPowerOfTwo(T.height),C&&g){var A=document.createElement("canvas");A.width=CesiumMath.nextPowerOfTwo(T.width),A.height=CesiumMath.nextPowerOfTwo(T.height),A.getContext("2d").drawImage(T,0,0,T.width,T.height,0,0,A.width,A.height),T=A}_=new Texture({context:i,source:T,pixelFormat:r.internalFormat,pixelDatatype:r.type,sampler:n,flipY:!1,skipColorSpaceConversion:!0}),v&&_.generateMipmap()}defined(_)&&(t._rendererResources.textures[e.id]=_,t._texturesByteLength+=_.sizeInBytes)}CreateTextureJob$1.prototype.set=function(e,t,i){this.gltfTexture=e,this.model=t,this.context=i},CreateTextureJob$1.prototype.execute=function(){createTexture$2(this.gltfTexture,this.model,this.context)};var scratchCreateTextureJob=new CreateTextureJob$1;function createTextures$2(e,t){var i=t.context,r=e._loadResources.texturesToCreate;if(e.asynchronous)for(;r.length>0&&(scratchCreateTextureJob.set(r.peek(),e,i),t.jobScheduler.execute(scratchCreateTextureJob,JobType$1.TEXTURE));)r.dequeue();else for(;r.length>0;)createTexture$2(r.dequeue(),e,i)}function getAttributeLocations$1(e,t){var i,r,n=e._sourceTechniques,a={},o=e._runtime.materialsById[t.material];if(!defined(o))return a;var s=n[o._technique];if(!defined(s))return a;var l=s.attributes,c=e._rendererResources.programs[s.program]._attributeLocations;for(i in c)if(c.hasOwnProperty(i)){var u=l[i];defined(u)&&(r=c[i],a[u.semantic]=r)}var d=e._precreatedAttributes;if(defined(d))for(i in d)d.hasOwnProperty(i)&&(r=c[i],a[i]=r);return a}function createJoints(e,t){for(var i=e.gltf,r=i.skins,n=i.nodes,a=e._runtime.nodes,o=e._loadResources.skinnedNodesIds,s=o.length,l=0;l<s;++l){var c=o[l],u=a[c],d=n[c],h=t[d.skin];u.inverseBindMatrices=h.inverseBindMatrices,u.bindShapeMatrix=h.bindShapeMatrix;for(var p=r[d.skin].joints,f=p.length,m=0;m<f;++m){var g=a[p[m]];u.joints.push(g)}}}function createSkins(e){var t=e._loadResources;if(0===t.pendingBufferLoads&&t.createSkins){t.createSkins=!1;var i=e.gltf,r=i.accessors,n={};ForEach.skin(i,(function(t,i){var a,o=r[t.inverseBindMatrices];Matrix4.equals(t.bindShapeMatrix,Matrix4.IDENTITY)||(a=Matrix4.clone(t.bindShapeMatrix)),n[i]={inverseBindMatrices:ModelAnimationCache.getSkinInverseBindMatrices(e,o),bindShapeMatrix:a}})),createJoints(e,n)}}function getChannelEvaluator(e,t,i,r){return function(n){defined(r)&&(n=e.clampAnimations?r.clampTime(n):r.wrapTime(n),t[i]=r.evaluate(n,t[i]),t.dirtyNumber=e._maxDirtyNumber)}}function createRuntimeAnimations(e){var t=e._loadResources;if(t.finishedPendingBufferLoads()&&t.createRuntimeAnimations){t.createRuntimeAnimations=!1,e._runtime.animations=[];var i=e._runtime.nodes,r=e.gltf.accessors;ForEach.animation(e.gltf,(function(t,n){for(var a=t.channels,o=t.samplers,s=Number.MAX_VALUE,l=-Number.MAX_VALUE,c=a.length,u=new Array(c),d=0;d<c;++d){var h=a[d],p=h.target,f=p.path,m=o[h.sampler],g=ModelAnimationCache.getAnimationParameterValues(e,r[m.input]),_=ModelAnimationCache.getAnimationParameterValues(e,r[m.output]);s=Math.min(s,g[0]),l=Math.max(l,g[g.length-1]);var y=ModelAnimationCache.getAnimationSpline(e,n,t,h.sampler,m,g,f,_);u[d]=getChannelEvaluator(e,i[p.node],p.path,y)}e._runtime.animations[n]={name:t.name,startTime:s,stopTime:l,channelEvaluators:u}}))}}function createVertexArrays$1(e,t){var i=e._loadResources;if(i.finishedBuffersCreation()&&i.finishedProgramCreation()&&i.createVertexArrays){i.createVertexArrays=!1;var r=e._rendererResources.buffers,n=e._rendererResources.vertexArrays,a=e.gltf,o=a.accessors;ForEach.mesh(a,(function(i,s){ForEach.meshPrimitive(i,(function(i,l){var c,u,d,h=[],p=getAttributeLocations$1(e,i),f=e._decodedData[s+".primitive."+l];ForEach.meshPrimitiveAttribute(i,(function(e,t){if(defined(c=p[t])){if(defined(f)){var i=f.attributes;if(i.hasOwnProperty(t)){var n=i[t];return void h.push({index:c,vertexBuffer:r[n.bufferView],componentsPerAttribute:n.componentsPerAttribute,componentDatatype:n.componentDatatype,normalize:n.normalized,offsetInBytes:n.byteOffset,strideInBytes:n.byteStride})}}var s=o[e],l=defined(s.normalized)&&s.normalized;h.push({index:c,vertexBuffer:r[s.bufferView],componentsPerAttribute:numberOfComponentsForType(s.type),componentDatatype:s.componentType,normalize:l,offsetInBytes:s.byteOffset,strideInBytes:getAccessorByteStride(a,s)})}}));var m,g=e._precreatedAttributes;if(defined(g))for(d in g)g.hasOwnProperty(d)&&defined(c=p[d])&&((u=g[d]).index=c,h.push(u));if(defined(i.indices)){var _=o[i.indices].bufferView;defined(f)&&(_=f.bufferView),m=r[_]}n[s+".primitive."+l]=new VertexArray({context:t,attributes:h,indexBuffer:m})}))}))}}function createRenderStates$3(e){var t=e._loadResources;t.createRenderStates&&(t.createRenderStates=!1,ForEach.material(e.gltf,(function(t,i){createRenderStateForMaterial(e,t,i)})))}function createRenderStateForMaterial(e,t,i){var r=e._rendererResources.renderStates,n=[WebGLConstants$1.FUNC_ADD,WebGLConstants$1.FUNC_ADD],a=[WebGLConstants$1.ONE,WebGLConstants$1.ONE_MINUS_SRC_ALPHA,WebGLConstants$1.ONE,WebGLConstants$1.ONE_MINUS_SRC_ALPHA];defined(t.extensions)&&defined(t.extensions.KHR_blend)&&(n=t.extensions.KHR_blend.blendEquation,a=t.extensions.KHR_blend.blendFactors);var o=!t.doubleSided,s="BLEND"===t.alphaMode;r[i]=RenderState.fromCache({cull:{enabled:o},depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},depthMask:!s,blending:{enabled:s,equationRgb:n[0],equationAlpha:n[1],functionSourceRgb:a[0],functionDestinationRgb:a[1],functionSourceAlpha:a[2],functionDestinationAlpha:a[3]}})}var gltfUniformsFromNode={MODEL:function(e,t,i){return function(){return i.computedMatrix}},VIEW:function(e,t,i){return function(){return e.view}},PROJECTION:function(e,t,i){return function(){return e.projection}},MODELVIEW:function(e,t,i){var r=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,r)}},CESIUM_RTC_MODELVIEW:function(e,t,i){var r=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,r),Matrix4.setTranslation(r,t._rtcCenterEye,r)}},MODELVIEWPROJECTION:function(e,t,i){var r=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,r),Matrix4.multiply(e._projection,r,r)}},MODELINVERSE:function(e,t,i){var r=new Matrix4;return function(){return Matrix4.inverse(i.computedMatrix,r)}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t,i){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t,i){var r=new Matrix4,n=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,r),Matrix4.inverse(r,n)}},MODELVIEWPROJECTIONINVERSE:function(e,t,i){var r=new Matrix4,n=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,r),Matrix4.multiply(e._projection,r,r),Matrix4.inverse(r,n)}},MODELINVERSETRANSPOSE:function(e,t,i){var r=new Matrix4,n=new Matrix3;return function(){return Matrix4.inverse(i.computedMatrix,r),Matrix4.getMatrix3(r,n),Matrix3.transpose(n,n)}},MODELVIEWINVERSETRANSPOSE:function(e,t,i){var r=new Matrix4,n=new Matrix4,a=new Matrix3;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,r),Matrix4.inverse(r,n),Matrix4.getMatrix3(n,a),Matrix3.transpose(a,a)}},VIEWPORT:function(e,t,i){return function(){return e.viewportCartesian4}}};function getUniformFunctionFromSource(e,t,i,r){var n=t._runtime.nodes[e];return gltfUniformsFromNode[i](r,t,n)}function createUniformsForMaterial(e,t,i,r,n,a,o){var s,l,c={},u={};return ForEach.techniqueUniform(i,(function(i,d){var h;if(defined(r)&&defined(r[d]))h=ModelUtility.createUniformFunction(i.type,r[d],a,o),c[d]=h.func,u[d]=h;else if(defined(i.node))c[d]=getUniformFunctionFromSource(i.node,e,i.semantic,n.uniformState);else if(defined(i.semantic))if("JOINTMATRIX"===i.semantic)s=d;else if("MORPHWEIGHTS"===i.semantic)l=d;else if("ALPHACUTOFF"===i.semantic){var p=t.alphaMode;if(defined(p)&&"MASK"===p){var f=defaultValue(t.alphaCutoff,.5);h=ModelUtility.createUniformFunction(i.type,f,a,o),c[d]=h.func,u[d]=h}}else c[d]=ModelUtility.getGltfSemanticUniforms()[i.semantic](n.uniformState,e);else if(defined(i.value)){var m=ModelUtility.createUniformFunction(i.type,i.value,a,o);c[d]=m.func,u[d]=m}})),{map:c,values:u,jointMatrixUniformName:s,morphWeightsUniformName:l}}function createUniformMaps(e,t){var i=e._loadResources;if(i.finishedProgramCreation()&&i.createUniformMaps){i.createUniformMaps=!1;var r=e.gltf,n=e._sourceTechniques,a=e._uniformMaps,o=e._rendererResources.textures,s=e._defaultTexture;ForEach.material(r,(function(i,r){var l=e._runtime.materialsById[r],c=n[l._technique],u=l._values,d=createUniformsForMaterial(e,i,c,u,t,o,s),h=a[r];if(h.uniformMap=d.map,h.values=d.values,h.jointMatrixUniformName=d.jointMatrixUniformName,h.morphWeightsUniformName=d.morphWeightsUniformName,defined(c.attributes.a_outlineCoordinates)){var p=ModelOutlineLoader.createTexture(e,t);h.uniformMap.u_outlineTexture=function(){return p}}}))}}function createUniformsForDracoQuantizedAttributes(e){return ModelUtility.createUniformsForDracoQuantizedAttributes(e.attributes)}function createUniformsForQuantizedAttributes(e,t){var i=getProgramForPrimitive(e,t),r=e._quantizedUniforms[i];return ModelUtility.createUniformsForQuantizedAttributes(e.gltf,t,r)}function createPickColorFunction$1(e){return function(){return e}}function createJointMatricesFunction(e){return function(){return e.computedJointMatrices}}function createMorphWeightsFunction(e){return function(){return e.weights}}function createSilhouetteColorFunction(e){return function(){return e.silhouetteColor}}function createSilhouetteSizeFunction(e){return function(){return e.silhouetteSize}}function createColorFunction(e){return function(){return e.color}}function createClippingPlanesMatrixFunction(e){return function(){return e._clippingPlanesMatrix}}function createIBLReferenceFrameMatrixFunction(e){return function(){return e._iblReferenceFrameMatrix}}function createClippingPlanesFunction(e){return function(){var t=e.clippingPlanes;return defined(t)&&t.enabled?t.texture:e._defaultTexture}}function createClippingPlanesEdgeStyleFunction(e){return function(){var t=e.clippingPlanes;if(!defined(t))return Color.WHITE.withAlpha(0);var i=Color.clone(t.edgeColor);return i.alpha=t.edgeWidth,i}}function createColorBlendFunction(e){return function(){return ColorBlendMode$1.getColorBlend(e.colorBlendMode,e.colorBlendAmount)}}function createIBLFactorFunction(e){return function(){return e._imageBasedLightingFactor}}function createLightColorFunction(e){return function(){return e._lightColor}}function createLuminanceAtZenithFunction(e){return function(){return e.luminanceAtZenith}}function createPolygonTexture(e,t){return function(){if(e._pickObject){if(e._pickObject.primitive&&e._pickObject.primitive.modifyMeshObject){if(!e._pickObject.primitive.modifyMeshObject.texture){if(!e._pickObject.primitive.modifyMeshObject.image)return e._defaultTexture;updateModifyTexture(e,t)}return e._pickObject.primitive.modifyMeshObject.texture?e._pickObject.primitive.modifyMeshObject.texture:e._defaultTexture}return e._defaultTexture}return e._defaultTexture}}function createPolygonBounds(e){return function(){if(e._pickObject){if(e._pickObject.primitive&&e._pickObject.primitive.modifyMeshObject){if(!e._pickObject.primitive.modifyMeshObject.modelBounds){if(!e._pickObject.primitive.modifyMeshObject.polygonGeometry)return new Cartesian4(0,0,0,0);updateModifyBounds(e)}return e._pickObject.primitive.modifyMeshObject.modelBounds?e._pickObject.primitive.modifyMeshObject.modelBounds:new Cartesian4(0,0,0,0)}return new Cartesian4(0,0,0,0)}return new Cartesian4(0,0,0,0)}}function createIsFlatten(e){return function(){return!(!e._pickObject||!e._pickObject.primitive)&&!!e._pickObject.primitive.modifyMeshObject}}function createFlattenHeight(e){return function(){var t=0;return e._pickObject&&e._pickObject.primitive&&e._pickObject.primitive.modifyMeshObject&&(null!=e._pickObject.primitive.modifyMeshObject.relativeHeight&&null!=e._pickObject.primitive.modifyMeshObject.relativeHeight||null!=e._pickObject.primitive.modifyMeshObject.height&&updateModifyRelativeHeight(e),null!=e._pickObject.primitive.modifyMeshObject.relativeHeight&&(t=e._pickObject.primitive.modifyMeshObject.relativeHeight)),t}}function createSphericalHarmonicCoefficientsFunction(e){return function(){return e._sphericalHarmonicCoefficients}}function createSpecularEnvironmentMapFunction(e){return function(){return e._specularEnvironmentMapAtlas.texture}}function createSpecularEnvironmentMapSizeFunction(e){return function(){return e._specularEnvironmentMapAtlas.texture.dimensions}}function createSpecularEnvironmentMapLOD(e){return function(){return e._specularEnvironmentMapAtlas.maximumMipmapLevel}}function triangleCountFromPrimitiveIndices(e,t){switch(e.mode){case PrimitiveType$1.TRIANGLES:return t/3;case PrimitiveType$1.TRIANGLE_STRIP:case PrimitiveType$1.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function createCommand$2(e,t,i,r,n){for(var a=e._nodeCommands,o=e._pickIds,s=e.allowPicking,l=e._runtime.meshesByName,c=e._rendererResources,u=c.vertexArrays,d=c.programs,h=c.renderStates,p=e._uniformMaps,f=e.gltf,m=f.accessors,g=f.meshes,_=t.mesh,y=g[_],v=y.primitives,C=v.length,T=0;T<C;++T){var S,A=v[T],x=m[A.indices],E=e._runtime.materialsById[A.material]._program,b=e._decodedData[_+".primitive."+T],P=A.attributes.POSITION;if(defined(P)){var D=ModelUtility.getAccessorMinMax(f,P);S=BoundingSphere.fromCornerPoints(Cartesian3.fromArray(D.min),Cartesian3.fromArray(D.max))}var w,M,I=u[_+".primitive."+T];if(defined(b))M=b.numberOfIndices,w=0;else if(defined(x))M=x.count,w=x.byteOffset/IndexDatatype$1.getSizeInBytes(x.componentType);else{M=m[A.attributes.POSITION].count,w=0}e._trianglesLength+=triangleCountFromPrimitiveIndices(A,M),A.mode===PrimitiveType$1.POINTS&&(e._pointsLength+=M);var R=p[A.material],O=R.uniformMap;if(defined(R.jointMatrixUniformName)){var B={};B[R.jointMatrixUniformName]=createJointMatricesFunction(i),O=combine$2(O,B)}if(defined(R.morphWeightsUniformName)){var L={};L[R.morphWeightsUniformName]=createMorphWeightsFunction(i),O=combine$2(O,L)}O=combine$2(O,{gltf_color:createColorFunction(e),gltf_colorBlend:createColorBlendFunction(e),gltf_clippingPlanes:createClippingPlanesFunction(e),gltf_clippingPlanesEdgeStyle:createClippingPlanesEdgeStyleFunction(e),gltf_clippingPlanesMatrix:createClippingPlanesMatrixFunction(e),gltf_iblReferenceFrameMatrix:createIBLReferenceFrameMatrixFunction(e),gltf_iblFactor:createIBLFactorFunction(e),gltf_lightColor:createLightColorFunction(e),gltf_sphericalHarmonicCoefficients:createSphericalHarmonicCoefficientsFunction(e),gltf_specularMap:createSpecularEnvironmentMapFunction(e),gltf_specularMapSize:createSpecularEnvironmentMapSizeFunction(e),gltf_maxSpecularLOD:createSpecularEnvironmentMapLOD(e),gltf_luminanceAtZenith:createLuminanceAtZenithFunction(e),u_polygonTexture:createPolygonTexture(e,r),u_polygonBounds:createPolygonBounds(e),u_isFlatten:createIsFlatten(e),u_flattenHeight:createFlattenHeight(e)}),defined(e._uniformMapLoaded)&&(O=e._uniformMapLoaded(O,E,i));var F={};e.extensionsUsed.WEB3D_quantized_attributes?F=createUniformsForQuantizedAttributes(e,A):e._dequantizeInShader&&defined(b)&&(F=createUniformsForDracoQuantizedAttributes(b)),O=combine$2(O,F);var N=h[A.material],V=N.blending.enabled,k=e._pickObject;defined(k)||(k={primitive:e,id:e.id,node:i.publicNode,mesh:l[y.name]});var U,G=ShadowMode$1.castShadows(e._shadows),$=ShadowMode$1.receiveShadows(e._shadows);if(s&&!defined(e._uniformMapLoaded))U=r.createPickId(k),o.push(U),O=combine$2(O,{czm_pickColor:createPickColorFunction$1(U.color)});s&&(U=defined(e._pickIdLoaded)&&defined(e._uniformMapLoaded)?e._pickIdLoaded():"czm_pickColor");var z,H=new DrawCommand({boundingVolume:new BoundingSphere,cull:e.cull,modelMatrix:new Matrix4,primitiveType:A.mode,vertexArray:I,count:M,offset:w,shaderProgram:d[E],castShadows:G,receiveShadows:$,uniformMap:O,renderState:N,owner:k,pass:V?Pass$1.TRANSLUCENT:e.opaquePass,pickId:U});n||((z=DrawCommand.shallowClone(H)).boundingVolume=new BoundingSphere,z.modelMatrix=new Matrix4);var W={show:!0,boundingSphere:S,command:H,command2D:z,silhouetteModelCommand:void 0,silhouetteModelCommand2D:void 0,silhouetteColorCommand:void 0,silhouetteColorCommand2D:void 0,translucentCommand:void 0,translucentCommand2D:void 0,disableCullingCommand:void 0,disableCullingCommand2D:void 0,programId:E};i.commands.push(W),a.push(W)}}function createRuntimeNodes(e,t,i){var r=e._loadResources;if(r.finishedEverythingButTextureCreation()&&r.createRuntimeNodes){r.createRuntimeNodes=!1;for(var n=[],a=e._runtime.nodes,o=e.gltf,s=o.nodes,l=o.scenes[o.scene].nodes,c=l.length,u=[],d={},h=0;h<c;++h)for(u.push({parentRuntimeNode:void 0,gltfNode:s[l[h]],id:l[h]});u.length>0;){var p=u.pop();d[p.id]=!0;var f=p.parentRuntimeNode,m=p.gltfNode,g=a[p.id];if(0===g.parents.length)if(defined(m.matrix))g.matrix=Matrix4.fromColumnMajorArray(m.matrix);else{var _=m.rotation;g.translation=Cartesian3.fromArray(m.translation),g.rotation=Quaternion.unpack(_),g.scale=Cartesian3.fromArray(m.scale)}defined(f)?(f.children.push(g),g.parents.push(f)):n.push(g),defined(m.mesh)&&createCommand$2(e,m,g,t,i);var y=m.children;if(defined(y))for(var v=y.length,C=0;C<v;C++){var T=y[C];d[T]||u.push({parentRuntimeNode:g,gltfNode:s[T],id:y[C]})}}e._runtime.rootNodes=n,e._runtime.nodes=a}}function getGeometryByteLength(e){var t=0;for(var i in e)e.hasOwnProperty(i)&&(t+=e[i].sizeInBytes);return t}function getTexturesByteLength(e){var t=0;for(var i in e)e.hasOwnProperty(i)&&(t+=e[i].sizeInBytes);return t}function createResources$5(e,t){var i=t.context,r=t.scene3DOnly,n=e._quantizedVertexShaders,a=e._sourceTechniques,o=e._sourcePrograms,s=e._rendererResources,l=s.sourceShaders;for(var c in e._loadRendererResourcesFromCache&&(l=s.sourceShaders=e._cachedRendererResources.sourceShaders),a)if(a.hasOwnProperty(c)){var u=a[c].program,d=o[u],h=l[d.vertexShader];if(ModelUtility.checkSupportedGlExtensions(d.glExtensions,i),e.extensionsUsed.WEB3D_quantized_attributes||e._dequantizeInShader){var p=n[u];defined(p)||(p=modifyShaderForQuantizedAttributes(h,u,e),n[u]=p),h=p}h=modifyShader(h,u,e._vertexShaderLoaded)}if(e._loadRendererResourcesFromCache){var f=e._cachedRendererResources;s.buffers=f.buffers,s.vertexArrays=f.vertexArrays,s.programs=f.programs,s.silhouettePrograms=f.silhouettePrograms,s.textures=f.textures,s.samplers=f.samplers,s.renderStates=f.renderStates,defined(e._precreatedAttributes)&&createVertexArrays$1(e,i),e._cachedGeometryByteLength+=getGeometryByteLength(f.buffers),e._cachedTexturesByteLength+=getTexturesByteLength(f.textures)}else createBuffers(e,t),createPrograms(e,t),createSamplers(e),loadTexturesFromBufferViews(e),createTextures$2(e,t);createSkins(e),createRuntimeAnimations(e),e._loadRendererResourcesFromCache||(createVertexArrays$1(e,i),createRenderStates$3(e)),createUniformMaps(e,i),createRuntimeNodes(e,i,r)}function getNodeMatrix(e,t){var i=e.publicNode,r=i.matrix;i.useMatrix&&defined(r)?Matrix4.clone(r,t):defined(e.matrix)?Matrix4.clone(e.matrix,t):(Matrix4.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t),i.setMatrix(t))}var scratchNodeStack=[],scratchComputedTranslation$1=new Cartesian4,scratchComputedMatrixIn2D=new Matrix4;function updateNodeHierarchyModelMatrix(e,t,i,r){var n=e._maxDirtyNumber,a=e._runtime.rootNodes,o=a.length,s=scratchNodeStack,l=e._computedModelMatrix;if(e._mode!==SceneMode$1.SCENE3D&&!e._ignoreCommands){var c=Matrix4.getColumn(l,3,scratchComputedTranslation$1);if(Cartesian4.equals(c,Cartesian4.UNIT_W)){var u=e.boundingSphere.center,d=Transforms.wgs84To2DModelMatrix(r,u,scratchComputedMatrixIn2D);l=Matrix4.multiply(d,l,scratchComputedMatrixIn2D),defined(e._rtcCenter)&&(Matrix4.setTranslation(l,Cartesian4.UNIT_W,l),e._rtcCenter=e._rtcCenter2D)}else l=Transforms.basisTo2D(r,l,scratchComputedMatrixIn2D),e._rtcCenter=e._rtcCenter3D}for(var h=0;h<o;++h){var p=a[h];for(getNodeMatrix(p,p.transformToRoot),s.push(p);s.length>0;){var f=(p=s.pop()).transformToRoot,m=p.commands;if(p.dirtyNumber===n||t||i){var g=Matrix4.multiplyTransformation(l,f,p.computedMatrix),_=m.length;if(_>0)for(var y=0;y<_;++y){var v=m[y],C=v.command;Matrix4.clone(g,C.modelMatrix),BoundingSphere.transform(v.boundingSphere,C.modelMatrix,C.boundingVolume),defined(e._rtcCenter)&&Cartesian3.add(e._rtcCenter,C.boundingVolume.center,C.boundingVolume.center),defined(C=v.command2D)&&e._mode===SceneMode$1.SCENE2D&&(Matrix4.clone(g,C.modelMatrix),C.modelMatrix[13]-=2*CesiumMath.sign(C.modelMatrix[13])*CesiumMath.PI*r.ellipsoid.maximumRadius,BoundingSphere.transform(v.boundingSphere,C.modelMatrix,C.boundingVolume))}}var T=p.children;if(defined(T))for(var S=T.length,A=0;A<S;++A){var x=T[A];x.dirtyNumber=Math.max(x.dirtyNumber,p.dirtyNumber),(x.dirtyNumber===n||i)&&(getNodeMatrix(x,x.transformToRoot),Matrix4.multiplyTransformation(f,x.transformToRoot,x.transformToRoot)),s.push(x)}}}++e._maxDirtyNumber}var scratchObjectSpace=new Matrix4;function applySkins(e){for(var t=e._runtime.skinnedNodes,i=t.length,r=0;r<i;++r){var n=t[r];scratchObjectSpace=Matrix4.inverseTransformation(n.transformToRoot,scratchObjectSpace);for(var a=n.computedJointMatrices,o=n.joints,s=n.bindShapeMatrix,l=n.inverseBindMatrices,c=l.length,u=0;u<c;++u)defined(a[u])||(a[u]=new Matrix4),a[u]=Matrix4.multiplyTransformation(scratchObjectSpace,o[u].transformToRoot,a[u]),a[u]=Matrix4.multiplyTransformation(a[u],l[u],a[u]),defined(s)&&(a[u]=Matrix4.multiplyTransformation(a[u],s,a[u]))}}function updatePerNodeShow(e){for(var t=e._runtime.rootNodes,i=t.length,r=scratchNodeStack,n=0;n<i;++n){var a=t[n];for(a.computedShow=a.publicNode.show,r.push(a);r.length>0;){for(var o=(a=r.pop()).computedShow,s=a.commands,l=s.length,c=0;c<l;++c)s[c].show=o;var u=a.children;if(defined(u))for(var d=u.length,h=0;h<d;++h){var p=u[h];p.computedShow=o&&p.publicNode.show,r.push(p)}}}}function updatePickIds(e,t){var i=e.id;if(e._id!==i){e._id=i;for(var r=e._pickIds,n=r.length,a=0;a<n;++a)r[a].object.id=i}}function updateWireframe$1(e){if(e._debugWireframe!==e.debugWireframe){e._debugWireframe=e.debugWireframe;for(var t=e.debugWireframe?PrimitiveType$1.LINES:PrimitiveType$1.TRIANGLES,i=e._nodeCommands,r=i.length,n=0;n<r;++n)i[n].command.primitiveType=t}}function updateShowBoundingVolume$2(e){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume){e._debugShowBoundingVolume=e.debugShowBoundingVolume;for(var t=e.debugShowBoundingVolume,i=e._nodeCommands,r=i.length,n=0;n<r;++n)i[n].command.debugShowBoundingVolume=t}}function updateShadows$1(e){if(e.shadows!==e._shadows){e._shadows=e.shadows;for(var t=ShadowMode$1.castShadows(e.shadows),i=ShadowMode$1.receiveShadows(e.shadows),r=e._nodeCommands,n=r.length,a=0;a<n;a++){var o=r[a];o.command.castShadows=t,o.command.receiveShadows=i}}}function getTranslucentRenderState$1(e,t){var i=clone$1(t,!0);return i.cull.enabled=!1,i.depthTest.enabled=!0,i.depthMask=!1,i.blending=BlendingState$1.ALPHA_BLEND,e.opaquePass===Pass$1.CESIUM_3D_TILE&&(i.stencilTest=StencilConstants$1.setCesium3DTileBit(),i.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK),RenderState.fromCache(i)}function deriveTranslucentCommand$1(e,t){var i=DrawCommand.shallowClone(t);return i.pass=Pass$1.TRANSLUCENT,i.renderState=getTranslucentRenderState$1(e,t.renderState),i}function updateColor(e,t,i){var r=t.scene3DOnly,n=e.color.alpha;if(n>0&&n<1){var a=e._nodeCommands,o=a.length;if(o>0&&(!defined(a[0].translucentCommand)||i))for(var s=0;s<o;++s){var l=a[s],c=l.command;if(l.translucentCommand=deriveTranslucentCommand$1(e,c),!r){var u=l.command2D;l.translucentCommand2D=deriveTranslucentCommand$1(e,u)}}}}function getDisableCullingRenderState$1(e){var t=clone$1(e,!0);return t.cull.enabled=!1,RenderState.fromCache(t)}function deriveDisableCullingCommand(e){var t=DrawCommand.shallowClone(e);return t.renderState=getDisableCullingRenderState$1(e.renderState),t}function updateBackFaceCulling$1(e,t,i){var r=t.scene3DOnly;if(!e.backFaceCulling){var n=e._nodeCommands,a=n.length;if(a>0&&(!defined(n[0].disableCullingCommand)||i))for(var o=0;o<a;++o){var s=n[o],l=s.command;if(s.disableCullingCommand=deriveDisableCullingCommand(l),!r){var c=s.command2D;s.disableCullingCommand2D=deriveDisableCullingCommand(c)}}}}function getProgramId(e,t){var i=e._rendererResources.programs;for(var r in i)if(i.hasOwnProperty(r)&&i[r]===t)return r}function createSilhouetteProgram(e,t,i){var r=t.vertexShaderSource.sources[0],n=t._attributeLocations,a=e._normalAttributeName;r=ShaderSource.replaceMain(r,"gltf_silhouette_main"),r+="uniform float gltf_silhouetteSize; \nvoid main() \n{ \n gltf_silhouette_main(); \n vec3 n = normalize(czm_normal3D * "+a+"); \n n.x *= czm_projection[0][0]; \n n.y *= czm_projection[1][1]; \n vec4 clip = gl_Position; \n clip.xy += n.xy * clip.w * gltf_silhouetteSize * czm_pixelRatio / czm_viewport.z; \n gl_Position = clip; \n}";return ShaderProgram.fromCache({context:i.context,vertexShaderSource:r,fragmentShaderSource:"uniform vec4 gltf_silhouetteColor; \nvoid main() \n{ \n gl_FragColor = czm_gammaCorrect(gltf_silhouetteColor); \n}",attributeLocations:n})}function hasSilhouette(e,t){return silhouetteSupported(t.context)&&e.silhouetteSize>0&&e.silhouetteColor.alpha>0&&defined(e._normalAttributeName)}function hasTranslucentCommands(e){for(var t=e._nodeCommands,i=t.length,r=0;r<i;++r){if(t[r].command.pass===Pass$1.TRANSLUCENT)return!0}return!1}function isTranslucent(e){return e.color.alpha>0&&e.color.alpha<1}function isInvisible(e){return 0===e.color.alpha}function alphaDirty(e,t){return Math.floor(e)!==Math.floor(t)||Math.ceil(e)!==Math.ceil(t)}var silhouettesLength=0;function createSilhouetteCommands(e,t){for(var i=++silhouettesLength%255,r=hasTranslucentCommands(e)||isTranslucent(e)||e.silhouetteColor.alpha<1,n=e._rendererResources.silhouettePrograms,a=t.scene3DOnly,o=e._nodeCommands,s=o.length,l=0;l<s;++l){var c=o[l],u=c.command,d=isTranslucent(e)?c.translucentCommand:u,h=DrawCommand.shallowClone(d),p=clone$1(d.renderState);p.stencilTest={enabled:!0,frontFunction:WebGLConstants$1.ALWAYS,backFunction:WebGLConstants$1.ALWAYS,reference:i,mask:-1,frontOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.REPLACE},backOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.REPLACE}},isInvisible(e)&&(p.colorMask={red:!1,green:!1,blue:!1,alpha:!1},p.depthMask=!1),p=RenderState.fromCache(p),h.renderState=p,c.silhouetteModelCommand=h;var f=DrawCommand.shallowClone(u);(p=clone$1(u.renderState,!0)).depthTest.enabled=!0,p.cull.enabled=!1,r&&(f.pass=Pass$1.TRANSLUCENT,p.depthMask=!1,p.blending=BlendingState$1.ALPHA_BLEND),p.stencilTest={enabled:!0,frontFunction:WebGLConstants$1.NOTEQUAL,backFunction:WebGLConstants$1.NOTEQUAL,reference:i,mask:-1,frontOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.KEEP},backOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.KEEP}},p=RenderState.fromCache(p);var m=u.shaderProgram,g=getProgramId(e,m),_=n[g];defined(_)||(_=createSilhouetteProgram(e,m,t),n[g]=_);var y=combine$2(u.uniformMap,{gltf_silhouetteColor:createSilhouetteColorFunction(e),gltf_silhouetteSize:createSilhouetteSizeFunction(e)});if(f.renderState=p,f.shaderProgram=_,f.uniformMap=y,f.castShadows=!1,f.receiveShadows=!1,c.silhouetteColorCommand=f,!a){var v=c.command2D,C=DrawCommand.shallowClone(h);C.boundingVolume=v.boundingVolume,C.modelMatrix=v.modelMatrix,c.silhouetteModelCommand2D=C;var T=DrawCommand.shallowClone(f);C.boundingVolume=v.boundingVolume,C.modelMatrix=v.modelMatrix,c.silhouetteColorCommand2D=T}}}function modifyShaderForClippingPlanes(e,t,i){return e=ShaderSource.replaceMain(e,"gltf_clip_main"),e+=Model._getClippingFunction(t,i)+"\n",e+="uniform highp sampler2D gltf_clippingPlanes; \nuniform mat4 gltf_clippingPlanesMatrix; \nuniform vec4 gltf_clippingPlanesEdgeStyle; \nvoid main() \n{ \n gltf_clip_main(); \n"+getClipAndStyleCode("gltf_clippingPlanes","gltf_clippingPlanesMatrix","gltf_clippingPlanesEdgeStyle")+"} \n"}function updateSilhouette(e,t,i){if(hasSilhouette(e,t)){var r=e._nodeCommands,n=r.length>0&&(alphaDirty(e.color.alpha,e._colorPreviousAlpha)||alphaDirty(e.silhouetteColor.alpha,e._silhouetteColorPreviousAlpha)||!defined(r[0].silhouetteModelCommand));e._colorPreviousAlpha=e.color.alpha,e._silhouetteColorPreviousAlpha=e.silhouetteColor.alpha,(n||i)&&createSilhouetteCommands(e,t)}}function updateClippingPlanes$1(e,t){var i=e._clippingPlanes;defined(i)&&i.owner===e&&i.enabled&&i.update(t)}var scratchBoundingSphere$1=new BoundingSphere;function scaleInPixels(e,t,i){return scratchBoundingSphere$1.center=e,scratchBoundingSphere$1.radius=t,i.camera.getPixelSize(scratchBoundingSphere$1,i.context.drawingBufferWidth,i.context.drawingBufferHeight)}var scratchPosition$7=new Cartesian3,scratchCartographic$e=new Cartographic;function getScale(e,t){var i=e.scale;if(0!==e.minimumPixelSize){var r=t.context,n=Math.max(r.drawingBufferWidth,r.drawingBufferHeight),a=defined(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;if(scratchPosition$7.x=a[12],scratchPosition$7.y=a[13],scratchPosition$7.z=a[14],defined(e._rtcCenter)&&Cartesian3.add(e._rtcCenter,scratchPosition$7,scratchPosition$7),e._mode!==SceneMode$1.SCENE3D){var o=t.mapProjection,s=o.ellipsoid.cartesianToCartographic(scratchPosition$7,scratchCartographic$e);o.project(s,scratchPosition$7),Cartesian3.fromElements(scratchPosition$7.z,scratchPosition$7.x,scratchPosition$7.y,scratchPosition$7)}var l=e.boundingSphere.radius,c=scaleInPixels(scratchPosition$7,l,t),u=1/c;Math.min(u*(2*l),n)<e.minimumPixelSize&&(i=e.minimumPixelSize*c/(2*e._initialRadius))}return defined(e.maximumScale)?Math.min(e.maximumScale,i):i}function releaseCachedGltf(e){defined(e._cacheKey)&&defined(e._cachedGltf)&&0==--e._cachedGltf.count&&delete gltfCache[e._cacheKey],e._cachedGltf=void 0}function CachedRendererResources(e,t){this.buffers=void 0,this.vertexArrays=void 0,this.programs=void 0,this.sourceShaders=void 0,this.silhouettePrograms=void 0,this.textures=void 0,this.samplers=void 0,this.renderStates=void 0,this.ready=!1,this.context=e,this.cacheKey=t,this.count=0}function destroy(e){for(var t in e)e.hasOwnProperty(t)&&e[t].destroy()}function destroyCachedRendererResources(e){destroy(e.buffers),destroy(e.vertexArrays),destroy(e.programs),destroy(e.silhouettePrograms),destroy(e.textures)}function getUpdateHeightCallback(e,t,i){return function(r){if(e.heightReference===HeightReference$1.RELATIVE_TO_GROUND){var n=t.cartesianToCartographic(r,scratchCartographic$e);n.height+=i.height,t.cartographicToCartesian(n,r)}var a=e._clampedModelMatrix;Matrix4.clone(e.modelMatrix,a),a[12]=r.x,a[13]=r.y,a[14]=r.z,e._heightChanged=!0}}function updateClamping(e){defined(e._removeUpdateHeightCallback)&&(e._removeUpdateHeightCallback(),e._removeUpdateHeightCallback=void 0);var t=e._scene;if(defined(t)&&defined(t.globe)&&e.heightReference!==HeightReference$1.NONE){var i=t.globe,r=i.ellipsoid,n=e.modelMatrix;scratchPosition$7.x=n[12],scratchPosition$7.y=n[13],scratchPosition$7.z=n[14];var a=r.cartesianToCartographic(scratchPosition$7);defined(e._clampedModelMatrix)||(e._clampedModelMatrix=Matrix4.clone(n,new Matrix4));var o=i._surface;e._removeUpdateHeightCallback=o.updateHeight(a,getUpdateHeightCallback(e,r,a));var s=i.getHeight(a);if(defined(s)){var l=getUpdateHeightCallback(e,r,a);Cartographic.clone(a,scratchCartographic$e),scratchCartographic$e.height=s,r.cartographicToCartesian(scratchCartographic$e,scratchPosition$7),l(scratchPosition$7)}}else e._clampedModelMatrix=void 0}CachedRendererResources.prototype.release=function(){if(0==--this.count)return defined(this.cacheKey)&&delete this.context.cache.modelRendererResourceCache[this.cacheKey],destroyCachedRendererResources(this),destroyObject(this)};var scratchDisplayConditionCartesian=new Cartesian3,scratchDistanceDisplayConditionCartographic=new Cartographic;function distanceDisplayConditionVisible(e,t){var i,r=e.distanceDisplayCondition,n=r.near*r.near,a=r.far*r.far;if(t.mode===SceneMode$1.SCENE2D){i=.5*(t.camera.frustum.right-t.camera.frustum.left),i*=i}else{var o=Matrix4.getTranslation(e.modelMatrix,scratchDisplayConditionCartesian);if(t.mode===SceneMode$1.COLUMBUS_VIEW){var s=t.mapProjection,l=s.ellipsoid.cartesianToCartographic(o,scratchDistanceDisplayConditionCartographic);o=s.project(l,o),Cartesian3.fromElements(o.z,o.x,o.y,o)}i=Cartesian3.distanceSquared(o,t.camera.positionWC)}return i>=n&&i<=a}function shaderAddFlatten(e){e=ShaderSource.replaceMain(e,"js_flatten_main");return e+="uniform sampler2D u_polygonTexture;\nuniform vec4 u_polygonBounds;\nuniform float u_flattenHeight;\nuniform bool u_isFlatten;\nbool isPointInBound(vec2 point, vec4 bounds) {\n return (point.x>bounds.x&&point.x<bounds.z&&point.y<bounds.y&&point.y>bounds.w);\n}\nfloat unpackDepth(const in vec4 rgba_depth)\n{\n const vec4 bitShifts = vec4(1.0, 1.0 / 255.0, 1.0 / (255.0 * 255.0), 1.0 / (255.0 * 255.0 * 255.0));\n float depth=dot(rgba_depth, bitShifts);\n return depth;\n}\nvoid main() \n{ \n js_flatten_main(); \n if(u_isFlatten)\n {\n vec3 weightedPosition = (a_position).xyz;\n vec4 viewPos = vec4(weightedPosition.xyz, 1.0);\n if(isPointInBound(viewPos.xy, u_polygonBounds))\n {\n vec2 texCoord;\n texCoord.x = (viewPos.x-u_polygonBounds.x)/(u_polygonBounds.z-u_polygonBounds.x);\n texCoord.y = (viewPos.y-u_polygonBounds.y)/(u_polygonBounds.w-u_polygonBounds.y);\n vec4 rgba_depth = texture2D(u_polygonTexture, texCoord.xy);\n if(rgba_depth.r > 0.0)\n {\n weightedPosition.z = u_flattenHeight;\n vec4 position = vec4(weightedPosition, 1.0);\n gl_Position = czm_modelViewProjection * position;\n }\n }\n }\n} \n"}function calcModifyMeshObject(e,t){var i=e.gltf;if(e._pickObject){var r=e._pickObject.primitive;if(i.isFlatten=!!r.modifyMeshObject,hasExtension(i,"KHR_techniques_webgl")){if(i.shaders&&i.shaders.length>0)for(var n=0;n<i.shaders.length;n++)if(i.shaders[n]&&i.shaders[n].type==WebGLConstants$1.VERTEX_SHADER)try{var a=i.shaders[n].extras._pipeline.source;i.shaders[n].extras._pipeline.source=shaderAddFlatten(a)}catch(e){}if(i.extensions&&i.extensions.KHR_techniques_webgl&&i.extensions.KHR_techniques_webgl.shaders&&i.extensions.KHR_techniques_webgl.shaders.length>0)for(n=0;n<i.extensions.KHR_techniques_webgl.shaders.length;n++)if(i.extensions.KHR_techniques_webgl.shaders[n]&&i.extensions.KHR_techniques_webgl.shaders[n].type==WebGLConstants$1.VERTEX_SHADER)try{a=i.extensions.KHR_techniques_webgl.shaders[n].extras._pipeline.source;i.extensions.KHR_techniques_webgl.shaders[n].extras._pipeline.source=shaderAddFlatten(a)}catch(e){}}if(i.materials)for(n=0;n<i.materials.length;n++)null!=i.materials[n].doubleSided&&(i.materials[n].doubleSided=!0);r.modifyMeshObject&&null==r.modifyMeshObject.modelBounds&&updateModifyMeshObject(e,t)}}function updateModifyBounds(e){var t=e._pickObject.primitive;if(t.modifyMeshObject&&t.boundingSphere.center&&t.modifyMeshObject.polygonGeometry){var i=e._modelMatrix,r=new Matrix4;Matrix4.inverse(i,r);for(var n=null,a=null,o=null,s=null,l=PolygonGeometry.createGeometry(t.modifyMeshObject.polygonGeometry),c=l.attributes.position.values,u=0;u<c.length/3;u++){var d=new Cartesian3(0,0,0);d.x=c[3*u],d.y=c[3*u+1],d.z=c[3*u+2],Matrix4.multiplyByPoint(r,d,d),l.attributes.position.values[3*u]=d.x,l.attributes.position.values[3*u+1]=d.y,l.attributes.position.values[3*u+2]=d.z,(null==n||n>d.x)&&(n=d.x),(null==a||a>d.y)&&(a=d.y),(null==o||o<d.x)&&(o=d.x),(null==s||s<d.y)&&(s=d.y)}e._pickObject.primitive.modifyMeshObject.modelBounds=new Cartesian4(n,s,o,a)}}function updateModifyRelativeHeight(e){var t=e._pickObject.primitive;if(t.modifyMeshObject&&t._clippingPlanesOriginMatrix&&(null==t.modifyMeshObject.relativeHeight||1==t.modifyMeshObject.change)){var i=t._clippingPlanesOriginMatrix,r=new Cartesian3(i[12],i[13],i[14]),n=t._ellipsoid.cartesianToCartographic(r);null!=t.modifyMeshObject.height&&(t.modifyMeshObject.relativeHeight=t.modifyMeshObject.height-n.height)}t.modifyMeshObject.change=!1}function updateModifyTexture(e,t){var i=e._pickObject.primitive;i.modifyMeshObject&&i.modifyMeshObject.image&&(i.modifyMeshObject.texture=new Texture({context:t,width:1024,height:1024,source:i.modifyMeshObject.image}))}function updateModifyMeshObject(e,t){updateModifyBounds(e),updateModifyTexture(e,t)}var scratchClippingPlanesMatrix$2=new Matrix4,scratchIBLReferenceFrameMatrix4=new Matrix4,scratchIBLReferenceFrameMatrix3=new Matrix3;function destroyIfNotCached(e,t){e.programs!==t.programs&&destroy(e.programs),e.silhouettePrograms!==t.silhouettePrograms&&destroy(e.silhouettePrograms)}function regenerateShaders(e,t){var i,r=e._rendererResources,n=e._cachedRendererResources;if(destroyIfNotCached(r,n),isClippingEnabled(e)||isColorShadingEnabled(e)||e._shouldRegenerateShaders){e._shouldRegenerateShaders=!1,r.programs={},r.silhouettePrograms={};var a={},o=e._sourceTechniques;for(var s in o)o.hasOwnProperty(s)&&(a[i=o[s].program]||(a[i]=!0,recreateProgram({programId:i,techniqueId:s},e,t.context)))}else r.programs=n.programs,r.silhouettePrograms=n.silhouettePrograms;for(var l=r.programs,c=e._nodeCommands,u=c.length,d=0;d<u;++d){var h=c[d],p=l[i=h.programId];h.command.shaderProgram=p,defined(h.command2D)&&(h.command2D.shaderProgram=p)}updateColor(e,t,!0),updateBackFaceCulling$1(e,t,!0),updateSilhouette(e,t,!0)}function Batched3DModel3DTileContent(e,t,i,r,n){this._tileset=e,this._tile=t,this._resource=i,this._model=void 0,this._batchTable=void 0,this._features=void 0,this._classificationType=e.vectorClassificationOnly?void 0:e.classificationType,this._batchIdAttributeName=void 0,this._diffuseAttributeOrUniformName={},this._rtcCenterTransform=void 0,this._contentModelMatrix=void 0,this.featurePropertiesDirty=!1,this._groupMetadata=void 0,initialize$e(this,r,n)}function getBatchIdAttributeName(e){var t=ModelUtility.getAttributeOrUniformBySemantic(e,"_BATCHID");return defined(t)||defined(t=ModelUtility.getAttributeOrUniformBySemantic(e,"BATCHID"))&&Batched3DModel3DTileContent._deprecationWarning("b3dm-legacy-batchid","The glTF in this b3dm uses the semantic `BATCHID`. Application-specific semantics should be prefixed with an underscore: `_BATCHID`."),t}function getVertexShaderCallback$1(e){return function(t,i){var r=e._batchTable,n=!defined(e._classificationType),a=e._model.gltf;defined(a)&&(e._batchIdAttributeName=getBatchIdAttributeName(a),e._diffuseAttributeOrUniformName[i]=ModelUtility.getDiffuseAttributeOrUniform(a,i));var o=r.getVertexShaderCallback(n,e._batchIdAttributeName,e._diffuseAttributeOrUniformName[i]);return defined(o)?o(t):t}}function getFragmentShaderCallback$1(e){return function(t,i){var r=e._batchTable,n=!defined(e._classificationType),a=e._model.gltf;defined(a)&&(e._diffuseAttributeOrUniformName[i]=ModelUtility.getDiffuseAttributeOrUniform(a,i));var o=r.getFragmentShaderCallback(n,e._diffuseAttributeOrUniformName[i],!1);return defined(o)?o(t):t}}function getPickIdCallback$1(e){return function(){return e._batchTable.getPickId()}}function getClassificationFragmentShaderCallback(e){return function(t){var i=e._batchTable.getClassificationFragmentShaderCallback();return defined(i)?i(t):t}}function createColorChangedCallback$2(e){return function(t,i){e._model.updateCommands(t,i)}}function initialize$e(e,t,i){var r=e._tileset,n=e._tile,a=e._resource,o=B3dmParser.parse(t,i),s=o.batchLength,l=new Cesium3DTileFeatureTable(o.featureTableJson,o.featureTableBinary);s=l.getGlobalProperty("BATCH_LENGTH"),l.featuresLength=s;var c,u=o.batchTableJson,d=o.batchTableBinary;defined(e._classificationType)&&(c=createColorChangedCallback$2(e));var h=new Cesium3DTileBatchTable(e,s,u,d,c);e._batchTable=h;var p=o.gltf,f={content:e,primitive:r};e._rtcCenterTransform=Matrix4.IDENTITY;var m=l.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(m)&&(e._rtcCenterTransform=Matrix4.fromTranslation(Cartesian3.fromArray(m))),e._contentModelMatrix=Matrix4.multiply(n.computedTransform,e._rtcCenterTransform,new Matrix4),defined(e._classificationType)?e._model=new ClassificationModel({gltf:p,cull:!1,basePath:a,requestType:RequestType$1.TILES3D,modelMatrix:e._contentModelMatrix,upAxis:r._gltfUpAxis,forwardAxis:Axis$1.X,debugWireframe:r.debugWireframe,vertexShaderLoaded:getVertexShaderCallback$1(e),classificationShaderLoaded:getClassificationFragmentShaderCallback(e),uniformMapLoaded:h.getUniformMapCallback(),pickIdLoaded:getPickIdCallback$1(e),classificationType:e._classificationType,batchTable:h}):(e._model=new Model({gltf:p,cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,basePath:a,requestType:RequestType$1.TILES3D,modelMatrix:e._contentModelMatrix,upAxis:r._gltfUpAxis,forwardAxis:Axis$1.X,shadows:r.shadows,debugWireframe:r.debugWireframe,incrementallyLoadTextures:!1,vertexShaderLoaded:getVertexShaderCallback$1(e),fragmentShaderLoaded:getFragmentShaderCallback$1(e),uniformMapLoaded:h.getUniformMapCallback(),pickIdLoaded:getPickIdCallback$1(e),addBatchIdToGeneratedShaders:s>0,pickObject:f,imageBasedLightingFactor:r.imageBasedLightingFactor,lightColor:r.lightColor,luminanceAtZenith:r.luminanceAtZenith,sphericalHarmonicCoefficients:r.sphericalHarmonicCoefficients,specularEnvironmentMaps:r.specularEnvironmentMaps,backFaceCulling:r.backFaceCulling,showOutline:r.showOutline}),e._model.readyPromise.then((function(e){e.activeAnimations.addAll({loop:ModelAnimationLoop$1.REPEAT})})))}function createFeatures$4(e){var t=e.featuresLength;if(!defined(e._features)&&t>0){for(var i=new Array(t),r=0;r<t;++r)i[r]=new Cesium3DTileFeature(e,r);e._features=i}}function Composite3DTileContent(e,t,i,r,n,a){this._tileset=e,this._tile=t,this._resource=i,this._contents=[],this._readyPromise=when.defer(),this._groupMetadata=void 0,initialize$d(this,r,n,a)}Model.prototype.update=function(e){if(e.mode!==SceneMode$1.MORPHING)if(FeatureDetection.supportsWebP.initialized){var t=e.context;this._defaultTexture=t.defaultTexture;var i=FeatureDetection.supportsWebP();if(this._state===ModelState.NEEDS_LOAD&&defined(this.gltf)){var r,n=this.cacheKey;if(defined(n)){t.cache.modelRendererResourceCache=defaultValue(t.cache.modelRendererResourceCache,{});var a=t.cache.modelRendererResourceCache;if(defined(r=a[this.cacheKey])){if(!r.ready)return;++r.count,this._loadRendererResourcesFromCache=!0}else(r=new CachedRendererResources(t,n)).count=1,a[this.cacheKey]=r;this._cachedRendererResources=r}else(r=new CachedRendererResources(t)).count=1,this._cachedRendererResources=r;if(this._state=ModelState.LOADING,this._state!==ModelState.FAILED){var o=this.gltf.extensions;if(defined(o)&&defined(o.CESIUM_RTC)){var s=Cartesian3.fromArray(o.CESIUM_RTC.center);if(!Cartesian3.equals(s,Cartesian3.ZERO)){this._rtcCenter3D=s;var l=e.mapProjection,c=l.ellipsoid.cartesianToCartographic(this._rtcCenter3D),u=l.project(c);Cartesian3.fromElements(u.z,u.x,u.y,u),this._rtcCenter2D=u,this._rtcCenterEye=new Cartesian3,this._rtcCenter=this._rtcCenter3D}}addPipelineExtras(this.gltf),this._loadResources=new ModelLoadResources,this._loadRendererResourcesFromCache||ModelUtility.parseBuffers(this,bufferLoad)}}var d=this._loadResources,h=this._incrementallyLoadTextures,p=!1;if(this._state===ModelState.LOADING){if(0===d.pendingBufferLoads){if(!d.initialized){if(e.brdfLutGenerator.update(e),ModelUtility.checkSupportedExtensions(this.extensionsRequired,i),ModelUtility.updateForwardAxis(this),!defined(this.gltf.extras.sourceVersion)){var f=this.gltf;f.extras.sourceVersion=ModelUtility.getAssetVersion(f),f.extras.sourceKHRTechniquesWebGL=defined(ModelUtility.getUsedExtensions(f).KHR_techniques_webgl),this._sourceVersion=f.extras.sourceVersion,this._sourceKHRTechniquesWebGL=f.extras.sourceKHRTechniquesWebGL,updateVersion(f),addDefaults(f);var m={addBatchIdToGeneratedShaders:this._addBatchIdToGeneratedShaders};processModelMaterialsCommon(f,m),processPbrMaterials(f,m),calcModifyMeshObject(this,t)}this._sourceVersion=this.gltf.extras.sourceVersion,this._sourceKHRTechniquesWebGL=this.gltf.extras.sourceKHRTechniquesWebGL,this._dequantizeInShader=this._dequantizeInShader&&DracoLoader.hasExtension(this),addBuffersToLoadResources(this),parseArticulations(this),parseTechniques(this),this._loadRendererResourcesFromCache||(parseBufferViews(this),parseShaders(this),parsePrograms(this),parseTextures(this,t,i)),parseMaterials(this),parseMeshes(this),parseNodes(this),DracoLoader.parse(this,t),d.initialized=!0}d.finishedDecoding()||DracoLoader.decodeModel(this,t).otherwise(ModelUtility.getFailedLoadFunction(this,"model",this.basePath)),d.finishedDecoding()&&!d.resourcesParsed&&(this._boundingSphere=ModelUtility.computeBoundingSphere(this),this._initialRadius=this._boundingSphere.radius,DracoLoader.cacheDataForModel(this),d.resourcesParsed=!0),d.resourcesParsed&&0===d.pendingShaderLoads&&(this.showOutline&&ModelOutlineLoader.outlinePrimitives(this),createResources$5(this,e))}(d.finished()||h&&d.finishedEverythingButTextureCreation())&&(this._state=ModelState.LOADED,p=!0)}if(defined(d)&&this._state===ModelState.LOADED&&(h&&!p&&createResources$5(this,e),d.finished())){this._loadResources=void 0;var g=this._rendererResources,_=this._cachedRendererResources;_.buffers=g.buffers,_.vertexArrays=g.vertexArrays,_.programs=g.programs,_.sourceShaders=g.sourceShaders,_.silhouettePrograms=g.silhouettePrograms,_.textures=g.textures,_.samplers=g.samplers,_.renderStates=g.renderStates,_.ready=!0,this._normalAttributeName=ModelUtility.getAttributeOrUniformBySemantic(this.gltf,"NORMAL"),defined(this._precreatedAttributes)&&(_.vertexArrays={}),this.releaseGltfJson&&releaseCachedGltf(this)}var y=OctahedralProjectedCubeMap.isSupported(t);if(this._shouldUpdateSpecularMapAtlas&&y){if(this._shouldUpdateSpecularMapAtlas=!1,this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),this._specularEnvironmentMapAtlas=void 0,defined(this._specularEnvironmentMaps)){this._specularEnvironmentMapAtlas=new OctahedralProjectedCubeMap(this._specularEnvironmentMaps);var v=this;this._specularEnvironmentMapAtlas.readyPromise.then((function(){v._shouldRegenerateShaders=!0})).otherwise((function(e){console.error("Error loading specularEnvironmentMaps: "+e)}))}this._shouldRegenerateShaders=!0}defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e);var C=!defined(this._specularEnvironmentMapAtlas)&&defined(e.specularEnvironmentMaps)&&!this._useDefaultSpecularMaps,T=!defined(e.specularEnvironmentMaps)&&this._useDefaultSpecularMaps,S=!defined(this._sphericalHarmonicCoefficients)&&defined(e.sphericalHarmonicCoefficients)&&!this._useDefaultSphericalHarmonics,A=!defined(e.sphericalHarmonicCoefficients)&&this._useDefaultSphericalHarmonics;this._shouldRegenerateShaders=this._shouldRegenerateShaders||C||T||S||A,this._useDefaultSpecularMaps=!defined(this._specularEnvironmentMapAtlas)&&defined(e.specularEnvironmentMaps),this._useDefaultSphericalHarmonics=!defined(this._sphericalHarmonicCoefficients)&&defined(e.sphericalHarmonicCoefficients);var x=hasSilhouette(this,e),E=isTranslucent(this),b=isInvisible(this),P=this.backFaceCulling,D=!defined(this.distanceDisplayCondition)||distanceDisplayConditionVisible(this,e),w=this.show&&D&&0!==this.scale&&(!b||x);if(w&&this._state===ModelState.LOADED||p){var M=this.activeAnimations.update(e)||this._cesiumAnimationsDirty;this._cesiumAnimationsDirty=!1,this._dirty=!1;var I=this.modelMatrix,R=e.mode!==this._mode;this._mode=e.mode;var O=!Matrix4.equals(this._modelMatrix,I)||this._scale!==this.scale||this._minimumPixelSize!==this.minimumPixelSize||0!==this.minimumPixelSize||this._maximumScale!==this.maximumScale||this._heightReference!==this.heightReference||this._heightChanged||R;if(O||p){Matrix4.clone(I,this._modelMatrix),updateClamping(this),defined(this._clampedModelMatrix)&&(I=this._clampedModelMatrix),this._scale=this.scale,this._minimumPixelSize=this.minimumPixelSize,this._maximumScale=this.maximumScale,this._heightReference=this.heightReference,this._heightChanged=!1;var B=getScale(this,e),L=this._computedModelMatrix;Matrix4.multiplyByUniformScale(I,B,L),this._upAxis===Axis$1.Y?Matrix4.multiplyTransformation(L,Axis$1.Y_UP_TO_Z_UP,L):this._upAxis===Axis$1.X&&Matrix4.multiplyTransformation(L,Axis$1.X_UP_TO_Z_UP,L),this.forwardAxis===Axis$1.Z&&Matrix4.multiplyTransformation(L,Axis$1.Z_UP_TO_X_UP,L)}(M||O||p)&&(updateNodeHierarchyModelMatrix(this,O,p,e.mapProjection),this._dirty=!0,(M||p)&&applySkins(this)),this._perNodeShowDirty&&(this._perNodeShowDirty=!1,updatePerNodeShow(this)),updatePickIds(this),updateWireframe$1(this),updateShowBoundingVolume$2(this),updateShadows$1(this),updateClippingPlanes$1(this,e);var F=this._clippingPlanes,N=0,V=defaultValue(this.referenceMatrix,I);if(isClippingEnabled(this)){var k=scratchClippingPlanesMatrix$2;k=Matrix4.multiply(t.uniformState.view3D,V,k),k=Matrix4.multiply(k,F.modelMatrix,k),this._clippingPlanesMatrix=Matrix4.inverseTranspose(k,this._clippingPlanesMatrix),N=F.clippingPlanesState}var U=defined(this._sphericalHarmonicCoefficients)||this._useDefaultSphericalHarmonics,G=defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready||this._useDefaultSpecularMaps;if(U||G){var $=scratchIBLReferenceFrameMatrix3,z=scratchIBLReferenceFrameMatrix4;z=Matrix4.multiply(t.uniformState.view3D,V,z),$=Matrix4.getMatrix3(z,$),$=Matrix3.getRotation($,$),this._iblReferenceFrameMatrix=Matrix3.transpose($,this._iblReferenceFrameMatrix)}var H=this._shouldRegenerateShaders;H=H||this._clippingPlanesState!==N,this._clippingPlanesState=N;var W=isColorShadingEnabled(this);W!==this._colorShadingEnabled&&(this._colorShadingEnabled=W,H=!0),H?regenerateShaders(this,e):(updateColor(this,e,!1),updateBackFaceCulling$1(this,e,!1),updateSilhouette(this,e,!1))}if(p){var j=this;e.afterRender.push((function(){j._ready=!0,j._readyPromise.resolve(j)}))}else{if(w&&!this._ignoreCommands){var q,X,Y,K=e.commandList,J=e.passes,Q=this._nodeCommands,Z=Q.length,ee=e.mapProjection.ellipsoid.maximumRadius*CesiumMath.PI;if(J.render||J.pick&&this.allowPicking){for(q=0;q<Z;++q)if((X=Q[q]).show){var te=X.command;if(x?te=X.silhouetteModelCommand:E?te=X.translucentCommand:P||(te=X.disableCullingCommand),K.push(te),Y=X.command.boundingVolume,e.mode===SceneMode$1.SCENE2D&&(Y.center.y+Y.radius>ee||Y.center.y-Y.radius<ee)){var ie=X.command2D;x?ie=X.silhouetteModelCommand2D:E?ie=X.translucentCommand2D:P||(ie=X.disableCullingCommand2D),K.push(ie)}}if(x&&!J.pick)for(q=0;q<Z;++q)(X=Q[q]).show&&(K.push(X.silhouetteColorCommand),Y=X.command.boundingVolume,e.mode===SceneMode$1.SCENE2D&&(Y.center.y+Y.radius>ee||Y.center.y-Y.radius<ee)&&K.push(X.silhouetteColorCommand2D))}}var re=this._credit;defined(re)&&e.creditDisplay.addCredit(re);for(var ne=this._resourceCredits,ae=ne.length,oe=0;oe<ae;oe++)e.creditDisplay.addCredit(ne[oe])}}else FeatureDetection.supportsWebP.initialize()},Model.prototype.isDestroyed=function(){return!1},Model.prototype.destroy=function(){defined(this._precreatedAttributes)&&destroy(this._rendererResources.vertexArrays),defined(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),defined(this._terrainProviderChangedCallback)&&(this._terrainProviderChangedCallback(),this._terrainProviderChangedCallback=void 0),defined(this._cachedRendererResources)&&destroyIfNotCached(this._rendererResources,this._cachedRendererResources),this._rendererResources=void 0,this._cachedRendererResources=this._cachedRendererResources&&this._cachedRendererResources.release(),DracoLoader.destroyCachedDataForModel(this);for(var e=this._pickIds,t=e.length,i=0;i<t;++i)e[i].destroy();releaseCachedGltf(this),this._quantizedVertexShaders=void 0;var r=this._clippingPlanes;return defined(r)&&!r.isDestroyed()&&r.owner===this&&r.destroy(),this._clippingPlanes=void 0,this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),destroyObject(this)},Model._getClippingFunction=getClippingFunction,Model._modifyShaderForColor=modifyShaderForColor,Batched3DModel3DTileContent._deprecationWarning=deprecationWarning,Object.defineProperties(Batched3DModel3DTileContent.prototype,{featuresLength:{get:function(){return this.batchTable.featuresLength}},pointsLength:{get:function(){return this._model.pointsLength}},trianglesLength:{get:function(){return this._model.trianglesLength}},geometryByteLength:{get:function(){return this._model.geometryByteLength}},texturesByteLength:{get:function(){return this._model.texturesByteLength}},batchTableByteLength:{get:function(){return this.batchTable.memorySizeInBytes}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._model.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}}),Batched3DModel3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Batched3DModel3DTileContent.prototype.getFeature=function(e){return createFeatures$4(this),this._features[e]},Batched3DModel3DTileContent.prototype.applyDebugSettings=function(e,t){t=e?t:Color.WHITE,0===this.featuresLength?this._model.color=t:this._batchTable.setAllColor(t)},Batched3DModel3DTileContent.prototype.applyStyle=function(e){if(0===this.featuresLength){var t=defined(e)&&defined(e.color),i=defined(e)&&defined(e.show);this._model.color=t?e.color.evaluateColor(void 0,this._model.color):Color.clone(Color.WHITE,this._model.color),this._model.show=!i||e.show.evaluate(void 0)}else this._batchTable.applyStyle(e)},Batched3DModel3DTileContent.prototype.update=function(e,t){var i=t.commandList.length,r=this._model,n=this._tile,a=this._batchTable;a.update(e,t),this._contentModelMatrix=Matrix4.multiply(n.computedTransform,this._rtcCenterTransform,this._contentModelMatrix),r.modelMatrix=this._contentModelMatrix,r.shadows=e.shadows,r.imageBasedLightingFactor=e.imageBasedLightingFactor,r.lightColor=e.lightColor,r.luminanceAtZenith=e.luminanceAtZenith,r.sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,r.specularEnvironmentMaps=e.specularEnvironmentMaps,r.backFaceCulling=e.backFaceCulling,r.debugWireframe=e.debugWireframe;var o=e.clippingPlanes;r.referenceMatrix=e.clippingPlanesOriginMatrix,defined(o)&&n.clippingPlanesDirty&&(r._clippingPlanes=o.enabled&&n._isClipped?o:void 0),defined(o)&&defined(r._clippingPlanes)&&r._clippingPlanes!==o&&(r._clippingPlanes=o),r.update(t),i<t.commandList.length&&(t.passes.render||t.passes.pick)&&!defined(this._classificationType)&&a.addDerivedCommands(t,i)},Batched3DModel3DTileContent.prototype.isDestroyed=function(){return!1},Batched3DModel3DTileContent.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},Object.defineProperties(Composite3DTileContent.prototype,{featurePropertiesDirty:{get:function(){for(var e=this._contents,t=e.length,i=0;i<t;++i)if(e[i].featurePropertiesDirty)return!0;return!1},set:function(e){for(var t=this._contents,i=t.length,r=0;r<i;++r)t[r].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e;for(var t=this._contents,i=t.length,r=0;r<i;++r)t[r].groupMetadata=e}}});var sizeOfUint32$4=Uint32Array.BYTES_PER_ELEMENT;function initialize$d(e,t,i,r){i=defaultValue(i,0);var n=new Uint8Array(t),a=new DataView(t);i+=sizeOfUint32$4;var o=a.getUint32(i,!0);if(1!==o)throw new RuntimeError("Only Composite Tile version 1 is supported. Version "+o+" is not.");i+=sizeOfUint32$4,i+=sizeOfUint32$4;var s=a.getUint32(i,!0);i+=sizeOfUint32$4;for(var l=[],c=0;c<s;++c){var u=getMagic(n,i),d=a.getUint32(i+2*sizeOfUint32$4,!0),h=r[u];if(!defined(h))throw new RuntimeError("Unknown tile content type, "+u+", inside Composite tile");var p=h(e._tileset,e._tile,e._resource,t,i);e._contents.push(p),l.push(p.readyPromise),i+=d}when.all(l).then((function(){e._readyPromise.resolve(e)})).otherwise((function(t){e._readyPromise.reject(t)}))}function Vector3DTileGeometry(e){this._boxes=e.boxes,this._boxBatchIds=e.boxBatchIds,this._cylinders=e.cylinders,this._cylinderBatchIds=e.cylinderBatchIds,this._ellipsoids=e.ellipsoids,this._ellipsoidBatchIds=e.ellipsoidBatchIds,this._spheres=e.spheres,this._sphereBatchIds=e.sphereBatchIds,this._modelMatrix=e.modelMatrix,this._batchTable=e.batchTable,this._boundingVolume=e.boundingVolume,this._center=e.center,defined(this._center)||(defined(this._boundingVolume)?this._center=Cartesian3.clone(this._boundingVolume.center):this._center=Cartesian3.clone(Cartesian3.ZERO)),this._boundingVolumes=void 0,this._batchedIndices=void 0,this._indices=void 0,this._indexOffsets=void 0,this._indexCounts=void 0,this._positions=void 0,this._vertexBatchIds=void 0,this._batchIds=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._ready=!1,this._readyPromise=when.defer(),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=ClassificationType$1.BOTH}function packBuffer$4(e){var t=new Float64Array(Matrix4.packedLength+Cartesian3.packedLength),i=0;return Cartesian3.pack(e._center,t,i),i+=Cartesian3.packedLength,Matrix4.pack(e._modelMatrix,t,i),t}function unpackBuffer$1(e,t){for(var i=0,r=t[i++],n=t[i++],a=e._boundingVolumes=new Array(n),o=0;o<n;++o)a[o]=BoundingSphere.unpack(t,i),i+=BoundingSphere.packedLength;for(var s=t[i++],l=e._batchedIndices=new Array(s),c=0;c<s;++c){var u=Color.unpack(t,i);i+=Color.packedLength;for(var d=t[i++],h=t[i++],p=t[i++],f=new Array(p),m=0;m<p;++m)f[m]=t[i++];l[c]=new Vector3DTileBatch({color:u,offset:d,count:h,batchIds:f})}return r}Composite3DTileContent.prototype.hasProperty=function(e,t){return!1},Composite3DTileContent.prototype.getFeature=function(e){},Composite3DTileContent.prototype.applyDebugSettings=function(e,t){for(var i=this._contents,r=i.length,n=0;n<r;++n)i[n].applyDebugSettings(e,t)},Composite3DTileContent.prototype.applyStyle=function(e){for(var t=this._contents,i=t.length,r=0;r<i;++r)t[r].applyStyle(e)},Composite3DTileContent.prototype.update=function(e,t){for(var i=this._contents,r=i.length,n=0;n<r;++n)i[n].update(e,t)},Composite3DTileContent.prototype.isDestroyed=function(){return!1},Composite3DTileContent.prototype.destroy=function(){for(var e=this._contents,t=e.length,i=0;i<t;++i)e[i].destroy();return destroyObject(this)},Object.defineProperties(Vector3DTileGeometry.prototype,{trianglesLength:{get:function(){return defined(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return defined(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise.promise}}}),Vector3DTileGeometry.packedBoxLength=Matrix4.packedLength+Cartesian3.packedLength,Vector3DTileGeometry.packedCylinderLength=Matrix4.packedLength+2,Vector3DTileGeometry.packedEllipsoidLength=Matrix4.packedLength+Cartesian3.packedLength,Vector3DTileGeometry.packedSphereLength=Cartesian3.packedLength+1;var createVerticesTaskProcessor$4=new TaskProcessor("createVectorTileGeometries",5),scratchColor$k=new Color;function createPrimitive$1(e){if(!defined(e._primitive)){if(!defined(e._verticesPromise)){var t=e._boxes,i=e._boxBatchIds,r=e._cylinders,n=e._cylinderBatchIds,a=e._ellipsoids,o=e._ellipsoidBatchIds,s=e._spheres,l=e._sphereBatchIds,c=e._batchTableColors,u=e._packedBuffer;if(!defined(c)){var d=0;defined(e._boxes)&&(t=e._boxes=arraySlice(t),d+=(i=e._boxBatchIds=arraySlice(i)).length),defined(e._cylinders)&&(r=e._cylinders=arraySlice(r),d+=(n=e._cylinderBatchIds=arraySlice(n)).length),defined(e._ellipsoids)&&(a=e._ellipsoids=arraySlice(a),d+=(o=e._ellipsoidBatchIds=arraySlice(o)).length),defined(e._spheres)&&(s=e._sphere=arraySlice(s),d+=(l=e._sphereBatchIds=arraySlice(l)).length),c=e._batchTableColors=new Uint32Array(d);for(var h=e._batchTable,p=0;p<d;++p){var f=h.getColor(p,scratchColor$k);c[p]=f.toRgba()}u=e._packedBuffer=packBuffer$4(e)}var m=[];defined(t)&&m.push(t.buffer,i.buffer),defined(r)&&m.push(r.buffer,n.buffer),defined(a)&&m.push(a.buffer,o.buffer),defined(s)&&m.push(s.buffer,l.buffer),m.push(c.buffer,u.buffer);var g={boxes:defined(t)?t.buffer:void 0,boxBatchIds:defined(t)?i.buffer:void 0,cylinders:defined(r)?r.buffer:void 0,cylinderBatchIds:defined(r)?n.buffer:void 0,ellipsoids:defined(a)?a.buffer:void 0,ellipsoidBatchIds:defined(a)?o.buffer:void 0,spheres:defined(s)?s.buffer:void 0,sphereBatchIds:defined(s)?l.buffer:void 0,batchTableColors:c.buffer,packedBuffer:u.buffer},_=e._verticesPromise=createVerticesTaskProcessor$4.scheduleTask(g,m);if(!defined(_))return;_.then((function(t){var i=new Float64Array(t.packedBuffer),r=unpackBuffer$1(e,i);e._indices=2===r?new Uint16Array(t.indices):new Uint32Array(t.indices),e._indexOffsets=new Uint32Array(t.indexOffsets),e._indexCounts=new Uint32Array(t.indexCounts),e._positions=new Float32Array(t.positions),e._vertexBatchIds=new Uint16Array(t.vertexBatchIds),e._batchIds=new Uint16Array(t.batchIds),e._ready=!0}))}e._ready&&!defined(e._primitive)&&(e._primitive=new Vector3DTilePrimitive({batchTable:e._batchTable,positions:e._positions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center,pickObject:defaultValue(e._pickObject,e)}),e._boxes=void 0,e._boxBatchIds=void 0,e._cylinders=void 0,e._cylinderBatchIds=void 0,e._ellipsoids=void 0,e._ellipsoidBatchIds=void 0,e._spheres=void 0,e._sphereBatchIds=void 0,e._center=void 0,e._modelMatrix=void 0,e._batchTable=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0,e._indices=void 0,e._indexOffsets=void 0,e._indexCounts=void 0,e._positions=void 0,e._vertexBatchIds=void 0,e._batchIds=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._verticesPromise=void 0,e._readyPromise.resolve())}}function Geometry3DTileContent(e,t,i,r,n){this._tileset=e,this._tile=t,this._resource=i,this._geometries=void 0,this._contentReadyPromise=void 0,this._readyPromise=when.defer(),this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._groupMetadata=void 0,initialize$c(this,r,n)}function createColorChangedCallback$1(e){return function(t,i){defined(e._geometries)&&e._geometries.updateCommands(t,i)}}function getBatchIds$1(e,t){var i,r,n,a,o,s=defaultValue(e.BOXES_LENGTH,0),l=defaultValue(e.CYLINDERS_LENGTH,0),c=defaultValue(e.ELLIPSOIDS_LENGTH,0),u=defaultValue(e.SPHERES_LENGTH,0);if(s>0&&defined(e.BOX_BATCH_IDS)){var d=t.byteOffset+e.BOX_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,d,s)}if(l>0&&defined(e.CYLINDER_BATCH_IDS)){var h=t.byteOffset+e.CYLINDER_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,h,l)}if(c>0&&defined(e.ELLIPSOID_BATCH_IDS)){var p=t.byteOffset+e.ELLIPSOID_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,p,c)}if(u>0&&defined(e.SPHERE_BATCH_IDS)){var f=t.byteOffset+e.SPHERE_BATCH_IDS.byteOffset;a=new Uint16Array(t.buffer,f,u)}var m=defined(i)||defined(r)||defined(n)||defined(a),g=s>0&&!defined(i)||l>0&&!defined(r)||c>0&&!defined(n)||u>0&&!defined(a);if(m&&g)throw new RuntimeError("If one group of batch ids is defined, then all batch ids must be defined.");if(!(defined(i)||defined(r)||defined(n)||defined(a))){var _=0;if(!defined(i)&&s>0)for(i=new Uint16Array(s),o=0;o<s;++o)i[o]=_++;if(!defined(r)&&l>0)for(r=new Uint16Array(l),o=0;o<l;++o)r[o]=_++;if(!defined(n)&&c>0)for(n=new Uint16Array(c),o=0;o<c;++o)n[o]=_++;if(!defined(a)&&u>0)for(a=new Uint16Array(u),o=0;o<u;++o)a[o]=_++}return{boxes:i,cylinders:r,ellipsoids:n,spheres:a}}Vector3DTileGeometry.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)},Vector3DTileGeometry.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)},Vector3DTileGeometry.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)},Vector3DTileGeometry.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},Vector3DTileGeometry.prototype.update=function(e){createPrimitive$1(this),this._ready&&(this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e))},Vector3DTileGeometry.prototype.isDestroyed=function(){return!1},Vector3DTileGeometry.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)},Object.defineProperties(Geometry3DTileContent.prototype,{featuresLength:{get:function(){return defined(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return defined(this._geometries)?this._geometries.trianglesLength:0}},geometryByteLength:{get:function(){return defined(this._geometries)?this._geometries.geometryByteLength:0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return defined(this._batchTable)?this._batchTable.memorySizeInBytes:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}});var sizeOfUint32$3=Uint32Array.BYTES_PER_ELEMENT;function initialize$c(e,t,i){i=defaultValue(i,0);var r=new Uint8Array(t),n=new DataView(t);i+=sizeOfUint32$3;var a=n.getUint32(i,!0);if(1!==a)throw new RuntimeError("Only Geometry tile version 1 is supported. Version "+a+" is not.");i+=sizeOfUint32$3;var o=n.getUint32(i,!0);if(i+=sizeOfUint32$3,0!==o){var s=n.getUint32(i,!0);if(i+=sizeOfUint32$3,0===s)throw new RuntimeError("Feature table must have a byte length greater than zero");var l=n.getUint32(i,!0);i+=sizeOfUint32$3;var c=n.getUint32(i,!0);i+=sizeOfUint32$3;var u=n.getUint32(i,!0),d=getJsonFromTypedArray(r,i+=sizeOfUint32$3,s);i+=s;var h,p,f=new Uint8Array(t,i,l);i+=l,c>0&&(h=getJsonFromTypedArray(r,i,c),i+=c,u>0&&(p=new Uint8Array(t,i,u),p=new Uint8Array(p)));var m=defaultValue(d.BOXES_LENGTH,0),g=defaultValue(d.CYLINDERS_LENGTH,0),_=defaultValue(d.ELLIPSOIDS_LENGTH,0),y=defaultValue(d.SPHERES_LENGTH,0),v=m+g+_+y,C=new Cesium3DTileBatchTable(e,v,h,p,createColorChangedCallback$1(e));if(e._batchTable=C,0!==v){var T,S=e.tile.computedTransform;defined(d.RTC_CENTER)&&(T=Cartesian3.unpack(d.RTC_CENTER),Matrix4.multiplyByPoint(S,T,T));var A=getBatchIds$1(d,f);if(m>0||g>0||_>0||y>0){var x,E,b,P;if(m>0){var D=f.byteOffset+d.BOXES.byteOffset;x=new Float32Array(f.buffer,D,Vector3DTileGeometry.packedBoxLength*m)}if(g>0){var w=f.byteOffset+d.CYLINDERS.byteOffset;E=new Float32Array(f.buffer,w,Vector3DTileGeometry.packedCylinderLength*g)}if(_>0){var M=f.byteOffset+d.ELLIPSOIDS.byteOffset;b=new Float32Array(f.buffer,M,Vector3DTileGeometry.packedEllipsoidLength*_)}if(y>0){var I=f.byteOffset+d.SPHERES.byteOffset;P=new Float32Array(f.buffer,I,Vector3DTileGeometry.packedSphereLength*y)}e._geometries=new Vector3DTileGeometry({boxes:x,boxBatchIds:A.boxes,cylinders:E,cylinderBatchIds:A.cylinders,ellipsoids:b,ellipsoidBatchIds:A.ellipsoids,spheres:P,sphereBatchIds:A.spheres,center:T,modelMatrix:S,batchTable:C,boundingVolume:e.tile.boundingVolume.boundingVolume})}}}else e._readyPromise.resolve(e)}function createFeatures$3(e){var t=e.featuresLength;if(!defined(e._features)&&t>0){var i=new Array(t);defined(e._geometries)&&e._geometries.createFeatures(e,i),e._features=i}}function Gltf3DTileContent(e,t,i,r){this._tileset=e,this._tile=t,this._resource=i,this._model=void 0,this.featurePropertiesDirty=!1,this._groupMetadata=void 0,initialize$b(this,r)}function initialize$b(e,t){var i=e._tileset,r=e._tile,n=e._resource,a={content:e,primitive:i};e._model=new Model({gltf:t,cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,basePath:n,requestType:RequestType$1.TILES3D,modelMatrix:r.computedTransform,upAxis:i._gltfUpAxis,forwardAxis:Axis$1.X,shadows:i.shadows,debugWireframe:i.debugWireframe,incrementallyLoadTextures:!1,addBatchIdToGeneratedShaders:!1,pickObject:a,imageBasedLightingFactor:i.imageBasedLightingFactor,lightColor:i.lightColor,luminanceAtZenith:i.luminanceAtZenith,sphericalHarmonicCoefficients:i.sphericalHarmonicCoefficients,specularEnvironmentMaps:i.specularEnvironmentMaps,backFaceCulling:i.backFaceCulling,showOutline:i.showOutline}),e._model.readyPromise.then((function(e){e.activeAnimations.addAll({loop:ModelAnimationLoop$1.REPEAT})}))}function ImplicitAvailabilityBitstream(e){var t=e.lengthBits,i=e.availableCount,r=e.constant,n=e.bitstream;if(defined(r))i=t;else{var a=Math.ceil(t/8);if(n.length!==a)throw new RuntimeError("Availability bitstream must be exactly "+a+" bytes long to store "+t+" bits. Actual bitstream was "+n.length+" bytes long.");var o=defaultValue(e.computeAvailableCountEnabled,!1);!defined(i)&&o&&(i=count1Bits(n,t))}this._lengthBits=t,this._availableCount=i,this._constant=r,this._bitstream=n}function count1Bits(e,t){for(var i=0,r=0;r<t;r++){var n=r%8;i+=e[r>>3]>>n&1}return i}Geometry3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Geometry3DTileContent.prototype.getFeature=function(e){return createFeatures$3(this),this._features[e]},Geometry3DTileContent.prototype.applyDebugSettings=function(e,t){defined(this._geometries)&&this._geometries.applyDebugSettings(e,t)},Geometry3DTileContent.prototype.applyStyle=function(e){createFeatures$3(this),defined(this._geometries)&&this._geometries.applyStyle(e,this._features)},Geometry3DTileContent.prototype.update=function(e,t){if(defined(this._geometries)&&(this._geometries.classificationType=this._tileset.classificationType,this._geometries.debugWireframe=this._tileset.debugWireframe,this._geometries.update(t)),defined(this._batchTable)&&this._geometries._ready&&this._batchTable.update(e,t),!defined(this._contentReadyPromise)){var i=this;this._contentReadyPromise=this._geometries.readyPromise.then((function(){i._readyPromise.resolve(i)}))}},Geometry3DTileContent.prototype.isDestroyed=function(){return!1},Geometry3DTileContent.prototype.destroy=function(){return this._geometries=this._geometries&&this._geometries.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},Object.defineProperties(Gltf3DTileContent.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return this._model.pointsLength}},trianglesLength:{get:function(){return this._model.trianglesLength}},geometryByteLength:{get:function(){return this._model.geometryByteLength}},texturesByteLength:{get:function(){return this._model.texturesByteLength}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._model.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}}),Gltf3DTileContent.prototype.hasProperty=function(e,t){return!1},Gltf3DTileContent.prototype.getFeature=function(e){},Gltf3DTileContent.prototype.applyDebugSettings=function(e,t){t=e?t:Color.WHITE,this._model.color=t},Gltf3DTileContent.prototype.applyStyle=function(e){var t=defined(e)&&defined(e.color),i=defined(e)&&defined(e.show);this._model.color=t?e.color.evaluateColor(void 0,this._model.color):Color.clone(Color.WHITE,this._model.color),this._model.show=!i||e.show.evaluate(void 0)},Gltf3DTileContent.prototype.update=function(e,t){var i=this._model,r=this._tile;i.modelMatrix=r.computedTransform,i.shadows=e.shadows,i.imageBasedLightingFactor=e.imageBasedLightingFactor,i.lightColor=e.lightColor,i.luminanceAtZenith=e.luminanceAtZenith,i.sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,i.specularEnvironmentMaps=e.specularEnvironmentMaps,i.backFaceCulling=e.backFaceCulling,i.debugWireframe=e.debugWireframe;var n=e.clippingPlanes;i.referenceMatrix=e.clippingPlanesOriginMatrix,defined(n)&&r.clippingPlanesDirty&&(i._clippingPlanes=n.enabled&&r._isClipped?n:void 0),defined(n)&&defined(i._clippingPlanes)&&i._clippingPlanes!==n&&(i._clippingPlanes=n),i.update(t)},Gltf3DTileContent.prototype.isDestroyed=function(){return!1},Gltf3DTileContent.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),destroyObject(this)},Object.defineProperties(ImplicitAvailabilityBitstream.prototype,{lengthBits:{get:function(){return this._lengthBits}},availableCount:{get:function(){return this._availableCount}}}),ImplicitAvailabilityBitstream.prototype.getBit=function(e){if(defined(this._constant))return this._constant;var t=e>>3,i=e%8;return 1==(this._bitstream[t]>>i&1)};var ImplicitSubdivisionScheme={QUADTREE:"QUADTREE",OCTREE:"OCTREE",getBranchingFactor:function(e){switch(e){case ImplicitSubdivisionScheme.OCTREE:return 8;case ImplicitSubdivisionScheme.QUADTREE:return 4}}},ImplicitSubdivisionScheme$1=Object.freeze(ImplicitSubdivisionScheme);function MetadataEntity(){}Object.defineProperties(MetadataEntity.prototype,{class:{get:function(){DeveloperError.throwInstantiationError()}}}),MetadataEntity.prototype.hasProperty=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.hasPropertyBySemantic=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.getPropertyIds=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.getProperty=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.setProperty=function(e,t){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.getPropertyBySemantic=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.setPropertyBySemantic=function(e,t){DeveloperError.throwInstantiationError()},MetadataEntity.hasProperty=function(e,t,i){if(defined(t[e]))return!0;if(defined(i)){var r=i.properties[e];if(defined(r)&&defined(r.default))return!0}return!1},MetadataEntity.hasPropertyBySemantic=function(e,t,i){return!!defined(i)&&defined(i.propertiesBySemantic[e])},MetadataEntity.getPropertyIds=function(e,t,i){for(var r in(i=defined(i)?i:[]).length=0,e)e.hasOwnProperty(r)&&defined(e[r])&&i.push(r);if(defined(t)){var n=t.properties;for(var a in n)n.hasOwnProperty(a)&&!defined(e[a])&&defined(n[a].default)&&i.push(a)}return i},MetadataEntity.getProperty=function(e,t,i){var r,n=t[e];if(defined(i)&&(r=i.properties[e]),!defined(n)&&defined(r)&&(n=r.default),defined(n))return Array.isArray(n)&&(n=n.slice()),defined(r)&&(n=r.normalize(n),n=r.unpackVectorAndMatrixTypes(n)),n},MetadataEntity.setProperty=function(e,t,i,r){if(!defined(i[e]))return!1;if(Array.isArray(t)&&(t=t.slice()),defined(r)){var n=r.properties[e];defined(n)&&(t=n.packVectorAndMatrixTypes(t),t=n.unnormalize(t))}return i[e]=t,!0},MetadataEntity.getPropertyBySemantic=function(e,t,i){if(defined(i)){var r=i.propertiesBySemantic[e];return defined(r)?MetadataEntity.getProperty(r.id,t,i):void 0}},MetadataEntity.setPropertyBySemantic=function(e,t,i,r){var n=r.propertiesBySemantic[e];return!!defined(n)&&MetadataEntity.setProperty(n.id,t,i,r)};var MetadataComponentType={INT8:"INT8",UINT8:"UINT8",INT16:"INT16",UINT16:"UINT16",INT32:"INT32",UINT32:"UINT32",INT64:"INT64",UINT64:"UINT64",FLOAT32:"FLOAT32",FLOAT64:"FLOAT64",BOOLEAN:"BOOLEAN",STRING:"STRING",ENUM:"ENUM",getMinimum:function(e){switch(e){case MetadataComponentType.INT8:return-128;case MetadataComponentType.UINT8:return 0;case MetadataComponentType.INT16:return-32768;case MetadataComponentType.UINT16:return 0;case MetadataComponentType.INT32:return-2147483648;case MetadataComponentType.UINT32:return 0;case MetadataComponentType.INT64:return FeatureDetection.supportsBigInt()?BigInt("-9223372036854775808"):-Math.pow(2,63);case MetadataComponentType.UINT64:return FeatureDetection.supportsBigInt()?BigInt(0):0;case MetadataComponentType.FLOAT32:return-34028234663852886e22;case MetadataComponentType.FLOAT64:return-Number.MAX_VALUE}},getMaximum:function(e){switch(e){case MetadataComponentType.INT8:return 127;case MetadataComponentType.UINT8:return 255;case MetadataComponentType.INT16:return 32767;case MetadataComponentType.UINT16:return 65535;case MetadataComponentType.INT32:return 2147483647;case MetadataComponentType.UINT32:return 4294967295;case MetadataComponentType.INT64:return FeatureDetection.supportsBigInt()?BigInt("9223372036854775807"):Math.pow(2,63)-1;case MetadataComponentType.UINT64:return FeatureDetection.supportsBigInt()?BigInt("18446744073709551615"):Math.pow(2,64)-1;case MetadataComponentType.FLOAT32:return 34028234663852886e22;case MetadataComponentType.FLOAT64:return Number.MAX_VALUE}},isNumericType:function(e){switch(e){case MetadataComponentType.INT8:case MetadataComponentType.UINT8:case MetadataComponentType.INT16:case MetadataComponentType.UINT16:case MetadataComponentType.INT32:case MetadataComponentType.UINT32:case MetadataComponentType.INT64:case MetadataComponentType.UINT64:case MetadataComponentType.FLOAT32:case MetadataComponentType.FLOAT64:return!0;default:return!1}},isIntegerType:function(e){switch(e){case MetadataComponentType.INT8:case MetadataComponentType.UINT8:case MetadataComponentType.INT16:case MetadataComponentType.UINT16:case MetadataComponentType.INT32:case MetadataComponentType.UINT32:case MetadataComponentType.INT64:case MetadataComponentType.UINT64:return!0;default:return!1}},isUnsignedIntegerType:function(e){switch(e){case MetadataComponentType.UINT8:case MetadataComponentType.UINT16:case MetadataComponentType.UINT32:case MetadataComponentType.UINT64:return!0;default:return!1}},isVectorCompatible:function(e){switch(e){case MetadataComponentType.INT8:case MetadataComponentType.UINT8:case MetadataComponentType.INT16:case MetadataComponentType.UINT16:case MetadataComponentType.INT32:case MetadataComponentType.UINT32:case MetadataComponentType.FLOAT32:case MetadataComponentType.FLOAT64:return!0;default:return!1}},normalize:function(e,t){return e>=0?Math.min(Number(e)/Number(MetadataComponentType.getMaximum(t)),1):-Math.min(Number(e)/Number(MetadataComponentType.getMinimum(t)),1)},unnormalize:function(e,t){var i=MetadataComponentType.getMinimum(t),r=MetadataComponentType.getMaximum(t);return e>=0?e*=Number(r):e=-e*Number(i),t!==MetadataComponentType.INT64&&t!==MetadataComponentType.UINT64||!FeatureDetection.supportsBigInt()||(e=BigInt(e)),e>r?r:e<i?i:e},getSizeInBytes:function(e){switch(e){case MetadataComponentType.INT8:case MetadataComponentType.UINT8:return 1;case MetadataComponentType.INT16:case MetadataComponentType.UINT16:return 2;case MetadataComponentType.INT32:case MetadataComponentType.UINT32:return 4;case MetadataComponentType.INT64:case MetadataComponentType.UINT64:return 8;case MetadataComponentType.FLOAT32:return 4;case MetadataComponentType.FLOAT64:return 8}}},MetadataComponentType$1=Object.freeze(MetadataComponentType),MetadataType={SINGLE:"SINGLE",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",ARRAY:"ARRAY",isVectorType:function(e){switch(e){case MetadataType.VEC2:case MetadataType.VEC3:case MetadataType.VEC4:return!0;default:return!1}},isMatrixType:function(e){switch(e){case MetadataType.MAT2:case MetadataType.MAT3:case MetadataType.MAT4:return!0;default:return!1}},getComponentCount:function(e){switch(e){case MetadataType.SINGLE:return 1;case MetadataType.VEC2:return 2;case MetadataType.VEC3:return 3;case MetadataType.VEC4:case MetadataType.MAT2:return 4;case MetadataType.MAT3:return 9;case MetadataType.MAT4:return 16;default:return}}},MetadataType$1=Object.freeze(MetadataType);function MetadataTableProperty(e){var t,i,r,n,a=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).count,o=e.property,s=e.classProperty,l=e.bufferViews,c=s.type,u=c===MetadataType$1.ARRAY,d=u&&!defined(s.componentCount),h=MetadataType$1.isVectorType(c)||MetadataType$1.isMatrixType(c),p=s.valueType,f=s.enumType,m=p===MetadataComponentType$1.STRING,g=p===MetadataComponentType$1.BOOLEAN;if(d){var _=defaultValue(o.arrayOffsetType,o.offsetType);_=defaultValue(MetadataComponentType$1[_],MetadataComponentType$1.UINT32),t=new BufferView(l[o.arrayOffsetBufferView],_,a+1)}if(i=d?t.get(a)-t.get(0):u||h?a*s.componentCount:a,m){var y=defaultValue(o.stringOffsetType,o.offsetType);y=defaultValue(MetadataComponentType$1[y],MetadataComponentType$1.UINT32),r=new BufferView(l[o.stringOffsetBufferView],y,i+1)}(m||g)&&(p=MetadataComponentType$1.UINT8),n=m?r.get(i)-r.get(0):g?Math.ceil(i/8):i;var v,C,T=new BufferView(l[o.bufferView],p,n),S=this;m?v=function(e){return getString(e,S._values,S._stringOffsets)}:g?(v=function(e){return getBoolean(e,S._values)},C=function(e,t){setBoolean(e,S._values,t)}):defined(f)?(v=function(e){var t=S._values.get(e);return f.namesByValue[t]},C=function(e,t){var i=f.valuesByName[t];S._values.set(e,i)}):(v=function(e){return S._values.get(e)},C=function(e,t){S._values.set(e,t)}),this._arrayOffsets=t,this._stringOffsets=r,this._values=T,this._classProperty=s,this._count=a,this._getValue=v,this._setValue=C,this._unpackedValues=void 0,this._extras=o.extras,this._extensions=o.extensions}function get(e,t){requiresUnpackForGet(e)&&unpackProperty(e);var i=e._classProperty;if(defined(e._unpackedValues)){var r=e._unpackedValues[t];return i.type===MetadataType$1.ARRAY?r.slice():r}var n,a,o=i.type,s=i.type===MetadataType$1.ARRAY,l=MetadataType$1.isVectorType(o)||MetadataType$1.isMatrixType(o);if(!s&&!l)return e._getValue(t);var c=i.componentCount;defined(c)?(n=t*c,a=c):(n=e._arrayOffsets.get(t),a=e._arrayOffsets.get(t+1)-n);for(var u=new Array(a),d=0;d<a;++d)u[d]=e._getValue(n+d);return u}function set(e,t,i){requiresUnpackForSet(e,t,i)&&unpackProperty(e);var r=e._classProperty;if(defined(e._unpackedValues))return r.type===MetadataType$1.ARRAY&&(i=i.slice()),void(e._unpackedValues[t]=i);var n=r.type,a=r.type===MetadataType$1.ARRAY,o=MetadataType$1.isVectorType(n)||MetadataType$1.isMatrixType(n);if(a||o){var s,l,c=r.componentCount;defined(c)?(s=t*c,l=c):(s=e._arrayOffsets.get(t),l=e._arrayOffsets.get(t+1)-s);for(var u=0;u<l;++u)e._setValue(s+u,i[u])}else e._setValue(t,i)}function getString(e,t,i){var r=i.get(e),n=i.get(e+1)-r;return getStringFromTypedArray(t.typedArray,r,n)}function getBoolean(e,t){var i=e>>3,r=e%8;return 1==(t.typedArray[i]>>r&1)}function setBoolean(e,t,i){var r=e>>3,n=e%8;i?t.typedArray[r]|=1<<n:t.typedArray[r]&=~(1<<n)}function getInt64NumberFallback(e,t){for(var i=t.dataView,r=8*e,n=0,a=(128&i.getUint8(r+7))>0,o=!0,s=0;s<8;++s){var l=i.getUint8(r+s);a&&(o?0!==l&&(l=255&~(l-1),o=!1):l=255&~l),n+=l*Math.pow(256,s)}return a&&(n=-n),n}function getInt64BigIntFallback(e,t){for(var i=t.dataView,r=8*e,n=BigInt(0),a=(128&i.getUint8(r+7))>0,o=!0,s=0;s<8;++s){var l=i.getUint8(r+s);a&&(o?0!==l&&(l=255&~(l-1),o=!1):l=255&~l),n+=BigInt(l)*(BigInt(1)<<BigInt(8*s))}return a&&(n=-n),n}function getUint64NumberFallback(e,t){var i=t.dataView,r=8*e;return i.getUint32(r,!0)+4294967296*i.getUint32(r+4,!0)}function getUint64BigIntFallback(e,t){var i=t.dataView,r=8*e,n=BigInt(i.getUint32(r,!0)),a=BigInt(i.getUint32(r+4,!0));return n+BigInt(4294967296)*a}function getComponentDatatype(e){switch(e){case MetadataComponentType$1.INT8:return ComponentDatatype$1.BYTE;case MetadataComponentType$1.UINT8:return ComponentDatatype$1.UNSIGNED_BYTE;case MetadataComponentType$1.INT16:return ComponentDatatype$1.SHORT;case MetadataComponentType$1.UINT16:return ComponentDatatype$1.UNSIGNED_SHORT;case MetadataComponentType$1.INT32:return ComponentDatatype$1.INT;case MetadataComponentType$1.UINT32:return ComponentDatatype$1.UNSIGNED_INT;case MetadataComponentType$1.FLOAT32:return ComponentDatatype$1.FLOAT;case MetadataComponentType$1.FLOAT64:return ComponentDatatype$1.DOUBLE}}function requiresUnpackForGet(e){if(defined(e._unpackedValues))return!1;var t=e._classProperty.valueType;return t===MetadataComponentType$1.STRING||(t===MetadataComponentType$1.INT64&&!FeatureDetection.supportsBigInt64Array()||t===MetadataComponentType$1.UINT64&&!FeatureDetection.supportsBigUint64Array())}function requiresUnpackForSet(e,t,i){if(requiresUnpackForGet(e))return!0;var r=e._arrayOffsets;if(defined(r)&&r.get(t+1)-r.get(t)!==i.length)return!0;return!1}function unpackProperty(e){e._unpackedValues=unpackValues(e),e._arrayOffsets=void 0,e._stringOffsets=void 0,e._values=void 0}function unpackValues(e){var t,i,r,n,a=e._count,o=new Array(a),s=e._classProperty;if(s.type!==MetadataType$1.ARRAY){for(t=0;t<a;++t)o[t]=e._getValue(t);return o}var l=s.componentCount;if(defined(l)){for(t=0;t<a;++t)for(n=new Array(l),o[t]=n,r=t*l,i=0;i<l;++i)n[i]=e._getValue(r+i);return o}for(t=0;t<a;++t){r=e._arrayOffsets.get(t);var c=e._arrayOffsets.get(t+1)-r;for(n=new Array(c),o[t]=n,i=0;i<c;++i)n[i]=e._getValue(r+i)}return o}function BufferView(e,t,i){var r,n,a,o=this;if(t===MetadataComponentType$1.INT64)FeatureDetection.supportsBigInt()?FeatureDetection.supportsBigInt64Array()?(r=new BigInt64Array(e.buffer,e.byteOffset,i),a=function(e,t){o.typedArray[e]=BigInt(t)}):(r=new Uint8Array(e.buffer,e.byteOffset,8*i),n=function(e){return getInt64BigIntFallback(e,o)}):(oneTimeWarning("INT64 type is not fully supported on this platform. Values greater than 2^53 - 1 or less than -(2^53 - 1) may lose precision when read."),r=new Uint8Array(e.buffer,e.byteOffset,8*i),n=function(e){return getInt64NumberFallback(e,o)});else if(t===MetadataComponentType$1.UINT64)FeatureDetection.supportsBigInt()?FeatureDetection.supportsBigUint64Array()?(r=new BigUint64Array(e.buffer,e.byteOffset,i),a=function(e,t){o.typedArray[e]=BigInt(t)}):(r=new Uint8Array(e.buffer,e.byteOffset,8*i),n=function(e){return getUint64BigIntFallback(e,o)}):(oneTimeWarning("UINT64 type is not fully supported on this platform. Values greater than 2^53 - 1 may lose precision when read."),r=new Uint8Array(e.buffer,e.byteOffset,8*i),n=function(e){return getUint64NumberFallback(e,o)});else{var s=getComponentDatatype(t);r=ComponentDatatype$1.createArrayBufferView(s,e.buffer,e.byteOffset,i),a=function(e,t){o.typedArray[e]=t}}defined(n)||(n=function(e){return o.typedArray[e]}),this.typedArray=r,this.dataView=new DataView(r.buffer,r.byteOffset),this.get=n,this.set=a,this._componentType=t}function MetadataTable(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).count,i={};if(defined(e.properties))for(var r in e.properties)e.properties.hasOwnProperty(r)&&(i[r]=new MetadataTableProperty({count:t,property:e.properties[r],classProperty:e.class.properties[r],bufferViews:e.bufferViews}));this._count=t,this._class=e.class,this._properties=i}function getDefault$1(e,t){if(defined(e)){var i=e.properties[t];if(defined(i)&&defined(i.default)){var r=i.default;return i.type===MetadataType$1.ARRAY&&(r=r.slice()),r=i.normalize(r),i.unpackVectorAndMatrixTypes(r)}}}function ResourceLoader(){}Object.defineProperties(MetadataTableProperty.prototype,{extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),MetadataTableProperty.prototype.get=function(e){var t=get(this,e);return t=this._classProperty.normalize(t),this._classProperty.unpackVectorAndMatrixTypes(t)},MetadataTableProperty.prototype.set=function(e,t){var i=this._classProperty;t=i.packVectorAndMatrixTypes(t),set(this,e,t=i.unnormalize(t))},MetadataTableProperty.prototype.getTypedArray=function(){if(defined(this._values))return this._values.typedArray},Object.defineProperties(MetadataTable.prototype,{count:{get:function(){return this._count}},class:{get:function(){return this._class}}}),MetadataTable.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},MetadataTable.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},MetadataTable.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},MetadataTable.prototype.getProperty=function(e,t){var i=this._properties[t];return defined(i)?i.get(e):getDefault$1(this._class,t)},MetadataTable.prototype.setProperty=function(e,t,i){var r=this._properties[t];return!!defined(r)&&(r.set(e,i),!0)},MetadataTable.prototype.getPropertyBySemantic=function(e,t){if(defined(this._class)){var i=this._class.propertiesBySemantic[t];if(defined(i))return this.getProperty(e,i.id)}},MetadataTable.prototype.setPropertyBySemantic=function(e,t,i){if(defined(this._class)){var r=this._class.propertiesBySemantic[t];if(defined(r))return this.setProperty(e,r.id,i)}return!1},MetadataTable.prototype.getPropertyTypedArray=function(e){var t=this._properties[e];if(defined(t))return t.getTypedArray()},MetadataTable.prototype.getPropertyTypedArrayBySemantic=function(e){if(defined(this._class)){var t=this._class.propertiesBySemantic[e];if(defined(t))return this.getPropertyTypedArray(t.id)}},Object.defineProperties(ResourceLoader.prototype,{promise:{get:function(){DeveloperError.throwInstantiationError()}},cacheKey:{get:function(){DeveloperError.throwInstantiationError()}}}),ResourceLoader.prototype.load=function(){DeveloperError.throwInstantiationError()},ResourceLoader.prototype.unload=function(){},ResourceLoader.prototype.process=function(e){},ResourceLoader.prototype.getError=function(e,t){return defined(t)&&(e+="\n"+t.message),new RuntimeError(e)},ResourceLoader.prototype.isDestroyed=function(){return!1},ResourceLoader.prototype.destroy=function(){return this.unload(),destroyObject(this)};var ResourceLoaderState={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},ResourceLoaderState$1=Object.freeze(ResourceLoaderState);function BufferLoader(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).typedArray,i=e.resource,r=e.cacheKey;this._typedArray=t,this._resource=i,this._cacheKey=r,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function loadExternalBuffer(e){var t=e._resource;e._state=ResourceLoaderState$1.LOADING,BufferLoader._fetchArrayBuffer(t).then((function(t){e.isDestroyed()||(e._typedArray=new Uint8Array(t),e._state=ResourceLoaderState$1.READY,e._promise.resolve(e))})).otherwise((function(i){if(!e.isDestroyed()){e._state=ResourceLoaderState$1.FAILED;var r="Failed to load external buffer: "+t.url;e._promise.reject(e.getError(r,i))}}))}defined(Object.create)&&(BufferLoader.prototype=Object.create(ResourceLoader.prototype),BufferLoader.prototype.constructor=BufferLoader),Object.defineProperties(BufferLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}}),BufferLoader.prototype.load=function(){defined(this._typedArray)?this._promise.resolve(this):loadExternalBuffer(this)},BufferLoader._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()},BufferLoader.prototype.unload=function(){this._typedArray=void 0},function(){var e,t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var i=WebAssembly.instantiate(function(e){for(var i=new Uint8Array(e.length),r=0;r<e.length;++r){var n=e.charCodeAt(r);i[r]=n>96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}var a=0;for(r=0;r<e.length;++r)i[a++]=i[r]<60?t[i[r]]:64*(i[r]-60)+i[++r];return i.buffer.slice(0,a)}("B9h79tEBBBENQ9gEUEU9gEUB9gBB9gVUUUUUEU9gDUUEU9gLUUUUEU9gIUUUEU9gVUUUUUB9gLUUUUB9gD99UE99Ie8aDILEVOLEVLRRRRRWWVBOOBEdddLVE9wEIIVIEBEOWEUEC+Q/KEKR/QIhO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwvBE8f9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwv9C9v919u9kBDe9tw79o9v9wT9fw9u9j9v9kw9WwvTw949Wwv79p9v9uBIy9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwvBL8e9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwv9C9v919u9kBO8a9tw79o9v9wT9fw9u9j9v9kw69u9kw949Wwv79p9v9uBRe9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jwBWA9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jw9C9v919u9kBdl9tw79o9v9wT9fw9u9j9v9kws9p2Twv9P9jTBQk9tw79o9v9wT9fw9u9j9v9kws9p2Twv9R919hTBKl9tw79o9v9wT9fw9u9j9v9kws9p2Twvt949wBXe9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9owBSA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9ow9TTv9p9wBZA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94swT9j9o9Sw9t9h9wBhL79iv9rBodWEBCEKDqxQ+f9Q8aDBK/EpE8jU8jJJJJBCJO9rGV8kJJJJBCBHODNALCEFAE0MBABCBrBJ+KJJBC+gEv86BBAVCJDFCBCJDZnJJJB8aDNAItMBAVCJDFADALZ+TJJJB8aKABAEFHRABCEFHEAVALFCBCBCJDAL9rALCfE0eZnJJJB8aAVAVCJDFALZ+TJJJBHWCJ/ABAL9uHODNAItMBAOC/wfBgGOCJDAOCJD6eHdCBHQINAWCJLFCBCJDZnJJJB8aAdAIAQ9rAQAdFAI6eHKADAQAL2FHXDNALtMBAKCSFGOC9wgHMAOCL4CIFCD4HpCBHSAXHZAEHhINDNAKtMBAWASFrBBHoCBHEAZHOINAWCJLFAEFAOrBBGaAo9rGoCETAoCkTCk91CR4786BBAOALFHOAaHoAECEFGEAK9HMBKKDNARAh9rAp6MBAhCBApZnJJJBGcApFHEDNAMtMBCBHxAWCJLFHqINARAE9rCk6MDAWCJLFAxFGlrBDHoCUHODNAlrBEGaAlrBBGkvCfEgMBCBHaAoCfEgMBCBHoDNAlrBIMBAlrBLMBAlrBVMBAlrBOMBAlrBRMBAlrBWMBAlrBdMBAlrBQMBAlrBKMBAlrBXMBAlrBMMBCBHaAlrBpMECBHoCUCBAlrBSeHOKCBHaKDNDNDNDNCLCDCECWAOCZ6GheAkCfEgGkCD0CLvAaCfEgGaCD0FAoCfEgGoCD0FAlrBIGyCD0FAlrBLG8aCD0FAlrBVGeCD0FAlrBOG3CD0FAlrBRG5CD0FAlrBWG8eCD0FAlrBdG8fCD0FAlrBQGACD0FAlrBKGHCD0FAlrBXGGCD0FAlrBMG8jCD0FAlrBpG8kCD0FAlrBSG8lCD0FG8mAOCZAheG8n6GOeAkCp0CWvAaCp0FAoCp0FAyCp0FA8aCp0FAeCp0FA3Cp0FA5Cp0FA8eCp0FA8fCp0FAACp0FAHCp0FAGCp0FA8jCp0FA8kCp0FA8lCp0FA8mA8nAOe6GoeGyCUFpDIEBKAcAxCO4FGaAarBBCDCIAoeAxCI4COgTv86BBAyCW9HMEAEAl8pBB83BBAECWFAlCWF8pBB83BBAECZFHEXDKAcAxCO4FGaAarBBCEAxCI4COgTv86BBKCDCLCWCEAheAOeAoeH8aCUAyTCU7HaCBH5AqHeINAEH3A8aHoAeHECBHOINAErBBGhAaAhAaCfEgGk6eAOCfEgAyTvHOAECEFHEAoCUFGoMBKA3AO86BBAeA8aFHeA3CEFHEA5A8aFG5CZ6MBKDNAlrBBGOAk6MBA3AO86BEA3CDFHEKDNAlrBEGOAk6MBAEAO86BBAECEFHEKDNAlrBDGOAk6MBAEAO86BBAECEFHEKDNAlrBIGOAk6MBAEAO86BBAECEFHEKDNAlrBLGOAk6MBAEAO86BBAECEFHEKDNAlrBVGOAk6MBAEAO86BBAECEFHEKDNAlrBOGOAk6MBAEAO86BBAECEFHEKDNAlrBRGOAk6MBAEAO86BBAECEFHEKDNAlrBWGOAk6MBAEAO86BBAECEFHEKDNAlrBdGOAk6MBAEAO86BBAECEFHEKDNAlrBQGOAk6MBAEAO86BBAECEFHEKDNAlrBKGOAk6MBAEAO86BBAECEFHEKDNAlrBXGOAk6MBAEAO86BBAECEFHEKDNAlrBMGOAk6MBAEAO86BBAECEFHEKDNAlrBpGOAk6MBAEAO86BBAECEFHEKAlrBSGOAk6MBAEAO86BBAECEFHEKAqCZFHqAxCZFGxAM6MBKKAEtMBAZCEFHZAEHhASCEFGSALsMDXEKKCBHOXIKAWAXAKCUFAL2FALZ+TJJJB8aAKAQFGQAI6MBKKCBHOARAE9rCAALALCA6e6MBDNALC8f0MBAECBCAAL9rGOZnJJJBAOFHEKAEAWCJDFALZ+TJJJBALFAB9rHOKAVCJOF8kJJJJBAOK9HEEUAECAAECA0eABCJ/ABAE9uC/wfBgGDCJDADCJD6eGDFCUFAD9uAE2ADCL4CIFCD4ADv2FCEFKMBCBABbDJ+KJJBK/pSEeU8jJJJJBC/AE9rGL8kJJJJBCBHVDNAICI9uGOChFAE0MBABCBYD+E+KJJBGRC/gEv86BBALC/ABFCfECJEZnJJJB8aALCuFGW9CU83IBALC8wFGd9CU83IBALCYFGQ9CU83IBALCAFGK9CU83IBALCkFGX9CU83IBALCZFGM9CU83IBAL9CU83IWAL9CU83IBABAEFC9wFGpABCEFGSAOFGE6HODNAItMBCMCSARCB9KeHZCBHhCBHoCBHaCBHcCBHxINDNAOCEgtMBCBHVXIKCDHqADAaCDTFGOYDBHlAOCWFYDBHkAOCLFYDBHyCBH8aCBHODNDNDNDNDNDNDNDNDNINALC/ABFAOCU7AxFCSgCITFGVYDLHeDNAVYDBGVAl9HMBAeAy9HMBAqC9+FHqXDKDNAVAy9HMBAeAk9HMBAqCUFHqXDKDNAVAk9HMBAeAlsMDKAqCLFHqA8aCZFH8aAOCEFGOCZ9HMBXDKKAqC870MBADAqCIgCX2GVC+E1JJBFYDBAaFCDTFYDBHqADAVCJ1JJBFYDBAaFCDTFYDBHyALADAVC11JJBFYDBAaFCDTFYDBGVAcZ+FJJJBGeCBCSAVAhsGkeAeCB9KAeAZ9IgGleHeAkAlCE7gHkDNARCE9IMBAeCS9HMBAVAVAoAVCEFAosGeeGoCEFsMDCMCSAeeHeKASAeA8av86BBAeCS9HMDAVAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAVHoXIKADCEAkAhsCETAyAhseCX2GOC11JJBFYDBAaFCDTFYDBHqADAOC+E1JJBFYDBAaFCDTFYDBHeADAOCJ1JJBFYDBAaFCDTFYDBHVCBHlDNARCE9IMBAhtMBAVMBAeCE9HMBAqCD9HMBAW9CU83IBAd9CU83IBAQ9CU83IBAK9CU83IBAX9CU83IBAM9CU83IBAL9CU83IWAL9CU83IBCBHhCEHlKAhAVAhsGOFH8aALAeAcZ+FJJJBHyALAqAcZ+FJJJBHkAyCM0MLAyCEFHyXVKCpHeASAOCLTCpv86BBAVHoKAetMBAeAZ9IMEKALAcCDTFAVbDBAcCEFCSgHcKAhAkFHhALC/ABFAxCITFGOAqbDLAOAVbDBALC/ABFAxCEFCSgGOCITFGeAVbDLAeAybDBAOCEFHVXDKCBCSAeA8asG3eHyA8aA3FH8aKDNDNAkCM0MBAkCEFHkXEKCBCSAqA8asG3eHkA8aA3FH8aKDNDNDNDNDNDNDNDNDNDNDNDNDNDNDNDNDNAkAyCLTvG3CfEgG5C+qUFp9UISSSSSSSSSSSSSSWSLQMSSSSSSSSSSSSESVSSSSSSSSSSSSSRDSdSSSSSSSSSSSSSSKSSSSSSSSSSSSSSSSOBKC/wEH8eA5pDMKpKC/xEH8eXXKC/yEH8eXKKC/zEH8eXQKC/0EH8eXdKC/1EH8eXWKC/2EH8eXRKC/3EH8eXOKC/4EH8eXVKC/5EH8eXLKC/6EH8eXIKC/7EH8eXDKC/8EH8eXEKCPEH8eKAlAVAh9HvMBASA8e86BBXEKASC9+CUAOe86BBAEA386BBAECEFHEKDNAOMBAVAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAVHoKDNAyCS9HMBAeAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAeHoKDNAkCS9HMBAqAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAqHoKALAcCDTFAVbDBAcCEFCSgHODNDNAypZBEEEEEEEEEEEEEEBEKALAOCDTFAebDBAcCDFCSgHOKDNDNAkpZBEEEEEEEEEEEEEEBEKALAOCDTFAqbDBAOCEFCSgHOKALC/ABFAxCITFGyAVbDLAyAebDBALC/ABFAxCEFCSgCITFGyAebDLAyAqbDBALC/ABFAxCDFCSgCITFGeAqbDLAeAVbDBAxCIFHVAOHcA8aHhKApAE6HOASCEFHSAVCSgHxAaCIFGaAI6MBKKCBHVAOMBAE9C/lm+i/D+Z+g8a83BWAE9CJ/s+d+0/1+M/e/U+GU83BBAEAB9rCZFHVKALC/AEF8kJJJJBAVK+mIEEUCBHIDNABADCUFCSgCDTFYDBAEsMBCEHIABADCpFCSgCDTFYDBAEsMBCDHIABADCMFCSgCDTFYDBAEsMBCIHIABADCXFCSgCDTFYDBAEsMBCLHIABADCKFCSgCDTFYDBAEsMBCVHIABADCQFCSgCDTFYDBAEsMBCOHIABADCdFCSgCDTFYDBAEsMBCRHIABADCWFCSgCDTFYDBAEsMBCWHIABADCRFCSgCDTFYDBAEsMBCdHIABADCOFCSgCDTFYDBAEsMBCQHIABADCVFCSgCDTFYDBAEsMBCKHIABADCLFCSgCDTFYDBAEsMBCXHIABADCIFCSgCDTFYDBAEsMBCMHIABADCDFCSgCDTFYDBAEsMBCpHIABADCEFCSgCDTFYDBAEsMBCSCUABADCSgCDTFYDBAEseSKAIKjEIUCRHDDNINADCEFHIADC96FGLC8f0MEAIHDCEALTAE6MBKKAICR9uCI2CDFABCI9u2ChFKMBCBABbD+E+KJJBK+YDERU8jJJJJBCZ9rHLCBHVDNAICVFAE0MBCBHVABCBrB+E+KJJBC/QEv86BBAL9CB83IWABCEFHOABAEFC98FHRDNAItMBCBHWINDNARAO0MBCBSKAVADAWCDTFYDBGdALCWFAVCDTFYDB9rGEAEC8f91GEFAE7C59K7GVAdALCWFAVCDTFGQYDB9rGEC8f91CETAECDT7vHEINAOAECfB0CRTAECfBgv86BBAOCEFHOAECR4GEMBKAQAdbDBAWCEFGWAI9HMBKKCBHVARAO6MBAOCBbBBAOAB9rCLFHVKAVK86EIUCWHDDNINADCEFHIADC95FGLC8f0MEAIHDCEALTAE6MBKKAICR9uAB2CVFK+yWDEUO99DNAEtMBADCLsHVCUADCETCUFTCU7HDDNDNCUAICUFTCU7+yGOjBBBzmGR+LjBBB9P9dtMBAR+oHIXEKCJJJJ94HIKAD+yHWDNAVMBABCOFHDINALCLFiDBGRjBBBBjBBJzALiDBGd+LAR+LmALCWFiDBGQ+LmGR+VARjBBBB9beGRnHKAdARnHRALCXFiDBHdDNDNAQjBBBB9gtMBAKHQXEKjBBJzAR+L+TGQAQ+MAKjBBBB9geHQjBBJzAK+L+TGKAK+MARjBBBB9geHRKADC9+FAI87EBDNDNjBBBzjBBB+/AdjBBBB9geAdjBBJ+/AdjBBJ+/9geGdjBBJzAdjBBJz9feAWnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADAB87EBDNDNjBBBzjBBB+/AQjBBBB9geAQjBBJ+/AQjBBJ+/9geGdjBBJzAdjBBJz9feAOnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADC98FAB87EBDNDNjBBBzjBBB+/ARjBBBB9geARjBBJ+/ARjBBJ+/9geGRjBBJzARjBBJz9feAOnmGR+LjBBB9P9dtMBAR+oHBXEKCJJJJ94HBKADC96FAB87EBALCZFHLADCWFHDAECUFGEMBXDKKABCIFHDINALCLFiDBGRjBBBBjBBJzALiDBGd+LAR+LmALCWFiDBGQ+LmGR+VARjBBBB9beGRnHKAdARnHRALCXFiDBHdDNDNAQjBBBB9gtMBAKHQXEKjBBJzAR+L+TGQAQ+MAKjBBBB9geHQjBBJzAK+L+TGKAK+MARjBBBB9geHRKADCUFAI86BBDNDNjBBBzjBBB+/AdjBBBB9geAdjBBJ+/AdjBBJ+/9geGdjBBJzAdjBBJz9feAWnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADAB86BBDNDNjBBBzjBBB+/AQjBBBB9geAQjBBJ+/AQjBBJ+/9geGdjBBJzAdjBBJz9feAOnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADC9+FAB86BBDNDNjBBBzjBBB+/ARjBBBB9geARjBBJ+/ARjBBJ+/9geGRjBBJzARjBBJz9feAOnmGR+LjBBB9P9dtMBAR+oHBXEKCJJJJ94HBKADC99FAB86BBALCZFHLADCLFHDAECUFGEMBKKK/KLLD99EUE99EUDNAEtMBDNDNCUAICUFTCU7+yGVjBBBzmGO+LjBBB9P9dtMBAO+oHIXEKCJJJJ94HIKAIC/8fIgHRINABCOFCICDALCLFiDB+LALiDB+L9eGIALCWFiDB+LALAICDTFiDB+L9eeGIALCXFiDB+LALAICDTFiDB+L9eeGIARv87EBDNDNjBBBzjBBB+/ALAICEFCIgCDTFiDBj/zL+1znjBBJ+/jBBJzALAICDTFiDBjBBBB9deGOnGWjBBBB9geAWjBBJ+/AWjBBJ+/9geGWjBBJzAWjBBJz9feAVnmGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKABAd87EBDNDNjBBBzjBBB+/AOALAICDFCIgCDTFiDBj/zL+1znnGWjBBBB9geAWjBBJ+/AWjBBJ+/9geGWjBBJzAWjBBJz9feAVnmGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKABCDFAd87EBDNDNjBBBzjBBB+/AOALAICUFCIgCDTFiDBj/zL+1znnGOjBBBB9geAOjBBJ+/AOjBBJ+/9geGOjBBJzAOjBBJz9feAVnmGO+LjBBB9P9dtMBAO+oHIXEKCJJJJ94HIKABCLFAI87EBABCWFHBALCZFHLAECUFGEMBKKK+tDDWUE998jJJJJBCZ9rGV8kJJJJBDNAEtMBADCD4GOtMBCEAI9rHRAOCDTHWCBHdINC+cUHDALHIAOHQINAIiDBAVCXFZ+YJJJB8aAVYDXGKADADAK9IeHDAICLFHIAQCUFGQMBKARADFGICkTHKCBHDCBAI9rHXAOHIINDNDNALADFiDBGMAXZ+XJJJBjBBBzjBBB+/AMjBBBB9gemGM+LjBBB9P9dtMBAM+oHQXEKCJJJJ94HQKABADFAQCfffRgAKvbDBADCLFHDAICUFGIMBKABAWFHBALAWFHLAdCEFGdAE9HMBKKAVCZF8kJJJJBK+iMDlUI998jJJJJBC+QD9rGV8kJJJJBAVC+oEFCBC/kBZnJJJB8aCBHODNADtMBCBHOAItMBDNABAE9HMBAVCUADCDTGRADCffffI0eCBYD/4+JJJBhJJJJBBGEbD+oEAVCEbD1DAEABARZ+TJJJB8aKAVC+YEFCWFCBbDBAV9CB83I+YEAVC+YEFAEADAIAVC+oEFZ+OJJJBCUAICDTGWAICffffI0eGdCBYD/4+JJJBhJJJJBBHRAVC+oEFAVYD1DGOCDTFARbDBAVAOCEFGQbD1DARAVYD+YEGKAWZ+TJJJBHXAVC+oEFAQCDTFADCI9uGMCBYD/4+JJJBhJJJJBBGRbDBAVAOCDFGWbD1DARCBAMZnJJJBHpAVC+oEFAWCDTFAdCBYD/4+JJJBhJJJJBBGSbDBAVAOCIFGQbD1DAXHRASHWINAWALiDBALARYDBGdCWAdCW6eCDTFC/EBFiDBmuDBARCLFHRAWCLFHWAICUFGIMBKCBHIAVC+oEFAQCDTFCUAMCDTADCffff970eCBYD/4+JJJBhJJJJBBGQbDBAVAOCLFGObD1DDNADCI6MBAEHRAQHWINAWASARYDBCDTFiDBASARCLFYDBCDTFiDBmASARCWFYDBCDTFiDBmuDBARCXFHRAWCLFHWAICEFGIAM6MBKKAVC/MBFHZAVYD+cEHhAVYD+gEHoAVHRCBHdCBHWCBHaCEHcINARHxAEAWCX2FGqCWFGlYDBHDAqYDBHkABAaCX2FGRCLFAqCLFGyYDBG8abDBARAkbDBARCWFADbDBApAWFCE86BBAZADbDWAZA8abDLAZAkbDBAQAWCDTFCBbDBCIHeDNAdtMBAxHRINDNARYDBGIADsMBAIAksMBAIA8asMBAZAeCDTFAIbDBAeCEFHeKARCLFHRAdCUFGdMBKKAXAkCDTFGRARYDBCUFbDBAXA8aCDTFGRARYDBCUFbDBAXADCDTFGRARYDBCUFbDBAoAhAqYDBCDTGIFYDBCDTFGkHRAKAIFGDYDBGdHIDNAdtMBDNINARYDBAWsMEARCLFHRAICUFGItMDXBKKARAdCDTAkFC98FYDBbDBADADYDBCUFbDBKAoAhAyYDBCDTGIFYDBCDTFGkHRAKAIFGDYDBGdHIDNAdtMBDNINARYDBAWsMEARCLFHRAICUFGIMBXDKKARAdCDTAkFC98FYDBbDBADADYDBCUFbDBKDNAKAlYDBCDTGRFGDYDBGdtMBAoAhARFYDBCDTFGkHRAdHIDNINARYDBAWsMEARCLFHRAICUFGIMBXDKKARAdCDTAkFC98FYDBbDBADADYDBCUFbDBKDNDNAetMBCUHWjBBBBH3CBHRINASAZARCDTFYDBCDTGIFGdiDBH5AdALCBARCEFGkARCS0eCDTFiDBALAXAIFYDBGRCWARCW6eCDTFC/EBFiDBmG8euDBDNAKAIFYDBGdtMBA8eA5+TH8eAoAhAIFYDBCDTFHRAdCDTHIINAQARYDBGdCDTFGDA8eADiDBmG5uDBA5A3A3A59dGDeH3AdAWADeHWARCLFHRAIC98FGIMBKKAkHRAkAe9HMBKAWCU9HMEKAcAM9PMDINDNApAcFrBBMBAcHWXDKAMAcCEFGc9HMBXIKKAaCEFHaAeCZAeCZ6eHdAZHRAxHZAWCU9HMBKKAOCDTAVC+oEFFC98FHRDNINAOtMEARYDBCBYD/0+JJJBh+BJJJBBARC98FHRAOCUFHOXBKKAVC+QDF8kJJJJBK/iLEVUCUAICDTGVAICffffI0eGOCBYD/4+JJJBhJJJJBBHRALALYD9gGWCDTFARbDBALAWCEFbD9gABARbDBAOCBYD/4+JJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDLCUADCDTADCffffI0eCBYD/4+JJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDWABYDBCBAVZnJJJB8aADCI9uHdDNADtMBABYDBHOAEHLADHRINAOALYDBCDTFGVAVYDBCEFbDBALCLFHLARCUFGRMBKKDNAItMBABYDBHLABYDLHRCBHVAIHOINARAVbDBARCLFHRALYDBAVFHVALCLFHLAOCUFGOMBKKDNADCI6MBABYDLHRABYDWHVCBHLINAECWFYDBHOAECLFYDBHDARAEYDBCDTFGWAWYDBGWCEFbDBAVAWCDTFALbDBARADCDTFGDADYDBGDCEFbDBAVADCDTFALbDBARAOCDTFGOAOYDBGOCEFbDBAVAOCDTFALbDBAECXFHEALCEFGLAd6MBKKDNAItMBABYDLHEABYDBHLINAEAEYDBALYDB9rbDBALCLFHLAECLFHEAICUFGIMBKKKqBABAEADAIC+k1JJBZ+NJJJBKqBABAEADAIC+M+JJJBZ+NJJJBK9dEEUABCfEAICDTZnJJJBHLCBHIDNADtMBINDNALAEYDBCDTFGBYDBCU9HMBABAIbDBAICEFHIKAECLFHEADCUFGDMBKKAIK9TEIUCBCBYD/8+JJJBGEABCIFC98gFGBbD/8+JJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABK9TEIUCBCBYD/8+JJJBGEABCIFC98gFGBbD/8+JJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK9+EIUzBHEDNDNCBYD/8+JJJBGDAECZTGI9NMBCUHEADAI9rCffIFCZ4NBCUsMEKADHEKCBABAE9rCIFC98gCBYD/8+JJJBFGDbD/8+JJJBDNADzBCZTGE9NMBADAE9rCffIFCZ4NB8aKKXBABAEZ+ZJJJBK+BEEIUDNAB+8GDCl4GICfEgGLCfEsMBDNALMBDNABjBBBB9cMBAECBbDBABSKABjBBJ9fnAEZ+YJJJBHBAEAEYDBCNFbDBABSKAEAICfEgC+CUFbDBADCfff+D94gCJJJ/4Iv++HBKABK+gEBDNDNAECJE9IMBABjBBBUnHBDNAECfE9OMBAEC+BUFHEXDKABjBBBUnHBAECPDAECPD9IeC+C9+FHEXEKAEC+BU9KMBABjBBJXnHBDNAEC+b9+9MMBAEC/mBFHEXEKABjBBJXnHBAEC+299AEC+2999KeC/MEFHEKABAEClTCJJJ/8IF++nKK+ODDBCJWK/0EBBBBEBBBDBBBEBBBDBBBBBBBDBBBBBBBEBBBBBBB+L29Hz/69+9Kz/n/76z/RG97z/Z/O9Xz8j/b85z/+/U9Yz/B/K9hz+2/z9dz9E+L9Mz59a8kz+R/t3z+a+Zyz79ohz/J4++8++y+d9v8+BBBB9S+49+z8r+Hbz9m9m/m8+l/Z/O8+/8+pg89Q/X+j878r+Hq8++m+b/E87BBBBBBJzBBJzBBJz+e/v/n8++y+dSz9I/h/68+XD/r8+/H0838+/w+nOzBBBB+wv9o8+UF888+9I/h/68+9C9g/l89/N/M9M89/d8kO8+BBBBF+8Tz9M836zs+2azl/Zpzz818ez9E+LXz/u98f8+819e/68+BC/0dKXEBBBDBBBZwBB"),{}).then((function(t){(e=t.instance).exports.__wasm_call_ctors(),e.exports.meshopt_encodeVertexVersion(0),e.exports.meshopt_encodeIndexVersion(1)}));function r(e){if(!e)throw new Error("Assertion failed")}function n(t,i,r,n,a){var o=e.exports.sbrk,s=o(i),l=o(n*a),c=new Uint8Array(e.exports.memory.buffer);c.set(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),l);var u=t(s,i,l,n,a),d=new Uint8Array(u);return d.set(c.subarray(s,s+u)),o(s-o(0)),d}function a(e){for(var t=0,i=0;i<e.length;++i){var r=e[i];t=t<r?r:t}return t}function o(e,t){if(r(2==t||4==t),4==t)return new Uint32Array(e.buffer,e.byteOffset,e.byteLength/4);var i=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);return new Uint32Array(i)}function s(t,i,r,n,a,o){var s=e.exports.sbrk,l=s(r*n),c=s(r*o),u=new Uint8Array(e.exports.memory.buffer);u.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),c),t(l,r,n,a,c);var d=new Uint8Array(r*n);return d.set(u.subarray(l,l+r*n)),s(l-s(0)),d}}();var MeshoptDecoder=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var i,r="B9h79tEBBBE8fV9gBB9gVUUUUUEU9gIUUUB9gEUEU9gIUUUEUIKQBEEEDDDILLLVE9wEEEVIEBEOWEUEC+Q/IEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBEy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBDe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBIl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBLk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBOL79iv9rBRQ+x8yQDBK/qMEZU8jJJJJBCJ/EB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rADZ1JJJBHWCJ/ABAD9uC/wfBgGOCJDAOCJD6eHdAICEFHLCBHQDNINAQAE9PMEAdAEAQ9rAQAdFAE6eHKDNDNADtMBAKCSFGOC9wgHXAOCL4CIFCD4HMAWCJDFHpCBHSALHZINDNARAZ9rAM9PMBCBHLXIKAZAMFHLDNAXtMBCBHhCBHIINDNARAL9rCk9PMBCBHLXVKAWCJ/CBFAIFHODNDNDNDNDNAZAICO4FrBBAhCOg4CIgpLBEDIBKAO9CB83IBAOCWF9CB83IBXIKAOALrBLALrBBGoCO4GaAaCIsGae86BBAOCEFALCLFAaFGarBBAoCL4CIgGcAcCIsGce86BBAOCDFAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOCIFAaAcFGarBBAoCIgGoAoCIsGoe86BBAOCLFAaAoFGarBBALrBEGoCO4GcAcCIsGce86BBAOCVFAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOCOFAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOCRFAaAcFGarBBAoCIgGoAoCIsGoe86BBAOCWFAaAoFGarBBALrBDGoCO4GcAcCIsGce86BBAOCdFAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOCQFAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOCKFAaAcFGarBBAoCIgGoAoCIsGoe86BBAOCXFAaAoFGorBBALrBIGLCO4GaAaCIsGae86BBAOCMFAoAaFGorBBALCL4CIgGaAaCIsGae86BBAOCpFAoAaFGorBBALCD4CIgGaAaCIsGae86BBAOCSFAoAaFGOrBBALCIgGLALCIsGLe86BBAOALFHLXDKAOALrBWALrBBGoCL4GaAaCSsGae86BBAOCEFALCWFAaFGarBBAoCSgGoAoCSsGoe86BBAOCDFAaAoFGorBBALrBEGaCL4GcAcCSsGce86BBAOCIFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCLFAoAaFGorBBALrBDGaCL4GcAcCSsGce86BBAOCVFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCOFAoAaFGorBBALrBIGaCL4GcAcCSsGce86BBAOCRFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCWFAoAaFGorBBALrBLGaCL4GcAcCSsGce86BBAOCdFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCQFAoAaFGorBBALrBVGaCL4GcAcCSsGce86BBAOCKFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCXFAoAaFGorBBALrBOGaCL4GcAcCSsGce86BBAOCMFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCpFAoAaFGorBBALrBRGLCL4GaAaCSsGae86BBAOCSFAoAaFGOrBBALCSgGLALCSsGLe86BBAOALFHLXEKAOAL8pBB83BBAOCWFALCWF8pBB83BBALCZFHLKAhCDFHhAICZFGIAX6MBKKDNALMBCBHLXIKDNAKtMBAWASFrBBHhCBHOApHIINAIAWCJ/CBFAOFrBBGZCE4CBAZCEg9r7AhFGh86BBAIADFHIAOCEFGOAK9HMBKKApCEFHpALHZASCEFGSAD9HMBKKABAQAD2FAWCJDFAKAD2Z1JJJB8aAWAWCJDFAKCUFAD2FADZ1JJJB8aKAKCBALeAQFHQALMBKC9+HOXEKCBC99ARAL9rADCAADCA0eseHOKAVCJ/EBF8kJJJJBAOK+OoEZU8jJJJJBC/AE9rGV8kJJJJBC9+HODNAECI9uGRChFAL0MBCUHOAIrBBGWC/wEgC/gE9HMBAWCSgGdCE0MBAVC/ABFCfECJEZ+JJJJB8aAVCuF9CU83IBAVC8wF9CU83IBAVCYF9CU83IBAVCAF9CU83IBAVCkF9CU83IBAVCZF9CU83IBAV9CU83IWAV9CU83IBAIALFC9wFHQAICEFGWARFHKDNAEtMBCMCSAdCEseHXABHICBHdCBHMCBHpCBHLCBHOINDNAKAQ9NMBC9+HOXIKDNDNAWrBBGRC/vE0MBAVC/ABFARCL4CU7AOFCSgCITFGSYDLHZASYDBHhDNARCSgGSAX9PMBAVARCU7ALFCSgCDTFYDBAdASeHRAStHSDNDNADCD9HMBABAh87EBABCLFAR87EBABCDFAZ87EBXEKAIAhbDBAICWFARbDBAICLFAZbDBKAdASFHdAVC/ABFAOCITFGoARbDBAoAZbDLAVALCDTFARbDBAVC/ABFAOCEFCSgGOCITFGZAhbDBAZARbDLALASFHLAOCEFHOXDKDNDNASCSsMBAMASFASC987FCEFHMXEKAK8sBBGSCfEgHRDNDNASCU9MMBAKCEFHKXEKAK8sBEGSCfBgCRTARCfBgvHRDNASCU9MMBAKCDFHKXEKAK8sBDGSCfBgCpTARvHRDNASCU9MMBAKCIFHKXEKAK8sBIGSCfBgCxTARvHRDNASCU9MMBAKCLFHKXEKAKrBLC3TARvHRAKCVFHKKARCE4CBARCEg9r7AMFHMKDNDNADCD9HMBABAh87EBABCLFAM87EBABCDFAZ87EBXEKAIAhbDBAICWFAMbDBAICLFAZbDBKAVC/ABFAOCITFGRAMbDBARAZbDLAVALCDTFAMbDBAVC/ABFAOCEFCSgGOCITFGRAhbDBARAMbDLALCEFHLAOCEFHOXEKDNARCPE0MBAVALAQARCSgFrBBGSCL4GZ9rCSgCDTFYDBAdCEFGhAZeHRAVALAS9rCSgCDTFYDBAhAZtGoFGhASCSgGZeHSAZtHZDNDNADCD9HMBABAd87EBABCLFAS87EBABCDFAR87EBXEKAIAdbDBAICWFASbDBAICLFARbDBKAVALCDTFAdbDBAVC/ABFAOCITFGaARbDBAaAdbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALAoFCSgGLCDTFASbDBAVC/ABFAOCDFCSgGOCITFGRAdbDBARASbDLAOCEFHOALAZFHLAhAZFHdXEKAdCBAKrBBGaeGZARC/+EsGcFHRAaCSgHhDNDNAaCL4GoMBARCEFHSXEKARHSAVALAo9rCSgCDTFYDBHRKDNDNAhMBASCEFHdXEKASHdAVALAa9rCSgCDTFYDBHSKDNDNActMBAKCEFHaXEKAK8sBEGaCfEgHZDNDNAaCU9MMBAKCDFHaXEKAK8sBDGaCfBgCRTAZCfBgvHZDNAaCU9MMBAKCIFHaXEKAK8sBIGaCfBgCpTAZvHZDNAaCU9MMBAKCLFHaXEKAK8sBLGaCfBgCxTAZvHZDNAaCU9MMBAKCVFHaXEKAKCOFHaAKrBVC3TAZvHZKAZCE4CBAZCEg9r7AMFGMHZKDNDNAoCSsMBAaHcXEKAa8sBBGKCfEgHRDNDNAKCU9MMBAaCEFHcXEKAa8sBEGKCfBgCRTARCfBgvHRDNAKCU9MMBAaCDFHcXEKAa8sBDGKCfBgCpTARvHRDNAKCU9MMBAaCIFHcXEKAa8sBIGKCfBgCxTARvHRDNAKCU9MMBAaCLFHcXEKAaCVFHcAarBLC3TARvHRKARCE4CBARCEg9r7AMFGMHRKDNDNAhCSsMBAcHKXEKAc8sBBGKCfEgHSDNDNAKCU9MMBAcCEFHKXEKAc8sBEGKCfBgCRTASCfBgvHSDNAKCU9MMBAcCDFHKXEKAc8sBDGKCfBgCpTASvHSDNAKCU9MMBAcCIFHKXEKAc8sBIGKCfBgCxTASvHSDNAKCU9MMBAcCLFHKXEKAcCVFHKAcrBLC3TASvHSKASCE4CBASCEg9r7AMFGMHSKDNDNADCD9HMBABAZ87EBABCLFAS87EBABCDFAR87EBXEKAIAZbDBAICWFASbDBAICLFARbDBKAVC/ABFAOCITFGaARbDBAaAZbDLAVALCDTFAZbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCDFCSgCITFGRAZbDBARASbDLAVALAotAoCSsvFGLCSgCDTFASbDBALAhtAhCSsvFHLAOCIFHOKAWCEFHWABCOFHBAICXFHIAOCSgHOALCSgHLApCIFGpAE6MBKKCBC99AKAQseHOKAVC/AEF8kJJJJBAOK/tLEDU8jJJJJBCZ9rHVC9+HODNAECVFAL0MBCUHOAIrBBC/+EgC/QE9HMBAV9CB83IWAICEFHOAIALFC98FHIDNAEtMBDNADCDsMBINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKAVCWFALCEgCDTvGDALCD4CBALCE4CEg9r7ADYDBFGLbDBABALbDBABCLFHBAECUFGEMBXDKKINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKABALCD4CBALCE4CEg9r7AVCWFALCEgCDTvGLYDBFGD87EBALADbDBABCDFHBAECUFGEMBKKCBC99AOAIseHOKAOK+lVOEUE99DUD99EUD99DNDNADCL9HMBAEtMEINDNDNjBBBzjBBB+/ABCDFGD8sBB+yAB8sBBGI+yGL+L+TABCEFGV8sBBGO+yGR+L+TGWjBBBB9gGdeAWjBB/+9CAWAWnjBBBBAWAdeGQAQ+MGKAICU9KeALmGLALnAQAKAOCU9KeARmGQAQnmm+R+VGRnmGW+LjBBB9P9dtMBAW+oHIXEKCJJJJ94HIKADAI86BBDNDNjBBBzjBBB+/AQjBBBB9geAQARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKAVAD86BBDNDNjBBBzjBBB+/ALjBBBB9geALARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKABAD86BBABCLFHBAECUFGEMBXDKKAEtMBINDNDNjBBBzjBBB+/ABCLFGD8uEB+yAB8uEBGI+yGL+L+TABCDFGV8uEBGO+yGR+L+TGWjBBBB9gGdeAWjB/+fsAWAWnjBBBBAWAdeGQAQ+MGKAICU9KeALmGLALnAQAKAOCU9KeARmGQAQnmm+R+VGRnmGW+LjBBB9P9dtMBAW+oHIXEKCJJJJ94HIKADAI87EBDNDNjBBBzjBBB+/AQjBBBB9geAQARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKAVAD87EBDNDNjBBBzjBBB+/ALjBBBB9geALARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKABAD87EBABCWFHBAECUFGEMBKKK/SILIUI99IUE99DNAEtMBCBHIABHLINDNDNj/zL81zALCOF8uEBGVCIv+y+VGOAL8uEB+ynGRjB/+fsnjBBBzjBBB+/ARjBBBB9gemGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKALCLF8uEBHQALCDF8uEBHKABAVCEFCIgAIvCETFAd87EBDNDNAOAK+ynGWjB/+fsnjBBBzjBBB+/AWjBBBB9gemGX+LjBBB9P9dtMBAX+oHKXEKCJJJJ94HKKABAVCDFCIgAIvCETFAK87EBDNDNAOAQ+ynGOjB/+fsnjBBBzjBBB+/AOjBBBB9gemGX+LjBBB9P9dtMBAX+oHQXEKCJJJJ94HQKABAVCUFCIgAIvCETFAQ87EBDNDNjBBJzARARn+TAWAWn+TAOAOn+TGRjBBBBARjBBBB9ge+RjB/+fsnjBBBzmGR+LjBBB9P9dtMBAR+oHQXEKCJJJJ94HQKABAVCIgAIvCETFAQ87EBALCWFHLAICLFHIAECUFGEMBKKK6BDNADCD4AE2GEtMBINABABYDBGDCWTCW91+yADCk91ClTCJJJ/8IF++nuDBABCLFHBAECUFGEMBKKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABKKKEBCJWKLZ9kBB";WebAssembly.validate(e)&&(r="B9h79tEBBBE5V9gBB9gVUUUUUEU9gIUUUB9gDUUB9gEUEUIMXBBEBEEDIDIDLLVE9wEEEVIEBEOWEUEC+Q/aEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBDy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBLe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBOk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBWl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBQL79iv9rBKQ/j6XLBZIK9+EVU8jJJJJBCZ9rHBCBHEINCBHDCBHIINABCWFADFAICJUAEAD4CEgGLe86BBAIALFHIADCEFGDCW9HMBKAEC+Q+YJJBFAI86BBAECITC+Q1JJBFAB8pIW83IBAECEFGECJD9HMBKK1HLSUD97EUO978jJJJJBCJ/KB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rAD/8QBBCJ/ABAD9uC/wfBgGOCJDAOCJD6eHWAICEFHOCBHdDNINAdAE9PMEAWAEAd9rAdAWFAE6eHQDNDNADtMBAQCSFGLC9wgGKCI2HXAKCETHMALCL4CIFCD4HpCBHSINAOHZCBHhDNINDNARAZ9rAp9PMBCBHOXVKAVCJ/CBFAhAK2FHoAZApFHOCBHIDNAKC/AB6MBARAO9rC/gB6MBCBHLINAoALFHIDNDNDNDNDNAZALCO4FrBBGaCIgpLBEDIBKAICBPhPKLBXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAIAOPBBBPKLBAOCZFHOKDNDNDNDNDNAaCD4CIgpLBEDIBKAICBPhPKLZXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLZAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLZAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAIAOPBBBPKLZAOCZFHOKDNDNDNDNDNAaCL4CIgpLBEDIBKAICBPhPKLAXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLAAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLAAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAIAOPBBBPKLAAOCZFHOKDNDNDNDNDNAaCO4pLBEDIBKAICBPhPKL8wXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBAaC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKL8wAOCLFAlPqBFAaC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBAaC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKL8wAOCWFAlPqBFAaC+Q+YJJBFrBBFHOXEKAIAOPBBBPKL8wAOCZFHOKALC/ABFHIALCJEFAK0MEAIHLARAO9rC/fB0MBKKDNAIAK9PMBAICI4HLINDNARAO9rCk9PMBCBHOXRKAoAIFHaDNDNDNDNDNAZAICO4FrBBALCOg4CIgpLBEDIBKAaCBPhPKLBXIKAaAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAaAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAaAOPBBBPKLBAOCZFHOKALCDFHLAICZFGIAK6MBKKDNAOtMBAOHZAhCEFGhCLsMDXEKKCBHOXIKDNAKtMBAVCJDFASFHIAVASFPBDBHlCBHaINAIAVCJ/CBFAaFGLPBLBGxCEP9tAxCEPSGcP9OP9hP9RGxALAKFPBLBGkCEP9tAkAcP9OP9hP9RGkPMBZEhDoIaLcVxOqRlGyALAMFPBLBG8aCEP9tA8aAcP9OP9hP9RG8aALAXFPBLBGeCEP9tAeAcP9OP9hP9RGePMBZEhDoIaLcVxOqRlG3PMBEZhDIoaLVcxORqlGcAcPMBEDIBEDIBEDIBEDIAlP9uGlPeBbDBAIADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFGLAlAyA3PMWdkyQK8aeXM35pS8e8fGcAcPMBEDIBEDIBEDIBEDIP9uGlPeBbDBALADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFGLAlAxAkPMWkdyQ8aKeX3M5p8eS8fGxA8aAePMWkdyQ8aKeX3M5p8eS8fGkPMBEZhDIoaLVcxORqlGcAcPMBEDIBEDIBEDIBEDIP9uGlPeBbDBALADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFGLAlAxAkPMWdkyQK8aeXM35pS8e8fGcAcPMBEDIBEDIBEDIBEDIP9uGlPeBbDBALADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFHIAaCZFGaAK6MBKKASCLFGSAD6MBKKABAdAD2FAVCJDFAQAD2/8QBBAVAVCJDFAQCUFAD2FAD/8QBBKAQCBAOeAdFHdAOMBKC9+HOXEKCBC99ARAO9rADCAADCA0eseHOKAVCJ/KBF8kJJJJBAOKWBZ+BJJJBK+KoEZU8jJJJJBC/AE9rGV8kJJJJBC9+HODNAECI9uGRChFAL0MBCUHOAIrBBGWC/wEgC/gE9HMBAWCSgGdCE0MBAVC/ABFCfECJE/8KBAVCuF9CU83IBAVC8wF9CU83IBAVCYF9CU83IBAVCAF9CU83IBAVCkF9CU83IBAVCZF9CU83IBAV9CU83IWAV9CU83IBAIALFC9wFHQAICEFGWARFHKDNAEtMBCMCSAdCEseHXABHICBHdCBHMCBHpCBHLCBHOINDNAKAQ9NMBC9+HOXIKDNDNAWrBBGRC/vE0MBAVC/ABFARCL4CU7AOFCSgCITFGSYDLHZASYDBHhDNARCSgGSAX9PMBAVARCU7ALFCSgCDTFYDBAdASeHRAStHSDNDNADCD9HMBABAh87EBABCLFAR87EBABCDFAZ87EBXEKAIAhbDBAICWFARbDBAICLFAZbDBKAdASFHdAVC/ABFAOCITFGoARbDBAoAZbDLAVALCDTFARbDBAVC/ABFAOCEFCSgGOCITFGZAhbDBAZARbDLALASFHLAOCEFHOXDKDNDNASCSsMBAMASFASC987FCEFHMXEKAK8sBBGSCfEgHRDNDNASCU9MMBAKCEFHKXEKAK8sBEGSCfBgCRTARCfBgvHRDNASCU9MMBAKCDFHKXEKAK8sBDGSCfBgCpTARvHRDNASCU9MMBAKCIFHKXEKAK8sBIGSCfBgCxTARvHRDNASCU9MMBAKCLFHKXEKAKrBLC3TARvHRAKCVFHKKARCE4CBARCEg9r7AMFHMKDNDNADCD9HMBABAh87EBABCLFAM87EBABCDFAZ87EBXEKAIAhbDBAICWFAMbDBAICLFAZbDBKAVC/ABFAOCITFGRAMbDBARAZbDLAVALCDTFAMbDBAVC/ABFAOCEFCSgGOCITFGRAhbDBARAMbDLALCEFHLAOCEFHOXEKDNARCPE0MBAVALAQARCSgFrBBGSCL4GZ9rCSgCDTFYDBAdCEFGhAZeHRAVALAS9rCSgCDTFYDBAhAZtGoFGhASCSgGZeHSAZtHZDNDNADCD9HMBABAd87EBABCLFAS87EBABCDFAR87EBXEKAIAdbDBAICWFASbDBAICLFARbDBKAVALCDTFAdbDBAVC/ABFAOCITFGaARbDBAaAdbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALAoFCSgGLCDTFASbDBAVC/ABFAOCDFCSgGOCITFGRAdbDBARASbDLAOCEFHOALAZFHLAhAZFHdXEKAdCBAKrBBGaeGZARC/+EsGcFHRAaCSgHhDNDNAaCL4GoMBARCEFHSXEKARHSAVALAo9rCSgCDTFYDBHRKDNDNAhMBASCEFHdXEKASHdAVALAa9rCSgCDTFYDBHSKDNDNActMBAKCEFHaXEKAK8sBEGaCfEgHZDNDNAaCU9MMBAKCDFHaXEKAK8sBDGaCfBgCRTAZCfBgvHZDNAaCU9MMBAKCIFHaXEKAK8sBIGaCfBgCpTAZvHZDNAaCU9MMBAKCLFHaXEKAK8sBLGaCfBgCxTAZvHZDNAaCU9MMBAKCVFHaXEKAKCOFHaAKrBVC3TAZvHZKAZCE4CBAZCEg9r7AMFGMHZKDNDNAoCSsMBAaHcXEKAa8sBBGKCfEgHRDNDNAKCU9MMBAaCEFHcXEKAa8sBEGKCfBgCRTARCfBgvHRDNAKCU9MMBAaCDFHcXEKAa8sBDGKCfBgCpTARvHRDNAKCU9MMBAaCIFHcXEKAa8sBIGKCfBgCxTARvHRDNAKCU9MMBAaCLFHcXEKAaCVFHcAarBLC3TARvHRKARCE4CBARCEg9r7AMFGMHRKDNDNAhCSsMBAcHKXEKAc8sBBGKCfEgHSDNDNAKCU9MMBAcCEFHKXEKAc8sBEGKCfBgCRTASCfBgvHSDNAKCU9MMBAcCDFHKXEKAc8sBDGKCfBgCpTASvHSDNAKCU9MMBAcCIFHKXEKAc8sBIGKCfBgCxTASvHSDNAKCU9MMBAcCLFHKXEKAcCVFHKAcrBLC3TASvHSKASCE4CBASCEg9r7AMFGMHSKDNDNADCD9HMBABAZ87EBABCLFAS87EBABCDFAR87EBXEKAIAZbDBAICWFASbDBAICLFARbDBKAVC/ABFAOCITFGaARbDBAaAZbDLAVALCDTFAZbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCDFCSgCITFGRAZbDBARASbDLAVALAotAoCSsvFGLCSgCDTFASbDBALAhtAhCSsvFHLAOCIFHOKAWCEFHWABCOFHBAICXFHIAOCSgHOALCSgHLApCIFGpAE6MBKKCBC99AKAQseHOKAVC/AEF8kJJJJBAOK/tLEDU8jJJJJBCZ9rHVC9+HODNAECVFAL0MBCUHOAIrBBC/+EgC/QE9HMBAV9CB83IWAICEFHOAIALFC98FHIDNAEtMBDNADCDsMBINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKAVCWFALCEgCDTvGDALCD4CBALCE4CEg9r7ADYDBFGLbDBABALbDBABCLFHBAECUFGEMBXDKKINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKABALCD4CBALCE4CEg9r7AVCWFALCEgCDTvGLYDBFGD87EBALADbDBABCDFHBAECUFGEMBKKCBC99AOAIseHOKAOK/xVDIUO978jJJJJBCA9rGI8kJJJJBDNDNADCL9HMBDNAEC98gGLtMBABHDCBHVINADADPBBBGOCkP+rECkP+sEP/6EGRAOCWP+rECkP+sEP/6EARP/gEAOCZP+rECkP+sEP/6EGWP/gEP/kEP/lEGdCBPhP+2EGQARCJJJJ94PhGKP9OP9RP/kEGRjBB/+9CPaARARP/mEAdAdP/mEAWAQAWAKP9OP9RP/kEGRARP/mEP/kEP/kEP/jEP/nEGWP/mEjBBN0PaGQP/kECfEPhP9OAOCJJJ94PhP9OP9QARAWP/mEAQP/kECWP+rECJ/+IPhP9OP9QAdAWP/mEAQP/kECZP+rECJJ/8RPhP9OP9QPKBBADCZFHDAVCLFGVAL6MBKKALAE9PMEAIAECIgGVCDTGDvCBCZAD9r/8KBAIABALCDTFGLAD/8QBBDNAVtMBAIAIPBLBGOCkP+rECkP+sEP/6EGRAOCWP+rECkP+sEP/6EARP/gEAOCZP+rECkP+sEP/6EGWP/gEP/kEP/lEGdCBPhP+2EGQARCJJJJ94PhGKP9OP9RP/kEGRjBB/+9CPaARARP/mEAdAdP/mEAWAQAWAKP9OP9RP/kEGRARP/mEP/kEP/kEP/jEP/nEGWP/mEjBBN0PaGQP/kECfEPhP9OAOCJJJ94PhP9OP9QARAWP/mEAQP/kECWP+rECJ/+IPhP9OP9QAdAWP/mEAQP/kECZP+rECJJ/8RPhP9OP9QPKLBKALAIAD/8QBBXEKABAEC98gGDZ+HJJJBADAE9PMBAIAECIgGLCITGVFCBCAAV9r/8KBAIABADCITFGDAV/8QBBAIALZ+HJJJBADAIAV/8QBBKAICAF8kJJJJBK+yIDDUR97DNAEtMBCBHDINABCZFGIAIPBBBGLCBPhGVCJJ98P3ECJJ98P3IGOP9OABPBBBGRALPMLVORXMpScxql358e8fCffEPhP9OP/6EARALPMBEDIWdQKZhoaky8aeGLCZP+sEP/6EGWP/gEALCZP+rECZP+sEP/6EGdP/gEP/kEP/lEGLjB/+fsPaAdALAVP+2EGVAdCJJJJ94PhGQP9OP9RP/kEGdAdP/mEALALP/mEAWAVAWAQP9OP9RP/kEGLALP/mEP/kEP/kEP/jEP/nEGWP/mEjBBN0PaGVP/kECZP+rEAdAWP/mEAVP/kECffIPhP9OP9QGdALAWP/mEAVP/kECUPSCBPlDCBPlICBPlOCBPlRCBPlQCBPlKCBPlpCBPlSP9OGLPMWdkyQK8aeXM35pS8e8fP9QPKBBABARAOP9OAdALPMBEZhDIoaLVcxORqlP9QPKBBABCAFHBADCLFGDAE6MBKKK94EIU8jJJJJBCA9rGI8kJJJJBABAEC98gGLZ+JJJJBDNALAE9PMBAIAECIgGVCITGEFCBCAAE9r/8KBAIABALCITFGBAE/8QBBAIAVZ+JJJJBABAIAE/8QBBKAICAF8kJJJJBK/hILDUE97EUV978jJJJJBCZ9rHDDNAEtMBCBHIINADABPBBBGLABCZFGVPBBBGOPMLVORXMpScxql358e8fGRCZP+sEGWCLP+rEPKLBABjBBJzPaj/zL81zPaAWCIPhP9QP/6EP/nEGWALAOPMBEDIWdQKZhoaky8aeGLCZP+rECZP+sEP/6EP/mEGOAOP/mEAWALCZP+sEP/6EP/mEGdAdP/mEAWARCZP+rECZP+sEP/6EP/mEGRARP/mEP/kEP/kEP/lECBPhP+4EP/jEjB/+fsPaGWP/mEjBBN0PaGLP/kECffIPhGQP9OAdAWP/mEALP/kECZP+rEP9QGdARAWP/mEALP/kECZP+rEAOAWP/mEALP/kEAQP9OP9QGWPMBEZhDIoaLVcxORqlGLP5BADPBLBPeB+t+J83IBABCWFALP5EADPBLBPeE+t+J83IBAVAdAWPMWdkyQK8aeXM35pS8e8fGWP5BADPBLBPeD+t+J83IBABCkFAWP5EADPBLBPeI+t+J83IBABCAFHBAICLFGIAE6MBKKK/3EDIUE978jJJJJBC/AB9rHIDNADCD4AE2GLC98gGVtMBCBHDABHEINAEAEPBBBGOCWP+rECWP+sEP/6EAOCkP+sEClP+rECJJJ/8IPhP+uEP/mEPKBBAECZFHEADCLFGDAV6MBKKDNAVAL9PMBAIALCIgGDCDTGEvCBC/ABAE9r/8KBAIABAVCDTFGVAE/8QBBDNADtMBAIAIPBLBGOCWP+rECWP+sEP/6EAOCkP+sEClP+rECJJJ/8IPhP+uEP/mEPKLBKAVAIAE/8QBBKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIKKKEBCJWKLZ9tBB");var n=WebAssembly.instantiate(function(e){for(var i=new Uint8Array(e.length),r=0;r<e.length;++r){var n=e.charCodeAt(r);i[r]=n>96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}var a=0;for(r=0;r<e.length;++r)i[a++]=i[r]<60?t[i[r]]:64*(i[r]-60)+i[++r];return i.buffer.slice(0,a)}(r),{}).then((function(e){(i=e.instance).exports.__wasm_call_ctors()}));function a(e,t,r,n,a,o){var s=i.exports.sbrk,l=r+3&-4,c=s(l*n),u=s(a.length),d=new Uint8Array(i.exports.memory.buffer);d.set(a,u);var h=e(c,r,n,u,a.length);if(0==h&&o&&o(c,l,n),t.set(d.subarray(c,c+r*n)),s(c-s(0)),0!=h)throw new Error("Malformed buffer data: "+h)}var o={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},s={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:n,supported:!0,decodeVertexBuffer:function(e,t,r,n,s){a(i.exports.meshopt_decodeVertexBuffer,e,t,r,n,i.exports[o[s]])},decodeIndexBuffer:function(e,t,r,n){a(i.exports.meshopt_decodeIndexBuffer,e,t,r,n)},decodeIndexSequence:function(e,t,r,n){a(i.exports.meshopt_decodeIndexSequence,e,t,r,n)},decodeGltfBuffer:function(e,t,r,n,l,c){a(i.exports[s[l]],e,t,r,n,i.exports[o[c]])}}}();function GltfBufferViewLoader(e){var t,i,r,n,a=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,o=e.gltf,s=e.bufferViewId,l=e.gltfResource,c=e.baseResource,u=e.cacheKey,d=o.bufferViews[s],h=d.buffer,p=d.byteOffset,f=d.byteLength,m=!1;if(hasExtension(d,"EXT_meshopt_compression")){var g=d.extensions.EXT_meshopt_compression;h=g.buffer,p=defaultValue(g.byteOffset,0),f=g.byteLength,m=!0,t=g.byteStride,i=g.count,r=g.mode,n=defaultValue(g.filter,"NONE")}var _=o.buffers[h];this._hasMeshopt=m,this._meshoptByteStride=t,this._meshoptCount=i,this._meshoptMode=r,this._meshoptFilter=n,this._resourceCache=a,this._gltfResource=l,this._baseResource=c,this._buffer=_,this._bufferId=h,this._byteOffset=p,this._byteLength=f,this._cacheKey=u,this._bufferLoader=void 0,this._typedArray=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function getBufferLoader(e){var t=e._resourceCache,i=e._buffer;if(defined(i.uri)){var r=e._baseResource.getDerivedResource({url:i.uri});return t.loadExternalBuffer({resource:r})}return t.loadEmbeddedBuffer({parentResource:e._gltfResource,bufferId:e._bufferId})}function GltfDracoLoader(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltf,r=e.draco,n=e.gltfResource,a=e.baseResource,o=e.cacheKey;this._resourceCache=t,this._gltfResource=n,this._baseResource=a,this._gltf=i,this._draco=r,this._cacheKey=o,this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodePromise=void 0,this._decodedData=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function handleError$6(e,t){e.unload(),e._state=ResourceLoaderState$1.FAILED;e._promise.reject(e.getError("Failed to load Draco",t))}function GltfImageLoader(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltf,r=e.imageId,n=e.gltfResource,a=e.baseResource,o=e.cacheKey,s=i.images[r],l=s.bufferView,c=s.uri;this._resourceCache=t,this._gltfResource=n,this._baseResource=a,this._gltf=i,this._bufferViewId=l,this._uri=c,this._cacheKey=o,this._bufferViewLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function getImageAndMipLevels(e){var t;return Array.isArray(e)&&(t=e.slice(1,e.length).map((function(e){return e.bufferView})),e=e[0]),{image:e,mipLevels:t}}function loadFromBufferView$2(e){var t=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});e._bufferViewLoader=t,e._state=ResourceLoaderState$1.LOADING,t.promise.then((function(){if(!e.isDestroyed())return loadImageFromBufferTypedArray(t.typedArray).then((function(t){if(!e.isDestroyed()){var i=getImageAndMipLevels(t);e.unload(),e._image=i.image,e._mipLevels=i.mipLevels,e._state=ResourceLoaderState$1.READY,e._promise.resolve(e)}}))})).otherwise((function(t){e.isDestroyed()||handleError$5(e,t,"Failed to load embedded image")}))}function loadFromUri$1(e){var t=e._baseResource,i=e._uri,r=t.getDerivedResource({url:i});e._state=ResourceLoaderState$1.LOADING,loadImageFromUri(r).then((function(t){if(!e.isDestroyed()){var i=getImageAndMipLevels(t);e.unload(),e._image=i.image,e._mipLevels=i.mipLevels,e._state=ResourceLoaderState$1.READY,e._promise.resolve(e)}})).otherwise((function(t){e.isDestroyed()||handleError$5(e,t,"Failed to load image: "+i)}))}function handleError$5(e,t,i){e.unload(),e._state=ResourceLoaderState$1.FAILED,e._promise.reject(e.getError(i,t))}function getMimeTypeFromTypedArray(e){var t=e.subarray(0,2),i=e.subarray(0,4),r=e.subarray(8,12);if(255===t[0]&&216===t[1])return"image/jpeg";if(137===t[0]&&80===t[1])return"image/png";if(171===t[0]&&75===t[1])return"image/ktx2";if(82===i[0]&&73===i[1]&&70===i[2]&&70===i[3]&&87===r[0]&&69===r[1]&&66===r[2]&&80===r[3])return"image/webp";throw new RuntimeError("Image format is not recognized")}function loadImageFromBufferTypedArray(e){var t=getMimeTypeFromTypedArray(e);return"image/ktx2"===t?loadKTX2(new Uint8Array(e)):GltfImageLoader._loadImageFromTypedArray({uint8Array:e,format:t,flipY:!1,skipColorSpaceConversion:!0})}defined(Object.create)&&(GltfBufferViewLoader.prototype=Object.create(ResourceLoader.prototype),GltfBufferViewLoader.prototype.constructor=GltfBufferViewLoader),Object.defineProperties(GltfBufferViewLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}}),GltfBufferViewLoader.prototype.load=function(){var e=getBufferLoader(this);this._bufferLoader=e,this._state=ResourceLoaderState$1.LOADING;var t=this;e.promise.then((function(){if(!t.isDestroyed()){var i=e.typedArray,r=new Uint8Array(i.buffer,i.byteOffset+t._byteOffset,t._byteLength);t.unload(),t._typedArray=r,t._hasMeshopt?t._state=ResourceLoaderState$1.PROCESSING:(t._state=ResourceLoaderState$1.READY,t._promise.resolve(t))}})).otherwise((function(e){if(!t.isDestroyed()){t.unload(),t._state=ResourceLoaderState$1.FAILED;t._promise.reject(t.getError("Failed to load buffer view",e))}}))},GltfBufferViewLoader.prototype.process=function(e){if(this._hasMeshopt&&defined(this._typedArray)&&this._state===ResourceLoaderState$1.PROCESSING){var t=this._meshoptCount,i=this._meshoptByteStride,r=new Uint8Array(t*i);MeshoptDecoder.decodeGltfBuffer(r,t,i,this._typedArray,this._meshoptMode,this._meshoptFilter),this._typedArray=r,this._state=ResourceLoaderState$1.READY,this._promise.resolve(this)}},GltfBufferViewLoader.prototype.unload=function(){defined(this._bufferLoader)&&this._resourceCache.unload(this._bufferLoader),this._bufferLoader=void 0,this._typedArray=void 0},defined(Object.create)&&(GltfDracoLoader.prototype=Object.create(ResourceLoader.prototype),GltfDracoLoader.prototype.constructor=GltfDracoLoader),Object.defineProperties(GltfDracoLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},decodedData:{get:function(){return this._decodedData}}}),GltfDracoLoader.prototype.load=function(){var e=this._resourceCache.loadBufferView({gltf:this._gltf,bufferViewId:this._draco.bufferView,gltfResource:this._gltfResource,baseResource:this._baseResource});this._bufferViewLoader=e,this._state=ResourceLoaderState$1.LOADING;var t=this;e.promise.then((function(){t.isDestroyed()||(t._bufferViewTypedArray=e.typedArray,t._state=ResourceLoaderState$1.PROCESSING)})).otherwise((function(e){t.isDestroyed()||handleError$6(t,e)}))},GltfDracoLoader.prototype.process=function(e){if(defined(this._bufferViewTypedArray)&&!defined(this._decodePromise)){var t=this._draco,i=this._gltf.bufferViews[t.bufferView],r=t.attributes,n={array:new Uint8Array(this._bufferViewTypedArray),bufferView:i,compressedAttributes:r,dequantizeInShader:!0},a=DracoLoader.decodeBufferView(n);if(defined(a)){var o=this;this._decodePromise=a.then((function(e){o.isDestroyed()||(o.unload(),o._decodedData={indices:e.indexArray,vertexAttributes:e.attributeData},o._state=ResourceLoaderState$1.READY,o._promise.resolve(o))})).otherwise((function(e){o.isDestroyed()||handleError$6(o,e)}))}}},GltfDracoLoader.prototype.unload=function(){defined(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodedData=void 0,this._gltf=void 0},defined(Object.create)&&(GltfImageLoader.prototype=Object.create(ResourceLoader.prototype),GltfImageLoader.prototype.constructor=GltfImageLoader),Object.defineProperties(GltfImageLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},image:{get:function(){return this._image}},mipLevels:{get:function(){return this._mipLevels}}}),GltfImageLoader.prototype.load=function(){defined(this._bufferViewId)?loadFromBufferView$2(this):loadFromUri$1(this)};var ktx2Regex$1=/(^data:image\/ktx2)|(\.ktx2$)/i;function loadImageFromUri(e){var t=e.url;return ktx2Regex$1.test(t)?loadKTX2(e):e.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0})}function GltfIndexBufferLoader(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltf,r=e.accessorId,n=e.gltfResource,a=e.baseResource,o=e.draco,s=e.cacheKey,l=defaultValue(e.asynchronous,!0),c=defaultValue(e.loadAsTypedArray,!1),u=i.accessors[r].componentType;this._resourceCache=t,this._gltfResource=n,this._baseResource=a,this._gltf=i,this._accessorId=r,this._indexDatatype=u,this._draco=o,this._cacheKey=s,this._asynchronous=l,this._loadAsTypedArray=c,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function loadFromDraco$1(e){var t=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});e._dracoLoader=t,e._state=ResourceLoaderState$1.LOADING,t.promise.then((function(){if(!e.isDestroyed()){var i=t.decodedData.indices.typedArray;e._typedArray=i,e._indexDatatype=ComponentDatatype$1.fromTypedArray(i),e._state=ResourceLoaderState$1.PROCESSING}})).otherwise((function(t){e.isDestroyed()||handleError$4(e,t)}))}function loadFromBufferView$1(e){var t=e._gltf,i=e._accessorId,r=t.accessors[i].bufferView,n=e._resourceCache.loadBufferView({gltf:t,bufferViewId:r,gltfResource:e._gltfResource,baseResource:e._baseResource});e._state=ResourceLoaderState$1.LOADING,e._bufferViewLoader=n,n.promise.then((function(){if(!e.isDestroyed()){var t=n.typedArray;e._typedArray=createIndicesTypedArray(e,t),e._state=ResourceLoaderState$1.PROCESSING}})).otherwise((function(t){e.isDestroyed()||handleError$4(e,t)}))}function createIndicesTypedArray(e,t){var i,r=e._gltf,n=e._accessorId,a=r.accessors[n],o=a.count,s=a.componentType,l=t.buffer,c=t.byteOffset+a.byteOffset;return s===IndexDatatype$1.UNSIGNED_BYTE?i=new Uint8Array(l,c,o):s===IndexDatatype$1.UNSIGNED_SHORT?i=new Uint16Array(l,c,o):s===IndexDatatype$1.UNSIGNED_INT&&(i=new Uint32Array(l,c,o)),i}function handleError$4(e,t){e.unload(),e._state=ResourceLoaderState$1.FAILED;t=e.getError("Failed to load index buffer",t),e._promise.reject(t)}function CreateIndexBufferJob(){this.typedArray=void 0,this.indexDatatype=void 0,this.context=void 0,this.buffer=void 0}function createIndexBuffer(e,t,i){var r=Buffer$1.createIndexBuffer({typedArray:e,context:i,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:t});return r.vertexArrayDestroyable=!1,r}GltfImageLoader.prototype.unload=function(){defined(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._uri=void 0,this._image=void 0,this._mipLevels=void 0,this._gltf=void 0},GltfImageLoader._loadImageFromTypedArray=loadImageFromTypedArray,defined(Object.create)&&(GltfIndexBufferLoader.prototype=Object.create(ResourceLoader.prototype),GltfIndexBufferLoader.prototype.constructor=GltfIndexBufferLoader),Object.defineProperties(GltfIndexBufferLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},indexDatatype:{get:function(){return this._indexDatatype}}}),GltfIndexBufferLoader.prototype.load=function(){defined(this._draco)?loadFromDraco$1(this):loadFromBufferView$1(this)},CreateIndexBufferJob.prototype.set=function(e,t,i){this.typedArray=e,this.indexDatatype=t,this.context=i},CreateIndexBufferJob.prototype.execute=function(){this.buffer=createIndexBuffer(this.typedArray,this.indexDatatype,this.context)};var scratchIndexBufferJob=new CreateIndexBufferJob;function removePipelineExtras(e){return ForEach.shader(e,(function(e){removeExtras(e)})),ForEach.buffer(e,(function(e){removeExtras(e)})),ForEach.image(e,(function(e){removeExtras(e)})),removeExtras(e),e}function removeExtras(e){defined(e.extras)&&(defined(e.extras._pipeline)&&delete e.extras._pipeline,0===Object.keys(e.extras).length&&delete e.extras)}function GltfJsonLoader(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltfResource,r=e.baseResource,n=e.typedArray,a=e.gltfJson,o=e.cacheKey;this._resourceCache=t,this._gltfResource=i,this._baseResource=r,this._typedArray=n,this._gltfJson=a,this._cacheKey=o,this._gltf=void 0,this._bufferLoaders=[],this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function loadFromUri(e){return e._fetchGltf().then((function(t){if(!e.isDestroyed()){var i=new Uint8Array(t);return processGltfTypedArray(e,i)}}))}function handleError$3(e,t){e.unload(),e._state=ResourceLoaderState$1.FAILED;var i="Failed to load glTF: "+e._gltfResource.url;e._promise.reject(e.getError(i,t))}function upgradeVersion(e,t){if("2.0"===t.asset.version)return when.resolve();var i=[];return ForEach.buffer(t,(function(t){if(!defined(t.extras._pipeline.source)&&defined(t.uri)){var r=e._baseResource.getDerivedResource({url:t.uri}),n=e._resourceCache.loadExternalBuffer({resource:r});e._bufferLoaders.push(n),i.push(n.promise.then((function(e){t.extras._pipeline.source=e.typedArray})))}})),when.all(i).then((function(){updateVersion(t)}))}function decodeDataUris(e){var t=[];return ForEach.buffer(e,(function(e){var i=e.uri;!defined(e.extras._pipeline.source)&&defined(i)&&isDataUri(i)&&(delete e.uri,t.push(Resource.fetchArrayBuffer(i).then((function(t){e.extras._pipeline.source=new Uint8Array(t)}))))})),when.all(t)}function loadEmbeddedBuffers(e,t){var i=[];return ForEach.buffer(t,(function(t,r){var n=t.extras._pipeline.source;if(defined(n)&&!defined(t.uri)){var a=e._resourceCache.loadEmbeddedBuffer({parentResource:e._gltfResource,bufferId:r,typedArray:n});e._bufferLoaders.push(a),i.push(a.promise)}})),when.all(i)}function processGltfJson(e,t){return addPipelineExtras(t),decodeDataUris(t).then((function(){return upgradeVersion(e,t).then((function(){return addDefaults(t),loadEmbeddedBuffers(e,t).then((function(){return removePipelineExtras(t),t}))}))}))}function processGltfTypedArray(e,t){return processGltfJson(e,"glTF"===getMagic(t)?parseGlb(t):getJsonFromTypedArray(t))}GltfIndexBufferLoader.prototype.process=function(e){if(this._state!==ResourceLoaderState$1.READY){var t=this._typedArray,i=this._indexDatatype;if(defined(this._dracoLoader)&&this._dracoLoader.process(e),defined(this._bufferViewLoader)&&this._bufferViewLoader.process(e),defined(t)){if(this._loadAsTypedArray)return this.unload(),this._typedArray=t,this._state=ResourceLoaderState$1.READY,void this._promise.resolve(this);var r;if(this._asynchronous){var n=scratchIndexBufferJob;if(n.set(t,i,e.context),!e.jobScheduler.execute(n,JobType$1.BUFFER))return;r=n.buffer}else r=createIndexBuffer(t,i,e.context);this.unload(),this._buffer=r,this._state=ResourceLoaderState$1.READY,this._promise.resolve(this)}}},GltfIndexBufferLoader.prototype.unload=function(){defined(this._buffer)&&this._buffer.destroy();var e=this._resourceCache;defined(this._bufferViewLoader)&&e.unload(this._bufferViewLoader),defined(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0},defined(Object.create)&&(GltfJsonLoader.prototype=Object.create(ResourceLoader.prototype),GltfJsonLoader.prototype.constructor=GltfJsonLoader),Object.defineProperties(GltfJsonLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},gltf:{get:function(){return this._gltf}}}),GltfJsonLoader.prototype.load=function(){var e;this._state=ResourceLoaderState$1.LOADING,e=defined(this._gltfJson)?processGltfJson(this,this._gltfJson):defined(this._typedArray)?processGltfTypedArray(this,this._typedArray):loadFromUri(this);var t=this;return e.then((function(e){t.isDestroyed()||(t._gltf=e,t._state=ResourceLoaderState$1.READY,t._promise.resolve(t))})).otherwise((function(e){t.isDestroyed()||handleError$3(t,e)}))},GltfJsonLoader.prototype.unload=function(){for(var e=this._bufferLoaders,t=e.length,i=0;i<t;++i)this._resourceCache.unload(e[i]);this._bufferLoaders.length=0,this._gltf=void 0},GltfJsonLoader.prototype._fetchGltf=function(){return this._gltfResource.fetchArrayBuffer()};var AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"},AlphaMode$1=Object.freeze(AlphaMode),ModelComponents={};function Quantization(){this.octEncoded=!1,this.octEncodedZXY=!1,this.normalizationRange=void 0,this.quantizedVolumeOffset=void 0,this.quantizedVolumeDimensions=void 0,this.quantizedVolumeStepSize=void 0,this.componentDatatype=void 0,this.type=void 0}function Attribute$1(){this.name=void 0,this.semantic=void 0,this.setIndex=void 0,this.componentDatatype=void 0,this.type=void 0,this.normalized=!1,this.count=void 0,this.min=void 0,this.max=void 0,this.constant=void 0,this.quantization=void 0,this.packedTypedArray=void 0,this.buffer=void 0,this.typedArray=void 0,this.byteOffset=0,this.byteStride=void 0}function Indices$1(){this.indexDatatype=void 0,this.count=void 0,this.buffer=void 0,this.typedArray=void 0}function FeatureIdAttribute$2(){this.propertyTableId=void 0,this.setIndex=void 0,this.offset=0,this.repeat=void 0}function FeatureIdTexture$1(){this.propertyTableId=void 0,this.textureReader=void 0}function MorphTarget$1(){this.attributes=[]}function Primitive$1(){this.attributes=[],this.morphTargets=[],this.morphWeights=[],this.indices=void 0,this.material=void 0,this.primitiveType=void 0,this.featureIdAttributes=[],this.featureIdTextures=[],this.featureTextureIds=[]}function Instances$1(){this.attributes=[],this.featureIdAttributes=[]}function Skin$1(){this.joints=void 0,this.inverseBindMatrices=void 0}function Node$2(){this.children=[],this.primitives=[],this.instances=void 0,this.skin=void 0,this.matrix=void 0,this.translation=void 0,this.rotation=void 0,this.scale=void 0}function Scene$2(){this.nodes=[],this.upAxis=void 0,this.forwardAxis=void 0}function Components$1(){this.scene=void 0,this.nodes=void 0,this.featureMetadata=void 0}function TextureReader(){this.texture=void 0,this.texCoord=0,this.transform=Matrix3.clone(Matrix3.IDENTITY),this.channels=void 0}function MetallicRoughness$2(){this.baseColorTexture=void 0,this.metallicRoughnessTexture=void 0,this.baseColorFactor=Cartesian4.clone(MetallicRoughness$2.DEFAULT_BASE_COLOR_FACTOR),this.metallicFactor=MetallicRoughness$2.DEFAULT_METALLIC_FACTOR,this.roughnessFactor=MetallicRoughness$2.DEFAULT_ROUGHNESS_FACTOR}function SpecularGlossiness$2(){this.diffuseTexture=void 0,this.specularGlossinessTexture=void 0,this.diffuseFactor=Cartesian4.clone(SpecularGlossiness$2.DEFAULT_DIFFUSE_FACTOR),this.specularFactor=Cartesian3.clone(SpecularGlossiness$2.DEFAULT_SPECULAR_FACTOR),this.glossinessFactor=SpecularGlossiness$2.DEFAULT_GLOSSINESS_FACTOR}function Material$2(){this.metallicRoughness=new MetallicRoughness$2,this.specularGlossiness=void 0,this.emissiveTexture=void 0,this.normalTexture=void 0,this.occlusionTexture=void 0,this.emissiveFactor=Cartesian3.clone(Material$2.DEFAULT_EMISSIVE_FACTOR),this.alphaMode=AlphaMode$1.OPAQUE,this.alphaCutoff=.5,this.doubleSided=!1,this.unlit=!1}MetallicRoughness$2.DEFAULT_BASE_COLOR_FACTOR=Cartesian4.ONE,MetallicRoughness$2.DEFAULT_METALLIC_FACTOR=1,MetallicRoughness$2.DEFAULT_ROUGHNESS_FACTOR=1,SpecularGlossiness$2.DEFAULT_DIFFUSE_FACTOR=Cartesian4.ONE,SpecularGlossiness$2.DEFAULT_SPECULAR_FACTOR=Cartesian3.ONE,SpecularGlossiness$2.DEFAULT_GLOSSINESS_FACTOR=1,Material$2.DEFAULT_EMISSIVE_FACTOR=Cartesian3.ZERO,ModelComponents.Quantization=Quantization,ModelComponents.Attribute=Attribute$1,ModelComponents.Indices=Indices$1,ModelComponents.FeatureIdAttribute=FeatureIdAttribute$2,ModelComponents.FeatureIdTexture=FeatureIdTexture$1,ModelComponents.MorphTarget=MorphTarget$1,ModelComponents.Primitive=Primitive$1,ModelComponents.Instances=Instances$1,ModelComponents.Skin=Skin$1,ModelComponents.Node=Node$2,ModelComponents.Scene=Scene$2,ModelComponents.Components=Components$1,ModelComponents.TextureReader=TextureReader,ModelComponents.MetallicRoughness=MetallicRoughness$2,ModelComponents.SpecularGlossiness=SpecularGlossiness$2,ModelComponents.Material=Material$2;var GltfLoaderUtil={getImageIdFromTexture:function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.textureId,r=e.supportedImageFormats,n=t.textures[i],a=n.extensions;if(defined(a)){if(r.webp&&defined(a.EXT_texture_webp))return a.EXT_texture_webp.source;if(r.basis&&defined(a.KHR_texture_basisu))return a.KHR_texture_basisu.source}return n.source},createSampler:function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.textureInfo,r=defaultValue(e.compressedTextureNoMipmap,!1),n=TextureWrap$1.REPEAT,a=TextureWrap$1.REPEAT,o=TextureMinificationFilter$1.LINEAR,s=TextureMagnificationFilter$1.LINEAR,l=i.index,c=t.textures[l].sampler;if(defined(c)){var u=t.samplers[c];n=defaultValue(u.wrapS,n),a=defaultValue(u.wrapT,a),o=defaultValue(u.minFilter,o),s=defaultValue(u.magFilter,s)}var d=!1,h=i.extensions;return defined(h)&&defined(h.KHR_texture_transform)&&(d=!0),(r||d)&&o!==TextureMinificationFilter$1.LINEAR&&o!==TextureMinificationFilter$1.NEAREST&&(o=o===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||o===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR?TextureMinificationFilter$1.NEAREST:TextureMinificationFilter$1.LINEAR),new Sampler({wrapS:n,wrapT:a,minificationFilter:o,magnificationFilter:s})}},defaultScale$2=new Cartesian2(1,1);function GltfTextureLoader(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltf,r=e.textureInfo,n=e.gltfResource,a=e.baseResource,o=e.supportedImageFormats,s=e.cacheKey,l=defaultValue(e.asynchronous,!0),c=r.index,u=GltfLoaderUtil.getImageIdFromTexture({gltf:i,textureId:c,supportedImageFormats:o});this._resourceCache=t,this._gltf=i,this._textureInfo=r,this._imageId=u,this._gltfResource=n,this._baseResource=a,this._cacheKey=s,this._asynchronous=l,this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function CreateTextureJob(){this.gltf=void 0,this.textureInfo=void 0,this.image=void 0,this.context=void 0,this.texture=void 0}function resizeImageToNextPowerOfTwo(e){var t=document.createElement("canvas");return t.width=CesiumMath.nextPowerOfTwo(e.width),t.height=CesiumMath.nextPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),t}function createTexture$1(e,t,i,r,n){var a=i.internalFormat,o=!1;PixelFormat$1.isCompressedFormat(a)&&!defined(r)&&(o=!0);var s,l=GltfLoaderUtil.createSampler({gltf:e,textureInfo:t,compressedTextureNoMipmap:o}),c=l.minificationFilter,u=l.wrapS,d=l.wrapT,h=c===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||c===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR||c===TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST||c===TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR,p=!defined(a)&&h,f=p||u===TextureWrap$1.REPEAT||u===TextureWrap$1.MIRRORED_REPEAT||d===TextureWrap$1.REPEAT||d===TextureWrap$1.MIRRORED_REPEAT,m=!CesiumMath.isPowerOfTwo(i.width)||!CesiumMath.isPowerOfTwo(i.height),g=f&&m;return defined(a)?(!n.webgl2&&PixelFormat$1.isCompressedFormat(a)&&m&&f&&console.warn("Compressed texture uses REPEAT or MIRRORED_REPEAT texture wrap mode and dimensions are not powers of two. The texture may be rendered incorrectly."),s=Texture.create({context:n,source:{arrayBufferView:i.bufferView,mipLevels:r},width:i.width,height:i.height,pixelFormat:i.internalFormat,sampler:l})):(g&&(i=resizeImageToNextPowerOfTwo(i)),s=Texture.create({context:n,source:i,sampler:l,flipY:!1,skipColorSpaceConversion:!0})),p&&s.generateMipmap(),s}GltfLoaderUtil.createModelTextureReader=function(e){var t,i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).textureInfo,r=e.channels,n=e.texture,a=defaultValue(i.texCoord,0),o=defaultValue(i.extensions,defaultValue.EMPTY_OBJECT).KHR_texture_transform;if(defined(o)){a=defaultValue(o.texCoord,a);var s=defined(o.offset)?Cartesian2.unpack(o.offset):Cartesian2.ZERO,l=defaultValue(o.rotation,0),c=defined(o.scale)?Cartesian2.unpack(o.scale):defaultScale$2;l=-l,t=new Matrix3(Math.cos(l)*c.x,-Math.sin(l)*c.y,s.x,Math.sin(l)*c.x,Math.cos(l)*c.y,s.y,0,0,1)}var u=new ModelComponents.TextureReader;return u.texture=n,u.texCoord=a,u.transform=t,u.channels=r,u},defined(Object.create)&&(GltfTextureLoader.prototype=Object.create(ResourceLoader.prototype),GltfTextureLoader.prototype.constructor=GltfTextureLoader),Object.defineProperties(GltfTextureLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},texture:{get:function(){return this._texture}}}),GltfTextureLoader.prototype.load=function(){var e=this._resourceCache.loadImage({gltf:this._gltf,imageId:this._imageId,gltfResource:this._gltfResource,baseResource:this._baseResource});this._imageLoader=e,this._state=ResourceLoaderState$1.LOADING;var t=this;e.promise.then((function(){t.isDestroyed()||(t._image=e.image,t._mipLevels=e.mipLevels,t._state=ResourceLoaderState$1.PROCESSING)})).otherwise((function(e){if(!t.isDestroyed()){t.unload(),t._state=ResourceLoaderState$1.FAILED;t._promise.reject(t.getError("Failed to load texture",e))}}))},CreateTextureJob.prototype.set=function(e,t,i,r,n){this.gltf=e,this.textureInfo=t,this.image=i,this.mipLevels=r,this.context=n},CreateTextureJob.prototype.execute=function(){this.texture=createTexture$1(this.gltf,this.textureInfo,this.image,this.mipLevels,this.context)};var scratchTextureJob=new CreateTextureJob;function GltfVertexBufferLoader(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,i=e.gltf,r=e.gltfResource,n=e.baseResource,a=e.bufferViewId,o=e.draco,s=e.attributeSemantic,l=e.accessorId,c=e.cacheKey,u=defaultValue(e.asynchronous,!0),d=defaultValue(e.dequantize,!1),h=defaultValue(e.loadAsTypedArray,!1);this._resourceCache=t,this._gltfResource=r,this._baseResource=n,this._gltf=i,this._bufferViewId=a,this._draco=o,this._attributeSemantic=s,this._accessorId=l,this._cacheKey=c,this._asynchronous=u,this._dequantize=d,this._loadAsTypedArray=h,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._quantization=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function getQuantizationInformation(e,t,i,r){var n=(1<<e.quantizationBits)-1,a=1/n,o=new ModelComponents.Quantization;if(o.componentDatatype=t,o.octEncoded=e.octEncoded,o.octEncodedZXY=!0,o.type=r,o.octEncoded)o.type=AttributeType$1.VEC2,o.normalizationRange=n;else{var s=AttributeType$1.getMathType(r);if(s===Number){var l=e.range;o.quantizedVolumeOffset=e.minValues[0],o.quantizedVolumeDimensions=l,o.normalizationRange=n,o.quantizedVolumeStepSize=l*a}else{o.quantizedVolumeOffset=s.unpack(e.minValues),o.normalizationRange=s.unpack(arrayFill(new Array(i),n));var c=arrayFill(new Array(i),e.range);o.quantizedVolumeDimensions=s.unpack(c);var u=c.map((function(e){return e*a}));o.quantizedVolumeStepSize=s.unpack(u)}}return o}function loadFromDraco(e){var t=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});e._dracoLoader=t,e._state=ResourceLoaderState$1.LOADING,t.promise.then((function(){if(!e.isDestroyed()){var i=t.decodedData.vertexAttributes[e._attributeSemantic],r=e._accessorId,n=e._gltf.accessors[r].type,a=i.array,o=i.data.quantization;defined(o)&&(e._quantization=getQuantizationInformation(o,i.data.componentDatatype,i.data.componentsPerAttribute,n)),e._typedArray=a,e._state=ResourceLoaderState$1.PROCESSING}})).otherwise((function(t){e.isDestroyed()||handleError$2(e,t)}))}function loadFromBufferView(e){var t=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});e._state=ResourceLoaderState$1.LOADING,e._bufferViewLoader=t,t.promise.then((function(){e.isDestroyed()||(e._typedArray=t.typedArray,e._state=ResourceLoaderState$1.PROCESSING)})).otherwise((function(t){e.isDestroyed()||handleError$2(e,t)}))}function handleError$2(e,t){e.unload(),e._state=ResourceLoaderState$1.FAILED;t=e.getError("Failed to load vertex buffer",t),e._promise.reject(t)}function CreateVertexBufferJob(){this.typedArray=void 0,this.dequantize=void 0,this.componentType=void 0,this.type=void 0,this.count=void 0,this.context=void 0,this.buffer=void 0}function createVertexBuffer$1(e,t,i,r,n,a){t&&i!==ComponentDatatype$1.FLOAT&&(e=AttributeCompression.dequantize(e,i,r,n));var o=Buffer$1.createVertexBuffer({typedArray:e,context:a,usage:BufferUsage$1.STATIC_DRAW});return o.vertexArrayDestroyable=!1,o}GltfTextureLoader.prototype.process=function(e){if(!defined(this._texture)&&defined(this._image)){var t;if(this._asynchronous){var i=scratchTextureJob;if(i.set(this._gltf,this._textureInfo,this._image,this._mipLevels,e.context),!e.jobScheduler.execute(i,JobType$1.TEXTURE))return;t=i.texture}else t=createTexture$1(this._gltf,this._textureInfo,this._image,this._mipLevels,e.context);this.unload(),this._texture=t,this._state=ResourceLoaderState$1.READY,this._promise.resolve(this)}},GltfTextureLoader.prototype.unload=function(){defined(this._texture)&&this._texture.destroy(),defined(this._imageLoader)&&this._resourceCache.unload(this._imageLoader),this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._gltf=void 0},defined(Object.create)&&(GltfVertexBufferLoader.prototype=Object.create(ResourceLoader.prototype),GltfVertexBufferLoader.prototype.constructor=GltfVertexBufferLoader),Object.defineProperties(GltfVertexBufferLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},quantization:{get:function(){return this._quantization}}}),GltfVertexBufferLoader.prototype.load=function(){defined(this._draco)?loadFromDraco(this):loadFromBufferView(this)},CreateVertexBufferJob.prototype.set=function(e,t,i,r,n,a){this.typedArray=e,this.dequantize=t,this.componentType=i,this.type=r,this.count=n,this.context=a},CreateVertexBufferJob.prototype.execute=function(){this.buffer=createVertexBuffer$1(this.typedArray,this.dequantize,this.componentType,this.type,this.count,this.context)};var scratchVertexBufferJob=new CreateVertexBufferJob;function MetadataClassProperty(e){var t,i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id,r=e.property;defined(r.enumType)&&(t=e.enums[r.enumType]);var n,a=r.type;MetadataComponentType$1.hasOwnProperty(a)?(n=MetadataComponentType$1[a],a=MetadataType$1.SINGLE):(a=defaultValue(MetadataType$1[a],MetadataType$1.SINGLE),n=MetadataComponentType$1[r.componentType]);var o=getValueType(n,t),s=MetadataComponentType$1.isIntegerType(n)&&defaultValue(r.normalized,!1),l=a===MetadataType$1.ARRAY?r.componentCount:MetadataType$1.getComponentCount(a);this._id=i,this._name=r.name,this._description=r.description,this._type=a,this._enumType=t,this._valueType=o,this._componentType=n,this._componentCount=l,this._normalized=s,this._min=r.min,this._max=r.max,this._default=r.default,this._optional=defaultValue(r.optional,!1),this._semantic=r.semantic,this._extras=r.extras,this._extensions=r.extensions}function validateArray(e,t,i){if(!Array.isArray(t))return getTypeErrorMessage(t,MetadataType$1.ARRAY);var r=t.length;if(defined(i)&&i!==r)return"Array length does not match componentCount";for(var n=0;n<r;++n){var a=checkValue(e,t[n]);if(defined(a))return a}}function validateVectorOrMatrix(e,t,i){if(!MetadataComponentType$1.isVectorCompatible(i)){var r="componentType "+i+" is incompatible with ";return MetadataType$1.isVectorType(t)?r+"vector type "+t:r+"matrix type "+t}return t!==MetadataType$1.VEC2||e instanceof Cartesian2?t!==MetadataType$1.VEC3||e instanceof Cartesian3?t!==MetadataType$1.VEC4||e instanceof Cartesian4?t!==MetadataType$1.MAT2||e instanceof Matrix2?t!==MetadataType$1.MAT3||e instanceof Matrix3?t!==MetadataType$1.MAT4||e instanceof Matrix4?void 0:"matrix value "+e+" must be a Matrix4":"matrix value "+e+" must be a Matrix3":"matrix value "+e+" must be a Matrix2":"vector value "+e+" must be a Cartesian4":"vector value "+e+" must be a Cartesian3":"vector value "+e+" must be a Cartesian2"}function getTypeErrorMessage(e,t){return"value "+e+" does not match type "+t}function getOutOfRangeErrorMessage(e,t,i){var r="value "+e+" is out of range for type "+t;return i&&(r+=" (normalized)"),r}function checkInRange(e,t,i){if(i){return e<(MetadataComponentType$1.isUnsignedIntegerType(t)?0:-1)||e>1?getOutOfRangeErrorMessage(e,t,i):void 0}if(e<MetadataComponentType$1.getMinimum(t)||e>MetadataComponentType$1.getMaximum(t))return getOutOfRangeErrorMessage(e,t,i)}function getNonFiniteErrorMessage(e,t){return"value "+e+" of type "+t+" must be finite"}function checkValue(e,t){var i=typeof t,r=e._enumType;if(defined(r))return"string"===i&&defined(r.valuesByName[t])?void 0:"value "+t+" is not a valid enum name for "+r.id;var n=e._valueType,a=e._normalized;switch(n){case MetadataComponentType$1.INT8:case MetadataComponentType$1.UINT8:case MetadataComponentType$1.INT16:case MetadataComponentType$1.UINT16:case MetadataComponentType$1.INT32:case MetadataComponentType$1.UINT32:return"number"!==i?getTypeErrorMessage(t,n):checkInRange(t,n,a);case MetadataComponentType$1.INT64:case MetadataComponentType$1.UINT64:return"number"!==i&&"bigint"!==i?getTypeErrorMessage(t,n):checkInRange(t,n,a);case MetadataComponentType$1.FLOAT32:case MetadataComponentType$1.FLOAT64:return"number"!==i?getTypeErrorMessage(t,n):isFinite(t)?checkInRange(t,n,a):getNonFiniteErrorMessage(t,n);case MetadataComponentType$1.BOOLEAN:if("boolean"!==i)return getTypeErrorMessage(t,n);break;case MetadataComponentType$1.STRING:if("string"!==i)return getTypeErrorMessage(t,n)}}function normalize(e,t,i){if(!e._normalized)return t;var r,n,a=e._type,o=e._valueType;if(a===MetadataType$1.ARRAY)for(n=t.length,r=0;r<n;++r)t[r]=i(t[r],o);else if(MetadataType$1.isVectorType(a)||MetadataType$1.isMatrixType(a))for(n=MetadataType$1.getComponentCount(a),r=0;r<n;++r)t[r]=i(t[r],o);else t=i(t,o);return t}function getValueType(e,t){return e===MetadataComponentType$1.ENUM?t.valueType:e}function MetadataClass(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id,i=e.class,r={},n={};for(var a in i.properties)if(i.properties.hasOwnProperty(a)){var o=new MetadataClassProperty({id:a,property:i.properties[a],enums:e.enums});r[a]=o,defined(o.semantic)&&(n[o.semantic]=o)}this._properties=r,this._propertiesBySemantic=n,this._id=t,this._name=i.name,this._description=i.description,this._extras=i.extras,this._extensions=i.extensions}function MetadataEnumValue(e){this._value=e.value,this._name=e.name,this._description=e.description,this._extras=e.extras,this._extensions=e.extensions}function MetadataEnum(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id,i=e.enum,r={},n={},a=i.values.map((function(e){return r[e.value]=e.name,n[e.name]=e.value,new MetadataEnumValue(e)})),o=defaultValue(MetadataComponentType$1[i.valueType],MetadataComponentType$1.UINT16);this._values=a,this._namesByValue=r,this._valuesByName=n,this._valueType=o,this._id=t,this._name=i.name,this._description=i.description,this._extras=i.extras,this._extensions=i.extensions}function MetadataSchema(e){var t={};if(defined(e.enums))for(var i in e.enums)e.enums.hasOwnProperty(i)&&(t[i]=new MetadataEnum({id:i,enum:e.enums[i]}));var r={};if(defined(e.classes))for(var n in e.classes)e.classes.hasOwnProperty(n)&&(r[n]=new MetadataClass({id:n,class:e.classes[n],enums:t}));this._classes=r,this._enums=t,this._id=e.id,this._name=e.name,this._description=e.description,this._version=e.version,this._extras=e.extras,this._extensions=e.extensions}function MetadataSchemaLoader(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).schema,i=e.resource,r=e.cacheKey;this._schema=defined(t)?new MetadataSchema(t):void 0,this._resource=i,this._cacheKey=r,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function loadExternalSchema(e){var t=e._resource;e._state=ResourceLoaderState$1.LOADING,t.fetchJson().then((function(t){e.isDestroyed()||(e._schema=new MetadataSchema(t),e._state=ResourceLoaderState$1.READY,e._promise.resolve(e))})).otherwise((function(i){if(!e.isDestroyed()){e._state=ResourceLoaderState$1.FAILED;var r="Failed to load schema: "+t.url;e._promise.reject(e.getError(r,i))}}))}GltfVertexBufferLoader.prototype.process=function(e){if(this._state!==ResourceLoaderState$1.READY){var t=this._typedArray,i=this._dequantize;if(defined(this._dracoLoader)&&this._dracoLoader.process(e),defined(this._bufferViewLoader)&&this._bufferViewLoader.process(e),defined(t)){if(this._loadAsTypedArray)return this.unload(),this._typedArray=t,this._state=ResourceLoaderState$1.READY,void this._promise.resolve(this);var r,n=this._gltf.accessors[this._accessorId];if(this._asynchronous){var a=scratchVertexBufferJob;if(a.set(t,i,n.componentType,n.type,n.count,e.context),!e.jobScheduler.execute(a,JobType$1.BUFFER))return;r=a.buffer}else r=createVertexBuffer$1(t,i,n.componentType,n.type,n.count,e.context);this.unload(),this._buffer=r,this._state=ResourceLoaderState$1.READY,this._promise.resolve(this)}}},GltfVertexBufferLoader.prototype.unload=function(){defined(this._buffer)&&this._buffer.destroy();var e=this._resourceCache;defined(this._bufferViewLoader)&&e.unload(this._bufferViewLoader),defined(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0},Object.defineProperties(MetadataClassProperty.prototype,{id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},type:{get:function(){return this._type}},enumType:{get:function(){return this._enumType}},componentType:{get:function(){return this._componentType}},valueType:{get:function(){return this._valueType}},componentCount:{get:function(){return this._componentCount}},normalized:{get:function(){return this._normalized}},max:{get:function(){return this._max}},min:{get:function(){return this._min}},default:{get:function(){return this._default}},optional:{get:function(){return this._optional}},semantic:{get:function(){return this._semantic}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),MetadataClassProperty.prototype.normalize=function(e){return normalize(this,e,MetadataComponentType$1.normalize)},MetadataClassProperty.prototype.unnormalize=function(e){return normalize(this,e,MetadataComponentType$1.unnormalize)},MetadataClassProperty.prototype.unpackVectorAndMatrixTypes=function(e){switch(this._type){case MetadataType$1.VEC2:return Cartesian2.unpack(e);case MetadataType$1.VEC3:return Cartesian3.unpack(e);case MetadataType$1.VEC4:return Cartesian4.unpack(e);case MetadataType$1.MAT2:return Matrix2.unpack(e);case MetadataType$1.MAT3:return Matrix3.unpack(e);case MetadataType$1.MAT4:return Matrix4.unpack(e);default:return e}},MetadataClassProperty.prototype.packVectorAndMatrixTypes=function(e){switch(this._type){case MetadataType$1.VEC2:return Cartesian2.pack(e,[]);case MetadataType$1.VEC3:return Cartesian3.pack(e,[]);case MetadataType$1.VEC4:return Cartesian4.pack(e,[]);case MetadataType$1.MAT2:return Matrix2.pack(e,[]);case MetadataType$1.MAT3:return Matrix3.pack(e,[]);case MetadataType$1.MAT4:return Matrix4.pack(e,[]);default:return e}},MetadataClassProperty.prototype.validate=function(e){var t=this._type,i=this._componentType;return MetadataType$1.isVectorType(t)||MetadataType$1.isMatrixType(t)?validateVectorOrMatrix(e,t,i):t===MetadataType$1.ARRAY?validateArray(this,e,this._componentCount):checkValue(this,e)},Object.defineProperties(MetadataClass.prototype,{properties:{get:function(){return this._properties}},propertiesBySemantic:{get:function(){return this._propertiesBySemantic}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),MetadataClass.BATCH_TABLE_CLASS_NAME="_batchTable",Object.defineProperties(MetadataEnumValue.prototype,{value:{get:function(){return this._value}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Object.defineProperties(MetadataEnum.prototype,{values:{get:function(){return this._values}},namesByValue:{get:function(){return this._namesByValue}},valuesByName:{get:function(){return this._valuesByName}},valueType:{get:function(){return this._valueType}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Object.defineProperties(MetadataSchema.prototype,{classes:{get:function(){return this._classes}},enums:{get:function(){return this._enums}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},version:{get:function(){return this._version}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),defined(Object.create)&&(MetadataSchemaLoader.prototype=Object.create(ResourceLoader.prototype),MetadataSchemaLoader.prototype.constructor=MetadataSchemaLoader),Object.defineProperties(MetadataSchemaLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},schema:{get:function(){return this._schema}}}),MetadataSchemaLoader.prototype.load=function(){defined(this._schema)?this._promise.resolve(this):loadExternalSchema(this)},MetadataSchemaLoader.prototype.unload=function(){this._schema=void 0};var ResourceCacheKey={};function getExternalResourceCacheKey(e){return getAbsoluteUri(e.url)}function getBufferViewCacheKey(e){var t=e.byteOffset,i=e.byteLength;if(hasExtension(e,"EXT_meshopt_compression")){var r=e.extensions.EXT_meshopt_compression;t=defaultValue(r.byteOffset,0),i=r.byteLength}return t+"-"+(t+i)}function getAccessorCacheKey(e,t){return t.byteOffset+e.byteOffset+"-"+e.componentType+"-"+e.type+"-"+e.count}function getExternalBufferCacheKey(e){return getExternalResourceCacheKey(e)}function getEmbeddedBufferCacheKey(e,t){return getExternalResourceCacheKey(e)+"-buffer-id-"+t}function getBufferCacheKey(e,t,i,r){return defined(e.uri)?getExternalBufferCacheKey(r.getDerivedResource({url:e.uri})):getEmbeddedBufferCacheKey(i,t)}function getDracoCacheKey(e,t,i,r){var n=t.bufferView,a=e.bufferViews[n],o=a.buffer;return getBufferCacheKey(e.buffers[o],o,i,r)+"-range-"+getBufferViewCacheKey(a)}function getImageCacheKey(e,t,i,r){var n=e.images[t],a=n.bufferView,o=n.uri;if(defined(o))return getExternalResourceCacheKey(r.getDerivedResource({url:o}));var s=e.bufferViews[a],l=s.buffer;return getBufferCacheKey(e.buffers[l],l,i,r)+"-range-"+getBufferViewCacheKey(s)}function getSamplerCacheKey(e,t){var i=GltfLoaderUtil.createSampler({gltf:e,textureInfo:t});return i.wrapS+"-"+i.wrapT+"-"+i.minificationFilter+"-"+i.magnificationFilter}function ResourceCache(){}function CacheEntry(e){this.referenceCount=1,this.resourceLoader=e}function ImplicitSubtree(e,t,i,r){this._resource=e,this._subtreeJson=void 0,this._bufferLoader=void 0,this._tileAvailability=void 0,this._implicitCoordinates=r,this._contentAvailabilityBitstreams=[],this._childSubtreeAvailability=void 0,this._subtreeLevels=i.subtreeLevels,this._subdivisionScheme=i.subdivisionScheme,this._branchingFactor=i.branchingFactor,this._readyPromise=when.defer(),this._metadataTable=void 0,this._metadataExtension=void 0,this._jumpBuffer=void 0,initialize$a(this,t,i)}function initialize$a(e,t,i){var r,n=parseSubtreeChunks(t),a=n.json;e._subtreeJson=a,hasExtension(a,"3DTILES_metadata")&&(r=a.extensions["3DTILES_metadata"]),e._metadataExtension=r;a.contentAvailabilityHeaders=[],hasExtension(a,"3DTILES_multiple_contents")?a.contentAvailabilityHeaders=a.extensions["3DTILES_multiple_contents"].contentAvailability:a.contentAvailabilityHeaders.push(defaultValue(a.contentAvailability,{constant:0}));var o=preprocessBuffers(a.buffers),s=preprocessBufferViews(a.bufferViews,o);markActiveBufferViews(a,s),defined(r)&&markActiveMetadataBufferViews(r,s),requestActiveBuffers(e,o,n.binary).then((function(t){var n=parseActiveBufferViews(s,t);parseAvailability(e,a,i,n),defined(r)&&(parseMetadataTable(e,i,n),makeJumpBuffer(e)),e._readyPromise.resolve(e)})).otherwise((function(t){e._readyPromise.reject(t)}))}function parseSubtreeChunks(e){var t=new DataView(e.buffer,e.byteOffset),i=8,r=t.getUint32(i,true);i+=8;var n=t.getUint32(i,true),a=getJsonFromTypedArray(e,i+=8,r);return i+=r,{json:a,binary:e.subarray(i,i+n)}}function preprocessBuffers(e){e=defined(e)?e:[];for(var t=0;t<e.length;t++){var i=e[t];i.isExternal=defined(i.uri),i.isActive=!1}return e}function preprocessBufferViews(e,t){e=defined(e)?e:[];for(var i=0;i<e.length;i++){var r=e[i],n=t[r.buffer];r.bufferHeader=n,r.isActive=!1}return e}function markActiveBufferViews(e,t){var i,r=e.tileAvailability;defined(r.bufferView)&&((i=t[r.bufferView]).isActive=!0,i.bufferHeader.isActive=!0);for(var n=e.contentAvailabilityHeaders,a=0;a<n.length;a++)defined(n[a].bufferView)&&((i=t[n[a].bufferView]).isActive=!0,i.bufferHeader.isActive=!0);var o=e.childSubtreeAvailability;defined(o.bufferView)&&((i=t[o.bufferView]).isActive=!0,i.bufferHeader.isActive=!0)}function markActiveMetadataBufferViews(e,t){var i,r=e.properties;for(var n in r)if(r.hasOwnProperty(n)){var a=r[n];(i=t[a.bufferView]).isActive=!0,i.bufferHeader.isActive=!0,defined(a.stringOffsetBufferView)&&((i=t[a.stringOffsetBufferView]).isActive=!0,i.bufferHeader.isActive=!0),defined(a.arrayOffsetBufferView)&&((i=t[a.arrayOffsetBufferView]).isActive=!0,i.bufferHeader.isActive=!0)}}function requestActiveBuffers(e,t,i){for(var r=[],n=0;n<t.length;n++){var a=t[n];if(a.isActive)if(a.isExternal){var o=requestExternalBuffer(e,a);r.push(o)}else r.push(when.resolve(i));else r.push(when.resolve(void 0))}return when.all(r).then((function(e){for(var t={},i=0;i<e.length;i++){var r=e[i];defined(r)&&(t[i]=r)}return t}))}function requestExternalBuffer(e,t){var i=e._resource.getDerivedResource({url:t.uri}),r=ResourceCache.loadExternalBuffer({resource:i});return e._bufferLoader=r,r.promise.then((function(e){return e.typedArray}))}function parseActiveBufferViews(e,t){for(var i={},r=0;r<e.length;r++){var n=e[r];if(n.isActive){var a=n.byteOffset,o=a+n.byteLength,s=t[n.buffer].subarray(a,o);i[r]=s}}return i}function parseAvailability(e,t,i,r){var n=i.branchingFactor,a=i.subtreeLevels,o=(Math.pow(n,a)-1)/(n-1),s=Math.pow(n,a),l=hasExtension(t,"3DTILES_metadata");e._tileAvailability=parseAvailabilityBitstream(t.tileAvailability,r,o,l);for(var c=0;c<t.contentAvailabilityHeaders.length;c++){var u=parseAvailabilityBitstream(t.contentAvailabilityHeaders[c],r,o);e._contentAvailabilityBitstreams.push(u)}e._childSubtreeAvailability=parseAvailabilityBitstream(t.childSubtreeAvailability,r,s)}function parseAvailabilityBitstream(e,t,i,r){return defined(e.constant)?new ImplicitAvailabilityBitstream({constant:Boolean(e.constant),lengthBits:i,availableCount:e.availableCount}):new ImplicitAvailabilityBitstream({bitstream:t[e.bufferView],lengthBits:i,availableCount:e.availableCount,computeAvailableCountEnabled:r})}function parseMetadataTable(e,t,i){var r=e._metadataExtension,n=e._tileAvailability.availableCount,a=r.class,o=t.metadataSchema.classes[a];e._metadataTable=new MetadataTable({class:o,count:n,properties:r.properties,bufferViews:i})}function makeJumpBuffer(e){var t,i=e._tileAvailability,r=0,n=i.lengthBits,a=i.availableCount;t=a<256?new Uint8Array(n):a<65536?new Uint16Array(n):new Uint32Array(n);for(var o=0;o<i.lengthBits;o++)i.getBit(o)&&(t[o]=r,r++);e._jumpBuffer=t}function ImplicitTileMetadata(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._class=e.class;var t=e.implicitSubtree;this._metadataTable=t.metadataTable,this._entityId=t.getEntityId(e.implicitCoordinates);var i=t.metadataExtension;this._extensions=i.extensions,this._extras=i.extras}ResourceCacheKey.getSchemaCacheKey=function(e){var t=e.schema,i=e.resource;return defined(t)?"embedded-schema:"+JSON.stringify(t):"external-schema:"+getExternalResourceCacheKey(i)},ResourceCacheKey.getExternalBufferCacheKey=function(e){return"external-buffer:"+getExternalBufferCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resource)},ResourceCacheKey.getEmbeddedBufferCacheKey=function(e){return"embedded-buffer:"+getEmbeddedBufferCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).parentResource,e.bufferId)},ResourceCacheKey.getGltfCacheKey=function(e){return"gltf:"+getExternalResourceCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltfResource)},ResourceCacheKey.getBufferViewCacheKey=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.bufferViewId,r=e.gltfResource,n=e.baseResource,a=t.bufferViews[i],o=a.buffer,s=t.buffers[o];hasExtension(a,"EXT_meshopt_compression")&&(o=a.extensions.EXT_meshopt_compression.buffer);return"buffer-view:"+getBufferCacheKey(s,o,r,n)+"-range-"+getBufferViewCacheKey(a)},ResourceCacheKey.getDracoCacheKey=function(e){return"draco:"+getDracoCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,e.draco,e.gltfResource,e.baseResource)},ResourceCacheKey.getVertexBufferCacheKey=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.gltfResource,r=e.baseResource,n=e.bufferViewId,a=e.draco,o=e.attributeSemantic,s="";if(defaultValue(e.dequantize,!1)&&(s+="-dequantize"),defaultValue(e.loadAsTypedArray,!1)&&(s+="-typed-array"),defined(a))return"vertex-buffer:"+getDracoCacheKey(t,a,i,r)+"-draco-"+o+s;var l=t.bufferViews[n],c=l.buffer;return"vertex-buffer:"+getBufferCacheKey(t.buffers[c],c,i,r)+"-range-"+getBufferViewCacheKey(l)+s},ResourceCacheKey.getIndexBufferCacheKey=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.accessorId,r=e.gltfResource,n=e.baseResource,a=e.draco,o="";if(defaultValue(e.loadAsTypedArray,!1)&&(o+="-typed-array"),defined(a))return"index-buffer:"+getDracoCacheKey(t,a,r,n)+"-draco"+o;var s=t.accessors[i],l=s.bufferView,c=t.bufferViews[l],u=c.buffer;return"index-buffer:"+getBufferCacheKey(t.buffers[u],u,r,n)+"-accessor-"+getAccessorCacheKey(s,c)+o},ResourceCacheKey.getImageCacheKey=function(e){return"image:"+getImageCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,e.imageId,e.gltfResource,e.baseResource)},ResourceCacheKey.getTextureCacheKey=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.textureInfo,r=e.gltfResource,n=e.baseResource,a=e.supportedImageFormats,o=i.index;return"texture:"+getImageCacheKey(t,GltfLoaderUtil.getImageIdFromTexture({gltf:t,textureId:o,supportedImageFormats:a}),r,n)+"-sampler-"+getSamplerCacheKey(t,i)},ResourceCache.cacheEntries={},ResourceCache.get=function(e){var t=ResourceCache.cacheEntries[e];if(defined(t))return++t.referenceCount,t.resourceLoader},ResourceCache.load=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceLoader,i=t.cacheKey;ResourceCache.cacheEntries[i]=new CacheEntry(t),t.load()},ResourceCache.unload=function(e){var t=e.cacheKey,i=ResourceCache.cacheEntries[t];--i.referenceCount,0===i.referenceCount&&(e.destroy(),delete ResourceCache.cacheEntries[t])},ResourceCache.loadSchema=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).schema,i=e.resource,r=ResourceCacheKey.getSchemaCacheKey({schema:t,resource:i}),n=ResourceCache.get(r);return defined(n)||(n=new MetadataSchemaLoader({schema:t,resource:i,cacheKey:r}),ResourceCache.load({resourceLoader:n})),n},ResourceCache.loadEmbeddedBuffer=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).parentResource,i=e.bufferId,r=e.typedArray,n=ResourceCacheKey.getEmbeddedBufferCacheKey({parentResource:t,bufferId:i}),a=ResourceCache.get(n);return defined(a)||(a=new BufferLoader({typedArray:r,cacheKey:n}),ResourceCache.load({resourceLoader:a})),a},ResourceCache.loadExternalBuffer=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resource,i=ResourceCacheKey.getExternalBufferCacheKey({resource:t}),r=ResourceCache.get(i);return defined(r)||(r=new BufferLoader({resource:t,cacheKey:i}),ResourceCache.load({resourceLoader:r})),r},ResourceCache.loadGltfJson=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltfResource,i=e.baseResource,r=e.typedArray,n=e.gltfJson,a=ResourceCacheKey.getGltfCacheKey({gltfResource:t}),o=ResourceCache.get(a);return defined(o)||(o=new GltfJsonLoader({resourceCache:ResourceCache,gltfResource:t,baseResource:i,typedArray:r,gltfJson:n,cacheKey:a}),ResourceCache.load({resourceLoader:o})),o},ResourceCache.loadBufferView=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.bufferViewId,r=e.gltfResource,n=e.baseResource,a=ResourceCacheKey.getBufferViewCacheKey({gltf:t,bufferViewId:i,gltfResource:r,baseResource:n}),o=ResourceCache.get(a);return defined(o)||(o=new GltfBufferViewLoader({resourceCache:ResourceCache,gltf:t,bufferViewId:i,gltfResource:r,baseResource:n,cacheKey:a}),ResourceCache.load({resourceLoader:o})),o},ResourceCache.loadDraco=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.draco,r=e.gltfResource,n=e.baseResource,a=ResourceCacheKey.getDracoCacheKey({gltf:t,draco:i,gltfResource:r,baseResource:n}),o=ResourceCache.get(a);return defined(o)||(o=new GltfDracoLoader({resourceCache:ResourceCache,gltf:t,draco:i,gltfResource:r,baseResource:n,cacheKey:a}),ResourceCache.load({resourceLoader:o})),o},ResourceCache.loadVertexBuffer=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.gltfResource,r=e.baseResource,n=e.bufferViewId,a=e.draco,o=e.attributeSemantic,s=e.accessorId,l=defaultValue(e.asynchronous,!0),c=defaultValue(e.dequantize,!1),u=defaultValue(e.loadAsTypedArray,!1),d=ResourceCacheKey.getVertexBufferCacheKey({gltf:t,gltfResource:i,baseResource:r,bufferViewId:n,draco:a,attributeSemantic:o,dequantize:c,loadAsTypedArray:u}),h=ResourceCache.get(d);return defined(h)||(h=new GltfVertexBufferLoader({resourceCache:ResourceCache,gltf:t,gltfResource:i,baseResource:r,bufferViewId:n,draco:a,attributeSemantic:o,accessorId:s,cacheKey:d,asynchronous:l,dequantize:c,loadAsTypedArray:u}),ResourceCache.load({resourceLoader:h})),h},ResourceCache.loadIndexBuffer=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.accessorId,r=e.gltfResource,n=e.baseResource,a=e.draco,o=defaultValue(e.asynchronous,!0),s=defaultValue(e.loadAsTypedArray,!1),l=ResourceCacheKey.getIndexBufferCacheKey({gltf:t,accessorId:i,gltfResource:r,baseResource:n,draco:a,loadAsTypedArray:s}),c=ResourceCache.get(l);return defined(c)||(c=new GltfIndexBufferLoader({resourceCache:ResourceCache,gltf:t,accessorId:i,gltfResource:r,baseResource:n,draco:a,cacheKey:l,asynchronous:o,loadAsTypedArray:s}),ResourceCache.load({resourceLoader:c})),c},ResourceCache.loadImage=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.imageId,r=e.gltfResource,n=e.baseResource,a=ResourceCacheKey.getImageCacheKey({gltf:t,imageId:i,gltfResource:r,baseResource:n}),o=ResourceCache.get(a);return defined(o)||(o=new GltfImageLoader({resourceCache:ResourceCache,gltf:t,imageId:i,gltfResource:r,baseResource:n,cacheKey:a}),ResourceCache.load({resourceLoader:o})),o},ResourceCache.loadTexture=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.textureInfo,r=e.gltfResource,n=e.baseResource,a=e.supportedImageFormats,o=defaultValue(e.asynchronous,!0),s=ResourceCacheKey.getTextureCacheKey({gltf:t,textureInfo:i,gltfResource:r,baseResource:n,supportedImageFormats:a}),l=ResourceCache.get(s);return defined(l)||(l=new GltfTextureLoader({resourceCache:ResourceCache,gltf:t,textureInfo:i,gltfResource:r,baseResource:n,supportedImageFormats:a,cacheKey:s,asynchronous:o}),ResourceCache.load({resourceLoader:l})),l},ResourceCache.clearForSpecs=function(){var e,t=[GltfVertexBufferLoader,GltfIndexBufferLoader,GltfDracoLoader,GltfTextureLoader,GltfImageLoader,GltfBufferViewLoader,BufferLoader,MetadataSchemaLoader,GltfJsonLoader],i=ResourceCache.cacheEntries,r=[];for(e in i)i.hasOwnProperty(e)&&r.push(i[e]);r.sort((function(e,i){return t.indexOf(e.resourceLoader.constructor)-t.indexOf(i.resourceLoader.constructor)}));for(var n=r.length,a=0;a<n;++a){var o=r[a];defined(i[e=o.resourceLoader.cacheKey])&&(o.resourceLoader.destroy(),delete i[e])}},Object.defineProperties(ImplicitSubtree.prototype,{readyPromise:{get:function(){return this._readyPromise.promise}},metadataTable:{get:function(){return this._metadataTable}},metadataExtension:{get:function(){return this._metadataExtension}},implicitCoordinates:{get:function(){return this._implicitCoordinates}}}),ImplicitSubtree.prototype.tileIsAvailableAtIndex=function(e){return this._tileAvailability.getBit(e)},ImplicitSubtree.prototype.tileIsAvailableAtCoordinates=function(e){var t=this.getTileIndex(e);return this.tileIsAvailableAtIndex(t)},ImplicitSubtree.prototype.contentIsAvailableAtIndex=function(e,t){return t=defaultValue(t,0),this._contentAvailabilityBitstreams[t].getBit(e)},ImplicitSubtree.prototype.contentIsAvailableAtCoordinates=function(e,t){var i=this.getTileIndex(e,t);return this.contentIsAvailableAtIndex(i)},ImplicitSubtree.prototype.childSubtreeIsAvailableAtIndex=function(e){return this._childSubtreeAvailability.getBit(e)},ImplicitSubtree.prototype.childSubtreeIsAvailableAtCoordinates=function(e){var t=this.getChildSubtreeIndex(e);return this.childSubtreeIsAvailableAtIndex(t)},ImplicitSubtree.prototype.getLevelOffset=function(e){var t=this._branchingFactor;return(Math.pow(t,e)-1)/(t-1)},ImplicitSubtree.prototype.getParentMortonIndex=function(e){var t=2;return this._subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE&&(t=3),e>>t},ImplicitSubtree.prototype.getTileIndex=function(e){var t=e.level-this._implicitCoordinates.level;if(t<0||this._subtreeLevels<=t)throw new RuntimeError("level is out of bounds for this subtree");return e.getSubtreeCoordinates().getOffsetCoordinates(e).tileIndex},ImplicitSubtree.prototype.getChildSubtreeIndex=function(e){if(e.level-this._implicitCoordinates.level!==this._implicitCoordinates.subtreeLevels)throw new RuntimeError("level is out of bounds for this subtree");return e.getParentSubtreeCoordinates().getOffsetCoordinates(e).mortonIndex},ImplicitSubtree.prototype.getEntityId=function(e){if(defined(this._metadataTable)){var t=this.getTileIndex(e);return this._tileAvailability.getBit(t)?this._jumpBuffer[t]:void 0}},ImplicitSubtree.prototype.isDestroyed=function(){return!1},ImplicitSubtree.prototype.destroy=function(){return defined(this._bufferLoader)&&ResourceCache.unload(this._bufferLoader),destroyObject(this)},Object.defineProperties(ImplicitTileMetadata.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),ImplicitTileMetadata.prototype.hasProperty=function(e){return this._metadataTable.hasProperty(e)},ImplicitTileMetadata.prototype.hasPropertyBySemantic=function(e){return this._metadataTable.hasPropertyBySemantic(e)},ImplicitTileMetadata.prototype.getPropertyIds=function(e){return this._metadataTable.getPropertyIds(e)},ImplicitTileMetadata.prototype.getProperty=function(e){return this._metadataTable.getProperty(this._entityId,e)},ImplicitTileMetadata.prototype.setProperty=function(e,t){return this._metadataTable.setProperty(this._entityId,e,t)},ImplicitTileMetadata.prototype.getPropertyBySemantic=function(e){return this._metadataTable.getPropertyBySemantic(this._entityId,e)},ImplicitTileMetadata.prototype.setPropertyBySemantic=function(e,t){return this._metadataTable.setPropertyBySemantic(this._entityId,e,t)};var MetadataSemantic={ID:"ID",NAME:"NAME",DESCRIPTION:"DESCRIPTION",TILE_BOUNDING_BOX:"TILE_BOUNDING_BOX",TILE_BOUNDING_REGION:"TILE_BOUNDING_REGION",TILE_BOUNDING_SPHERE:"TILE_BOUNDING_SPHERE",TILE_MINIMUM_HEIGHT:"TILE_MINIMUM_HEIGHT",TILE_MAXIMUM_HEIGHT:"TILE_MAXIMUM_HEIGHT",TILE_HORIZON_OCCLUSION_POINT:"TILE_HORIZON_OCCLUSION_POINT",TILE_GEOMETRIC_ERROR:"TILE_GEOMETRIC_ERROR",CONTENT_BOUNDING_BOX:"CONTENT_BOUNDING_BOX",CONTENT_BOUNDING_REGION:"CONTENT_BOUNDING_REGION",CONTENT_BOUNDING_SPHERE:"CONTENT_BOUNDING_SPHERE",CONTENT_MINIMUM_HEIGHT:"CONTENT_MINIMUM_HEIGHT",CONTENT_MAXIMUM_HEIGHT:"CONTENT_MAXIMUM_HEIGHT",CONTENT_HORIZON_OCCLUSION_POINT:"CONTENT_HORIZON_OCCLUSION_POINT"},MetadataSemantic$1=Object.freeze(MetadataSemantic);function parseBoundingVolumeSemantics(e){return{tile:{boundingVolume:parseBoundingVolume("TILE",e),minimumHeight:parseMinimumHeight("TILE",e),maximumHeight:parseMaximumHeight("TILE",e)},content:{boundingVolume:parseBoundingVolume("CONTENT",e),minimumHeight:parseMinimumHeight("CONTENT",e),maximumHeight:parseMaximumHeight("CONTENT",e)}}}function parseBoundingVolume(e,t){var i=e+"_BOUNDING_BOX",r=t.getPropertyBySemantic(i);if(defined(r))return{box:r};var n=e+"_BOUNDING_REGION",a=t.getPropertyBySemantic(n);if(defined(a))return{region:a};var o=e+"_BOUNDING_SPHERE",s=t.getPropertyBySemantic(o);return defined(s)?{sphere:s}:void 0}function parseMinimumHeight(e,t){var i=e+"_MINIMUM_HEIGHT";return t.getPropertyBySemantic(i)}function parseMaximumHeight(e,t){var i=e+"_MAXIMUM_HEIGHT";return t.getPropertyBySemantic(i)}function Implicit3DTileContent(e,t,i,r,n){var a=t.implicitTileset,o=t.implicitCoordinates;this._implicitTileset=a,this._implicitCoordinates=o,this._implicitSubtree=void 0,this._tileset=e,this._tile=t,this._resource=i,this._readyPromise=when.defer(),this.featurePropertiesDirty=!1,this._groupMetadata=void 0;var s=o.getTemplateValues(),l=a.subtreeUriTemplate.getDerivedResource({templateValues:s});this._url=l.getUrlComponent(!0),initialize$9(this,r,n)}function initialize$9(e,t,i){i=defaultValue(i,0);var r=new Uint8Array(t,i),n=new ImplicitSubtree(e._resource,r,e._implicitTileset,e._implicitCoordinates);e._implicitSubtree=n,n.readyPromise.then((function(){expandSubtree(e,n),e._readyPromise.resolve()})).otherwise((function(t){e._readyPromise.reject(t)}))}function expandSubtree(e,t){var i=e._tile,r=transcodeSubtreeTiles(e,t,i,e._implicitCoordinates.childIndex);i.children.push(r.rootTile);for(var n=listChildSubtrees(e,t,r.bottomRow),a=0;a<n.length;a++){var o=n[a],s=o.tile,l=makePlaceholderChildSubtree(e,s,o.childIndex);s.children.push(l)}}function listChildSubtrees(e,t,i){for(var r=[],n=e._implicitTileset.branchingFactor,a=0;a<i.length;a++){var o=i[a];if(defined(o))for(var s=0;s<n;s++){var l=a*n+s;t.childSubtreeIsAvailableAtIndex(l)&&r.push({tile:o,childIndex:s})}}return r}function transcodeSubtreeTiles(e,t,i,r){for(var n=deriveChildTile(e,t,i,r,0,!0),a=[n],o=[],s=e._implicitTileset,l=1;l<s.subtreeLevels;l++){for(var c=t.getLevelOffset(l),u=s.branchingFactor*a.length,d=0;d<u;d++){var h=c+d;if(t.tileIsAvailableAtIndex(h)){var p=a[t.getParentMortonIndex(d)],f=deriveChildTile(e,t,p,d%s.branchingFactor,h);p.children.push(f),o.push(f)}else o.push(void 0)}a=o,o=[]}return{rootTile:n,bottomRow:a}}function getGeometricError$2(e,t,i){var r=MetadataSemantic$1.TILE_GEOMETRIC_ERROR;return defined(e)&&e.hasPropertyBySemantic(r)?e.getPropertyBySemantic(r):t.geometricError/Math.pow(2,i.level)}function deriveChildTile(e,t,i,r,n,a){var o,s,l,c,u=e._implicitTileset;if(o=defaultValue(a,!1)?i.implicitCoordinates:i.implicitCoordinates.getChildCoordinates(r),defined(t.metadataExtension)){var d=parseBoundingVolumeSemantics(s=new ImplicitTileMetadata({class:t.metadataTable.class,implicitCoordinates:o,implicitSubtree:t}));l=d.tile,c=d.content}for(var h=getTileBoundingVolume(u,o,r,a,i,l),p=[],f=0;f<u.contentCount;f++)if(t.contentIsAvailableAtIndex(n,f)){var m={uri:u.contentUriTemplates[f].getDerivedResource({templateValues:o.getTemplateValues()}).url},g=getContentBoundingVolume$1(h,c);defined(g)&&(m.boundingVolume=g),p.push(combine$2(m,u.contentHeaders[f]))}var _={boundingVolume:h,geometricError:getGeometricError$2(s,u,o),refine:u.refine};1===p.length?_.content=p[0]:p.length>1&&(_.extensions={"3DTILES_multiple_contents":{content:p}});var y=clone$1(u.tileHeader,true);delete y.boundingVolume,delete y.transform;var v=combine$2(_,y,true),C=makeTile$1(e,u.baseResource,v,i);return C.implicitCoordinates=o,C.implicitSubtree=t,C.metadata=s,C}function canUpdateHeights(e,t){return defined(e)&&defined(t)&&(defined(t.minimumHeight)||defined(t.maximumHeight))&&(hasExtension(e,"3DTILES_bounding_volume_S2")||defined(e.region))}function updateHeights$2(e,t){hasExtension(e,"3DTILES_bounding_volume_S2")&&defined(t)?updateS2CellHeights(e.extensions["3DTILES_bounding_volume_S2"],t.minimumHeight,t.maximumHeight):defined(e.region)&&defined(t)&&updateRegionHeights(e.region,t.minimumHeight,t.maximumHeight)}function updateRegionHeights(e,t,i){defined(t)&&(e[4]=t),defined(i)&&(e[5]=i)}function updateS2CellHeights(e,t,i){defined(t)&&(e.minimumHeight=t),defined(i)&&(e.maximumHeight=i)}function getTileBoundingVolume(e,t,i,r,n,a){var o;return updateHeights$2(o=!defined(a)||!defined(a.boundingVolume)||!canUpdateHeights(a.boundingVolume,a)&&canUpdateHeights(e.boundingVolume,a)?deriveBoundingVolume(e,t,i,defaultValue(r,!1),n):a.boundingVolume,a),o}function getContentBoundingVolume$1(e,t){var i;return defined(t)&&(i=t.boundingVolume),canUpdateHeights(i,t)?updateHeights$2(i,t):canUpdateHeights(e,t)&&updateHeights$2(i=clone$1(e,!0),t),i}function deriveBoundingVolume(e,t,i,r,n){var a=e.boundingVolume;return hasExtension(a,"3DTILES_bounding_volume_S2")?deriveBoundingVolumeS2(r,n,i,t.level,t.x,t.y,t.z):defined(a.region)?{region:deriveBoundingRegion(a.region,t.level,t.x,t.y,t.z)}:{box:deriveBoundingBox(a.box,t.level,t.x,t.y,t.z)}}function deriveBoundingVolumeS2(e,t,i,r,n,a,o){var s=t._boundingVolume;if(e)return{extensions:{"3DTILES_bounding_volume_S2":{token:S2Cell.getTokenFromId(s.s2Cell._cellId),minimumHeight:s.minimumHeight,maximumHeight:s.maximumHeight}}};var l,c,u=Number(t._boundingVolume.s2Cell._cellId>>BigInt(61)),d=u%2==0?HilbertOrder.encode2D(r,n,a):HilbertOrder.encode2D(r,a,n),h=S2Cell.fromFacePositionLevel(u,BigInt(d),r);if(defined(o)){var p=(s.maximumHeight+s.minimumHeight)/2;l=i<4?s.minimumHeight:p,c=i<4?p:s.maximumHeight}else l=s.minimumHeight,c=s.maximumHeight;return{extensions:{"3DTILES_bounding_volume_S2":{token:S2Cell.getTokenFromId(h._cellId),minimumHeight:l,maximumHeight:c}}}}Object.defineProperties(Implicit3DTileContent.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._url}},batchTable:{get:function(){}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}});var scratchScaleFactors=new Cartesian3,scratchRootCenter=new Cartesian3,scratchCenter$5=new Cartesian3,scratchHalfAxes$1=new Matrix3;function deriveBoundingBox(e,t,i,r,n){if(0===t)return e;var a=Cartesian3.unpack(e,0,scratchRootCenter),o=Matrix3.unpack(e,3,scratchHalfAxes$1),s=Math.pow(2,-t),l=(2*i+1)*s-1,c=(2*r+1)*s-1,u=0,d=Cartesian3.fromElements(s,s,1,scratchScaleFactors);defined(n)&&(u=(2*n+1)*s-1,d.z=s);var h=Cartesian3.fromElements(l,c,u,scratchCenter$5);h=Matrix3.multiplyByVector(o,h,scratchCenter$5),h=Cartesian3.add(h,a,scratchCenter$5);var p=Matrix3.clone(o);p=Matrix3.multiplyByScale(p,d,p);var f=new Array(12);return Cartesian3.pack(h,f),Matrix3.pack(p,f,3),f}var scratchRectangle$6=new Rectangle;function deriveBoundingRegion(e,t,i,r,n){if(0===t)return e.slice();var a=Rectangle.unpack(e,0,scratchRectangle$6),o=e[4],s=e[5],l=Math.pow(2,-t),c=l*a.width,u=CesiumMath.negativePiToPi(a.west+i*c),d=CesiumMath.negativePiToPi(u+c),h=l*a.height,p=CesiumMath.negativePiToPi(a.south+r*h),f=CesiumMath.negativePiToPi(p+h),m=o,g=s;if(defined(n)){var _=l*(s-o);g=(m+=n*_)+_}return[u,p,d,f,m,g]}function makePlaceholderChildSubtree(e,t,i){var r=e._implicitTileset,n=t.implicitCoordinates.getChildCoordinates(i),a=deriveBoundingVolume(r,n,i,!1,t),o=getGeometricError$2(void 0,r,n),s=r.subtreeUriTemplate.getDerivedResource({templateValues:n.getTemplateValues()}).url,l={boundingVolume:a,geometricError:o,refine:r.refine,content:{uri:s}},c=makeTile$1(e,r.baseResource,l,t);return c.implicitTileset=r,c.implicitCoordinates=n,c}function makeTile$1(e,t,i,r){return new(0,e._tile.constructor)(e._tileset,t,i,r)}function ModelInstance(e,t,i,r){this.primitive=e,this._modelMatrix=Matrix4.clone(t),this._instanceId=i,this._modelId=r}Implicit3DTileContent.prototype.hasProperty=function(e,t){return!1},Implicit3DTileContent.prototype.getFeature=function(e){},Implicit3DTileContent.prototype.applyDebugSettings=function(e,t){},Implicit3DTileContent.prototype.applyStyle=function(e){},Implicit3DTileContent.prototype.update=function(e,t){},Implicit3DTileContent.prototype.isDestroyed=function(){return!1},Implicit3DTileContent.prototype.destroy=function(){return this._implicitSubtree=this._implicitSubtree&&this._implicitSubtree.destroy(),destroyObject(this)},Implicit3DTileContent._deriveBoundingBox=deriveBoundingBox,Implicit3DTileContent._deriveBoundingRegion=deriveBoundingRegion,Implicit3DTileContent._deriveBoundingVolumeS2=deriveBoundingVolumeS2,Object.defineProperties(ModelInstance.prototype,{instanceId:{get:function(){return this._instanceId}},model:{get:function(){return this.primitive._model}},modelId:{get:function(){return this.primitive._modelId}},modelMatrix:{get:function(){return Matrix4.clone(this._modelMatrix)},set:function(e){Matrix4.clone(e,this._modelMatrix),this.primitive.expandBoundingSphere(this._modelMatrix),this.primitive._dirty=!0}}});var LoadState={NEEDS_LOAD:0,LOADING:1,LOADED:2,FAILED:3};function ModelInstanceCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this._instancingSupported=!1,this._dynamic=defaultValue(e.dynamic,!1),this._allowPicking=defaultValue(e.allowPicking,!0),this._ready=!1,this._readyPromise=when.defer(),this._state=LoadState.NEEDS_LOAD,this._dirty=!1,this._cull=defaultValue(e.cull,!0),this._opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._instances=createInstances(this,e.instances),this._batchTable=e.batchTable,this._model=void 0,this._vertexBufferTypedArray=void 0,this._vertexBuffer=void 0,this._batchIdBuffer=void 0,this._instancedUniformsByProgram=void 0,this._drawCommands=[],this._modelCommands=void 0,this._renderStates=void 0,this._disableCullingRenderStates=void 0,this._boundingSphere=createBoundingSphere(this),this._center=Cartesian3.clone(this._boundingSphere.center),this._rtcTransform=new Matrix4,this._rtcModelView=new Matrix4,this._mode=void 0,this.modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._url=Resource.createIfNeeded(e.url),this._requestType=e.requestType,this._gltf=e.gltf,this._basePath=Resource.createIfNeeded(e.basePath),this._asynchronous=e.asynchronous,this._incrementallyLoadTextures=e.incrementallyLoadTextures,this._upAxis=e.upAxis,this._forwardAxis=e.forwardAxis,this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this._shadows=this.shadows,this._pickIdLoaded=e.pickIdLoaded,this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=defaultValue(e.debugWireframe,!1),this._debugWireframe=!1,this._imageBasedLightingFactor=new Cartesian2(1,1),Cartesian2.clone(e.imageBasedLightingFactor,this._imageBasedLightingFactor),this.lightColor=e.lightColor,this.luminanceAtZenith=e.luminanceAtZenith,this.sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,this.specularEnvironmentMaps=e.specularEnvironmentMaps,this.backFaceCulling=defaultValue(e.backFaceCulling,!0),this._backFaceCulling=this.backFaceCulling,this._color=defaultValue(e.color,Cesium.Color.WHITE),this._id=defaultValue(e.id,null)}function createInstances(e,t){for(var i=(t=defaultValue(t,[])).length,r=new Array(i),n=0;n<i;++n){var a=t[n],o=a.modelMatrix,s=defaultValue(a.batchId,n),l=defaultValue(a.modelId);r[n]=new ModelInstance(e,o,s,l)}return r}function createBoundingSphere(e){for(var t=e.length,i=new Array(t),r=0;r<t;++r)i[r]=Matrix4.getTranslation(e._instances[r]._modelMatrix,new Cartesian3);return BoundingSphere.fromPoints(i)}Object.defineProperties(ModelInstanceCollection.prototype,{allowPicking:{get:function(){return this._allowPicking}},length:{get:function(){return this._instances.length}},activeAnimations:{get:function(){return this._model.activeAnimations}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){Cartesian2.clone(e,this._imageBasedLightingFactor)}}});var scratchCartesian$7=new Cartesian3,scratchMatrix$3=new Matrix4;function getCheckUniformSemanticFunction(e,t,i,r){return function(n,a){var o=n.semantic;if(defined(o)&&e.indexOf(o)>-1){if(!(t.indexOf(o)>-1))throw new RuntimeError('Shader program cannot be optimized for instancing. Uniform "'+a+'" in program "'+i+'" uses unsupported semantic "'+o+'"');r[a]=o}}}function getInstancedUniforms(e,t){if(defined(e._instancedUniformsByProgram))return e._instancedUniformsByProgram[t];var i={};e._instancedUniformsByProgram=i;var r=["MODEL","MODELVIEW","CESIUM_RTC_MODELVIEW","MODELVIEWPROJECTION","MODELINVERSE","MODELVIEWINVERSE","MODELVIEWPROJECTIONINVERSE","MODELINVERSETRANSPOSE","MODELVIEWINVERSETRANSPOSE"],n=["MODELVIEW","CESIUM_RTC_MODELVIEW","MODELVIEWPROJECTION","MODELVIEWINVERSETRANSPOSE"],a=e._model._sourceTechniques;for(var o in a)if(a.hasOwnProperty(o)){var s=a[o],l=s.program;if(!defined(i[l])){var c={};i[l]=c,ForEach.techniqueUniform(s,getCheckUniformSemanticFunction(r,n,t,c))}}return i[t]}function getVertexShaderCallback(e){return function(t,i){var r=getInstancedUniforms(e,i),n=defined(e._batchTable),a=ShaderSource.replaceMain(t,"czm_instancing_main"),o="",s="";for(var l in r)if(r.hasOwnProperty(l)){var c,u=r[l];"MODELVIEW"===u||"CESIUM_RTC_MODELVIEW"===u?c="czm_instanced_modelView":"MODELVIEWPROJECTION"===u?(c="czm_instanced_modelViewProjection",o+="mat4 czm_instanced_modelViewProjection;\n",s+="czm_instanced_modelViewProjection = czm_projection * czm_instanced_modelView;\n"):"MODELVIEWINVERSETRANSPOSE"===u&&(c="czm_instanced_modelViewInverseTranspose",o+="mat3 czm_instanced_modelViewInverseTranspose;\n",s+="czm_instanced_modelViewInverseTranspose = mat3(czm_instanced_modelView);\n");var d=new RegExp("uniform.*"+l+".*");a=a.replace(d,""),d=new RegExp(l+"\\b","g"),a=a.replace(d,c)}var h,p,f;n?(h="attribute float a_batchId;\n",p="",f=""):(h="",p="attribute vec4 pickColor;\nvarying vec4 v_pickColor;\n",f=" v_pickColor = pickColor;\n");var m="uniform mat4 czm_instanced_modifiedModelView;\nuniform mat4 czm_instanced_nodeTransform;\n"+o+"mat4 czm_instanced_modelView;\nattribute vec4 czm_modelMatrixRow0;\nattribute vec4 czm_modelMatrixRow1;\nattribute vec4 czm_modelMatrixRow2;\n"+h+p+a+"void main()\n{\n mat4 czm_instanced_model = mat4(czm_modelMatrixRow0.x, czm_modelMatrixRow1.x, czm_modelMatrixRow2.x, 0.0, czm_modelMatrixRow0.y, czm_modelMatrixRow1.y, czm_modelMatrixRow2.y, 0.0, czm_modelMatrixRow0.z, czm_modelMatrixRow1.z, czm_modelMatrixRow2.z, 0.0, czm_modelMatrixRow0.w, czm_modelMatrixRow1.w, czm_modelMatrixRow2.w, 1.0);\n czm_instanced_modelView = czm_instanced_modifiedModelView * czm_instanced_model * czm_instanced_nodeTransform;\n"+s+" czm_instancing_main();\n"+f+"}\n";if(n){var g=e._model.gltf,_=ModelUtility.getDiffuseAttributeOrUniform(g,i);m=e._batchTable.getVertexShaderCallback(!0,"a_batchId",_)(m)}return m}}function getFragmentShaderCallback(e){return function(t,i){var r=e._batchTable;if(defined(r)){var n=e._model.gltf,a=ModelUtility.getDiffuseAttributeOrUniform(n,i);t=r.getFragmentShaderCallback(!0,a,!1)(t)}else t="varying vec4 v_pickColor;\n"+t;return t}}function createModifiedModelView(e,t){return function(){return Matrix4.multiply(t.uniformState.view,e._rtcTransform,e._rtcModelView)}}function createNodeTransformFunction(e){return function(){return e.computedMatrix}}function getUniformMapCallback(e,t){return function(i,r,n){(i=clone$1(i)).czm_instanced_modifiedModelView=createModifiedModelView(e,t),i.czm_instanced_nodeTransform=createNodeTransformFunction(n);var a=getInstancedUniforms(e,r);for(var o in a)a.hasOwnProperty(o)&&delete i[o];return defined(e._batchTable)&&(i=e._batchTable.getUniformMapCallback()(i)),i}}function getVertexShaderNonInstancedCallback(e){return function(t,i){if(defined(e._batchTable)){var r=e._model.gltf,n=ModelUtility.getDiffuseAttributeOrUniform(r,i);t="uniform float a_batchId\n;"+(t=e._batchTable.getVertexShaderCallback(!0,"a_batchId",n)(t))}return t}}function getFragmentShaderNonInstancedCallback(e){return function(t,i){var r=e._batchTable;if(defined(r)){var n=e._model.gltf,a=ModelUtility.getDiffuseAttributeOrUniform(n,i);t=r.getFragmentShaderCallback(!0,a,!1)(t)}else t="uniform vec4 czm_pickColor;\n"+t;return t}}function getUniformMapNonInstancedCallback(e){return function(t){return defined(e._batchTable)&&(t=e._batchTable.getUniformMapCallback()(t)),t}}function getVertexBufferTypedArray(e){var t=e._instances,i=e.length,r=e._center,n=e._vertexBufferTypedArray;defined(n)||(n=new Float32Array(12*i)),e._dynamic&&(e._vertexBufferTypedArray=n);for(var a=0;a<i;++a){var o=t[a]._modelMatrix,s=Matrix4.clone(o,scratchMatrix$3);s[12]-=r.x,s[13]-=r.y,s[14]-=r.z;var l=12*a;n[l+0]=s[0],n[l+1]=s[4],n[l+2]=s[8],n[l+3]=s[12],n[l+4]=s[1],n[l+5]=s[5],n[l+6]=s[9],n[l+7]=s[13],n[l+8]=s[2],n[l+9]=s[6],n[l+10]=s[10],n[l+11]=s[14]}return n}function createVertexBuffer(e,t){var i,r=e._instances,n=e.length,a=e._dynamic,o=defined(e._batchTable);if(o){var s=new Uint16Array(n);for(i=0;i<n;++i)s[i]=r[i]._instanceId;e._batchIdBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:s,usage:BufferUsage$1.STATIC_DRAW})}if(!o){var l=new Uint8Array(4*n);for(i=0;i<n;++i){var c=e._pickIds[i].color,u=4*i;l[u]=Color.floatToByte(c.red),l[u+1]=Color.floatToByte(c.green),l[u+2]=Color.floatToByte(c.blue),l[u+3]=Color.floatToByte(c.alpha)}e._pickIdBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:l,usage:BufferUsage$1.STATIC_DRAW})}var d=getVertexBufferTypedArray(e);e._vertexBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:d,usage:a?BufferUsage$1.STREAM_DRAW:BufferUsage$1.STATIC_DRAW})}function updateVertexBuffer(e){var t=getVertexBufferTypedArray(e);e._vertexBuffer.copyFromArrayView(t)}function createPickIds(e,t){for(var i=e._instances,r=i.length,n=new Array(r),a=0;a<r;++a)n[a]=t.createPickId(i[a]);return n}function createModel$1(e,t){var i=e._instancingSupported,r=defined(e._batchTable),n=e._allowPicking,a={url:e._url,requestType:e._requestType,gltf:e._gltf,basePath:e._basePath,shadows:e._shadows,cacheKey:void 0,asynchronous:e._asynchronous,allowPicking:n,incrementallyLoadTextures:e._incrementallyLoadTextures,upAxis:e._upAxis,forwardAxis:e._forwardAxis,precreatedAttributes:void 0,vertexShaderLoaded:void 0,fragmentShaderLoaded:void 0,uniformMapLoaded:void 0,pickIdLoaded:e._pickIdLoaded,ignoreCommands:!0,opaquePass:e._opaquePass,imageBasedLightingFactor:e.imageBasedLightingFactor,lightColor:e.lightColor,luminanceAtZenith:e.luminanceAtZenith,sphericalHarmonicCoefficients:e.sphericalHarmonicCoefficients,specularEnvironmentMaps:e.specularEnvironmentMaps,showOutline:e.showOutline,id:e._id,color:e._color};if(r||(e._pickIds=createPickIds(e,t)),i){createVertexBuffer(e,t);var o=ComponentDatatype$1.getSizeInBytes(ComponentDatatype$1.FLOAT),s={czm_modelMatrixRow0:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:12*o,instanceDivisor:1},czm_modelMatrixRow1:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:4*o,strideInBytes:12*o,instanceDivisor:1},czm_modelMatrixRow2:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:8*o,strideInBytes:12*o,instanceDivisor:1}};r&&(s.a_batchId={index:0,vertexBuffer:e._batchIdBuffer,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0,instanceDivisor:1}),r||(s.pickColor={index:0,vertexBuffer:e._pickIdBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1}),a.precreatedAttributes=s,a.vertexShaderLoaded=getVertexShaderCallback(e),a.fragmentShaderLoaded=getFragmentShaderCallback(e),a.uniformMapLoaded=getUniformMapCallback(e,t),defined(e._url)&&(a.cacheKey=e._url.getUrlComponent()+"#instanced")}else a.vertexShaderLoaded=getVertexShaderNonInstancedCallback(e),a.fragmentShaderLoaded=getFragmentShaderNonInstancedCallback(e),a.uniformMapLoaded=getUniformMapNonInstancedCallback(e);defined(e._url)?e._model=Model.fromGltf(a):e._model=new Model(a)}function updateWireframe(e,t){if(e._debugWireframe!==e.debugWireframe||t){e._debugWireframe=e.debugWireframe;for(var i=e.debugWireframe?PrimitiveType$1.LINES:PrimitiveType$1.TRIANGLES,r=e._drawCommands,n=r.length,a=0;a<n;++a)r[a].primitiveType=i}}function getDisableCullingRenderState(e){var t=clone$1(e,!0);return t.cull.enabled=!1,RenderState.fromCache(t)}function updateBackFaceCulling(e,t){if(e._backFaceCulling!==e.backFaceCulling||t){e._backFaceCulling=e.backFaceCulling;var i,r=e._drawCommands,n=r.length;if(!defined(e._disableCullingRenderStates))for(e._disableCullingRenderStates=new Array(n),e._renderStates=new Array(n),i=0;i<n;++i){var a=r[i].renderState,o=getDisableCullingRenderState(a);e._disableCullingRenderStates[i]=o,e._renderStates[i]=a}for(i=0;i<n;++i)r[i].renderState=e._backFaceCulling?e._renderStates[i]:e._disableCullingRenderStates[i]}}function updateShowBoundingVolume$1(e,t){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume||t){e._debugShowBoundingVolume=e.debugShowBoundingVolume;for(var i=e._drawCommands,r=i.length,n=0;n<r;++n)i[n].debugShowBoundingVolume=e.debugShowBoundingVolume}}function createCommands$2(e,t){for(var i=t.length,r=e.length,n=e._boundingSphere,a=e._cull,o=0;o<i;++o){var s=DrawCommand.shallowClone(t[o]);s.instanceCount=r,s.boundingVolume=n,s.cull=a,defined(e._batchTable)?s.pickId=e._batchTable.getPickId():s.pickId="v_pickColor",e._drawCommands.push(s)}}function createBatchIdFunction(e){return function(){return e}}function createPickColorFunction(e){return function(){return e}}function createCommandsNonInstanced(e,t){for(var i=e._instances,r=t.length,n=e.length,a=defined(e._batchTable),o=e._cull,s=0;s<r;++s)for(var l=0;l<n;++l){var c=DrawCommand.shallowClone(t[s]);if(c.modelMatrix=new Matrix4,c.boundingVolume=new BoundingSphere,c.cull=o,c.uniformMap=clone$1(c.uniformMap),a)c.uniformMap.a_batchId=createBatchIdFunction(i[l]._instanceId);else{var u=e._pickIds[l];c.uniformMap.czm_pickColor=createPickColorFunction(u.color)}e._drawCommands.push(c)}}function updateCommandsNonInstanced(e){for(var t=e._modelCommands,i=t.length,r=e.length,n=e._rtcTransform,a=e._center,o=0;o<i;++o)for(var s=t[o],l=0;l<r;++l){var c=o*r+l,u=e._drawCommands[c],d=Matrix4.clone(e._instances[l]._modelMatrix,scratchMatrix$3);d[12]-=a.x,d[13]-=a.y,d[14]-=a.z,d=Matrix4.multiply(n,d,scratchMatrix$3);var h=s.modelMatrix,p=u.modelMatrix;Matrix4.multiply(d,h,p);var f=s.boundingVolume,m=u.boundingVolume;BoundingSphere.transform(f,d,m)}}function getModelCommands(e){for(var t=e._nodeCommands,i=t.length,r=[],n=0;n<i;++n){var a=t[n];a.show&&r.push(a.command)}return r}function commandsDirty(e){for(var t=e._nodeCommands,i=t.length,r=!1,n=0;n<i;n++){var a=t[n];a.command.dirty&&(a.command.dirty=!1,r=!0)}return r}function generateModelCommands(e,t){e._drawCommands=[];var i=getModelCommands(e._model);t?createCommands$2(e,i):(createCommandsNonInstanced(e,i),updateCommandsNonInstanced(e))}function updateShadows(e,t){if(e.shadows!==e._shadows||t){e._shadows=e.shadows;for(var i=ShadowMode$1.castShadows(e.shadows),r=ShadowMode$1.receiveShadows(e.shadows),n=e._drawCommands,a=n.length,o=0;o<a;++o){var s=n[o];s.castShadows=i,s.receiveShadows=r}}}function Instanced3DModel3DTileContent(e,t,i,r,n){this._tileset=e,this._tile=t,this._resource=i,this._modelInstanceCollection=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._groupMetadata=void 0,initialize$8(this,r,n)}function getPickIdCallback(e){return function(){return e._batchTable.getPickId()}}ModelInstanceCollection.prototype.expandBoundingSphere=function(e){var t=Matrix4.getTranslation(e,scratchCartesian$7);BoundingSphere.expand(this._boundingSphere,t,this._boundingSphere)},ModelInstanceCollection.prototype.update=function(e){if(e.mode!==SceneMode$1.MORPHING&&this.show&&0!==this.length){var t=e.context;if(this._state===LoadState.NEEDS_LOAD){this._state=LoadState.LOADING,this._instancingSupported=t.instancedArrays,createModel$1(this,t);var i=this;this._model.readyPromise.otherwise((function(e){i._state=LoadState.FAILED,i._readyPromise.reject(e)}))}var r=this._instancingSupported,n=this._model;if(n.imageBasedLightingFactor=this.imageBasedLightingFactor,n.lightColor=this.lightColor,n.luminanceAtZenith=this.luminanceAtZenith,n.sphericalHarmonicCoefficients=this.sphericalHarmonicCoefficients,n.specularEnvironmentMaps=this.specularEnvironmentMaps,n.update(e),n.ready&&this._state===LoadState.LOADING){this._state=LoadState.LOADED,this._ready=!0;var a=n.boundingSphere.radius+Cartesian3.magnitude(n.boundingSphere.center);return this._boundingSphere.radius+=a,this._modelCommands=getModelCommands(n),generateModelCommands(this,r),void this._readyPromise.resolve(this)}if(this._state===LoadState.LOADED){var o=e.mode!==this._mode,s=this.modelMatrix,l=!Matrix4.equals(this._modelMatrix,s);if(o||l){this._mode=e.mode,Matrix4.clone(s,this._modelMatrix);var c=Matrix4.multiplyByTranslation(this._modelMatrix,this._center,this._rtcTransform);this._mode!==SceneMode$1.SCENE3D&&(c=Transforms.basisTo2D(e.mapProjection,c,c)),Matrix4.getTranslation(c,this._boundingSphere.center)}r&&this._dirty&&(this._dynamic=!0,this._dirty=!1,updateVertexBuffer(this));var u=commandsDirty(n);u&&generateModelCommands(this,r),!r&&(n.dirty||this._dirty||o||l)&&updateCommandsNonInstanced(this),updateShadows(this,u),updateWireframe(this,u),updateBackFaceCulling(this,u),updateShowBoundingVolume$1(this,u);var d=e.passes;if(d.render||d.pick)for(var h=e.commandList,p=this._drawCommands,f=p.length,m=0;m<f;++m)h.push(p[m])}}},ModelInstanceCollection.prototype.isDestroyed=function(){return!1},ModelInstanceCollection.prototype.destroy=function(){this._model=this._model&&this._model.destroy();var e=this._pickIds;if(defined(e))for(var t=e.length,i=0;i<t;++i)e[i].destroy();return destroyObject(this)},Instanced3DModel3DTileContent._deprecationWarning=deprecationWarning,Object.defineProperties(Instanced3DModel3DTileContent.prototype,{featuresLength:{get:function(){return this._batchTable.featuresLength}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){var e=this._modelInstanceCollection._model;return defined(e)?e.trianglesLength:0}},geometryByteLength:{get:function(){var e=this._modelInstanceCollection._model;return defined(e)?e.geometryByteLength:0}},texturesByteLength:{get:function(){var e=this._modelInstanceCollection._model;return defined(e)?e.texturesByteLength:0}},batchTableByteLength:{get:function(){return this._batchTable.memorySizeInBytes}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._modelInstanceCollection.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}});var sizeOfUint32$2=Uint32Array.BYTES_PER_ELEMENT,propertyScratch1=new Array(4),propertyScratch2=new Array(4);function initialize$8(e,t,i){var r=defaultValue(i,0);i=r;var n=new Uint8Array(t),a=new DataView(t);i+=sizeOfUint32$2;var o=a.getUint32(i,!0);if(1!==o)throw new RuntimeError("Only Instanced 3D Model version 1 is supported. Version "+o+" is not.");i+=sizeOfUint32$2;var s=a.getUint32(i,!0);i+=sizeOfUint32$2;var l=a.getUint32(i,!0);if(0===l)throw new RuntimeError("featureTableJsonByteLength is zero, the feature table must be defined.");i+=sizeOfUint32$2;var c=a.getUint32(i,!0);i+=sizeOfUint32$2;var u=a.getUint32(i,!0);i+=sizeOfUint32$2;var d=a.getUint32(i,!0);i+=sizeOfUint32$2;var h=a.getUint32(i,!0);if(1!==h&&0!==h)throw new RuntimeError("Only glTF format 0 (uri) or 1 (embedded) are supported. Format "+h+" is not.");var p=getJsonFromTypedArray(n,i+=sizeOfUint32$2,l);i+=l;var f=new Uint8Array(t,i,c);i+=c;var m,g,_=new Cesium3DTileFeatureTable(p,f),y=_.getGlobalProperty("INSTANCES_LENGTH");if(_.featuresLength=y,!defined(y))throw new RuntimeError("Feature table global property: INSTANCES_LENGTH must be defined");u>0&&(m=getJsonFromTypedArray(n,i,u),i+=u,d>0&&(g=new Uint8Array(t,i,d),g=new Uint8Array(g),i+=d)),e._batchTable=new Cesium3DTileBatchTable(e,y,m,g);var v,C=r+s-i;if(0===C)throw new RuntimeError("glTF byte length is zero, i3dm must have a glTF to instance.");i%4==0?v=new Uint8Array(t,i,C):(Instanced3DModel3DTileContent._deprecationWarning("i3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),v=new Uint8Array(n.subarray(i,i+C)));var T=e._tileset,S={instances:new Array(y),batchTable:e._batchTable,cull:!1,url:void 0,requestType:RequestType$1.TILES3D,gltf:void 0,basePath:void 0,incrementallyLoadTextures:!1,upAxis:T._gltfUpAxis,forwardAxis:Axis$1.X,opaquePass:Pass$1.CESIUM_3D_TILE,pickIdLoaded:getPickIdCallback(e),imageBasedLightingFactor:T.imageBasedLightingFactor,lightColor:T.lightColor,luminanceAtZenith:T.luminanceAtZenith,sphericalHarmonicCoefficients:T.sphericalHarmonicCoefficients,specularEnvironmentMaps:T.specularEnvironmentMaps,backFaceCulling:T.backFaceCulling,showOutline:T.showOutline};if(0===h){var A=getStringFromTypedArray(v);A=A.replace(/[\s\0]+$/,""),S.url=e._resource.getDerivedResource({url:A})}else S.gltf=v,S.basePath=e._resource.clone();var x,E=_.getGlobalProperty("EAST_NORTH_UP"),b=_.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(b)&&(x=Cartesian3.unpack(b));for(var P=S.instances,D=new Cartesian3,w=new Array(3),M=new Cartesian3,I=new Cartesian3,R=new Cartesian3,O=new Matrix3,B=new Quaternion,L=new Cartesian3,F=new TranslationRotationScale,N=new Matrix4,V=0;V<y;V++){var k=_.getProperty("POSITION",ComponentDatatype$1.FLOAT,3,V,propertyScratch1);if(!defined(k)){k=w;var U=_.getProperty("POSITION_QUANTIZED",ComponentDatatype$1.UNSIGNED_SHORT,3,V,propertyScratch1);if(!defined(U))throw new RuntimeError("Either POSITION or POSITION_QUANTIZED must be defined for each instance.");var G=_.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ComponentDatatype$1.FLOAT,3);if(!defined(G))throw new RuntimeError("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");var $=_.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ComponentDatatype$1.FLOAT,3);if(!defined($))throw new RuntimeError("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");for(var z=0;z<3;z++)k[z]=U[z]/65535*$[z]+G[z]}Cartesian3.unpack(k,0,D),defined(x)&&Cartesian3.add(D,x,D),F.translation=D;var H=_.getProperty("NORMAL_UP",ComponentDatatype$1.FLOAT,3,V,propertyScratch1),W=_.getProperty("NORMAL_RIGHT",ComponentDatatype$1.FLOAT,3,V,propertyScratch2),j=!1;if(defined(H)){if(!defined(W))throw new RuntimeError("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");Cartesian3.unpack(H,0,I),Cartesian3.unpack(W,0,M),j=!0}else{var q=_.getProperty("NORMAL_UP_OCT32P",ComponentDatatype$1.UNSIGNED_SHORT,2,V,propertyScratch1),X=_.getProperty("NORMAL_RIGHT_OCT32P",ComponentDatatype$1.UNSIGNED_SHORT,2,V,propertyScratch2);if(defined(q)){if(!defined(X))throw new RuntimeError("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");AttributeCompression.octDecodeInRange(q[0],q[1],65535,I),AttributeCompression.octDecodeInRange(X[0],X[1],65535,M),j=!0}else E?(Transforms.eastNorthUpToFixedFrame(D,Ellipsoid.WGS84,N),Matrix4.getMatrix3(N,O)):Matrix3.clone(Matrix3.IDENTITY,O)}j&&(Cartesian3.cross(M,I,R),Cartesian3.normalize(R,R),Matrix3.setColumn(O,0,M,O),Matrix3.setColumn(O,1,I,O),Matrix3.setColumn(O,2,R,O)),Quaternion.fromRotationMatrix(O,B),F.rotation=B,L=Cartesian3.fromElements(1,1,1,L);var Y=_.getProperty("SCALE",ComponentDatatype$1.FLOAT,1,V);defined(Y)&&Cartesian3.multiplyByScalar(L,Y,L);var K=_.getProperty("SCALE_NON_UNIFORM",ComponentDatatype$1.FLOAT,3,V,propertyScratch1);defined(K)&&(L.x*=K[0],L.y*=K[1],L.z*=K[2]),F.scale=L;var J=_.getProperty("BATCH_ID",ComponentDatatype$1.UNSIGNED_SHORT,1,V);defined(J)||(J=V),Matrix4.fromTranslationRotationScale(F,N);var Q=N.clone();P[V]={modelMatrix:Q,batchId:J}}e._modelInstanceCollection=new ModelInstanceCollection(S),e._modelInstanceCollection.readyPromise.then((function(e){e.activeAnimations.addAll({loop:ModelAnimationLoop$1.REPEAT})}))}function createFeatures$2(e){var t=e.featuresLength;if(!defined(e._features)&&t>0){for(var i=new Array(t),r=0;r<t;++r)i[r]=new Cesium3DTileFeature(e,r);e._features=i}}Instanced3DModel3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Instanced3DModel3DTileContent.prototype.getFeature=function(e){return this.featuresLength,createFeatures$2(this),this._features[e]},Instanced3DModel3DTileContent.prototype.applyDebugSettings=function(e,t){t=e?t:Color.WHITE,this._batchTable.setAllColor(t)},Instanced3DModel3DTileContent.prototype.applyStyle=function(e){this._batchTable.applyStyle(e)},Instanced3DModel3DTileContent.prototype.update=function(e,t){var i=t.commandList.length;this._batchTable.update(e,t),this._modelInstanceCollection.modelMatrix=this._tile.computedTransform,this._modelInstanceCollection.shadows=this._tileset.shadows,this._modelInstanceCollection.lightColor=this._tileset.lightColor,this._modelInstanceCollection.luminanceAtZenith=this._tileset.luminanceAtZenith,this._modelInstanceCollection.sphericalHarmonicCoefficients=this._tileset.sphericalHarmonicCoefficients,this._modelInstanceCollection.specularEnvironmentMaps=this._tileset.specularEnvironmentMaps,this._modelInstanceCollection.backFaceCulling=this._tileset.backFaceCulling,this._modelInstanceCollection.debugWireframe=this._tileset.debugWireframe;var r=this._modelInstanceCollection._model;if(defined(r)){var n=this._tileset.clippingPlanes;r.referenceMatrix=this._tileset.clippingPlanesOriginMatrix,defined(n)&&this._tile.clippingPlanesDirty&&(r._clippingPlanes=n.enabled&&this._tile._isClipped?n:void 0),defined(n)&&defined(r._clippingPlanes)&&r._clippingPlanes!==n&&(r._clippingPlanes=n)}this._modelInstanceCollection.update(t),i<t.commandList.length&&(t.passes.render||t.passes.pick)&&this._batchTable.addDerivedCommands(t,i,!1)},Instanced3DModel3DTileContent.prototype.isDestroyed=function(){return!1},Instanced3DModel3DTileContent.prototype.destroy=function(){return this._modelInstanceCollection=this._modelInstanceCollection&&this._modelInstanceCollection.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)};var Cesium3DTileRefine={ADD:0,REPLACE:1},Cesium3DTileRefine$1=Object.freeze(Cesium3DTileRefine),DecodingState={NEEDS_DECODE:0,DECODING:1,READY:2,FAILED:3};function PointCloud(e){this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=Color.clone(Color.DARKGRAY),this._highlightColor=Color.clone(Color.WHITE),this._pointSize=1,this._rtcCenter=void 0,this._quantizedVolumeScale=void 0,this._quantizedVolumeOffset=void 0,this._styleableShaderAttributes=void 0,this._isQuantized=!1,this._isOctEncoded16P=!1,this._isRGB565=!1,this._hasColors=!1,this._hasNormals=!1,this._hasBatchIds=!1,this._decodingState=DecodingState.READY,this._dequantizeInShader=!0,this._isQuantizedDraco=!1,this._isOctEncodedDraco=!1,this._quantizedRange=0,this._octEncodedRange=0,this.backFaceCulling=!1,this._backFaceCulling=!1,this.normalShading=!0,this._normalShading=!0,this._opaqueRenderState=void 0,this._translucentRenderState=void 0,this._mode=void 0,this._ready=!1,this._readyPromise=when.defer(),this._pointsLength=0,this._geometryByteLength=0,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._batchTableLoaded=e.batchTableLoaded,this._pickIdLoaded=e.pickIdLoaded,this._opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._cull=defaultValue(e.cull,!0),this.style=void 0,this._style=void 0,this.styleDirty=!1,this.modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.time=0,this.shadows=ShadowMode$1.ENABLED,this._boundingSphere=void 0,this.clippingPlanes=void 0,this.isClipped=!1,this.clippingPlanesDirty=!1,this.clippingPlanesOriginMatrix=void 0,this.attenuation=!1,this._attenuation=!1,this.geometricError=0,this.geometricErrorScale=1,this.maximumAttenuation=this._pointSize,initialize$7(this,e)}Object.defineProperties(PointCloud.prototype,{pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},color:{get:function(){return Color.clone(this._highlightColor)},set:function(e){this._highlightColor=Color.clone(e,this._highlightColor)}},boundingSphere:{get:function(){if(defined(this._drawCommand))return this._drawCommand.boundingVolume},set:function(e){this._boundingSphere=BoundingSphere.clone(e,this._boundingSphere)}}});var sizeOfUint32$1=Uint32Array.BYTES_PER_ELEMENT;function initialize$7(e,t){var i=t.arrayBuffer,r=defaultValue(t.byteOffset,0),n=new Uint8Array(i),a=new DataView(i);r+=sizeOfUint32$1;var o=a.getUint32(r,!0);if(1!==o)throw new RuntimeError("Only Point Cloud tile version 1 is supported. Version "+o+" is not.");r+=sizeOfUint32$1,r+=sizeOfUint32$1;var s=a.getUint32(r,!0);if(0===s)throw new RuntimeError("Feature table must have a byte length greater than zero");r+=sizeOfUint32$1;var l=a.getUint32(r,!0);r+=sizeOfUint32$1;var c=a.getUint32(r,!0);r+=sizeOfUint32$1;var u=a.getUint32(r,!0),d=getJsonFromTypedArray(n,r+=sizeOfUint32$1,s);r+=s;var h,p,f=new Uint8Array(i,r,l);r+=l,c>0&&(h=getJsonFromTypedArray(n,r,c),r+=c,u>0&&(p=new Uint8Array(i,r,u),r+=u));var m=new Cesium3DTileFeatureTable(d,f),g=m.getGlobalProperty("POINTS_LENGTH");if(m.featuresLength=g,!defined(g))throw new RuntimeError("Feature table global property: POINTS_LENGTH must be defined");var _,y,v,C,T=m.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(T)&&(e._rtcCenter=Cartesian3.unpack(T));var S,A,x,E,b,P=!1,D=!1,w=!1,M=!1,I=!1,R=!1,O=!1,B=!1,L=defined(d.extensions)?d.extensions["3DTILES_draco_point_compression"]:void 0,F=defined(h)&&defined(h.extensions)?h.extensions["3DTILES_draco_point_compression"]:void 0;if(defined(F)&&(x=F.properties),defined(L)){A=L.properties;var N=L.byteOffset,V=L.byteLength;if(!defined(A)||!defined(N)||!defined(V))throw new RuntimeError("Draco properties, byteOffset, and byteLength must be defined");S=arraySlice(f,N,N+V),P=defined(A.POSITION),D=defined(A.RGB)||defined(A.RGBA),w=defined(A.NORMAL),M=defined(A.BATCH_ID),R=defined(A.RGBA),e._decodingState=DecodingState.NEEDS_DECODE}if(defined(S)&&(E={buffer:S,featureTableProperties:A,batchTableProperties:x,properties:combine$2(A,x),dequantizeInShader:e._dequantizeInShader}),!P)if(defined(d.POSITION))_=m.getPropertyArray("POSITION",ComponentDatatype$1.FLOAT,3),P=!0;else if(defined(d.POSITION_QUANTIZED)){_=m.getPropertyArray("POSITION_QUANTIZED",ComponentDatatype$1.UNSIGNED_SHORT,3),I=!0,P=!0;var k=m.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ComponentDatatype$1.FLOAT,3);if(!defined(k))throw new RuntimeError("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");e._quantizedVolumeScale=Cartesian3.unpack(k),e._quantizedRange=65535;var U=m.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ComponentDatatype$1.FLOAT,3);if(!defined(U))throw new RuntimeError("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e._quantizedVolumeOffset=Cartesian3.unpack(U)}if(D||(defined(d.RGBA)?(y=m.getPropertyArray("RGBA",ComponentDatatype$1.UNSIGNED_BYTE,4),R=!0,D=!0):defined(d.RGB)?(y=m.getPropertyArray("RGB",ComponentDatatype$1.UNSIGNED_BYTE,3),D=!0):defined(d.RGB565)&&(y=m.getPropertyArray("RGB565",ComponentDatatype$1.UNSIGNED_SHORT,1),O=!0,D=!0)),w||(defined(d.NORMAL)?(v=m.getPropertyArray("NORMAL",ComponentDatatype$1.FLOAT,3),w=!0):defined(d.NORMAL_OCT16P)&&(v=m.getPropertyArray("NORMAL_OCT16P",ComponentDatatype$1.UNSIGNED_BYTE,2),B=!0,w=!0)),M||defined(d.BATCH_ID)&&(C=m.getPropertyArray("BATCH_ID",ComponentDatatype$1.UNSIGNED_SHORT,1),M=!0),!P)throw new RuntimeError("Either POSITION or POSITION_QUANTIZED must be defined.");if(defined(d.CONSTANT_RGBA)){var G=m.getGlobalProperty("CONSTANT_RGBA",ComponentDatatype$1.UNSIGNED_BYTE,4);e._constantColor=Color.fromBytes(G[0],G[1],G[2],G[3],e._constantColor)}if(M){var $=m.getGlobalProperty("BATCH_LENGTH");if(!defined($))throw new RuntimeError("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");defined(p)&&(p=new Uint8Array(p)),defined(e._batchTableLoaded)&&e._batchTableLoaded($,h,p)}!M&&defined(p)&&(b=Cesium3DTileBatchTable.getBinaryProperties(g,h,p)),e._parsedContent={positions:_,colors:y,normals:v,batchIds:C,styleableProperties:b,draco:E},e._pointsLength=g,e._isQuantized=I,e._isOctEncoded16P=B,e._isRGB565=O,e._isTranslucent=R,e._hasColors=D,e._hasNormals=w,e._hasBatchIds=M}var scratchMin$1=new Cartesian3,scratchMax$1=new Cartesian3,scratchPosition$6=new Cartesian3,randomValues;function getRandomValues(e){if(!defined(randomValues)){CesiumMath.setRandomNumberSeed(0),randomValues=new Array(e);for(var t=0;t<e;++t)randomValues[t]=CesiumMath.nextRandomNumber()}return randomValues}function computeApproximateBoundingSphereFromPositions(e){for(var t=e.length/3,i=Math.min(t,20),r=getRandomValues(20),n=Number.MAX_VALUE,a=-Number.MAX_VALUE,o=Cartesian3.fromElements(n,n,n,scratchMin$1),s=Cartesian3.fromElements(a,a,a,scratchMax$1),l=0;l<i;++l){var c=Math.floor(r[l]*t),u=Cartesian3.unpack(e,3*c,scratchPosition$6);Cartesian3.minimumByComponent(o,u,o),Cartesian3.maximumByComponent(s,u,s)}var d=BoundingSphere.fromCornerPoints(o,s);return d.radius+=CesiumMath.EPSILON2,d}function prepareVertexAttribute(e,t){var i=ComponentDatatype$1.fromTypedArray(e);return i===ComponentDatatype$1.INT||i===ComponentDatatype$1.UNSIGNED_INT||i===ComponentDatatype$1.DOUBLE?(oneTimeWarning("Cast pnts property to floats",'Point cloud property "'+t+'" will be casted to a float array because INT, UNSIGNED_INT, and DOUBLE are not valid WebGL vertex attribute types. Some precision may be lost.'),new Float32Array(e)):e}var scratchPointSizeAndTimeAndGeometricErrorAndDepthMultiplier=new Cartesian4,scratchQuantizedVolumeScaleAndOctEncodedRange=new Cartesian4,scratchColor$j=new Color,positionLocation=0,colorLocation=1,normalLocation=2,batchIdLocation=3,numberOfAttributes=4,scratchClippingPlanesMatrix$1=new Matrix4,scratchInverseTransposeClippingPlanesMatrix$1=new Matrix4;function createResources$4(e,t){var i,r,n=t.context,a=e._parsedContent,o=e._pointsLength,s=a.positions,l=a.colors,c=a.normals,u=a.batchIds,d=a.styleableProperties,h=defined(d),p=e._isQuantized,f=e._isQuantizedDraco,m=e._isOctEncoded16P,g=e._isOctEncodedDraco,_=e._quantizedRange,y=e._octEncodedRange,v=e._isRGB565,C=e._isTranslucent,T=e._hasColors,S=e._hasNormals,A=e._hasBatchIds,x=[],E={};if(e._styleableShaderAttributes=E,h){var b=numberOfAttributes;for(var P in d)if(d.hasOwnProperty(P)){var D=d[P],w=prepareVertexAttribute(D.typedArray,P);i=D.componentCount,r=ComponentDatatype$1.fromTypedArray(w);var M=Buffer$1.createVertexBuffer({context:n,typedArray:w,usage:BufferUsage$1.STATIC_DRAW});e._geometryByteLength+=M.sizeInBytes;var I={index:b,vertexBuffer:M,componentsPerAttribute:i,componentDatatype:r,normalize:!1,offsetInBytes:0,strideInBytes:0};x.push(I),E[P]={location:b,componentCount:i},++b}}var R,O,B,L=Buffer$1.createVertexBuffer({context:n,typedArray:s,usage:BufferUsage$1.STATIC_DRAW});e._geometryByteLength+=L.sizeInBytes,T&&(R=Buffer$1.createVertexBuffer({context:n,typedArray:l,usage:BufferUsage$1.STATIC_DRAW}),e._geometryByteLength+=R.sizeInBytes),S&&(O=Buffer$1.createVertexBuffer({context:n,typedArray:c,usage:BufferUsage$1.STATIC_DRAW}),e._geometryByteLength+=O.sizeInBytes),A&&(u=prepareVertexAttribute(u,"batchIds"),B=Buffer$1.createVertexBuffer({context:n,typedArray:u,usage:BufferUsage$1.STATIC_DRAW}),e._geometryByteLength+=B.sizeInBytes);var F=[];if(r=p?ComponentDatatype$1.UNSIGNED_SHORT:f?_<=255?ComponentDatatype$1.UNSIGNED_BYTE:ComponentDatatype$1.UNSIGNED_SHORT:ComponentDatatype$1.FLOAT,F.push({index:positionLocation,vertexBuffer:L,componentsPerAttribute:3,componentDatatype:r,normalize:!1,offsetInBytes:0,strideInBytes:0}),e._cull&&(e._boundingSphere=p||f?BoundingSphere.fromCornerPoints(Cartesian3.ZERO,e._quantizedVolumeScale):computeApproximateBoundingSphereFromPositions(s)),T)if(v)F.push({index:colorLocation,vertexBuffer:R,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0});else{var N=C?4:3;F.push({index:colorLocation,vertexBuffer:R,componentsPerAttribute:N,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0})}S&&(m?(i=2,r=ComponentDatatype$1.UNSIGNED_BYTE):g?(i=2,r=y<=255?ComponentDatatype$1.UNSIGNED_BYTE:ComponentDatatype$1.UNSIGNED_SHORT):(i=3,r=ComponentDatatype$1.FLOAT),F.push({index:normalLocation,vertexBuffer:O,componentsPerAttribute:i,componentDatatype:r,normalize:!1,offsetInBytes:0,strideInBytes:0})),A&&F.push({index:batchIdLocation,vertexBuffer:B,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.fromTypedArray(u),normalize:!1,offsetInBytes:0,strideInBytes:0}),h&&(F=F.concat(x));var V=new VertexArray({context:n,attributes:F}),k={depthTest:{enabled:!0}},U={depthTest:{enabled:!0},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND};e._opaquePass===Pass$1.CESIUM_3D_TILE&&(k.stencilTest=StencilConstants$1.setCesium3DTileBit(),k.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,U.stencilTest=StencilConstants$1.setCesium3DTileBit(),U.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK),e._opaqueRenderState=RenderState.fromCache(k),e._translucentRenderState=RenderState.fromCache(U),e._drawCommand=new DrawCommand({boundingVolume:new BoundingSphere,cull:e._cull,modelMatrix:new Matrix4,primitiveType:PrimitiveType$1.POINTS,vertexArray:V,count:o,shaderProgram:void 0,uniformMap:void 0,renderState:C?e._translucentRenderState:e._opaqueRenderState,pass:C?Pass$1.TRANSLUCENT:e._opaquePass,owner:e,castShadows:!1,receiveShadows:!1,pickId:e._pickIdLoaded()})}function createUniformMap$4(e,t){var i=t.context,r=e._isQuantized,n=e._isQuantizedDraco,a=e._isOctEncodedDraco,o={u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier:function(){var r=scratchPointSizeAndTimeAndGeometricErrorAndDepthMultiplier;if(r.x=e._attenuation?e.maximumAttenuation:e._pointSize,r.x*=t.pixelRatio,r.y=e.time,e._attenuation){var n,a=t.camera.frustum;n=t.mode===SceneMode$1.SCENE2D||a instanceof OrthographicFrustum?Number.POSITIVE_INFINITY:i.drawingBufferHeight/t.camera.frustum.sseDenominator,r.z=e.geometricError*e.geometricErrorScale,r.w=n}return r},u_highlightColor:function(){return e._highlightColor},u_constantColor:function(){return e._constantColor},u_clippingPlanes:function(){var t=e.clippingPlanes;return e.isClipped?t.texture:i.defaultTexture},u_clippingPlanesEdgeStyle:function(){var t=e.clippingPlanes;if(!defined(t))return Color.TRANSPARENT;var i=Color.clone(t.edgeColor,scratchColor$j);return i.alpha=t.edgeWidth,i},u_clippingPlanesMatrix:function(){var t=e.clippingPlanes;if(!defined(t))return Matrix4.IDENTITY;var r=defaultValue(e.clippingPlanesOriginMatrix,e._modelMatrix);Matrix4.multiply(i.uniformState.view3D,r,scratchClippingPlanesMatrix$1);var n=Matrix4.multiply(scratchClippingPlanesMatrix$1,t.modelMatrix,scratchClippingPlanesMatrix$1);return Matrix4.inverseTranspose(n,scratchInverseTransposeClippingPlanesMatrix$1)}};(r||n||a)&&(o=combine$2(o,{u_quantizedVolumeScaleAndOctEncodedRange:function(){var t=scratchQuantizedVolumeScaleAndOctEncodedRange;if(defined(e._quantizedVolumeScale)){var i=Cartesian3.clone(e._quantizedVolumeScale,t);Cartesian3.divideByScalar(i,e._quantizedRange,t)}return t.w=e._octEncodedRange,t}})),defined(e._uniformMapLoaded)&&(o=e._uniformMapLoaded(o)),e._drawCommand.uniformMap=o}function getStyleablePropertyIds(e,t){for(var i=/czm_3dtiles_property_(\d+)/g,r=i.exec(e);null!==r;){var n=parseInt(r[1]);-1===t.indexOf(n)&&t.push(n),r=i.exec(e)}}function getBuiltinPropertyNames(e,t){e=e.slice(e.indexOf("\n"));for(var i=/czm_3dtiles_builtin_property_(\w+)/g,r=i.exec(e);null!==r;){var n=r[1];-1===t.indexOf(n)&&t.push(n),r=i.exec(e)}}function getVertexAttribute(e,t){for(var i=e.numberOfAttributes,r=0;r<i;++r){var n=e.getAttribute(r);if(n.index===t)return n}}var builtinVariableSubstitutionMap={POSITION:"czm_3dtiles_builtin_property_POSITION",POSITION_ABSOLUTE:"czm_3dtiles_builtin_property_POSITION_ABSOLUTE",COLOR:"czm_3dtiles_builtin_property_COLOR",NORMAL:"czm_3dtiles_builtin_property_NORMAL"};function createShaders$2(e,t,i){var r,n,a,o,s,l,c=t.context,u=defined(i),d=e._isQuantized,h=e._isQuantizedDraco,p=e._isOctEncoded16P,f=e._isOctEncodedDraco,m=e._isRGB565,g=e._isTranslucent,_=e._hasColors,y=e._hasNormals,v=e._hasBatchIds,C=e._backFaceCulling,T=e._normalShading,S=e._drawCommand.vertexArray,A=e.clippingPlanes,x=e._attenuation,E=g,b=clone$1(builtinVariableSubstitutionMap),P={},D=e._styleableShaderAttributes;for(n in D)D.hasOwnProperty(n)&&(a=D[n],b[n]="czm_3dtiles_property_"+a.location,P[a.location]=a);if(u){var w={translucent:!1},M="(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)";o=i.getColorShaderFunction("getColorFromStyle"+M,b,w),s=i.getShowShaderFunction("getShowFromStyle"+M,b,w),l=i.getPointSizeShaderFunction("getPointSizeFromStyle"+M,b,w),defined(o)&&w.translucent&&(E=!0)}e._styleTranslucent=E;var I=defined(o),R=defined(s),O=defined(l),B=e.isClipped,L=[],F=[];I&&(getStyleablePropertyIds(o,L),getBuiltinPropertyNames(o,F)),R&&(getStyleablePropertyIds(s,L),getBuiltinPropertyNames(s,F)),O&&(getStyleablePropertyIds(l,L),getBuiltinPropertyNames(l,F));var N=F.indexOf("COLOR")>=0,V=F.indexOf("NORMAL")>=0;if(V&&!y)throw new RuntimeError("Style references the NORMAL semantic but the point cloud does not have normals");for(n in D)if(D.hasOwnProperty(n)){a=D[n];var k=L.indexOf(a.location)>=0;getVertexAttribute(S,a.location).enabled=k}var U=_&&(!I||N);_&&(getVertexAttribute(S,colorLocation).enabled=U);var G=y&&(T||C||V);y&&(getVertexAttribute(S,normalLocation).enabled=G);var $={a_position:positionLocation};U&&($.a_color=colorLocation),G&&($.a_normal=normalLocation),v&&($.a_batchId=batchIdLocation);var z="",H=L.length;for(r=0;r<H;++r){var W=L[r],j=(a=P[W]).componentCount,q="czm_3dtiles_property_"+W;z+="attribute "+(1===j?"float":"vec"+j)+" "+q+"; \n",$[q]=a.location}createUniformMap$4(e,t);var X="attribute vec3 a_position; \nvarying vec4 v_color; \nuniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier; \nuniform vec4 u_constantColor; \nuniform vec4 u_highlightColor; \n";X+="float u_pointSize; \nfloat u_time; \n",x&&(X+="float u_geometricError; \nfloat u_depthMultiplier; \n"),X+=z,U&&(X+=g?"attribute vec4 a_color; \n":m?"attribute float a_color; \nconst float SHIFT_RIGHT_11 = 1.0 / 2048.0; \nconst float SHIFT_RIGHT_5 = 1.0 / 32.0; \nconst float SHIFT_LEFT_11 = 2048.0; \nconst float SHIFT_LEFT_5 = 32.0; \nconst float NORMALIZE_6 = 1.0 / 64.0; \nconst float NORMALIZE_5 = 1.0 / 32.0; \n":"attribute vec3 a_color; \n"),G&&(X+=p||f?"attribute vec2 a_normal; \n":"attribute vec3 a_normal; \n"),v&&(X+="attribute float a_batchId; \n"),(d||h||f)&&(X+="uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange; \n"),I&&(X+=o),R&&(X+=s),O&&(X+=l),X+="void main() \n{ \n u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x; \n u_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y; \n",x&&(X+=" u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z; \n u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w; \n"),X+=U?g?" vec4 color = a_color; \n":m?" float compressed = a_color; \n float r = floor(compressed * SHIFT_RIGHT_11); \n compressed -= r * SHIFT_LEFT_11; \n float g = floor(compressed * SHIFT_RIGHT_5); \n compressed -= g * SHIFT_LEFT_5; \n float b = compressed; \n vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5); \n vec4 color = vec4(rgb, 1.0); \n":" vec4 color = vec4(a_color, 1.0); \n":" vec4 color = u_constantColor; \n",X+=d||h?" vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz; \n":" vec3 position = a_position; \n",X+=" vec3 position_absolute = vec3(czm_model * vec4(position, 1.0)); \n",G?(X+=p?" vec3 normal = czm_octDecode(a_normal); \n":f?" vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy; \n":" vec3 normal = a_normal; \n",X+=" vec3 normalEC = czm_normal * normal; \n"):X+=" vec3 normal = vec3(1.0); \n",I&&(X+=" color = getColorFromStyle(position, position_absolute, color, normal); \n"),R&&(X+=" float show = float(getShowFromStyle(position, position_absolute, color, normal)); \n"),X+=O?" gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio; \n":x?" vec4 positionEC = czm_modelView * vec4(position, 1.0); \n float depth = -positionEC.z; \n gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize); \n":" gl_PointSize = u_pointSize; \n",X+=" color = color * u_highlightColor; \n",G&&T&&(X+=" float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC); \n diffuseStrength = max(diffuseStrength, 0.4); \n color.xyz *= diffuseStrength * czm_lightColor; \n"),X+=" v_color = color; \n gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n",G&&C&&(X+=" float visible = step(-normalEC.z, 0.0); \n gl_Position *= visible; \n gl_PointSize *= visible; \n"),R&&(X+=" gl_Position.w *= float(show); \n gl_PointSize *= float(show); \n"),X+="} \n";var Y="varying vec4 v_color; \n";B&&(Y+="uniform highp sampler2D u_clippingPlanes; \nuniform mat4 u_clippingPlanesMatrix; \nuniform vec4 u_clippingPlanesEdgeStyle; \n",Y+="\n",Y+=getClippingFunction(A,c),Y+="\n"),Y+="void main() \n{ \n gl_FragColor = czm_gammaCorrect(v_color); \n",B&&(Y+=getClipAndStyleCode("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),Y+="} \n",defined(e._vertexShaderLoaded)&&(X=e._vertexShaderLoaded(X)),defined(e._fragmentShaderLoaded)&&(Y=e._fragmentShaderLoaded(Y));var K=e._drawCommand;defined(K.shaderProgram)&&K.shaderProgram.destroy(),K.shaderProgram=ShaderProgram.fromCache({context:c,vertexShaderSource:X,fragmentShaderSource:Y,attributeLocations:$});try{K.shaderProgram._bind()}catch(e){throw new RuntimeError("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function decodeDraco(e,t){if(e._decodingState===DecodingState.READY)return!1;if(e._decodingState===DecodingState.NEEDS_DECODE){var i=e._parsedContent,r=i.draco,n=DracoLoader.decodePointCloud(r,t);defined(n)&&(e._decodingState=DecodingState.DECODING,n.then((function(t){e._decodingState=DecodingState.READY;var n=defined(t.POSITION)?t.POSITION.array:void 0,a=defined(t.RGB)?t.RGB.array:void 0,o=defined(t.RGBA)?t.RGBA.array:void 0,s=defined(t.NORMAL)?t.NORMAL.array:void 0,l=defined(t.BATCH_ID)?t.BATCH_ID.array:void 0,c=defined(n)&&defined(t.POSITION.data.quantization),u=defined(s)&&defined(t.NORMAL.data.quantization);if(c){var d=t.POSITION.data.quantization,h=d.range;e._quantizedVolumeScale=Cartesian3.fromElements(h,h,h),e._quantizedVolumeOffset=Cartesian3.unpack(d.minValues),e._quantizedRange=(1<<d.quantizationBits)-1,e._isQuantizedDraco=!0}u&&(e._octEncodedRange=(1<<t.NORMAL.data.quantization.quantizationBits)-1,e._isOctEncodedDraco=!0);var p=i.styleableProperties,f=r.batchTableProperties;for(var m in f)if(f.hasOwnProperty(m)){var g=t[m];defined(p)||(p={}),p[m]={typedArray:g.array,componentCount:g.data.componentsPerAttribute}}i.positions=defaultValue(n,i.positions),i.colors=defaultValue(defaultValue(o,a),i.colors),i.normals=defaultValue(s,i.normals),i.batchIds=defaultValue(l,i.batchIds),i.styleableProperties=p})).otherwise((function(t){e._decodingState=DecodingState.FAILED,e._readyPromise.reject(t)})))}return!0}var scratchComputedTranslation=new Cartesian4,scratchScale$3=new Cartesian3;function attachTexture(e,t,i){var r=e._gl;r.framebufferTexture2D(r.FRAMEBUFFER,t,i._target,i._texture,0)}function attachRenderbuffer(e,t,i){var r=e._gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,t,r.RENDERBUFFER,i._getRenderbuffer())}function Framebuffer(e){var t,i,r,n,a,o=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context._gl;if(ContextLimits.maximumColorAttachments,this._gl=o,this._framebuffer=o.createFramebuffer(),this._colorTextures=[],this._colorRenderbuffers=[],this._activeColorAttachments=[],this._depthTexture=void 0,this._depthRenderbuffer=void 0,this._stencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this.destroyAttachments=defaultValue(e.destroyAttachments,!0),defined(e.depthTexture)||defined(e.depthRenderbuffer),defined(e.depthStencilTexture)||defined(e.depthStencilRenderbuffer),this._bind(),defined(e.colorTextures)){var s=e.colorTextures;for(n=this._colorTextures.length=this._activeColorAttachments.length=s.length,r=0;r<n;++r)t=s[r],attachTexture(this,a=this._gl.COLOR_ATTACHMENT0+r,t),this._activeColorAttachments[r]=a,this._colorTextures[r]=t}if(defined(e.colorRenderbuffers)){var l=e.colorRenderbuffers;for(n=this._colorRenderbuffers.length=this._activeColorAttachments.length=l.length,r=0;r<n;++r)i=l[r],attachRenderbuffer(this,a=this._gl.COLOR_ATTACHMENT0+r,i),this._activeColorAttachments[r]=a,this._colorRenderbuffers[r]=i}defined(e.depthTexture)&&(t=e.depthTexture,attachTexture(this,this._gl.DEPTH_ATTACHMENT,t),this._depthTexture=t),defined(e.depthRenderbuffer)&&(i=e.depthRenderbuffer,attachRenderbuffer(this,this._gl.DEPTH_ATTACHMENT,i),this._depthRenderbuffer=i),defined(e.stencilRenderbuffer)&&(i=e.stencilRenderbuffer,attachRenderbuffer(this,this._gl.STENCIL_ATTACHMENT,i),this._stencilRenderbuffer=i),defined(e.depthStencilTexture)&&(t=e.depthStencilTexture,attachTexture(this,this._gl.DEPTH_STENCIL_ATTACHMENT,t),this._depthStencilTexture=t),defined(e.depthStencilRenderbuffer)&&(i=e.depthStencilRenderbuffer,attachRenderbuffer(this,this._gl.DEPTH_STENCIL_ATTACHMENT,i),this._depthStencilRenderbuffer=i),this._unBind()}PointCloud.prototype.update=function(e){if(!decodeDraco(this,e.context)){var t=!1,i=!Matrix4.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,i=!0),defined(this._drawCommand)||(createResources$4(this,e),i=!0,t=!0,this._ready=!0,this._readyPromise.resolve(this),this._parsedContent=void 0),i){Matrix4.clone(this.modelMatrix,this._modelMatrix);var r=this._drawCommand.modelMatrix;if(Matrix4.clone(this._modelMatrix,r),defined(this._rtcCenter)&&Matrix4.multiplyByTranslation(r,this._rtcCenter,r),defined(this._quantizedVolumeOffset)&&Matrix4.multiplyByTranslation(r,this._quantizedVolumeOffset,r),e.mode!==SceneMode$1.SCENE3D){var n=e.mapProjection,a=Matrix4.getColumn(r,3,scratchComputedTranslation);Cartesian4.equals(a,Cartesian4.UNIT_W)||Transforms.basisTo2D(n,r,r)}var o=this._drawCommand.boundingVolume;if(BoundingSphere.clone(this._boundingSphere,o),this._cull){var s=o.center;Matrix4.multiplyByPoint(r,s,s);var l=Matrix4.getScale(r,scratchScale$3);o.radius*=Cartesian3.maximumComponent(l)}}this.clippingPlanesDirty&&(this.clippingPlanesDirty=!1,t=!0),this._attenuation!==this.attenuation&&(this._attenuation=this.attenuation,t=!0),this.backFaceCulling!==this._backFaceCulling&&(this._backFaceCulling=this.backFaceCulling,t=!0),this.normalShading!==this._normalShading&&(this._normalShading=this.normalShading,t=!0),(this._style!==this.style||this.styleDirty)&&(this._style=this.style,this.styleDirty=!1,t=!0),t&&createShaders$2(this,e,this._style),this._drawCommand.castShadows=ShadowMode$1.castShadows(this.shadows),this._drawCommand.receiveShadows=ShadowMode$1.receiveShadows(this.shadows);var c=this._highlightColor.alpha<1||this._constantColor.alpha<1||this._styleTranslucent;this._drawCommand.renderState=c?this._translucentRenderState:this._opaqueRenderState,this._drawCommand.pass=c?Pass$1.TRANSLUCENT:this._opaquePass;var u=e.commandList,d=e.passes;(d.render||d.pick)&&u.push(this._drawCommand)}},PointCloud.prototype.isDestroyed=function(){return!1},PointCloud.prototype.destroy=function(){var e=this._drawCommand;return defined(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),destroyObject(this)},Object.defineProperties(Framebuffer.prototype,{status:{get:function(){this._bind();var e=this._gl.checkFramebufferStatus(this._gl.FRAMEBUFFER);return this._unBind(),e}},numberOfColorAttachments:{get:function(){return this._activeColorAttachments.length}},depthTexture:{get:function(){return this._depthTexture}},depthRenderbuffer:{get:function(){return this._depthRenderbuffer}},stencilRenderbuffer:{get:function(){return this._stencilRenderbuffer}},depthStencilTexture:{get:function(){return this._depthStencilTexture}},depthStencilRenderbuffer:{get:function(){return this._depthStencilRenderbuffer}},hasDepthAttachment:{get:function(){return!!(this.depthTexture||this.depthRenderbuffer||this.depthStencilTexture||this.depthStencilRenderbuffer)}}}),Framebuffer.prototype._bind=function(){var e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer)},Framebuffer.prototype._unBind=function(){var e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)},Framebuffer.prototype._getActiveColorAttachments=function(){return this._activeColorAttachments},Framebuffer.prototype.getColorTexture=function(e){return this._colorTextures[e]},Framebuffer.prototype.getColorRenderbuffer=function(e){return this._colorRenderbuffers[e]},Framebuffer.prototype.isDestroyed=function(){return!1},Framebuffer.prototype.destroy=function(){if(this.destroyAttachments){for(var e=0,t=this._colorTextures,i=t.length;e<i;++e){var r=t[e];defined(r)&&r.destroy()}var n=this._colorRenderbuffers;for(i=n.length,e=0;e<i;++e){var a=n[e];defined(a)&&a.destroy()}this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy(),this._stencilRenderbuffer=this._stencilRenderbuffer&&this._stencilRenderbuffer.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()}return this._gl.deleteFramebuffer(this._framebuffer),destroyObject(this)};var PointCloudEyeDomeLightingShader="#extension GL_EXT_frag_depth : enable\nuniform sampler2D u_pointCloud_colorGBuffer;\nuniform sampler2D u_pointCloud_depthGBuffer;\nuniform vec2 u_distanceAndEdlStrength;\nvarying vec2 v_textureCoordinates;\nvec2 neighborContribution(float log2Depth, vec2 offset)\n{\nfloat dist = u_distanceAndEdlStrength.x;\nvec2 texCoordOrig = v_textureCoordinates + offset * dist;\nvec2 texCoord0 = v_textureCoordinates + offset * floor(dist);\nvec2 texCoord1 = v_textureCoordinates + offset * ceil(dist);\nfloat depthOrLogDepth0 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord0));\nfloat depthOrLogDepth1 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord1));\nif (depthOrLogDepth0 == 0.0 || depthOrLogDepth1 == 0.0) {\nreturn vec2(0.0);\n}\nfloat depthMix = mix(depthOrLogDepth0, depthOrLogDepth1, fract(dist));\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(texCoordOrig, depthMix);\nreturn vec2(max(0.0, log2Depth - log2(-eyeCoordinate.z / eyeCoordinate.w)), 1.0);\n}\nvoid main()\n{\nfloat depthOrLogDepth = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, v_textureCoordinates));\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depthOrLogDepth);\neyeCoordinate /= eyeCoordinate.w;\nfloat log2Depth = log2(-eyeCoordinate.z);\nif (depthOrLogDepth == 0.0)\n{\ndiscard;\n}\nvec4 color = texture2D(u_pointCloud_colorGBuffer, v_textureCoordinates);\nvec2 texelSize = 1.0 / czm_viewport.zw;\nvec2 responseAndCount = vec2(0.0);\nresponseAndCount += neighborContribution(log2Depth, vec2(-texelSize.x, 0.0));\nresponseAndCount += neighborContribution(log2Depth, vec2(+texelSize.x, 0.0));\nresponseAndCount += neighborContribution(log2Depth, vec2(0.0, -texelSize.y));\nresponseAndCount += neighborContribution(log2Depth, vec2(0.0, +texelSize.y));\nfloat response = responseAndCount.x / responseAndCount.y;\nfloat strength = u_distanceAndEdlStrength.y;\nfloat shade = exp(-response * 300.0 * strength);\ncolor.rgb *= shade;\ngl_FragColor = vec4(color);\ngl_FragDepthEXT = depthOrLogDepth;\n}\n";function PointCloudEyeDomeLighting(){this._framebuffer=void 0,this._colorGBuffer=void 0,this._depthGBuffer=void 0,this._depthTexture=void 0,this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}function destroyFramebuffer$1(e){var t=e._framebuffer;defined(t)&&(e._colorGBuffer.destroy(),e._depthGBuffer.destroy(),e._depthTexture.destroy(),t.destroy(),e._framebuffer=void 0,e._colorGBuffer=void 0,e._depthGBuffer=void 0,e._depthTexture=void 0,e._drawCommand=void 0,e._clearCommand=void 0)}function createFramebuffer$3(e,t){var i=t.drawingBufferWidth,r=t.drawingBufferHeight,n=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST}),a=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST}),o=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.DEPTH_COMPONENT,pixelDatatype:PixelDatatype$1.UNSIGNED_INT,sampler:Sampler.NEAREST});e._framebuffer=new Framebuffer({context:t,colorTextures:[n,a],depthTexture:o,destroyAttachments:!1}),e._colorGBuffer=n,e._depthGBuffer=a,e._depthTexture=o}var distanceAndEdlStrengthScratch=new Cartesian2;function createCommands$1(e,t){var i=new ShaderSource({defines:["LOG_DEPTH_WRITE"],sources:[PointCloudEyeDomeLightingShader]}),r={u_pointCloud_colorGBuffer:function(){return e._colorGBuffer},u_pointCloud_depthGBuffer:function(){return e._depthGBuffer},u_distanceAndEdlStrength:function(){return distanceAndEdlStrengthScratch.x=e._radius,distanceAndEdlStrengthScratch.y=e._strength,distanceAndEdlStrengthScratch}},n=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:StencilConstants$1.setCesium3DTileBit(),stencilMask:StencilConstants$1.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(i,{uniformMap:r,renderState:n,pass:Pass$1.CESIUM_3D_TILE,owner:e}),e._clearCommand=new ClearCommand({framebuffer:e._framebuffer,color:new Color(0,0,0,0),depth:1,renderState:RenderState.fromCache(),pass:Pass$1.CESIUM_3D_TILE,owner:e})}function createResources$3(e,t){var i=t.drawingBufferWidth,r=t.drawingBufferHeight,n=e._colorGBuffer,a=!1,o=defined(n)&&(n.width!==i||n.height!==r);return defined(n)&&!o||(destroyFramebuffer$1(e),createFramebuffer$3(e,t),createCommands$1(e,t),a=!0),a}function isSupported(e){return e.drawBuffers&&e.fragmentDepth}function getECShaderProgram(e,t){var i=e.shaderCache.getDerivedShaderProgram(t,"EC");if(!defined(i)){var r=t._attributeLocations,n=t.fragmentShaderSource.clone();n.sources=n.sources.map((function(e){return e=(e=ShaderSource.replaceMain(e,"czm_point_cloud_post_process_main")).replace(/gl_FragColor/g,"gl_FragData[0]")})),n.sources.unshift("#extension GL_EXT_draw_buffers : enable \n"),n.sources.push("void main() \n{ \n czm_point_cloud_post_process_main(); \n#ifdef LOG_DEPTH\n czm_writeLogDepth();\n gl_FragData[1] = czm_packDepth(gl_FragDepthEXT); \n#else\n gl_FragData[1] = czm_packDepth(gl_FragCoord.z);\n#endif\n}"),i=e.shaderCache.createDerivedShaderProgram(t,"EC",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:n,attributeLocations:r})}return i}function PointCloudShading(e){var t=defaultValue(e,{});this.attenuation=defaultValue(t.attenuation,!1),this.geometricErrorScale=defaultValue(t.geometricErrorScale,1),this.maximumAttenuation=t.maximumAttenuation,this.baseResolution=t.baseResolution,this.eyeDomeLighting=defaultValue(t.eyeDomeLighting,!0),this.eyeDomeLightingStrength=defaultValue(t.eyeDomeLightingStrength,1),this.eyeDomeLightingRadius=defaultValue(t.eyeDomeLightingRadius,1),this.backFaceCulling=defaultValue(t.backFaceCulling,!1),this.normalShading=defaultValue(t.normalShading,!0)}function PointCloud3DTileContent(e,t,i,r,n){this._tileset=e,this._tile=t,this._resource=i,this._pickId=void 0,this._batchTable=void 0,this._styleDirty=!1,this._features=void 0,this.featurePropertiesDirty=!1,this._groupMetadata=void 0,this._pointCloud=new PointCloud({arrayBuffer:r,byteOffset:n,cull:!1,opaquePass:Pass$1.CESIUM_3D_TILE,vertexShaderLoaded:getVertexShaderLoaded(this),fragmentShaderLoaded:getFragmentShaderLoaded$1(this),uniformMapLoaded:getUniformMapLoaded$1(this),batchTableLoaded:getBatchTableLoaded(this),pickIdLoaded:getPickIdLoaded$1(this)})}function getVertexShaderLoaded(e){return function(t){return defined(e._batchTable)?e._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(t):t}}function getFragmentShaderLoaded$1(e){return function(t){return defined(e._batchTable)?e._batchTable.getFragmentShaderCallback(!1,void 0,!1)(t):"uniform vec4 czm_pickColor;\n"+t}}function getUniformMapLoaded$1(e){return function(t){return defined(e._batchTable)?e._batchTable.getUniformMapCallback()(t):combine$2(t,{czm_pickColor:function(){return e._pickId.color}})}}function getBatchTableLoaded(e){return function(t,i,r){e._batchTable=new Cesium3DTileBatchTable(e,t,i,r)}}function getPickIdLoaded$1(e){return function(){return defined(e._batchTable)?e._batchTable.getPickId():"czm_pickColor"}}function getGeometricError$1(e){var t=e._tileset.pointCloudShading,i=e._tile.contentBoundingVolume.boundingSphere.volume(),r=CesiumMath.cbrt(i/e.pointsLength),n=e._tile.geometricError;return 0===n&&(n=defined(t)&&defined(t.baseResolution)?t.baseResolution:r),n}function createFeatures$1(e){var t=e.featuresLength;if(!defined(e._features)&&t>0){for(var i=new Array(t),r=0;r<t;++r)i[r]=new Cesium3DTileFeature(e,r);e._features=i}}PointCloudEyeDomeLighting.isSupported=isSupported,PointCloudEyeDomeLighting.prototype.update=function(e,t,i,r){if(isSupported(e.context)){this._strength=i.eyeDomeLightingStrength,this._radius=i.eyeDomeLightingRadius*e.pixelRatio;var n,a,o,s=createResources$3(this,e.context),l=e.commandList,c=l.length;for(n=t;n<c;++n){var u=l[n];if(u.primitiveType===PrimitiveType$1.POINTS&&u.pass!==Pass$1.TRANSLUCENT){a=void 0,o=void 0;var d=u.derivedCommands.pointCloudProcessor;defined(d)&&(a=d.command,o=d.originalShaderProgram),(!defined(a)||u.dirty||s||o!==u.shaderProgram||a.framebuffer!==this._framebuffer)&&((a=DrawCommand.shallowClone(u,a)).framebuffer=this._framebuffer,a.shaderProgram=getECShaderProgram(e.context,u.shaderProgram),a.castShadows=!1,a.receiveShadows=!1,defined(d)||(d={command:a,originalShaderProgram:u.shaderProgram},u.derivedCommands.pointCloudProcessor=d),d.originalShaderProgram=u.shaderProgram),l[n]=a}}var h=this._clearCommand,p=this._drawCommand;p.boundingVolume=r,l.push(p),l.push(h)}},PointCloudEyeDomeLighting.prototype.isDestroyed=function(){return!1},PointCloudEyeDomeLighting.prototype.destroy=function(){return destroyFramebuffer$1(this),destroyObject(this)},PointCloudShading.isSupported=function(e){return PointCloudEyeDomeLighting.isSupported(e.context)},Object.defineProperties(PointCloud3DTileContent.prototype,{featuresLength:{get:function(){return defined(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return this._pointCloud.pointsLength}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return this._pointCloud.geometryByteLength}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return defined(this._batchTable)?this._batchTable.memorySizeInBytes:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._pointCloud.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}}),PointCloud3DTileContent.prototype.hasProperty=function(e,t){return!!defined(this._batchTable)&&this._batchTable.hasProperty(e,t)},PointCloud3DTileContent.prototype.getFeature=function(e){if(defined(this._batchTable))return this.featuresLength,createFeatures$1(this),this._features[e]},PointCloud3DTileContent.prototype.applyDebugSettings=function(e,t){this._pointCloud.color=e?t:Color.WHITE},PointCloud3DTileContent.prototype.applyStyle=function(e){defined(this._batchTable)?this._batchTable.applyStyle(e):this._styleDirty=!0};var defaultShading$1=new PointCloudShading;function Tileset3DTileContent(e,t,i,r){this._tileset=e,this._tile=t,this._resource=i,this._readyPromise=when.defer(),this.featurePropertiesDirty=!1,this._groupMetadata=void 0,initialize$6(this,r)}function initialize$6(e,t){e._tileset.loadTileset(e._resource,t,e._tile),e._readyPromise.resolve(e)}function VertexArrayFacade(e,t,i,r){var n=VertexArrayFacade._verifyAttributes(t);i=defaultValue(i,0);for(var a,o,s=[],l={},c=n.length,u=0;u<c;++u){var d=n[u];d.vertexBuffer?s.push(d):(defined(a=l[o=d.usage])||(a=l[o]=[]),a.push(d))}function h(e,t){return ComponentDatatype$1.getSizeInBytes(t.componentDatatype)-ComponentDatatype$1.getSizeInBytes(e.componentDatatype)}for(o in this._allBuffers=[],l)if(l.hasOwnProperty(o)){(a=l[o]).sort(h);var p=VertexArrayFacade._vertexSizeInBytes(a),f={vertexSizeInBytes:p,vertexBuffer:void 0,usage:a[0].usage,needsCommit:!1,arrayBuffer:void 0,arrayViews:VertexArrayFacade._createArrayViews(a,p)};this._allBuffers.push(f)}this._size=0,this._instanced=defaultValue(r,!1),this._precreated=s,this._context=e,this.writers=void 0,this.va=void 0,this.resize(i)}PointCloud3DTileContent.prototype.update=function(e,t){var i,r=this._pointCloud,n=defaultValue(e.pointCloudShading,defaultShading$1),a=this._tile,o=this._batchTable,s=t.mode,l=e.clippingPlanes;defined(this._pickId)||defined(o)||(this._pickId=t.context.createPickId({primitive:e,content:this})),defined(o)&&o.update(e,t),i=defined(a._contentBoundingVolume)?s===SceneMode$1.SCENE3D?a._contentBoundingVolume.boundingSphere:a._contentBoundingVolume2D.boundingSphere:s===SceneMode$1.SCENE3D?a._boundingVolume.boundingSphere:a._boundingVolume2D.boundingSphere;var c=this._styleDirty;this._styleDirty=!1,r.clippingPlanesOriginMatrix=e.clippingPlanesOriginMatrix,r.style=defined(o)?void 0:e.style,r.styleDirty=c,r.modelMatrix=a.computedTransform,r.time=e.timeSinceLoad,r.shadows=e.shadows,r.boundingSphere=i,r.clippingPlanes=l,r.isClipped=defined(l)&&l.enabled&&a._isClipped,r.clippingPlanesDirty=a.clippingPlanesDirty,r.attenuation=n.attenuation,r.backFaceCulling=n.backFaceCulling,r.normalShading=n.normalShading,r.geometricError=getGeometricError$1(this),r.geometricErrorScale=n.geometricErrorScale,defined(n)&&defined(n.maximumAttenuation)?r.maximumAttenuation=n.maximumAttenuation:a.refine===Cesium3DTileRefine$1.ADD?r.maximumAttenuation=5:r.maximumAttenuation=e.maximumScreenSpaceError,r.update(t)},PointCloud3DTileContent.prototype.isDestroyed=function(){return!1},PointCloud3DTileContent.prototype.destroy=function(){return this._pickId=this._pickId&&this._pickId.destroy(),this._pointCloud=this._pointCloud&&this._pointCloud.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},Object.defineProperties(Tileset3DTileContent.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}}),Tileset3DTileContent.prototype.hasProperty=function(e,t){return!1},Tileset3DTileContent.prototype.getFeature=function(e){},Tileset3DTileContent.prototype.applyDebugSettings=function(e,t){},Tileset3DTileContent.prototype.applyStyle=function(e){},Tileset3DTileContent.prototype.update=function(e,t){},Tileset3DTileContent.prototype.isDestroyed=function(){return!1},Tileset3DTileContent.prototype.destroy=function(){return destroyObject(this)},VertexArrayFacade._verifyAttributes=function(e){for(var t=[],i=0;i<e.length;++i){var r=e[i],n={index:defaultValue(r.index,i),enabled:defaultValue(r.enabled,!0),componentsPerAttribute:r.componentsPerAttribute,componentDatatype:defaultValue(r.componentDatatype,ComponentDatatype$1.FLOAT),normalize:defaultValue(r.normalize,!1),vertexBuffer:r.vertexBuffer,usage:defaultValue(r.usage,BufferUsage$1.STATIC_DRAW)};t.push(n)}for(var a=new Array(t.length),o=0;o<t.length;++o){a[t[o].index]=!0}return t},VertexArrayFacade._vertexSizeInBytes=function(e){for(var t=0,i=e.length,r=0;r<i;++r){var n=e[r];t+=n.componentsPerAttribute*ComponentDatatype$1.getSizeInBytes(n.componentDatatype)}var a=i>0?ComponentDatatype$1.getSizeInBytes(e[0].componentDatatype):0,o=a>0?t%a:0;return t+=0===o?0:a-o},VertexArrayFacade._createArrayViews=function(e,t){for(var i=[],r=0,n=e.length,a=0;a<n;++a){var o=e[a],s=o.componentDatatype;i.push({index:o.index,enabled:o.enabled,componentsPerAttribute:o.componentsPerAttribute,componentDatatype:s,normalize:o.normalize,offsetInBytes:r,vertexSizeInComponentType:t/ComponentDatatype$1.getSizeInBytes(s),view:void 0}),r+=o.componentsPerAttribute*ComponentDatatype$1.getSizeInBytes(s)}return i},VertexArrayFacade.prototype.resize=function(e){this._size=e;var t=this._allBuffers;this.writers=[];for(var i=0,r=t.length;i<r;++i){var n=t[i];VertexArrayFacade._resize(n,this._size),VertexArrayFacade._appendWriters(this.writers,n)}destroyVA(this)},VertexArrayFacade._resize=function(e,t){if(e.vertexSizeInBytes>0){var i=new ArrayBuffer(t*e.vertexSizeInBytes);if(defined(e.arrayBuffer))for(var r=new Uint8Array(i),n=new Uint8Array(e.arrayBuffer),a=n.length,o=0;o<a;++o)r[o]=n[o];for(var s=e.arrayViews,l=s.length,c=0;c<l;++c){var u=s[c];u.view=ComponentDatatype$1.createArrayBufferView(u.componentDatatype,i,u.offsetInBytes)}e.arrayBuffer=i}};var createWriters=[function(e,t,i){return function(r,n){t[r*i]=n,e.needsCommit=!0}},function(e,t,i){return function(r,n,a){var o=r*i;t[o]=n,t[o+1]=a,e.needsCommit=!0}},function(e,t,i){return function(r,n,a,o){var s=r*i;t[s]=n,t[s+1]=a,t[s+2]=o,e.needsCommit=!0}},function(e,t,i){return function(r,n,a,o,s){var l=r*i;t[l]=n,t[l+1]=a,t[l+2]=o,t[l+3]=s,e.needsCommit=!0}}];function commit(e,t){if(t.needsCommit&&t.vertexSizeInBytes>0){t.needsCommit=!1;var i=t.vertexBuffer,r=e._size*t.vertexSizeInBytes,n=defined(i);if(!n||i.sizeInBytes<r)return n&&i.destroy(),t.vertexBuffer=Buffer$1.createVertexBuffer({context:e._context,typedArray:t.arrayBuffer,usage:t.usage}),t.vertexBuffer.vertexArrayDestroyable=!1,!0;t.vertexBuffer.copyFromArrayView(t.arrayBuffer)}return!1}function subCommit(e,t,i){if(e.needsCommit&&e.vertexSizeInBytes>0){var r=e.vertexSizeInBytes*t,n=e.vertexSizeInBytes*i;e.vertexBuffer.copyFromArrayView(new Uint8Array(e.arrayBuffer,r,n),r)}}function destroyVA(e){var t=e.va;if(defined(t)){for(var i=t.length,r=0;r<i;++r)t[r].va.destroy();e.va=void 0}}VertexArrayFacade._appendWriters=function(e,t){for(var i=t.arrayViews,r=i.length,n=0;n<r;++n){var a=i[n];e[a.index]=createWriters[a.componentsPerAttribute-1](t,a.view,a.vertexSizeInComponentType)}},VertexArrayFacade.prototype.commit=function(e){var t,i,r,n=!1,a=this._allBuffers;for(i=0,r=a.length;i<r;++i)n=commit(this,t=a[i])||n;if(n||!defined(this.va)){destroyVA(this);for(var o=this.va=[],s=CesiumMath.SIXTY_FOUR_KILOBYTES-4,l=defined(e)&&!this._instanced?Math.ceil(this._size/s):1,c=0;c<l;++c){var u=[];for(i=0,r=a.length;i<r;++i){var d=c*((t=a[i]).vertexSizeInBytes*s);VertexArrayFacade._appendAttributes(u,t,d,this._instanced)}u=u.concat(this._precreated),o.push({va:new VertexArray({context:this._context,attributes:u,indexBuffer:e}),indicesCount:1.5*(c!==l-1?s:this._size%s)})}}},VertexArrayFacade._appendAttributes=function(e,t,i,r){for(var n=t.arrayViews,a=n.length,o=0;o<a;++o){var s=n[o];e.push({index:s.index,enabled:s.enabled,componentsPerAttribute:s.componentsPerAttribute,componentDatatype:s.componentDatatype,normalize:s.normalize,vertexBuffer:t.vertexBuffer,offsetInBytes:i+s.offsetInBytes,strideInBytes:t.vertexSizeInBytes,instanceDivisor:r?1:0})}},VertexArrayFacade.prototype.subCommit=function(e,t){for(var i=this._allBuffers,r=0,n=i.length;r<n;++r)subCommit(i[r],e,t)},VertexArrayFacade.prototype.endSubCommits=function(){for(var e=this._allBuffers,t=0,i=e.length;t<i;++t)e[t].needsCommit=!1},VertexArrayFacade.prototype.isDestroyed=function(){return!1},VertexArrayFacade.prototype.destroy=function(){for(var e=this._allBuffers,t=0,i=e.length;t<i;++t){var r=e[t];r.vertexBuffer=r.vertexBuffer&&r.vertexBuffer.destroy()}return destroyVA(this),destroyObject(this)};var BillboardCollectionFS="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform sampler2D u_atlas;\n#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\nvarying vec2 v_textureCoordinates;\nvarying vec4 v_pickColor;\nvarying vec4 v_color;\n#ifdef SDF\nvarying vec4 v_outlineColor;\nvarying float v_outlineWidth;\n#endif\n#ifdef FRAGMENT_DEPTH_CHECK\nvarying vec4 v_textureCoordinateBounds;\nvarying vec4 v_originTextureCoordinateAndTranslate;\nvarying vec4 v_compressed;\nvarying mat2 v_rotationMatrix;\nconst float SHIFT_LEFT12 = 4096.0;\nconst float SHIFT_LEFT1 = 2.0;\nconst float SHIFT_RIGHT12 = 1.0 / 4096.0;\nconst float SHIFT_RIGHT1 = 1.0 / 2.0;\nfloat getGlobeDepth(vec2 adjustedST, vec2 depthLookupST, bool applyTranslate, vec2 dimensions, vec2 imageSize)\n{\nvec2 lookupVector = imageSize * (depthLookupST - adjustedST);\nlookupVector = v_rotationMatrix * lookupVector;\nvec2 labelOffset = (dimensions - imageSize) * (depthLookupST - vec2(0.0, v_originTextureCoordinateAndTranslate.y));\nvec2 translation = v_originTextureCoordinateAndTranslate.zw;\nif (applyTranslate)\n{\ntranslation += (dimensions * v_originTextureCoordinateAndTranslate.xy * vec2(1.0, 0.0));\n}\nvec2 st = ((lookupVector - translation + labelOffset) + gl_FragCoord.xy) / czm_viewport.zw;\nfloat logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st));\nif (logDepthOrDepth == 0.0)\n{\nreturn 0.0;\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\nreturn eyeCoordinate.z / eyeCoordinate.w;\n}\n#endif\n#ifdef SDF\nfloat getDistance(vec2 position)\n{\nreturn texture2D(u_atlas, position).r;\n}\nvec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)\n{\nfloat distance = getDistance(position);\nif (outlineWidth > 0.0)\n{\nfloat outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE);\nfloat outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);\nvec4 sdfColor = mix(outlineColor, v_color, outlineFactor);\nfloat alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance);\nreturn vec4(sdfColor.rgb, sdfColor.a * alpha);\n}\nelse\n{\nfloat alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);\nreturn vec4(v_color.rgb, v_color.a * alpha);\n}\n}\n#endif\nvoid main()\n{\nvec4 color = texture2D(u_atlas, v_textureCoordinates);\n#ifdef SDF\nfloat outlineWidth = v_outlineWidth;\nvec4 outlineColor = v_outlineColor;\nfloat distance = getDistance(v_textureCoordinates);\n#ifdef GL_OES_standard_derivatives\nfloat smoothing = fwidth(distance);\nvec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));\nvec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);\nvec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);\nvec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);\nvec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);\nvec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);\ncolor = (center + color1 + color2 + color3 + color4)/5.0;\n#else\nfloat smoothing = 1.0/32.0;\ncolor = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);\n#endif\ncolor = czm_gammaCorrect(color);\n#else\ncolor = czm_gammaCorrect(color);\ncolor *= czm_gammaCorrect(v_color);\n#endif\n#if !defined(OPAQUE) && !defined(TRANSLUCENT)\nif (color.a < 0.005)\n{\ndiscard;\n}\n#else\n#ifdef OPAQUE\nif (color.a < 0.995)\n{\ndiscard;\n}\n#else\nif (color.a >= 0.995)\n{\ndiscard;\n}\n#endif\n#endif\n#ifdef VECTOR_TILE\ncolor *= u_highlightColor;\n#endif\ngl_FragColor = color;\n#ifdef LOG_DEPTH\nczm_writeLogDepth();\n#endif\n#ifdef FRAGMENT_DEPTH_CHECK\nfloat temp = v_compressed.y;\ntemp = temp * SHIFT_RIGHT1;\nfloat temp2 = (temp - floor(temp)) * SHIFT_LEFT1;\nbool enableDepthTest = temp2 != 0.0;\nbool applyTranslate = floor(temp) != 0.0;\nif (enableDepthTest) {\ntemp = v_compressed.z;\ntemp = temp * SHIFT_RIGHT12;\nvec2 dimensions;\ndimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;\ndimensions.x = floor(temp);\ntemp = v_compressed.w;\ntemp = temp * SHIFT_RIGHT12;\nvec2 imageSize;\nimageSize.y = (temp - floor(temp)) * SHIFT_LEFT12;\nimageSize.x = floor(temp);\nvec2 adjustedST = v_textureCoordinates - v_textureCoordinateBounds.xy;\nadjustedST = adjustedST / vec2(v_textureCoordinateBounds.z - v_textureCoordinateBounds.x, v_textureCoordinateBounds.w - v_textureCoordinateBounds.y);\nfloat epsilonEyeDepth = v_compressed.x + czm_epsilon1;\nfloat globeDepth1 = getGlobeDepth(adjustedST, v_originTextureCoordinateAndTranslate.xy, applyTranslate, dimensions, imageSize);\nif (globeDepth1 != 0.0 && globeDepth1 > epsilonEyeDepth)\n{\nfloat globeDepth2 = getGlobeDepth(adjustedST, vec2(0.0, 1.0), applyTranslate, dimensions, imageSize);\nif (globeDepth2 != 0.0 && globeDepth2 > epsilonEyeDepth)\n{\nfloat globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize);\nif (globeDepth3 != 0.0 && globeDepth3 > epsilonEyeDepth)\n{\ndiscard;\n}\n}\n}\n}\n#endif\n}\n",BillboardCollectionVS="#ifdef INSTANCED\nattribute vec2 direction;\n#endif\nattribute vec4 positionHighAndScale;\nattribute vec4 positionLowAndRotation;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 compressedAttribute2;\nattribute vec4 eyeOffset;\nattribute vec4 scaleByDistance;\nattribute vec4 pixelOffsetScaleByDistance;\nattribute vec4 compressedAttribute3;\nattribute vec2 sdf;\n#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)\nattribute vec4 textureCoordinateBoundsOrLabelTranslate;\n#endif\n#ifdef VECTOR_TILE\nattribute float a_batchId;\n#endif\nvarying vec2 v_textureCoordinates;\n#ifdef FRAGMENT_DEPTH_CHECK\nvarying vec4 v_textureCoordinateBounds;\nvarying vec4 v_originTextureCoordinateAndTranslate;\nvarying vec4 v_compressed;\nvarying mat2 v_rotationMatrix;\n#endif\nvarying vec4 v_pickColor;\nvarying vec4 v_color;\n#ifdef SDF\nvarying vec4 v_outlineColor;\nvarying float v_outlineWidth;\n#endif\nconst float UPPER_BOUND = 32768.0;\nconst float SHIFT_LEFT16 = 65536.0;\nconst float SHIFT_LEFT12 = 4096.0;\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_LEFT7 = 128.0;\nconst float SHIFT_LEFT5 = 32.0;\nconst float SHIFT_LEFT3 = 8.0;\nconst float SHIFT_LEFT2 = 4.0;\nconst float SHIFT_LEFT1 = 2.0;\nconst float SHIFT_RIGHT12 = 1.0 / 4096.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nconst float SHIFT_RIGHT7 = 1.0 / 128.0;\nconst float SHIFT_RIGHT5 = 1.0 / 32.0;\nconst float SHIFT_RIGHT3 = 1.0 / 8.0;\nconst float SHIFT_RIGHT2 = 1.0 / 4.0;\nconst float SHIFT_RIGHT1 = 1.0 / 2.0;\nvec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters, out mat2 rotationMatrix, out float mpp)\n{\nvec2 halfSize = imageSize * scale * 0.5;\nhalfSize *= ((direction * 2.0) - 1.0);\nvec2 originTranslate = origin * abs(halfSize);\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nif (validAlignedAxis || rotation != 0.0)\n{\nfloat angle = rotation;\nif (validAlignedAxis)\n{\nvec4 projectedAlignedAxis = czm_modelViewProjection * vec4(alignedAxis, 0.0);\nangle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /\n(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));\n}\nfloat cosTheta = cos(angle);\nfloat sinTheta = sin(angle);\nrotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\nhalfSize = rotationMatrix * halfSize;\n}\nelse\n{\nrotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);\n}\n#endif\nmpp = czm_metersPerPixel(positionEC);\npositionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp);\npositionEC.xy += (translate + pixelOffset) * mpp;\nreturn positionEC;\n}\n#ifdef VERTEX_DEPTH_CHECK\nfloat getGlobeDepth(vec4 positionEC)\n{\nvec4 posWC = czm_eyeToWindowCoordinates(positionEC);\nfloat globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));\nif (globeDepth == 0.0)\n{\nreturn 0.0;\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);\nreturn eyeCoordinate.z / eyeCoordinate.w;\n}\n#endif\nvoid main()\n{\nvec3 positionHigh = positionHighAndScale.xyz;\nvec3 positionLow = positionLowAndRotation.xyz;\nfloat scale = positionHighAndScale.w;\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nfloat rotation = positionLowAndRotation.w;\n#else\nfloat rotation = 0.0;\n#endif\nfloat compressed = compressedAttribute0.x;\nvec2 pixelOffset;\npixelOffset.x = floor(compressed * SHIFT_RIGHT7);\ncompressed -= pixelOffset.x * SHIFT_LEFT7;\npixelOffset.x -= UPPER_BOUND;\nvec2 origin;\norigin.x = floor(compressed * SHIFT_RIGHT5);\ncompressed -= origin.x * SHIFT_LEFT5;\norigin.y = floor(compressed * SHIFT_RIGHT3);\ncompressed -= origin.y * SHIFT_LEFT3;\n#ifdef FRAGMENT_DEPTH_CHECK\nvec2 depthOrigin = origin.xy;\n#endif\norigin -= vec2(1.0);\nfloat show = floor(compressed * SHIFT_RIGHT2);\ncompressed -= show * SHIFT_LEFT2;\n#ifdef INSTANCED\nvec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);\nvec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);\nvec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;\n#else\nvec2 direction;\ndirection.x = floor(compressed * SHIFT_RIGHT1);\ndirection.y = compressed - direction.x * SHIFT_LEFT1;\nvec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);\n#endif\nfloat temp = compressedAttribute0.y * SHIFT_RIGHT8;\npixelOffset.y = -(floor(temp) - UPPER_BOUND);\nvec2 translate;\ntranslate.y = (temp - floor(temp)) * SHIFT_LEFT16;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\ntranslate.x = floor(temp) - UPPER_BOUND;\ntranslate.y += (temp - floor(temp)) * SHIFT_LEFT8;\ntranslate.y -= UPPER_BOUND;\ntemp = compressedAttribute1.x * SHIFT_RIGHT8;\nfloat temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);\nvec2 imageSize = vec2(floor(temp), temp2);\n#ifdef FRAGMENT_DEPTH_CHECK\nfloat labelHorizontalOrigin = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));\nfloat applyTranslate = 0.0;\nif (labelHorizontalOrigin != 0.0)\n{\napplyTranslate = 1.0;\nlabelHorizontalOrigin -= 2.0;\ndepthOrigin.x = labelHorizontalOrigin + 1.0;\n}\ndepthOrigin = vec2(1.0) - (depthOrigin * 0.5);\n#endif\n#ifdef EYE_DISTANCE_TRANSLUCENCY\nvec4 translucencyByDistance;\ntranslucencyByDistance.x = compressedAttribute1.z;\ntranslucencyByDistance.z = compressedAttribute1.w;\ntranslucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\ntemp = compressedAttribute1.y * SHIFT_RIGHT8;\ntranslucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\n#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)\ntemp = compressedAttribute3.w;\ntemp = temp * SHIFT_RIGHT12;\nvec2 dimensions;\ndimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;\ndimensions.x = floor(temp);\n#endif\n#ifdef ALIGNED_AXIS\nvec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));\ntemp = compressedAttribute2.z * SHIFT_RIGHT5;\nbool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0;\n#else\nvec3 alignedAxis = vec3(0.0);\nbool validAlignedAxis = false;\n#endif\nvec4 pickColor;\nvec4 color;\ntemp = compressedAttribute2.y;\ntemp = temp * SHIFT_RIGHT8;\npickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor.r = floor(temp);\ntemp = compressedAttribute2.x;\ntemp = temp * SHIFT_RIGHT8;\ncolor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\ncolor.g = (temp - floor(temp)) * SHIFT_LEFT8;\ncolor.r = floor(temp);\ntemp = compressedAttribute2.z * SHIFT_RIGHT8;\nbool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor /= 255.0;\ncolor.a = floor(temp);\ncolor /= 255.0;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\n#if defined(FRAGMENT_DEPTH_CHECK) || defined(VERTEX_DEPTH_CHECK)\nfloat eyeDepth = positionEC.z;\n#endif\npositionEC = czm_eyeOffset(positionEC, eyeOffset.xyz);\npositionEC.xyz *= show;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\n#endif\n#ifdef EYE_DISTANCE_SCALING\nfloat distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq);\nscale *= distanceScale;\ntranslate *= distanceScale;\nif (scale == 0.0)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency == 0.0)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\n#ifdef EYE_DISTANCE_PIXEL_OFFSET\nfloat pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);\npixelOffset *= pixelOffsetScale;\n#endif\n#ifdef DISTANCE_DISPLAY_CONDITION\nfloat nearSq = compressedAttribute3.x;\nfloat farSq = compressedAttribute3.y;\nif (lengthSq < nearSq || lengthSq > farSq)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nmat2 rotationMatrix;\nfloat mpp;\n#ifdef DISABLE_DEPTH_DISTANCE\nfloat disableDepthTestDistance = compressedAttribute3.z;\n#endif\n#ifdef VERTEX_DEPTH_CHECK\nif (lengthSq < disableDepthTestDistance) {\nfloat depthsilon = 10.0;\nvec2 labelTranslate = textureCoordinateBoundsOrLabelTranslate.xy;\nvec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\nfloat globeDepth1 = getGlobeDepth(pEC1);\nif (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1)\n{\nvec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\nfloat globeDepth2 = getGlobeDepth(pEC2);\nif (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2)\n{\nvec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\nfloat globeDepth3 = getGlobeDepth(pEC3);\nif (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3)\n{\npositionEC.xyz = vec3(0.0);\n}\n}\n}\n}\n#endif\npositionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\ngl_Position = czm_projection * positionEC;\nv_textureCoordinates = textureCoordinates;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth();\n#endif\n#ifdef DISABLE_DEPTH_DISTANCE\nif (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n{\ndisableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n}\nif (disableDepthTestDistance != 0.0)\n{\nfloat zclip = gl_Position.z / gl_Position.w;\nbool clipped = (zclip < -1.0 || zclip > 1.0);\nif (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n{\ngl_Position.z = -gl_Position.w;\n#ifdef LOG_DEPTH\nv_depthFromNearPlusOne = 1.0;\n#endif\n}\n}\n#endif\n#ifdef FRAGMENT_DEPTH_CHECK\nif (sizeInMeters) {\ntranslate /= mpp;\ndimensions /= mpp;\nimageSize /= mpp;\n}\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nv_rotationMatrix = rotationMatrix;\n#else\nv_rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);\n#endif\nfloat enableDepthCheck = 0.0;\nif (lengthSq < disableDepthTestDistance)\n{\nenableDepthCheck = 1.0;\n}\nfloat dw = floor(clamp(dimensions.x, 0.0, SHIFT_LEFT12));\nfloat dh = floor(clamp(dimensions.y, 0.0, SHIFT_LEFT12));\nfloat iw = floor(clamp(imageSize.x, 0.0, SHIFT_LEFT12));\nfloat ih = floor(clamp(imageSize.y, 0.0, SHIFT_LEFT12));\nv_compressed.x = eyeDepth;\nv_compressed.y = applyTranslate * SHIFT_LEFT1 + enableDepthCheck;\nv_compressed.z = dw * SHIFT_LEFT12 + dh;\nv_compressed.w = iw * SHIFT_LEFT12 + ih;\nv_originTextureCoordinateAndTranslate.xy = depthOrigin;\nv_originTextureCoordinateAndTranslate.zw = translate;\nv_textureCoordinateBounds = textureCoordinateBoundsOrLabelTranslate;\n#endif\n#ifdef SDF\nvec4 outlineColor;\nfloat outlineWidth;\ntemp = sdf.x;\ntemp = temp * SHIFT_RIGHT8;\noutlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.r = floor(temp);\ntemp = sdf.y;\ntemp = temp * SHIFT_RIGHT8;\nfloat temp3 = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.a = floor(temp);\noutlineColor /= 255.0;\nv_outlineWidth = outlineWidth / 255.0;\nv_outlineColor = outlineColor;\nv_outlineColor.a *= translucency;\n#endif\nv_pickColor = pickColor;\nv_color = color;\nv_color.a *= translucency;\n}\n",SceneTransforms={},actualPositionScratch=new Cartesian4(0,0,0,1),positionCC=new Cartesian4,scratchViewport$1=new BoundingRectangle,scratchWindowCoord0=new Cartesian2,scratchWindowCoord1=new Cartesian2;SceneTransforms.wgs84ToWindowCoordinates=function(e,t,i){return SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates(e,t,Cartesian3.ZERO,i)};var scratchCartesian4$3=new Cartesian4,scratchEyeOffset=new Cartesian3;function worldToClip(e,t,i,r){var n=i.viewMatrix,a=Matrix4.multiplyByVector(n,Cartesian4.fromElements(e.x,e.y,e.z,1,scratchCartesian4$3),scratchCartesian4$3),o=Cartesian3.multiplyComponents(t,Cartesian3.normalize(a,scratchEyeOffset),scratchEyeOffset);return a.x+=t.x+o.x,a.y+=t.y+o.y,a.z+=o.z,Matrix4.multiplyByVector(i.frustum.projectionMatrix,a,r)}var scratchMaxCartographic=new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO),scratchProjectedCartesian=new Cartesian3,scratchCameraPosition$1=new Cartesian3;SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates=function(e,t,i,r){var n=e.frameState,a=SceneTransforms.computeActualWgs84Position(n,t,actualPositionScratch);if(defined(a)){var o=e.canvas,s=scratchViewport$1;s.x=0,s.y=0,s.width=o.clientWidth,s.height=o.clientHeight;var l=e.camera,c=!1;if(n.mode===SceneMode$1.SCENE2D){var u=e.mapProjection,d=scratchMaxCartographic,h=u.project(d,scratchProjectedCartesian),p=Cartesian3.clone(l.position,scratchCameraPosition$1),f=l.frustum.clone(),m=Matrix4.computeViewportTransformation(s,0,1,new Matrix4),g=l.frustum.projectionMatrix,_=l.positionWC.y,y=Cartesian3.fromElements(CesiumMath.sign(_)*h.x-_,0,-l.positionWC.x),v=Transforms.pointToGLWindowCoordinates(g,m,y);if(0===_||v.x<=0||v.x>=o.clientWidth)c=!0;else{if(v.x>.5*o.clientWidth){s.width=v.x,l.frustum.right=h.x-_,positionCC=worldToClip(a,i,l,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord0),s.x+=v.x,l.position.x=-l.position.x;var C=l.frustum.right;l.frustum.right=-l.frustum.left,l.frustum.left=-C,positionCC=worldToClip(a,i,l,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord1)}else{s.x+=v.x,s.width-=v.x,l.frustum.left=-h.x-_,positionCC=worldToClip(a,i,l,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord0),s.x=s.x-s.width,l.position.x=-l.position.x;var T=l.frustum.left;l.frustum.left=-l.frustum.right,l.frustum.right=-T,positionCC=worldToClip(a,i,l,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord1)}Cartesian3.clone(p,l.position),l.frustum=f.clone(),((r=Cartesian2.clone(scratchWindowCoord0,r)).x<0||r.x>o.clientWidth)&&(r.x=scratchWindowCoord1.x)}}if(n.mode!==SceneMode$1.SCENE2D||c){if((positionCC=worldToClip(a,i,l,positionCC)).z<0&&!(l.frustum instanceof OrthographicFrustum)&&!(l.frustum instanceof OrthographicOffCenterFrustum))return;r=SceneTransforms.clipToGLWindowCoordinates(s,positionCC,r)}return r.y=o.clientHeight-r.y,r}},SceneTransforms.wgs84ToDrawingBufferCoordinates=function(e,t,i){if(defined(i=SceneTransforms.wgs84ToWindowCoordinates(e,t,i)))return SceneTransforms.transformWindowToDrawingBuffer(e,i,i)};var projectedPosition=new Cartesian3,positionInCartographic=new Cartographic;SceneTransforms.computeActualWgs84Position=function(e,t,i){var r=e.mode;if(r===SceneMode$1.SCENE3D)return Cartesian3.clone(t,i);var n=e.mapProjection,a=n.ellipsoid.cartesianToCartographic(t,positionInCartographic);if(defined(a)){if(n.project(a,projectedPosition),r===SceneMode$1.COLUMBUS_VIEW)return Cartesian3.fromElements(projectedPosition.z,projectedPosition.x,projectedPosition.y,i);if(r===SceneMode$1.SCENE2D)return Cartesian3.fromElements(0,projectedPosition.x,projectedPosition.y,i);var o=e.morphTime;return Cartesian3.fromElements(CesiumMath.lerp(projectedPosition.z,t.x,o),CesiumMath.lerp(projectedPosition.x,t.y,o),CesiumMath.lerp(projectedPosition.y,t.z,o),i)}};var positionNDC=new Cartesian3,positionWC=new Cartesian3,viewportTransform=new Matrix4;SceneTransforms.clipToGLWindowCoordinates=function(e,t,i){return Cartesian3.divideByScalar(t,t.w,positionNDC),Matrix4.computeViewportTransformation(e,0,1,viewportTransform),Matrix4.multiplyByPoint(viewportTransform,positionNDC,positionWC),Cartesian2.fromCartesian3(positionWC,i)},SceneTransforms.transformWindowToDrawingBuffer=function(e,t,i){var r=e.canvas,n=e.drawingBufferWidth/r.clientWidth,a=e.drawingBufferHeight/r.clientHeight;return Cartesian2.fromElements(t.x*n,t.y*a,i)};var scratchNDC=new Cartesian4,scratchWorldCoords=new Cartesian4;function Billboard(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucencyByDistance,r=e.pixelOffsetScaleByDistance,n=e.scaleByDistance,a=e.distanceDisplayCondition;defined(i)&&(i=NearFarScalar.clone(i)),defined(r)&&(r=NearFarScalar.clone(r)),defined(n)&&(n=NearFarScalar.clone(n)),defined(a)&&(a=DistanceDisplayCondition.clone(a)),this._show=defaultValue(e.show,!0),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this._actualPosition=Cartesian3.clone(this._position),this._pixelOffset=Cartesian2.clone(defaultValue(e.pixelOffset,Cartesian2.ZERO)),this._translate=new Cartesian2(0,0),this._eyeOffset=Cartesian3.clone(defaultValue(e.eyeOffset,Cartesian3.ZERO)),this._heightReference=defaultValue(e.heightReference,HeightReference$1.NONE),this._verticalOrigin=defaultValue(e.verticalOrigin,VerticalOrigin$1.CENTER),this._horizontalOrigin=defaultValue(e.horizontalOrigin,HorizontalOrigin$1.CENTER),this._scale=defaultValue(e.scale,1),this._color=Color.clone(defaultValue(e.color,Color.WHITE)),this._rotation=defaultValue(e.rotation,0),this._alignedAxis=Cartesian3.clone(defaultValue(e.alignedAxis,Cartesian3.ZERO)),this._width=e.width,this._height=e.height,this._scaleByDistance=n,this._translucencyByDistance=i,this._pixelOffsetScaleByDistance=r,this._sizeInMeters=defaultValue(e.sizeInMeters,!1),this._distanceDisplayCondition=a,this._disableDepthTestDistance=e.disableDepthTestDistance,this._id=e.id,this._collection=defaultValue(e.collection,t),this._pickId=void 0,this._pickPrimitive=defaultValue(e._pickPrimitive,this),this._billboardCollection=t,this._dirty=!1,this._index=-1,this._batchIndex=void 0,this._imageIndex=-1,this._imageIndexPromise=void 0,this._imageId=void 0,this._image=void 0,this._imageSubRegion=void 0,this._imageWidth=void 0,this._imageHeight=void 0,this._labelDimensions=void 0,this._labelHorizontalOrigin=void 0,this._labelTranslate=void 0;var o=e.image,s=e.imageId;defined(o)&&(defined(s)||(s="string"==typeof o?o:defined(o.src)?o.src:createGuid()),this._imageId=s,this._image=o),defined(e.imageSubRegion)&&(this._imageId=s,this._imageSubRegion=e.imageSubRegion),defined(this._billboardCollection._textureAtlas)&&this._loadImage(),this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=SceneMode$1.SCENE3D,this._clusterShow=!0,this._outlineColor=Color.clone(defaultValue(e.outlineColor,Color.BLACK)),this._outlineWidth=defaultValue(e.outlineWidth,0),this._updateClamping()}SceneTransforms.drawingBufferToWgs84Coordinates=function(e,t,i,r){var n=e.context.uniformState,a=n.currentFrustum,o=a.x,s=a.y;if(e.frameState.useLogDepth){var l=i*n.log2FarDepthFromNearPlusOne;i=s*(1-o/(Math.pow(2,l)-1+o))/(s-o)}var c,u=e.view.passState.viewport,d=Cartesian4.clone(Cartesian4.UNIT_W,scratchNDC);d.x=(t.x-u.x)/u.width*2-1,d.y=(t.y-u.y)/u.height*2-1,d.z=2*i-1,d.w=1;var h=e.camera.frustum;if(defined(h.fovy)){var p=1/(c=Matrix4.multiplyByVector(n.inverseViewProjection,d,scratchWorldCoords)).w;Cartesian3.multiplyByScalar(c,p,c)}else defined(h._offCenterFrustum)&&(h=h._offCenterFrustum),(c=scratchWorldCoords).x=.5*(d.x*(h.right-h.left)+h.left+h.right),c.y=.5*(d.y*(h.top-h.bottom)+h.bottom+h.top),c.z=.5*(d.z*(o-s)-o-s),c.w=1,c=Matrix4.multiplyByVector(n.inverseView,c,c);return Cartesian3.fromCartesian4(c,r)};var SHOW_INDEX$7=Billboard.SHOW_INDEX=0,POSITION_INDEX$7=Billboard.POSITION_INDEX=1,PIXEL_OFFSET_INDEX$1=Billboard.PIXEL_OFFSET_INDEX=2,EYE_OFFSET_INDEX$1=Billboard.EYE_OFFSET_INDEX=3,HORIZONTAL_ORIGIN_INDEX$1=Billboard.HORIZONTAL_ORIGIN_INDEX=4,VERTICAL_ORIGIN_INDEX$1=Billboard.VERTICAL_ORIGIN_INDEX=5,SCALE_INDEX$3=Billboard.SCALE_INDEX=6,IMAGE_INDEX_INDEX$1=Billboard.IMAGE_INDEX_INDEX=7,COLOR_INDEX$5=Billboard.COLOR_INDEX=8,ROTATION_INDEX$1=Billboard.ROTATION_INDEX=9,ALIGNED_AXIS_INDEX$1=Billboard.ALIGNED_AXIS_INDEX=10,SCALE_BY_DISTANCE_INDEX$3=Billboard.SCALE_BY_DISTANCE_INDEX=11,TRANSLUCENCY_BY_DISTANCE_INDEX$3=Billboard.TRANSLUCENCY_BY_DISTANCE_INDEX=12,PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX$1=Billboard.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13,DISTANCE_DISPLAY_CONDITION$2=Billboard.DISTANCE_DISPLAY_CONDITION=14,DISABLE_DEPTH_DISTANCE$1=Billboard.DISABLE_DEPTH_DISTANCE=15;Billboard.TEXTURE_COORDINATE_BOUNDS=16;var SDF_INDEX$1=Billboard.SDF_INDEX=17;function makeDirty$3(e,t){var i=e._billboardCollection;defined(i)&&(i._updateBillboard(e,t),e._dirty=!0)}Billboard.NUMBER_OF_PROPERTIES=18,Object.defineProperties(Billboard.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,makeDirty$3(this,SHOW_INDEX$7))}},position:{get:function(){return this._position},set:function(e){var t=this._position;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),Cartesian3.clone(e,this._actualPosition),this._updateClamping(),makeDirty$3(this,POSITION_INDEX$7))}},heightReference:{get:function(){return this._heightReference},set:function(e){e!==this._heightReference&&(this._heightReference=e,this._updateClamping(),makeDirty$3(this,POSITION_INDEX$7))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){var t=this._pixelOffset;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),makeDirty$3(this,PIXEL_OFFSET_INDEX$1))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){var t=this._scaleByDistance;NearFarScalar.equals(t,e)||(this._scaleByDistance=NearFarScalar.clone(e,t),makeDirty$3(this,SCALE_BY_DISTANCE_INDEX$3))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;NearFarScalar.equals(t,e)||(this._translucencyByDistance=NearFarScalar.clone(e,t),makeDirty$3(this,TRANSLUCENCY_BY_DISTANCE_INDEX$3))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){var t=this._pixelOffsetScaleByDistance;NearFarScalar.equals(t,e)||(this._pixelOffsetScaleByDistance=NearFarScalar.clone(e,t),makeDirty$3(this,PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX$1))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){var t=this._eyeOffset;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty$3(this,EYE_OFFSET_INDEX$1))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,makeDirty$3(this,HORIZONTAL_ORIGIN_INDEX$1))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){this._verticalOrigin!==e&&(this._verticalOrigin=e,makeDirty$3(this,VERTICAL_ORIGIN_INDEX$1))}},scale:{get:function(){return this._scale},set:function(e){this._scale!==e&&(this._scale=e,makeDirty$3(this,SCALE_INDEX$3))}},color:{get:function(){return this._color},set:function(e){var t=this._color;Color.equals(t,e)||(Color.clone(e,t),makeDirty$3(this,COLOR_INDEX$5))}},rotation:{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,makeDirty$3(this,ROTATION_INDEX$1))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){var t=this._alignedAxis;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty$3(this,ALIGNED_AXIS_INDEX$1))}},width:{get:function(){return defaultValue(this._width,this._imageWidth)},set:function(e){this._width!==e&&(this._width=e,makeDirty$3(this,IMAGE_INDEX_INDEX$1))}},height:{get:function(){return defaultValue(this._height,this._imageHeight)},set:function(e){this._height!==e&&(this._height=e,makeDirty$3(this,IMAGE_INDEX_INDEX$1))}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){this._sizeInMeters!==e&&(this._sizeInMeters=e,makeDirty$3(this,COLOR_INDEX$5))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){DistanceDisplayCondition.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition),makeDirty$3(this,DISTANCE_DISPLAY_CONDITION$2))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,makeDirty$3(this,DISABLE_DEPTH_DISTANCE$1))}},id:{get:function(){return this._id},set:function(e){this._id=e,defined(this._pickId)&&(this._pickId.object.id=e)}},pickPrimitive:{get:function(){return this._pickPrimitive},set:function(e){this._pickPrimitive=e,defined(this._pickId)&&(this._pickId.object.primitive=e)}},pickId:{get:function(){return this._pickId}},image:{get:function(){return this._imageId},set:function(e){defined(e)?"string"==typeof e?this.setImage(e,e):e instanceof Resource?this.setImage(e.url,e):defined(e.src)?this.setImage(e.src,e):this.setImage(createGuid(),e):(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=void 0,this._image=void 0,this._imageIndexPromise=void 0,makeDirty$3(this,IMAGE_INDEX_INDEX$1))}},ready:{get:function(){return-1!==this._imageIndex}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=Cartesian3.clone(e,this._actualClampedPosition),makeDirty$3(this,POSITION_INDEX$7)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,makeDirty$3(this,SHOW_INDEX$7))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;Color.equals(t,e)||(Color.clone(e,t),makeDirty$3(this,SDF_INDEX$1))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,makeDirty$3(this,SDF_INDEX$1))}}}),Billboard.prototype.getPickId=function(e){return defined(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId},Billboard.prototype._updateClamping=function(){Billboard._updateClamping(this._billboardCollection,this)};var scratchCartographic$d=new Cartographic,scratchPosition$5=new Cartesian3;Billboard._updateClamping=function(e,t){var i=e._scene;if(defined(i)&&defined(i.globe)){var r=i.globe,n=r.ellipsoid,a=r._surface,o=i.frameState.mode,s=o!==t._mode;if(t._mode=o,(t._heightReference===HeightReference$1.NONE||s)&&defined(t._removeCallbackFunc)&&(t._removeCallbackFunc(),t._removeCallbackFunc=void 0,t._clampedPosition=void 0),t._heightReference!==HeightReference$1.NONE&&defined(t._position)){var l=n.cartesianToCartographic(t._position);if(defined(l)){defined(t._removeCallbackFunc)&&t._removeCallbackFunc(),t._removeCallbackFunc=a.updateHeight(l,u),Cartographic.clone(l,scratchCartographic$d);var c=r.getHeight(l);defined(c)&&(scratchCartographic$d.height=c),n.cartographicToCartesian(scratchCartographic$d,scratchPosition$5),u(scratchPosition$5)}else t._actualClampedPosition=void 0}}function u(e){if(t._heightReference===HeightReference$1.RELATIVE_TO_GROUND)if(t._mode===SceneMode$1.SCENE3D){var i=n.cartesianToCartographic(e,scratchCartographic$d);i.height+=l.height,n.cartographicToCartesian(i,e)}else e.x+=l.height;t._clampedPosition=Cartesian3.clone(e,t._clampedPosition)}},Billboard.prototype._loadImage=function(){var e,t=this._billboardCollection._textureAtlas,i=this._imageId,r=this._image,n=this._imageSubRegion;if(defined(r)&&(e=t.addImage(i,r)),defined(n)&&(e=t.addSubRegion(i,n)),this._imageIndexPromise=e,defined(e)){var a=this;e.then((function(e){if(a._imageId===i&&a._image===r&&BoundingRectangle.equals(a._imageSubRegion,n)){var o=t.textureCoordinates[e];a._imageWidth=t.texture.width*o.width,a._imageHeight=t.texture.height*o.height,a._imageIndex=e,a._ready=!0,a._image=void 0,a._imageIndexPromise=void 0,makeDirty$3(a,IMAGE_INDEX_INDEX$1)}})).otherwise((function(e){console.error("Error loading image for billboard: "+e),a._imageIndexPromise=void 0}))}},Billboard.prototype.setImage=function(e,t){this._imageId!==e&&(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=e,this._image=t,defined(this._billboardCollection._textureAtlas)&&this._loadImage())},Billboard.prototype.setImageSubRegion=function(e,t){this._imageId===e&&BoundingRectangle.equals(this._imageSubRegion,t)||(this._imageIndex=-1,this._imageId=e,this._imageSubRegion=BoundingRectangle.clone(t),defined(this._billboardCollection._textureAtlas)&&this._loadImage())},Billboard.prototype._setTranslate=function(e){var t=this._translate;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),makeDirty$3(this,PIXEL_OFFSET_INDEX$1))},Billboard.prototype._getActualPosition=function(){return defined(this._clampedPosition)?this._clampedPosition:this._actualPosition},Billboard.prototype._setActualPosition=function(e){defined(this._clampedPosition)||Cartesian3.clone(e,this._actualPosition),makeDirty$3(this,POSITION_INDEX$7)};var tempCartesian3$1=new Cartesian4;Billboard._computeActualPosition=function(e,t,i,r){return defined(e._clampedPosition)?(i.mode!==e._mode&&e._updateClamping(),e._clampedPosition):i.mode===SceneMode$1.SCENE3D?t:(Matrix4.multiplyByPoint(r,t,tempCartesian3$1),SceneTransforms.computeActualWgs84Position(i,tempCartesian3$1))};var scratchCartesian3$4=new Cartesian3;Billboard._computeScreenSpacePosition=function(e,t,i,r,n,a){var o=Matrix4.multiplyByPoint(e,t,scratchCartesian3$4),s=SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates(n,o,i,a);if(defined(s))return Cartesian2.add(s,r,s),s};var scratchPixelOffset=new Cartesian2(0,0);Billboard.prototype.computeScreenSpacePosition=function(e,t){var i=this._billboardCollection;defined(t)||(t=new Cartesian2),Cartesian2.clone(this._pixelOffset,scratchPixelOffset),Cartesian2.add(scratchPixelOffset,this._translate,scratchPixelOffset);var r=i.modelMatrix,n=this._position;if(defined(this._clampedPosition)&&(n=this._clampedPosition,e.mode!==SceneMode$1.SCENE3D)){var a=e.mapProjection,o=a.ellipsoid,s=a.unproject(n,scratchCartographic$d);n=o.cartographicToCartesian(s,scratchCartesian3$4),r=Matrix4.IDENTITY}return Billboard._computeScreenSpacePosition(r,n,this._eyeOffset,scratchPixelOffset,e,t)},Billboard.getScreenSpaceBoundingBox=function(e,t,i){var r=e.width,n=e.height,a=e.scale;r*=a,n*=a;var o=t.x;e.horizontalOrigin===HorizontalOrigin$1.RIGHT?o-=r:e.horizontalOrigin===HorizontalOrigin$1.CENTER&&(o-=.5*r);var s=t.y;return e.verticalOrigin===VerticalOrigin$1.BOTTOM||e.verticalOrigin===VerticalOrigin$1.BASELINE?s-=n:e.verticalOrigin===VerticalOrigin$1.CENTER&&(s-=.5*n),defined(i)||(i=new BoundingRectangle),i.x=o,i.y=s,i.width=r,i.height=n,i},Billboard.prototype.equals=function(e){return this===e||defined(e)&&this._id===e._id&&Cartesian3.equals(this._position,e._position)&&this._imageId===e._imageId&&this._show===e._show&&this._scale===e._scale&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&BoundingRectangle.equals(this._imageSubRegion,e._imageSubRegion)&&Color.equals(this._color,e._color)&&Cartesian2.equals(this._pixelOffset,e._pixelOffset)&&Cartesian2.equals(this._translate,e._translate)&&Cartesian3.equals(this._eyeOffset,e._eyeOffset)&&NearFarScalar.equals(this._scaleByDistance,e._scaleByDistance)&&NearFarScalar.equals(this._translucencyByDistance,e._translucencyByDistance)&&NearFarScalar.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&DistanceDisplayCondition.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance},Billboard.prototype._destroy=function(){defined(this._customData)&&(this._billboardCollection._scene.globe._surface.removeTileCustomData(this._customData),this._customData=void 0),defined(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this.image=void 0,this._pickId=this._pickId&&this._pickId.destroy(),this._billboardCollection=void 0};var BlendOption={OPAQUE:0,TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2},BlendOption$1=Object.freeze(BlendOption),SDFSettings={FONT_SIZE:48,PADDING:10,RADIUS:8,CUTOFF:.25},SDFSettings$1=Object.freeze(SDFSettings);function TextureAtlasNode(e,t,i,r,n){this.bottomLeft=defaultValue(e,Cartesian2.ZERO),this.topRight=defaultValue(t,Cartesian2.ZERO),this.childNode1=i,this.childNode2=r,this.imageIndex=n}var defaultInitialSize=new Cartesian2(16,16);function TextureAtlas(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=defaultValue(e.borderWidthInPixels,1),i=defaultValue(e.initialSize,defaultInitialSize);this._context=e.context,this._pixelFormat=defaultValue(e.pixelFormat,PixelFormat$1.RGBA),this._borderWidthInPixels=t,this._textureCoordinates=[],this._guid=createGuid(),this._idHash={},this._initialSize=i,this._root=void 0}function resizeAtlas(e,t){var i=e._context,r=e.numberOfImages,n=e._borderWidthInPixels;if(r>0){for(var a=e._texture.width,o=e._texture.height,s=2*(a+t.width+n),l=2*(o+t.height+n),c=a/s,u=o/l,d=new TextureAtlasNode(new Cartesian2(a+n,n),new Cartesian2(s,o)),h=new TextureAtlasNode(new Cartesian2,new Cartesian2(s,o),e._root,d),p=new TextureAtlasNode(new Cartesian2(n,o+n),new Cartesian2(s,l)),f=new TextureAtlasNode(new Cartesian2,new Cartesian2(s,l),h,p),m=0;m<e._textureCoordinates.length;m++){var g=e._textureCoordinates[m];defined(g)&&(g.x*=c,g.y*=u,g.width*=c,g.height*=u)}var _=new Texture({context:e._context,width:s,height:l,pixelFormat:e._pixelFormat}),y=new Framebuffer({context:i,colorTextures:[e._texture],destroyAttachments:!1});y._bind(),_.copyFromFramebuffer(0,0,0,0,s,l),y._unBind(),y.destroy(),e._texture=e._texture&&e._texture.destroy(),e._texture=_,e._root=f}else{var v=2*(t.width+2*n),C=2*(t.height+2*n);v<e._initialSize.x&&(v=e._initialSize.x),C<e._initialSize.y&&(C=e._initialSize.y),e._texture=e._texture&&e._texture.destroy(),e._texture=new Texture({context:e._context,width:v,height:C,pixelFormat:e._pixelFormat}),e._root=new TextureAtlasNode(new Cartesian2(n,n),new Cartesian2(v,C))}}function findNode(e,t,i){if(defined(t)){if(!defined(t.childNode1)&&!defined(t.childNode2)){if(defined(t.imageIndex))return;var r=t.topRight.x-t.bottomLeft.x,n=t.topRight.y-t.bottomLeft.y,a=r-i.width,o=n-i.height;if(a<0||o<0)return;if(0===a&&0===o)return t;if(a>o){t.childNode1=new TextureAtlasNode(new Cartesian2(t.bottomLeft.x,t.bottomLeft.y),new Cartesian2(t.bottomLeft.x+i.width,t.topRight.y));var s=t.bottomLeft.x+i.width+e._borderWidthInPixels;s<t.topRight.x&&(t.childNode2=new TextureAtlasNode(new Cartesian2(s,t.bottomLeft.y),new Cartesian2(t.topRight.x,t.topRight.y)))}else{t.childNode1=new TextureAtlasNode(new Cartesian2(t.bottomLeft.x,t.bottomLeft.y),new Cartesian2(t.topRight.x,t.bottomLeft.y+i.height));var l=t.bottomLeft.y+i.height+e._borderWidthInPixels;l<t.topRight.y&&(t.childNode2=new TextureAtlasNode(new Cartesian2(t.bottomLeft.x,l),new Cartesian2(t.topRight.x,t.topRight.y)))}return findNode(e,t.childNode1,i)}return findNode(e,t.childNode1,i)||findNode(e,t.childNode2,i)}}function addImage(e,t,i){var r=findNode(e,e._root,t);if(defined(r)){r.imageIndex=i;var n=e._texture.width,a=e._texture.height,o=r.topRight.x-r.bottomLeft.x,s=r.topRight.y-r.bottomLeft.y,l=r.bottomLeft.x/n,c=r.bottomLeft.y/a,u=o/n,d=s/a;e._textureCoordinates[i]=new BoundingRectangle(l,c,u,d),e._texture.copyFrom({source:t,xOffset:r.bottomLeft.x,yOffset:r.bottomLeft.y})}else resizeAtlas(e,t),addImage(e,t,i);e._guid=createGuid()}Object.defineProperties(TextureAtlas.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},textureCoordinates:{get:function(){return this._textureCoordinates}},texture:{get:function(){return defined(this._texture)||(this._texture=new Texture({context:this._context,width:this._initialSize.x,height:this._initialSize.y,pixelFormat:this._pixelFormat})),this._texture}},numberOfImages:{get:function(){return this._textureCoordinates.length}},guid:{get:function(){return this._guid}}}),TextureAtlas.prototype.addImage=function(e,t){var i=this._idHash[e];if(defined(i))return i;if("function"==typeof t)t=t(e);else if("string"==typeof t||t instanceof Resource){t=Resource.createIfNeeded(t).fetchImage()}var r=this;return i=when(t,(function(e){if(r.isDestroyed())return-1;var t=r.numberOfImages;return addImage(r,e,t),t})),this._idHash[e]=i,i},TextureAtlas.prototype.addSubRegion=function(e,t){var i=this._idHash[e];if(!defined(i))throw new RuntimeError('image with id "'+e+'" not found in the atlas.');var r=this;return when(i,(function(e){if(-1===e)return-1;var i=r._texture.width,n=r._texture.height,a=r.numberOfImages,o=r._textureCoordinates[e],s=o.x+t.x/i,l=o.y+t.y/n,c=t.width/i,u=t.height/n;return r._textureCoordinates.push(new BoundingRectangle(s,l,c,u)),r._guid=createGuid(),a}))},TextureAtlas.prototype.isDestroyed=function(){return!1},TextureAtlas.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),destroyObject(this)};var SHOW_INDEX$6=Billboard.SHOW_INDEX,POSITION_INDEX$6=Billboard.POSITION_INDEX,PIXEL_OFFSET_INDEX=Billboard.PIXEL_OFFSET_INDEX,EYE_OFFSET_INDEX=Billboard.EYE_OFFSET_INDEX,HORIZONTAL_ORIGIN_INDEX=Billboard.HORIZONTAL_ORIGIN_INDEX,VERTICAL_ORIGIN_INDEX=Billboard.VERTICAL_ORIGIN_INDEX,SCALE_INDEX$2=Billboard.SCALE_INDEX,IMAGE_INDEX_INDEX=Billboard.IMAGE_INDEX_INDEX,COLOR_INDEX$4=Billboard.COLOR_INDEX,ROTATION_INDEX=Billboard.ROTATION_INDEX,ALIGNED_AXIS_INDEX=Billboard.ALIGNED_AXIS_INDEX,SCALE_BY_DISTANCE_INDEX$2=Billboard.SCALE_BY_DISTANCE_INDEX,TRANSLUCENCY_BY_DISTANCE_INDEX$2=Billboard.TRANSLUCENCY_BY_DISTANCE_INDEX,PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=Billboard.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX,DISTANCE_DISPLAY_CONDITION_INDEX$2=Billboard.DISTANCE_DISPLAY_CONDITION,DISABLE_DEPTH_DISTANCE=Billboard.DISABLE_DEPTH_DISTANCE,TEXTURE_COORDINATE_BOUNDS=Billboard.TEXTURE_COORDINATE_BOUNDS,SDF_INDEX=Billboard.SDF_INDEX,NUMBER_OF_PROPERTIES$4=Billboard.NUMBER_OF_PROPERTIES,attributeLocations$6,attributeLocationsBatched$1={positionHighAndScale:0,positionLowAndRotation:1,compressedAttribute0:2,compressedAttribute1:3,compressedAttribute2:4,eyeOffset:5,scaleByDistance:6,pixelOffsetScaleByDistance:7,compressedAttribute3:8,textureCoordinateBoundsOrLabelTranslate:9,a_batchId:10,sdf:11},attributeLocationsInstanced$1={direction:0,positionHighAndScale:1,positionLowAndRotation:2,compressedAttribute0:3,compressedAttribute1:4,compressedAttribute2:5,eyeOffset:6,scaleByDistance:7,pixelOffsetScaleByDistance:8,compressedAttribute3:9,textureCoordinateBoundsOrLabelTranslate:10,a_batchId:11,sdf:12},getIndexBuffer$1;function BillboardCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._textureAtlasGUID=void 0,this._destroyTextureAtlas=!0,this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!1,this._shaderRotation=!1,this._compiledShaderRotation=!1,this._shaderAlignedAxis=!1,this._compiledShaderAlignedAxis=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderPixelOffsetScaleByDistance=!1,this._compiledShaderPixelOffsetScaleByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._shaderClampToGround=!1,this._compiledShaderClampToGround=!1,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$4),this._maxSize=0,this._maxEyeOffset=0,this._maxScale=1,this._maxPixelOffset=0,this._allHorizontalCenter=!0,this._allVerticalCenter=!0,this._allSizedInMeters=!0,this._baseVolume=new BoundingSphere,this._baseVolumeWC=new BoundingSphere,this._baseVolume2D=new BoundingSphere,this._boundingVolume=new BoundingSphere,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowTextureAtlas=defaultValue(e.debugShowTextureAtlas,!1),this.blendOption=defaultValue(e.blendOption,BlendOption$1.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=SceneMode$1.SCENE3D,this._buffersUsage=[BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW],this._highlightColor=Color.clone(Color.WHITE);var t=this;this._uniforms={u_atlas:function(){return t._textureAtlas.texture},u_highlightColor:function(){return t._highlightColor}};var i=this._scene;defined(i)&&defined(i.terrainProviderChanged)&&(this._removeCallbackFunc=i.terrainProviderChanged.addEventListener((function(){for(var e=this._billboards,t=e.length,i=0;i<t;++i)defined(e[i])&&e[i]._updateClamping()}),this))}function destroyBillboards(e){for(var t=e.length,i=0;i<t;++i)e[i]&&e[i]._destroy()}function removeBillboards(e){if(e._billboardsRemoved){e._billboardsRemoved=!1;for(var t=[],i=e._billboards,r=i.length,n=0,a=0;n<r;++n){var o=i[n];defined(o)&&(o._index=a++,t.push(o))}e._billboards=t}}function getIndexBufferBatched$1(e){var t=e.cache.billboardCollection_indexBufferBatched;if(defined(t))return t;for(var i=new Uint16Array(98298),r=0,n=0;r<98298;r+=6,n+=4)i[r]=n,i[r+1]=n+1,i[r+2]=n+2,i[r+3]=n+0,i[r+4]=n+2,i[r+5]=n+3;return(t=Buffer$1.createIndexBuffer({context:e,typedArray:i,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT})).vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferBatched=t,t}function getIndexBufferInstanced$1(e){var t=e.cache.billboardCollection_indexBufferInstanced;return defined(t)||((t=Buffer$1.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT})).vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferInstanced=t),t}function getVertexBufferInstanced$1(e){var t=e.cache.billboardCollection_vertexBufferInstanced;return defined(t)||((t=Buffer$1.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:BufferUsage$1.STATIC_DRAW})).vertexArrayDestroyable=!1,e.cache.billboardCollection_vertexBufferInstanced=t),t}function createVAF$2(e,t,i,r,n,a){var o=[{index:attributeLocations$6.positionHighAndScale,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[POSITION_INDEX$6]},{index:attributeLocations$6.positionLowAndRotation,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[POSITION_INDEX$6]},{index:attributeLocations$6.compressedAttribute0,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[PIXEL_OFFSET_INDEX]},{index:attributeLocations$6.compressedAttribute1,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[TRANSLUCENCY_BY_DISTANCE_INDEX$2]},{index:attributeLocations$6.compressedAttribute2,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[COLOR_INDEX$4]},{index:attributeLocations$6.eyeOffset,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[EYE_OFFSET_INDEX]},{index:attributeLocations$6.scaleByDistance,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[SCALE_BY_DISTANCE_INDEX$2]},{index:attributeLocations$6.pixelOffsetScaleByDistance,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX]},{index:attributeLocations$6.compressedAttribute3,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[DISTANCE_DISPLAY_CONDITION_INDEX$2]},{index:attributeLocations$6.textureCoordinateBoundsOrLabelTranslate,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[TEXTURE_COORDINATE_BOUNDS]}];return r&&o.push({index:attributeLocations$6.direction,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT,vertexBuffer:getVertexBufferInstanced$1(e)}),defined(n)&&o.push({index:attributeLocations$6.a_batchId,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.FLOAT,bufferUsage:BufferUsage$1.STATIC_DRAW}),a&&o.push({index:attributeLocations$6.sdf,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[SDF_INDEX]}),new VertexArrayFacade(e,o,r?t:4*t,r)}Object.defineProperties(BillboardCollection.prototype,{length:{get:function(){return removeBillboards(this),this._billboards.length}},textureAtlas:{get:function(){return this._textureAtlas},set:function(e){this._textureAtlas!==e&&(this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._textureAtlas=e,this._createVertexArray=!0)}},destroyTextureAtlas:{get:function(){return this._destroyTextureAtlas},set:function(e){this._destroyTextureAtlas=e}}}),BillboardCollection.prototype.add=function(e){var t=new Billboard(e,this);return t._index=this._billboards.length,this._billboards.push(t),this._createVertexArray=!0,t},BillboardCollection.prototype.remove=function(e){return!!this.contains(e)&&(this._billboards[e._index]=void 0,this._billboardsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},BillboardCollection.prototype.removeAll=function(){destroyBillboards(this._billboards),this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!0},BillboardCollection.prototype._updateBillboard=function(e,t){e._dirty||(this._billboardsToUpdate[this._billboardsToUpdateIndex++]=e),++this._propertiesChanged[t]},BillboardCollection.prototype.contains=function(e){return defined(e)&&e._billboardCollection===this},BillboardCollection.prototype.get=function(e){return removeBillboards(this),this._billboards[e]},BillboardCollection.prototype.computeNewBuffersUsage=function(){for(var e=this._buffersUsage,t=!1,i=this._propertiesChanged,r=0;r<NUMBER_OF_PROPERTIES$4;++r){var n=0===i[r]?BufferUsage$1.STATIC_DRAW:BufferUsage$1.STREAM_DRAW;t=t||e[r]!==n,e[r]=n}return t};var writePositionScratch$2=new EncodedCartesian3;function writePositionScaleAndRotation(e,t,i,r,n){var a,o=r[attributeLocations$6.positionHighAndScale],s=r[attributeLocations$6.positionLowAndRotation],l=n._getActualPosition();e._mode===SceneMode$1.SCENE3D&&(BoundingSphere.expand(e._baseVolume,l,e._baseVolume),e._boundingVolumeDirty=!0),EncodedCartesian3.fromCartesian(l,writePositionScratch$2);var c=n.scale,u=n.rotation;0!==u&&(e._shaderRotation=!0),e._maxScale=Math.max(e._maxScale,c);var d=writePositionScratch$2.high,h=writePositionScratch$2.low;e._instanced?(o(a=n._index,d.x,d.y,d.z,c),s(a,h.x,h.y,h.z,u)):(o((a=4*n._index)+0,d.x,d.y,d.z,c),o(a+1,d.x,d.y,d.z,c),o(a+2,d.x,d.y,d.z,c),o(a+3,d.x,d.y,d.z,c),s(a+0,h.x,h.y,h.z,u),s(a+1,h.x,h.y,h.z,u),s(a+2,h.x,h.y,h.z,u),s(a+3,h.x,h.y,h.z,u))}var scratchCartesian2$3=new Cartesian2,UPPER_BOUND=32768,LEFT_SHIFT16$1=65536,LEFT_SHIFT12=4096,LEFT_SHIFT8$1=256,LEFT_SHIFT7=128,LEFT_SHIFT5=32,LEFT_SHIFT3=8,LEFT_SHIFT2=4,RIGHT_SHIFT8=1/256,LOWER_LEFT=0,LOWER_RIGHT=2,UPPER_RIGHT=3,UPPER_LEFT=1;function writeCompressedAttrib0$1(e,t,i,r,n){var a,o=r[attributeLocations$6.compressedAttribute0],s=n.pixelOffset,l=s.x,c=s.y,u=n._translate,d=u.x,h=u.y;e._maxPixelOffset=Math.max(e._maxPixelOffset,Math.abs(l+d),Math.abs(-c+h));var p=n.horizontalOrigin,f=n._verticalOrigin,m=n.show&&n.clusterShow;0===n.color.alpha&&(m=!1),f===VerticalOrigin$1.BASELINE&&(f=VerticalOrigin$1.BOTTOM),e._allHorizontalCenter=e._allHorizontalCenter&&p===HorizontalOrigin$1.CENTER,e._allVerticalCenter=e._allVerticalCenter&&f===VerticalOrigin$1.CENTER;var g=0,_=0,y=0,v=0,C=n._imageIndex;if(-1!==C){var T=i[C];g=T.x,_=T.y,y=T.width,v=T.height}var S=g+y,A=_+v,x=Math.floor(CesiumMath.clamp(l,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*LEFT_SHIFT7;x+=(p+1)*LEFT_SHIFT5,x+=(f+1)*LEFT_SHIFT3,x+=(m?1:0)*LEFT_SHIFT2;var E=Math.floor(CesiumMath.clamp(c,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*LEFT_SHIFT8$1,b=Math.floor(CesiumMath.clamp(d,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*LEFT_SHIFT8$1,P=(CesiumMath.clamp(h,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*RIGHT_SHIFT8,D=Math.floor(P);E+=D,b+=Math.floor((P-D)*LEFT_SHIFT8$1),scratchCartesian2$3.x=g,scratchCartesian2$3.y=_;var w=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);scratchCartesian2$3.x=S;var M=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);scratchCartesian2$3.y=A;var I=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);scratchCartesian2$3.x=g;var R=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);e._instanced?o(a=n._index,x,E,b,w):(o((a=4*n._index)+0,x+LOWER_LEFT,E,b,w),o(a+1,x+LOWER_RIGHT,E,b,M),o(a+2,x+UPPER_RIGHT,E,b,I),o(a+3,x+UPPER_LEFT,E,b,R))}function writeCompressedAttrib1$1(e,t,i,r,n){var a,o=r[attributeLocations$6.compressedAttribute1],s=n.alignedAxis;Cartesian3.equals(s,Cartesian3.ZERO)||(e._shaderAlignedAxis=!0);var l=0,c=1,u=1,d=1,h=n.translucencyByDistance;defined(h)&&(l=h.near,c=h.nearValue,u=h.far,d=h.farValue,1===c&&1===d||(e._shaderTranslucencyByDistance=!0));var p=0,f=n._imageIndex;-1!==f&&(p=i[f].width);var m=e._textureAtlas.texture.width,g=Math.round(defaultValue(n.width,m*p));e._maxSize=Math.max(e._maxSize,g);var _=CesiumMath.clamp(g,0,LEFT_SHIFT16$1),y=0;Math.abs(Cartesian3.magnitudeSquared(s)-1)<CesiumMath.EPSILON6&&(y=AttributeCompression.octEncodeFloat(s)),c=CesiumMath.clamp(c,0,1),_=_*LEFT_SHIFT8$1+(c=1===c?255:255*c|0),d=CesiumMath.clamp(d,0,1),y=y*LEFT_SHIFT8$1+(d=1===d?255:255*d|0),e._instanced?o(a=n._index,_,y,l,u):(o((a=4*n._index)+0,_,y,l,u),o(a+1,_,y,l,u),o(a+2,_,y,l,u),o(a+3,_,y,l,u))}function writeCompressedAttrib2(e,t,i,r,n){var a,o=r[attributeLocations$6.compressedAttribute2],s=n.color,l=defined(e._batchTable)?Color.WHITE:n.getPickId(t.context).color,c=n.sizeInMeters?1:0,u=Math.abs(Cartesian3.magnitudeSquared(n.alignedAxis)-1)<CesiumMath.EPSILON6?1:0;e._allSizedInMeters=e._allSizedInMeters&&1===c;var d=0,h=n._imageIndex;-1!==h&&(d=i[h].height);var p=e._textureAtlas.texture.dimensions,f=Math.round(defaultValue(n.height,p.y*d));e._maxSize=Math.max(e._maxSize,f);var m=defaultValue(n._labelHorizontalOrigin,-2),g=f*LEFT_SHIFT2+(m+=2),_=Color.floatToByte(s.red),y=Color.floatToByte(s.green),v=Color.floatToByte(s.blue),C=_*LEFT_SHIFT16$1+y*LEFT_SHIFT8$1+v;_=Color.floatToByte(l.red),y=Color.floatToByte(l.green),v=Color.floatToByte(l.blue);var T=_*LEFT_SHIFT16$1+y*LEFT_SHIFT8$1+v,S=Color.floatToByte(s.alpha)*LEFT_SHIFT16$1+Color.floatToByte(l.alpha)*LEFT_SHIFT8$1;S+=2*c+u,e._instanced?o(a=n._index,C,T,S,g):(o((a=4*n._index)+0,C,T,S,g),o(a+1,C,T,S,g),o(a+2,C,T,S,g),o(a+3,C,T,S,g))}function writeEyeOffset(e,t,i,r,n){var a,o=r[attributeLocations$6.eyeOffset],s=n.eyeOffset,l=s.z;if(n._heightReference!==HeightReference$1.NONE&&(l*=1.005),e._maxEyeOffset=Math.max(e._maxEyeOffset,Math.abs(s.x),Math.abs(s.y),Math.abs(l)),e._instanced){var c=0,u=0,d=n._imageIndex;if(-1!==d){var h=i[d];c=h.width,u=h.height}scratchCartesian2$3.x=c,scratchCartesian2$3.y=u;var p=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);o(a=n._index,s.x,s.y,l,p)}else o((a=4*n._index)+0,s.x,s.y,l,0),o(a+1,s.x,s.y,l,0),o(a+2,s.x,s.y,l,0),o(a+3,s.x,s.y,l,0)}function writeScaleByDistance$1(e,t,i,r,n){var a,o=r[attributeLocations$6.scaleByDistance],s=0,l=1,c=1,u=1,d=n.scaleByDistance;defined(d)&&(s=d.near,l=d.nearValue,c=d.far,u=d.farValue,1===l&&1===u||(e._shaderScaleByDistance=!0)),e._instanced?o(a=n._index,s,l,c,u):(o((a=4*n._index)+0,s,l,c,u),o(a+1,s,l,c,u),o(a+2,s,l,c,u),o(a+3,s,l,c,u))}function writePixelOffsetScaleByDistance(e,t,i,r,n){var a,o=r[attributeLocations$6.pixelOffsetScaleByDistance],s=0,l=1,c=1,u=1,d=n.pixelOffsetScaleByDistance;defined(d)&&(s=d.near,l=d.nearValue,c=d.far,u=d.farValue,1===l&&1===u||(e._shaderPixelOffsetScaleByDistance=!0)),e._instanced?o(a=n._index,s,l,c,u):(o((a=4*n._index)+0,s,l,c,u),o(a+1,s,l,c,u),o(a+2,s,l,c,u),o(a+3,s,l,c,u))}function writeCompressedAttribute3(e,t,i,r,n){var a,o=r[attributeLocations$6.compressedAttribute3],s=0,l=Number.MAX_VALUE,c=n.distanceDisplayCondition;defined(c)&&(s=c.near,l=c.far,s*=s,l*=l,e._shaderDistanceDisplayCondition=!0);var u,d,h=n.disableDepthTestDistance,p=n.heightReference===HeightReference$1.CLAMP_TO_GROUND&&t.context.depthTexture;if(defined(h)||(h=p?5e3:0),h*=h,(p||h>0)&&(e._shaderDisableDepthDistance=!0,h===Number.POSITIVE_INFINITY&&(h=-1)),defined(n._labelDimensions))d=n._labelDimensions.x,u=n._labelDimensions.y;else{var f=0,m=0,g=n._imageIndex;if(-1!==g){var _=i[g];f=_.height,m=_.width}u=Math.round(defaultValue(n.height,e._textureAtlas.texture.dimensions.y*f));var y=e._textureAtlas.texture.width;d=Math.round(defaultValue(n.width,y*m))}var v=Math.floor(CesiumMath.clamp(d,0,LEFT_SHIFT12)),C=Math.floor(CesiumMath.clamp(u,0,LEFT_SHIFT12)),T=v*LEFT_SHIFT12+C;e._instanced?o(a=n._index,s,l,h,T):(o((a=4*n._index)+0,s,l,h,T),o(a+1,s,l,h,T),o(a+2,s,l,h,T),o(a+3,s,l,h,T))}function writeTextureCoordinateBoundsOrLabelTranslate(e,t,i,r,n){if(n.heightReference===HeightReference$1.CLAMP_TO_GROUND){var a=e._scene,o=t.context,s=t.globeTranslucencyState.translucent,l=defined(a.globe)&&a.globe.depthTestAgainstTerrain;e._shaderClampToGround=o.depthTexture&&!s&&l}var c,u=r[attributeLocations$6.textureCoordinateBoundsOrLabelTranslate];if(ContextLimits.maximumVertexTextureImageUnits>0){var d=0,h=0;return defined(n._labelTranslate)&&(d=n._labelTranslate.x,h=n._labelTranslate.y),void(e._instanced?u(c=n._index,d,h,0,0):(u((c=4*n._index)+0,d,h,0,0),u(c+1,d,h,0,0),u(c+2,d,h,0,0),u(c+3,d,h,0,0)))}var p=0,f=0,m=0,g=0,_=n._imageIndex;if(-1!==_){var y=i[_];p=y.x,f=y.y,m=y.width,g=y.height}var v=p+m,C=f+g;e._instanced?u(c=n._index,p,f,v,C):(u((c=4*n._index)+0,p,f,v,C),u(c+1,p,f,v,C),u(c+2,p,f,v,C),u(c+3,p,f,v,C))}function writeBatchId(e,t,i,r,n){if(defined(e._batchTable)){var a,o=r[attributeLocations$6.a_batchId],s=n._batchIndex;e._instanced?o(a=n._index,s):(o((a=4*n._index)+0,s),o(a+1,s),o(a+2,s),o(a+3,s))}}function writeSDF(e,t,i,r,n){if(e._sdf){var a,o=r[attributeLocations$6.sdf],s=n.outlineColor,l=n.outlineWidth,c=Color.floatToByte(s.red),u=Color.floatToByte(s.green),d=Color.floatToByte(s.blue),h=c*LEFT_SHIFT16$1+u*LEFT_SHIFT8$1+d,p=l/SDFSettings$1.RADIUS,f=Color.floatToByte(s.alpha)*LEFT_SHIFT16$1+Color.floatToByte(p)*LEFT_SHIFT8$1;e._instanced?o(a=n._index,h,f):(o((a=4*n._index)+0,h+LOWER_LEFT,f),o(a+1,h+LOWER_RIGHT,f),o(a+2,h+UPPER_RIGHT,f),o(a+3,h+UPPER_LEFT,f))}}function writeBillboard(e,t,i,r,n){writePositionScaleAndRotation(e,t,i,r,n),writeCompressedAttrib0$1(e,t,i,r,n),writeCompressedAttrib1$1(e,t,i,r,n),writeCompressedAttrib2(e,t,i,r,n),writeEyeOffset(e,t,i,r,n),writeScaleByDistance$1(e,t,i,r,n),writePixelOffsetScaleByDistance(e,t,i,r,n),writeCompressedAttribute3(e,t,i,r,n),writeTextureCoordinateBoundsOrLabelTranslate(e,t,i,r,n),writeBatchId(e,t,i,r,n),writeSDF(e,t,i,r,n)}function recomputeActualPositions$1(e,t,i,r,n,a){var o;r.mode===SceneMode$1.SCENE3D?(o=e._baseVolume,e._boundingVolumeDirty=!0):o=e._baseVolume2D;for(var s=[],l=0;l<i;++l){var c=t[l],u=c.position,d=Billboard._computeActualPosition(c,u,r,n);defined(d)&&(c._setActualPosition(d),a?s.push(d):BoundingSphere.expand(o,d,o))}a&&BoundingSphere.fromPoints(s,o)}function updateMode$2(e,t){var i=t.mode,r=e._billboards,n=e._billboardsToUpdate,a=e._modelMatrix;e._createVertexArray||e._mode!==i||i!==SceneMode$1.SCENE3D&&!Matrix4.equals(a,e.modelMatrix)?(e._mode=i,Matrix4.clone(e.modelMatrix,a),e._createVertexArray=!0,i!==SceneMode$1.SCENE3D&&i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions$1(e,r,r.length,t,a,!0)):i===SceneMode$1.MORPHING?recomputeActualPositions$1(e,r,r.length,t,a,!0):i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions$1(e,n,e._billboardsToUpdateIndex,t,a,!1)}function updateBoundingVolume$1(e,t,i){var r=1;e._allSizedInMeters&&0===e._maxPixelOffset||(r=t.camera.getPixelSize(i,t.context.drawingBufferWidth,t.context.drawingBufferHeight));var n=r*e._maxScale*e._maxSize*2;e._allHorizontalCenter&&e._allVerticalCenter&&(n*=.5);var a=r*e._maxPixelOffset+e._maxEyeOffset;i.radius+=n+a}function createDebugCommand(e,t){var i=t.createViewportQuadCommand("uniform sampler2D billboard_texture; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n gl_FragColor = texture2D(billboard_texture, v_textureCoordinates); \n} \n",{uniformMap:{billboard_texture:function(){return e._textureAtlas.texture}}});return i.pass=Pass$1.OVERLAY,i}var scratchWriterArray$2=[];function createBillboardPointCallback(e,t,i,r,n){return function(){var a=document.createElement("canvas"),o=n+2*r;a.height=a.width=o;var s=a.getContext("2d");return s.clearRect(0,0,o,o),0!==r&&(s.beginPath(),s.arc(o/2,o/2,o/2,0,2*Math.PI,!0),s.closePath(),s.fillStyle=i,s.fill(),e<1&&(s.save(),s.globalCompositeOperation="destination-out",s.beginPath(),s.arc(o/2,o/2,n/2,0,2*Math.PI,!0),s.closePath(),s.fillStyle="black",s.fill(),s.restore())),s.beginPath(),s.arc(o/2,o/2,n/2,0,2*Math.PI,!0),s.closePath(),s.fillStyle=t,s.fill(),a}}function Cesium3DTilePointFeature(e,t,i,r,n){this._content=e,this._billboard=i,this._label=r,this._polyline=n,this._batchId=t,this._billboardImage=void 0,this._billboardColor=void 0,this._billboardOutlineColor=void 0,this._billboardOutlineWidth=void 0,this._billboardSize=void 0,this._pointSize=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._heightOffset=void 0,this._pickIds=new Array(3),setBillboardImage(this)}BillboardCollection.prototype.update=function(e){if(removeBillboards(this),this.show){var t=this._billboards,i=t.length,r=e.context;this._instanced=r.instancedArrays,attributeLocations$6=this._instanced?attributeLocationsInstanced$1:attributeLocationsBatched$1,getIndexBuffer$1=this._instanced?getIndexBufferInstanced$1:getIndexBufferBatched$1;var n=this._textureAtlas;if(!defined(n)){n=this._textureAtlas=new TextureAtlas({context:r});for(var a=0;a<i;++a)t[a]._loadImage()}var o=n.textureCoordinates;if(0!==o.length){updateMode$2(this,e),i=(t=this._billboards).length;var s,l=this._billboardsToUpdate,c=this._billboardsToUpdateIndex,u=this._propertiesChanged,d=n.guid,h=this._createVertexArray||this._textureAtlasGUID!==d;this._textureAtlasGUID=d;var p=e.passes,f=p.pick;if(h||!f&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(var m=0;m<NUMBER_OF_PROPERTIES$4;++m)u[m]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),i>0){this._vaf=createVAF$2(r,i,this._buffersUsage,this._instanced,this._batchTable,this._sdf),s=this._vaf.writers;for(var g=0;g<i;++g){var _=this._billboards[g];_._dirty=!1,writeBillboard(this,e,o,s,_)}this._vaf.commit(getIndexBuffer$1(r))}this._billboardsToUpdateIndex=0}else if(c>0){var y=scratchWriterArray$2;y.length=0,(u[POSITION_INDEX$6]||u[ROTATION_INDEX]||u[SCALE_INDEX$2])&&y.push(writePositionScaleAndRotation),(u[IMAGE_INDEX_INDEX]||u[PIXEL_OFFSET_INDEX]||u[HORIZONTAL_ORIGIN_INDEX]||u[VERTICAL_ORIGIN_INDEX]||u[SHOW_INDEX$6])&&(y.push(writeCompressedAttrib0$1),this._instanced&&y.push(writeEyeOffset)),(u[IMAGE_INDEX_INDEX]||u[ALIGNED_AXIS_INDEX]||u[TRANSLUCENCY_BY_DISTANCE_INDEX$2])&&(y.push(writeCompressedAttrib1$1),y.push(writeCompressedAttrib2)),(u[IMAGE_INDEX_INDEX]||u[COLOR_INDEX$4])&&y.push(writeCompressedAttrib2),u[EYE_OFFSET_INDEX]&&y.push(writeEyeOffset),u[SCALE_BY_DISTANCE_INDEX$2]&&y.push(writeScaleByDistance$1),u[PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX]&&y.push(writePixelOffsetScaleByDistance),(u[DISTANCE_DISPLAY_CONDITION_INDEX$2]||u[DISABLE_DEPTH_DISTANCE]||u[IMAGE_INDEX_INDEX]||u[POSITION_INDEX$6])&&y.push(writeCompressedAttribute3),(u[IMAGE_INDEX_INDEX]||u[POSITION_INDEX$6])&&y.push(writeTextureCoordinateBoundsOrLabelTranslate),u[SDF_INDEX]&&y.push(writeSDF);var v=y.length;if(s=this._vaf.writers,c/i>.1){for(var C=0;C<c;++C){var T=l[C];T._dirty=!1;for(var S=0;S<v;++S)y[S](this,e,o,s,T)}this._vaf.commit(getIndexBuffer$1(r))}else{for(var A=0;A<c;++A){var x=l[A];x._dirty=!1;for(var E=0;E<v;++E)y[E](this,e,o,s,x);this._instanced?this._vaf.subCommit(x._index,1):this._vaf.subCommit(4*x._index,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(c>1.5*i&&(l.length=i),defined(this._vaf)&&defined(this._vaf.va)){var b;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,BoundingSphere.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));var P=Matrix4.IDENTITY;e.mode===SceneMode$1.SCENE3D?(P=this.modelMatrix,b=BoundingSphere.clone(this._baseVolumeWC,this._boundingVolume)):b=BoundingSphere.clone(this._baseVolume2D,this._boundingVolume),updateBoundingVolume$1(this,e,b);var D,w,M,I,R,O=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,O){this._blendOption===BlendOption$1.OPAQUE||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LESS},depthMask:!0}):this._rsOpaque=void 0;var B=this._blendOption===BlendOption$1.TRANSLUCENT;this._blendOption===BlendOption$1.TRANSLUCENT||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=RenderState.fromCache({depthTest:{enabled:!0,func:B?WebGLConstants$1.LEQUAL:WebGLConstants$1.LESS},depthMask:B,blending:BlendingState$1.ALPHA_BLEND}):this._rsTranslucent=void 0}this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||0!==e.minimumDisableDepthTestDistance;var L=ContextLimits.maximumVertexTextureImageUnits>0;if(O||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){D=BillboardCollectionVS,w=BillboardCollectionFS,R=[],defined(this._batchTable)&&(R.push("VECTOR_TILE"),D=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(D),w=this._batchTable.getFragmentShaderCallback(!1,void 0)(w)),M=new ShaderSource({defines:R,sources:[D]}),this._instanced&&M.defines.push("INSTANCED"),this._shaderRotation&&M.defines.push("ROTATION"),this._shaderAlignedAxis&&M.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&M.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&M.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&M.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),this._shaderDistanceDisplayCondition&&M.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&M.defines.push("DISABLE_DEPTH_DISTANCE"),this._shaderClampToGround&&(L?M.defines.push("VERTEX_DEPTH_CHECK"):M.defines.push("FRAGMENT_DEPTH_CHECK"));var F=1-SDFSettings$1.CUTOFF;this._sdf&&M.defines.push("SDF");var N=defined(this._batchTable)?"VECTOR_TILE":"";this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT&&(I=new ShaderSource({defines:["OPAQUE",N],sources:[w]}),this._shaderClampToGround&&(L?I.defines.push("VERTEX_DEPTH_CHECK"):I.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(I.defines.push("SDF"),I.defines.push("SDF_EDGE "+F)),this._sp=ShaderProgram.replaceCache({context:r,shaderProgram:this._sp,vertexShaderSource:M,fragmentShaderSource:I,attributeLocations:attributeLocations$6}),I=new ShaderSource({defines:["TRANSLUCENT",N],sources:[w]}),this._shaderClampToGround&&(L?I.defines.push("VERTEX_DEPTH_CHECK"):I.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(I.defines.push("SDF"),I.defines.push("SDF_EDGE "+F)),this._spTranslucent=ShaderProgram.replaceCache({context:r,shaderProgram:this._spTranslucent,vertexShaderSource:M,fragmentShaderSource:I,attributeLocations:attributeLocations$6})),this._blendOption===BlendOption$1.OPAQUE&&(I=new ShaderSource({defines:[N],sources:[w]}),this._shaderClampToGround&&(L?I.defines.push("VERTEX_DEPTH_CHECK"):I.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(I.defines.push("SDF"),I.defines.push("SDF_EDGE "+F)),this._sp=ShaderProgram.replaceCache({context:r,shaderProgram:this._sp,vertexShaderSource:M,fragmentShaderSource:I,attributeLocations:attributeLocations$6})),this._blendOption===BlendOption$1.TRANSLUCENT&&(I=new ShaderSource({defines:[N],sources:[w]}),this._shaderClampToGround&&(L?I.defines.push("VERTEX_DEPTH_CHECK"):I.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(I.defines.push("SDF"),I.defines.push("SDF_EDGE "+F)),this._spTranslucent=ShaderProgram.replaceCache({context:r,shaderProgram:this._spTranslucent,vertexShaderSource:M,fragmentShaderSource:I,attributeLocations:attributeLocations$6})),this._compiledShaderRotation=this._shaderRotation,this._compiledShaderAlignedAxis=this._shaderAlignedAxis,this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderPixelOffsetScaleByDistance=this._shaderPixelOffsetScaleByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance,this._compiledShaderClampToGround=this._shaderClampToGround,this._compiledSDF=this._sdf}var V=e.commandList;if(p.render||p.pick){var k,U=this._colorCommands,G=this._blendOption===BlendOption$1.OPAQUE,$=this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT,z=this._vaf.va,H=z.length,W=this._uniforms;defined(this._batchTable)?(W=this._batchTable.getUniformMapCallback()(W),k=this._batchTable.getPickId()):k="v_pickColor",U.length=H;for(var j=$?2*H:H,q=0;q<j;++q){var X=U[q];defined(X)||(X=U[q]=new DrawCommand);var Y=G||$&&q%2==0;X.pass=Y||!$?Pass$1.OPAQUE:Pass$1.TRANSLUCENT,X.owner=this;var K=$?Math.floor(q/2):q;X.boundingVolume=b,X.modelMatrix=P,X.count=z[K].indicesCount,X.shaderProgram=Y?this._sp:this._spTranslucent,X.uniformMap=W,X.vertexArray=z[K].va,X.renderState=Y?this._rsOpaque:this._rsTranslucent,X.debugShowBoundingVolume=this.debugShowBoundingVolume,X.pickId=k,this._instanced&&(X.count=6,X.instanceCount=i),V.push(X)}this.debugShowTextureAtlas&&(defined(this.debugCommand)||(this.debugCommand=createDebugCommand(this,e.context)),V.push(this.debugCommand))}}}}},BillboardCollection.prototype.isDestroyed=function(){return!1},BillboardCollection.prototype.destroy=function(){return defined(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spTranslucent=this._spTranslucent&&this._spTranslucent.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),destroyBillboards(this._billboards),destroyObject(this)};var scratchCartographic$c=new Cartographic;function setBillboardImage(e){var t=e._billboard;if(defined(e._billboardImage)&&e._billboardImage!==t.image)t.image=e._billboardImage;else if(!defined(e._billboardImage)){var i=defaultValue(e._color,Cesium3DTilePointFeature.defaultColor),r=defaultValue(e._pointOutlineColor,Cesium3DTilePointFeature.defaultPointOutlineColor),n=defaultValue(e._pointOutlineWidth,Cesium3DTilePointFeature.defaultPointOutlineWidth),a=defaultValue(e._pointSize,Cesium3DTilePointFeature.defaultPointSize),o=e._billboardColor,s=e._billboardOutlineColor,l=e._billboardOutlineWidth,c=e._billboardSize;if(!Color.equals(i,o)||!Color.equals(r,s)||n!==l||a!==c){e._billboardColor=Color.clone(i,e._billboardColor),e._billboardOutlineColor=Color.clone(r,e._billboardOutlineColor),e._billboardOutlineWidth=n,e._billboardSize=a;var u=i.alpha,d=i.toCssColorString(),h=r.toCssColorString(),p=JSON.stringify([d,a,h,n]);t.setImage(p,createBillboardPointCallback(u,d,h,n,a))}}}Object.defineProperties(Cesium3DTilePointFeature.prototype,{show:{get:function(){return this._label.show},set:function(e){this._label.show=e,this._billboard.show=e,this._polyline.show=e}},color:{get:function(){return this._color},set:function(e){this._color=Color.clone(e,this._color),setBillboardImage(this)}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=e,setBillboardImage(this)}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=Color.clone(e,this._pointOutlineColor),setBillboardImage(this)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=e,setBillboardImage(this)}},labelColor:{get:function(){return this._label.fillColor},set:function(e){this._label.fillColor=e,this._polyline.show=this._label.show&&e.alpha>0}},labelOutlineColor:{get:function(){return this._label.outlineColor},set:function(e){this._label.outlineColor=e}},labelOutlineWidth:{get:function(){return this._label.outlineWidth},set:function(e){this._label.outlineWidth=e}},font:{get:function(){return this._label.font},set:function(e){this._label.font=e}},labelStyle:{get:function(){return this._label.style},set:function(e){this._label.style=e}},labelText:{get:function(){return this._label.text},set:function(e){defined(e)||(e=""),this._label.text=e}},backgroundColor:{get:function(){return this._label.backgroundColor},set:function(e){this._label.backgroundColor=e}},backgroundPadding:{get:function(){return this._label.backgroundPadding},set:function(e){this._label.backgroundPadding=e}},backgroundEnabled:{get:function(){return this._label.showBackground},set:function(e){this._label.showBackground=e}},scaleByDistance:{get:function(){return this._label.scaleByDistance},set:function(e){this._label.scaleByDistance=e,this._billboard.scaleByDistance=e}},translucencyByDistance:{get:function(){return this._label.translucencyByDistance},set:function(e){this._label.translucencyByDistance=e,this._billboard.translucencyByDistance=e}},distanceDisplayCondition:{get:function(){return this._label.distanceDisplayCondition},set:function(e){this._label.distanceDisplayCondition=e,this._polyline.distanceDisplayCondition=e,this._billboard.distanceDisplayCondition=e}},heightOffset:{get:function(){return this._heightOffset},set:function(e){var t=defaultValue(this._heightOffset,0),i=this._content.tileset.ellipsoid,r=i.cartesianToCartographic(this._billboard.position,scratchCartographic$c);r.height=r.height-t+e;var n=i.cartographicToCartesian(r);this._billboard.position=n,this._label.position=this._billboard.position,this._polyline.positions=[this._polyline.positions[0],n],this._heightOffset=e}},anchorLineEnabled:{get:function(){return this._polyline.show},set:function(e){this._polyline.show=e}},anchorLineColor:{get:function(){return this._polyline.material.uniforms.color},set:function(e){this._polyline.material.uniforms.color=Color.clone(e,this._polyline.material.uniforms.color)}},image:{get:function(){return this._billboardImage},set:function(e){var t=this._billboardImage!==e;this._billboardImage=e,t&&setBillboardImage(this)}},disableDepthTestDistance:{get:function(){return this._label.disableDepthTestDistance},set:function(e){this._label.disableDepthTestDistance=e,this._billboard.disableDepthTestDistance=e}},horizontalOrigin:{get:function(){return this._billboard.horizontalOrigin},set:function(e){this._billboard.horizontalOrigin=e}},verticalOrigin:{get:function(){return this._billboard.verticalOrigin},set:function(e){this._billboard.verticalOrigin=e}},labelHorizontalOrigin:{get:function(){return this._label.horizontalOrigin},set:function(e){this._label.horizontalOrigin=e}},labelVerticalOrigin:{get:function(){return this._label.verticalOrigin},set:function(e){this._label.verticalOrigin=e}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},pickIds:{get:function(){var e=this._pickIds;return e[0]=this._billboard.pickId,e[1]=this._label.pickId,e[2]=this._polyline.pickId,e}}}),Cesium3DTilePointFeature.defaultColor=Color.WHITE,Cesium3DTilePointFeature.defaultPointOutlineColor=Color.BLACK,Cesium3DTilePointFeature.defaultPointOutlineWidth=0,Cesium3DTilePointFeature.defaultPointSize=8,Cesium3DTilePointFeature.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)},Cesium3DTilePointFeature.prototype.getPropertyNames=function(e){return this._content.batchTable.getPropertyNames(this._batchId,e)},Cesium3DTilePointFeature.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)},Cesium3DTilePointFeature.prototype.getPropertyInherited=function(e){return Cesium3DTileFeature.getPropertyInherited(this._content,this._batchId,e)},Cesium3DTilePointFeature.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0},Cesium3DTilePointFeature.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)},Cesium3DTilePointFeature.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)},Cesium3DTilePointFeature.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};var clamp_1=clamp;function clamp(e,t,i){return t<i?e<t?t:e>i?i:e:e<i?i:e>t?t:e}var bitmapSdf=calcSDF,INF=1e20;function calcSDF(e,t){t||(t={});var i,r,n,a,o,s,l,c,u,d,h,p=null==t.cutoff?.25:t.cutoff,f=null==t.radius?8:t.radius,m=t.channel||0;if(ArrayBuffer.isView(e)||Array.isArray(e)){if(!t.width||!t.height)throw Error("For raw data width and height should be provided by options");i=t.width,r=t.height,a=e,s=t.stride?t.stride:Math.floor(e.length/i/r)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(l=(c=e).getContext("2d"),i=c.width,r=c.height,a=(u=l.getImageData(0,0,i,r)).data,s=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(l=e,i=(c=e.canvas).width,r=c.height,a=(u=l.getImageData(0,0,i,r)).data,s=4):window.ImageData&&e instanceof window.ImageData&&(u=e,i=e.width,r=e.height,a=u.data,s=4);if(n=Math.max(i,r),window.Uint8ClampedArray&&a instanceof window.Uint8ClampedArray||window.Uint8Array&&a instanceof window.Uint8Array)for(o=a,a=Array(i*r),d=0,h=o.length;d<h;d++)a[d]=o[d*s+m]/255;else if(1!==s)throw Error("Raw data can have only 1 value per pixel");var g=Array(i*r),_=Array(i*r),y=Array(n),v=Array(n),C=Array(n+1),T=Array(n);for(d=0,h=i*r;d<h;d++){var S=a[d];g[d]=1===S?0:0===S?INF:Math.pow(Math.max(0,.5-S),2),_[d]=1===S?INF:0===S?0:Math.pow(Math.max(0,S-.5),2)}edt(g,i,r,y,v,T,C),edt(_,i,r,y,v,T,C);var A=window.Float32Array?new Float32Array(i*r):new Array(i*r);for(d=0,h=i*r;d<h;d++)A[d]=clamp_1(1-((g[d]-_[d])/f+p),0,1);return A}function edt(e,t,i,r,n,a,o){for(var s=0;s<t;s++){for(var l=0;l<i;l++)r[l]=e[l*t+s];for(edt1d(r,n,a,o,i),l=0;l<i;l++)e[l*t+s]=n[l]}for(l=0;l<i;l++){for(s=0;s<t;s++)r[s]=e[l*t+s];for(edt1d(r,n,a,o,t),s=0;s<t;s++)e[l*t+s]=Math.sqrt(n[s])}}function edt1d(e,t,i,r,n){i[0]=0,r[0]=-INF,r[1]=+INF;for(var a=1,o=0;a<n;a++){for(var s=(e[a]+a*a-(e[i[o]]+i[o]*i[o]))/(2*a-2*i[o]);s<=r[o];)o--,s=(e[a]+a*a-(e[i[o]]+i[o]*i[o]))/(2*a-2*i[o]);i[++o]=a,r[o]=s,r[o+1]=+INF}for(a=0,o=0;a<n;a++){for(;r[o+1]<a;)o++;t[a]=(a-i[o])*(a-i[o])+e[i[o]]}}var LabelStyle={FILL:0,OUTLINE:1,FILL_AND_OUTLINE:2},LabelStyle$1=Object.freeze(LabelStyle),fontInfoCache={},fontInfoCacheLength=0,fontInfoCacheMaxSize=256,defaultBackgroundColor$2=new Color(.165,.165,.165,.8),defaultBackgroundPadding$1=new Cartesian2(7,5),textTypes=Object.freeze({LTR:0,RTL:1,WEAK:2,BRACKETS:3});function rebindAllGlyphs$1(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function repositionAllGlyphs$1(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function getCSSValue(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)}function parseFont(e){var t=fontInfoCache[e._font];if(!defined(t)){var i=document.createElement("div");i.style.position="absolute",i.style.opacity=0,i.style.font=e._font,document.body.appendChild(i);var r=parseFloat(getCSSValue(i,"line-height"));isNaN(r)&&(r=void 0),t={family:getCSSValue(i,"font-family"),size:getCSSValue(i,"font-size").replace("px",""),style:getCSSValue(i,"font-style"),weight:getCSSValue(i,"font-weight"),lineHeight:r},document.body.removeChild(i),fontInfoCacheLength<fontInfoCacheMaxSize&&(fontInfoCache[e._font]=t,fontInfoCacheLength++)}e._fontFamily=t.family,e._fontSize=t.size,e._fontStyle=t.style,e._fontWeight=t.weight,e._lineHeight=t.lineHeight}function Label(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucencyByDistance,r=e.pixelOffsetScaleByDistance,n=e.scaleByDistance,a=e.distanceDisplayCondition;defined(i)&&(i=NearFarScalar.clone(i)),defined(r)&&(r=NearFarScalar.clone(r)),defined(n)&&(n=NearFarScalar.clone(n)),defined(a)&&(a=DistanceDisplayCondition.clone(a)),this._renderedText=void 0,this._text=void 0,this._show=defaultValue(e.show,!0),this._font=defaultValue(e.font,"30px sans-serif"),this._fillColor=Color.clone(defaultValue(e.fillColor,Color.WHITE)),this._outlineColor=Color.clone(defaultValue(e.outlineColor,Color.BLACK)),this._outlineWidth=defaultValue(e.outlineWidth,1),this._showBackground=defaultValue(e.showBackground,!1),this._backgroundColor=Color.clone(defaultValue(e.backgroundColor,defaultBackgroundColor$2)),this._backgroundPadding=Cartesian2.clone(defaultValue(e.backgroundPadding,defaultBackgroundPadding$1)),this._style=defaultValue(e.style,LabelStyle$1.FILL),this._verticalOrigin=defaultValue(e.verticalOrigin,VerticalOrigin$1.BASELINE),this._horizontalOrigin=defaultValue(e.horizontalOrigin,HorizontalOrigin$1.LEFT),this._pixelOffset=Cartesian2.clone(defaultValue(e.pixelOffset,Cartesian2.ZERO)),this._eyeOffset=Cartesian3.clone(defaultValue(e.eyeOffset,Cartesian3.ZERO)),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this._scale=defaultValue(e.scale,1),this._id=e.id,this._translucencyByDistance=i,this._pixelOffsetScaleByDistance=r,this._scaleByDistance=n,this._heightReference=defaultValue(e.heightReference,HeightReference$1.NONE),this._distanceDisplayCondition=a,this._disableDepthTestDistance=e.disableDepthTestDistance,this._labelCollection=t,this._glyphs=[],this._backgroundBillboard=void 0,this._batchIndex=void 0,this._rebindAllGlyphs=!0,this._repositionAllGlyphs=!0,this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=void 0,this._clusterShow=!0,this.text=defaultValue(e.text,""),this._relativeSize=1,parseFont(this),this._updateClamping()}function convertTextToTypes(e,t){for(var i=/[a-zA-Z0-9]/,r=/[()[\]{}<>]/,n=[],a="",o=textTypes.LTR,s="",l=e.length,c=0;c<l;++c){var u=e.charAt(c);s=t.test(u)?textTypes.RTL:i.test(u)?textTypes.LTR:r.test(u)?textTypes.BRACKETS:textTypes.WEAK,0===c&&(o=s),o===s&&s!==textTypes.BRACKETS?a+=u:(""!==a&&n.push({Type:o,Word:a}),o=s,a=u)}return n.push({Type:s,Word:a}),n}function reverseWord(e){return e.split("").reverse().join("")}function spliceWord(e,t,i){return e.slice(0,t)+i+e.slice(t)}function reverseBrackets(e){switch(e){case"(":return")";case")":return"(";case"[":return"]";case"]":return"[";case"{":return"}";case"}":return"{";case"<":return">";case">":return"<"}}Object.defineProperties(Label.prototype,{show:{get:function(){return this._show},set:function(e){if(this._show!==e){this._show=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i].billboard;defined(n)&&(n.show=e)}var a=this._backgroundBillboard;defined(a)&&(a.show=e)}}},position:{get:function(){return this._position},set:function(e){var t=this._position;if(!Cartesian3.equals(t,e)){Cartesian3.clone(e,t);for(var i=this._glyphs,r=0,n=i.length;r<n;r++){var a=i[r].billboard;defined(a)&&(a.position=e)}var o=this._backgroundBillboard;defined(o)&&(o.position=e),this._updateClamping()}}},heightReference:{get:function(){return this._heightReference},set:function(e){if(e!==this._heightReference){this._heightReference=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i].billboard;defined(n)&&(n.heightReference=e)}var a=this._backgroundBillboard;defined(a)&&(a.heightReference=e),repositionAllGlyphs$1(this),this._updateClamping()}}},text:{get:function(){return this._text},set:function(e){if(this._text!==e){this._text=e;var t=e.replace(/\u00ad/g,"");this._renderedText=Label.enableRightToLeftDetection?reverseRtl(t):t,rebindAllGlyphs$1(this)}}},font:{get:function(){return this._font},set:function(e){this._font!==e&&(this._font=e,rebindAllGlyphs$1(this),parseFont(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){var t=this._fillColor;Color.equals(t,e)||(Color.clone(e,t),rebindAllGlyphs$1(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;Color.equals(t,e)||(Color.clone(e,t),rebindAllGlyphs$1(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,rebindAllGlyphs$1(this))}},showBackground:{get:function(){return this._showBackground},set:function(e){this._showBackground!==e&&(this._showBackground=e,rebindAllGlyphs$1(this))}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){var t=this._backgroundColor;if(!Color.equals(t,e)){Color.clone(e,t);var i=this._backgroundBillboard;defined(i)&&(i.color=t)}}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){var t=this._backgroundPadding;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),repositionAllGlyphs$1(this))}},style:{get:function(){return this._style},set:function(e){this._style!==e&&(this._style=e,rebindAllGlyphs$1(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){var t=this._pixelOffset;if(!Cartesian2.equals(t,e)){Cartesian2.clone(e,t);for(var i=this._glyphs,r=0,n=i.length;r<n;r++){var a=i[r];defined(a.billboard)&&(a.billboard.pixelOffset=e)}var o=this._backgroundBillboard;defined(o)&&(o.pixelOffset=e)}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;if(!NearFarScalar.equals(t,e)){this._translucencyByDistance=NearFarScalar.clone(e,t);for(var i=this._glyphs,r=0,n=i.length;r<n;r++){var a=i[r];defined(a.billboard)&&(a.billboard.translucencyByDistance=e)}var o=this._backgroundBillboard;defined(o)&&(o.translucencyByDistance=e)}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){var t=this._pixelOffsetScaleByDistance;if(!NearFarScalar.equals(t,e)){this._pixelOffsetScaleByDistance=NearFarScalar.clone(e,t);for(var i=this._glyphs,r=0,n=i.length;r<n;r++){var a=i[r];defined(a.billboard)&&(a.billboard.pixelOffsetScaleByDistance=e)}var o=this._backgroundBillboard;defined(o)&&(o.pixelOffsetScaleByDistance=e)}}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){var t=this._scaleByDistance;if(!NearFarScalar.equals(t,e)){this._scaleByDistance=NearFarScalar.clone(e,t);for(var i=this._glyphs,r=0,n=i.length;r<n;r++){var a=i[r];defined(a.billboard)&&(a.billboard.scaleByDistance=e)}var o=this._backgroundBillboard;defined(o)&&(o.scaleByDistance=e)}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){var t=this._eyeOffset;if(!Cartesian3.equals(t,e)){Cartesian3.clone(e,t);for(var i=this._glyphs,r=0,n=i.length;r<n;r++){var a=i[r];defined(a.billboard)&&(a.billboard.eyeOffset=e)}var o=this._backgroundBillboard;defined(o)&&(o.eyeOffset=e)}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,repositionAllGlyphs$1(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){if(this._verticalOrigin!==e){this._verticalOrigin=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard.verticalOrigin=e)}var a=this._backgroundBillboard;defined(a)&&(a.verticalOrigin=e),repositionAllGlyphs$1(this)}}},scale:{get:function(){return this._scale},set:function(e){if(this._scale!==e){this._scale=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard.scale=e*this._relativeSize)}var a=this._backgroundBillboard;defined(a)&&(a.scale=e*this._relativeSize),repositionAllGlyphs$1(this)}}},totalScale:{get:function(){return this._scale*this._relativeSize}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(!DistanceDisplayCondition.equals(e,this._distanceDisplayCondition)){this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition);for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard.distanceDisplayCondition=e)}var a=this._backgroundBillboard;defined(a)&&(a.distanceDisplayCondition=e)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){this._disableDepthTestDistance=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard.disableDepthTestDistance=e)}var a=this._backgroundBillboard;defined(a)&&(a.disableDepthTestDistance=e)}}},id:{get:function(){return this._id},set:function(e){if(this._id!==e){this._id=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard.id=e)}var a=this._backgroundBillboard;defined(a)&&(a.id=e)}}},pickId:{get:function(){if(0!==this._glyphs.length&&defined(this._glyphs[0].billboard))return this._glyphs[0].billboard.pickId}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=Cartesian3.clone(e,this._actualClampedPosition);for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard._clampedPosition=e)}var a=this._backgroundBillboard;defined(a)&&(a._clampedPosition=e)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){if(this._clusterShow!==e){this._clusterShow=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard.clusterShow=e)}var a=this._backgroundBillboard;defined(a)&&(a.clusterShow=e)}}}}),Label.prototype._updateClamping=function(){Billboard._updateClamping(this._labelCollection,this)},Label.prototype.computeScreenSpacePosition=function(e,t){defined(t)||(t=new Cartesian2);var i=this._labelCollection.modelMatrix,r=defined(this._actualClampedPosition)?this._actualClampedPosition:this._position;return Billboard._computeScreenSpacePosition(i,r,this._eyeOffset,this._pixelOffset,e,t)},Label.getScreenSpaceBoundingBox=function(e,t,i){var r=0,n=0,a=0,o=0,s=e.totalScale,l=e._backgroundBillboard;if(defined(l))r=t.x+l._translate.x,n=t.y-l._translate.y,a=l.width*s,o=l.height*s,e.verticalOrigin===VerticalOrigin$1.BOTTOM||e.verticalOrigin===VerticalOrigin$1.BASELINE?n-=o:e.verticalOrigin===VerticalOrigin$1.CENTER&&(n-=.5*o);else{r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;for(var c=0,u=0,d=e._glyphs,h=d.length,p=0;p<h;++p){var f=d[p],m=f.billboard;if(defined(m)){var g=t.x+m._translate.x,_=t.y-m._translate.y,y=f.dimensions.width*s,v=f.dimensions.height*s;e.verticalOrigin===VerticalOrigin$1.BOTTOM||e.verticalOrigin===VerticalOrigin$1.BASELINE?_-=v:e.verticalOrigin===VerticalOrigin$1.CENTER&&(_-=.5*v),e._verticalOrigin===VerticalOrigin$1.TOP?_+=SDFSettings$1.PADDING*s:e._verticalOrigin!==VerticalOrigin$1.BOTTOM&&e._verticalOrigin!==VerticalOrigin$1.BASELINE||(_-=SDFSettings$1.PADDING*s),r=Math.min(r,g),n=Math.min(n,_),c=Math.max(c,g+y),u=Math.max(u,_+v)}}a=c-r,o=u-n}return defined(i)||(i=new BoundingRectangle),i.x=r,i.y=n,i.width=a,i.height=o,i},Label.prototype.equals=function(e){return this===e||defined(e)&&this._show===e._show&&this._scale===e._scale&&this._outlineWidth===e._outlineWidth&&this._showBackground===e._showBackground&&this._style===e._style&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&this._renderedText===e._renderedText&&this._font===e._font&&Cartesian3.equals(this._position,e._position)&&Color.equals(this._fillColor,e._fillColor)&&Color.equals(this._outlineColor,e._outlineColor)&&Color.equals(this._backgroundColor,e._backgroundColor)&&Cartesian2.equals(this._backgroundPadding,e._backgroundPadding)&&Cartesian2.equals(this._pixelOffset,e._pixelOffset)&&Cartesian3.equals(this._eyeOffset,e._eyeOffset)&&NearFarScalar.equals(this._translucencyByDistance,e._translucencyByDistance)&&NearFarScalar.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&NearFarScalar.equals(this._scaleByDistance,e._scaleByDistance)&&DistanceDisplayCondition.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._id===e._id},Label.prototype.isDestroyed=function(){return!1},Label.enableRightToLeftDetection=!1;var hebrew="א-ת",arabic="-ۿݐ-ݿࢠ-ࣿ",rtlChars=new RegExp("["+hebrew+arabic+"]");function reverseRtl(e){for(var t=e.split("\n"),i="",r=0;r<t.length;r++){for(var n=t[r],a=rtlChars.test(n.charAt(0)),o=convertTextToTypes(n,rtlChars),s=0,l="",c=0;c<o.length;++c){var u=o[c],d=u.Type===textTypes.BRACKETS?reverseBrackets(u.Word):reverseWord(u.Word);a?u.Type===textTypes.RTL?(l=d+l,s=0):u.Type===textTypes.LTR?(l=spliceWord(l,s,u.Word),s+=u.Word.length):u.Type!==textTypes.WEAK&&u.Type!==textTypes.BRACKETS||(u.Type===textTypes.WEAK&&o[c-1].Type===textTypes.BRACKETS?l=d+l:o[c-1].Type===textTypes.RTL?(l=d+l,s=0):o.length>c+1?o[c+1].Type===textTypes.RTL?(l=d+l,s=0):(l=spliceWord(l,s,u.Word),s+=u.Word.length):l=spliceWord(l,0,d)):u.Type===textTypes.RTL?l=spliceWord(l,s,d):u.Type===textTypes.LTR?s=(l+=u.Word).length:u.Type!==textTypes.WEAK&&u.Type!==textTypes.BRACKETS||(c>0&&o[c-1].Type===textTypes.RTL?o.length>c+1?o[c+1].Type===textTypes.RTL?l=spliceWord(l,s,d):s=(l+=u.Word).length:l+=u.Word:s=(l+=u.Word).length)}i+=l,r<t.length-1&&(i+="\n")}return i}var graphemeSplitter=createCommonjsModule((function(e){e.exports&&(e.exports=function(){var e=3,t=4,i=12,r=13,n=16,a=17;function o(e,t){void 0===t&&(t=0);var i=e.charCodeAt(t);if(55296<=i&&i<=56319&&t<e.length-1){var r=i;return 56320<=(n=e.charCodeAt(t+1))&&n<=57343?1024*(r-55296)+(n-56320)+65536:r}if(56320<=i&&i<=57343&&t>=1){var n=i;return 55296<=(r=e.charCodeAt(t-1))&&r<=56319?1024*(r-55296)+(n-56320)+65536:n}return i}function s(o,s,l){var c=[o].concat(s).concat([l]),u=c[c.length-2],d=l,h=c.lastIndexOf(14);if(h>1&&c.slice(1,h).every((function(t){return t==e}))&&-1==[e,r,a].indexOf(o))return 2;var p=c.lastIndexOf(t);if(p>0&&c.slice(1,p).every((function(e){return e==t}))&&-1==[i,t].indexOf(u))return c.filter((function(e){return e==t})).length%2==1?3:4;if(0==u&&1==d)return 0;if(2==u||0==u||1==u)return 14==d&&s.every((function(t){return t==e}))?2:1;if(2==d||0==d||1==d)return 1;if(6==u&&(6==d||7==d||9==d||10==d))return 0;if(!(9!=u&&7!=u||7!=d&&8!=d))return 0;if((10==u||8==u)&&8==d)return 0;if(d==e||15==d)return 0;if(5==d)return 0;if(u==i)return 0;var f=-1!=c.indexOf(e)?c.lastIndexOf(e)-1:c.length-2;return-1!=[r,a].indexOf(c[f])&&c.slice(f+1,-1).every((function(t){return t==e}))&&14==d||15==u&&-1!=[n,a].indexOf(d)?0:-1!=s.indexOf(t)?2:u==t&&d==t?0:1}function l(o){return 1536<=o&&o<=1541||1757==o||1807==o||2274==o||3406==o||69821==o||70082<=o&&o<=70083||72250==o||72326<=o&&o<=72329||73030==o?i:13==o?0:10==o?1:0<=o&&o<=9||11<=o&&o<=12||14<=o&&o<=31||127<=o&&o<=159||173==o||1564==o||6158==o||8203==o||8206<=o&&o<=8207||8232==o||8233==o||8234<=o&&o<=8238||8288<=o&&o<=8292||8293==o||8294<=o&&o<=8303||55296<=o&&o<=57343||65279==o||65520<=o&&o<=65528||65529<=o&&o<=65531||113824<=o&&o<=113827||119155<=o&&o<=119162||917504==o||917505==o||917506<=o&&o<=917535||917632<=o&&o<=917759||918e3<=o&&o<=921599?2:768<=o&&o<=879||1155<=o&&o<=1159||1160<=o&&o<=1161||1425<=o&&o<=1469||1471==o||1473<=o&&o<=1474||1476<=o&&o<=1477||1479==o||1552<=o&&o<=1562||1611<=o&&o<=1631||1648==o||1750<=o&&o<=1756||1759<=o&&o<=1764||1767<=o&&o<=1768||1770<=o&&o<=1773||1809==o||1840<=o&&o<=1866||1958<=o&&o<=1968||2027<=o&&o<=2035||2070<=o&&o<=2073||2075<=o&&o<=2083||2085<=o&&o<=2087||2089<=o&&o<=2093||2137<=o&&o<=2139||2260<=o&&o<=2273||2275<=o&&o<=2306||2362==o||2364==o||2369<=o&&o<=2376||2381==o||2385<=o&&o<=2391||2402<=o&&o<=2403||2433==o||2492==o||2494==o||2497<=o&&o<=2500||2509==o||2519==o||2530<=o&&o<=2531||2561<=o&&o<=2562||2620==o||2625<=o&&o<=2626||2631<=o&&o<=2632||2635<=o&&o<=2637||2641==o||2672<=o&&o<=2673||2677==o||2689<=o&&o<=2690||2748==o||2753<=o&&o<=2757||2759<=o&&o<=2760||2765==o||2786<=o&&o<=2787||2810<=o&&o<=2815||2817==o||2876==o||2878==o||2879==o||2881<=o&&o<=2884||2893==o||2902==o||2903==o||2914<=o&&o<=2915||2946==o||3006==o||3008==o||3021==o||3031==o||3072==o||3134<=o&&o<=3136||3142<=o&&o<=3144||3146<=o&&o<=3149||3157<=o&&o<=3158||3170<=o&&o<=3171||3201==o||3260==o||3263==o||3266==o||3270==o||3276<=o&&o<=3277||3285<=o&&o<=3286||3298<=o&&o<=3299||3328<=o&&o<=3329||3387<=o&&o<=3388||3390==o||3393<=o&&o<=3396||3405==o||3415==o||3426<=o&&o<=3427||3530==o||3535==o||3538<=o&&o<=3540||3542==o||3551==o||3633==o||3636<=o&&o<=3642||3655<=o&&o<=3662||3761==o||3764<=o&&o<=3769||3771<=o&&o<=3772||3784<=o&&o<=3789||3864<=o&&o<=3865||3893==o||3895==o||3897==o||3953<=o&&o<=3966||3968<=o&&o<=3972||3974<=o&&o<=3975||3981<=o&&o<=3991||3993<=o&&o<=4028||4038==o||4141<=o&&o<=4144||4146<=o&&o<=4151||4153<=o&&o<=4154||4157<=o&&o<=4158||4184<=o&&o<=4185||4190<=o&&o<=4192||4209<=o&&o<=4212||4226==o||4229<=o&&o<=4230||4237==o||4253==o||4957<=o&&o<=4959||5906<=o&&o<=5908||5938<=o&&o<=5940||5970<=o&&o<=5971||6002<=o&&o<=6003||6068<=o&&o<=6069||6071<=o&&o<=6077||6086==o||6089<=o&&o<=6099||6109==o||6155<=o&&o<=6157||6277<=o&&o<=6278||6313==o||6432<=o&&o<=6434||6439<=o&&o<=6440||6450==o||6457<=o&&o<=6459||6679<=o&&o<=6680||6683==o||6742==o||6744<=o&&o<=6750||6752==o||6754==o||6757<=o&&o<=6764||6771<=o&&o<=6780||6783==o||6832<=o&&o<=6845||6846==o||6912<=o&&o<=6915||6964==o||6966<=o&&o<=6970||6972==o||6978==o||7019<=o&&o<=7027||7040<=o&&o<=7041||7074<=o&&o<=7077||7080<=o&&o<=7081||7083<=o&&o<=7085||7142==o||7144<=o&&o<=7145||7149==o||7151<=o&&o<=7153||7212<=o&&o<=7219||7222<=o&&o<=7223||7376<=o&&o<=7378||7380<=o&&o<=7392||7394<=o&&o<=7400||7405==o||7412==o||7416<=o&&o<=7417||7616<=o&&o<=7673||7675<=o&&o<=7679||8204==o||8400<=o&&o<=8412||8413<=o&&o<=8416||8417==o||8418<=o&&o<=8420||8421<=o&&o<=8432||11503<=o&&o<=11505||11647==o||11744<=o&&o<=11775||12330<=o&&o<=12333||12334<=o&&o<=12335||12441<=o&&o<=12442||42607==o||42608<=o&&o<=42610||42612<=o&&o<=42621||42654<=o&&o<=42655||42736<=o&&o<=42737||43010==o||43014==o||43019==o||43045<=o&&o<=43046||43204<=o&&o<=43205||43232<=o&&o<=43249||43302<=o&&o<=43309||43335<=o&&o<=43345||43392<=o&&o<=43394||43443==o||43446<=o&&o<=43449||43452==o||43493==o||43561<=o&&o<=43566||43569<=o&&o<=43570||43573<=o&&o<=43574||43587==o||43596==o||43644==o||43696==o||43698<=o&&o<=43700||43703<=o&&o<=43704||43710<=o&&o<=43711||43713==o||43756<=o&&o<=43757||43766==o||44005==o||44008==o||44013==o||64286==o||65024<=o&&o<=65039||65056<=o&&o<=65071||65438<=o&&o<=65439||66045==o||66272==o||66422<=o&&o<=66426||68097<=o&&o<=68099||68101<=o&&o<=68102||68108<=o&&o<=68111||68152<=o&&o<=68154||68159==o||68325<=o&&o<=68326||69633==o||69688<=o&&o<=69702||69759<=o&&o<=69761||69811<=o&&o<=69814||69817<=o&&o<=69818||69888<=o&&o<=69890||69927<=o&&o<=69931||69933<=o&&o<=69940||70003==o||70016<=o&&o<=70017||70070<=o&&o<=70078||70090<=o&&o<=70092||70191<=o&&o<=70193||70196==o||70198<=o&&o<=70199||70206==o||70367==o||70371<=o&&o<=70378||70400<=o&&o<=70401||70460==o||70462==o||70464==o||70487==o||70502<=o&&o<=70508||70512<=o&&o<=70516||70712<=o&&o<=70719||70722<=o&&o<=70724||70726==o||70832==o||70835<=o&&o<=70840||70842==o||70845==o||70847<=o&&o<=70848||70850<=o&&o<=70851||71087==o||71090<=o&&o<=71093||71100<=o&&o<=71101||71103<=o&&o<=71104||71132<=o&&o<=71133||71219<=o&&o<=71226||71229==o||71231<=o&&o<=71232||71339==o||71341==o||71344<=o&&o<=71349||71351==o||71453<=o&&o<=71455||71458<=o&&o<=71461||71463<=o&&o<=71467||72193<=o&&o<=72198||72201<=o&&o<=72202||72243<=o&&o<=72248||72251<=o&&o<=72254||72263==o||72273<=o&&o<=72278||72281<=o&&o<=72283||72330<=o&&o<=72342||72344<=o&&o<=72345||72752<=o&&o<=72758||72760<=o&&o<=72765||72767==o||72850<=o&&o<=72871||72874<=o&&o<=72880||72882<=o&&o<=72883||72885<=o&&o<=72886||73009<=o&&o<=73014||73018==o||73020<=o&&o<=73021||73023<=o&&o<=73029||73031==o||92912<=o&&o<=92916||92976<=o&&o<=92982||94095<=o&&o<=94098||113821<=o&&o<=113822||119141==o||119143<=o&&o<=119145||119150<=o&&o<=119154||119163<=o&&o<=119170||119173<=o&&o<=119179||119210<=o&&o<=119213||119362<=o&&o<=119364||121344<=o&&o<=121398||121403<=o&&o<=121452||121461==o||121476==o||121499<=o&&o<=121503||121505<=o&&o<=121519||122880<=o&&o<=122886||122888<=o&&o<=122904||122907<=o&&o<=122913||122915<=o&&o<=122916||122918<=o&&o<=122922||125136<=o&&o<=125142||125252<=o&&o<=125258||917536<=o&&o<=917631||917760<=o&&o<=917999?e:127462<=o&&o<=127487?t:2307==o||2363==o||2366<=o&&o<=2368||2377<=o&&o<=2380||2382<=o&&o<=2383||2434<=o&&o<=2435||2495<=o&&o<=2496||2503<=o&&o<=2504||2507<=o&&o<=2508||2563==o||2622<=o&&o<=2624||2691==o||2750<=o&&o<=2752||2761==o||2763<=o&&o<=2764||2818<=o&&o<=2819||2880==o||2887<=o&&o<=2888||2891<=o&&o<=2892||3007==o||3009<=o&&o<=3010||3014<=o&&o<=3016||3018<=o&&o<=3020||3073<=o&&o<=3075||3137<=o&&o<=3140||3202<=o&&o<=3203||3262==o||3264<=o&&o<=3265||3267<=o&&o<=3268||3271<=o&&o<=3272||3274<=o&&o<=3275||3330<=o&&o<=3331||3391<=o&&o<=3392||3398<=o&&o<=3400||3402<=o&&o<=3404||3458<=o&&o<=3459||3536<=o&&o<=3537||3544<=o&&o<=3550||3570<=o&&o<=3571||3635==o||3763==o||3902<=o&&o<=3903||3967==o||4145==o||4155<=o&&o<=4156||4182<=o&&o<=4183||4228==o||6070==o||6078<=o&&o<=6085||6087<=o&&o<=6088||6435<=o&&o<=6438||6441<=o&&o<=6443||6448<=o&&o<=6449||6451<=o&&o<=6456||6681<=o&&o<=6682||6741==o||6743==o||6765<=o&&o<=6770||6916==o||6965==o||6971==o||6973<=o&&o<=6977||6979<=o&&o<=6980||7042==o||7073==o||7078<=o&&o<=7079||7082==o||7143==o||7146<=o&&o<=7148||7150==o||7154<=o&&o<=7155||7204<=o&&o<=7211||7220<=o&&o<=7221||7393==o||7410<=o&&o<=7411||7415==o||43043<=o&&o<=43044||43047==o||43136<=o&&o<=43137||43188<=o&&o<=43203||43346<=o&&o<=43347||43395==o||43444<=o&&o<=43445||43450<=o&&o<=43451||43453<=o&&o<=43456||43567<=o&&o<=43568||43571<=o&&o<=43572||43597==o||43755==o||43758<=o&&o<=43759||43765==o||44003<=o&&o<=44004||44006<=o&&o<=44007||44009<=o&&o<=44010||44012==o||69632==o||69634==o||69762==o||69808<=o&&o<=69810||69815<=o&&o<=69816||69932==o||70018==o||70067<=o&&o<=70069||70079<=o&&o<=70080||70188<=o&&o<=70190||70194<=o&&o<=70195||70197==o||70368<=o&&o<=70370||70402<=o&&o<=70403||70463==o||70465<=o&&o<=70468||70471<=o&&o<=70472||70475<=o&&o<=70477||70498<=o&&o<=70499||70709<=o&&o<=70711||70720<=o&&o<=70721||70725==o||70833<=o&&o<=70834||70841==o||70843<=o&&o<=70844||70846==o||70849==o||71088<=o&&o<=71089||71096<=o&&o<=71099||71102==o||71216<=o&&o<=71218||71227<=o&&o<=71228||71230==o||71340==o||71342<=o&&o<=71343||71350==o||71456<=o&&o<=71457||71462==o||72199<=o&&o<=72200||72249==o||72279<=o&&o<=72280||72343==o||72751==o||72766==o||72873==o||72881==o||72884==o||94033<=o&&o<=94078||119142==o||119149==o?5:4352<=o&&o<=4447||43360<=o&&o<=43388?6:4448<=o&&o<=4519||55216<=o&&o<=55238?7:4520<=o&&o<=4607||55243<=o&&o<=55291?8:44032==o||44060==o||44088==o||44116==o||44144==o||44172==o||44200==o||44228==o||44256==o||44284==o||44312==o||44340==o||44368==o||44396==o||44424==o||44452==o||44480==o||44508==o||44536==o||44564==o||44592==o||44620==o||44648==o||44676==o||44704==o||44732==o||44760==o||44788==o||44816==o||44844==o||44872==o||44900==o||44928==o||44956==o||44984==o||45012==o||45040==o||45068==o||45096==o||45124==o||45152==o||45180==o||45208==o||45236==o||45264==o||45292==o||45320==o||45348==o||45376==o||45404==o||45432==o||45460==o||45488==o||45516==o||45544==o||45572==o||45600==o||45628==o||45656==o||45684==o||45712==o||45740==o||45768==o||45796==o||45824==o||45852==o||45880==o||45908==o||45936==o||45964==o||45992==o||46020==o||46048==o||46076==o||46104==o||46132==o||46160==o||46188==o||46216==o||46244==o||46272==o||46300==o||46328==o||46356==o||46384==o||46412==o||46440==o||46468==o||46496==o||46524==o||46552==o||46580==o||46608==o||46636==o||46664==o||46692==o||46720==o||46748==o||46776==o||46804==o||46832==o||46860==o||46888==o||46916==o||46944==o||46972==o||47e3==o||47028==o||47056==o||47084==o||47112==o||47140==o||47168==o||47196==o||47224==o||47252==o||47280==o||47308==o||47336==o||47364==o||47392==o||47420==o||47448==o||47476==o||47504==o||47532==o||47560==o||47588==o||47616==o||47644==o||47672==o||47700==o||47728==o||47756==o||47784==o||47812==o||47840==o||47868==o||47896==o||47924==o||47952==o||47980==o||48008==o||48036==o||48064==o||48092==o||48120==o||48148==o||48176==o||48204==o||48232==o||48260==o||48288==o||48316==o||48344==o||48372==o||48400==o||48428==o||48456==o||48484==o||48512==o||48540==o||48568==o||48596==o||48624==o||48652==o||48680==o||48708==o||48736==o||48764==o||48792==o||48820==o||48848==o||48876==o||48904==o||48932==o||48960==o||48988==o||49016==o||49044==o||49072==o||49100==o||49128==o||49156==o||49184==o||49212==o||49240==o||49268==o||49296==o||49324==o||49352==o||49380==o||49408==o||49436==o||49464==o||49492==o||49520==o||49548==o||49576==o||49604==o||49632==o||49660==o||49688==o||49716==o||49744==o||49772==o||49800==o||49828==o||49856==o||49884==o||49912==o||49940==o||49968==o||49996==o||50024==o||50052==o||50080==o||50108==o||50136==o||50164==o||50192==o||50220==o||50248==o||50276==o||50304==o||50332==o||50360==o||50388==o||50416==o||50444==o||50472==o||50500==o||50528==o||50556==o||50584==o||50612==o||50640==o||50668==o||50696==o||50724==o||50752==o||50780==o||50808==o||50836==o||50864==o||50892==o||50920==o||50948==o||50976==o||51004==o||51032==o||51060==o||51088==o||51116==o||51144==o||51172==o||51200==o||51228==o||51256==o||51284==o||51312==o||51340==o||51368==o||51396==o||51424==o||51452==o||51480==o||51508==o||51536==o||51564==o||51592==o||51620==o||51648==o||51676==o||51704==o||51732==o||51760==o||51788==o||51816==o||51844==o||51872==o||51900==o||51928==o||51956==o||51984==o||52012==o||52040==o||52068==o||52096==o||52124==o||52152==o||52180==o||52208==o||52236==o||52264==o||52292==o||52320==o||52348==o||52376==o||52404==o||52432==o||52460==o||52488==o||52516==o||52544==o||52572==o||52600==o||52628==o||52656==o||52684==o||52712==o||52740==o||52768==o||52796==o||52824==o||52852==o||52880==o||52908==o||52936==o||52964==o||52992==o||53020==o||53048==o||53076==o||53104==o||53132==o||53160==o||53188==o||53216==o||53244==o||53272==o||53300==o||53328==o||53356==o||53384==o||53412==o||53440==o||53468==o||53496==o||53524==o||53552==o||53580==o||53608==o||53636==o||53664==o||53692==o||53720==o||53748==o||53776==o||53804==o||53832==o||53860==o||53888==o||53916==o||53944==o||53972==o||54e3==o||54028==o||54056==o||54084==o||54112==o||54140==o||54168==o||54196==o||54224==o||54252==o||54280==o||54308==o||54336==o||54364==o||54392==o||54420==o||54448==o||54476==o||54504==o||54532==o||54560==o||54588==o||54616==o||54644==o||54672==o||54700==o||54728==o||54756==o||54784==o||54812==o||54840==o||54868==o||54896==o||54924==o||54952==o||54980==o||55008==o||55036==o||55064==o||55092==o||55120==o||55148==o||55176==o?9:44033<=o&&o<=44059||44061<=o&&o<=44087||44089<=o&&o<=44115||44117<=o&&o<=44143||44145<=o&&o<=44171||44173<=o&&o<=44199||44201<=o&&o<=44227||44229<=o&&o<=44255||44257<=o&&o<=44283||44285<=o&&o<=44311||44313<=o&&o<=44339||44341<=o&&o<=44367||44369<=o&&o<=44395||44397<=o&&o<=44423||44425<=o&&o<=44451||44453<=o&&o<=44479||44481<=o&&o<=44507||44509<=o&&o<=44535||44537<=o&&o<=44563||44565<=o&&o<=44591||44593<=o&&o<=44619||44621<=o&&o<=44647||44649<=o&&o<=44675||44677<=o&&o<=44703||44705<=o&&o<=44731||44733<=o&&o<=44759||44761<=o&&o<=44787||44789<=o&&o<=44815||44817<=o&&o<=44843||44845<=o&&o<=44871||44873<=o&&o<=44899||44901<=o&&o<=44927||44929<=o&&o<=44955||44957<=o&&o<=44983||44985<=o&&o<=45011||45013<=o&&o<=45039||45041<=o&&o<=45067||45069<=o&&o<=45095||45097<=o&&o<=45123||45125<=o&&o<=45151||45153<=o&&o<=45179||45181<=o&&o<=45207||45209<=o&&o<=45235||45237<=o&&o<=45263||45265<=o&&o<=45291||45293<=o&&o<=45319||45321<=o&&o<=45347||45349<=o&&o<=45375||45377<=o&&o<=45403||45405<=o&&o<=45431||45433<=o&&o<=45459||45461<=o&&o<=45487||45489<=o&&o<=45515||45517<=o&&o<=45543||45545<=o&&o<=45571||45573<=o&&o<=45599||45601<=o&&o<=45627||45629<=o&&o<=45655||45657<=o&&o<=45683||45685<=o&&o<=45711||45713<=o&&o<=45739||45741<=o&&o<=45767||45769<=o&&o<=45795||45797<=o&&o<=45823||45825<=o&&o<=45851||45853<=o&&o<=45879||45881<=o&&o<=45907||45909<=o&&o<=45935||45937<=o&&o<=45963||45965<=o&&o<=45991||45993<=o&&o<=46019||46021<=o&&o<=46047||46049<=o&&o<=46075||46077<=o&&o<=46103||46105<=o&&o<=46131||46133<=o&&o<=46159||46161<=o&&o<=46187||46189<=o&&o<=46215||46217<=o&&o<=46243||46245<=o&&o<=46271||46273<=o&&o<=46299||46301<=o&&o<=46327||46329<=o&&o<=46355||46357<=o&&o<=46383||46385<=o&&o<=46411||46413<=o&&o<=46439||46441<=o&&o<=46467||46469<=o&&o<=46495||46497<=o&&o<=46523||46525<=o&&o<=46551||46553<=o&&o<=46579||46581<=o&&o<=46607||46609<=o&&o<=46635||46637<=o&&o<=46663||46665<=o&&o<=46691||46693<=o&&o<=46719||46721<=o&&o<=46747||46749<=o&&o<=46775||46777<=o&&o<=46803||46805<=o&&o<=46831||46833<=o&&o<=46859||46861<=o&&o<=46887||46889<=o&&o<=46915||46917<=o&&o<=46943||46945<=o&&o<=46971||46973<=o&&o<=46999||47001<=o&&o<=47027||47029<=o&&o<=47055||47057<=o&&o<=47083||47085<=o&&o<=47111||47113<=o&&o<=47139||47141<=o&&o<=47167||47169<=o&&o<=47195||47197<=o&&o<=47223||47225<=o&&o<=47251||47253<=o&&o<=47279||47281<=o&&o<=47307||47309<=o&&o<=47335||47337<=o&&o<=47363||47365<=o&&o<=47391||47393<=o&&o<=47419||47421<=o&&o<=47447||47449<=o&&o<=47475||47477<=o&&o<=47503||47505<=o&&o<=47531||47533<=o&&o<=47559||47561<=o&&o<=47587||47589<=o&&o<=47615||47617<=o&&o<=47643||47645<=o&&o<=47671||47673<=o&&o<=47699||47701<=o&&o<=47727||47729<=o&&o<=47755||47757<=o&&o<=47783||47785<=o&&o<=47811||47813<=o&&o<=47839||47841<=o&&o<=47867||47869<=o&&o<=47895||47897<=o&&o<=47923||47925<=o&&o<=47951||47953<=o&&o<=47979||47981<=o&&o<=48007||48009<=o&&o<=48035||48037<=o&&o<=48063||48065<=o&&o<=48091||48093<=o&&o<=48119||48121<=o&&o<=48147||48149<=o&&o<=48175||48177<=o&&o<=48203||48205<=o&&o<=48231||48233<=o&&o<=48259||48261<=o&&o<=48287||48289<=o&&o<=48315||48317<=o&&o<=48343||48345<=o&&o<=48371||48373<=o&&o<=48399||48401<=o&&o<=48427||48429<=o&&o<=48455||48457<=o&&o<=48483||48485<=o&&o<=48511||48513<=o&&o<=48539||48541<=o&&o<=48567||48569<=o&&o<=48595||48597<=o&&o<=48623||48625<=o&&o<=48651||48653<=o&&o<=48679||48681<=o&&o<=48707||48709<=o&&o<=48735||48737<=o&&o<=48763||48765<=o&&o<=48791||48793<=o&&o<=48819||48821<=o&&o<=48847||48849<=o&&o<=48875||48877<=o&&o<=48903||48905<=o&&o<=48931||48933<=o&&o<=48959||48961<=o&&o<=48987||48989<=o&&o<=49015||49017<=o&&o<=49043||49045<=o&&o<=49071||49073<=o&&o<=49099||49101<=o&&o<=49127||49129<=o&&o<=49155||49157<=o&&o<=49183||49185<=o&&o<=49211||49213<=o&&o<=49239||49241<=o&&o<=49267||49269<=o&&o<=49295||49297<=o&&o<=49323||49325<=o&&o<=49351||49353<=o&&o<=49379||49381<=o&&o<=49407||49409<=o&&o<=49435||49437<=o&&o<=49463||49465<=o&&o<=49491||49493<=o&&o<=49519||49521<=o&&o<=49547||49549<=o&&o<=49575||49577<=o&&o<=49603||49605<=o&&o<=49631||49633<=o&&o<=49659||49661<=o&&o<=49687||49689<=o&&o<=49715||49717<=o&&o<=49743||49745<=o&&o<=49771||49773<=o&&o<=49799||49801<=o&&o<=49827||49829<=o&&o<=49855||49857<=o&&o<=49883||49885<=o&&o<=49911||49913<=o&&o<=49939||49941<=o&&o<=49967||49969<=o&&o<=49995||49997<=o&&o<=50023||50025<=o&&o<=50051||50053<=o&&o<=50079||50081<=o&&o<=50107||50109<=o&&o<=50135||50137<=o&&o<=50163||50165<=o&&o<=50191||50193<=o&&o<=50219||50221<=o&&o<=50247||50249<=o&&o<=50275||50277<=o&&o<=50303||50305<=o&&o<=50331||50333<=o&&o<=50359||50361<=o&&o<=50387||50389<=o&&o<=50415||50417<=o&&o<=50443||50445<=o&&o<=50471||50473<=o&&o<=50499||50501<=o&&o<=50527||50529<=o&&o<=50555||50557<=o&&o<=50583||50585<=o&&o<=50611||50613<=o&&o<=50639||50641<=o&&o<=50667||50669<=o&&o<=50695||50697<=o&&o<=50723||50725<=o&&o<=50751||50753<=o&&o<=50779||50781<=o&&o<=50807||50809<=o&&o<=50835||50837<=o&&o<=50863||50865<=o&&o<=50891||50893<=o&&o<=50919||50921<=o&&o<=50947||50949<=o&&o<=50975||50977<=o&&o<=51003||51005<=o&&o<=51031||51033<=o&&o<=51059||51061<=o&&o<=51087||51089<=o&&o<=51115||51117<=o&&o<=51143||51145<=o&&o<=51171||51173<=o&&o<=51199||51201<=o&&o<=51227||51229<=o&&o<=51255||51257<=o&&o<=51283||51285<=o&&o<=51311||51313<=o&&o<=51339||51341<=o&&o<=51367||51369<=o&&o<=51395||51397<=o&&o<=51423||51425<=o&&o<=51451||51453<=o&&o<=51479||51481<=o&&o<=51507||51509<=o&&o<=51535||51537<=o&&o<=51563||51565<=o&&o<=51591||51593<=o&&o<=51619||51621<=o&&o<=51647||51649<=o&&o<=51675||51677<=o&&o<=51703||51705<=o&&o<=51731||51733<=o&&o<=51759||51761<=o&&o<=51787||51789<=o&&o<=51815||51817<=o&&o<=51843||51845<=o&&o<=51871||51873<=o&&o<=51899||51901<=o&&o<=51927||51929<=o&&o<=51955||51957<=o&&o<=51983||51985<=o&&o<=52011||52013<=o&&o<=52039||52041<=o&&o<=52067||52069<=o&&o<=52095||52097<=o&&o<=52123||52125<=o&&o<=52151||52153<=o&&o<=52179||52181<=o&&o<=52207||52209<=o&&o<=52235||52237<=o&&o<=52263||52265<=o&&o<=52291||52293<=o&&o<=52319||52321<=o&&o<=52347||52349<=o&&o<=52375||52377<=o&&o<=52403||52405<=o&&o<=52431||52433<=o&&o<=52459||52461<=o&&o<=52487||52489<=o&&o<=52515||52517<=o&&o<=52543||52545<=o&&o<=52571||52573<=o&&o<=52599||52601<=o&&o<=52627||52629<=o&&o<=52655||52657<=o&&o<=52683||52685<=o&&o<=52711||52713<=o&&o<=52739||52741<=o&&o<=52767||52769<=o&&o<=52795||52797<=o&&o<=52823||52825<=o&&o<=52851||52853<=o&&o<=52879||52881<=o&&o<=52907||52909<=o&&o<=52935||52937<=o&&o<=52963||52965<=o&&o<=52991||52993<=o&&o<=53019||53021<=o&&o<=53047||53049<=o&&o<=53075||53077<=o&&o<=53103||53105<=o&&o<=53131||53133<=o&&o<=53159||53161<=o&&o<=53187||53189<=o&&o<=53215||53217<=o&&o<=53243||53245<=o&&o<=53271||53273<=o&&o<=53299||53301<=o&&o<=53327||53329<=o&&o<=53355||53357<=o&&o<=53383||53385<=o&&o<=53411||53413<=o&&o<=53439||53441<=o&&o<=53467||53469<=o&&o<=53495||53497<=o&&o<=53523||53525<=o&&o<=53551||53553<=o&&o<=53579||53581<=o&&o<=53607||53609<=o&&o<=53635||53637<=o&&o<=53663||53665<=o&&o<=53691||53693<=o&&o<=53719||53721<=o&&o<=53747||53749<=o&&o<=53775||53777<=o&&o<=53803||53805<=o&&o<=53831||53833<=o&&o<=53859||53861<=o&&o<=53887||53889<=o&&o<=53915||53917<=o&&o<=53943||53945<=o&&o<=53971||53973<=o&&o<=53999||54001<=o&&o<=54027||54029<=o&&o<=54055||54057<=o&&o<=54083||54085<=o&&o<=54111||54113<=o&&o<=54139||54141<=o&&o<=54167||54169<=o&&o<=54195||54197<=o&&o<=54223||54225<=o&&o<=54251||54253<=o&&o<=54279||54281<=o&&o<=54307||54309<=o&&o<=54335||54337<=o&&o<=54363||54365<=o&&o<=54391||54393<=o&&o<=54419||54421<=o&&o<=54447||54449<=o&&o<=54475||54477<=o&&o<=54503||54505<=o&&o<=54531||54533<=o&&o<=54559||54561<=o&&o<=54587||54589<=o&&o<=54615||54617<=o&&o<=54643||54645<=o&&o<=54671||54673<=o&&o<=54699||54701<=o&&o<=54727||54729<=o&&o<=54755||54757<=o&&o<=54783||54785<=o&&o<=54811||54813<=o&&o<=54839||54841<=o&&o<=54867||54869<=o&&o<=54895||54897<=o&&o<=54923||54925<=o&&o<=54951||54953<=o&&o<=54979||54981<=o&&o<=55007||55009<=o&&o<=55035||55037<=o&&o<=55063||55065<=o&&o<=55091||55093<=o&&o<=55119||55121<=o&&o<=55147||55149<=o&&o<=55175||55177<=o&&o<=55203?10:9757==o||9977==o||9994<=o&&o<=9997||127877==o||127938<=o&&o<=127940||127943==o||127946<=o&&o<=127948||128066<=o&&o<=128067||128070<=o&&o<=128080||128110==o||128112<=o&&o<=128120||128124==o||128129<=o&&o<=128131||128133<=o&&o<=128135||128170==o||128372<=o&&o<=128373||128378==o||128400==o||128405<=o&&o<=128406||128581<=o&&o<=128583||128587<=o&&o<=128591||128675==o||128692<=o&&o<=128694||128704==o||128716==o||129304<=o&&o<=129308||129310<=o&&o<=129311||129318==o||129328<=o&&o<=129337||129341<=o&&o<=129342||129489<=o&&o<=129501?r:127995<=o&&o<=127999?14:8205==o?15:9792==o||9794==o||9877<=o&&o<=9878||9992==o||10084==o||127752==o||127806==o||127859==o||127891==o||127908==o||127912==o||127979==o||127981==o||128139==o||128187<=o&&o<=128188||128295==o||128300==o||128488==o||128640==o||128658==o?n:128102<=o&&o<=128105?a:11}return this.nextBreak=function(e,t){if(void 0===t&&(t=0),t<0)return 0;if(t>=e.length-1)return e.length;for(var i,r,n=l(o(e,t)),a=[],c=t+1;c<e.length;c++)if(r=c-1,!(55296<=(i=e).charCodeAt(r)&&i.charCodeAt(r)<=56319&&56320<=i.charCodeAt(r+1)&&i.charCodeAt(r+1)<=57343)){var u=l(o(e,c));if(s(n,a,u))return c;a.push(u)}return e.length},this.splitGraphemes=function(e){for(var t,i=[],r=0;(t=this.nextBreak(e,r))<e.length;)i.push(e.slice(r,t)),r=t;return r<e.length&&i.push(e.slice(r)),i},this.iterateGraphemes=function(e){var t=0,i={next:function(){var i,r;return(r=this.nextBreak(e,t))<e.length?(i=e.slice(t,r),t=r,{value:i,done:!1}):t<e.length?(i=e.slice(t),t=e.length,{value:i,done:!1}):{value:void 0,done:!0}}.bind(this)};return"undefined"!=typeof Symbol&&Symbol.iterator&&(i[Symbol.iterator]=function(){return i}),i},this.countGraphemes=function(e){for(var t,i=0,r=0;(t=this.nextBreak(e,r))<e.length;)r=t,i++;return r<e.length&&i++,i},this})}));function Glyph(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function GlyphTextureInfo(e,t,i){this.labelCollection=e,this.index=t,this.dimensions=i}var defaultLineSpacingPercent=1.2,whitePixelCanvasId="ID_WHITE_PIXEL",whitePixelSize=new Cartesian2(4,4),whitePixelBoundingRegion=new BoundingRectangle(1,1,1,1);function addWhitePixelCanvas(e,t){var i=document.createElement("canvas");i.width=whitePixelSize.x,i.height=whitePixelSize.y;var r=i.getContext("2d");r.fillStyle="#fff",r.fillRect(0,0,i.width,i.height),e.addImage(whitePixelCanvasId,i).then((function(e){t._whitePixelIndex=e}))}var writeTextToCanvasParameters={};function createGlyphCanvas(e,t,i,r,n,a,o){return writeTextToCanvasParameters.font=t,writeTextToCanvasParameters.fillColor=i,writeTextToCanvasParameters.strokeColor=r,writeTextToCanvasParameters.strokeWidth=n,writeTextToCanvasParameters.padding=SDFSettings$1.PADDING,o===VerticalOrigin$1.CENTER?writeTextToCanvasParameters.textBaseline="middle":o===VerticalOrigin$1.TOP?writeTextToCanvasParameters.textBaseline="top":writeTextToCanvasParameters.textBaseline="bottom",writeTextToCanvasParameters.fill=a===LabelStyle$1.FILL||a===LabelStyle$1.FILL_AND_OUTLINE,writeTextToCanvasParameters.stroke=a===LabelStyle$1.OUTLINE||a===LabelStyle$1.FILL_AND_OUTLINE,writeTextToCanvasParameters.backgroundColor=Color.BLACK,writeTextToCanvas(e,writeTextToCanvasParameters)}function unbindGlyph(e,t){t.textureInfo=void 0,t.dimensions=void 0;var i=t.billboard;defined(i)&&(i.show=!1,i.image=void 0,defined(i._removeCallbackFunc)&&(i._removeCallbackFunc(),i._removeCallbackFunc=void 0),e._spareBillboards.push(i),t.billboard=void 0)}function addGlyphToTextureAtlas(e,t,i,r){e.addImage(t,i).then((function(e){r.index=e}))}var splitter=new graphemeSplitter;function rebindAllGlyphs(e,t){var i,r,n,a=t._renderedText,o=splitter.splitGraphemes(a),s=o.length,l=t._glyphs,c=l.length;if(t._relativeSize=t._fontSize/SDFSettings$1.FONT_SIZE,s<c)for(r=s;r<c;++r)unbindGlyph(e,l[r]);l.length=s;var u=t._showBackground&&a.split("\n").join("").length>0,d=t._backgroundBillboard,h=e._backgroundBillboardCollection;u?(defined(d)||(d=h.add({collection:e,image:whitePixelCanvasId,imageSubRegion:whitePixelBoundingRegion}),t._backgroundBillboard=d),d.color=t._backgroundColor,d.show=t._show,d.position=t._position,d.eyeOffset=t._eyeOffset,d.pixelOffset=t._pixelOffset,d.horizontalOrigin=HorizontalOrigin$1.LEFT,d.verticalOrigin=t._verticalOrigin,d.heightReference=t._heightReference,d.scale=t.totalScale,d.pickPrimitive=t,d.id=t._id,d.translucencyByDistance=t._translucencyByDistance,d.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,d.scaleByDistance=t._scaleByDistance,d.distanceDisplayCondition=t._distanceDisplayCondition,d.disableDepthTestDistance=t._disableDepthTestDistance):defined(d)&&(h.remove(d),t._backgroundBillboard=d=void 0);var p=e._glyphTextureCache;for(n=0;n<s;++n){var f=o[n],m=t._verticalOrigin,g=JSON.stringify([f,t._fontFamily,t._fontStyle,t._fontWeight,+m]),_=p[g];if(!defined(_)){var y=createGlyphCanvas(f,t._fontStyle+" "+t._fontWeight+" "+SDFSettings$1.FONT_SIZE+"px "+t._fontFamily,Color.WHITE,Color.WHITE,0,LabelStyle$1.FILL,m);if(_=new GlyphTextureInfo(e,-1,y.dimensions),p[g]=_,y.width>0&&y.height>0){for(var v=bitmapSdf(y,{cutoff:SDFSettings$1.CUTOFF,radius:SDFSettings$1.RADIUS}),C=y.getContext("2d"),T=y.width,S=y.height,A=C.getImageData(0,0,T,S),x=0;x<T;x++)for(var E=0;E<S;E++){var b=E*T+x,P=255*v[b],D=4*b;A.data[D+0]=P,A.data[D+1]=P,A.data[D+2]=P,A.data[D+3]=P}C.putImageData(A,0,0)," "!==f&&addGlyphToTextureAtlas(e._textureAtlas,g,y,_)}}if(defined(i=l[n])?-1===_.index?unbindGlyph(e,i):defined(i.textureInfo)&&(i.textureInfo=void 0):(i=new Glyph,l[n]=i),i.textureInfo=_,i.dimensions=_.dimensions,-1!==_.index){var w=i.billboard,M=e._spareBillboards;defined(w)||(M.length>0?w=M.pop():((w=e._billboardCollection.add({collection:e}))._labelDimensions=new Cartesian2,w._labelTranslate=new Cartesian2),i.billboard=w),w.show=t._show,w.position=t._position,w.eyeOffset=t._eyeOffset,w.pixelOffset=t._pixelOffset,w.horizontalOrigin=HorizontalOrigin$1.LEFT,w.verticalOrigin=t._verticalOrigin,w.heightReference=t._heightReference,w.scale=t.totalScale,w.pickPrimitive=t,w.id=t._id,w.image=g,w.translucencyByDistance=t._translucencyByDistance,w.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,w.scaleByDistance=t._scaleByDistance,w.distanceDisplayCondition=t._distanceDisplayCondition,w.disableDepthTestDistance=t._disableDepthTestDistance,w._batchIndex=t._batchIndex,w.outlineColor=t.outlineColor,t.style===LabelStyle$1.FILL_AND_OUTLINE?(w.color=t._fillColor,w.outlineWidth=t.outlineWidth):t.style===LabelStyle$1.FILL?(w.color=t._fillColor,w.outlineWidth=0):t.style===LabelStyle$1.OUTLINE&&(w.color=Color.TRANSPARENT,w.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function calculateWidthOffset(e,t,i){return t===HorizontalOrigin$1.CENTER?-e/2:t===HorizontalOrigin$1.RIGHT?-(e+i.x):i.x}var glyphPixelOffset=new Cartesian2,scratchBackgroundPadding=new Cartesian2;function repositionAllGlyphs(e){var t,i,r,n=e._glyphs,a=e._renderedText,o=0,s=0,l=[],c=Number.NEGATIVE_INFINITY,u=0,d=1,h=n.length,p=e._backgroundBillboard,f=Cartesian2.clone(defined(p)?e._backgroundPadding:Cartesian2.ZERO,scratchBackgroundPadding);for(f.x/=e._relativeSize,f.y/=e._relativeSize,r=0;r<h;++r)"\n"===a.charAt(r)?(l.push(o),++d,o=0):(i=(t=n[r]).dimensions,u=Math.max(u,i.height-i.descent),c=Math.max(c,i.descent),o+=i.width-i.minx,r<h-1&&(o+=n[r+1].dimensions.minx),s=Math.max(s,o));l.push(o);var m=u+c,g=e.totalScale,_=e._horizontalOrigin,y=e._verticalOrigin,v=0,C=l[v],T=calculateWidthOffset(C,_,f),S=(defined(e._lineHeight)?e._lineHeight:defaultLineSpacingPercent*e._fontSize)/e._relativeSize,A=S*(d-1),x=s,E=m+A;defined(p)&&(x+=2*f.x,E+=2*f.y,p._labelHorizontalOrigin=_),glyphPixelOffset.x=T*g,glyphPixelOffset.y=0;var b=!0,P=0;for(r=0;r<h;++r)if("\n"===a.charAt(r))P+=S,T=calculateWidthOffset(C=l[++v],_,f),glyphPixelOffset.x=T*g,b=!0;else if(i=(t=n[r]).dimensions,y===VerticalOrigin$1.TOP?(glyphPixelOffset.y=i.height-u-f.y,glyphPixelOffset.y+=SDFSettings$1.PADDING):y===VerticalOrigin$1.CENTER?glyphPixelOffset.y=(A+i.height-u)/2:y===VerticalOrigin$1.BASELINE?(glyphPixelOffset.y=A,glyphPixelOffset.y-=SDFSettings$1.PADDING):(glyphPixelOffset.y=A+c+f.y,glyphPixelOffset.y-=SDFSettings$1.PADDING),glyphPixelOffset.y=(glyphPixelOffset.y-i.descent-P)*g,b&&(glyphPixelOffset.x-=SDFSettings$1.PADDING*g,b=!1),defined(t.billboard)&&(t.billboard._setTranslate(glyphPixelOffset),t.billboard._labelDimensions.x=x,t.billboard._labelDimensions.y=E,t.billboard._labelHorizontalOrigin=_),r<h-1){var D=n[r+1];glyphPixelOffset.x+=(i.width-i.minx+D.dimensions.minx)*g}if(defined(p)&&a.split("\n").join("").length>0&&(T=_===HorizontalOrigin$1.CENTER?-s/2-f.x:_===HorizontalOrigin$1.RIGHT?-(s+2*f.x):0,glyphPixelOffset.x=T*g,y===VerticalOrigin$1.TOP?glyphPixelOffset.y=m-u-c:y===VerticalOrigin$1.CENTER?glyphPixelOffset.y=(m-u)/2-c:y===VerticalOrigin$1.BASELINE?glyphPixelOffset.y=-f.y-c:glyphPixelOffset.y=0,glyphPixelOffset.y=glyphPixelOffset.y*g,p.width=x,p.height=E,p._setTranslate(glyphPixelOffset),p._labelTranslate=Cartesian2.clone(glyphPixelOffset,p._labelTranslate)),e.heightReference===HeightReference$1.CLAMP_TO_GROUND)for(r=0;r<h;++r){var w=(t=n[r]).billboard;defined(w)&&(w._labelTranslate=Cartesian2.clone(glyphPixelOffset,w._labelTranslate))}}function destroyLabel(e,t){for(var i=t._glyphs,r=0,n=i.length;r<n;++r)unbindGlyph(e,i[r]);defined(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,defined(t._removeCallbackFunc)&&t._removeCallbackFunc(),destroyObject(t)}function LabelCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._backgroundTextureAtlas=void 0,this._whitePixelIndex=void 0,this._backgroundBillboardCollection=new BillboardCollection({scene:this._scene}),this._backgroundBillboardCollection.destroyTextureAtlas=!1,this._billboardCollection=new BillboardCollection({scene:this._scene,batchTable:this._batchTable}),this._billboardCollection.destroyTextureAtlas=!1,this._billboardCollection._sdf=!0,this._spareBillboards=[],this._glyphTextureCache={},this._labels=[],this._labelsToUpdate=[],this._totalGlyphCount=0,this._highlightColor=Color.clone(Color.WHITE),this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.blendOption=defaultValue(e.blendOption,BlendOption$1.OPAQUE_AND_TRANSLUCENT)}Object.defineProperties(LabelCollection.prototype,{length:{get:function(){return this._labels.length}}}),LabelCollection.prototype.add=function(e){var t=new Label(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t},LabelCollection.prototype.remove=function(e){if(defined(e)&&e._labelCollection===this){var t=this._labels.indexOf(e);if(-1!==t)return this._labels.splice(t,1),destroyLabel(this,e),!0}return!1},LabelCollection.prototype.removeAll=function(){for(var e=this._labels,t=0,i=e.length;t<i;++t)destroyLabel(this,e[t]);e.length=0},LabelCollection.prototype.contains=function(e){return defined(e)&&e._labelCollection===this},LabelCollection.prototype.get=function(e){return this._labels[e]},LabelCollection.prototype.update=function(e){if(this.show){var t=this._billboardCollection,i=this._backgroundBillboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume,i.modelMatrix=this.modelMatrix,i.debugShowBoundingVolume=this.debugShowBoundingVolume;var r=e.context;defined(this._textureAtlas)||(this._textureAtlas=new TextureAtlas({context:r}),t.textureAtlas=this._textureAtlas),defined(this._backgroundTextureAtlas)||(this._backgroundTextureAtlas=new TextureAtlas({context:r,initialSize:whitePixelSize}),i.textureAtlas=this._backgroundTextureAtlas,addWhitePixelCanvas(this._backgroundTextureAtlas,this));for(var n=this._labelsToUpdate.length,a=0;a<n;++a){var o=this._labelsToUpdate[a];if(!o.isDestroyed()){var s=o._glyphs.length;o._rebindAllGlyphs&&(rebindAllGlyphs(this,o),o._rebindAllGlyphs=!1),o._repositionAllGlyphs&&(repositionAllGlyphs(o),o._repositionAllGlyphs=!1);var l=o._glyphs.length-s;this._totalGlyphCount+=l}}var c=i.length>0?BlendOption$1.TRANSLUCENT:this.blendOption;t.blendOption=c,i.blendOption=c,t._highlightColor=this._highlightColor,i._highlightColor=this._highlightColor,this._labelsToUpdate.length=0,i.update(e),t.update(e)}},LabelCollection.prototype.isDestroyed=function(){return!1},LabelCollection.prototype.destroy=function(){return this.removeAll(),this._billboardCollection=this._billboardCollection.destroy(),this._textureAtlas=this._textureAtlas&&this._textureAtlas.destroy(),this._backgroundBillboardCollection=this._backgroundBillboardCollection.destroy(),this._backgroundTextureAtlas=this._backgroundTextureAtlas&&this._backgroundTextureAtlas.destroy(),destroyObject(this)};var PolylineVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 position2DHigh;\nattribute vec3 position2DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 prevPosition2DHigh;\nattribute vec3 prevPosition2DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec3 nextPosition2DHigh;\nattribute vec3 nextPosition2DLow;\nattribute vec4 texCoordExpandAndBatchIndex;\nvarying vec2 v_st;\nvarying float v_width;\nvarying vec4 v_pickColor;\nvarying float v_polylineAngle;\nvoid main()\n{\nfloat texCoord = texCoordExpandAndBatchIndex.x;\nfloat expandDir = texCoordExpandAndBatchIndex.y;\nbool usePrev = texCoordExpandAndBatchIndex.z < 0.0;\nfloat batchTableIndex = texCoordExpandAndBatchIndex.w;\nvec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex);\nfloat width = widthAndShow.x + 0.5;\nfloat show = widthAndShow.y;\nif (width < 1.0)\n{\nshow = 0.0;\n}\nvec4 pickColor = batchTable_getPickColor(batchTableIndex);\nvec4 p, prev, next;\nif (czm_morphTime == 1.0)\n{\np = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\nprev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\nnext = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n}\nelse if (czm_morphTime == 0.0)\n{\np = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nprev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\nnext = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n}\nelse\n{\np = czm_columbusViewMorph(\nczm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\nczm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\nczm_morphTime);\nprev = czm_columbusViewMorph(\nczm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\nczm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\nczm_morphTime);\nnext = czm_columbusViewMorph(\nczm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\nczm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\nczm_morphTime);\n}\n#ifdef DISTANCE_DISPLAY_CONDITION\nvec3 centerHigh = batchTable_getCenterHigh(batchTableIndex);\nvec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex);\nvec3 centerLow = centerLowAndRadius.xyz;\nfloat radius = centerLowAndRadius.w;\nvec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex);\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nvec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz);\nlengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius);\n}\nfloat nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;\nfloat farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;\nif (lengthSq < nearSq || lengthSq > farSq)\n{\nshow = 0.0;\n}\n#endif\nfloat polylineAngle;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, polylineAngle);\ngl_Position = czm_viewportOrthographic * positionWC * show;\nv_st.s = texCoord;\nv_st.t = czm_writeNonPerspective(clamp(expandDir, 0.0, 1.0), gl_Position.w);\nv_width = width;\nv_pickColor = pickColor;\nv_polylineAngle = polylineAngle;\n}\n";function Polyline(e,t){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._show=defaultValue(e.show,!0),this._width=defaultValue(e.width,1),this._loop=defaultValue(e.loop,!1),this._distanceDisplayCondition=e.distanceDisplayCondition,this._material=e.material,defined(this._material)||(this._material=Material$3.fromType(Material$3.ColorType,{color:new Color(1,1,1,1)}));var i,r=e.positions;defined(r)||(r=[]),this._positions=r,this._actualPositions=arrayRemoveDuplicates(r,Cartesian3.equalsEpsilon),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=r.slice()),this._actualPositions.push(Cartesian3.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id,defined(t)&&(i=Matrix4.clone(t.modelMatrix)),this._modelMatrix=i,this._segments=PolylinePipeline.wrapLongitude(this._actualPositions,i),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$3),this._polylineCollection=t,this._dirty=!1,this._pickId=void 0,this._boundingVolume=BoundingSphere.fromPoints(this._actualPositions),this._boundingVolumeWC=BoundingSphere.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new BoundingSphere}var POSITION_INDEX$5=Polyline.POSITION_INDEX=0,SHOW_INDEX$5=Polyline.SHOW_INDEX=1,WIDTH_INDEX$1=Polyline.WIDTH_INDEX=2,MATERIAL_INDEX$1=Polyline.MATERIAL_INDEX=3,POSITION_SIZE_INDEX$1=Polyline.POSITION_SIZE_INDEX=4,DISTANCE_DISPLAY_CONDITION$1=Polyline.DISTANCE_DISPLAY_CONDITION=5,NUMBER_OF_PROPERTIES$3=Polyline.NUMBER_OF_PROPERTIES=6;function makeDirty$2(e,t){++e._propertiesChanged[t];var i=e._polylineCollection;defined(i)&&(i._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties(Polyline.prototype,{show:{get:function(){return this._show},set:function(e){e!==this._show&&(this._show=e,makeDirty$2(this,SHOW_INDEX$5))}},positions:{get:function(){return this._positions},set:function(e){var t=arrayRemoveDuplicates(e,Cartesian3.equalsEpsilon);this._loop&&t.length>2&&(t===e&&(t=e.slice()),t.push(Cartesian3.clone(t[0]))),this._actualPositions.length===t.length&&this._actualPositions.length===this._length||makeDirty$2(this,POSITION_SIZE_INDEX$1),this._positions=e,this._actualPositions=t,this._length=t.length,this._boundingVolume=BoundingSphere.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=BoundingSphere.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),makeDirty$2(this,POSITION_INDEX$5),this.update()}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,makeDirty$2(this,MATERIAL_INDEX$1))}},width:{get:function(){return this._width},set:function(e){e!==this._width&&(this._width=e,makeDirty$2(this,WIDTH_INDEX$1))}},loop:{get:function(){return this._loop},set:function(e){if(e!==this._loop){var t=this._actualPositions;e?t.length>2&&!Cartesian3.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(Cartesian3.clone(t[0]))):t.length>2&&Cartesian3.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,makeDirty$2(this,POSITION_SIZE_INDEX$1)}}},id:{get:function(){return this._id},set:function(e){this._id=e,defined(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},isDestroyed:{get:function(){return!defined(this._polylineCollection)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){DistanceDisplayCondition.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition),makeDirty$2(this,DISTANCE_DISPLAY_CONDITION$1))}}}),Polyline.prototype.update=function(){var e=Matrix4.IDENTITY;defined(this._polylineCollection)&&(e=this._polylineCollection.modelMatrix);var t=this._segments.positions.length,i=this._segments.lengths,r=this._propertiesChanged[POSITION_INDEX$5]>0||this._propertiesChanged[POSITION_SIZE_INDEX$1]>0;if(Matrix4.equals(e,this._modelMatrix)&&!r||(this._segments=PolylinePipeline.wrapLongitude(this._actualPositions,e),this._boundingVolumeWC=BoundingSphere.transform(this._boundingVolume,e,this._boundingVolumeWC)),this._modelMatrix=Matrix4.clone(e,this._modelMatrix),this._segments.positions.length!==t)makeDirty$2(this,POSITION_SIZE_INDEX$1);else for(var n=i.length,a=0;a<n;++a)if(i[a]!==this._segments.lengths[a]){makeDirty$2(this,POSITION_SIZE_INDEX$1);break}},Polyline.prototype.getPickId=function(e){return defined(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId},Polyline.prototype._clean=function(){this._dirty=!1;for(var e=this._propertiesChanged,t=0;t<NUMBER_OF_PROPERTIES$3-1;++t)e[t]=0},Polyline.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0};var SHOW_INDEX$4=Polyline.SHOW_INDEX,WIDTH_INDEX=Polyline.WIDTH_INDEX,POSITION_INDEX$4=Polyline.POSITION_INDEX,MATERIAL_INDEX=Polyline.MATERIAL_INDEX,POSITION_SIZE_INDEX=Polyline.POSITION_SIZE_INDEX,DISTANCE_DISPLAY_CONDITION=Polyline.DISTANCE_DISPLAY_CONDITION,NUMBER_OF_PROPERTIES$2=Polyline.NUMBER_OF_PROPERTIES,attributeLocations$5={texCoordExpandAndBatchIndex:0,position3DHigh:1,position3DLow:2,position2DHigh:3,position2DLow:4,prevPosition3DHigh:5,prevPosition3DLow:6,prevPosition2DHigh:7,prevPosition2DLow:8,nextPosition3DHigh:9,nextPosition3DLow:10,nextPosition2DHigh:11,nextPosition2DLow:12};function PolylineCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._opaqueRS=void 0,this._translucentRS=void 0,this._colorCommands=[],this._polylinesUpdated=!1,this._polylinesRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$2),this._polylines=[],this._polylineBuckets={},this._positionBufferUsage={bufferUsage:BufferUsage$1.STATIC_DRAW,frameCount:0},this._mode=void 0,this._polylinesToUpdate=[],this._vertexArrays=[],this._positionBuffer=void 0,this._texCoordExpandAndBatchIndexBuffer=void 0,this._batchTable=void 0,this._createBatchTable=!1,this._useHighlightColor=!1,this._highlightColor=Color.clone(Color.WHITE);var t=this;this._uniformMap={u_highlightColor:function(){return t._highlightColor}}}function createBatchTable(e,t){defined(e._batchTable)&&e._batchTable.destroy();var i=[{functionName:"batchTable_getWidthAndShow",componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:2},{functionName:"batchTable_getPickColor",componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0},{functionName:"batchTable_getCenterHigh",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"batchTable_getCenterLowAndRadius",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{functionName:"batchTable_getDistanceDisplayCondition",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2}];e._batchTable=new BatchTable(t,i,e._polylines.length)}Object.defineProperties(PolylineCollection.prototype,{length:{get:function(){return removePolylines(this),this._polylines.length}}}),PolylineCollection.prototype.add=function(e){var t=new Polyline(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,this._createBatchTable=!0,t},PolylineCollection.prototype.remove=function(e){if(this.contains(e)){if(this._polylinesRemoved=!0,this._createVertexArray=!0,this._createBatchTable=!0,defined(e._bucket)){var t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()}return e._destroy(),!0}return!1},PolylineCollection.prototype.removeAll=function(){releaseShaders(this),destroyPolylines(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0},PolylineCollection.prototype.contains=function(e){return defined(e)&&e._polylineCollection===this},PolylineCollection.prototype.get=function(e){return removePolylines(this),this._polylines[e]};var scratchUpdatePolylineEncodedCartesian=new EncodedCartesian3,scratchUpdatePolylineCartesian4=new Cartesian4,scratchNearFarCartesian2=new Cartesian2;PolylineCollection.prototype.update=function(e){if(removePolylines(this),0!==this._polylines.length&&this.show){updateMode$1(this,e);var t,i=e.context,r=e.mapProjection,n=this._propertiesChanged;if(this._createBatchTable){if(0===ContextLimits.maximumVertexTextureImageUnits)throw new RuntimeError("Vertex texture fetch support is required to render polylines. The maximum number of vertex texture image units must be greater than zero.");createBatchTable(this,i),this._createBatchTable=!1}if(this._createVertexArray||computeNewBuffersUsage(this))createVertexArrays(this,i,r);else if(this._polylinesUpdated){var a=this._polylinesToUpdate;if(this._mode!==SceneMode$1.SCENE3D)for(var o=a.length,s=0;s<o;++s)(t=a[s]).update();if(n[POSITION_SIZE_INDEX]||n[MATERIAL_INDEX])createVertexArrays(this,i,r);else for(var l=a.length,c=this._polylineBuckets,u=0;u<l;++u){n=(t=a[u])._propertiesChanged;var d=t._bucket,h=0;for(var p in c)if(c.hasOwnProperty(p)){if(c[p]===d){n[POSITION_INDEX$4]&&d.writeUpdate(h,t,this._positionBuffer,r);break}h+=c[p].lengthOfPositions}if((n[SHOW_INDEX$4]||n[WIDTH_INDEX])&&this._batchTable.setBatchedAttribute(t._index,0,new Cartesian2(t._width,t._show)),this._batchTable.attributes.length>2){if(n[POSITION_INDEX$4]||n[POSITION_SIZE_INDEX]){var f=e.mode===SceneMode$1.SCENE2D?t._boundingVolume2D:t._boundingVolumeWC,m=EncodedCartesian3.fromCartesian(f.center,scratchUpdatePolylineEncodedCartesian),g=Cartesian4.fromElements(m.low.x,m.low.y,m.low.z,f.radius,scratchUpdatePolylineCartesian4);this._batchTable.setBatchedAttribute(t._index,2,m.high),this._batchTable.setBatchedAttribute(t._index,3,g)}if(n[DISTANCE_DISPLAY_CONDITION]){var _=scratchNearFarCartesian2;_.x=0,_.y=Number.MAX_VALUE;var y=t.distanceDisplayCondition;defined(y)&&(_.x=y.near,_.y=y.far),this._batchTable.setBatchedAttribute(t._index,4,_)}}t._clean()}a.length=0,this._polylinesUpdated=!1}n=this._propertiesChanged;for(var v=0;v<NUMBER_OF_PROPERTIES$2;++v)n[v]=0;var C=Matrix4.IDENTITY;e.mode===SceneMode$1.SCENE3D&&(C=this.modelMatrix);var T=e.passes,S=0!==e.morphTime;if(defined(this._opaqueRS)&&this._opaqueRS.depthTest.enabled===S||(this._opaqueRS=RenderState.fromCache({depthMask:S,depthTest:{enabled:S}})),defined(this._translucentRS)&&this._translucentRS.depthTest.enabled===S||(this._translucentRS=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,depthMask:!S,depthTest:{enabled:S}})),this._batchTable.update(e),T.render||T.pick)createCommandLists(this,e,this._colorCommands,C)}};var boundingSphereScratch$2=new BoundingSphere,boundingSphereScratch2=new BoundingSphere;function createCommandLists(e,t,i,r){for(var n=t.context,a=t.commandList,o=i.length,s=0,l=!0,c=e._vertexArrays,u=e.debugShowBoundingVolume,d=e._batchTable.getUniformMapCallback(),h=c.length,p=0;p<h;++p)for(var f=c[p],m=f.buckets,g=m.length,_=0;_<g;++_){for(var y,v,C,T,S=m[_],A=S.offset,x=S.bucket.shaderProgram,E=S.bucket.polylines,b=E.length,P=0,D=0;D<b;++D){var w=E[D],M=createMaterialId(w._material);if(M!==y){if(defined(y)&&P>0){var I=v.isTranslucent();s>=o?(C=new DrawCommand({owner:e}),i.push(C)):C=i[s],++s,T=combine$2(d(v._uniforms),e._uniformMap),C.boundingVolume=BoundingSphere.clone(boundingSphereScratch$2,C.boundingVolume),C.modelMatrix=r,C.shaderProgram=x,C.vertexArray=f.va,C.renderState=I?e._translucentRS:e._opaqueRS,C.pass=I?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,C.debugShowBoundingVolume=u,C.pickId="v_pickColor",C.uniformMap=T,C.count=P,C.offset=A,A+=P,P=0,l=!0,a.push(C)}(v=w._material).update(n),y=M}for(var R,O=w._locatorBuckets,B=O.length,L=0;L<B;++L){var F=O[L];F.locator===S&&(P+=F.count)}t.mode===SceneMode$1.SCENE3D?R=w._boundingVolumeWC:t.mode===SceneMode$1.COLUMBUS_VIEW?R=w._boundingVolume2D:t.mode===SceneMode$1.SCENE2D?defined(w._boundingVolume2D)&&((R=BoundingSphere.clone(w._boundingVolume2D,boundingSphereScratch2)).center.x=0):defined(w._boundingVolumeWC)&&defined(w._boundingVolume2D)&&(R=BoundingSphere.union(w._boundingVolumeWC,w._boundingVolume2D,boundingSphereScratch2)),l?(l=!1,BoundingSphere.clone(R,boundingSphereScratch$2)):BoundingSphere.union(R,boundingSphereScratch$2,boundingSphereScratch$2)}defined(y)&&P>0&&(s>=o?(C=new DrawCommand({owner:e}),i.push(C)):C=i[s],++s,T=combine$2(d(v._uniforms),e._uniformMap),C.boundingVolume=BoundingSphere.clone(boundingSphereScratch$2,C.boundingVolume),C.modelMatrix=r,C.shaderProgram=x,C.vertexArray=f.va,C.renderState=v.isTranslucent()?e._translucentRS:e._opaqueRS,C.pass=v.isTranslucent()?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,C.debugShowBoundingVolume=u,C.pickId="v_pickColor",C.uniformMap=T,C.count=P,C.offset=A,l=!0,a.push(C)),y=void 0}i.length=s}function computeNewBuffersUsage(e){var t=!1,i=e._propertiesChanged,r=e._positionBufferUsage;return i[POSITION_INDEX$4]?r.bufferUsage!==BufferUsage$1.STREAM_DRAW?(t=!0,r.bufferUsage=BufferUsage$1.STREAM_DRAW,r.frameCount=100):r.frameCount=100:r.bufferUsage!==BufferUsage$1.STATIC_DRAW&&(0===r.frameCount?(t=!0,r.bufferUsage=BufferUsage$1.STATIC_DRAW):r.frameCount--),t}PolylineCollection.prototype.isDestroyed=function(){return!1},PolylineCollection.prototype.destroy=function(){return destroyVertexArrays(this),releaseShaders(this),destroyPolylines(this),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)};var emptyVertexBuffer=[0,0,0];function createVertexArrays(e,t,i){e._createVertexArray=!1,releaseShaders(e),destroyVertexArrays(e),sortPolylinesIntoBuckets(e);var r,n,a=[[]],o=a[0],s=e._batchTable,l=e._useHighlightColor,c=[0],u=0,d=[[]],h=0,p=e._polylineBuckets;for(r in p)p.hasOwnProperty(r)&&((n=p[r]).updateShader(t,s,l),h+=n.lengthOfPositions);if(h>0){var f,m=e._mode,g=new Float32Array(6*h*3),_=new Float32Array(4*h),y=0,v=0,C=0;for(r in p)if(p.hasOwnProperty(r)){(n=p[r]).write(g,_,y,v,C,s,t,i),m===SceneMode$1.MORPHING&&(defined(f)||(f=new Float32Array(6*h*3)),n.writeForMorph(f,y));var T=n.lengthOfPositions;y+=6*T*3,v+=4*T,C+=4*T,u=n.updateIndices(a,c,d,u)}var S,A=e._positionBufferUsage.bufferUsage,x=BufferUsage$1.STATIC_DRAW;e._positionBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:g,usage:A}),defined(f)&&(S=Buffer$1.createVertexBuffer({context:t,typedArray:f,usage:A})),e._texCoordExpandAndBatchIndexBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:_,usage:x});for(var E=3*Float32Array.BYTES_PER_ELEMENT,b=4*Float32Array.BYTES_PER_ELEMENT,P=0,D=a.length,w=0;w<D;++w)if((o=a[w]).length>0){var M=new Uint16Array(o),I=Buffer$1.createIndexBuffer({context:t,typedArray:M,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});P+=c[w];var R,O,B,L,F=6*(w*(E*CesiumMath.SIXTY_FOUR_KILOBYTES)-P*E),N=E+F,V=E+N,k=E+V,U=E+k,G=E+U,$=w*(b*CesiumMath.SIXTY_FOUR_KILOBYTES)-P*b,z=[{index:attributeLocations$5.position3DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:F,strideInBytes:6*E},{index:attributeLocations$5.position3DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:N,strideInBytes:6*E},{index:attributeLocations$5.position2DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:F,strideInBytes:6*E},{index:attributeLocations$5.position2DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:N,strideInBytes:6*E},{index:attributeLocations$5.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:V,strideInBytes:6*E},{index:attributeLocations$5.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:k,strideInBytes:6*E},{index:attributeLocations$5.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:V,strideInBytes:6*E},{index:attributeLocations$5.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:k,strideInBytes:6*E},{index:attributeLocations$5.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:U,strideInBytes:6*E},{index:attributeLocations$5.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:G,strideInBytes:6*E},{index:attributeLocations$5.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:U,strideInBytes:6*E},{index:attributeLocations$5.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:G,strideInBytes:6*E},{index:attributeLocations$5.texCoordExpandAndBatchIndex,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,vertexBuffer:e._texCoordExpandAndBatchIndexBuffer,offsetInBytes:$}];m===SceneMode$1.SCENE3D?(R=e._positionBuffer,O="vertexBuffer",B=emptyVertexBuffer,L="value"):m===SceneMode$1.SCENE2D||m===SceneMode$1.COLUMBUS_VIEW?(R=emptyVertexBuffer,O="value",B=e._positionBuffer,L="vertexBuffer"):(R=S,O="vertexBuffer",B=e._positionBuffer,L="vertexBuffer"),z[0][O]=R,z[1][O]=R,z[2][L]=B,z[3][L]=B,z[4][O]=R,z[5][O]=R,z[6][L]=B,z[7][L]=B,z[8][O]=R,z[9][O]=R,z[10][L]=B,z[11][L]=B;var H=new VertexArray({context:t,attributes:z,indexBuffer:I});e._vertexArrays.push({va:H,buckets:d[w]})}}}function replacer(e,t){return t instanceof Texture?t.id:t}var scratchUniformArray=[];function createMaterialId(e){var t=Material$3._uniformList[e.type],i=t.length;scratchUniformArray.length=2*i;for(var r=0,n=0;n<i;++n){var a=t[n];scratchUniformArray[r]=a,scratchUniformArray[r+1]=e._uniforms[a](),r+=2}return e.type+":"+JSON.stringify(scratchUniformArray,replacer)}function sortPolylinesIntoBuckets(e){for(var t=e._mode,i=e._modelMatrix,r=e._polylineBuckets={},n=e._polylines,a=n.length,o=0;o<a;++o){var s=n[o];if(s._actualPositions.length>1){s.update();var l=s.material,c=r[l.type];defined(c)||(c=r[l.type]=new PolylineBucket(l,t,i)),c.addPolyline(s)}}}function updateMode$1(e,t){var i=t.mode;e._mode===i&&Matrix4.equals(e._modelMatrix,e.modelMatrix)||(e._mode=i,e._modelMatrix=Matrix4.clone(e.modelMatrix),e._createVertexArray=!0)}function removePolylines(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;for(var t,i=[],r=[],n=0,a=e._polylines.length,o=0;o<a;++o)(t=e._polylines[o]).isDestroyed||(t._index=n++,r.push(t),i.push(t));e._polylines=i,e._polylinesToUpdate=r}}function releaseShaders(e){for(var t=e._polylines,i=t.length,r=0;r<i;++r)if(!t[r].isDestroyed){var n=t[r]._bucket;defined(n)&&(n.shaderProgram=n.shaderProgram&&n.shaderProgram.destroy())}}function destroyVertexArrays(e){for(var t=e._vertexArrays.length,i=0;i<t;++i)e._vertexArrays[i].va.destroy();e._vertexArrays.length=0}function destroyPolylines(e){for(var t=e._polylines,i=t.length,r=0;r<i;++r)t[r].isDestroyed||t[r]._destroy()}function VertexArrayBucketLocator(e,t,i){this.count=e,this.offset=t,this.bucket=i}function PolylineBucket(e,t,i){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.mode=t,this.modelMatrix=i}function intersectsIDL(e){return Cartesian3.dot(Cartesian3.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(Plane.ORIGIN_ZX_PLANE)===Intersect$1.INTERSECTING}PolylineCollection.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,e._dirty||this._polylinesToUpdate.push(e),++this._propertiesChanged[t]},PolylineBucket.prototype.addPolyline=function(e){this.polylines.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this},PolylineBucket.prototype.updateShader=function(e,t,i){if(!defined(this.shaderProgram)){var r=["DISTANCE_DISPLAY_CONDITION"];i&&r.push("VECTOR_TILE"),-1!==this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g)&&r.push("POLYLINE_DASH"),FeatureDetection.isInternetExplorer()||r.push("CLIP_POLYLINE");var n=new ShaderSource({defines:r,sources:["varying vec4 v_pickColor;\n",this.material.shaderSource,PolylineFS$1]}),a=t.getVertexShaderCallback()(PolylineVS),o=new ShaderSource({defines:r,sources:[PolylineCommon,a]});this.shaderProgram=ShaderProgram.fromCache({context:e,vertexShaderSource:o,fragmentShaderSource:n,attributeLocations:attributeLocations$5})}},PolylineBucket.prototype.getPolylinePositionsLength=function(e){var t;if(this.mode===SceneMode$1.SCENE3D||!intersectsIDL(e))return 4*(t=e._actualPositions.length)-4;var i=0,r=e._segments.lengths;t=r.length;for(var n=0;n<t;++n)i+=4*r[n]-4;return i};var scratchWritePosition=new Cartesian3,scratchWritePrevPosition=new Cartesian3,scratchWriteNextPosition=new Cartesian3,scratchWriteVector=new Cartesian3,scratchPickColorCartesian=new Cartesian4,scratchWidthShowCartesian=new Cartesian2;PolylineBucket.prototype.write=function(e,t,i,r,n,a,o,s){for(var l=this.mode,c=s.ellipsoid.maximumRadius*CesiumMath.PI,u=this.polylines,d=u.length,h=0;h<d;++h){for(var p,f=u[h],m=f.width,g=f.show&&m>0,_=f._index,y=this.getSegments(f,s),v=y.positions,C=y.lengths,T=v.length,S=f.getPickId(o).color,A=0,x=0,E=0;E<T;++E){0===E?f._loop?p=v[T-2]:(p=scratchWriteVector,Cartesian3.subtract(v[0],v[1],p),Cartesian3.add(v[0],p,p)):p=v[E-1],Cartesian3.clone(p,scratchWritePrevPosition),Cartesian3.clone(v[E],scratchWritePosition),E===T-1?f._loop?p=v[1]:(p=scratchWriteVector,Cartesian3.subtract(v[T-1],v[T-2],p),Cartesian3.add(v[T-1],p,p)):p=v[E+1],Cartesian3.clone(p,scratchWriteNextPosition);var b=C[A];E===x+b&&(x+=b,++A);var P=E-x==0,D=E===x+C[A]-1;l===SceneMode$1.SCENE2D&&(scratchWritePrevPosition.z=0,scratchWritePosition.z=0,scratchWriteNextPosition.z=0),l!==SceneMode$1.SCENE2D&&l!==SceneMode$1.MORPHING||(P||D)&&c-Math.abs(scratchWritePosition.x)<1&&((scratchWritePosition.x<0&&scratchWritePrevPosition.x>0||scratchWritePosition.x>0&&scratchWritePrevPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWritePrevPosition),(scratchWritePosition.x<0&&scratchWriteNextPosition.x>0||scratchWritePosition.x>0&&scratchWriteNextPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWriteNextPosition));for(var w=D?2:4,M=P?2:0;M<w;++M){EncodedCartesian3.writeElements(scratchWritePosition,e,i),EncodedCartesian3.writeElements(scratchWritePrevPosition,e,i+6),EncodedCartesian3.writeElements(scratchWriteNextPosition,e,i+12);var I=M-2<0?-1:1;t[n]=E/(T-1),t[n+1]=M%2*2-1,t[n+2]=I,t[n+3]=_,i+=18,n+=4}}var R=scratchPickColorCartesian;R.x=Color.floatToByte(S.red),R.y=Color.floatToByte(S.green),R.z=Color.floatToByte(S.blue),R.w=Color.floatToByte(S.alpha);var O=scratchWidthShowCartesian;O.x=m,O.y=g?1:0;var B=l===SceneMode$1.SCENE2D?f._boundingVolume2D:f._boundingVolumeWC,L=EncodedCartesian3.fromCartesian(B.center,scratchUpdatePolylineEncodedCartesian),F=L.high,N=Cartesian4.fromElements(L.low.x,L.low.y,L.low.z,B.radius,scratchUpdatePolylineCartesian4),V=scratchNearFarCartesian2;V.x=0,V.y=Number.MAX_VALUE;var k=f.distanceDisplayCondition;defined(k)&&(V.x=k.near,V.y=k.far),a.setBatchedAttribute(_,0,O),a.setBatchedAttribute(_,1,R),a.attributes.length>2&&(a.setBatchedAttribute(_,2,F),a.setBatchedAttribute(_,3,N),a.setBatchedAttribute(_,4,V))}};var morphPositionScratch=new Cartesian3,morphPrevPositionScratch=new Cartesian3,morphNextPositionScratch=new Cartesian3,morphVectorScratch=new Cartesian3;PolylineBucket.prototype.writeForMorph=function(e,t){for(var i=this.modelMatrix,r=this.polylines,n=r.length,a=0;a<n;++a)for(var o=r[a],s=o._segments.positions,l=o._segments.lengths,c=s.length,u=0,d=0,h=0;h<c;++h){var p;0===h?o._loop?p=s[c-2]:(p=morphVectorScratch,Cartesian3.subtract(s[0],s[1],p),Cartesian3.add(s[0],p,p)):p=s[h-1],p=Matrix4.multiplyByPoint(i,p,morphPrevPositionScratch);var f,m=Matrix4.multiplyByPoint(i,s[h],morphPositionScratch);h===c-1?o._loop?f=s[1]:(f=morphVectorScratch,Cartesian3.subtract(s[c-1],s[c-2],f),Cartesian3.add(s[c-1],f,f)):f=s[h+1],f=Matrix4.multiplyByPoint(i,f,morphNextPositionScratch);var g=l[u];h===d+g&&(d+=g,++u);for(var _=h-d==0,y=h===d+l[u]-1?2:4,v=_?2:0;v<y;++v)EncodedCartesian3.writeElements(m,e,t),EncodedCartesian3.writeElements(p,e,t+6),EncodedCartesian3.writeElements(f,e,t+12),t+=18}};var scratchSegmentLengths=new Array(1);PolylineBucket.prototype.updateIndices=function(e,t,i,r){var n=i.length-1,a=new VertexArrayBucketLocator(0,r,this);i[n].push(a);var o=0,s=e[e.length-1],l=0;s.length>0&&(l=s[s.length-1]+1);for(var c=this.polylines,u=c.length,d=0;d<u;++d){var h,p=c[d];if(p._locatorBuckets=[],this.mode===SceneMode$1.SCENE3D){h=scratchSegmentLengths;var f=p._actualPositions.length;if(!(f>0))continue;h[0]=f}else h=p._segments.lengths;var m=h.length;if(m>0){for(var g=0,_=0;_<m;++_)for(var y=h[_]-1,v=0;v<y;++v)l+4>CesiumMath.SIXTY_FOUR_KILOBYTES&&(p._locatorBuckets.push({locator:a,count:g}),g=0,t.push(4),s=[],e.push(s),l=0,a.count=o,o=0,r=0,a=new VertexArrayBucketLocator(0,0,this),i[++n]=[a]),s.push(l,l+2,l+1),s.push(l+1,l+2,l+3),g+=6,o+=6,r+=6,l+=4;p._locatorBuckets.push({locator:a,count:g}),l+4>CesiumMath.SIXTY_FOUR_KILOBYTES&&(t.push(0),s=[],e.push(s),l=0,a.count=o,r=0,o=0,a=new VertexArrayBucketLocator(0,0,this),i[++n]=[a])}p._clean()}return a.count=o,r},PolylineBucket.prototype.getPolylineStartIndex=function(e){for(var t=this.polylines,i=0,r=t.length,n=0;n<r;++n){var a=t[n];if(a===e)break;i+=a._actualLength}return i};var scratchSegments={positions:void 0,lengths:void 0},scratchLengths=new Array(1),pscratch=new Cartesian3,scratchCartographic$b=new Cartographic,scratchPositionsArray;function Vector3DTilePoints(e){this._positions=e.positions,this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._rectangle=e.rectangle,this._minHeight=e.minimumHeight,this._maxHeight=e.maximumHeight,this._billboardCollection=void 0,this._labelCollection=void 0,this._polylineCollection=void 0,this._verticesPromise=void 0,this._packedBuffer=void 0,this._ready=!1,this._readyPromise=when.defer(),this._resolvedPromise=!1}function packBuffer$3(e,t){var i=e._rectangle,r=e._minHeight,n=e._maxHeight,a=2+Rectangle.packedLength+Ellipsoid.packedLength,o=new Float64Array(a),s=0;return o[s++]=r,o[s++]=n,Rectangle.pack(i,o,s),s+=Rectangle.packedLength,Ellipsoid.pack(t,o,s),o}PolylineBucket.prototype.getSegments=function(e,t){var i=e._actualPositions;if(this.mode===SceneMode$1.SCENE3D)return scratchLengths[0]=i.length,scratchSegments.positions=i,scratchSegments.lengths=scratchLengths,scratchSegments;intersectsIDL(e)&&(i=e._segments.positions);for(var r,n=t.ellipsoid,a=[],o=this.modelMatrix,s=i.length,l=pscratch,c=0;c<s;++c)r=i[c],l=Matrix4.multiplyByPoint(o,r,l),a.push(t.project(n.cartesianToCartographic(l,scratchCartographic$b)));if(a.length>0){e._boundingVolume2D=BoundingSphere.fromPoints(a,e._boundingVolume2D);var u=e._boundingVolume2D.center;e._boundingVolume2D.center=new Cartesian3(u.z,u.x,u.y)}return scratchSegments.positions=a,scratchSegments.lengths=e._segments.lengths,scratchSegments},PolylineBucket.prototype.writeUpdate=function(e,t,i,r){var n=this.mode,a=r.ellipsoid.maximumRadius*CesiumMath.PI,o=t._actualLength;if(o){e+=this.getPolylineStartIndex(t);var s=scratchPositionsArray,l=6*o*3;!defined(s)||s.length<l?s=scratchPositionsArray=new Float32Array(l):s.length>l&&(s=new Float32Array(s.buffer,0,l));var c,u=this.getSegments(t,r),d=u.positions,h=u.lengths,p=0,f=0,m=0;o=d.length;for(var g=0;g<o;++g){0===g?t._loop?c=d[o-2]:(c=scratchWriteVector,Cartesian3.subtract(d[0],d[1],c),Cartesian3.add(d[0],c,c)):c=d[g-1],Cartesian3.clone(c,scratchWritePrevPosition),Cartesian3.clone(d[g],scratchWritePosition),g===o-1?t._loop?c=d[1]:(c=scratchWriteVector,Cartesian3.subtract(d[o-1],d[o-2],c),Cartesian3.add(d[o-1],c,c)):c=d[g+1],Cartesian3.clone(c,scratchWriteNextPosition);var _=h[f];g===m+_&&(m+=_,++f);var y=g-m==0,v=g===m+h[f]-1;n===SceneMode$1.SCENE2D&&(scratchWritePrevPosition.z=0,scratchWritePosition.z=0,scratchWriteNextPosition.z=0),n!==SceneMode$1.SCENE2D&&n!==SceneMode$1.MORPHING||(y||v)&&a-Math.abs(scratchWritePosition.x)<1&&((scratchWritePosition.x<0&&scratchWritePrevPosition.x>0||scratchWritePosition.x>0&&scratchWritePrevPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWritePrevPosition),(scratchWritePosition.x<0&&scratchWriteNextPosition.x>0||scratchWritePosition.x>0&&scratchWriteNextPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWriteNextPosition));for(var C=v?2:4,T=y?2:0;T<C;++T)EncodedCartesian3.writeElements(scratchWritePosition,s,p),EncodedCartesian3.writeElements(scratchWritePrevPosition,s,p+6),EncodedCartesian3.writeElements(scratchWriteNextPosition,s,p+12),p+=18}i.copyFromArrayView(s,18*Float32Array.BYTES_PER_ELEMENT*e)}},Object.defineProperties(Vector3DTilePoints.prototype,{pointsLength:{get:function(){return this._billboardCollection.length}},texturesByteLength:{get:function(){return this._billboardCollection.textureAtlas.texture.sizeInBytes+this._labelCollection._textureAtlas.texture.sizeInBytes}},readyPromise:{get:function(){return this._readyPromise.promise}}});var createVerticesTaskProcessor$3=new TaskProcessor("createVectorTilePoints",5),scratchPosition$4=new Cartesian3;function createPoints(e,t){if(!defined(e._billboardCollection)){var i;if(!defined(e._verticesPromise)){i=e._positions;var r=e._packedBuffer;defined(r)||(i=e._positions=arraySlice(i),e._batchIds=arraySlice(e._batchIds),r=e._packedBuffer=packBuffer$3(e,t));var n=[i.buffer,r.buffer],a={positions:i.buffer,packedBuffer:r.buffer},o=e._verticesPromise=createVerticesTaskProcessor$3.scheduleTask(a,n);if(!defined(o))return;o.then((function(t){e._positions=new Float64Array(t.positions),e._ready=!0}))}if(e._ready&&!defined(e._billboardCollection)){i=e._positions;var s=e._batchTable,l=e._batchIds,c=e._billboardCollection=new BillboardCollection({batchTable:s}),u=e._labelCollection=new LabelCollection({batchTable:s}),d=e._polylineCollection=new PolylineCollection;d._useHighlightColor=!0;for(var h=i.length/3,p=0;p<h;++p){var f=l[p],m=Cartesian3.unpack(i,3*p,scratchPosition$4),g=c.add();g.position=m,g._batchIndex=f;var _=u.add();_.text=" ",_.position=m,_._batchIndex=f,d.add().positions=[Cartesian3.clone(m),Cartesian3.clone(m)]}e._positions=void 0,e._packedBuffer=void 0}}}function clearStyle$2(e,t){for(var i=e._batchIds,r=i.length,n=0;n<r;++n){var a=t[i[n]];a.show=!0,a.pointSize=Cesium3DTilePointFeature.defaultPointSize,a.color=Cesium3DTilePointFeature.defaultColor,a.pointOutlineColor=Cesium3DTilePointFeature.defaultPointOutlineColor,a.pointOutlineWidth=Cesium3DTilePointFeature.defaultPointOutlineWidth,a.labelColor=Color.WHITE,a.labelOutlineColor=Color.WHITE,a.labelOutlineWidth=1,a.font="30px sans-serif",a.labelStyle=LabelStyle$1.FILL,a.labelText=void 0,a.backgroundColor=new Color(.165,.165,.165,.8),a.backgroundPadding=new Cartesian2(7,5),a.backgroundEnabled=!1,a.scaleByDistance=void 0,a.translucencyByDistance=void 0,a.distanceDisplayCondition=void 0,a.heightOffset=0,a.anchorLineEnabled=!1,a.anchorLineColor=Color.WHITE,a.image=void 0,a.disableDepthTestDistance=0,a.horizontalOrigin=HorizontalOrigin$1.CENTER,a.verticalOrigin=VerticalOrigin$1.CENTER,a.labelHorizontalOrigin=HorizontalOrigin$1.RIGHT,a.labelVerticalOrigin=VerticalOrigin$1.BASELINE}}Vector3DTilePoints.prototype.createFeatures=function(e,t){for(var i=this._billboardCollection,r=this._labelCollection,n=this._polylineCollection,a=this._batchIds,o=a.length,s=0;s<o;++s){var l=a[s],c=i.get(s),u=r.get(s),d=n.get(s);t[l]=new Cesium3DTilePointFeature(e,l,c,u,d)}},Vector3DTilePoints.prototype.applyDebugSettings=function(e,t){e?(Color.clone(t,this._billboardCollection._highlightColor),Color.clone(t,this._labelCollection._highlightColor),Color.clone(t,this._polylineCollection._highlightColor)):(Color.clone(Color.WHITE,this._billboardCollection._highlightColor),Color.clone(Color.WHITE,this._labelCollection._highlightColor),Color.clone(Color.WHITE,this._polylineCollection._highlightColor))};var scratchColor$i=new Color,scratchColor2=new Color,scratchColor3=new Color,scratchColor4=new Color,scratchColor5=new Color,scratchColor6=new Color,scratchScaleByDistance=new NearFarScalar,scratchTranslucencyByDistance=new NearFarScalar,scratchDistanceDisplayCondition=new DistanceDisplayCondition;function Vector3DTilePolygons(e){this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._positions=e.positions,this._counts=e.counts,this._indices=e.indices,this._indexCounts=e.indexCounts,this._indexOffsets=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._batchedPositions=void 0,this._transferrableBatchIds=void 0,this._vertexBatchIds=void 0,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._polygonMinimumHeights=e.polygonMinimumHeights,this._polygonMaximumHeights=e.polygonMaximumHeights,this._center=defaultValue(e.center,Cartesian3.ZERO),this._rectangle=e.rectangle,this._center=void 0,this._boundingVolume=e.boundingVolume,this._boundingVolumes=void 0,this._batchedIndices=void 0,this._ready=!1,this._readyPromise=when.defer(),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=ClassificationType$1.BOTH}function packBuffer$2(e){var t=new Float64Array(3+Cartesian3.packedLength+Ellipsoid.packedLength+Rectangle.packedLength),i=0;return t[i++]=e._indices.BYTES_PER_ELEMENT,t[i++]=e._minimumHeight,t[i++]=e._maximumHeight,Cartesian3.pack(e._center,t,i),i+=Cartesian3.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,Rectangle.pack(e._rectangle,t,i),t}function unpackBuffer(e,t){for(var i=1,r=t[i++],n=e._boundingVolumes=new Array(r),a=0;a<r;++a)n[a]=OrientedBoundingBox.unpack(t,i),i+=OrientedBoundingBox.packedLength;for(var o=t[i++],s=e._batchedIndices=new Array(o),l=0;l<o;++l){var c=Color.unpack(t,i);i+=Color.packedLength;for(var u=t[i++],d=t[i++],h=t[i++],p=new Array(h),f=0;f<h;++f)p[f]=t[i++];s[l]=new Vector3DTileBatch({color:c,offset:u,count:d,batchIds:p})}}Vector3DTilePoints.prototype.applyStyle=function(e,t){if(defined(e))for(var i=this._batchIds,r=i.length,n=0;n<r;++n){var a=t[i[n]];if(defined(e.show)&&(a.show=e.show.evaluate(a)),defined(e.pointSize)&&(a.pointSize=e.pointSize.evaluate(a)),defined(e.color)&&(a.color=e.color.evaluateColor(a,scratchColor$i)),defined(e.pointOutlineColor)&&(a.pointOutlineColor=e.pointOutlineColor.evaluateColor(a,scratchColor2)),defined(e.pointOutlineWidth)&&(a.pointOutlineWidth=e.pointOutlineWidth.evaluate(a)),defined(e.labelColor)&&(a.labelColor=e.labelColor.evaluateColor(a,scratchColor3)),defined(e.labelOutlineColor)&&(a.labelOutlineColor=e.labelOutlineColor.evaluateColor(a,scratchColor4)),defined(e.labelOutlineWidth)&&(a.labelOutlineWidth=e.labelOutlineWidth.evaluate(a)),defined(e.font)&&(a.font=e.font.evaluate(a)),defined(e.labelStyle)&&(a.labelStyle=e.labelStyle.evaluate(a)),defined(e.labelText)?a.labelText=e.labelText.evaluate(a):a.labelText=void 0,defined(e.backgroundColor)&&(a.backgroundColor=e.backgroundColor.evaluateColor(a,scratchColor5)),defined(e.backgroundPadding)&&(a.backgroundPadding=e.backgroundPadding.evaluate(a)),defined(e.backgroundEnabled)&&(a.backgroundEnabled=e.backgroundEnabled.evaluate(a)),defined(e.scaleByDistance)){var o=e.scaleByDistance.evaluate(a);scratchScaleByDistance.near=o.x,scratchScaleByDistance.nearValue=o.y,scratchScaleByDistance.far=o.z,scratchScaleByDistance.farValue=o.w,a.scaleByDistance=scratchScaleByDistance}else a.scaleByDistance=void 0;if(defined(e.translucencyByDistance)){var s=e.translucencyByDistance.evaluate(a);scratchTranslucencyByDistance.near=s.x,scratchTranslucencyByDistance.nearValue=s.y,scratchTranslucencyByDistance.far=s.z,scratchTranslucencyByDistance.farValue=s.w,a.translucencyByDistance=scratchTranslucencyByDistance}else a.translucencyByDistance=void 0;if(defined(e.distanceDisplayCondition)){var l=e.distanceDisplayCondition.evaluate(a);scratchDistanceDisplayCondition.near=l.x,scratchDistanceDisplayCondition.far=l.y,a.distanceDisplayCondition=scratchDistanceDisplayCondition}else a.distanceDisplayCondition=void 0;defined(e.heightOffset)&&(a.heightOffset=e.heightOffset.evaluate(a)),defined(e.anchorLineEnabled)&&(a.anchorLineEnabled=e.anchorLineEnabled.evaluate(a)),defined(e.anchorLineColor)&&(a.anchorLineColor=e.anchorLineColor.evaluateColor(a,scratchColor6)),defined(e.image)?a.image=e.image.evaluate(a):a.image=void 0,defined(e.disableDepthTestDistance)&&(a.disableDepthTestDistance=e.disableDepthTestDistance.evaluate(a)),defined(e.horizontalOrigin)&&(a.horizontalOrigin=e.horizontalOrigin.evaluate(a)),defined(e.verticalOrigin)&&(a.verticalOrigin=e.verticalOrigin.evaluate(a)),defined(e.labelHorizontalOrigin)&&(a.labelHorizontalOrigin=e.labelHorizontalOrigin.evaluate(a)),defined(e.labelVerticalOrigin)&&(a.labelVerticalOrigin=e.labelVerticalOrigin.evaluate(a))}else clearStyle$2(this,t)},Vector3DTilePoints.prototype.update=function(e){createPoints(this,e.mapProjection.ellipsoid),this._ready&&(this._polylineCollection.update(e),this._billboardCollection.update(e),this._labelCollection.update(e),this._resolvedPromise||(this._readyPromise.resolve(),this._resolvedPromise=!0))},Vector3DTilePoints.prototype.isDestroyed=function(){return!1},Vector3DTilePoints.prototype.destroy=function(){return this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._polylineCollection=this._polylineCollection&&this._polylineCollection.destroy(),destroyObject(this)},Object.defineProperties(Vector3DTilePolygons.prototype,{trianglesLength:{get:function(){return defined(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return defined(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise.promise}}});var createVerticesTaskProcessor$2=new TaskProcessor("createVectorTilePolygons",5),scratchColor$h=new Color;function createPrimitive(e){if(!defined(e._primitive)){if(!defined(e._verticesPromise)){var t=e._positions,i=e._counts,r=e._indexCounts,n=e._indices,a=e._transferrableBatchIds,o=e._batchTableColors,s=e._packedBuffer;if(!defined(o)){t=e._positions=arraySlice(e._positions),i=e._counts=arraySlice(e._counts),r=e._indexCounts=arraySlice(e._indexCounts),n=e._indices=arraySlice(e._indices),e._center=e._ellipsoid.cartographicToCartesian(Rectangle.center(e._rectangle)),a=e._transferrableBatchIds=new Uint32Array(e._batchIds),o=e._batchTableColors=new Uint32Array(a.length);for(var l=e._batchTable,c=o.length,u=0;u<c;++u){var d=l.getColor(u,scratchColor$h);o[u]=d.toRgba()}s=e._packedBuffer=packBuffer$2(e)}var h=[t.buffer,i.buffer,r.buffer,n.buffer,a.buffer,o.buffer,s.buffer],p={packedBuffer:s.buffer,positions:t.buffer,counts:i.buffer,indexCounts:r.buffer,indices:n.buffer,batchIds:a.buffer,batchTableColors:o.buffer},f=e._polygonMinimumHeights,m=e._polygonMaximumHeights;defined(f)&&defined(m)&&(f=arraySlice(f),m=arraySlice(m),h.push(f.buffer,m.buffer),p.minimumHeights=f,p.maximumHeights=m);var g=e._verticesPromise=createVerticesTaskProcessor$2.scheduleTask(p,h);if(!defined(g))return;when(g,(function(t){e._positions=void 0,e._counts=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0;var i=new Float64Array(t.packedBuffer),r=i[0];unpackBuffer(e,i),e._indices=2===IndexDatatype$1.getSizeInBytes(r)?new Uint16Array(t.indices):new Uint32Array(t.indices),e._indexOffsets=new Uint32Array(t.indexOffsets),e._indexCounts=new Uint32Array(t.indexCounts),e._batchedPositions=new Float32Array(t.positions),e._vertexBatchIds=new Uint16Array(t.batchIds),e._ready=!0}))}e._ready&&!defined(e._primitive)&&(e._primitive=new Vector3DTilePrimitive({batchTable:e._batchTable,positions:e._batchedPositions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center}),e._batchTable=void 0,e._batchIds=void 0,e._positions=void 0,e._counts=void 0,e._indices=void 0,e._indexCounts=void 0,e._indexOffsets=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0,e._center=void 0,e._rectangle=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0,e._verticesPromise=void 0,e._readyPromise.resolve())}}Vector3DTilePolygons.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)},Vector3DTilePolygons.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)},Vector3DTilePolygons.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)},Vector3DTilePolygons.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},Vector3DTilePolygons.prototype.update=function(e){createPrimitive(this),this._ready&&(this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e))},Vector3DTilePolygons.prototype.isDestroyed=function(){return!1},Vector3DTilePolygons.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)};var Vector3DTilePolylinesVS="attribute vec4 currentPosition;\nattribute vec4 previousPosition;\nattribute vec4 nextPosition;\nattribute vec2 expandAndWidth;\nattribute float a_batchId;\nuniform mat4 u_modifiedModelView;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = u_modifiedModelView * currentPosition;\nvec4 prev = u_modifiedModelView * previousPosition;\nvec4 next = u_modifiedModelView * nextPosition;\nfloat angle;\nvec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle);\ngl_Position = czm_viewportOrthographic * positionWC;\n}\n";function Vector3DTilePolylines(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._boundingVolume=e.boundingVolume,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._currentPositions=void 0,this._previousPositions=void 0,this._nextPositions=void 0,this._expandAndWidth=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=Color.clone(Color.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._readyPromise=when.defer(),this._verticesPromise=void 0}function packBuffer$1(e){var t=e._rectangle,i=e._minimumHeight,r=e._maximumHeight,n=e._ellipsoid,a=e._center,o=2+Rectangle.packedLength+Ellipsoid.packedLength+Cartesian3.packedLength,s=new Float64Array(o),l=0;return s[l++]=i,s[l++]=r,Rectangle.pack(t,s,l),l+=Rectangle.packedLength,Ellipsoid.pack(n,s,l),l+=Ellipsoid.packedLength,Cartesian3.pack(a,s,l),s}Object.defineProperties(Vector3DTilePolylines.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise.promise}}});var createVerticesTaskProcessor$1=new TaskProcessor("createVectorTilePolylines",5),attributeLocations$4={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function createVertexArray$2(e,t){if(!defined(e._va)){if(!defined(e._verticesPromise)){var i=e._positions,r=e._widths,n=e._counts,a=e._transferrableBatchIds,o=e._packedBuffer;defined(o)||(i=e._positions=arraySlice(i),r=e._widths=arraySlice(r),n=e._counts=arraySlice(n),a=e._transferrableBatchIds=arraySlice(e._batchIds),o=e._packedBuffer=packBuffer$1(e));var s=[i.buffer,r.buffer,n.buffer,a.buffer,o.buffer],l={positions:i.buffer,widths:r.buffer,counts:n.buffer,batchIds:a.buffer,packedBuffer:o.buffer,keepDecodedPositions:e._keepDecodedPositions},c=e._verticesPromise=createVerticesTaskProcessor$1.scheduleTask(l,s);if(!defined(c))return;when(c).then((function(t){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(t.decodedPositions),e._decodedPositionOffsets=new Uint32Array(t.decodedPositionOffsets)),e._currentPositions=new Float32Array(t.currentPositions),e._previousPositions=new Float32Array(t.previousPositions),e._nextPositions=new Float32Array(t.nextPositions),e._expandAndWidth=new Float32Array(t.expandAndWidth),e._vertexBatchIds=new Uint16Array(t.batchIds);var i=t.indexDatatype;e._indices=i===IndexDatatype$1.UNSIGNED_SHORT?new Uint16Array(t.indices):new Uint32Array(t.indices),e._ready=!0})).otherwise((function(t){e._readyPromise.reject(t)}))}if(e._ready&&!defined(e._va)){var u=e._currentPositions,d=e._previousPositions,h=e._nextPositions,p=e._expandAndWidth,f=e._vertexBatchIds,m=e._indices,g=d.byteLength+u.byteLength+h.byteLength;g+=p.byteLength+f.byteLength+m.byteLength,e._trianglesLength=m.length/3,e._geometryByteLength=g;var _=Buffer$1.createVertexBuffer({context:t,typedArray:d,usage:BufferUsage$1.STATIC_DRAW}),y=Buffer$1.createVertexBuffer({context:t,typedArray:u,usage:BufferUsage$1.STATIC_DRAW}),v=Buffer$1.createVertexBuffer({context:t,typedArray:h,usage:BufferUsage$1.STATIC_DRAW}),C=Buffer$1.createVertexBuffer({context:t,typedArray:p,usage:BufferUsage$1.STATIC_DRAW}),T=Buffer$1.createVertexBuffer({context:t,typedArray:f,usage:BufferUsage$1.STATIC_DRAW}),S=Buffer$1.createIndexBuffer({context:t,typedArray:m,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:2===m.BYTES_PER_ELEMENT?IndexDatatype$1.UNSIGNED_SHORT:IndexDatatype$1.UNSIGNED_INT}),A=[{index:attributeLocations$4.previousPosition,vertexBuffer:_,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$4.currentPosition,vertexBuffer:y,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$4.nextPosition,vertexBuffer:v,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$4.expandAndWidth,vertexBuffer:C,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2},{index:attributeLocations$4.a_batchId,vertexBuffer:T,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new VertexArray({context:t,attributes:A,indexBuffer:S}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._currentPositions=void 0,e._previousPositions=void 0,e._nextPositions=void 0,e._expandAndWidth=void 0,e._vertexBatchIds=void 0,e._indices=void 0,e._readyPromise.resolve()}}}var modifiedModelViewScratch$2=new Matrix4,rtcScratch$2=new Cartesian3;function createUniformMap$3(e,t){defined(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){var i=t.uniformState.view;return Matrix4.clone(i,modifiedModelViewScratch$2),Matrix4.multiplyByPoint(modifiedModelViewScratch$2,e._center,rtcScratch$2),Matrix4.setTranslation(modifiedModelViewScratch$2,rtcScratch$2,modifiedModelViewScratch$2),modifiedModelViewScratch$2},u_highlightColor:function(){return e._highlightColor}})}function createRenderStates$2(e){if(!defined(e._rs)){e._rs=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},polygonOffset:{enabled:!0,factor:-5,units:-5}})}}var PolylineFS="uniform vec4 u_highlightColor; \nvoid main()\n{\n gl_FragColor = u_highlightColor;\n}\n";function createShaders$1(e,t){if(!defined(e._sp)){var i=e._batchTable,r=i.getVertexShaderCallback(!1,"a_batchId",void 0)(Vector3DTilePolylinesVS),n=i.getFragmentShaderCallback(!1,void 0,!1)(PolylineFS),a=new ShaderSource({defines:["VECTOR_TILE",FeatureDetection.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[PolylineCommon,r]}),o=new ShaderSource({defines:["VECTOR_TILE"],sources:[n]});e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:attributeLocations$4})}}function queueCommands$1(e,t){if(!defined(e._command)){var i=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new DrawCommand({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:i,boundingVolume:e._boundingVolume,pass:Pass$1.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}function clearStyle$1(e,t){for(var i=e._batchIds,r=i.length,n=0;n<r;++n){var a=t[i[n]];a.show=!0,a.color=Color.WHITE}}Vector3DTilePolylines.getPolylinePositions=function(e,t){var i=e._batchIds,r=e._decodedPositions,n=e._decodedPositionOffsets;if(defined(i)&&defined(r)){var a,o,s=i.length,l=0,c=0;for(a=0;a<s;++a)i[a]===t&&(l+=n[a+1]-n[a]);if(0!==l){var u=new Float64Array(3*l);for(a=0;a<s;++a)if(i[a]===t){var d=n[a],h=n[a+1]-d;for(o=0;o<h;++o){var p=3*(d+o);u[c++]=r[p],u[c++]=r[p+1],u[c++]=r[p+2]}}return u}}},Vector3DTilePolylines.prototype.getPositions=function(e){return Vector3DTilePolylines.getPolylinePositions(this,e)},Vector3DTilePolylines.prototype.createFeatures=function(e,t){for(var i=this._batchIds,r=i.length,n=0;n<r;++n){var a=i[n];t[a]=new Cesium3DTileFeature(e,a)}},Vector3DTilePolylines.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};var scratchColor$g=new Color,DEFAULT_COLOR_VALUE$1=Color.WHITE,DEFAULT_SHOW_VALUE$1=!0;Vector3DTilePolylines.prototype.applyStyle=function(e,t){if(defined(e))for(var i=this._batchIds,r=i.length,n=0;n<r;++n){var a=t[i[n]];a.color=defined(e.color)?e.color.evaluateColor(a,scratchColor$g):DEFAULT_COLOR_VALUE$1,a.show=defined(e.show)?e.show.evaluate(a):DEFAULT_SHOW_VALUE$1}else clearStyle$1(this,t)},Vector3DTilePolylines.prototype.update=function(e){var t=e.context;if(createVertexArray$2(this,t),createUniformMap$3(this,t),createShaders$1(this,t),createRenderStates$2(this),this._ready){var i=e.passes;(i.render||i.pick)&&queueCommands$1(this,e)}},Vector3DTilePolylines.prototype.isDestroyed=function(){return!1},Vector3DTilePolylines.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),destroyObject(this)};var Vector3DTileClampedPolylinesVS="attribute vec3 startEllipsoidNormal;\nattribute vec3 endEllipsoidNormal;\nattribute vec4 startPositionAndHeight;\nattribute vec4 endPositionAndHeight;\nattribute vec4 startFaceNormalAndVertexCorner;\nattribute vec4 endFaceNormalAndHalfWidth;\nattribute float a_batchId;\nuniform mat4 u_modifiedModelView;\nuniform vec2 u_minimumMaximumVectorHeights;\nvarying vec4 v_startPlaneEC;\nvarying vec4 v_endPlaneEC;\nvarying vec4 v_rightPlaneEC;\nvarying float v_halfWidth;\nvarying vec3 v_volumeUpEC;\nvoid main()\n{\nfloat isEnd = floor(startFaceNormalAndVertexCorner.w * 0.251);\nfloat isTop = floor(startFaceNormalAndVertexCorner.w * mix(0.51, 0.19, isEnd));\nvec3 forward = endPositionAndHeight.xyz - startPositionAndHeight.xyz;\nvec3 right = normalize(cross(forward, startEllipsoidNormal));\nvec4 position = vec4(startPositionAndHeight.xyz, 1.0);\nposition.xyz += forward * isEnd;\nv_volumeUpEC = czm_normal * normalize(cross(right, forward));\nfloat offset;\nvec3 ellipsoidNormal = mix(startEllipsoidNormal, endEllipsoidNormal, isEnd);\noffset = mix(startPositionAndHeight.w, endPositionAndHeight.w, isEnd);\noffset = mix(u_minimumMaximumVectorHeights.y, u_minimumMaximumVectorHeights.x, isTop) - offset;\nposition.xyz += offset * ellipsoidNormal;\nposition = u_modifiedModelView * position;\nright = czm_normal * right;\nvec3 scratchNormal = mix(-startFaceNormalAndVertexCorner.xyz, endFaceNormalAndHalfWidth.xyz, isEnd);\nscratchNormal = cross(scratchNormal, mix(startEllipsoidNormal, endEllipsoidNormal, isEnd));\nvec3 miterPushNormal = czm_normal * normalize(scratchNormal);\noffset = 2.0 * endFaceNormalAndHalfWidth.w * max(0.0, czm_metersPerPixel(position));\noffset = offset / dot(miterPushNormal, right);\nposition.xyz += miterPushNormal * (offset * sign(0.5 - mod(startFaceNormalAndVertexCorner.w, 2.0)));\ngl_Position = czm_depthClamp(czm_projection * position);\nposition = u_modifiedModelView * vec4(startPositionAndHeight.xyz, 1.0);\nvec3 startNormalEC = czm_normal * startFaceNormalAndVertexCorner.xyz;\nv_startPlaneEC = vec4(startNormalEC, -dot(startNormalEC, position.xyz));\nv_rightPlaneEC = vec4(right, -dot(right, position.xyz));\nposition = u_modifiedModelView * vec4(endPositionAndHeight.xyz, 1.0);\nvec3 endNormalEC = czm_normal * endFaceNormalAndHalfWidth.xyz;\nv_endPlaneEC = vec4(endNormalEC, -dot(endNormalEC, position.xyz));\nv_halfWidth = endFaceNormalAndHalfWidth.w;\n}\n",Vector3DTileClampedPolylinesFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec4 v_startPlaneEC;\nvarying vec4 v_endPlaneEC;\nvarying vec4 v_rightPlaneEC;\nvarying float v_halfWidth;\nvarying vec3 v_volumeUpEC;\nuniform vec4 u_highlightColor;\nvoid main()\n{\nfloat logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));\nif (logDepthOrDepth == 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(0.0, 0.0, 1.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\neyeCoordinate /= eyeCoordinate.w;\nfloat halfMaxWidth = v_halfWidth * czm_metersPerPixel(eyeCoordinate);\nhalfMaxWidth += halfMaxWidth * (1.0 - dot(-normalize(eyeCoordinate.xyz), v_volumeUpEC));\nfloat widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);\nfloat distanceFromStart = czm_planeDistance(v_startPlaneEC, eyeCoordinate.xyz);\nfloat distanceFromEnd = czm_planeDistance(v_endPlaneEC, eyeCoordinate.xyz);\nif (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(logDepthOrDepth, 0.0, 0.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\ngl_FragColor = u_highlightColor;\nczm_writeDepthClamp();\n}\n";function Vector3DTileClampedPolylines(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._minimumMaximumVectorHeights=new Cartesian2(ApproximateTerrainHeights._defaultMinTerrainHeight,ApproximateTerrainHeights._defaultMaxTerrainHeight),this._boundingVolume=OrientedBoundingBox.fromRectangle(e.rectangle,ApproximateTerrainHeights._defaultMinTerrainHeight,ApproximateTerrainHeights._defaultMaxTerrainHeight,this._ellipsoid),this._classificationType=e.classificationType,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._startEllipsoidNormals=void 0,this._endEllipsoidNormals=void 0,this._startPositionAndHeights=void 0,this._startFaceNormalAndVertexCornerIds=void 0,this._endPositionAndHeights=void 0,this._endFaceNormalAndHalfWidths=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=Color.clone(Color.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._readyPromise=when.defer(),this._verticesPromise=void 0;var t=this;ApproximateTerrainHeights.initialize().then((function(){updateMinimumMaximumHeights(t,t._rectangle,t._ellipsoid)})).otherwise((function(e){this._readyPromise.reject(e)}))}function updateMinimumMaximumHeights(e,t,i){var r=ApproximateTerrainHeights.getMinimumMaximumHeights(t,i),n=r.minimumTerrainHeight,a=r.maximumTerrainHeight,o=e._minimumMaximumVectorHeights;o.x=n,o.y=a;var s=e._boundingVolume,l=e._rectangle;OrientedBoundingBox.fromRectangle(l,n,a,i,s)}function packBuffer(e){var t=e._rectangle,i=e._minimumHeight,r=e._maximumHeight,n=e._ellipsoid,a=e._center,o=2+Rectangle.packedLength+Ellipsoid.packedLength+Cartesian3.packedLength,s=new Float64Array(o),l=0;return s[l++]=i,s[l++]=r,Rectangle.pack(t,s,l),l+=Rectangle.packedLength,Ellipsoid.pack(n,s,l),l+=Ellipsoid.packedLength,Cartesian3.pack(a,s,l),s}Object.defineProperties(Vector3DTileClampedPolylines.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise.promise}}});var createVerticesTaskProcessor=new TaskProcessor("createVectorTileClampedPolylines"),attributeLocations$3={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function createVertexArray$1(e,t){if(!defined(e._va)){if(!defined(e._verticesPromise)){var i=e._positions,r=e._widths,n=e._counts,a=e._transferrableBatchIds,o=e._packedBuffer;defined(o)||(i=e._positions=arraySlice(i),r=e._widths=arraySlice(r),n=e._counts=arraySlice(n),a=e._transferrableBatchIds=arraySlice(e._batchIds),o=e._packedBuffer=packBuffer(e));var s=[i.buffer,r.buffer,n.buffer,a.buffer,o.buffer],l={positions:i.buffer,widths:r.buffer,counts:n.buffer,batchIds:a.buffer,packedBuffer:o.buffer,keepDecodedPositions:e._keepDecodedPositions},c=e._verticesPromise=createVerticesTaskProcessor.scheduleTask(l,s);if(!defined(c))return;when(c,(function(t){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(t.decodedPositions),e._decodedPositionOffsets=new Uint32Array(t.decodedPositionOffsets)),e._startEllipsoidNormals=new Float32Array(t.startEllipsoidNormals),e._endEllipsoidNormals=new Float32Array(t.endEllipsoidNormals),e._startPositionAndHeights=new Float32Array(t.startPositionAndHeights),e._startFaceNormalAndVertexCornerIds=new Float32Array(t.startFaceNormalAndVertexCornerIds),e._endPositionAndHeights=new Float32Array(t.endPositionAndHeights),e._endFaceNormalAndHalfWidths=new Float32Array(t.endFaceNormalAndHalfWidths),e._vertexBatchIds=new Uint16Array(t.vertexBatchIds);var i=t.indexDatatype;e._indices=i===IndexDatatype$1.UNSIGNED_SHORT?new Uint16Array(t.indices):new Uint32Array(t.indices),e._ready=!0})).otherwise((function(t){e._readyPromise.reject(t)}))}if(e._ready&&!defined(e._va)){var u=e._startEllipsoidNormals,d=e._endEllipsoidNormals,h=e._startPositionAndHeights,p=e._endPositionAndHeights,f=e._startFaceNormalAndVertexCornerIds,m=e._endFaceNormalAndHalfWidths,g=e._vertexBatchIds,_=e._indices,y=u.byteLength+d.byteLength;y+=h.byteLength+p.byteLength,y+=f.byteLength+m.byteLength,y+=g.byteLength+_.byteLength,e._trianglesLength=_.length/3,e._geometryByteLength=y;var v=Buffer$1.createVertexBuffer({context:t,typedArray:u,usage:BufferUsage$1.STATIC_DRAW}),C=Buffer$1.createVertexBuffer({context:t,typedArray:d,usage:BufferUsage$1.STATIC_DRAW}),T=Buffer$1.createVertexBuffer({context:t,typedArray:h,usage:BufferUsage$1.STATIC_DRAW}),S=Buffer$1.createVertexBuffer({context:t,typedArray:p,usage:BufferUsage$1.STATIC_DRAW}),A=Buffer$1.createVertexBuffer({context:t,typedArray:f,usage:BufferUsage$1.STATIC_DRAW}),x=Buffer$1.createVertexBuffer({context:t,typedArray:m,usage:BufferUsage$1.STATIC_DRAW}),E=Buffer$1.createVertexBuffer({context:t,typedArray:g,usage:BufferUsage$1.STATIC_DRAW}),b=Buffer$1.createIndexBuffer({context:t,typedArray:_,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:2===_.BYTES_PER_ELEMENT?IndexDatatype$1.UNSIGNED_SHORT:IndexDatatype$1.UNSIGNED_INT}),P=[{index:attributeLocations$3.startEllipsoidNormal,vertexBuffer:v,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$3.endEllipsoidNormal,vertexBuffer:C,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$3.startPositionAndHeight,vertexBuffer:T,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{index:attributeLocations$3.endPositionAndHeight,vertexBuffer:S,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{index:attributeLocations$3.startFaceNormalAndVertexCorner,vertexBuffer:A,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{index:attributeLocations$3.endFaceNormalAndHalfWidth,vertexBuffer:x,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{index:attributeLocations$3.a_batchId,vertexBuffer:E,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new VertexArray({context:t,attributes:P,indexBuffer:b}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._startEllipsoidNormals=void 0,e._endEllipsoidNormals=void 0,e._startPositionAndHeights=void 0,e._startFaceNormalAndVertexCornerIds=void 0,e._endPositionAndHeights=void 0,e._endFaceNormalAndHalfWidths=void 0,e._vertexBatchIds=void 0,e._indices=void 0,e._readyPromise.resolve()}}}var modifiedModelViewScratch$1=new Matrix4,rtcScratch$1=new Cartesian3;function createUniformMap$2(e,t){defined(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){var i=t.uniformState.view;return Matrix4.clone(i,modifiedModelViewScratch$1),Matrix4.multiplyByPoint(modifiedModelViewScratch$1,e._center,rtcScratch$1),Matrix4.setTranslation(modifiedModelViewScratch$1,rtcScratch$1,modifiedModelViewScratch$1),modifiedModelViewScratch$1},u_highlightColor:function(){return e._highlightColor},u_minimumMaximumVectorHeights:function(){return e._minimumMaximumVectorHeights}})}function getRenderState(e){return RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.EQUAL,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK}})}function createRenderStates$1(e){defined(e._rs)||(e._rs=getRenderState(!1),e._rs3DTiles=getRenderState(!0))}function createShaders(e,t){if(!defined(e._sp)){var i=e._batchTable,r=i.getVertexShaderCallback(!1,"a_batchId",void 0)(Vector3DTileClampedPolylinesVS),n=i.getFragmentShaderCallback(!1,void 0,!0)(Vector3DTileClampedPolylinesFS),a=new ShaderSource({defines:["VECTOR_TILE",FeatureDetection.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[PolylineCommon,r]}),o=new ShaderSource({defines:["VECTOR_TILE"],sources:[n]});e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:attributeLocations$3})}}function queueCommands(e,t){var i=e._command;if(!defined(e._command)){var r=e._batchTable.getUniformMapCallback()(e._uniformMap);i=e._command=new DrawCommand({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:r,boundingVolume:e._boundingVolume,pass:Pass$1.TERRAIN_CLASSIFICATION,pickId:e._batchTable.getPickId()});var n=DrawCommand.shallowClone(i,i.derivedCommands.tileset);n.renderState=e._rs3DTiles,n.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,i.derivedCommands.tileset=n}var a=e._classificationType;a!==ClassificationType$1.TERRAIN&&a!==ClassificationType$1.BOTH||t.commandList.push(i),a!==ClassificationType$1.CESIUM_3D_TILE&&a!==ClassificationType$1.BOTH||t.commandList.push(i.derivedCommands.tileset)}function clearStyle(e,t){for(var i=e._batchIds,r=i.length,n=0;n<r;++n){var a=t[i[n]];a.show=!0,a.color=Color.WHITE}}Vector3DTileClampedPolylines.prototype.getPositions=function(e){return Vector3DTilePolylines.getPolylinePositions(this,e)},Vector3DTileClampedPolylines.prototype.createFeatures=function(e,t){for(var i=this._batchIds,r=i.length,n=0;n<r;++n){var a=i[n];t[a]=new Cesium3DTileFeature(e,a)}},Vector3DTileClampedPolylines.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};var scratchColor$f=new Color,DEFAULT_COLOR_VALUE=Color.WHITE,DEFAULT_SHOW_VALUE=!0;function Vector3DTileContent(e,t,i,r,n){this._tileset=e,this._tile=t,this._resource=i,this._polygons=void 0,this._polylines=void 0,this._points=void 0,this._contentReadyPromise=void 0,this._readyPromise=when.defer(),this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._groupMetadata=void 0,initialize$5(this,r,n)}function createColorChangedCallback(e){return function(t,i){defined(e._polygons)&&e._polygons.updateCommands(t,i)}}function getBatchIds(e,t){var i,r,n,a,o=defaultValue(e.POLYGONS_LENGTH,0),s=defaultValue(e.POLYLINES_LENGTH,0),l=defaultValue(e.POINTS_LENGTH,0);if(o>0&&defined(e.POLYGON_BATCH_IDS)){var c=t.byteOffset+e.POLYGON_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,c,o)}if(s>0&&defined(e.POLYLINE_BATCH_IDS)){var u=t.byteOffset+e.POLYLINE_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,u,s)}if(l>0&&defined(e.POINT_BATCH_IDS)){var d=t.byteOffset+e.POINT_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,d,l)}var h=defined(i)||defined(r)||defined(n),p=o>0&&!defined(i)||s>0&&!defined(r)||l>0&&!defined(n);if(h&&p)throw new RuntimeError("If one group of batch ids is defined, then all batch ids must be defined.");if(!defined(i)&&!defined(r)&&!defined(n)){var f=0;if(!defined(i)&&o>0)for(i=new Uint16Array(o),a=0;a<o;++a)i[a]=f++;if(!defined(r)&&s>0)for(r=new Uint16Array(s),a=0;a<s;++a)r[a]=f++;if(!defined(n)&&l>0)for(n=new Uint16Array(l),a=0;a<l;++a)n[a]=f++}return{polygons:i,polylines:r,points:n}}Vector3DTileClampedPolylines.prototype.applyStyle=function(e,t){if(defined(e))for(var i=this._batchIds,r=i.length,n=0;n<r;++n){var a=t[i[n]];a.color=defined(e.color)?e.color.evaluateColor(a,scratchColor$f):DEFAULT_COLOR_VALUE,a.show=defined(e.show)?e.show.evaluate(a):DEFAULT_SHOW_VALUE}else clearStyle(this,t)},Vector3DTileClampedPolylines.prototype.update=function(e){var t=e.context;if(createVertexArray$1(this,t),createUniformMap$2(this,t),createShaders(this,t),createRenderStates$1(this),this._ready){var i=e.passes;(i.render||i.pick)&&queueCommands(this,e)}},Vector3DTileClampedPolylines.prototype.isDestroyed=function(){return!1},Vector3DTileClampedPolylines.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),destroyObject(this)},Object.defineProperties(Vector3DTileContent.prototype,{featuresLength:{get:function(){return defined(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return defined(this._points)?this._points.pointsLength:0}},trianglesLength:{get:function(){var e=0;return defined(this._polygons)&&(e+=this._polygons.trianglesLength),defined(this._polylines)&&(e+=this._polylines.trianglesLength),e}},geometryByteLength:{get:function(){var e=0;return defined(this._polygons)&&(e+=this._polygons.geometryByteLength),defined(this._polylines)&&(e+=this._polylines.geometryByteLength),e}},texturesByteLength:{get:function(){return defined(this._points)?this._points.texturesByteLength:0}},batchTableByteLength:{get:function(){return defined(this._batchTable)?this._batchTable.memorySizeInBytes:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}});var sizeOfUint32=Uint32Array.BYTES_PER_ELEMENT;function createFloatingPolylines(e){return new Vector3DTilePolylines(e)}function createClampedPolylines(e){return new Vector3DTileClampedPolylines(e)}function initialize$5(e,t,i){i=defaultValue(i,0);var r=new Uint8Array(t),n=new DataView(t);i+=sizeOfUint32;var a=n.getUint32(i,!0);if(1!==a)throw new RuntimeError("Only Vector tile version 1 is supported. Version "+a+" is not.");i+=sizeOfUint32;var o=n.getUint32(i,!0);if(i+=sizeOfUint32,0!==o){var s=n.getUint32(i,!0);if(i+=sizeOfUint32,0===s)throw new RuntimeError("Feature table must have a byte length greater than zero");var l=n.getUint32(i,!0);i+=sizeOfUint32;var c=n.getUint32(i,!0);i+=sizeOfUint32;var u=n.getUint32(i,!0);i+=sizeOfUint32;var d=n.getUint32(i,!0);i+=sizeOfUint32;var h=n.getUint32(i,!0);i+=sizeOfUint32;var p=n.getUint32(i,!0);i+=sizeOfUint32;var f=n.getUint32(i,!0),m=getJsonFromTypedArray(r,i+=sizeOfUint32,s);i+=s;var g,_,y=new Uint8Array(t,i,l);i+=l,c>0&&(g=getJsonFromTypedArray(r,i,c),i+=c,u>0&&(_=new Uint8Array(t,i,u),_=new Uint8Array(_),i+=u));var v=defaultValue(m.POLYGONS_LENGTH,0),C=defaultValue(m.POLYLINES_LENGTH,0),T=defaultValue(m.POINTS_LENGTH,0),S=v+C+T,A=new Cesium3DTileBatchTable(e,S,g,_,createColorChangedCallback(e));if(e._batchTable=A,0!==S){var x=new Cesium3DTileFeatureTable(m,y),E=x.getGlobalProperty("REGION");if(!defined(E))throw new RuntimeError("Feature table global property: REGION must be defined");var b=Rectangle.unpack(E),P=E[4],D=E[5],w=e._tile.computedTransform,M=x.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(M)?(M=Cartesian3.unpack(M),Matrix4.multiplyByPoint(w,M,M)):((M=Rectangle.center(b)).height=CesiumMath.lerp(P,D,.5),M=Ellipsoid.WGS84.cartographicToCartesian(M));var I=getBatchIds(m,y);if(i+=(4-i%4)%4,v>0){x.featuresLength=v;var R=defaultValue(x.getPropertyArray("POLYGON_COUNTS",ComponentDatatype$1.UNSIGNED_INT,1),x.getPropertyArray("POLYGON_COUNT",ComponentDatatype$1.UNSIGNED_INT,1));if(!defined(R))throw new RuntimeError("Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");var O=defaultValue(x.getPropertyArray("POLYGON_INDEX_COUNTS",ComponentDatatype$1.UNSIGNED_INT,1),x.getPropertyArray("POLYGON_INDEX_COUNT",ComponentDatatype$1.UNSIGNED_INT,1));if(!defined(O))throw new RuntimeError("Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");var B=R.reduce((function(e,t){return e+2*t}),0),L=O.reduce((function(e,t){return e+t}),0),F=new Uint32Array(t,i,L);i+=d;var N,V,k=new Uint16Array(t,i,B);i+=h,defined(m.POLYGON_MINIMUM_HEIGHTS)&&defined(m.POLYGON_MAXIMUM_HEIGHTS)&&(N=x.getPropertyArray("POLYGON_MINIMUM_HEIGHTS",ComponentDatatype$1.FLOAT,1),V=x.getPropertyArray("POLYGON_MAXIMUM_HEIGHTS",ComponentDatatype$1.FLOAT,1)),e._polygons=new Vector3DTilePolygons({positions:k,counts:R,indexCounts:O,indices:F,minimumHeight:P,maximumHeight:D,polygonMinimumHeights:N,polygonMaximumHeights:V,center:M,rectangle:b,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:A,batchIds:I.polygons,modelMatrix:w})}if(C>0){x.featuresLength=C;var U=defaultValue(x.getPropertyArray("POLYLINE_COUNTS",ComponentDatatype$1.UNSIGNED_INT,1),x.getPropertyArray("POLYLINE_COUNT",ComponentDatatype$1.UNSIGNED_INT,1));if(!defined(U))throw new RuntimeError("Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0");var G=x.getPropertyArray("POLYLINE_WIDTHS",ComponentDatatype$1.UNSIGNED_SHORT,1);if(!defined(G)){G=new Uint16Array(C);for(var $=0;$<C;++$)G[$]=2}var z=U.reduce((function(e,t){return e+3*t}),0),H=new Uint16Array(t,i,z);i+=p;var W=e._tileset,j=W.examineVectorLinesFunction;if(defined(j))examineVectorLines(decodeVectorPolylinePositions(new Uint16Array(H),b,P,D,Ellipsoid.WGS84),U,I.polylines,A,e.url,j);var q=createFloatingPolylines;defined(W.classificationType)&&(q=createClampedPolylines),e._polylines=q({positions:H,widths:G,counts:U,batchIds:I.polylines,minimumHeight:P,maximumHeight:D,center:M,rectangle:b,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:A,classificationType:W.classificationType,keepDecodedPositions:W.vectorKeepDecodedPositions})}if(T>0){var X=new Uint16Array(t,i,3*T);i+=f,e._points=new Vector3DTilePoints({positions:X,batchIds:I.points,minimumHeight:P,maximumHeight:D,rectangle:b,batchTable:A})}}}else e._readyPromise.resolve(e)}function createFeatures(e){var t=e.featuresLength;if(!defined(e._features)&&t>0){var i=new Array(t);defined(e._polygons)&&e._polygons.createFeatures(e,i),defined(e._polylines)&&e._polylines.createFeatures(e,i),defined(e._points)&&e._points.createFeatures(e,i),e._features=i}}function examineVectorLines(e,t,i,r,n,a){for(var o=t.length,s=0,l=0;l<o;l++){var c=3*t[l],u=e.slice(s,s+c);s+=c,a(u,i[l],n,r)}}function PropertyTable(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._name=e.name,this._id=e.id,this._count=e.count,this._extras=e.extras,this._extensions=e.extensions,this._metadataTable=e.metadataTable,this._jsonMetadataTable=e.jsonMetadataTable,this._batchTableHierarchy=e.batchTableHierarchy}Vector3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Vector3DTileContent.prototype.getFeature=function(e){return createFeatures(this),this._features[e]},Vector3DTileContent.prototype.applyDebugSettings=function(e,t){defined(this._polygons)&&this._polygons.applyDebugSettings(e,t),defined(this._polylines)&&this._polylines.applyDebugSettings(e,t),defined(this._points)&&this._points.applyDebugSettings(e,t)},Vector3DTileContent.prototype.applyStyle=function(e){createFeatures(this),defined(this._polygons)&&this._polygons.applyStyle(e,this._features),defined(this._polylines)&&this._polylines.applyStyle(e,this._features),defined(this._points)&&this._points.applyStyle(e,this._features)},Vector3DTileContent.prototype.update=function(e,t){var i=!0;if(defined(this._polygons)&&(this._polygons.classificationType=this._tileset.classificationType,this._polygons.debugWireframe=this._tileset.debugWireframe,this._polygons.update(t),i=i&&this._polygons._ready),defined(this._polylines)&&(this._polylines.update(t),i=i&&this._polylines._ready),defined(this._points)&&(this._points.update(t),i=i&&this._points._ready),defined(this._batchTable)&&i&&this._batchTable.update(e,t),!defined(this._contentReadyPromise)){var r=defined(this._points)?this._points.readyPromise:void 0,n=defined(this._polygons)?this._polygons.readyPromise:void 0,a=defined(this._polylines)?this._polylines.readyPromise:void 0,o=this;this._contentReadyPromise=when.all([r,n,a]).then((function(){o._readyPromise.resolve(o)})).otherwise((function(e){o._readyPromise.reject(e)}))}},Vector3DTileContent.prototype.getPolylinePositions=function(e){var t=this._polylines;if(defined(t))return t.getPositions(e)},Vector3DTileContent.prototype.isDestroyed=function(){return!1},Vector3DTileContent.prototype.destroy=function(){return this._polygons=this._polygons&&this._polygons.destroy(),this._polylines=this._polylines&&this._polylines.destroy(),this._points=this._points&&this._points.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},Object.defineProperties(PropertyTable.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},count:{get:function(){return this._count}},class:{get:function(){if(defined(this._metadataTable))return this._metadataTable.class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),PropertyTable.prototype.hasProperty=function(e,t){return!(!defined(this._metadataTable)||!this._metadataTable.hasProperty(t))||(!(!defined(this._jsonMetadataTable)||!this._jsonMetadataTable.hasProperty(t))||!(!defined(this._batchTableHierarchy)||!this._batchTableHierarchy.hasProperty(e,t)))},PropertyTable.prototype.hasPropertyBySemantic=function(e,t){return!!defined(this._metadataTable)&&this._metadataTable.hasPropertyBySemantic(t)},PropertyTable.prototype.propertyExists=function(e){return!(!defined(this._metadataTable)||!this._metadataTable.hasProperty(e))||(!(!defined(this._jsonMetadataTable)||!this._jsonMetadataTable.hasProperty(e))||!(!defined(this._batchTableHierarchy)||!this._batchTableHierarchy.propertyExists(e)))},PropertyTable.prototype.propertyExistsBySemantic=function(e){return!!defined(this._metadataTable)&&this._metadataTable.hasPropertyBySemantic(e)};var scratchResults=[];function PropertyTextureProperty(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).property,i=e.classProperty,r=e.textures,n=t.texture,a=GltfLoaderUtil.createModelTextureReader({textureInfo:n,channels:t.channels,texture:r[n.index]});this._textureReader=a,this._classProperty=i,this._extras=t.extras,this._extensions=t.extensions}function PropertyTexture(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).featureTexture,i=e.class,r=e.textures,n=t.extensions,a=t.extras,o={};if(defined(t.properties))for(var s in t.properties)t.properties.hasOwnProperty(s)&&(o[s]=new PropertyTextureProperty({property:t.properties[s],classProperty:i.properties[s],textures:r}));this._name=e.name,this._id=e.id,this._class=i,this._properties=o,this._extras=a,this._extensions=n}function FeatureMetadata(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._schema=e.schema;var t=e.propertyTables;this._propertyTableCount=defined(t)?t.length:0,this._propertyTables=t,this._propertyTextures=e.propertyTextures,this._statistics=e.statistics,this._extras=e.extras,this._extensions=e.extensions}function parseFeatureMetadata(e){var t,i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).extension,r=e.schema,n=[];if(defined(i.propertyTables))for(t=0;t<i.propertyTables.length;t++){var a=i.propertyTables[t],o=r.classes[a.class],s=new MetadataTable({count:a.count,properties:a.properties,class:o,bufferViews:e.bufferViews});n.push(new PropertyTable({id:t,name:a.name,count:a.count,metadataTable:s,extras:a.extras,extensions:a.extensions}))}var l=[];if(defined(i.propertyTextures))for(t=0;t<i.propertyTextures.length;t++){var c=i.propertyTextures[t];l.push(new PropertyTexture({id:t,name:c.name,featureTexture:reformatPropertyTexture(c),class:r.classes[c.class],textures:e.textures}))}return new FeatureMetadata({schema:r,propertyTables:n,propertyTextures:l,statistics:i.statistics,extras:i.extras,extensions:i.extensions})}function reformatPropertyTexture(e){var t=clone$1(e),i=clone$1(e);i.properties={};var r=e.properties;for(var n in r)if(r.hasOwnProperty(n)){var a=r[n];i.properties[n]={texture:t,channels:reformatChannels(a)}}return i}function reformatChannels(e){return e.map((function(e){return"rgba".charAt(e)})).join("")}function parseFeatureMetadataLegacy(e){var t,i,r=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).extension,n=e.schema,a=[];if(defined(r.featureTables))for(i=Object.keys(r.featureTables).sort(),t=0;t<i.length;t++){var o=i[t],s=r.featureTables[o],l=n.classes[s.class],c=new MetadataTable({count:s.count,properties:s.properties,class:l,bufferViews:e.bufferViews});a.push(new PropertyTable({id:o,count:s.count,metadataTable:c,extras:s.extras,extensions:s.extensions}))}var u=[];if(defined(r.featureTextures))for(i=Object.keys(r.featureTextures).sort(),t=0;t<i.length;t++){var d=i[t],h=r.featureTextures[d];u.push(new PropertyTexture({id:d,featureTexture:h,class:n.classes[h.class],textures:e.textures}))}return new FeatureMetadata({schema:n,propertyTables:a,propertyTextures:u,statistics:r.statistics,extras:r.extras,extensions:r.extensions})}function GltfFeatureMetadataLoader(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,i=e.extension,r=e.extensionLegacy,n=e.gltfResource,a=e.baseResource,o=e.supportedImageFormats,s=e.cacheKey,l=defaultValue(e.asynchronous,!0);this._gltfResource=n,this._baseResource=a,this._gltf=t,this._extension=i,this._extensionLegacy=r,this._supportedImageFormats=o,this._cacheKey=s,this._asynchronous=l,this._bufferViewLoaders=[],this._textureLoaders=[],this._schemaLoader=void 0,this._featureMetadata=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function gatherBufferViewIdsFromProperties(e,t){for(var i in e)if(e.hasOwnProperty(i)){var r=e[i],n=r.bufferView,a=r.arrayOffsetBufferView,o=r.stringOffsetBufferView;defined(n)&&(t[n]=!0),defined(a)&&(t[a]=!0),defined(o)&&(t[o]=!0)}}function gatherUsedBufferViewIds(e){var t=e.propertyTables,i={};if(defined(t))for(var r=0;r<t.length;r++){gatherBufferViewIdsFromProperties(t[r].properties,i)}return i}function gatherUsedBufferViewIdsLegacy(e){var t=e.featureTables,i={};if(defined(t))for(var r in t)if(t.hasOwnProperty(r)){var n=t[r].properties;defined(n)&&gatherBufferViewIdsFromProperties(n,i)}return i}function loadBufferViews(e){var t;t=defined(e._extension)?gatherUsedBufferViewIds(e._extension):gatherUsedBufferViewIdsLegacy(e._extensionLegacy);var i=[],r={};for(var n in t)if(t.hasOwnProperty(n)){var a=ResourceCache.loadBufferView({gltf:e._gltf,bufferViewId:parseInt(n),gltfResource:e._gltfResource,baseResource:e._baseResource});i.push(a.promise),e._bufferViewLoaders.push(a),r[n]=a}return when.all(i).then((function(){var t={};for(var i in r)if(r.hasOwnProperty(i)){var n=r[i],a=new Uint8Array(n.typedArray);t[i]=a}return unloadBufferViews$1(e),t}))}function gatherUsedTextureIds(e){var t={},i=e.propertyTextures;if(defined(i))for(var r=0;r<i.length;r++){var n=i[r];defined(n.properties)&&(t[n.index]=n)}return t}function gatherTextureIdsFromProperties(e,t){for(var i in e)if(e.hasOwnProperty(i)){var r=e[i].texture;t[r.index]=r}}function gatherUsedTextureIdsLegacy(e){var t={},i=e.featureTextures;if(defined(i))for(var r in i)if(i.hasOwnProperty(r)){var n=i[r].properties;defined(n)&&gatherTextureIdsFromProperties(n,t)}return t}function loadTextures(e){var t;t=defined(e._extension)?gatherUsedTextureIds(e._extension):gatherUsedTextureIdsLegacy(e._extensionLegacy);var i=e._gltf,r=e._gltfResource,n=e._baseResource,a=e._supportedImageFormats,o=e._asynchronous,s=[],l={};for(var c in t)if(t.hasOwnProperty(c)){var u=ResourceCache.loadTexture({gltf:i,textureInfo:t[c],gltfResource:r,baseResource:n,supportedImageFormats:a,asynchronous:o});s.push(u.promise),e._textureLoaders.push(u),l[c]=u}return when.all(s).then((function(){var e={};for(var t in l)if(l.hasOwnProperty(t)){var i=l[t];e[t]=i.texture}return e}))}function loadSchema(e){var t,i=defaultValue(e._extension,e._extensionLegacy);if(defined(i.schemaUri)){var r=e._baseResource.getDerivedResource({url:i.schemaUri});t=ResourceCache.loadSchema({resource:r})}else t=ResourceCache.loadSchema({schema:i.schema});return e._schemaLoader=t,t.promise.then((function(e){return e.schema}))}function unloadBufferViews$1(e){for(var t=e._bufferViewLoaders,i=t.length,r=0;r<i;++r)ResourceCache.unload(t[r]);e._bufferViewLoaders.length=0}function unloadTextures$1(e){for(var t=e._textureLoaders,i=t.length,r=0;r<i;++r)ResourceCache.unload(t[r]);e._textureLoaders.length=0}PropertyTable.prototype.getPropertyIds=function(e,t){return(t=defined(t)?t:[]).length=0,defined(this._metadataTable)&&t.push.apply(t,this._metadataTable.getPropertyIds(scratchResults)),defined(this._jsonMetadataTable)&&t.push.apply(t,this._jsonMetadataTable.getPropertyIds(scratchResults)),defined(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,scratchResults)),t},PropertyTable.prototype.getProperty=function(e,t){var i;return defined(this._metadataTable)&&defined(i=this._metadataTable.getProperty(e,t))||defined(this._jsonMetadataTable)&&defined(i=this._jsonMetadataTable.getProperty(e,t))||defined(this._batchTableHierarchy)&&defined(i=this._batchTableHierarchy.getProperty(e,t))?i:void 0},PropertyTable.prototype.setProperty=function(e,t,i){return!(!defined(this._metadataTable)||!this._metadataTable.setProperty(e,t,i))||(!(!defined(this._jsonMetadataTable)||!this._jsonMetadataTable.setProperty(e,t,i))||defined(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,i))},PropertyTable.prototype.getPropertyBySemantic=function(e,t){if(defined(this._metadataTable))return this._metadataTable.getPropertyBySemantic(e,t)},PropertyTable.prototype.setPropertyBySemantic=function(e,t,i){return!!defined(this._metadataTable)&&this._metadataTable.setPropertyBySemantic(e,t,i)},PropertyTable.prototype.getPropertyTypedArray=function(e){if(defined(this._metadataTable))return this._metadataTable.getPropertyTypedArray(e)},PropertyTable.prototype.getPropertyTypedArrayBySemantic=function(e){if(defined(this._metadataTable))return this._metadataTable.getPropertyTypedArrayBySemantic(e)},Object.defineProperties(PropertyTextureProperty.prototype,{textureReader:{get:function(){return this._textureReader}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Object.defineProperties(PropertyTexture.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),PropertyTexture.prototype.getProperty=function(e){return this._properties[e]},Object.defineProperties(FeatureMetadata.prototype,{schema:{get:function(){return this._schema}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},propertyTableCount:{get:function(){return this._propertyTableCount}},propertyTables:{get:function(){return this._propertyTables}}}),FeatureMetadata.prototype.getPropertyTable=function(e){return this._propertyTables[e]},FeatureMetadata.prototype.getPropertyTexture=function(e){return this._propertyTextures[e]},defined(Object.create)&&(GltfFeatureMetadataLoader.prototype=Object.create(ResourceLoader.prototype),GltfFeatureMetadataLoader.prototype.constructor=GltfFeatureMetadataLoader),Object.defineProperties(GltfFeatureMetadataLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},featureMetadata:{get:function(){return this._featureMetadata}}}),GltfFeatureMetadataLoader.prototype.load=function(){var e=loadBufferViews(this),t=loadTextures(this),i=loadSchema(this);this._gltf=void 0,this._state=ResourceLoaderState$1.LOADING;var r=this;when.all([e,t,i]).then((function(e){if(!r.isDestroyed()){var t=e[0],i=e[1],n=e[2];defined(r._extension)?r._featureMetadata=parseFeatureMetadata({extension:r._extension,schema:n,bufferViews:t,textures:i}):r._featureMetadata=parseFeatureMetadataLegacy({extension:r._extensionLegacy,schema:n,bufferViews:t,textures:i}),r._state=ResourceLoaderState$1.READY,r._promise.resolve(r)}})).otherwise((function(e){if(!r.isDestroyed()){r.unload(),r._state=ResourceLoaderState$1.FAILED;r._promise.reject(r.getError("Failed to load feature metadata",e))}}))},GltfFeatureMetadataLoader.prototype.process=function(e){if(this._state===ResourceLoaderState$1.LOADING)for(var t=this._textureLoaders,i=t.length,r=0;r<i;++r){t[r].process(e)}},GltfFeatureMetadataLoader.prototype.unload=function(){unloadBufferViews$1(this),unloadTextures$1(this),defined(this._schemaLoader)&&ResourceCache.unload(this._schemaLoader),this._schemaLoader=void 0,this._featureMetadata=void 0};var InstanceAttributeSemantic={TRANSLATION:"TRANSLATION",ROTATION:"ROTATION",SCALE:"SCALE",FEATURE_ID:"FEATURE_ID",fromGltfSemantic:function(e){var t=e,i=/^(\w+)_\d+$/.exec(e);switch(null!==i&&(t=i[1]),t){case"TRANSLATION":return InstanceAttributeSemantic.TRANSLATION;case"ROTATION":return InstanceAttributeSemantic.ROTATION;case"SCALE":return InstanceAttributeSemantic.SCALE;case"_FEATURE_ID":case"FEATURE_ID":return InstanceAttributeSemantic.FEATURE_ID}}},InstanceAttributeSemantic$1=Object.freeze(InstanceAttributeSemantic);function SupportedImageFormats(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.webp=defaultValue(e.webp,!1),this.basis=defaultValue(e.basis,!1)}var VertexAttributeSemantic={POSITION:"POSITION",NORMAL:"NORMAL",TANGENT:"TANGENT",TEXCOORD:"TEXCOORD",COLOR:"COLOR",JOINTS:"JOINTS",WEIGHTS:"WEIGHTS",FEATURE_ID:"FEATURE_ID"};function semanticToVariableName(e){switch(e){case VertexAttributeSemantic.POSITION:return"positionMC";case VertexAttributeSemantic.NORMAL:return"normalMC";case VertexAttributeSemantic.TANGENT:return"tangentMC";case VertexAttributeSemantic.TEXCOORD:return"texCoord";case VertexAttributeSemantic.COLOR:return"color";case VertexAttributeSemantic.JOINTS:return"joints";case VertexAttributeSemantic.WEIGHTS:return"weights";case VertexAttributeSemantic.FEATURE_ID:return"featureId"}}VertexAttributeSemantic.hasSetIndex=function(e){switch(e){case VertexAttributeSemantic.POSITION:case VertexAttributeSemantic.NORMAL:case VertexAttributeSemantic.TANGENT:return!1;case VertexAttributeSemantic.TEXCOORD:case VertexAttributeSemantic.COLOR:case VertexAttributeSemantic.JOINTS:case VertexAttributeSemantic.WEIGHTS:case VertexAttributeSemantic.FEATURE_ID:return!0}},VertexAttributeSemantic.fromGltfSemantic=function(e){var t=e,i=/^(\w+)_\d+$/.exec(e);switch(null!==i&&(t=i[1]),t){case"POSITION":return VertexAttributeSemantic.POSITION;case"NORMAL":return VertexAttributeSemantic.NORMAL;case"TANGENT":return VertexAttributeSemantic.TANGENT;case"TEXCOORD":return VertexAttributeSemantic.TEXCOORD;case"COLOR":return VertexAttributeSemantic.COLOR;case"JOINTS":return VertexAttributeSemantic.JOINTS;case"WEIGHTS":return VertexAttributeSemantic.WEIGHTS;case"_FEATURE_ID":case"FEATURE_ID":case"_BATCHID":case"BATCHID":return VertexAttributeSemantic.FEATURE_ID}},VertexAttributeSemantic.fromPntsSemantic=function(e){switch(e){case"POSITION":case"POSITION_QUANTIZED":return VertexAttributeSemantic.POSITION;case"RGBA":case"RGB":case"RGB565":return VertexAttributeSemantic.COLOR;case"NORMAL":case"NORMAL_OCT16P":return VertexAttributeSemantic.NORMAL;case"BATCH_ID":return VertexAttributeSemantic.FEATURE_ID}},VertexAttributeSemantic.getGlslType=function(e){switch(e){case VertexAttributeSemantic.POSITION:case VertexAttributeSemantic.NORMAL:case VertexAttributeSemantic.TANGENT:return"vec3";case VertexAttributeSemantic.TEXCOORD:return"vec2";case VertexAttributeSemantic.COLOR:return"vec4";case VertexAttributeSemantic.JOINTS:return"ivec4";case VertexAttributeSemantic.WEIGHTS:return"vec4";case VertexAttributeSemantic.FEATURE_ID:return"int"}},VertexAttributeSemantic.getVariableName=function(e,t){var i=semanticToVariableName(e);return defined(t)&&(i+="_"+t),i};var VertexAttributeSemantic$1=Object.freeze(VertexAttributeSemantic),Attribute=ModelComponents.Attribute,Indices=ModelComponents.Indices,FeatureIdAttribute$1=ModelComponents.FeatureIdAttribute,FeatureIdTexture=ModelComponents.FeatureIdTexture,MorphTarget=ModelComponents.MorphTarget,Primitive=ModelComponents.Primitive,Instances=ModelComponents.Instances,Skin=ModelComponents.Skin,Node$1=ModelComponents.Node,Scene$1=ModelComponents.Scene,Components=ModelComponents.Components,MetallicRoughness$1=ModelComponents.MetallicRoughness,SpecularGlossiness$1=ModelComponents.SpecularGlossiness,Material$1=ModelComponents.Material,GltfLoaderState={UNLOADED:0,LOADING:1,LOADED:2,PROCESSING:3,PROCESSED:4,READY:4,FAILED:5};function GltfLoader(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltfResource,i=e.baseResource,r=e.typedArray,n=defaultValue(e.releaseGltfJson,!1),a=defaultValue(e.asynchronous,!0),o=defaultValue(e.incrementallyLoadTextures,!0),s=defaultValue(e.upAxis,Axis$1.Y),l=defaultValue(e.forwardAxis,Axis$1.Z),c=defaultValue(e.loadAsTypedArray,!1);i=defined(i)?i:t.clone(),this._gltfJson=e.gltfJson,this._gltfResource=t,this._baseResource=i,this._typedArray=r,this._releaseGltfJson=n,this._asynchronous=a,this._incrementallyLoadTextures=o,this._upAxis=s,this._forwardAxis=l,this._loadAsTypedArray=c,this._sortedPropertyTableIds=void 0,this._sortedFeatureTextureIds=void 0,this._gltfJsonLoader=void 0,this._state=GltfLoaderState.UNLOADED,this._textureState=GltfLoaderState.UNLOADED,this._promise=when.defer(),this._texturesLoadedPromise=when.defer(),this._transform=Matrix4.IDENTITY,this._textureLoaders=[],this._bufferViewLoaders=[],this._geometryLoaders=[],this._featureMetadataLoader=void 0,this._components=void 0}function handleError$1(e,t){e.unload(),e._state=GltfLoaderState.FAILED,e._textureState=GltfLoaderState.FAILED;t=e.getError("Failed to load glTF",t),e._promise.reject(t),e._texturesLoadedPromise.reject(t)}function process$1(e,t){var i,r=e._textureLoaders,n=r.length;for(i=0;i<n;++i)r[i].process(t);var a=e._bufferViewLoaders,o=a.length;for(i=0;i<o;++i)a[i].process(t);var s=e._geometryLoaders,l=s.length;for(i=0;i<l;++i)s[i].process(t);defined(e._featureMetadataLoader)&&e._featureMetadataLoader.process(t)}function loadVertexBuffer(e,t,i,r,n,a,o){var s=t.accessors[i].bufferView,l=ResourceCache.loadVertexBuffer({gltf:t,gltfResource:e._gltfResource,baseResource:e._baseResource,bufferViewId:s,draco:n,attributeSemantic:r,accessorId:i,asynchronous:e._asynchronous,dequantize:a,loadAsTypedArray:o});return e._geometryLoaders.push(l),l}function loadIndexBuffer(e,t,i,r,n){var a=ResourceCache.loadIndexBuffer({gltf:t,accessorId:i,gltfResource:e._gltfResource,baseResource:e._baseResource,draco:r,asynchronous:e._asynchronous,loadAsTypedArray:n});return e._geometryLoaders.push(a),a}function loadBufferView(e,t,i){var r=ResourceCache.loadBufferView({gltf:t,bufferViewId:i,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoaders.push(r),r}function getPackedTypedArray(e,t,i){var r=t.byteOffset,n=getAccessorByteStride(e,t),a=t.count,o=numberOfComponentsForType(t.type),s=t.componentType,l=ComponentDatatype$1.getSizeInBytes(s),c=a*o;if(n===l*o)return i=new Uint8Array(i),ComponentDatatype$1.createArrayBufferView(s,i.buffer,i.byteOffset+r,c);var u=ComponentDatatype$1.createTypedArray(s,c),d=new DataView(i.buffer),h=new Array(o),p=getComponentReader(t.componentType);r=i.byteOffset+r;for(var f=0;f<a;++f){p(d,r,o,l,h);for(var m=0;m<o;++m)u[f*o+m]=h[m];r+=n}return u}function fromArray(e,t){if(defined(t))return e===Number?t[0]:e.unpack(t)}function getDefault(e){return e===Number?0:new e}function createAttribute(e,t,i,r,n){var a=e.accessors[t],o=AttributeType$1.getMathType(a.type),s=new Attribute;return s.name=i,s.semantic=r,s.setIndex=n,s.constant=getDefault(o),s.componentDatatype=a.componentType,s.normalized=defaultValue(a.normalized,!1),s.count=a.count,s.type=a.type,s.min=fromArray(o,a.min),s.max=fromArray(o,a.max),s.byteOffset=a.byteOffset,s.byteStride=getAccessorByteStride(e,a),s}function getSetIndex(e){var t=/^\w+_(\d+)$/.exec(e);if(null!==t)return parseInt(t[1])}function loadAttribute(e,t,i,r,n,a,o,s,l){var c=t.accessors[i],u=c.bufferView,d=n,h=r.fromGltfSemantic(n),p=defined(h)?getSetIndex(n):void 0,f=createAttribute(t,i,d,h,p);return defined(a)||defined(u)?(loadVertexBuffer(e,t,i,n,a,o,s).promise.then((function(i){if(!e.isDestroyed()){if(l){var r=i.typedArray;f.packedTypedArray=getPackedTypedArray(t,c,r),f.byteOffset=0,f.byteStride=void 0}else s?f.typedArray=i.typedArray:f.buffer=i.buffer;defined(a)&&defined(a.attributes)&&defined(a.attributes[n])&&(f.byteOffset=0,f.byteStride=void 0,f.quantization=i.quantization)}})),f):f}function loadVertexAttribute(e,t,i,r,n){return loadAttribute(e,t,i,VertexAttributeSemantic$1,r,n,!1,e._loadAsTypedArray,!1)}function loadInstancedAttribute(e,t,i,r,n){return loadAttribute(e,t,i,InstanceAttributeSemantic$1,r,void 0,!0,n,n)}function loadIndices(e,t,i,r){var n=t.accessors[i],a=n.bufferView;if(defined(r)||defined(a)){var o=new Indices;o.count=n.count;var s=e._loadAsTypedArray;return loadIndexBuffer(e,t,i,r,s).promise.then((function(t){e.isDestroyed()||(o.indexDatatype=t.indexDatatype,s?o.typedArray=t.typedArray:o.buffer=t.buffer)})),o}}function loadTexture(e,t,i,r,n){if(defined(GltfLoaderUtil.getImageIdFromTexture({gltf:t,textureId:i.index,supportedImageFormats:r}))){var a=ResourceCache.loadTexture({gltf:t,textureInfo:i,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:r,asynchronous:e._asynchronous});e._textureLoaders.push(a);var o=GltfLoaderUtil.createModelTextureReader({textureInfo:i});return a.promise.then((function(t){e.isDestroyed()||(o.texture=t.texture,defined(n)&&(o.texture.sampler=n))})),o}}function loadMaterial(e,t,i,r){var n=new Material$1,a=defaultValue(i.extensions,defaultValue.EMPTY_OBJECT),o=a.KHR_materials_pbrSpecularGlossiness,s=i.pbrMetallicRoughness;if(n.unlit=defined(a.KHR_materials_unlit),defined(o)){var l=new SpecularGlossiness$1;n.specularGlossiness=l,defined(o.diffuseTexture)&&(l.diffuseTexture=loadTexture(e,t,o.diffuseTexture,r)),defined(o.specularGlossinessTexture)&&defined(o.specularGlossinessTexture)&&(l.specularGlossinessTexture=loadTexture(e,t,o.specularGlossinessTexture,r)),l.diffuseFactor=fromArray(Cartesian4,o.diffuseFactor),l.specularFactor=fromArray(Cartesian3,o.specularFactor),l.glossinessFactor=o.glossinessFactor,n.pbrSpecularGlossiness=o}else if(defined(s)){var c=new MetallicRoughness$1;n.metallicRoughness=c,defined(s.baseColorTexture)&&(c.baseColorTexture=loadTexture(e,t,s.baseColorTexture,r)),defined(s.metallicRoughnessTexture)&&(c.metallicRoughnessTexture=loadTexture(e,t,s.metallicRoughnessTexture,r)),c.baseColorFactor=fromArray(Cartesian4,s.baseColorFactor),c.metallicFactor=s.metallicFactor,c.roughnessFactor=s.roughnessFactor,n.pbrMetallicRoughness=s}return defined(i.emissiveTexture)&&(n.emissiveTexture=loadTexture(e,t,i.emissiveTexture,r)),defined(i.normalTexture)&&(n.normalTexture=loadTexture(e,t,i.normalTexture,r)),defined(i.occlusionTexture)&&(n.occlusionTexture=loadTexture(e,t,i.occlusionTexture,r)),n.emissiveFactor=fromArray(Cartesian3,i.emissiveFactor),n.alphaMode=i.alphaMode,n.alphaCutoff=i.alphaCutoff,n.doubleSided=i.doubleSided,n}function loadFeatureIdAttribute(e,t){var i=new FeatureIdAttribute$1;return i.propertyTableId=t,i.setIndex=e.attribute,i.offset=defaultValue(e.offset,0),i.repeat=e.repeat,i}function loadFeatureIdAttributeLegacy(e,t){var i=new FeatureIdAttribute$1,r=e.featureIds;i.propertyTableId=t,i.setIndex=getSetIndex(r.attribute),i.offset=defaultValue(r.constant,0);var n=defaultValue(r.divisor,0);return i.repeat=0===n?void 0:n,i}function loadFeatureIdTexture(e,t,i,r,n){var a=new FeatureIdTexture,o=i;a.propertyTableId=r,a.textureReader=loadTexture(e,t,o,n,Sampler.NEAREST);var s="rgba".charAt(i.channel);return a.textureReader.channels=s,a}function loadFeatureIdTextureLegacy(e,t,i,r,n){var a=new FeatureIdTexture,o=i.featureIds,s=o.texture;return a.propertyTableId=r,a.textureReader=loadTexture(e,t,s,n,Sampler.NEAREST),a.textureReader.channels=o.channels,a}function loadMorphTarget(e,t,i){var r=new MorphTarget;for(var n in i)if(i.hasOwnProperty(n)){var a=i[n];r.attributes.push(loadVertexAttribute(e,t,a,n,void 0))}return r}function loadPrimitive(e,t,i,r,n){var a=new Primitive,o=i.material;defined(o)&&(a.material=loadMaterial(e,t,t.materials[o],n));var s=defaultValue(i.extensions,defaultValue.EMPTY_OBJECT),l=s.KHR_draco_mesh_compression,c=i.attributes;if(defined(c))for(var u in c)if(c.hasOwnProperty(u)){var d=c[u];a.attributes.push(loadVertexAttribute(e,t,d,u,l))}var h=i.targets;if(defined(h)){for(var p=h.length,f=0;f<p;++f)a.morphTargets.push(loadMorphTarget(e,t,h[f]));a.morphWeights=defined(r)?r.slice():arrayFill(new Array(p),0)}var m=i.indices;defined(m)&&(a.indices=loadIndices(e,t,m,l));var g=s.EXT_mesh_features,_=s.EXT_feature_metadata;return defined(g)?loadPrimitiveMetadata(e,t,a,g,n):defined(_)&&loadPrimitiveMetadataLegacy(e,t,a,_,n),a.primitiveType=i.mode,a}function loadPrimitiveMetadata(e,t,i,r,n){var a,o=[],s=[],l=r.featureIds,c=r.propertyTables;if(defined(l))for(a=0;a<l.length;a++){var u=l[a];defined(u.channel)?s.push(u):o.push(u)}var d=o.length;for(a=0;a<d;++a)i.featureIdAttributes.push(loadFeatureIdAttribute(o[a],c[a]));var h=s.length;for(a=0;a<h;++a)i.featureIdTextures.push(loadFeatureIdTexture(e,t,s[a],c[a],n));defined(r.propertyTextures)&&(i.featureTextureIds=r.propertyTextures)}function loadPrimitiveMetadataLegacy(e,t,i,r,n){var a,o=r.featureIdAttributes;if(defined(o)){var s=o.length;for(a=0;a<s;++a){var l=o[a];i.featureIdAttributes.push(loadFeatureIdAttributeLegacy(l,e._sortedPropertyTableIds.indexOf(l.featureTable)))}}var c=r.featureIdTextures;if(defined(c)){var u=c.length;for(a=0;a<u;++a){var d=c[a];i.featureIdTextures.push(loadFeatureIdTextureLegacy(e,t,d,e._sortedPropertyTableIds.indexOf(d.featureTable),n))}}defined(r.featureTextures)&&(i.featureTextureIds=r.featureTextures.map((function(t){return e._sortedFeatureTextureIds.indexOf(t)})))}function loadInstances(e,t,i,r){var n=i.EXT_mesh_gpu_instancing,a=new Instances,o=n.attributes;if(defined(o)){var s=defined(o.ROTATION),l=defined(o.TRANSLATION)&&defined(t.accessors[o.TRANSLATION].min)&&defined(t.accessors[o.TRANSLATION].max);for(var c in o)if(o.hasOwnProperty(c)){var u=e._loadAsTypedArray||!r.context.instancedArrays||(s||!l)&&(c===InstanceAttributeSemantic$1.TRANSLATION||c===InstanceAttributeSemantic$1.ROTATION||c===InstanceAttributeSemantic$1.SCALE)||c.indexOf(InstanceAttributeSemantic$1.FEATURE_ID)>=0,d=o[c];a.attributes.push(loadInstancedAttribute(e,t,d,c,u))}}var h=defaultValue(n.extensions,defaultValue.EMPTY_OBJECT),p=i.EXT_mesh_features,f=h.EXT_feature_metadata;return defined(p)?loadInstanceMetadata(a,p):defined(f)&&loadInstanceMetadataLegacy(a,f,e._sortedPropertyTableIds),a}function loadInstanceMetadata(e,t){for(var i=t.featureIds,r=defined(t.propertyTables)?t.propertyTables:[],n=i.length,a=0;a<n;a++){var o=i[a],s=r[a];e.featureIdAttributes.push(loadFeatureIdAttribute(o,s))}}function loadInstanceMetadataLegacy(e,t,i){var r=t.featureIdAttributes;if(defined(r))for(var n=r.length,a=0;a<n;++a){var o=r[a];e.featureIdAttributes.push(loadFeatureIdAttributeLegacy(o,i.indexOf(o.featureTable)))}}function loadSkin(e,t,i,r){for(var n=new Skin,a=i.joints,o=a.length,s=new Array(o),l=0;l<o;++l)s[l]=r[a[l]];n.joints=s;var c=i.inverseBindMatrices;if(defined(c)){var u=t.accessors[c],d=u.bufferView;if(defined(d))loadBufferView(e,t,d).promise.then((function(i){if(!e.isDestroyed()){for(var r=i.typedArray,a=getPackedTypedArray(t,u,r),s=new Array(o),l=0;l<o;++l)s[l]=Matrix4.unpack(a,16*l);n.inverseBindMatrices=s}}))}else n.inverseBindMatrices=arrayFill(new Array(o),Matrix4.IDENTITY);return n}function loadNode(e,t,i,r,n){var a=new Node$1;a.matrix=fromArray(Matrix4,i.matrix),a.translation=fromArray(Cartesian3,i.translation),a.rotation=fromArray(Quaternion,i.rotation),a.scale=fromArray(Cartesian3,i.scale);var o=i.mesh;if(defined(o))for(var s=t.meshes[o],l=defaultValue(i.weights,s.weights),c=s.primitives,u=c.length,d=0;d<u;++d)a.primitives.push(loadPrimitive(e,t,c[d],l,r));var h=defaultValue(i.extensions,defaultValue.EMPTY_OBJECT);return defined(h.EXT_mesh_gpu_instancing)&&(a.instances=loadInstances(e,t,h,n)),a}function loadNodes(e,t,i,r){var n,a,o=t.nodes.length,s=new Array(o);for(n=0;n<o;++n)s[n]=loadNode(e,t,t.nodes[n],i,r);for(n=0;n<o;++n){var l=t.nodes[n].children;if(defined(l)){var c=l.length;for(a=0;a<c;++a)s[n].children.push(s[l[a]])}}for(n=0;n<o;++n){var u=t.nodes[n].skin;defined(u)&&(s[n].skin=loadSkin(e,t,t.skins[u],s))}return s}function loadFeatureMetadata(e,t,i,r,n){var a=new GltfFeatureMetadataLoader({gltf:t,extension:i,extensionLegacy:r,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:n,asynchronous:e._asynchronous});return a.load(),e._featureMetadataLoader=a,a}function getSceneNodeIds(e){var t;return defined(e.scenes)&&defined(e.scene)&&(t=e.scenes[e.scene].nodes),t=defined(t=defaultValue(t,e.nodes))?t:[]}function loadScene(e,t,i,r){var n=new Scene$1;n.upAxis=i,n.forwardAxis=r;var a=getSceneNodeIds(e);return n.nodes=a.map((function(e){return t[e]})),n}function parse(e,t,i,r){var n=defaultValue(t.extensions,defaultValue.EMPTY_OBJECT),a=n.EXT_mesh_features,o=n.EXT_feature_metadata;if(o){var s=o.featureTables,l=o.featureTextures,c=defined(s)?s:[],u=defined(l)?l:[];e._sortedPropertyTableIds=Object.keys(c).sort(),e._sortedFeatureTextureIds=Object.keys(u).sort()}var d=loadNodes(e,t,i,r),h=loadScene(t,d,e._upAxis,e._forwardAxis),p=new Components;(p.scene=h,p.nodes=d,e._components=p,defined(a)||defined(o))&&loadFeatureMetadata(e,t,a,o,i).promise.then((function(t){e.isDestroyed()||(p.featureMetadata=t.featureMetadata)}));var f=[];f.push.apply(f,e._bufferViewLoaders),f.push.apply(f,e._geometryLoaders),defined(e._featureMetadataLoader)&&f.push(e._featureMetadataLoader),e._incrementallyLoadTextures||f.push.apply(f,e._textureLoaders);var m=f.map((function(e){return e.promise})),g=e._textureLoaders.map((function(e){return e.promise}));when.all(m).then((function(){e.isDestroyed()||(e._state=GltfLoaderState.PROCESSED)})).otherwise((function(t){e.isDestroyed()||handleError$1(e,t)})),when.all(g).then((function(){e.isDestroyed()||(e._textureState=GltfLoaderState.PROCESSED)}))}function unloadTextures(e){for(var t=e._textureLoaders,i=t.length,r=0;r<i;++r)ResourceCache.unload(t[r]);e._textureLoaders.length=0}function unloadBufferViews(e){for(var t=e._bufferViewLoaders,i=t.length,r=0;r<i;++r)ResourceCache.unload(t[r]);e._bufferViewLoaders.length=0}function unloadGeometry(e){for(var t=e._geometryLoaders,i=t.length,r=0;r<i;++r)ResourceCache.unload(t[r]);e._geometryLoaders.length=0}function unloadFeatureMetadata(e){defined(e._featureMetadataLoader)&&(e._featureMetadataLoader.destroy(),e._featureMetadataLoader=void 0)}function ModelExperimentalUtility(){}defined(Object.create)&&(GltfLoader.prototype=Object.create(ResourceLoader.prototype),GltfLoader.prototype.constructor=GltfLoader),Object.defineProperties(GltfLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},texturesLoadedPromise:{get:function(){return this._texturesLoadedPromise.promise}},transform:{get:function(){return this._transform}}}),GltfLoader.prototype.load=function(){var e=ResourceCache.loadGltfJson({gltfResource:this._gltfResource,baseResource:this._baseResource,typedArray:this._typedArray,gltfJson:this._gltfJson});this._gltfJsonLoader=e,this._state=GltfLoaderState.LOADING,this._textureState=GltfLoaderState.LOADING;var t=this;e.promise.then((function(){t.isDestroyed()||(t._state=GltfLoaderState.LOADED,t._textureState=GltfLoaderState.LOADED)})).otherwise((function(e){t.isDestroyed()||handleError$1(t,e)}))},GltfLoader.prototype.process=function(e){if(FeatureDetection.supportsWebP.initialized){if(this._state===GltfLoaderState.LOADED){this._state=GltfLoaderState.PROCESSING;var t=new SupportedImageFormats({webp:FeatureDetection.supportsWebP(),basis:e.context.supportsBasis});parse(this,defined(this._gltfJsonLoader)?this._gltfJsonLoader.gltf:this._gltfJson,t,e),defined(this._gltfJsonLoader)&&this._releaseGltfJson&&(ResourceCache.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0)}this._textureState===GltfLoaderState.LOADED&&(this._textureState=GltfLoaderState.PROCESSING),this._state!==GltfLoaderState.PROCESSING&&this._textureState!==GltfLoaderState.PROCESSING||process$1(this,e),this._state===GltfLoaderState.PROCESSED&&(unloadBufferViews(this),this._state=GltfLoaderState.READY,this._promise.resolve(this)),this._textureState===GltfLoaderState.PROCESSED&&(this._textureState=GltfLoaderState.READY,this._texturesLoadedPromise.resolve(this))}else FeatureDetection.supportsWebP.initialize()},GltfLoader.prototype.unload=function(){defined(this._gltfJsonLoader)&&ResourceCache.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0,unloadTextures(this),unloadBufferViews(this),unloadGeometry(this),unloadFeatureMetadata(this),this._components=void 0},ModelExperimentalUtility.getFailedLoadFunction=function(e,t,i){return function(r){var n="Failed to load "+t+": "+i;defined(r)&&(n+="\n"+r.message),e._readyPromise.reject(new RuntimeError(n))}},ModelExperimentalUtility.getNodeTransform=function(e){return defined(e.matrix)?e.matrix:Matrix4.fromTranslationQuaternionRotationScale(defined(e.translation)?e.translation:Cartesian3.ZERO,defined(e.rotation)?e.rotation:Quaternion.IDENTITY,defined(e.scale)?e.scale:Cartesian3.ONE)},ModelExperimentalUtility.getAttributeBySemantic=function(e,t,i){for(var r=e.attributes,n=r.length,a=0;a<n;++a){var o=r[a],s=!defined(i)||o.setIndex===i;if(o.semantic===t&&s)return o}},ModelExperimentalUtility.hasQuantizedAttributes=function(e){if(!defined(e))return!1;for(var t=0;t<e.length;t++){if(defined(e[t].quantization))return!0}return!1},ModelExperimentalUtility.getAttributeInfo=function(e){var t,i=e.semantic,r=e.setIndex,n=!1;defined(i)?(t=VertexAttributeSemantic$1.getVariableName(i,r),n=!0):t=(t=(t=e.name).replace(/^_/,"")).toLowerCase();var a=/^color_\d+$/.test(t),o=e.type,s=AttributeType$1.getGlslType(o);a&&(s="vec4");var l,c=defined(e.quantization);return c&&(l=a?"vec4":AttributeType$1.getGlslType(e.quantization.type)),{attribute:e,isQuantized:c,variableName:t,hasSemantic:n,glslType:s,quantizedGlslType:l}};var cartesianMaxScratch=new Cartesian3,cartesianMinScratch=new Cartesian3;ModelExperimentalUtility.createBoundingSphere=function(e,t,i,r){var n,a=ModelExperimentalUtility.getAttributeBySemantic(e,"POSITION"),o=a.max,s=a.min;if(defined(i)&&defined(r)){var l=Cartesian3.add(s,r,cartesianMinScratch),c=Cartesian3.add(o,i,cartesianMaxScratch);n=BoundingSphere.fromCornerPoints(l,c)}else n=BoundingSphere.fromCornerPoints(s,o);return BoundingSphere.transform(n,t,n),n},ModelExperimentalUtility.correctModelMatrix=function(e,t,i){t===Axis$1.Y?Matrix4.multiplyTransformation(e,Axis$1.Y_UP_TO_Z_UP,e):t===Axis$1.X&&Matrix4.multiplyTransformation(e,Axis$1.X_UP_TO_Z_UP,e),i===Axis$1.Z&&Matrix4.multiplyTransformation(e,Axis$1.Z_UP_TO_X_UP,e)};var ModelExperimentalFS="#if defined(HAS_NORMALS) && !defined(HAS_TANGENTS) && !defined(LIGHTING_UNLIT)\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n#endif\nczm_modelMaterial defaultModelMaterial()\n{\nczm_modelMaterial material;\nmaterial.diffuse = vec3(1.0);\nmaterial.specular = vec3(0.04);\nmaterial.roughness = 0.0;\nmaterial.occlusion = 1.0;\nmaterial.normalEC = vec3(0.0, 0.0, 1.0);\nmaterial.emissive = vec3(0.0);\nmaterial.alpha = 1.0;\nreturn material;\n}\nvec4 handleAlpha(vec3 color, float alpha)\n{\n#ifdef ALPHA_MODE_MASK\nif (alpha < u_alphaCutoff) {\ndiscard;\n}\nreturn vec4(color, 1.0);\n#elif defined(ALPHA_MODE_BLEND)\nreturn vec4(color, alpha);\n#else // OPAQUE\nreturn vec4(color, 1.0);\n#endif\n}\nFeature feature;\nvoid main()\n{\nczm_modelMaterial material = defaultModelMaterial();\nProcessedAttributes attributes;\ngeometryStage(attributes);\n#ifdef HAS_FEATURES\nfeatureStage(feature);\n#endif\n#ifndef CUSTOM_SHADER_REPLACE_MATERIAL\nmaterialStage(material, attributes, feature);\n#endif\n#ifdef HAS_CUSTOM_FRAGMENT_SHADER\ncustomShaderStage(material, attributes);\n#endif\nlightingStage(material);\n#ifdef HAS_FEATURES\ncpuStylingStage(material, feature);\n#endif\n#ifdef HAS_MODEL_COLOR\nmodelColorStage(material);\n#endif\nvec4 color = handleAlpha(material.diffuse, material.alpha);\ngl_FragColor = color;\n}\n",ModelExperimentalVS="precision highp float;\nczm_modelVertexOutput defaultVertexOutput(vec3 positionMC) {\nczm_modelVertexOutput vsOutput;\nvsOutput.positionMC = positionMC;\nvsOutput.pointSize = 1.0;\nreturn vsOutput;\n}\nvoid main()\n{\nProcessedAttributes attributes;\ninitializeAttributes(attributes);\n#ifdef USE_DEQUANTIZATION\ndequantizationStage(attributes);\n#endif\n#ifdef HAS_INSTANCING\ninstancingStage(attributes.positionMC);\n#ifdef USE_PICKING\nv_pickColor = a_pickColor;\n#endif\n#endif\n#if defined(HAS_FEATURES) && defined(FEATURE_ID_ATTRIBUTE)\nFeature feature;\nfeatureStage(feature);\ncpuStylingStage(attributes.positionMC, feature);\nupdateFeatureStruct(feature);\n#endif\n#ifdef HAS_CUSTOM_VERTEX_SHADER\nczm_modelVertexOutput vsOutput = defaultVertexOutput(attributes.positionMC);\ncustomShaderStage(vsOutput, attributes);\n#endif\ngeometryStage(attributes);\n#ifdef PRIMITIVE_TYPE_POINTS\n#ifdef HAS_CUSTOM_VERTEX_SHADER\ngl_PointSize = vsOutput.pointSize;\n#else\ngl_PointSize = 1.0;\n#endif\n#endif\n}\n",StyleCommandsNeeded={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2,getStyleCommandsNeeded:function(e,t){return 0===t?StyleCommandsNeeded.ALL_OPAQUE:t===e?StyleCommandsNeeded.ALL_TRANSLUCENT:StyleCommandsNeeded.OPAQUE_AND_TRANSLUCENT}},StyleCommandsNeeded$1=Object.freeze(StyleCommandsNeeded);function buildDrawCommands(e,t){var i=e.shaderBuilder;i.addVertexLines([ModelExperimentalVS]),i.addFragmentLines([ModelExperimentalFS]);var r=defined(e.indices)?e.indices.buffer:void 0,n=new VertexArray({context:t.context,indexBuffer:r,attributes:e.attributes}),a=e.model;a._resources.push(n);var o=RenderState.fromCache(e.renderStateOptions),s=i.buildShaderProgram(t.context);a._resources.push(s);var l=e.alphaOptions.pass,c=new DrawCommand({boundingVolume:e.boundingSphere,modelMatrix:e.modelMatrix,uniformMap:e.uniformMap,renderState:o,vertexArray:n,shaderProgram:s,cull:a.cull,pass:l,count:e.count,pickId:e.pickId,instanceCount:e.instanceCount,primitiveType:e.primitiveType,debugShowBoundingVolume:a.debugShowBoundingVolume}),u=e.styleCommandsNeeded,d=[];if(defined(u)){var h=createDerivedCommands(c);if(l!==Pass$1.TRANSLUCENT)switch(u){case StyleCommandsNeeded$1.ALL_OPAQUE:d.push(c);break;case StyleCommandsNeeded$1.ALL_TRANSLUCENT:d.push(h.translucent);break;case StyleCommandsNeeded$1.OPAQUE_AND_TRANSLUCENT:d.push(c,h.translucent)}else d.push(c)}else d.push(c);return d}function createDerivedCommands(e){var t={};return t.translucent=deriveTranslucentCommand(e),t}function deriveTranslucentCommand(e){var t=DrawCommand.shallowClone(e);t.pass=Pass$1.TRANSLUCENT;var i=clone$1(e.renderState,!0);return i.cull.enabled=!1,i.depthTest.enabled=!0,i.depthMask=!1,i.blending=BlendingState$1.ALPHA_BLEND,t.renderState=RenderState.fromCache(i),t}var ShaderDestination={VERTEX:0,FRAGMENT:1,BOTH:2,includesVertexShader:function(e){return e===ShaderDestination.VERTEX||e===ShaderDestination.BOTH},includesFragmentShader:function(e){return e===ShaderDestination.FRAGMENT||e===ShaderDestination.BOTH}},ShaderDestination$1=Object.freeze(ShaderDestination),CustomShaderStageVS="void customShaderStage(inout czm_modelVertexOutput vsOutput, inout ProcessedAttributes attributes)\n{\nVertexInput vsInput;\ninitializeInputStruct(vsInput, attributes);\nvertexMain(vsInput, vsOutput);\nattributes.positionMC = vsOutput.positionMC;\n}\n",CustomShaderStageFS="void customShaderStage(inout czm_modelMaterial material, ProcessedAttributes attributes)\n{\nFragmentInput fsInput;\ninitializeInputStruct(fsInput, attributes);\nfragmentMain(fsInput, material);\n}\n",CustomShaderMode={MODIFY_MATERIAL:"MODIFY_MATERIAL",REPLACE_MATERIAL:"REPLACE_MATERIAL",getDefineName:function(e){return"CUSTOM_SHADER_"+e}},CustomShaderMode$1=Object.freeze(CustomShaderMode),CustomShaderPipelineStage={};function getAttributesByName(e){for(var t={},i=0;i<e.length;i++){var r=e[i],n=ModelExperimentalUtility.getAttributeInfo(r);t[n.variableName]=n}return t}CustomShaderPipelineStage.name="CustomShaderPipelineStage",CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_VS="AttributesVS",CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_FS="AttributesFS",CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES="Attributes",CustomShaderPipelineStage.STRUCT_ID_VERTEX_INPUT="VertexInput",CustomShaderPipelineStage.STRUCT_NAME_VERTEX_INPUT="VertexInput",CustomShaderPipelineStage.STRUCT_ID_FRAGMENT_INPUT="FragmentInput",CustomShaderPipelineStage.STRUCT_NAME_FRAGMENT_INPUT="FragmentInput",CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS="initializeInputStructVS",CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS="void initializeInputStruct(out VertexInput vsInput, ProcessedAttributes attributes)",CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS="initializeInputStructFS",CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS="void initializeInputStruct(out FragmentInput fsInput, ProcessedAttributes attributes)",CustomShaderPipelineStage.process=function(e,t,i){var r=e.shaderBuilder,n=e.model.customShader,a=generateShaderLines(n,t);if(a.customShaderEnabled){if(addLinesToShader(r,n,a),a.shouldComputePositionWC&&r.addDefine("COMPUTE_POSITION_WC",void 0,ShaderDestination$1.BOTH),defined(n.vertexShaderText)&&r.addDefine("HAS_CUSTOM_VERTEX_SHADER",void 0,ShaderDestination$1.VERTEX),defined(n.fragmentShaderText)){r.addDefine("HAS_CUSTOM_FRAGMENT_SHADER",void 0,ShaderDestination$1.FRAGMENT);var o=CustomShaderMode$1.getDefineName(n.mode);r.addDefine(o,void 0,ShaderDestination$1.FRAGMENT)}var s=n.uniforms;for(var l in s)if(s.hasOwnProperty(l)){var c=s[l];r.addUniform(c.type,l)}var u=n.varyings;for(var d in u)if(u.hasOwnProperty(d)){var h=u[d];r.addVarying(h,d)}defined(n.lightingModel)&&(e.lightingOptions.lightingModel=n.lightingModel);var p=e.alphaOptions;n.isTranslucent?(p.pass=Pass$1.TRANSLUCENT,p.alphaMode=AlphaMode$1.BLEND):(p.pass=void 0,p.alphaMode=AlphaMode$1.OPAQUE),e.uniformMap=combine$2(e.uniformMap,n.uniformMap)}};var attributeTypeLUT={position:"vec3",normal:"vec3",tangent:"vec3",bitangent:"vec3",texCoord:"vec2",color:"vec4",joints:"ivec4",weights:"vec4"},attributeDefaultValueLUT={position:"vec3(0.0)",normal:"vec3(0.0, 0.0, 1.0)",tangent:"vec3(1.0, 0.0, 0.0)",bitangent:"vec3(0.0, 1.0, 0.0)",texCoord:"vec2(0.0)",color:"vec4(1.0)",joints:"ivec4(0)",weights:"vec4(0.0)"};function inferAttributeDefaults(e){var t=e.replace(/_[0-9]+$/,"");t=t.replace(/(MC|EC)$/,"");var i=attributeTypeLUT[t],r=attributeDefaultValueLUT[t];if(defined(i))return{attributeField:[i,e],value:r}}function generateVertexShaderLines(e,t,i){var r,n,a=partitionAttributes(t,e.usedVariablesVertex.attributeSet,!1),o=a.addToShader,s=a.missingAttributes,l=[],c=[];for(r in o)if(o.hasOwnProperty(r)){var u=[o[r].glslType,r];l.push(u),n="vsInput.attributes."+r+" = attributes."+r+";",c.push(n)}for(var d=0;d<s.length;d++){var h=inferAttributeDefaults(r=s[d]);if(!defined(h))return void CustomShaderPipelineStage._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveVS","Primitive is missing attribute "+r+", disabling custom vertex shader");l.push(h.attributeField),n="vsInput.attributes."+r+" = "+h.value+";",c.push(n)}i.enabled=!0,i.attributeFields=l,i.initializationLines=c}function generatePositionBuiltins(e){var t=[],i=[],r=e.usedVariablesFragment.attributeSet;return r.hasOwnProperty("positionWC")&&(t.push(["vec3","positionWC"]),i.push("fsInput.attributes.positionWC = attributes.positionWC;")),r.hasOwnProperty("positionEC")&&(t.push(["vec3","positionEC"]),i.push("fsInput.attributes.positionEC = attributes.positionEC;")),{attributeFields:t,initializationLines:i}}function generateFragmentShaderLines(e,t,i){var r,n,a=partitionAttributes(t,e.usedVariablesFragment.attributeSet,!0),o=a.addToShader,s=a.missingAttributes,l=[],c=[];for(r in o)if(o.hasOwnProperty(r)){var u=[o[r].glslType,r];l.push(u),n="fsInput.attributes."+r+" = attributes."+r+";",c.push(n)}for(var d=0;d<s.length;d++){var h=inferAttributeDefaults(r=s[d]);if(!defined(h))return void CustomShaderPipelineStage._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveFS","Primitive is missing attribute "+r+", disabling custom fragment shader.");l.push(h.attributeField),n="fsInput.attributes."+r+" = "+h.value+";",c.push(n)}var p=generatePositionBuiltins(e);i.enabled=!0,i.attributeFields=l.concat(p.attributeFields),i.initializationLines=p.initializationLines.concat(c)}var builtinAttributes={positionWC:!0,positionEC:!0};function partitionAttributes(e,t,i){var r,n,a={};for(n in e)if(e.hasOwnProperty(n)){var o=e[n];r=n,i&&"normalMC"===n?r="normalEC":i&&"tangentMC"===n&&(r="tangentEC"),t.hasOwnProperty(r)&&(a[r]=o)}var s=[];for(n in t)if(t.hasOwnProperty(n)){if(builtinAttributes.hasOwnProperty(n))continue;r=n,i&&"normalEC"===n?r="normalMC":i&&"tangentEC"===n&&(r="tangentMC"),e.hasOwnProperty(r)||s.push(n)}return{addToShader:a,missingAttributes:s}}function generateShaderLines(e,t){var i={enabled:!1},r={enabled:!1},n=getAttributesByName(t.attributes);defined(e.vertexShaderText)&&generateVertexShaderLines(e,n,i),defined(e.fragmentShaderText)&&generateFragmentShaderLines(e,n,r);var a=e.usedVariablesFragment.attributeSet.hasOwnProperty("positionWC")&&r.enabled;return{vertexLines:i,fragmentLines:r,vertexLinesEnabled:i.enabled,fragmentLinesEnabled:r.enabled,customShaderEnabled:i.enabled||r.enabled,shouldComputePositionWC:a}}function addVertexLinesToShader(e,t){var i,r=CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_VS;e.addStruct(r,CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,ShaderDestination$1.VERTEX);var n=t.attributeFields;for(i=0;i<n.length;i++){var a=n[i],o=a[0],s=a[1];e.addStructField(r,o,s)}r=CustomShaderPipelineStage.STRUCT_ID_VERTEX_INPUT,e.addStruct(r,CustomShaderPipelineStage.STRUCT_NAME_VERTEX_INPUT,ShaderDestination$1.VERTEX),e.addStructField(r,CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,"attributes");var l=CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS;e.addFunction(l,CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS,ShaderDestination$1.VERTEX);var c=t.initializationLines;e.addFunctionLines(l,c)}function addFragmentLinesToShader(e,t){var i,r,n,a,o=CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_FS;e.addStruct(o,CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,ShaderDestination$1.FRAGMENT);var s=t.attributeFields;for(i=0;i<s.length;i++)n=(r=s[i])[0],a=r[1],e.addStructField(o,n,a);o=CustomShaderPipelineStage.STRUCT_ID_FRAGMENT_INPUT,e.addStruct(o,CustomShaderPipelineStage.STRUCT_NAME_FRAGMENT_INPUT,ShaderDestination$1.FRAGMENT),e.addStructField(o,CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,"attributes");var l=CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS;e.addFunction(l,CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS,ShaderDestination$1.FRAGMENT);var c=t.initializationLines;e.addFunctionLines(l,c)}function addLinesToShader(e,t,i){var r=i.vertexLines;r.enabled&&(addVertexLinesToShader(e,r),e.addVertexLines(["#line 0",t.vertexShaderText,CustomShaderStageVS]));var n=i.fragmentLines;n.enabled&&(addFragmentLinesToShader(e,n),e.addFragmentLines(["#line 0",t.fragmentShaderText,CustomShaderStageFS]))}CustomShaderPipelineStage._oneTimeWarning=oneTimeWarning;var LightingStageFS="vec3 LINEARtoSRGB(vec3 linearIn)\n{\n#ifndef HDR\nreturn pow(linearIn, vec3(1.0/2.2));\n#else\nreturn linearIn;\n#endif\n}\n#ifdef LIGHTING_PBR\nvec3 applyTonemapping(vec3 linearIn)\n{\n#ifndef HDR\nreturn czm_acesTonemapping(linearIn);\n#else\nreturn linearIn;\n#endif\n}\nvec3 computePbrLighting(czm_modelMaterial inputMaterial)\n{\nczm_pbrParameters pbrParameters;\npbrParameters.diffuseColor = inputMaterial.diffuse;\npbrParameters.f0 = inputMaterial.specular;\npbrParameters.roughness = inputMaterial.roughness;\nvec3 lightColorHdr = czm_lightColorHdr;\nvec3 color = inputMaterial.diffuse;\n#ifdef HAS_NORMALS\ncolor = czm_pbrLighting(\nv_positionEC,\ninputMaterial.normalEC,\nczm_lightDirectionEC,\nlightColorHdr,\npbrParameters\n);\n#endif\ncolor *= inputMaterial.occlusion;\ncolor += inputMaterial.emissive;\ncolor = applyTonemapping(color);\nreturn color;\n}\n#endif\nvoid lightingStage(inout czm_modelMaterial material)\n{\nvec3 color = vec3(0.0);\n#ifdef LIGHTING_PBR\ncolor = computePbrLighting(material);\n#else // unlit\ncolor = material.diffuse;\n#endif\ncolor = LINEARtoSRGB(color);\nmaterial.diffuse = color;\n}\n",LightingModel={UNLIT:0,PBR:1},LightingModel$1=Object.freeze(LightingModel),LightingPipelineStage={name:"LightingPipelineStage",process:function(e,t){var i=e.lightingOptions,r=e.shaderBuilder;i.lightingModel===LightingModel$1.PBR?r.addDefine("LIGHTING_PBR",void 0,ShaderDestination$1.FRAGMENT):r.addDefine("LIGHTING_UNLIT",void 0,ShaderDestination$1.FRAGMENT),r.addFragmentLines([LightingStageFS])}},ModelColorStageFS="void modelColorStage(inout czm_modelMaterial material)\n{\nmaterial.diffuse = mix(material.diffuse, model_color.rgb, model_colorBlend);\nfloat highlight = ceil(model_colorBlend);\nmaterial.diffuse *= mix(model_color.rgb, vec3(1.0), highlight);\nmaterial.alpha *= model_color.a;\n}\n",ModelColorPipelineStage={COLOR_UNIFORM_NAME:"model_color",COLOR_BLEND_UNIFORM_NAME:"model_colorBlend",process:function(e,t,i){var r=e.shaderBuilder;r.addDefine("HAS_MODEL_COLOR",void 0,ShaderDestination$1.FRAGMENT),r.addFragmentLines([ModelColorStageFS]);var n={},a=t.color;a.alpha>0&&a.alpha<1&&(e.alphaOptions.pass=Pass$1.TRANSLUCENT,e.alphaOptions.alphaMode=AlphaMode$1.BLEND),r.addUniform("vec4",ModelColorPipelineStage.COLOR_UNIFORM_NAME,ShaderDestination$1.FRAGMENT),n[ModelColorPipelineStage.COLOR_UNIFORM_NAME]=function(){return t.color},r.addUniform("float",ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME,ShaderDestination$1.FRAGMENT),n[ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME]=function(){return ColorBlendMode$1.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=combine$2(n,e.uniformMap)}},AlphaPipelineStage={name:"AlphaPipelineStage",process:function(e,t,i){var r=e.alphaOptions,n=e.model;r.pass=defaultValue(r.pass,n.opaquePass);var a=e.renderStateOptions;r.pass===Pass$1.TRANSLUCENT?a.blending=BlendingState$1.ALPHA_BLEND:a.blending=BlendingState$1.DISABLED;var o=e.shaderBuilder,s=e.uniformMap,l=r.alphaMode;l===AlphaMode$1.MASK?(o.addDefine("ALPHA_MODE_MASK",void 0,ShaderDestination$1.FRAGMENT),o.addUniform("float","u_alphaCutoff",ShaderDestination$1.FRAGMENT),s.u_alphaCutoff=function(){return r.alphaCutoff}):l===AlphaMode$1.BLEND?o.addDefine("ALPHA_MODE_BLEND",void 0,ShaderDestination$1.FRAGMENT):o.addDefine("ALPHA_MODE_OPAQUE",void 0,ShaderDestination$1.FRAGMENT)}},BatchTexturePipelineStage={name:"BatchTexturePipelineStage",process:function(e,t,i){var r=e.shaderBuilder,n={},a=e.model,o=a.featureTables[a.featureTableId],s=o.featuresLength;r.addUniform("float","model_featuresLength"),n.model_featuresLength=function(){return s};var l=o.batchTexture;r.addUniform("sampler2D","model_batchTexture"),n.model_batchTexture=function(){return defaultValue(l.batchTexture,l.defaultTexture)},r.addUniform("vec4","model_textureStep"),n.model_textureStep=function(){return l.textureStep},l.textureDimensions.y>1&&(r.addDefine("MULTILINE_BATCH_TEXTURE"),r.addUniform("vec2","model_textureDimensions"),n.model_textureDimensions=function(){return l.textureDimensions}),e.uniformMap=combine$2(n,e.uniformMap)}},FeatureStageCommon="vec2 computeSt(float featureId)\n{\nfloat stepX = model_textureStep.x;\nfloat centerX = model_textureStep.y;\n#ifdef MULTILINE_BATCH_TEXTURE\nfloat stepY = model_textureStep.z;\nfloat centerY = model_textureStep.w;\nfloat xId = mod(featureId, model_textureDimensions.x);\nfloat yId = floor(featureId / model_textureDimensions.x);\nreturn vec2(centerX + (xId * stepX), centerY + (yId * stepY));\n#else\nreturn vec2(centerX + (featureId * stepX), 0.5);\n#endif\n}\n",FeatureStageFS="void featureStage(inout Feature feature)\n{\n#ifdef FEATURE_ID_TEXTURE\nfloat featureId = floor(texture2D(FEATURE_ID_TEXTURE, FEATURE_ID_TEXCOORD).FEATURE_ID_CHANNEL * 255.0 + 0.5);\nvec2 featureSt;\nif (featureId < model_featuresLength)\n{\nfeatureSt = computeSt(featureId);\nfeature.id = int(featureId);\nfeature.st = featureSt;\nfeature.color = texture2D(model_batchTexture, featureSt);\n}\nelse\n{\nfeature.id = int(model_featuresLength) + 1;\nfeature.st = vec2(0.0);\nfeature.color = vec4(1.0);\n}\n#else\nupdateFeatureStruct(feature);\n#endif\n}\n",FeatureStageVS="void featureStage(inout Feature feature)\n{\nfloat featureId = FEATURE_ID_ATTRIBUTE;\nif (featureId < model_featuresLength)\n{\nvec2 featureSt = computeSt(featureId);\nfeature.id = int(featureId);\nfeature.st = featureSt;\nfeature.color = texture2D(model_batchTexture, featureSt);\n}\nelse\n{\nfeature.id = int(model_featuresLength) + 1;\nfeature.st = vec2(0.0);\nfeature.color = vec4(1.0);\n}\n}\n",FeatureIdPipelineStage={};function getFeatureIdAttributeInfo(e,t,i){var r,n,a,o=0;defined(i)?(n=i.featureIdAttributes[e],r=i.attributes[0].count,a="a_instanceFeatureId_",o=1):(n=t.featureIdAttributes[e],r=ModelExperimentalUtility.getAttributeBySemantic(t,VertexAttributeSemantic$1.POSITION).count,a="a_featureId_");return{count:r,attribute:n,prefix:a,instanceDivisor:o}}function updateFeatureStruct(e){e.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE,"int","id"),e.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE,"vec2","st"),e.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE,"vec4","color")}function generateFeatureFunctions(e){e.addFunction(FeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_VS,FeatureIdPipelineStage.FUNCTION_SIGNATURE_UPDATE_FEATURE,ShaderDestination$1.VERTEX),e.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_VS,["v_activeFeatureId = float(feature.id);","v_activeFeatureSt = feature.st;","v_activeFeatureColor = feature.color;"]),e.addFunction(FeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_FS,FeatureIdPipelineStage.FUNCTION_SIGNATURE_UPDATE_FEATURE,ShaderDestination$1.FRAGMENT),e.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_FS,["feature.id = int(v_activeFeatureId);","feature.st = v_activeFeatureSt;","feature.color = v_activeFeatureColor;"])}function processFeatureIdAttributes$1(e,t,i){var r,n=e.shaderBuilder,a=e.model,o=e.runtimeNode.node.instances,s=getFeatureIdAttributeInfo(a.featureIdAttributeIndex,i,o),l=s.attribute,c=s.prefix;defined(l.setIndex)?r=l.setIndex:generateFeatureIdAttribute(s,r=e.featureIdVertexAttributeSetIndex++,t,e),n.addDefine("FEATURE_ID_ATTRIBUTE",c+r,ShaderDestination$1.VERTEX),n.addVarying("float","v_activeFeatureId"),n.addVarying("vec2","v_activeFeatureSt"),n.addVarying("vec4","v_activeFeatureColor"),generateFeatureFunctions(n),n.addVertexLines([FeatureStageCommon,FeatureStageVS])}function processFeatureIdTextures(e,t,i){var r=e.shaderBuilder,n=e.uniformMap,a=e.model.featureIdTextureIndex,o=i[a].textureReader,s="u_featureIdTexture_"+a;r.addDefine("FEATURE_ID_TEXTURE",s,ShaderDestination$1.FRAGMENT),r.addUniform("sampler2D",s,ShaderDestination$1.FRAGMENT),n[s]=function(){return defaultValue(o.texture,t.context.defaultTexture)},r.addDefine("FEATURE_ID_TEXCOORD","v_texCoord_"+o.texCoord,ShaderDestination$1.FRAGMENT),r.addDefine("FEATURE_ID_CHANNEL",o.channels,ShaderDestination$1.FRAGMENT)}function generateFeatureIdAttribute(e,t,i,r){var n,a,o=r.model,s=r.shaderBuilder,l=e.attribute,c=e.prefix;if(defined(l.repeat)){var u=generateFeatureIdTypedArray(l,e.count);(a=Buffer$1.createVertexBuffer({context:i.context,typedArray:u,usage:BufferUsage$1.STATIC_DRAW})).vertexArrayDestroyable=!1,o._resources.push(a)}else n=l.offset;var d={index:r.attributeIndex++,instanceDivisor:e.instanceDivisor,value:n,vertexBuffer:a,normalize:!1,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.FLOAT,strideInBytes:ComponentDatatype$1.getSizeInBytes(ComponentDatatype$1.FLOAT),offsetInBytes:0};r.attributes.push(d),s.addAttribute("float",c+t)}function generateFeatureIdTypedArray(e,t){for(var i=e.offset,r=e.repeat,n=new Float32Array(t),a=0;a<t;a++)n[a]=i+Math.floor(a/r);return n}FeatureIdPipelineStage.name="FeatureIdPipelineStage",FeatureIdPipelineStage.STRUCT_ID_FEATURE="FeatureStruct",FeatureIdPipelineStage.STRUCT_NAME_FEATURE="Feature",FeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_VS="updateFeatureStructVS",FeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_FS="updateFeatureStructFS",FeatureIdPipelineStage.FUNCTION_SIGNATURE_UPDATE_FEATURE="void updateFeatureStruct(inout Feature feature)",FeatureIdPipelineStage.process=function(e,t,i){var r=e.shaderBuilder;e.hasFeatureIds=!0,r.addDefine("HAS_FEATURES",void 0,ShaderDestination$1.BOTH),updateFeatureStruct(r);var n=t.featureIdTextures;n.length>0?processFeatureIdTextures(e,i,n):processFeatureIdAttributes$1(e,i,t),r.addFragmentLines([FeatureStageCommon,FeatureStageFS])};var CPUStylingStageVS="void filterByPassType(inout vec3 positionMC, vec4 featureColor)\n{\nbool styleTranslucent = (featureColor.a != 1.0);\nif (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)\n{\npositionMC *= 0.0;\n}\nelse if (czm_pass != czm_passTranslucent && styleTranslucent)\n{\npositionMC *= 0.0;\n}\n}\nvoid cpuStylingStage(inout vec3 positionMC, inout Feature feature)\n{\nfloat show = ceil(feature.color.a);\npositionMC *= show;\nfilterByPassType(positionMC, feature.color);\n}\n",CPUStylingStageFS="void filterByPassType(vec4 featureColor)\n{\nbool styleTranslucent = (featureColor.a != 1.0);\nif (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)\n{\ndiscard;\n}\nelse if (czm_pass != czm_passTranslucent && styleTranslucent)\n{\ndiscard;\n}\n}\nvoid cpuStylingStage(inout czm_modelMaterial material, Feature feature)\n{\nvec4 featureColor = feature.color;\nif (featureColor.a == 0.0)\n{\ndiscard;\n}\n#ifdef FEATURE_ID_TEXTURE\nfilterByPassType(featureColor);\n#endif\nfeatureColor = czm_gammaCorrect(featureColor);\nfloat highlight = ceil(model_colorBlend);\nmaterial.diffuse *= mix(featureColor.rgb, vec3(1.0), highlight);\nmaterial.alpha *= featureColor.a;\n}\n",CPUStylingPipelineStage={name:"CPUStylingPipelineStage",process:function(e,t,i){var r=e.model,n=e.shaderBuilder;n.addVertexLines([CPUStylingStageVS]),n.addFragmentLines([CPUStylingStageFS]),n.addDefine("USE_CPU_STYLING",void 0,ShaderDestination$1.BOTH),defined(r.color)||(n.addUniform("float",ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME,ShaderDestination$1.FRAGMENT),e.uniformMap[ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME]=function(){return ColorBlendMode$1.getColorBlend(r.colorBlendMode,r.colorBlendAmount)});var a=e.alphaOptions.pass===Pass$1.TRANSLUCENT;n.addUniform("bool","model_commandTranslucent",ShaderDestination$1.BOTH),e.uniformMap.model_commandTranslucent=function(){return a};var o=r.featureTables[r.featureTableId],s=StyleCommandsNeeded$1.getStyleCommandsNeeded(o.featuresLength,o.batchTexture.translucentFeaturesLength);s!==StyleCommandsNeeded$1.ALL_OPAQUE&&(e.alphaOptions.alphaMode=AlphaMode$1.BLEND),e.styleCommandsNeeded=s}},DequantizationPipelineStage={};function addDequantizationUniforms(e,t){var i=e.shaderBuilder,r=e.uniformMap,n=t.variableName,a=t.attribute.quantization;if(a.octEncoded){var o="model_normalizationRange_"+n;i.addUniform("float",o,ShaderDestination$1.VERTEX),r[o]=function(){return a.normalizationRange}}else{var s="model_quantizedVolumeOffset_"+n,l="model_quantizedVolumeStepSize_"+n,c=t.glslType;i.addUniform(c,s,ShaderDestination$1.VERTEX),i.addUniform(c,l,ShaderDestination$1.VERTEX);var u=a.quantizedVolumeOffset,d=a.quantizedVolumeStepSize;/^color_\d+$/.test(n)&&(u=promoteToVec4(u,0),d=promoteToVec4(d,1)),r[s]=function(){return u},r[l]=function(){return d}}}function promoteToVec4(e,t){return e instanceof Cartesian4?e:new Cartesian4(e.x,e.y,e.z,t)}function updateDequantizationFunction(e,t){var i,r=t.variableName,n=t.attribute.quantization;i=n.octEncoded?generateOctDecodeLine(r,n):generateDequantizeLine(r),e.addFunctionLines(DequantizationPipelineStage.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,[i])}function generateOctDecodeLine(e,t){return"attributes."+e+" = czm_octDecode("+("a_quantized_"+e)+", "+("model_normalizationRange_"+e)+")"+(t.octEncodedZXY?".zxy":".xyz")+";"}function generateDequantizeLine(e){return"attributes."+e+" = "+("model_quantizedVolumeOffset_"+e)+" + "+("a_quantized_"+e)+" * "+("model_quantizedVolumeStepSize_"+e)+";"}DequantizationPipelineStage.name="DequantizationPipelineStage",DequantizationPipelineStage.FUNCTION_ID_DEQUANTIZATION_STAGE_VS="dequantizationStage",DequantizationPipelineStage.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS="void dequantizationStage(inout ProcessedAttributes attributes)",DequantizationPipelineStage.process=function(e,t){var i=e.shaderBuilder;i.addFunction(DequantizationPipelineStage.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,DequantizationPipelineStage.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS,ShaderDestination$1.VERTEX),i.addDefine("USE_DEQUANTIZATION",void 0,ShaderDestination$1.VERTEX);for(var r=t.attributes,n=0;n<r.length;n++){var a=r[n];if(defined(a.quantization)){var o=ModelExperimentalUtility.getAttributeInfo(a);updateDequantizationFunction(i,o),addDequantizationUniforms(e,o)}}};var GeometryStageFS="void geometryStage(out ProcessedAttributes attributes)\n{\nattributes.positionMC = v_positionMC;\nattributes.positionEC = v_positionEC;\n#ifdef COMPUTE_POSITION_WC\nattributes.positionWC = v_positionWC;\n#endif\n#ifdef HAS_NORMALS\nattributes.normalEC = normalize(v_normalEC);\n#endif\n#ifdef HAS_TANGENTS\nattributes.tangentEC = normalize(v_tangentEC);\n#endif\n#ifdef HAS_BITANGENTS\nattributes.bitangentEC = normalize(v_bitangentEC);\n#endif\nsetDynamicVaryings(attributes);\n}\n",GeometryStageVS="void geometryStage(inout ProcessedAttributes attributes)\n{\nvec3 positionMC = attributes.positionMC;\nv_positionMC = positionMC;\nv_positionEC = (czm_modelView * vec4(positionMC, 1.0)).xyz;\ngl_Position = czm_modelViewProjection * vec4(positionMC, 1.0);\n#ifdef COMPUTE_POSITION_WC\nv_positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;\n#endif\n#ifdef HAS_NORMALS\nv_normalEC = czm_normal * attributes.normalMC;\n#endif\n#ifdef HAS_TANGENTS\nv_tangentEC = normalize(czm_normal * attributes.tangentMC);\n#endif\n#ifdef HAS_BITANGENTS\nv_bitangentEC = normalize(czm_normal * attributes.bitangentMC);\n#endif\nsetDynamicVaryings(attributes);\n}\n",GeometryPipelineStage={};function processAttribute(e,t,i){var r=e.shaderBuilder,n=ModelExperimentalUtility.getAttributeInfo(t);addAttributeToRenderResources(e,t,i),addAttributeDeclaration(r,n),addVaryingDeclaration(r,n),defined(t.semantic)&&addSemanticDefine(r,t),updateAttributesStruct(r,n),updateInitialzeAttributesFunction(r,n),updateSetDynamicVaryingsFunction(r,n)}function addSemanticDefine(e,t){var i=t.semantic,r=t.setIndex;switch(i){case VertexAttributeSemantic$1.NORMAL:e.addDefine("HAS_NORMALS");break;case VertexAttributeSemantic$1.TANGENT:e.addDefine("HAS_TANGENTS");break;case VertexAttributeSemantic$1.FEATURE_ID:case VertexAttributeSemantic$1.TEXCOORD:case VertexAttributeSemantic$1.COLOR:e.addDefine("HAS_"+i+"_"+r)}}function addAttributeToRenderResources(e,t,i){var r,n,a=t.quantization;defined(a)?(r=a.type,n=a.componentDatatype):(r=t.type,n=t.componentDatatype);var o=t.semantic,s=t.setIndex;o===VertexAttributeSemantic$1.FEATURE_ID&&s>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=s+1);var l={index:i,value:defined(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:AttributeType$1.getNumberOfComponents(r),componentDatatype:n,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(l)}function addVaryingDeclaration(e,t){var i,r=t.variableName,n="v_"+r;"normalMC"===r?(n="v_normalEC",i=t.glslType):"tangentMC"===r?(i="vec3",n="v_tangentEC"):i=t.glslType,e.addVarying(i,n)}function addAttributeDeclaration(e,t){var i,r,n=t.attribute.semantic,a=t.variableName;t.isQuantized?(i="a_quantized_"+a,r=t.quantizedGlslType):(i="a_"+a,r=t.glslType),n===VertexAttributeSemantic$1.POSITION?e.setPositionAttribute(r,i):e.addAttribute(r,i)}function updateAttributesStruct(e,t){var i=GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,r=GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,n=t.variableName;"tangentMC"===n?(e.addStructField(i,"vec3","tangentMC"),e.addStructField(r,"vec3","tangentEC")):"normalMC"===n?(e.addStructField(i,"vec3","normalMC"),e.addStructField(r,"vec3","normalEC")):(e.addStructField(i,t.glslType,n),e.addStructField(r,t.glslType,n))}function updateInitialzeAttributesFunction(e,t){if(!t.isQuantized){var i,r=GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES,n=t.variableName;i="tangentMC"===n?"attributes.tangentMC = a_tangentMC.xyz;":"attributes."+n+" = a_"+n+";",e.addFunctionLines(r,[i])}}function updateSetDynamicVaryingsFunction(e,t){var i=t.attribute.semantic,r=t.attribute.setIndex;if(!defined(i)||defined(r)){var n=GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,a=t.variableName,o="v_"+a+" = attributes."+a+";";e.addFunctionLines(n,[o]),n=GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,o="attributes."+a+" = v_"+a+";",e.addFunctionLines(n,[o])}}function handleBitangents(e,t){for(var i=!1,r=!1,n=0;n<t.length;n++){var a=t[n];a.semantic===VertexAttributeSemantic$1.NORMAL?i=!0:a.semantic===VertexAttributeSemantic$1.TANGENT&&(r=!0)}i&&r&&(e.addDefine("HAS_BITANGENTS"),e.addFunctionLines(GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES,["attributes.bitangentMC = normalize(cross(a_normalMC, a_tangentMC.xyz) * a_tangentMC.w);"]),e.addVarying("vec3","v_bitangentEC"),e.addStructField(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"vec3","bitangentMC"),e.addStructField(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","bitangentEC"))}GeometryPipelineStage.name="GeometryPipelineStage",GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS="ProcessedAttributesVS",GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS="ProcessedAttributesFS",GeometryPipelineStage.STRUCT_NAME_PROCESSED_ATTRIBUTES="ProcessedAttributes",GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES="initializeAttributes",GeometryPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES="void initializeAttributes(out ProcessedAttributes attributes)",GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS="setDynamicVaryingsVS",GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS="setDynamicVaryingsFS",GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS="void setDynamicVaryings(inout ProcessedAttributes attributes)",GeometryPipelineStage.process=function(e,t){var i,r=e.shaderBuilder;r.addStruct(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",ShaderDestination$1.VERTEX),r.addStruct(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",ShaderDestination$1.FRAGMENT),r.addStruct(FeatureIdPipelineStage.STRUCT_ID_FEATURE,FeatureIdPipelineStage.STRUCT_NAME_FEATURE,ShaderDestination$1.BOTH),r.addFunction(GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES,GeometryPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,ShaderDestination$1.VERTEX),r.addVarying("vec3","v_positionWC"),r.addVarying("vec3","v_positionEC"),r.addStructField(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),r.addStructField(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),r.addFunction(GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,ShaderDestination$1.VERTEX),r.addFunction(GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,ShaderDestination$1.FRAGMENT);for(var n=0;n<t.attributes.length;n++){var a=t.attributes[n];i=a.semantic===VertexAttributeSemantic$1.POSITION?0:e.attributeIndex++,processAttribute(e,a,i)}handleBitangents(r,t.attributes),t.primitiveType===PrimitiveType$1.POINTS&&r.addDefine("PRIMITIVE_TYPE_POINTS"),r.addVertexLines([GeometryStageVS]),r.addFragmentLines([GeometryStageFS])};var MaterialStageFS="bool isDefaultStyleColor(vec3 color)\n{\nreturn all(greaterThan(color, vec3(1.0 - czm_epsilon3)));\n}\nvec3 blend(vec3 sourceColor, vec3 styleColor, float styleColorBlend)\n{\nvec3 blendColor = mix(sourceColor, styleColor, styleColorBlend);\nvec3 color = isDefaultStyleColor(styleColor.rgb) ? sourceColor : blendColor;\nreturn color;\n}\nvec3 SRGBtoLINEAR3(vec3 srgbIn)\n{\nreturn pow(srgbIn, vec3(2.2));\n}\nvec4 SRGBtoLINEAR4(vec4 srgbIn)\n{\nvec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\nreturn vec4(linearOut, srgbIn.a);\n}\nvec2 computeTextureTransform(vec2 texCoord, mat3 textureTransform)\n{\nreturn vec2(textureTransform * vec3(texCoord, 1.0));\n}\n#ifdef HAS_NORMALS\nvec3 computeNormal(ProcessedAttributes attributes)\n{\nvec3 ng = attributes.normalEC;\nvec3 normal = ng;\n#ifdef HAS_NORMAL_TEXTURE\nvec2 normalTexCoords = TEXCOORD_NORMAL;\n#ifdef HAS_NORMAL_TEXTURE_TRANSFORM\nnormalTexCoords = computeTextureTransform(normalTexCoords, u_normalTextureTransform);\n#endif\n#ifdef HAS_BITANGENTS\nvec3 t = attributes.tangentEC;\nvec3 b = attributes.bitangentEC;\nmat3 tbn = mat3(t, b, ng);\nvec3 n = texture2D(u_normalTexture, normalTexCoords).rgb;\nnormal = normalize(tbn * (2.0 * n - 1.0));\n#elif defined(GL_OES_standard_derivatives)\nvec3 positionEC = attributes.positionEC;\nvec3 pos_dx = dFdx(positionEC);\nvec3 pos_dy = dFdy(positionEC);\nvec3 tex_dx = dFdx(vec3(normalTexCoords,0.0));\nvec3 tex_dy = dFdy(vec3(normalTexCoords,0.0));\nvec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\nt = normalize(t - ng * dot(ng, t));\nvec3 b = normalize(cross(ng, t));\nmat3 tbn = mat3(t, b, ng);\nvec3 n = texture2D(u_normalTexture, normalTexCoords).rgb;\nnormal = normalize(tbn * (2.0 * n - 1.0));\n#endif\n#endif\nreturn normal;\n}\n#endif\nvoid materialStage(inout czm_modelMaterial material, ProcessedAttributes attributes, Feature feature)\n{\n#ifdef HAS_NORMALS\nmaterial.normalEC = computeNormal(attributes);\n#endif\nvec4 baseColorWithAlpha = vec4(1.0);\n#ifdef HAS_BASE_COLOR_TEXTURE\nvec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;\n#ifdef HAS_BASE_COLOR_TEXTURE_TRANSFORM\nbaseColorTexCoords = computeTextureTransform(baseColorTexCoords, u_baseColorTextureTransform);\n#endif\nbaseColorWithAlpha = SRGBtoLINEAR4(texture2D(u_baseColorTexture, baseColorTexCoords));\n#ifdef HAS_BASE_COLOR_FACTOR\nbaseColorWithAlpha *= u_baseColorFactor;\n#endif\n#elif defined(HAS_BASE_COLOR_FACTOR)\nbaseColorWithAlpha = u_baseColorFactor;\n#endif\n#ifdef HAS_COLOR_0\nbaseColorWithAlpha *= attributes.color_0;\n#endif\nmaterial.diffuse = baseColorWithAlpha.rgb;\nmaterial.alpha = baseColorWithAlpha.a;\n#ifdef USE_CPU_STYLING\nmaterial.diffuse = blend(material.diffuse, feature.color.rgb, model_colorBlend);\n#endif\n#ifdef HAS_OCCLUSION_TEXTURE\nvec2 occlusionTexCoords = TEXCOORD_OCCLUSION;\n#ifdef HAS_OCCLUSION_TEXTURE_TRANSFORM\nocclusionTexCoords = computeTextureTransform(occlusionTexCoords, u_occlusionTextureTransform);\n#endif\nmaterial.occlusion = texture2D(u_occlusionTexture, occlusionTexCoords).r;\n#endif\n#ifdef HAS_EMISSIVE_TEXTURE\nvec2 emissiveTexCoords = TEXCOORD_EMISSIVE;\n#ifdef HAS_EMISSIVE_TEXTURE_TRANSFORM\nemissiveTexCoords = computeTextureTransform(emissiveTexCoords, u_emissiveTextureTransform);\n#endif\nvec3 emissive = SRGBtoLINEAR3(texture2D(u_emissiveTexture, emissiveTexCoords).rgb);\n#ifdef HAS_EMISSIVE_FACTOR\nemissive *= u_emissiveFactor;\n#endif\nmaterial.emissive = emissive;\n#elif defined(HAS_EMISSIVE_FACTOR)\nmaterial.emissive = u_emissiveFactor;\n#endif\n#if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)\n#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE\nvec2 specularGlossinessTexCoords = TEXCOORD_SPECULAR_GLOSSINESS;\n#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE_TRANSFORM\nspecularGlossinessTexCoords = computeTextureTransform(specularGlossinessTexCoords, u_specularGlossinessTextureTransform);\n#endif\nvec4 specularGlossiness = SRGBtoLINEAR4(texture2D(u_specularGlossinessTexture, specularGlossinessTexCoords));\nvec3 specular = specularGlossiness.rgb;\nfloat glossiness = specularGlossiness.a;\n#ifdef HAS_SPECULAR_FACTOR\nspecular *= u_specularFactor;\n#endif\n#ifdef HAS_GLOSSINESS_FACTOR\nglossiness *= u_glossinessFactor;\n#endif\n#else\n#ifdef HAS_SPECULAR_FACTOR\nvec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));\n#else\nvec3 specular = vec3(1.0);\n#endif\n#ifdef HAS_GLOSSINESS_FACTOR\nfloat glossiness = clamp(u_glossinessFactor, 0.0, 1.0);\n#else\nfloat glossiness = 1.0;\n#endif\n#endif\n#ifdef HAS_DIFFUSE_TEXTURE\nvec2 diffuseTexCoords = TEXCOORD_DIFFUSE;\n#ifdef HAS_DIFFUSE_TEXTURE_TRANSFORM\ndiffuseTexCoords = computeTextureTransform(diffuseTexCoords, u_diffuseTextureTransform);\n#endif\nvec4 diffuse = SRGBtoLINEAR4(texture2D(u_diffuseTexture, diffuseTexCoords));\n#ifdef HAS_DIFFUSE_FACTOR\ndiffuse *= u_diffuseFactor;\n#endif\n#elif defined(HAS_DIFFUSE_FACTOR)\nvec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));\n#else\nvec4 diffuse = vec4(1.0);\n#endif\nczm_pbrParameters parameters = czm_pbrSpecularGlossinessMaterial(\ndiffuse.rgb,\nspecular,\nglossiness\n);\nmaterial.diffuse = parameters.diffuseColor;\nmaterial.alpha = diffuse.a;\nmaterial.specular = parameters.f0;\nmaterial.roughness = parameters.roughness;\n#elif defined(LIGHTING_PBR)\n#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE\nvec2 metallicRoughnessTexCoords = TEXCOORD_METALLIC_ROUGHNESS;\n#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE_TRANSFORM\nmetallicRoughnessTexCoords = computeTextureTransform(metallicRoughnessTexCoords, u_metallicRoughnessTextureTransform);\n#endif\nvec3 metallicRoughness = texture2D(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;\nfloat metalness = clamp(metallicRoughness.b, 0.0, 1.0);\nfloat roughness = clamp(metallicRoughness.g, 0.04, 1.0);\n#ifdef HAS_METALLIC_FACTOR\nmetalness *= u_metallicFactor;\n#endif\n#ifdef HAS_ROUGHNESS_FACTOR\nroughness *= u_roughnessFactor;\n#endif\n#else\n#ifdef HAS_METALLIC_FACTOR\nfloat metalness = clamp(u_metallicFactor, 0.0, 1.0);\n#else\nfloat metalness = 1.0;\n#endif\n#ifdef HAS_ROUGHNESS_FACTOR\nfloat roughness = clamp(u_roughnessFactor, 0.04, 1.0);\n#else\nfloat roughness = 1.0;\n#endif\n#endif\nczm_pbrParameters parameters = czm_pbrMetallicRoughnessMaterial(\nmaterial.diffuse,\nmetalness,\nroughness\n);\nmaterial.diffuse = parameters.diffuseColor;\nmaterial.specular = parameters.f0;\nmaterial.roughness = parameters.roughness;\n#endif\n}\n",Material=ModelComponents.Material,MetallicRoughness=ModelComponents.MetallicRoughness,SpecularGlossiness=ModelComponents.SpecularGlossiness,MaterialPipelineStage={};function processTextureTransform(e,t,i,r,n){var a="HAS_"+n+"_TEXTURE_TRANSFORM";e.addDefine(a,void 0,ShaderDestination$1.FRAGMENT);var o=r+"Transform";e.addUniform("mat3",o,ShaderDestination$1.FRAGMENT),t[o]=function(){return i.transform}}function processTexture(e,t,i,r,n,a){e.addUniform("sampler2D",r,ShaderDestination$1.FRAGMENT),t[r]=function(){return defaultValue(i.texture,a)};var o="HAS_"+n+"_TEXTURE";e.addDefine(o,void 0,ShaderDestination$1.FRAGMENT);var s="v_texCoord_"+i.texCoord,l="TEXCOORD_"+n;e.addDefine(l,s,ShaderDestination$1.FRAGMENT);var c=i.transform;defined(c)&&!Matrix3.equals(c,Matrix3.IDENTITY)&&processTextureTransform(e,t,i,r,n)}function processMaterialUniforms(e,t,i,r,n,a){var o=e.emissiveTexture;defined(o)&&processTexture(i,t,o,"u_emissiveTexture","EMISSIVE",a);var s=e.emissiveFactor;defined(s)&&!Cartesian3.equals(s,Material.DEFAULT_EMISSIVE_FACTOR)&&(i.addUniform("vec3","u_emissiveFactor",ShaderDestination$1.FRAGMENT),t.u_emissiveFactor=function(){return e.emissiveFactor},i.addDefine("HAS_EMISSIVE_FACTOR",void 0,ShaderDestination$1.FRAGMENT));var l=e.normalTexture;defined(l)&&processTexture(i,t,l,"u_normalTexture","NORMAL",n);var c=e.occlusionTexture;defined(c)&&processTexture(i,t,c,"u_occlusionTexture","OCCLUSION",r)}function processSpecularGlossinessUniforms(e,t,i,r){var n=e.specularGlossiness;i.addDefine("USE_SPECULAR_GLOSSINESS",void 0,ShaderDestination$1.FRAGMENT);var a=n.diffuseTexture;defined(a)&&processTexture(i,t,a,"u_diffuseTexture","DIFFUSE",r);var o=n.diffuseFactor;defined(o)&&!Cartesian4.equals(o,SpecularGlossiness.DEFAULT_DIFFUSE_FACTOR)&&(i.addUniform("vec4","u_diffuseFactor",ShaderDestination$1.FRAGMENT),t.u_diffuseFactor=function(){return n.diffuseFactor},i.addDefine("HAS_DIFFUSE_FACTOR",void 0,ShaderDestination$1.FRAGMENT));var s=n.specularGlossinessTexture;defined(s)&&processTexture(i,t,s,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",r);var l=n.specularFactor;defined(l)&&!Cartesian3.equals(l,SpecularGlossiness.DEFAULT_SPECULAR_FACTOR)&&(i.addUniform("vec3","u_specularFactor",ShaderDestination$1.FRAGMENT),t.u_specularFactor=function(){return n.specularFactor},i.addDefine("HAS_SPECULAR_FACTOR",void 0,ShaderDestination$1.FRAGMENT));var c=n.glossinessFactor;defined(c)&&c!==SpecularGlossiness.DEFAULT_GLOSSINESS_FACTOR&&(i.addUniform("float","u_glossinessFactor",ShaderDestination$1.FRAGMENT),t.u_glossinessFactor=function(){return n.glossinessFactor},i.addDefine("HAS_GLOSSINESS_FACTOR",void 0,ShaderDestination$1.FRAGMENT))}function processMetallicRoughnessUniforms(e,t,i,r){var n=e.metallicRoughness;i.addDefine("USE_METALLIC_ROUGHNESS",void 0,ShaderDestination$1.FRAGMENT);var a=n.baseColorTexture;defined(a)&&processTexture(i,t,a,"u_baseColorTexture","BASE_COLOR",r);var o=n.baseColorFactor;defined(o)&&!Cartesian4.equals(o,MetallicRoughness.DEFAULT_BASE_COLOR_FACTOR)&&(i.addUniform("vec4","u_baseColorFactor",ShaderDestination$1.FRAGMENT),t.u_baseColorFactor=function(){return n.baseColorFactor},i.addDefine("HAS_BASE_COLOR_FACTOR",void 0,ShaderDestination$1.FRAGMENT));var s=n.metallicRoughnessTexture;defined(s)&&processTexture(i,t,s,"u_metallicRoughnessTexture","METALLIC_ROUGHNESS",r);var l=n.metallicFactor;defined(l)&&l!==MetallicRoughness.DEFAULT_METALLIC_FACTOR&&(i.addUniform("float","u_metallicFactor",ShaderDestination$1.FRAGMENT),t.u_metallicFactor=function(){return n.metallicFactor},i.addDefine("HAS_METALLIC_FACTOR",void 0,ShaderDestination$1.FRAGMENT));var c=n.roughnessFactor;defined(c)&&c!==MetallicRoughness.DEFAULT_ROUGHNESS_FACTOR&&(i.addUniform("float","u_roughnessFactor",ShaderDestination$1.FRAGMENT),t.u_roughnessFactor=function(){return n.roughnessFactor},i.addDefine("HAS_ROUGHNESS_FACTOR",void 0,ShaderDestination$1.FRAGMENT))}MaterialPipelineStage.name="MaterialPipelineStage",MaterialPipelineStage.process=function(e,t,i){var r=t.material,n=e.uniformMap,a=e.shaderBuilder,o=i.context.defaultTexture;processMaterialUniforms(r,n,a,o,i.context.defaultNormalTexture,i.context.defaultEmissiveTexture),defined(r.specularGlossiness)?processSpecularGlossinessUniforms(r,n,a,o):processMetallicRoughnessUniforms(r,n,a,o);var s=e.lightingOptions;r.unlit?s.lightingModel=LightingModel$1.UNLIT:s.lightingModel=LightingModel$1.PBR;var l=!r.doubleSided;e.renderStateOptions.cull={enabled:l};var c=e.alphaOptions;defined(c.alphaMode)||(c.alphaMode=r.alphaMode,r.alphaMode===AlphaMode$1.BLEND?c.pass=Pass$1.TRANSLUCENT:r.alphaMode===AlphaMode$1.MASK&&(c.alphaCutoff=r.alphaCutoff)),a.addFragmentLines([MaterialStageFS])},MaterialPipelineStage._processTexture=processTexture,MaterialPipelineStage._processTextureTransform=processTextureTransform;var PickingPipelineStage={};function buildPickObject(e,t){var i,r=e.model,n={model:r,node:e.runtimeNode,primitive:e.runtimePrimitive},a=r.content;return i=defined(a)?{content:a,primitive:a.tileset,detail:n}:{primitive:r,detail:n},defined(t)&&(i.instanceId=t),i}function processPickTexture(e,t,i){var r,n=e.model,a=n.featureIdAttributeIndex;if(defined(n.featureTableId))r=n.featureTableId;else if(defined(i))r=i.featureIdAttributes[a].propertyTableId;else if(t.featureIdTextures.length>0){var o=n.featureIdTextureIndex;r=t.featureIdTextures[o].propertyTableId}else r=t.featureIdAttributes[a].propertyTableId;var s=n.featureTables[r];e.shaderBuilder.addUniform("sampler2D","model_pickTexture",ShaderDestination$1.FRAGMENT);var l=s.batchTexture,c={model_pickTexture:function(){return defaultValue(l.pickTexture,l.defaultTexture)}};e.uniformMap=combine$2(c,e.uniformMap),e.pickId="((feature.id < int(model_featuresLength)) ? texture2D(model_pickTexture, feature.st) : vec4(0.0))"}function processInstancedPickIds(e,t,i){for(var r=e.instanceCount,n=new Array(r),a=new Uint8Array(4*r),o=e.model._resources,s=0;s<r;s++){var l=buildPickObject(e,s),c=i.createPickId(l);o.push(c),n[s]=c;var u=c.color;a[4*s+0]=Color.floatToByte(u.red),a[4*s+1]=Color.floatToByte(u.green),a[4*s+2]=Color.floatToByte(u.blue),a[4*s+3]=Color.floatToByte(u.alpha)}var d=Buffer$1.createVertexBuffer({context:i,typedArray:a,usage:BufferUsage$1.STATIC_DRAW});d.vertexArrayDestroyable=!1,o.push(d);var h={index:e.attributeIndex++,vertexBuffer:d,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1};e.attributes.push(h);var p=e.shaderBuilder;p.addDefine("USE_PICKING",void 0,ShaderDestination$1.BOTH),p.addAttribute("vec4","a_pickColor"),p.addVarying("vec4","v_pickColor"),e.pickId="v_pickColor"}function ModelExperimentalPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.primitive=e.primitive,this.node=e.node,this.model=e.model,this.pipelineStages=[],initialize$4(this)}function initialize$4(e){var t=e.pipelineStages,i=e.primitive,r=e.node,n=e.model,a=n.customShader,o=!(defined(a)&&defined(a.fragmentShaderText))||a.mode!==CustomShaderMode$1.REPLACE_MATERIAL,s=ModelExperimentalUtility.hasQuantizedAttributes(i.attributes);t.push(GeometryPipelineStage),s&&t.push(DequantizationPipelineStage),o&&t.push(MaterialPipelineStage),t.push(LightingPipelineStage);var l,c=n.featureIdAttributeIndex,u=n.featureIdTextureIndex;defined(r.instances)&&r.instances.featureIdAttributes.length>0&&(defined(r.instances.featureIdAttributes[c])&&(l=!0));var d=defined(ModelExperimentalUtility.getAttributeBySemantic(i,VertexAttributeSemantic$1.FEATURE_ID)),h=defined(i.featureIdTextures[u]);(l||(l||d||h))&&(t.push(FeatureIdPipelineStage),t.push(BatchTexturePipelineStage),t.push(CPUStylingPipelineStage)),n.allowPicking&&t.push(PickingPipelineStage),t.push(AlphaPipelineStage)}PickingPipelineStage.name="PickingPipelineStage",PickingPipelineStage.process=function(e,t,i){var r=i.context,n=e.runtimeNode,a=e.shaderBuilder,o=e.model,s=n.node.instances;if(e.hasFeatureIds)processPickTexture(e,t,s);else if(defined(s))processInstancedPickIds(e,s,r);else{var l=buildPickObject(e),c=r.createPickId(l);o._resources.push(c),a.addUniform("vec4","czm_pickColor",ShaderDestination$1.FRAGMENT),e.uniformMap.czm_pickColor=function(){return c.color},e.pickId="czm_pickColor"}};var InstancingStageVS="void instancingStage(inout vec3 positionMC)\n{\nmat4 instancingTransform;\n#ifdef HAS_INSTANCE_MATRICES\ninstancingTransform = mat4(\na_instancingTransformRow0.x, a_instancingTransformRow1.x, a_instancingTransformRow2.x, 0.0,\na_instancingTransformRow0.y, a_instancingTransformRow1.y, a_instancingTransformRow2.y, 0.0,\na_instancingTransformRow0.z, a_instancingTransformRow1.z, a_instancingTransformRow2.z, 0.0,\na_instancingTransformRow0.w, a_instancingTransformRow1.w, a_instancingTransformRow2.w, 1.0\n);\n#else\nvec3 translation = vec3(0.0, 0.0, 0.0);\nvec3 scale = vec3(1.0, 1.0, 1.0);\n#ifdef HAS_INSTANCE_TRANSLATION\ntranslation = a_instanceTranslation;\n#endif\n#ifdef HAS_INSTANCE_SCALE\nscale = a_instanceScale;\n#endif\ninstancingTransform = mat4(\nscale.x, 0.0, 0.0, 0.0,\n0.0, scale.y, 0.0, 0.0,\n0.0, 0.0, scale.z, 0.0,\ntranslation.x, translation.y, translation.z, 1.0\n);\n#endif\npositionMC = (instancingTransform * vec4(positionMC, 1.0)).xyz;\n}\n",InstancingPipelineStage={name:"InstancingPipelineStage",process:function(e,t,i){var r=t.instances,n=r.attributes[0].count,a=[],o=e.shaderBuilder;o.addDefine("HAS_INSTANCING"),o.addVertexLines([InstancingStageVS]);var s,l,c=ModelExperimentalUtility.getAttributeBySemantic(r,InstanceAttributeSemantic$1.TRANSLATION);if(defined(c)&&(s=c.max,l=c.min),!defined(ModelExperimentalUtility.getAttributeBySemantic(r,InstanceAttributeSemantic$1.ROTATION))&&defined(s)&&defined(l)){defined(c)&&(a.push({index:e.attributeIndex++,vertexBuffer:c.buffer,componentsPerAttribute:AttributeType$1.getNumberOfComponents(c.type),componentDatatype:c.componentDatatype,normalize:!1,offsetInBytes:c.byteOffset,strideInBytes:c.byteStride,instanceDivisor:1}),e.instancingTranslationMax=s,e.instancingTranslationMin=l,o.addDefine("HAS_INSTANCE_TRANSLATION"),o.addAttribute("vec3","a_instanceTranslation"));var u=ModelExperimentalUtility.getAttributeBySemantic(r,InstanceAttributeSemantic$1.SCALE);defined(u)&&(a.push({index:e.attributeIndex++,vertexBuffer:u.buffer,componentsPerAttribute:AttributeType$1.getNumberOfComponents(u.type),componentDatatype:u.componentDatatype,normalize:!1,offsetInBytes:u.byteOffset,strideInBytes:u.byteStride,instanceDivisor:1}),o.addDefine("HAS_INSTANCE_SCALE"),o.addAttribute("vec3","a_instanceScale"))}else a=processMatrixAttributes(t,n,e,i);processFeatureIdAttributes(e,i,r,a),e.instanceCount=n,e.attributes.push.apply(e.attributes,a)}},translationScratch$1=new Cartesian3,rotationScratch$2=new Quaternion,scaleScratch=new Cartesian3,transformScratch=new Matrix4;function getInstanceTransformsTypedArray(e,t,i){var r,n=new Float32Array(12*t),a=ModelExperimentalUtility.getAttributeBySemantic(e,InstanceAttributeSemantic$1.TRANSLATION),o=ModelExperimentalUtility.getAttributeBySemantic(e,InstanceAttributeSemantic$1.ROTATION),s=ModelExperimentalUtility.getAttributeBySemantic(e,InstanceAttributeSemantic$1.SCALE),l=new Cartesian3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),c=new Cartesian3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),u=defined(a),d=defined(o),h=defined(s),p=u?a.packedTypedArray:new Float32Array(3*t),f=d?o.packedTypedArray:new Float32Array(4*t);h?r=s.packedTypedArray:(r=new Float32Array(3*t)).fill(1);for(var m=0;m<t;m++){var g=new Cartesian3(p[3*m],p[3*m+1],p[3*m+2],translationScratch$1);Cartesian3.maximumByComponent(l,g,l),Cartesian3.minimumByComponent(c,g,c);var _=new Quaternion(f[4*m],f[4*m+1],f[4*m+2],d?f[4*m+3]:1,rotationScratch$2),y=new Cartesian3(r[3*m],r[3*m+1],r[3*m+2],scaleScratch),v=Matrix4.fromTranslationQuaternionRotationScale(g,_,y,transformScratch),C=12*m;n[C+0]=v[0],n[C+1]=v[4],n[C+2]=v[8],n[C+3]=v[12],n[C+4]=v[1],n[C+5]=v[5],n[C+6]=v[9],n[C+7]=v[13],n[C+8]=v[2],n[C+9]=v[6],n[C+10]=v[10],n[C+11]=v[14],i.instancingTranslationMax=l,i.instancingTranslationMin=c}return n}function processFeatureIdAttributes(e,t,i,r){for(var n=i.attributes,a=e.model,o=e.shaderBuilder,s=0;s<n.length;s++){var l=n[s];if(l.semantic===InstanceAttributeSemantic$1.FEATURE_ID){l.setIndex>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=l.setIndex+1);var c=Buffer$1.createVertexBuffer({context:t.context,typedArray:l.packedTypedArray,usage:BufferUsage$1.STATIC_DRAW});c.vertexArrayDestroyable=!1,a._resources.push(c),r.push({index:e.attributeIndex++,vertexBuffer:c,componentsPerAttribute:AttributeType$1.getNumberOfComponents(l.type),componentDatatype:l.componentDatatype,normalize:!1,offsetInBytes:l.byteOffset,strideInBytes:l.byteStride,instanceDivisor:1}),o.addAttribute("float","a_instanceFeatureId_"+l.setIndex)}}}function processMatrixAttributes(e,t,i,r){var n=getInstanceTransformsTypedArray(e.instances,t,i),a=Buffer$1.createVertexBuffer({context:r.context,typedArray:n,usage:BufferUsage$1.STATIC_DRAW});a.vertexArrayDestroyable=!1,i.model._resources.push(a);var o=ComponentDatatype$1.getSizeInBytes(ComponentDatatype$1.FLOAT),s=[{index:i.attributeIndex++,vertexBuffer:a,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:12*o,instanceDivisor:1},{index:i.attributeIndex++,vertexBuffer:a,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:4*o,strideInBytes:12*o,instanceDivisor:1},{index:i.attributeIndex++,vertexBuffer:a,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:8*o,strideInBytes:12*o,instanceDivisor:1}],l=i.shaderBuilder;return l.addDefine("HAS_INSTANCE_MATRICES"),l.addAttribute("vec4","a_instancingTransformRow0"),l.addAttribute("vec4","a_instancingTransformRow1"),l.addAttribute("vec4","a_instancingTransformRow2"),s}function ModelExperimentalNode(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.node=e.node,this.modelMatrix=e.modelMatrix,this.pipelineStages=[],this.runtimePrimitives=[],initialize$3(this)}function initialize$3(e){var t=e.node,i=e.pipelineStages;defined(t.instances)&&i.push(InstancingPipelineStage)}function ModelAlphaOptions(){this.pass=void 0,this.alphaMode=void 0,this.alphaCutoff=void 0}function ShaderStruct(e){this.name=e,this.fields=[]}function ShaderFunction(e){this.signature=e,this.body=[]}function ShaderBuilder(){this._positionAttributeLine=void 0,this._nextAttributeLocation=1,this._attributeLocations={},this._attributeLines=[],this._structs={},this._functions={},this._vertexShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]},this._fragmentShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]}}function generateStructLines(e){var t,i,r,n=[],a=[],o=e._vertexShaderParts.structIds;for(t=0;t<o.length;t++)i=o[t],r=e._structs[i].generateGlslLines(),n.push.apply(n,r);for(o=e._fragmentShaderParts.structIds,t=0;t<o.length;t++)i=o[t],r=e._structs[i].generateGlslLines(),a.push.apply(a,r);return{vertexLines:n,fragmentLines:a}}function generateFunctionLines(e){var t,i,r,n=[],a=[],o=e._vertexShaderParts.functionIds;for(t=0;t<o.length;t++)i=o[t],r=e._functions[i].generateGlslLines(),n.push.apply(n,r);for(o=e._fragmentShaderParts.functionIds,t=0;t<o.length;t++)i=o[t],r=e._functions[i].generateGlslLines(),a.push.apply(a,r);return{vertexLines:n,fragmentLines:a}}function ModelRenderResources(e){this.shaderBuilder=new ShaderBuilder,this.model=e,this.uniformMap={},this.alphaOptions=new ModelAlphaOptions}function NodeRenderResources(e,t){this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=clone$1(e.uniformMap),this.alphaOptions=clone$1(e.alphaOptions),this.runtimeNode=t,this.modelMatrix=t.modelMatrix,this.attributes=[],this.attributeIndex=1,this.featureIdVertexAttributeSetIndex=0,this.instanceCount=0,this.instancingTranslationMax=void 0,this.instancingTranslationMin=void 0}function ModelLightingOptions(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.lightingModel=defaultValue(e.lightingModel,LightingModel$1.UNLIT)}function PrimitiveRenderResources(e,t){this.model=e.model,this.runtimeNode=e.runtimeNode,this.attributes=e.attributes.slice(),this.attributeIndex=e.attributeIndex,this.featureIdVertexAttributeSetIndex=e.featureIdVertexAttributeSetIndex,this.hasFeatureIds=!1,this.uniformMap=clone$1(e.uniformMap),this.alphaOptions=clone$1(e.alphaOptions),this.modelMatrix=e.modelMatrix.clone(),this.shaderBuilder=e.shaderBuilder.clone(),this.instanceCount=e.instanceCount,this.runtimePrimitive=t;var i=t.primitive;this.count=defined(i.indices)?i.indices.count:ModelExperimentalUtility.getAttributeBySemantic(i,"POSITION").count,this.indices=i.indices,this.primitiveType=i.primitiveType,this.boundingSphere=ModelExperimentalUtility.createBoundingSphere(i,this.modelMatrix,e.instancingTranslationMax,e.instancingTranslationMin),this.lightingOptions=new ModelLightingOptions,this.pickId=void 0,this.renderStateOptions={depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},blending:BlendingState$1.DISABLED},this.styleCommandsNeeded=void 0}function ModelExperimentalSceneGraph(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._model=e.model,this._modelComponents=e.modelComponents,this._pipelineStages=[],this._runtimeNodes=[],this._drawCommands=[],this._boundingSphere=void 0,this._boundingSpheres=[],initialize$2(this)}function initialize$2(e){var t=Matrix4.clone(e._model.modelMatrix),i=e._modelComponents.scene;ModelExperimentalUtility.correctModelMatrix(t,i.upAxis,i.forwardAxis);for(var r=e._modelComponents.scene.nodes,n=0;n<r.length;n++){var a=e._modelComponents.scene.nodes[n];traverseSceneGraph(e,a,Matrix4.multiply(t,ModelExperimentalUtility.getNodeTransform(a),new Matrix4))}}function traverseSceneGraph(e,t,i){if(defined(t.children)||defined(t.primitives)){var r;if(defined(t.children))for(r=0;r<t.children.length;r++){var n=t.children[r];traverseSceneGraph(e,n,Matrix4.multiply(i,ModelExperimentalUtility.getNodeTransform(n),new Matrix4))}var a=new ModelExperimentalNode({node:t,modelMatrix:i});if(defined(t.primitives))for(r=0;r<t.primitives.length;r++)a.runtimePrimitives.push(new ModelExperimentalPrimitive({primitive:t.primitives[r],node:t,model:e._model}));e._runtimeNodes.push(a)}}function ModelFeature(e){this._model=e.model,this._featureTable=e.featureTable,this._featureId=e.featureId,this._color=void 0}function ModelFeatureTable(e){var t=e.model,i=e.propertyTable;this._propertyTable=i,this._model=t,this._features=void 0,this._featuresLength=0,this._batchTexture=void 0,this._styleCommandsNeededDirty=!1,this._styleCommandsNeeded=StyleCommandsNeeded$1.ALL_OPAQUE,initialize$1(this)}function initialize$1(e){var t=e._model.content,i=defined(t),r=e._propertyTable.count;if(0!==r){for(var n=new Array(r),a=0;a<r;a++)n[a]=i?new Cesium3DTileFeature(t,a):new ModelFeature({model:e._model,featureId:a,featureTable:e});e._features=n,e._featuresLength=r,e._batchTexture=new BatchTexture({featuresLength:r,owner:e,statistics:i?t.tileset.statistics:e._statistics})}}InstancingPipelineStage._getInstanceTransformsTypedArray=getInstanceTransformsTypedArray,ShaderStruct.prototype.addField=function(e,t){var i=" "+e+" "+t+";";this.fields.push(i)},ShaderStruct.prototype.generateGlslLines=function(){var e=this.fields;return 0===e.length&&(e=[" float _empty;"]),[].concat("struct "+this.name,"{",e,"};")},ShaderFunction.prototype.addLines=function(e){var t=e.map((function(e){return" "+e}));Array.prototype.push.apply(this.body,t)},ShaderFunction.prototype.generateGlslLines=function(){return[].concat(this.signature,"{",this.body,"}")},Object.defineProperties(ShaderBuilder.prototype,{attributeLocations:{get:function(){return this._attributeLocations}}}),ShaderBuilder.prototype.addDefine=function(e,t,i){i=defaultValue(i,ShaderDestination$1.BOTH);var r=e;defined(t)&&(r+=" "+t.toString()),ShaderDestination$1.includesVertexShader(i)&&this._vertexShaderParts.defineLines.push(r),ShaderDestination$1.includesFragmentShader(i)&&this._fragmentShaderParts.defineLines.push(r)},ShaderBuilder.prototype.addStruct=function(e,t,i){this._structs[e]=new ShaderStruct(t),ShaderDestination$1.includesVertexShader(i)&&this._vertexShaderParts.structIds.push(e),ShaderDestination$1.includesFragmentShader(i)&&this._fragmentShaderParts.structIds.push(e)},ShaderBuilder.prototype.addStructField=function(e,t,i){this._structs[e].addField(t,i)},ShaderBuilder.prototype.addFunction=function(e,t,i){this._functions[e]=new ShaderFunction(t),ShaderDestination$1.includesVertexShader(i)&&this._vertexShaderParts.functionIds.push(e),ShaderDestination$1.includesFragmentShader(i)&&this._fragmentShaderParts.functionIds.push(e)},ShaderBuilder.prototype.addFunctionLines=function(e,t){this._functions[e].addLines(t)},ShaderBuilder.prototype.addUniform=function(e,t,i){i=defaultValue(i,ShaderDestination$1.BOTH);var r="uniform "+e+" "+t+";";ShaderDestination$1.includesVertexShader(i)&&this._vertexShaderParts.uniformLines.push(r),ShaderDestination$1.includesFragmentShader(i)&&this._fragmentShaderParts.uniformLines.push(r)},ShaderBuilder.prototype.setPositionAttribute=function(e,t){return this._positionAttributeLine="attribute "+e+" "+t+";",this._attributeLocations[t]=0,0},ShaderBuilder.prototype.addAttribute=function(e,t){var i="attribute "+e+" "+t+";";this._attributeLines.push(i);var r=this._nextAttributeLocation;return this._attributeLocations[t]=r,this._nextAttributeLocation++,r},ShaderBuilder.prototype.addVarying=function(e,t){var i="varying "+e+" "+t+";";this._vertexShaderParts.varyingLines.push(i),this._fragmentShaderParts.varyingLines.push(i)},ShaderBuilder.prototype.addVertexLines=function(e){Array.prototype.push.apply(this._vertexShaderParts.shaderLines,e)},ShaderBuilder.prototype.addFragmentLines=function(e){Array.prototype.push.apply(this._fragmentShaderParts.shaderLines,e)},ShaderBuilder.prototype.buildShaderProgram=function(e){var t=defined(this._positionAttributeLine)?[this._positionAttributeLine]:[],i=generateStructLines(this),r=generateFunctionLines(this),n=t.concat(this._attributeLines,this._vertexShaderParts.uniformLines,this._vertexShaderParts.varyingLines,i.vertexLines,r.vertexLines,this._vertexShaderParts.shaderLines).join("\n"),a=new ShaderSource({defines:this._vertexShaderParts.defineLines,sources:[n]}),o=this._fragmentShaderParts.uniformLines.concat(this._fragmentShaderParts.varyingLines,i.fragmentLines,r.fragmentLines,this._fragmentShaderParts.shaderLines).join("\n"),s=new ShaderSource({defines:this._fragmentShaderParts.defineLines,sources:[o]});return ShaderProgram.fromCache({context:e,vertexShaderSource:a,fragmentShaderSource:s,attributeLocations:this._attributeLocations})},ShaderBuilder.prototype.clone=function(){return clone$1(this,!0)},ModelExperimentalSceneGraph.prototype.buildDrawCommands=function(e){var t,i,r,n=new ModelRenderResources(this._model),a=[],o=this._model;for(defined(o.color)&&a.push(ModelColorPipelineStage),t=0;t<a.length;t++){a[t].process(n,o,e)}for(t=0;t<this._runtimeNodes.length;t++){var s=this._runtimeNodes[t],l=new NodeRenderResources(n,s);for(i=0;i<s.pipelineStages.length;i++){s.pipelineStages[i].process(l,s.node,e)}for(i=0;i<s.runtimePrimitives.length;i++){var c=s.runtimePrimitives[i],u=c.pipelineStages.slice();if(defined(o.customShader)){var d=u.indexOf(LightingPipelineStage);u.splice(d,0,CustomShaderPipelineStage)}var h=new PrimitiveRenderResources(l,c);for(r=0;r<u.length;r++){u[r].process(h,c.primitive,e)}this._boundingSpheres.push(h.boundingSphere);var p=buildDrawCommands(h,e);this._drawCommands.push.apply(this._drawCommands,p)}}this._boundingSphere=BoundingSphere.fromBoundingSpheres(this._boundingSpheres)},Object.defineProperties(ModelFeature.prototype,{show:{get:function(){return this._featureTable.getShow(this._featureId)},set:function(e){this._featureTable.setShow(this._featureId,e)}},color:{get:function(){return defined(this._color)||(this._color=new Color),this._featureTable.getColor(this._featureId,this._color)},set:function(e){this._featureTable.setColor(this._featureId,e)}},primitive:{get:function(){return this._model}},featureTable:{get:function(){return this._featureTable}}}),ModelFeature.prototype.hasProperty=function(e){return this._featureTable.hasProperty(this._featureId,e)},ModelFeature.prototype.getProperty=function(e){return this._featureTable.getProperty(this._featureId,e)},ModelFeature.prototype.getPropertyInherited=function(e){var t=this._featureTable.getPropertyBySemantic(this._featureId,e);return defined(t)?t:this._featureTable.getProperty(this._featureId,e)},ModelFeature.prototype.getPropertyNames=function(e){return this._featureTable.getPropertyNames(e)},ModelFeature.prototype.setProperty=function(e,t){return this._featureTable.setProperty(this._featureId,e,t)},Object.defineProperties(ModelFeatureTable.prototype,{batchTexture:{get:function(){return this._batchTexture}},featuresLength:{get:function(){return this._featuresLength}},styleCommandsNeededDirty:{get:function(){return this._styleCommandsNeededDirty}}}),ModelFeatureTable.prototype.update=function(e){this._styleCommandsNeededDirty=!1,this._batchTexture.update(void 0,e);var t=StyleCommandsNeeded$1.getStyleCommandsNeeded(this._featuresLength,this._batchTexture.translucentFeaturesLength);this._styleCommandsNeeded!==t&&(this._styleCommandsNeededDirty=!0,this._styleCommandsNeeded=t)},ModelFeatureTable.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)},ModelFeatureTable.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)},ModelFeatureTable.prototype.getShow=function(e){return this._batchTexture.getShow(e)},ModelFeatureTable.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)},ModelFeatureTable.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)},ModelFeatureTable.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)},ModelFeatureTable.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)},ModelFeatureTable.prototype.getFeature=function(e){return this._features[e]},ModelFeatureTable.prototype.hasProperty=function(e,t){return this._propertyTable.hasProperty(e,t)},ModelFeatureTable.prototype.getProperty=function(e,t){return this._propertyTable.getProperty(e,t)},ModelFeatureTable.prototype.getPropertyBySemantic=function(e,t){return this._propertyTable.getPropertyBySemantic(e,t)},ModelFeatureTable.prototype.getPropertyNames=function(e){return this._propertyTable.getPropertyIds(e)},ModelFeatureTable.prototype.setProperty=function(e,t,i){return this._propertyTable.setProperty(e,t,i)};var scratchColor$e=new Color;function JsonMetadataTable(e){this._count=e.count,this._properties=clone$1(e.properties,!0)}function parseBatchTable(e){var t=e.count,i=e.batchTable,r=e.binaryBody,n=partitionProperties(i),a=new JsonMetadataTable({count:t,properties:n.jsonProperties}),o=initializeHierarchy(n.hierarchy,r),s=transcodeBinaryProperties(t,MetadataClass.BATCH_TABLE_CLASS_NAME,n.binaryProperties,r),l=s.featureTableJson,c=new MetadataTable({count:l.count,properties:l.properties,class:s.transcodedClass,bufferViews:s.bufferViewsU8}),u=new PropertyTable({id:0,name:"Batch Table",count:l.count,metadataTable:c,jsonMetadataTable:a,batchTableHierarchy:o});return new FeatureMetadata({schema:s.transcodedSchema,propertyTables:[u],extensions:n.extensions,extras:n.extras})}function partitionProperties(e){var t,i=e.HIERARCHY,r=e.extras,n=e.extensions;defined(i)?(parseBatchTable._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),t=i):defined(n)&&(t=n["3DTILES_batch_table_hierarchy"]);var a={},o={};for(var s in e)if(e.hasOwnProperty(s)&&"HIERARCHY"!==s&&"extensions"!==s&&"extras"!==s){var l=e[s];Array.isArray(l)?a[s]=l:o[s]=l}return{binaryProperties:o,jsonProperties:a,hierarchy:t,extras:r,extensions:n}}function transcodeBinaryProperties(e,t,i,r){var n={},a={},o={},s=0;for(var l in i)if(i.hasOwnProperty(l)){if(!defined(r))throw new RuntimeError("Property "+l+" requires a batch table binary.");var c=i[l],u=getBinaryAccessor(c);a[l]={bufferView:s},n[l]=transcodePropertyType(c),o[s]=u.createArrayBufferView(r.buffer,r.byteOffset+c.byteOffset,e),s++}var d={classes:{}};d.classes[t]={properties:n};var h=new MetadataSchema(d);return{featureTableJson:{class:t,count:e,properties:a},bufferViewsU8:o,transcodedSchema:h,transcodedClass:h.classes[t]}}function transcodePropertyType(e){var t=transcodeComponentType(e.componentType),i=e.type;return"SCALAR"===i?{type:"SINGLE",componentType:t}:{type:i,componentType:t}}function transcodeComponentType(e){switch(e){case"BYTE":return"INT8";case"UNSIGNED_BYTE":return"UINT8";case"SHORT":return"INT16";case"UNSIGNED_SHORT":return"UINT16";case"INT":return"INT32";case"UNSIGNED_INT":return"UINT32";case"FLOAT":return"FLOAT32";case"DOUBLE":return"FLOAT64"}}function initializeHierarchy(e,t){if(defined(e))return new BatchTableHierarchy({extension:e,binaryBody:t})}ModelFeatureTable.prototype.applyStyle=function(e){if(!defined(e))return this.setAllColor(BatchTexture.DEFAULT_COLOR_VALUE),void this.setAllShow(BatchTexture.DEFAULT_SHOW_VALUE);for(var t=0;t<this._featuresLength;t++){var i=this.getFeature(t),r=defined(e.color)?defaultValue(e.color.evaluateColor(i,scratchColor$e),BatchTexture.DEFAULT_COLOR_VALUE):BatchTexture.DEFAULT_COLOR_VALUE,n=defined(e.show)?defaultValue(e.show.evaluate(i),BatchTexture.DEFAULT_SHOW_VALUE):BatchTexture.DEFAULT_SHOW_VALUE;this.setColor(t,r),this.setShow(t,n)}},ModelFeatureTable.prototype.isDestroyed=function(){return!1},ModelFeatureTable.prototype.destroy=function(e){this._batchTexture.destroy(),destroyObject(this)},JsonMetadataTable.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties)},JsonMetadataTable.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,void 0,e)},JsonMetadataTable.prototype.getProperty=function(e,t){var i=this._properties[t];if(defined(i))return clone$1(i[e],!0)},JsonMetadataTable.prototype.setProperty=function(e,t,i){var r=this._properties[t];return!!defined(r)&&(r[e]=clone$1(i,!0),!0)},parseBatchTable._deprecationWarning=deprecationWarning;var B3dmLoaderState={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},FeatureIdAttribute=ModelComponents.FeatureIdAttribute;function B3dmLoader(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).b3dmResource,i=e.baseResource,r=e.arrayBuffer,n=defaultValue(e.byteOffset,0),a=defaultValue(e.releaseGltfJson,!1),o=defaultValue(e.asynchronous,!0),s=defaultValue(e.incrementallyLoadTextures,!0),l=defaultValue(e.upAxis,Axis$1.Y),c=defaultValue(e.forwardAxis,Axis$1.X),u=defaultValue(e.loadAsTypedArray,!1);i=defined(i)?i:t.clone(),this._b3dmResource=t,this._baseResource=i,this._arrayBuffer=r,this._byteOffset=n,this._releaseGltfJson=a,this._asynchronous=o,this._incrementallyLoadTextures=s,this._upAxis=l,this._forwardAxis=c,this._loadAsTypedArray=u,this._state=B3dmLoaderState.UNLOADED,this._promise=when.defer(),this._gltfLoader=void 0,this._batchLength=0,this._propertyTable=void 0,this._batchTable=void 0,this._components=void 0,this._transform=Matrix4.IDENTITY}function handleError(e,t){e.unload(),e._state=B3dmLoaderState.FAILED;t=e.getError("Failed to load B3DM",t),e._promise.reject(t)}function createFeatureMetadata(e,t){var i=e._batchTable,r=e._batchLength;if(0!==r){var n;if(defined(i.json))n=parseBatchTable({count:r,batchTable:i.json,binaryBody:i.binary});else n=new FeatureMetadata({schema:{},propertyTables:[new PropertyTable({name:MetadataClass.BATCH_TABLE_CLASS_NAME,count:r})]});for(var a=t.scene.nodes,o=0;o<a.length;o++)processNode(a[o]);t.featureMetadata=n}}function processNode(e){if(defined(e.children)||defined(e.primitives)){var t;if(defined(e.children))for(t=0;t<e.children.length;t++)processNode(e.children[t]);if(defined(e.primitives))for(t=0;t<e.primitives.length;t++){var i=e.primitives[t],r=ModelExperimentalUtility.getAttributeBySemantic(i,VertexAttributeSemantic$1.FEATURE_ID);if(defined(r)){r.setIndex=0;var n=new FeatureIdAttribute;n.propertyTableId=0,n.setIndex=0,i.featureIdAttributes.push(n)}}}}function ModelExperimental(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._loader=e.loader,this._resource=e.resource,this._modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._resourcesLoaded=!1,this._drawCommandsBuilt=!1,this._ready=!1,this._readyPromise=when.defer(),this._customShader=e.customShader,this._content=e.content,this._texturesLoaded=!1;var t=e.color;this._color=defaultValue(t)?Color.clone(t):void 0,this._colorBlendMode=defaultValue(e.colorBlendMode,ColorBlendMode$1.HIGHLIGHT),this._colorBlendAmount=defaultValue(e.colorBlendAmount,.5),this._cull=defaultValue(e.cull,!0),this._opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._allowPicking=defaultValue(e.allowPicking,!0),this._show=defaultValue(e.show,!0),this._featureIdAttributeIndex=defaultValue(e.featureIdAttributeIndex,0),this._featureIdTextureIndex=defaultValue(e.featureIdTextureIndex,0),this._featureTables=void 0,this._featureTableId=void 0,this._resources=[],this._boundingSphere=void 0,this._debugShowBoundingVolumeDirty=!1,this._debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),initialize(this)}function createModelFeatureTables(e,t){for(var i=[],r=t.propertyTables,n=0;n<r.length;n++){var a=new ModelFeatureTable({model:e,propertyTable:r[n]});a.featuresLength>0&&i.push(a)}return i}function selectFeatureTableId(e,t){var i,r,n,a,o,s=t._featureIdAttributeIndex,l=t._featureIdTextureIndex;for(i=0;i<e.nodes.length;i++)if(defined((o=e.nodes[i]).instances)&&defined(n=o.instances.featureIdAttributes[s]))return n.propertyTableId;for(i=0;i<e.nodes.length;i++)for(o=e.nodes[i],r=0;r<o.primitives.length;r++){var c=o.primitives[r];if(a=c.featureIdTextures[l],n=c.featureIdAttributes[s],defined(a))return a.propertyTableId;if(defined(n))return n.propertyTableId}}function initialize(e){var t=e._loader,i=e._resource;t.load(),t.promise.then((function(t){Matrix4.multiply(e._modelMatrix,t.transform,e._modelMatrix);var i=t.components,r=i.featureMetadata;if(defined(r)&&r.propertyTableCount>0){var n=selectFeatureTableId(i,e),a=createModelFeatureTables(e,r);e.featureTables=a,e.featureTableId=n}e._sceneGraph=new ModelExperimentalSceneGraph({model:e,modelComponents:i}),e._resourcesLoaded=!0})).otherwise(ModelExperimentalUtility.getFailedLoadFunction(e,"model",i)),t.texturesLoadedPromise.then((function(){e._texturesLoaded=!0})).otherwise(ModelExperimentalUtility.getFailedLoadFunction(e,"model",i))}function updateShowBoundingVolume(e,t){for(var i=e._drawCommands,r=0;r<i.length;r++)i[r].debugShowBoundingVolume=t}function ModelExperimental3DTileContent(e,t,i){this._tileset=e,this._tile=t,this._resource=i,this._model=void 0,this._groupMetadata=void 0}defined(Object.create)&&(B3dmLoader.prototype=Object.create(ResourceLoader.prototype),B3dmLoader.prototype.constructor=B3dmLoader),Object.defineProperties(B3dmLoader.prototype,{promise:{get:function(){return this._promise.promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},transform:{get:function(){return this._transform}}}),B3dmLoader.prototype.load=function(){var e=B3dmParser.parse(this._arrayBuffer,this._byteOffset),t=e.batchLength,i=e.featureTableJson,r=e.featureTableBinary,n=e.batchTableJson,a=e.batchTableBinary,o=new Cesium3DTileFeatureTable(i,r);t=o.getGlobalProperty("BATCH_LENGTH"),this._batchLength=t;var s=o.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(s)&&(this._transform=Matrix4.fromTranslation(Cartesian3.fromArray(s))),this._batchTable={json:n,binary:a};var l=new GltfLoader({upAxis:this._upAxis,typedArray:e.gltf,forwardAxis:this._forwardAxis,gltfResource:this._b3dmResource,baseResource:this._baseResource,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAsTypedArray:this._loadAsTypedArray});this._gltfLoader=l,this._state=B3dmLoaderState.LOADING;var c=this;l.load(),l.promise.then((function(){if(!c.isDestroyed()){var e=l.components;createFeatureMetadata(c,e),c._components=e,c._state=B3dmLoaderState.READY,c._promise.resolve(c)}})).otherwise((function(e){c.isDestroyed()||handleError(c,e)}))},B3dmLoader.prototype.process=function(e){this._state===B3dmLoaderState.LOADING&&(this._state=B3dmLoaderState.PROCESSING),this._state===B3dmLoaderState.PROCESSING&&this._gltfLoader.process(e)},B3dmLoader.prototype.unload=function(){defined(this._gltfLoader)&&this._gltfLoader.unload(),this._components=void 0},Object.defineProperties(ModelExperimental.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},cull:{get:function(){return this._cull}},opaquePass:{get:function(){return this._opaquePass}},customShader:{get:function(){return this._customShader},set:function(e){e!==this._customShader&&this.resetDrawCommands(),this._customShader=e}},content:{get:function(){return this._content}},featureTableId:{get:function(){return this._featureTableId},set:function(e){this._featureTableId=e}},featureTables:{get:function(){return this._featureTables},set:function(e){this._featureTables=e}},allowPicking:{get:function(){return this._allowPicking}},style:{get:function(){return this._style},set:function(e){e!==this._style&&this.applyStyle(e),this._style=e}},color:{get:function(){return this._color},set:function(e){Color.equals(this._color,e)||this.resetDrawCommands(),this._color=e}},colorBlendMode:{get:function(){return this._colorBlendMode},set:function(e){this._colorBlendMode=e}},colorBlendAmount:{get:function(){return this._colorBlendAmount},set:function(e){this._colorBlendAmount=e}},boundingSphere:{get:function(){return this._sceneGraph._boundingSphere}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=e}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolumeDirty=!0),this._debugShowBoundingVolume=e}},show:{get:function(){return this._show},set:function(e){this._show=e}},featureIdAttributeIndex:{get:function(){return this._featureIdAttributeIndex}},featureIdTextureIndex:{get:function(){return this._featureIdTextureIndex}}}),ModelExperimental.prototype.resetDrawCommands=function(){this._drawCommandsBuilt&&(this.destroyResources(),this._drawCommandsBuilt=!1,this._sceneGraph._drawCommands=[])},ModelExperimental.prototype.update=function(e){if(this._resourcesLoaded&&this._texturesLoaded||this._loader.process(e),defined(this._customShader)&&this._customShader.update(e),this._resourcesLoaded){var t=this._featureTables;if(defined(t))for(var i=0;i<t.length;i++)t[i].update(e),t[i].styleCommandsNeededDirty&&this.resetDrawCommands();if(!this._drawCommandsBuilt){this._sceneGraph.buildDrawCommands(e),this._drawCommandsBuilt=!0;var r=this;if(!r._ready)return void e.afterRender.push((function(){r._ready=!0,r._readyPromise.resolve(r)}))}this._debugShowBoundingVolumeDirty&&(updateShowBoundingVolume(this._sceneGraph,this._debugShowBoundingVolume),this._debugShowBoundingVolumeDirty=!1),this._show&&e.commandList.push.apply(e.commandList,this._sceneGraph._drawCommands)}},ModelExperimental.prototype.isDestroyed=function(){return!1},ModelExperimental.prototype.destroy=function(){var e=this._loader;defined(e)&&e.destroy();var t=this._featureTables;if(defined(t))for(var i=0;i<t.length;i++)t[i].destroy();this.destroyResources(),destroyObject(this)},ModelExperimental.prototype.destroyResources=function(){for(var e=this._resources,t=0;t<e.length;t++)e[t].destroy();this._resources=[]},ModelExperimental.fromGltf=function(e){var t={releaseGltfJson:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).releaseGltfJson,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis},i=e.gltf,r=defaultValue(e.basePath,""),n=Resource.createIfNeeded(r);return defined(i.asset)?(t.gltfJson=i,t.baseResource=n,t.gltfResource=n):i instanceof Uint8Array?(t.typedArray=i,t.baseResource=n,t.gltfResource=n):t.gltfResource=Resource.createIfNeeded(e.gltf),new ModelExperimental({loader:new GltfLoader(t),resource:t.gltfResource,modelMatrix:e.modelMatrix,debugShowBoundingVolume:e.debugShowBoundingVolume,cull:e.cull,opaquePass:e.opaquePass,allowPicking:e.allowPicking,customShader:e.customShader,content:e.content,show:e.show,color:e.color,colorBlendAmount:e.colorBlendAmount,colorBlendMode:e.colorBlendMode,featureIdAttributeIndex:e.featureIdAttributeIndex,featureIdTextureIndex:e.featureIdTextureIndex})},ModelExperimental.fromB3dm=function(e){var t={b3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis};return new ModelExperimental({loader:new B3dmLoader(t),resource:t.b3dmResource,modelMatrix:e.modelMatrix,debugShowBoundingVolume:e.debugShowBoundingVolume,cull:e.cull,opaquePass:e.opaquePass,allowPicking:e.allowPicking,customShader:e.customShader,content:e.content,show:e.show,featureIdAttributeIndex:e.featureIdAttributeIndex,featureIdTextureIndex:e.featureIdTextureIndex})},ModelExperimental.prototype.applyColorAndShow=function(e){var t=defined(e)&&defined(e.color),i=defined(e)&&defined(e.show);this._color=t?e.color.evaluateColor(void 0,this._color):Color.clone(Color.WHITE,this._color),this._show=!i||e.show.evaluate(void 0)},ModelExperimental.prototype.applyStyle=function(e){defined(this.featureTableId)&&this.featureTables[this.featureTableId].featuresLength>0?this.featureTables[this.featureTableId].applyStyle(e):this.applyColorAndShow(e);this.resetDrawCommands()},Object.defineProperties(ModelExperimental3DTileContent.prototype,{featuresLength:{get:function(){var e=this._model,t=e.featureTables,i=e.featureTableId;return defined(t)&&defined(t[i])?t[i].featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._model.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){var e=this._model,t=e.featureTables,i=e.featureTableId;if(defined(t)&&defined(t[i]))return t[i]}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}}),ModelExperimental3DTileContent.prototype.getFeature=function(e){var t=this._model,i=t.featureTableId;if(defined(i))return t.featureTables[i].getFeature(e)},ModelExperimental3DTileContent.prototype.hasProperty=function(e,t){var i=this._model,r=i.featureTableId;return!!defined(r)&&i.featureTables[r].hasProperty(e,t)},ModelExperimental3DTileContent.prototype.applyDebugSettings=function(e,t){},ModelExperimental3DTileContent.prototype.applyStyle=function(e){this._model.applyStyle(e)},ModelExperimental3DTileContent.prototype.update=function(e,t){var i=this._model,r=this._tile;i.colorBlendAmount=e.colorBlendAmount,i.colorBlendMode=e.colorBlendMode,i.modelMatrix=r.computedTransform,i.customShader=e.customShader,i.update(t)},ModelExperimental3DTileContent.prototype.isDestroyed=function(){return!1},ModelExperimental3DTileContent.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),destroyObject(this)},ModelExperimental3DTileContent.fromGltf=function(e,t,i,r){var n=new ModelExperimental3DTileContent(e,t,i),a={gltf:r,cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,basePath:i,modelMatrix:t.computedTransform,upAxis:e._gltfUpAxis,forwardAxis:Axis$1.X,incrementallyLoadTextures:!1,customShader:e.customShader,content:n,colorBlendMode:e.colorBlendMode,colorBlendAmount:e.colorBlendAmount};return n._model=ModelExperimental.fromGltf(a),n},ModelExperimental3DTileContent.fromB3dm=function(e,t,i,r,n){var a=new ModelExperimental3DTileContent(e,t,i),o={arrayBuffer:r,byteOffset:n,resource:i,cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,modelMatrix:t.computedTransform,upAxis:e._gltfUpAxis,forwardAxis:Axis$1.X,incrementallyLoadTextures:!1,customShader:e.customShader,content:a,colorBlendMode:e.colorBlendMode,colorBlendAmount:e.colorBlendAmount};return a._model=ModelExperimental.fromB3dm(o),a};var Cesium3DTileContentFactory={b3dm:function(e,t,i,r,n){return ExperimentalFeatures.enableModelExperimental?ModelExperimental3DTileContent.fromB3dm(e,t,i,r,n):new Batched3DModel3DTileContent(e,t,i,r,n)},pnts:function(e,t,i,r,n){return new PointCloud3DTileContent(e,t,i,r,n)},i3dm:function(e,t,i,r,n){return new Instanced3DModel3DTileContent(e,t,i,r,n)},cmpt:function(e,t,i,r,n){return new Composite3DTileContent(e,t,i,r,n,Cesium3DTileContentFactory)},externalTileset:function(e,t,i,r){return new Tileset3DTileContent(e,t,i,r)},geom:function(e,t,i,r,n){return new Geometry3DTileContent(e,t,i,r,n)},vctr:function(e,t,i,r,n){return new Vector3DTileContent(e,t,i,r,n)},subt:function(e,t,i,r,n){return new Implicit3DTileContent(e,t,i,r,n)},glb:function(e,t,i,r,n){if(r.byteLength<12)throw new RuntimeError("Invalid glb content");var a=new DataView(r,n).getUint32(8,!0),o=new Uint8Array(r,n,a);return ExperimentalFeatures.enableModelExperimental?ModelExperimental3DTileContent.fromGltf(e,t,i,o):new Gltf3DTileContent(e,t,i,o)},gltf:function(e,t,i,r){return ExperimentalFeatures.enableModelExperimental?ModelExperimental3DTileContent.fromGltf(e,t,i,r):new Gltf3DTileContent(e,t,i,r)}},Cesium3DTileContentState={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Cesium3DTileContentState$1=Object.freeze(Cesium3DTileContentState),Cesium3DTileContentType={BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",COMPOSITE:"cmpt",POINT_CLOUD:"pnts",VECTOR:"vctr",GEOMETRY:"geom",GLTF:"gltf",GLTF_BINARY:"glb",IMPLICIT_SUBTREE:"subt",EXTERNAL_TILESET:"externalTileset",MULTIPLE_CONTENT:"multipleContent",isBinaryFormat:function(e){switch(e){case Cesium3DTileContentType.BATCHED_3D_MODEL:case Cesium3DTileContentType.INSTANCED_3D_MODEL:case Cesium3DTileContentType.COMPOSITE:case Cesium3DTileContentType.POINT_CLOUD:case Cesium3DTileContentType.VECTOR:case Cesium3DTileContentType.GEOMETRY:case Cesium3DTileContentType.IMPLICIT_SUBTREE:case Cesium3DTileContentType.GLTF_BINARY:return!0;default:return!1}}},Cesium3DTileContentType$1=Object.freeze(Cesium3DTileContentType),Cesium3DTileOptimizationHint={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0},Cesium3DTileOptimizationHint$1=Object.freeze(Cesium3DTileOptimizationHint);function Cesium3DTilesetMostDetailedTraversal(){}var traversal$1={stack:new ManagedArray,stackMaximumLength:0};function isVisible$1(e){return e._visible&&e._inRequestVolume}function hasEmptyContent$1(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function hasUnloadedContent$1(e){return!hasEmptyContent$1(e)&&e.contentUnloaded}function canTraverse$1(e,t){return 0!==t.children.length&&(t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:(t.hasEmptyContent,!0))}function updateAndPushChildren$1(e,t,i,r){for(var n=t.children,a=n.length,o=0;o<a;++o){var s=n[o];s.updateVisibility(r),isVisible$1(s)&&i.push(s)}}function loadTile$1(e,t){(hasUnloadedContent$1(t)||t.contentExpired)&&(t._priority=0,e._requestedTiles.push(t))}function touchTile$1(e,t,i){t._touchedFrame!==i.frameNumber&&(e._cache.touch(t),t._touchedFrame=i.frameNumber)}function visitTile$4(e){++e.statistics.visited}function selectDesiredTile$1(e,t,i){t.contentAvailable&&t.contentVisibility(i)!==Intersect$1.OUTSIDE&&e._selectedTiles.push(t)}function Cesium3DTilesetTraversal(){}function isVisible(e){return e._visible&&e._inRequestVolume}Cesium3DTilesetMostDetailedTraversal.selectTiles=function(e,t){e._selectedTiles.length=0,e._requestedTiles.length=0,e._hasMixedContent=!1;var i=!0,r=e.root;if(r.updateVisibility(t),!isVisible$1(r))return i;var n=traversal$1.stack;for(n.push(e.root);n.length>0;){traversal$1.stackMaximumLength=Math.max(traversal$1.stackMaximumLength,n.length);var a=n.pop(),o=a.refine===Cesium3DTileRefine$1.ADD,s=a.refine===Cesium3DTileRefine$1.REPLACE,l=canTraverse$1(e,a);l&&updateAndPushChildren$1(e,a,n,t),(o||s&&!l)&&(loadTile$1(e,a),touchTile$1(e,a,t),selectDesiredTile$1(e,a,t),hasEmptyContent$1(a)||a.contentAvailable||(i=!1)),visitTile$4(e)}return traversal$1.stack.trim(traversal$1.stackMaximumLength),i};var traversal={stack:new ManagedArray,stackMaximumLength:0},emptyTraversal={stack:new ManagedArray,stackMaximumLength:0},descendantTraversal={stack:new ManagedArray,stackMaximumLength:0},selectionTraversal={stack:new ManagedArray,stackMaximumLength:0,ancestorStack:new ManagedArray,ancestorStackMaximumLength:0},descendantSelectionDepth=2;function executeBaseTraversal(e,t,i){executeTraversal(e,t,e._maximumScreenSpaceError,e._maximumScreenSpaceError,i)}function executeSkipTraversal(e,t,i){executeTraversal(e,t,Number.MAX_VALUE,e._maximumScreenSpaceError,i),traverseAndSelect(e,t,i)}function executeBaseAndSkipTraversal(e,t,i){executeTraversal(e,t,Math.max(e.baseScreenSpaceError,e.maximumScreenSpaceError),e.maximumScreenSpaceError,i),traverseAndSelect(e,t,i)}function skipLevelOfDetail(e){return e._skipLevelOfDetail}function addEmptyTile(e,t){e._emptyTiles.push(t)}function selectTile(e,t,i){if(t.contentVisibility(i)!==Intersect$1.OUTSIDE){var r=t.content;r.featurePropertiesDirty?(r.featurePropertiesDirty=!1,t.lastStyleTime=0,e._selectedTilesToStyle.push(t)):t._selectedFrame<i.frameNumber-1&&e._selectedTilesToStyle.push(t),t._selectedFrame=i.frameNumber,e._selectedTiles.push(t)}}function selectDescendants(e,t,i){var r=descendantTraversal.stack;for(r.push(t);r.length>0;){descendantTraversal.stackMaximumLength=Math.max(descendantTraversal.stackMaximumLength,r.length);for(var n=r.pop().children,a=n.length,o=0;o<a;++o){var s=n[o];isVisible(s)&&(s.contentAvailable?(updateTile(e,s,i),touchTile(e,s,i),selectTile(e,s,i)):s._depth-t._depth<descendantSelectionDepth&&r.push(s))}}}function selectDesiredTile(e,t,i){if(skipLevelOfDetail(e)){var r=t.contentAvailable?t:t._ancestorWithContentAvailable;defined(r)?r._shouldSelect=!0:selectDescendants(e,t,i)}else t.contentAvailable&&selectTile(e,t,i)}function visitTile$3(e,t,i){++e._statistics.visited,t._visitedFrame=i.frameNumber}function touchTile(e,t,i){t._touchedFrame!==i.frameNumber&&(e._cache.touch(t),t._touchedFrame=i.frameNumber)}function updateMinimumMaximumPriority(e,t){e._maximumPriority.distance=Math.max(t._priorityHolder._distanceToCamera,e._maximumPriority.distance),e._minimumPriority.distance=Math.min(t._priorityHolder._distanceToCamera,e._minimumPriority.distance),e._maximumPriority.depth=Math.max(t._depth,e._maximumPriority.depth),e._minimumPriority.depth=Math.min(t._depth,e._minimumPriority.depth),e._maximumPriority.foveatedFactor=Math.max(t._priorityHolder._foveatedFactor,e._maximumPriority.foveatedFactor),e._minimumPriority.foveatedFactor=Math.min(t._priorityHolder._foveatedFactor,e._minimumPriority.foveatedFactor),e._maximumPriority.reverseScreenSpaceError=Math.max(t._priorityReverseScreenSpaceError,e._maximumPriority.reverseScreenSpaceError),e._minimumPriority.reverseScreenSpaceError=Math.min(t._priorityReverseScreenSpaceError,e._minimumPriority.reverseScreenSpaceError)}function isOnScreenLongEnough(e,t,i){if(!e._cullRequestsWhileMoving)return!0;var r=t.boundingSphere,n=Math.max(2*r.radius,1),a=i.camera,o=0!==a.positionWCDeltaMagnitude?a.positionWCDeltaMagnitude:a.positionWCDeltaMagnitudeLastFrame;return e.cullRequestsWhileMovingMultiplier*o/n<1}function loadTile(e,t,i){if(t._requestedFrame!==i.frameNumber&&(hasUnloadedContent(t)||t.contentExpired)&&isOnScreenLongEnough(e,t,i)){var r=i.camera.timeSinceMoved<e.foveatedTimeDelay;t.priorityDeferred&&r||(t._requestedFrame=i.frameNumber,e._requestedTiles.push(t))}}function updateVisibility(e,t,i){t._updatedVisibilityFrame!==e._updatedVisibilityFrame&&(t.updateVisibility(i),t._updatedVisibilityFrame=e._updatedVisibilityFrame)}function anyChildrenVisible(e,t,i){for(var r=!1,n=t.children,a=n.length,o=0;o<a;++o){var s=n[o];updateVisibility(e,s,i),r=r||isVisible(s)}return r}function meetsScreenSpaceErrorEarly(e,t,i){var r=t.parent;return!(!defined(r)||r.hasTilesetContent||r.hasImplicitContent||r.refine!==Cesium3DTileRefine$1.ADD)&&t.getScreenSpaceError(i,!0)<=e._maximumScreenSpaceError}function updateTileVisibility(e,t,i){if(updateVisibility(e,t,i),isVisible(t)){var r=t.children.length>0;if((t.hasTilesetContent||t.hasImplicitContent)&&r){var n=t.children[0];return updateTileVisibility(e,n,i),void(t._visible=n._visible)}if(!meetsScreenSpaceErrorEarly(e,t,i)){var a=t.refine===Cesium3DTileRefine$1.REPLACE,o=t._optimChildrenWithinParent===Cesium3DTileOptimizationHint$1.USE_OPTIMIZATION;return a&&o&&r&&!anyChildrenVisible(e,t,i)?(++e._statistics.numberOfTilesCulledWithChildrenUnion,void(t._visible=!1)):void 0}t._visible=!1}}function updateTile(e,t,i){updateTileVisibility(e,t,i),t.updateExpiration(),t._wasMinPriorityChild=!1,t._priorityHolder=t,updateMinimumMaximumPriority(e,t),t._shouldSelect=!1,t._finalResolution=!0}function updateTileAncestorContentLinks(e,t){e._ancestorWithContent=void 0,e._ancestorWithContentAvailable=void 0;var i=e.parent;if(defined(i)){var r=!hasUnloadedContent(i)||i._requestedFrame===t.frameNumber;e._ancestorWithContent=r?i:i._ancestorWithContent,e._ancestorWithContentAvailable=i.contentAvailable?i:i._ancestorWithContentAvailable}}function hasEmptyContent(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function hasUnloadedContent(e){return!hasEmptyContent(e)&&e.contentUnloaded}function reachedSkippingThreshold(e,t){var i=t._ancestorWithContent;return!e.immediatelyLoadDesiredLevelOfDetail&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf||defined(i)&&t._screenSpaceError<i._screenSpaceError/e.skipScreenSpaceErrorFactor&&t._depth>i._depth+e.skipLevels)}function sortChildrenByDistanceToCamera(e,t){return 0===t._distanceToCamera&&0===e._distanceToCamera?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}function updateAndPushChildren(e,t,i,r){var n,a=t.refine===Cesium3DTileRefine$1.REPLACE,o=t.children,s=o.length;for(n=0;n<s;++n)updateTile(e,o[n],r);o.sort(sortChildrenByDistanceToCamera);var l,c=!skipLevelOfDetail(e)&&a&&!hasEmptyContent(t),u=!0,d=!1,h=-1,p=Number.MAX_VALUE;for(n=0;n<s;++n){var f;if(isVisible(l=o[n])?(i.push(l),l._foveatedFactor<p&&(h=n,p=l._foveatedFactor),d=!0):(c||e.loadSiblings)&&(l._foveatedFactor<p&&(h=n,p=l._foveatedFactor),loadTile(e,l,r),touchTile(e,l,r)),c)f=!!l._inRequestVolume&&(hasEmptyContent(l)?executeEmptyTraversal(e,l,r):l.contentAvailable),u=u&&f}if(d||(u=!1),-1!==h&&!skipLevelOfDetail(e)&&a){var m=o[h];m._wasMinPriorityChild=!0;var g=(t._wasMinPriorityChild||t===e.root)&&p<=t._priorityHolder._foveatedFactor?t._priorityHolder:t;for(g._foveatedFactor=Math.min(m._foveatedFactor,g._foveatedFactor),g._distanceToCamera=Math.min(m._distanceToCamera,g._distanceToCamera),n=0;n<s;++n)(l=o[n])._priorityHolder=g}return u}function inBaseTraversal(e,t,i){return!skipLevelOfDetail(e)||!e.immediatelyLoadDesiredLevelOfDetail&&(!defined(t._ancestorWithContent)||(0===t._screenSpaceError?t.parent._screenSpaceError>i:t._screenSpaceError>i))}function canTraverse(e,t){return 0!==t.children.length&&(t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:t._screenSpaceError>e._maximumScreenSpaceError)}function executeTraversal(e,t,i,r,n){var a=traversal.stack;for(a.push(t);a.length>0;){traversal.stackMaximumLength=Math.max(traversal.stackMaximumLength,a.length);var o=a.pop();updateTileAncestorContentLinks(o,n);var s=inBaseTraversal(e,o,i),l=o.refine===Cesium3DTileRefine$1.ADD,c=o.refine===Cesium3DTileRefine$1.REPLACE,u=o.parent,d=!defined(u)||u._refines,h=!1;canTraverse(e,o)&&(h=updateAndPushChildren(e,o,a,n)&&d);var p=!h&&d;hasEmptyContent(o)?(addEmptyTile(e,o),loadTile(e,o,n),p&&selectDesiredTile(e,o,n)):l?(selectDesiredTile(e,o,n),loadTile(e,o,n)):c&&(s?(loadTile(e,o,n),p&&selectDesiredTile(e,o,n)):p?(selectDesiredTile(e,o,n),loadTile(e,o,n)):reachedSkippingThreshold(e,o)&&loadTile(e,o,n)),visitTile$3(e,o,n),touchTile(e,o,n),o._refines=h}}function executeEmptyTraversal(e,t,i){var r=!0,n=emptyTraversal.stack;for(n.push(t);n.length>0;){emptyTraversal.stackMaximumLength=Math.max(emptyTraversal.stackMaximumLength,n.length);var a=n.pop(),o=a.children,s=o.length,l=hasEmptyContent(a),c=l&&canTraverse(e,a),u=l&&0===a.children.length;if(c||a.contentAvailable||u||(r=!1),updateTile(e,a,i),isVisible(a)||(loadTile(e,a,i),touchTile(e,a,i)),c)for(var d=0;d<s;++d){var h=o[d];n.push(h)}}return r}function traverseAndSelect(e,t,i){var r,n=selectionTraversal.stack,a=selectionTraversal.ancestorStack;for(n.push(t);n.length>0||a.length>0;){if(selectionTraversal.stackMaximumLength=Math.max(selectionTraversal.stackMaximumLength,n.length),selectionTraversal.ancestorStackMaximumLength=Math.max(selectionTraversal.ancestorStackMaximumLength,a.length),a.length>0){var o=a.peek();if(o._stackLength===n.length){a.pop(),o!==r&&(o._finalResolution=!1),selectTile(e,o,i);continue}}var s=n.pop();if(defined(s)){var l=s.refine===Cesium3DTileRefine$1.ADD,c=s._shouldSelect,u=s.children,d=u.length,h=canTraverse(e,s);if(c)if(l)selectTile(e,s,i);else{if(s._selectionDepth=a.length,s._selectionDepth>0&&(e._hasMixedContent=!0),r=s,!h){selectTile(e,s,i);continue}a.push(s),s._stackLength=n.length}if(h)for(var p=0;p<d;++p){var f=u[p];isVisible(f)&&n.push(f)}}}}Cesium3DTilesetTraversal.selectTiles=function(e,t){if(e._requestedTiles.length=0,!e.debugFreezeFrame){e._selectedTiles.length=0,e._selectedTilesToStyle.length=0,e._emptyTiles.length=0,e._hasMixedContent=!1;var i=e.root;if(updateTile(e,i,t),isVisible(i)&&!(i.getScreenSpaceError(t,!0)<=e._maximumScreenSpaceError)){skipLevelOfDetail(e)?e.immediatelyLoadDesiredLevelOfDetail?executeSkipTraversal(e,i,t):executeBaseAndSkipTraversal(e,i,t):executeBaseTraversal(e,i,t),traversal.stack.trim(traversal.stackMaximumLength),emptyTraversal.stack.trim(emptyTraversal.stackMaximumLength),descendantTraversal.stack.trim(descendantTraversal.stackMaximumLength),selectionTraversal.stack.trim(selectionTraversal.stackMaximumLength),selectionTraversal.ancestorStack.trim(selectionTraversal.ancestorStackMaximumLength);for(var r=e._requestedTiles,n=r.length,a=0;a<n;++a)r[a].updatePriority()}}};var Cesium3DTilePass={RENDER:0,PICK:1,SHADOW:2,PRELOAD:3,PRELOAD_FLIGHT:4,REQUEST_RENDER_MODE_DEFER_CHECK:5,MOST_DETAILED_PRELOAD:6,MOST_DETAILED_PICK:7,NUMBER_OF_PASSES:8},passOptions=new Array(Cesium3DTilePass.NUMBER_OF_PASSES);passOptions[Cesium3DTilePass.RENDER]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!0,requestTiles:!0,ignoreCommands:!1}),passOptions[Cesium3DTilePass.PICK]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!1,ignoreCommands:!1}),passOptions[Cesium3DTilePass.SHADOW]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!1}),passOptions[Cesium3DTilePass.PRELOAD]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.PRELOAD_FLIGHT]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.REQUEST_RENDER_MODE_DEFER_CHECK]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.MOST_DETAILED_PRELOAD]=Object.freeze({traversal:Cesium3DTilesetMostDetailedTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.MOST_DETAILED_PICK]=Object.freeze({traversal:Cesium3DTilesetMostDetailedTraversal,isRender:!1,requestTiles:!1,ignoreCommands:!1}),Cesium3DTilePass.getPassOptions=function(e){return passOptions[e]};var Cesium3DTilePass$1=Object.freeze(Cesium3DTilePass);function Empty3DTileContent(e,t){this._tileset=e,this._tile=t,this.featurePropertiesDirty=!1}function findGroupMetadata(e,t){if(hasExtension(t,"3DTILES_metadata")){var i=t.extensions["3DTILES_metadata"].group;return e.metadata.groups[i]}}function preprocess3DTileContent(e){var t=new Uint8Array(e),i=getMagic(t);if("glTF"===i&&(i="glb"),Cesium3DTileContentType$1.isBinaryFormat(i))return{contentType:i,binaryPayload:t};var r=getJsonContent(t);if(defined(r.root))return{contentType:Cesium3DTileContentType$1.EXTERNAL_TILESET,jsonPayload:r};if(defined(r.asset))return{contentType:Cesium3DTileContentType$1.GLTF,jsonPayload:r};throw new RuntimeError("Invalid tile content.")}function getJsonContent(e){var t;try{t=getJsonFromTypedArray(e)}catch(e){throw new RuntimeError("Invalid tile content.")}return t}function Multiple3DTileContent(e,t,i,r){this._tileset=e,this._tile=t,this._tilesetResource=i,this._contents=[];var n=r.content;this._innerContentHeaders=n,this._requestsInFlight=0,this._cancelCount=0;var a=this._innerContentHeaders.length;this._arrayFetchPromises=new Array(a),this._requests=new Array(a),this._innerContentResources=new Array(a),this._serverKeys=new Array(a);for(var o=0;o<a;o++){var s=i.getDerivedResource({url:n[o].uri}),l=RequestScheduler.getServerKey(s.getUrlComponent());this._innerContentResources[o]=s,this._serverKeys[o]=l}this._contentsFetchedPromise=void 0,this._readyPromise=when.defer()}function updatePendingRequests(e,t){e._requestsInFlight+=t,e.tileset.statistics.numberOfPendingRequests+=t}function cancelPendingRequests(e,t){e._cancelCount++,e._tile._contentState=t,e.tileset.statistics.numberOfPendingRequests-=e._requestsInFlight,e._requestsInFlight=0;var i=e._innerContentHeaders.length;e._arrayFetchPromises=new Array(i)}function canScheduleAllRequests(e){for(var t={},i=0;i<e.length;i++){var r=e[i];defined(t[r])?t[r]++:t[r]=1}for(var n in t)if(t.hasOwnProperty(n)&&!RequestScheduler.serverHasOpenSlots(n,t[n]))return!1;return RequestScheduler.heapHasOpenSlots(e.length)}function requestInnerContent(e,t,i,r){var n=e._innerContentResources[t].clone(),a=e.tile,o=e._serverKeys[t],s=new Request({throttle:!0,throttleByServer:!0,type:RequestType$1.TILES3D,priorityFunction:function(){return a._priority},serverKey:o});return n.request=s,e._requests[t]=s,n.fetchArrayBuffer().then((function(t){if(!(i<e._cancelCount))return updatePendingRequests(e,-1),t})).otherwise((function(a){i<e._cancelCount||(n.request.state!==RequestState$1.CANCELLED?(updatePendingRequests(e,-1),handleInnerContentFailed(e,t,a)):cancelPendingRequests(e,r))}))}function createInnerContents(e){var t=e._cancelCount;when.all(e._arrayFetchPromises).then((function(i){if(!(t<e._cancelCount))return i.map((function(t,i){if(defined(t))try{return createInnerContent(e,t,i)}catch(t){return void handleInnerContentFailed(e,i,t)}}))})).then((function(t){defined(t)?(e._contents=t.filter(defined),awaitReadyPromises(e),defined(e._contentsFetchedPromise)&&e._contentsFetchedPromise.resolve()):defined(e._contentsFetchedPromise)&&(e._contentsFetchedPromise.resolve(),e._contentsFetchedPromise=void 0)})).otherwise((function(t){defined(e._contentsFetchedPromise)&&e._contentsFetchedPromise.reject(t)}))}function createInnerContent(e,t,i){var r=preprocess3DTileContent(t);if(r.contentType===Cesium3DTileContentType$1.EXTERNAL_TILESET)throw new RuntimeError("External tilesets are disallowed inside the 3DTILES_multiple_contents extension");e._disableSkipLevelOfDetail=e._disableSkipLevelOfDetail||r.contentType===Cesium3DTileContentType$1.GEOMETRY||r.contentType===Cesium3DTileContentType$1.VECTOR;var n,a=e._tileset,o=e._innerContentResources[i],s=Cesium3DTileContentFactory[r.contentType];n=defined(r.binaryPayload)?s(a,e._tile,o,r.binaryPayload.buffer,0):s(a,e._tile,o,r.jsonPayload);var l=e._innerContentHeaders[i];return n.groupMetadata=findGroupMetadata(a,l),n}function awaitReadyPromises(e){var t=e._contents.map((function(e){return e.readyPromise}));when.all(t).then((function(){e._readyPromise.resolve(e)})).otherwise((function(t){e._readyPromise.reject(t)}))}function handleInnerContentFailed(e,t,i){var r=e._tileset,n=e._innerContentResources[t].url,a=defined(i.message)?i.message:i.toString();r.tileFailed.numberOfListeners>0?r.tileFailed.raiseEvent({url:n,message:a}):(console.log("A content failed to load: "+n),console.log("Error: "+a))}function TileBoundingRegion(e){this.rectangle=Rectangle.clone(e.rectangle),this.minimumHeight=defaultValue(e.minimumHeight,0),this.maximumHeight=defaultValue(e.maximumHeight,0),this.southwestCornerCartesian=new Cartesian3,this.northeastCornerCartesian=new Cartesian3,this.westNormal=new Cartesian3,this.southNormal=new Cartesian3,this.eastNormal=new Cartesian3,this.northNormal=new Cartesian3;var t=defaultValue(e.ellipsoid,Ellipsoid.WGS84);computeBox(this,e.rectangle,t),this._orientedBoundingBox=void 0,this._boundingSphere=void 0,defaultValue(e.computeBoundingVolumes,!0)&&this.computeBoundingVolumes(t)}Object.defineProperties(Empty3DTileContent.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},batchTable:{get:function(){}},groupMetadata:{get:function(){},set:function(e){throw new DeveloperError("Empty3DTileContent cannot have group metadata")}}}),Empty3DTileContent.prototype.hasProperty=function(e,t){return!1},Empty3DTileContent.prototype.getFeature=function(e){},Empty3DTileContent.prototype.applyDebugSettings=function(e,t){},Empty3DTileContent.prototype.applyStyle=function(e){},Empty3DTileContent.prototype.update=function(e,t){},Empty3DTileContent.prototype.isDestroyed=function(){return!1},Empty3DTileContent.prototype.destroy=function(){return destroyObject(this)},Object.defineProperties(Multiple3DTileContent.prototype,{featurePropertiesDirty:{get:function(){for(var e=this._contents,t=e.length,i=0;i<t;++i)if(e[i].featurePropertiesDirty)return!0;return!1},set:function(e){for(var t=this._contents,i=t.length,r=0;r<i;++r)t[r].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},batchTable:{get:function(){}},groupMetadata:{get:function(){},set:function(){throw new DeveloperError("Multiple3DTileContent cannot have group metadata")}},innerContentUrls:{get:function(){return this._innerContentHeaders.map((function(e){return e.uri}))}},contentsFetchedPromise:{get:function(){if(defined(this._contentsFetchedPromise))return this._contentsFetchedPromise.promise}}}),Multiple3DTileContent.prototype.requestInnerContents=function(){if(!canScheduleAllRequests(this._serverKeys))return this._serverKeys.length;var e=this._innerContentHeaders;updatePendingRequests(this,e.length);for(var t=0;t<e.length;t++)this._arrayFetchPromises[t]=requestInnerContent(this,t,this._cancelCount,this._tile._contentState);return defined(this._contentsFetchedPromise)||(this._contentsFetchedPromise=when.defer()),createInnerContents(this),0},Multiple3DTileContent.prototype.cancelRequests=function(){for(var e=0;e<this._requests.length;e++){var t=this._requests[e];defined(t)&&t.cancel()}},Multiple3DTileContent.prototype.hasProperty=function(e,t){return!1},Multiple3DTileContent.prototype.getFeature=function(e){},Multiple3DTileContent.prototype.applyDebugSettings=function(e,t){for(var i=this._contents,r=i.length,n=0;n<r;++n)i[n].applyDebugSettings(e,t)},Multiple3DTileContent.prototype.applyStyle=function(e){for(var t=this._contents,i=t.length,r=0;r<i;++r)t[r].applyStyle(e)},Multiple3DTileContent.prototype.update=function(e,t){for(var i=this._contents,r=i.length,n=0;n<r;++n)i[n].update(e,t)},Multiple3DTileContent.prototype.isDestroyed=function(){return!1},Multiple3DTileContent.prototype.destroy=function(){for(var e=this._contents,t=e.length,i=0;i<t;++i)e[i].destroy();return destroyObject(this)},Object.defineProperties(TileBoundingRegion.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}}),TileBoundingRegion.prototype.computeBoundingVolumes=function(e){this._orientedBoundingBox=OrientedBoundingBox.fromRectangle(this.rectangle,this.minimumHeight,this.maximumHeight,e),this._boundingSphere=BoundingSphere.fromOrientedBoundingBox(this._orientedBoundingBox)};var cartesian3Scratch$1=new Cartesian3,cartesian3Scratch2=new Cartesian3,cartesian3Scratch3=new Cartesian3,eastWestNormalScratch=new Cartesian3,westernMidpointScratch=new Cartesian3,easternMidpointScratch=new Cartesian3,cartographicScratch$3=new Cartographic,planeScratch=new Plane(Cartesian3.UNIT_X,0),rayScratch=new Ray;function computeBox(e,t,i){i.cartographicToCartesian(Rectangle.southwest(t),e.southwestCornerCartesian),i.cartographicToCartesian(Rectangle.northeast(t),e.northeastCornerCartesian),cartographicScratch$3.longitude=t.west,cartographicScratch$3.latitude=.5*(t.south+t.north),cartographicScratch$3.height=0;var r=i.cartographicToCartesian(cartographicScratch$3,westernMidpointScratch),n=Cartesian3.cross(r,Cartesian3.UNIT_Z,cartesian3Scratch$1);Cartesian3.normalize(n,e.westNormal),cartographicScratch$3.longitude=t.east;var a=i.cartographicToCartesian(cartographicScratch$3,easternMidpointScratch),o=Cartesian3.cross(Cartesian3.UNIT_Z,a,cartesian3Scratch$1);Cartesian3.normalize(o,e.eastNormal);var s,l=Cartesian3.subtract(r,a,cartesian3Scratch$1),c=Cartesian3.normalize(l,eastWestNormalScratch),u=t.south;if(u>0){cartographicScratch$3.longitude=.5*(t.west+t.east),cartographicScratch$3.latitude=u;var d=i.cartographicToCartesian(cartographicScratch$3,rayScratch.origin);Cartesian3.clone(c,rayScratch.direction);var h=Plane.fromPointNormal(e.southwestCornerCartesian,e.westNormal,planeScratch);IntersectionTests.rayPlane(rayScratch,h,e.southwestCornerCartesian),s=i.geodeticSurfaceNormal(d,cartesian3Scratch2)}else s=i.geodeticSurfaceNormalCartographic(Rectangle.southeast(t),cartesian3Scratch2);var p=Cartesian3.cross(s,l,cartesian3Scratch3);Cartesian3.normalize(p,e.southNormal);var f,m=t.north;if(m<0){cartographicScratch$3.longitude=.5*(t.west+t.east),cartographicScratch$3.latitude=m;var g=i.cartographicToCartesian(cartographicScratch$3,rayScratch.origin);Cartesian3.negate(c,rayScratch.direction);var _=Plane.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,planeScratch);IntersectionTests.rayPlane(rayScratch,_,e.northeastCornerCartesian),f=i.geodeticSurfaceNormal(g,cartesian3Scratch2)}else f=i.geodeticSurfaceNormalCartographic(Rectangle.northwest(t),cartesian3Scratch2);var y=Cartesian3.cross(l,f,cartesian3Scratch3);Cartesian3.normalize(y,e.northNormal)}var southwestCornerScratch=new Cartesian3,northeastCornerScratch=new Cartesian3,negativeUnitY=new Cartesian3(0,-1,0),negativeUnitZ=new Cartesian3(0,0,-1),vectorScratch=new Cartesian3;function distanceToCameraRegion(e,t){var i,r,n,a=t.camera,o=a.positionWC,s=a.positionCartographic,l=0;if(!Rectangle.contains(e.rectangle,s)){var c=e.southwestCornerCartesian,u=e.northeastCornerCartesian,d=e.westNormal,h=e.southNormal,p=e.eastNormal,f=e.northNormal;t.mode!==SceneMode$1.SCENE3D&&((c=t.mapProjection.project(Rectangle.southwest(e.rectangle),southwestCornerScratch)).z=c.y,c.y=c.x,c.x=0,(u=t.mapProjection.project(Rectangle.northeast(e.rectangle),northeastCornerScratch)).z=u.y,u.y=u.x,u.x=0,d=negativeUnitY,p=Cartesian3.UNIT_Y,h=negativeUnitZ,f=Cartesian3.UNIT_Z);var m=Cartesian3.subtract(o,c,vectorScratch),g=Cartesian3.dot(m,d),_=Cartesian3.dot(m,h),y=Cartesian3.subtract(o,u,vectorScratch),v=Cartesian3.dot(y,p),C=Cartesian3.dot(y,f);g>0?l+=g*g:v>0&&(l+=v*v),_>0?l+=_*_:C>0&&(l+=C*C)}if(t.mode===SceneMode$1.SCENE3D?(i=s.height,r=e.minimumHeight,n=e.maximumHeight):(i=o.x,r=0,n=0),i>n){var T=i-n;l+=T*T}else if(i<r){var S=r-i;l+=S*S}return Math.sqrt(l)}TileBoundingRegion.prototype.distanceToCamera=function(e){var t=distanceToCameraRegion(this,e);if(e.mode===SceneMode$1.SCENE3D&&defined(this._orientedBoundingBox)){var i=Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC));return Math.max(t,i)}return t},TileBoundingRegion.prototype.intersectPlane=function(e){return this._orientedBoundingBox.intersectPlane(e)},TileBoundingRegion.prototype.createDebugVolume=function(e){var t=new Matrix4.clone(Matrix4.IDENTITY);return new Primitive$2({geometryInstances:new GeometryInstance({geometry:new RectangleOutlineGeometry({rectangle:this.rectangle,height:this.minimumHeight,extrudedHeight:this.maximumHeight}),id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})};var centerCartographicScratch$1=new Cartographic;function TileBoundingS2Cell(e){var t=S2Cell.fromToken(e.token),i=defaultValue(e.minimumHeight,0),r=defaultValue(e.maximumHeight,0),n=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this.s2Cell=t,this.minimumHeight=i,this.maximumHeight=r,this.ellipsoid=n;var a=computeBoundingPlanes(t,i,r,n);this._boundingPlanes=a;var o,s=computeVertices(a);for(this._vertices=s,this._edgeNormals=new Array(6),this._edgeNormals[0]=computeEdgeNormals(a[0],s.slice(0,4)),o=0;o<4;o++)this._edgeNormals[0][o]=Cartesian3.negate(this._edgeNormals[0][o],this._edgeNormals[0][o]);for(this._edgeNormals[1]=computeEdgeNormals(a[1],s.slice(4,8)),o=0;o<4;o++)this._edgeNormals[2+o]=computeEdgeNormals(a[2+o],[s[o%4],s[(o+1)%4],s[4+(o+1)%4],s[4+o]]);for(this._planeVertices=[this._vertices.slice(0,4),this._vertices.slice(4,8)],o=0;o<4;o++)this._planeVertices.push([this._vertices[o%4],this._vertices[(o+1)%4],this._vertices[4+(o+1)%4],this._vertices[4+o]]);var l=t.getCenter();(centerCartographicScratch$1=n.cartesianToCartographic(l,centerCartographicScratch$1)).height=(r+i)/2,this.center=n.cartographicToCartesian(centerCartographicScratch$1,l),this._boundingSphere=BoundingSphere.fromPoints(s)}var centerGeodeticNormalScratch=new Cartesian3,topCartographicScratch=new Cartographic,topScratch=new Cartesian3,vertexCartographicScratch=new Cartographic,vertexScratch=new Cartesian3,vertexGeodeticNormalScratch=new Cartesian3,sideNormalScratch=new Cartesian3,sideScratch=new Cartesian3;function computeBoundingPlanes(e,t,i,r){var n=new Array(6),a=e.getCenter(),o=r.geodeticSurfaceNormal(a,centerGeodeticNormalScratch),s=r.cartesianToCartographic(a,topCartographicScratch);s.height=i;var l=r.cartographicToCartesian(s,topScratch),c=Plane.fromPointNormal(l,o);n[0]=c;var u,d,h,p=0,f=[];for(u=0;u<4;u++){d=e.getVertex(u),f[u]=d,(h=r.cartesianToCartographic(d,vertexCartographicScratch)).height=t;var m=Plane.getPointDistance(c,r.cartographicToCartesian(h,vertexScratch));m<p&&(p=m)}var g=Plane.clone(c);for(g.normal=Cartesian3.negate(g.normal,g.normal),g.distance=-1*g.distance+p,n[1]=g,u=0;u<4;u++){d=f[u];var _=f[(u+1)%4],y=r.geodeticSurfaceNormal(d,vertexGeodeticNormalScratch),v=Cartesian3.subtract(_,d,sideScratch),C=Cartesian3.cross(v,y,sideNormalScratch);C=Cartesian3.normalize(C,C),n[2+u]=Plane.fromPointNormal(d,C)}return n}var n0Scratch=new Cartesian3,n1Scratch=new Cartesian3,n2Scratch=new Cartesian3,x0Scratch=new Cartesian3,x1Scratch=new Cartesian3,x2Scratch=new Cartesian3,t0Scratch=new Cartesian3,t1Scratch=new Cartesian3,t2Scratch=new Cartesian3,f0Scratch=new Cartesian3,f1Scratch=new Cartesian3,f2Scratch=new Cartesian3,sScratch=new Cartesian3,matrixScratch=new Matrix3;function computeIntersection(e,t,i){n0Scratch=e.normal,n1Scratch=t.normal,n2Scratch=i.normal,x0Scratch=Cartesian3.multiplyByScalar(e.normal,-e.distance,x0Scratch),x1Scratch=Cartesian3.multiplyByScalar(t.normal,-t.distance,x1Scratch),x2Scratch=Cartesian3.multiplyByScalar(i.normal,-i.distance,x2Scratch),f0Scratch=Cartesian3.multiplyByScalar(Cartesian3.cross(n1Scratch,n2Scratch,t0Scratch),Cartesian3.dot(x0Scratch,n0Scratch),f0Scratch),f1Scratch=Cartesian3.multiplyByScalar(Cartesian3.cross(n2Scratch,n0Scratch,t1Scratch),Cartesian3.dot(x1Scratch,n1Scratch),f1Scratch),f2Scratch=Cartesian3.multiplyByScalar(Cartesian3.cross(n0Scratch,n1Scratch,t2Scratch),Cartesian3.dot(x2Scratch,n2Scratch),f2Scratch),matrixScratch[0]=n0Scratch.x,matrixScratch[1]=n1Scratch.x,matrixScratch[2]=n2Scratch.x,matrixScratch[3]=n0Scratch.y,matrixScratch[4]=n1Scratch.y,matrixScratch[5]=n2Scratch.y,matrixScratch[6]=n0Scratch.z,matrixScratch[7]=n1Scratch.z,matrixScratch[8]=n2Scratch.z;var r=Matrix3.determinant(matrixScratch);return sScratch=Cartesian3.add(f0Scratch,f1Scratch,sScratch),sScratch=Cartesian3.add(sScratch,f2Scratch,sScratch),new Cartesian3(sScratch.x/r,sScratch.y/r,sScratch.z/r)}function computeVertices(e){for(var t=new Array(8),i=0;i<4;i++)t[i]=computeIntersection(e[0],e[2+(i+3)%4],e[2+i%4]),t[i+4]=computeIntersection(e[1],e[2+(i+3)%4],e[2+i%4]);return t}var edgeScratch=new Cartesian3,edgeNormalScratch=new Cartesian3;function computeEdgeNormals(e,t){for(var i=[],r=0;r<4;r++)edgeScratch=Cartesian3.subtract(t[(r+1)%4],t[r],edgeScratch),edgeNormalScratch=Cartesian3.cross(e.normal,edgeScratch,edgeNormalScratch),edgeNormalScratch=Cartesian3.normalize(edgeNormalScratch,edgeNormalScratch),i[r]=Cartesian3.clone(edgeNormalScratch);return i}Object.defineProperties(TileBoundingS2Cell.prototype,{boundingVolume:{get:function(){return this}},boundingSphere:{get:function(){return this._boundingSphere}}});var facePointScratch=new Cartesian3;TileBoundingS2Cell.prototype.distanceToCamera=function(e){var t,i,r,n,a,o,s=e.camera.positionWC,l=[],c=[];for(Plane.getPointDistance(this._boundingPlanes[0],s)>0?(l.push(0),c.push(this._planeVertices[0]),t=this._edgeNormals[0]):Plane.getPointDistance(this._boundingPlanes[1],s)>0&&(l.push(1),c.push(this._planeVertices[1]),t=this._edgeNormals[1]),i=0;i<4;i++)r=2+i,Plane.getPointDistance(this._boundingPlanes[r],s)>0&&(l.push(r),c.push(this._planeVertices[r]),t=this._edgeNormals[r]);if(0===l.length)return 0;if(1===l.length)return o=this._boundingPlanes[l[0]],a=closestPointPolygon(Plane.projectPointOntoPlane(o,s,facePointScratch),c[0],o,t),Cartesian3.distance(a,s);if(2===l.length){if(0===l[0]){var u=[this._vertices[4*l[0]+(l[1]-2)],this._vertices[4*l[0]+(l[1]-2+1)%4]];return a=closestPointLineSegment(s,u[0],u[1]),Cartesian3.distance(a,s)}var d,h=Number.MAX_VALUE;for(i=0;i<2;i++)o=this._boundingPlanes[l[i]],a=closestPointPolygon(Plane.projectPointOntoPlane(o,s,facePointScratch),c[i],o,this._edgeNormals[l[i]]),(d=Cartesian3.distanceSquared(a,s))<h&&(h=d);return Math.sqrt(h)}return l.length>3?(a=closestPointPolygon(Plane.projectPointOntoPlane(this._boundingPlanes[1],s,facePointScratch),this._planeVertices[1],this._boundingPlanes[1],this._edgeNormals[1]),Cartesian3.distance(a,s)):(n=2===l[1]&&5===l[2]?0:1,0===l[0]?Cartesian3.distance(s,this._vertices[(l[1]-2+n)%4]):Cartesian3.distance(s,this._vertices[4+(l[1]-2+n)%4]))};var dScratch=new Cartesian3,pL0Scratch=new Cartesian3;function closestPointLineSegment(e,t,i){var r=Cartesian3.subtract(i,t,dScratch),n=Cartesian3.subtract(e,t,pL0Scratch),a=Cartesian3.dot(r,n);if(a<=0)return t;var o=Cartesian3.dot(r,r);return a>=o?i:new Cartesian3((1-(a/=o))*t.x+a*i.x,(1-a)*t.y+a*i.y,(1-a)*t.z+a*i.z)}var edgePlaneScratch=new Plane(Cartesian3.UNIT_X,0);function closestPointPolygon(e,t,i,r){for(var n,a,o,s=Number.MAX_VALUE,l=0;l<t.length;l++){var c=Plane.fromPointNormal(t[l],r[l],edgePlaneScratch);Plane.getPointDistance(c,e)<0||(o=closestPointLineSegment(e,t[l],t[(l+1)%4]),(n=Cartesian3.distance(e,o))<s&&(s=n,a=o))}return defined(a)?a:e}function TileBoundingSphere(e,t){0===t&&(t=CesiumMath.EPSILON7),this._boundingSphere=new BoundingSphere(e,t)}function TileMetadata(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._class=e.class;var t=e.tile;this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}TileBoundingS2Cell.prototype.intersectPlane=function(e){for(var t=0,i=0,r=0;r<this._vertices.length;r++){Cartesian3.dot(e.normal,this._vertices[r])+e.distance<0?i++:t++}return t===this._vertices.length?Intersect$1.INSIDE:i===this._vertices.length?Intersect$1.OUTSIDE:Intersect$1.INTERSECTING},TileBoundingS2Cell.prototype.createDebugVolume=function(e){for(var t=new Matrix4.clone(Matrix4.IDENTITY),i=new CoplanarPolygonOutlineGeometry({polygonHierarchy:{positions:this._planeVertices[0]}}),r=new GeometryInstance({geometry:CoplanarPolygonOutlineGeometry.createGeometry(i),id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),n=new CoplanarPolygonOutlineGeometry({polygonHierarchy:{positions:this._planeVertices[1]}}),a=new GeometryInstance({geometry:CoplanarPolygonOutlineGeometry.createGeometry(n),id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),o=[],s=0;s<4;s++){var l=new CoplanarPolygonOutlineGeometry({polygonHierarchy:{positions:this._planeVertices[2+s]}}),c=CoplanarPolygonOutlineGeometry.createGeometry(l);o[s]=new GeometryInstance({geometry:c,id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}})}return new Primitive$2({geometryInstances:[o[0],o[1],o[2],o[3],a,r],appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})},Object.defineProperties(TileBoundingSphere.prototype,{center:{get:function(){return this._boundingSphere.center}},radius:{get:function(){return this._boundingSphere.radius}},boundingVolume:{get:function(){return this._boundingSphere}},boundingSphere:{get:function(){return this._boundingSphere}}}),TileBoundingSphere.prototype.distanceToCamera=function(e){var t=this._boundingSphere;return Math.max(0,Cartesian3.distance(t.center,e.camera.positionWC)-t.radius)},TileBoundingSphere.prototype.intersectPlane=function(e){return BoundingSphere.intersectPlane(this._boundingSphere,e)},TileBoundingSphere.prototype.update=function(e,t){Cartesian3.clone(e,this._boundingSphere.center),this._boundingSphere.radius=t},TileBoundingSphere.prototype.createDebugVolume=function(e){return new Primitive$2({geometryInstances:new GeometryInstance({geometry:new SphereOutlineGeometry({radius:this.radius}),id:"outline",modelMatrix:Matrix4.fromTranslation(this.center,new Matrix4.clone(Matrix4.IDENTITY)),attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})},Object.defineProperties(TileMetadata.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),TileMetadata.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},TileMetadata.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},TileMetadata.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},TileMetadata.prototype.getProperty=function(e){return MetadataEntity.getProperty(e,this._properties,this._class)},TileMetadata.prototype.setProperty=function(e,t){return MetadataEntity.setProperty(e,t,this._properties,this._class)},TileMetadata.prototype.getPropertyBySemantic=function(e){return MetadataEntity.getPropertyBySemantic(e,this._properties,this._class)},TileMetadata.prototype.setPropertyBySemantic=function(e,t){return MetadataEntity.setPropertyBySemantic(e,t,this._properties,this._class)};var scratchU=new Cartesian3,scratchV=new Cartesian3,scratchW=new Cartesian3,scratchCartesian$6=new Cartesian3;function computeMissingVector(e,t,i){i=Cartesian3.cross(e,t,i);var r=Cartesian3.magnitude(i);return Cartesian3.multiplyByScalar(i,CesiumMath.EPSILON7/r,i)}function findOrthogonalVector(e,t){var i=Cartesian3.normalize(e,scratchCartesian$6);return computeMissingVector(e,Cartesian3.equalsEpsilon(i,Cartesian3.UNIT_X,CesiumMath.EPSILON6)?Cartesian3.UNIT_Y:Cartesian3.UNIT_X,t)}function checkHalfAxes(e){var t=Matrix3.getColumn(e,0,scratchU),i=Matrix3.getColumn(e,1,scratchV),r=Matrix3.getColumn(e,2,scratchW),n=Cartesian3.equals(t,Cartesian3.ZERO),a=Cartesian3.equals(i,Cartesian3.ZERO),o=Cartesian3.equals(r,Cartesian3.ZERO);return n||a||o?n&&a&&o?(e[0]=CesiumMath.EPSILON7,e[4]=CesiumMath.EPSILON7,e[8]=CesiumMath.EPSILON7,e):(!n||a||o?n||!a||o?n||a||!o?n?a?o||(i=computeMissingVector(r,t=findOrthogonalVector(r,t),i)):r=computeMissingVector(i,t=findOrthogonalVector(i,t),r):r=computeMissingVector(i=findOrthogonalVector(t,i),t,r):r=computeMissingVector(i,t,r):i=computeMissingVector(t,r,i):t=computeMissingVector(i,r,t),Matrix3.setColumn(e,0,t,e),Matrix3.setColumn(e,1,i,e),Matrix3.setColumn(e,2,r,e),e):e}function TileOrientedBoundingBox(e,t){t=checkHalfAxes(t),this._orientedBoundingBox=new OrientedBoundingBox(e,t),this._boundingSphere=BoundingSphere.fromOrientedBoundingBox(this._orientedBoundingBox)}function Cesium3DTile(e,t,i,r){this._tileset=e,this._header=i;var n=i.content;this.transform=defined(i.transform)?Matrix4.unpack(i.transform):Matrix4.clone(Matrix4.IDENTITY);var a,o,s,l,c=defined(r)?r.computedTransform:e.modelMatrix,u=Matrix4.multiply(c,this.transform,new Matrix4),d=defined(r)?r._initialTransform:Matrix4.IDENTITY;this._initialTransform=Matrix4.multiply(d,this.transform,new Matrix4),this.computedTransform=u,this._boundingVolume=this.createBoundingVolume(i.boundingVolume,u),this._boundingVolume2D=void 0,defined(n)&&defined(n.boundingVolume)&&(a=this.createBoundingVolume(n.boundingVolume,u)),this._contentBoundingVolume=a,this._contentBoundingVolume2D=void 0,defined(i.viewerRequestVolume)&&(o=this.createBoundingVolume(i.viewerRequestVolume,u)),this._viewerRequestVolume=o,this.geometricError=i.geometricError,this._geometricError=i.geometricError,defined(this._geometricError)||(this._geometricError=defined(r)?r.geometricError:e._geometricError,Cesium3DTile._deprecationWarning("geometricErrorUndefined","Required property geometricError is undefined for this tile. Using parent's geometric error instead.")),this.updateGeometricErrorScale(),defined(i.refine)?("replace"!==i.refine&&"add"!==i.refine||Cesium3DTile._deprecationWarning("lowercase-refine",'This tile uses a lowercase refine "'+i.refine+'". Instead use "'+i.refine.toUpperCase()+'".'),s="REPLACE"===i.refine.toUpperCase()?Cesium3DTileRefine$1.REPLACE:Cesium3DTileRefine$1.ADD):s=defined(r)?r.refine:Cesium3DTileRefine$1.REPLACE,this.refine=s,this.children=[],this.parent=r;var h,p,f,m,g=!1,_=!1;if(t=Resource.createIfNeeded(t),hasExtension(i,"3DTILES_multiple_contents"))_=!0,h=Cesium3DTileContentState$1.UNLOADED,p=t.clone();else if(defined(n)){var y=n.uri;defined(n.url)&&(Cesium3DTile._deprecationWarning("contentUrl",'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'),y=n.url),h=Cesium3DTileContentState$1.UNLOADED,p=t.getDerivedResource({url:y}),f=RequestScheduler.getServerKey(p.getUrlComponent())}else l=new Empty3DTileContent(e,this),g=!0,h=Cesium3DTileContentState$1.READY;if(this._content=l,this._contentResource=p,this._contentState=h,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this._expiredContent=void 0,this._serverKey=f,this.hasEmptyContent=g,this.hasTilesetContent=!1,this.hasImplicitContent=!1,this.hasMultipleContents=_,hasExtension(i,"3DTILES_metadata")){var v=i.extensions["3DTILES_metadata"];m=new TileMetadata({tile:v,class:e.metadata.schema.classes[v.class]})}this.metadata=m,this.cacheNode=void 0;var C,T,S=i.expire;defined(S)&&(C=S.duration,defined(S.date)&&(T=JulianDate.fromIso8601(S.date))),this.expireDuration=C,this.expireDate=T,this.lastStyleTime=0,this._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.NOT_COMPUTED,this.clippingPlanesDirty=!1,this.priorityDeferred=!1,this.implicitTileset=void 0,this.implicitCoordinates=void 0,this.implicitSubtree=void 0,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._screenSpaceErrorProgressiveResolution=0,this._visibilityPlaneMask=0,this._visible=!1,this._inRequestVolume=!1,this._finalResolution=!0,this._depth=0,this._stackLength=0,this._selectionDepth=0,this._updatedVisibilityFrame=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._ancestorWithContent=void 0,this._ancestorWithContentAvailable=void 0,this._refines=!1,this._shouldSelect=!1,this._isClipped=!0,this._clippingPlanesState=0,this._debugBoundingVolume=void 0,this._debugContentBoundingVolume=void 0,this._debugViewerRequestVolume=void 0,this._debugColor=Color.fromRandom({alpha:1}),this._debugColorizeTiles=!1,this._priority=0,this._priorityHolder=this,this._priorityProgressiveResolution=!1,this._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1,this._priorityReverseScreenSpaceError=0,this._foveatedFactor=0,this._wasMinPriorityChild=!1,this._loadTimestamp=new JulianDate,this._commandsLength=0,this._color=void 0,this._colorDirty=!1,this._request=void 0}Object.defineProperties(TileOrientedBoundingBox.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}}),TileOrientedBoundingBox.prototype.distanceToCamera=function(e){return Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC))},TileOrientedBoundingBox.prototype.intersectPlane=function(e){return this._orientedBoundingBox.intersectPlane(e)},TileOrientedBoundingBox.prototype.update=function(e,t){Cartesian3.clone(e,this._orientedBoundingBox.center),t=checkHalfAxes(t),Matrix3.clone(t,this._orientedBoundingBox.halfAxes),BoundingSphere.fromOrientedBoundingBox(this._orientedBoundingBox,this._boundingSphere)},TileOrientedBoundingBox.prototype.createDebugVolume=function(e){return new Primitive$2({geometryInstances:new GeometryInstance({geometry:new BoxOutlineGeometry({minimum:new Cartesian3(-1,-1,-1),maximum:new Cartesian3(1,1,1)}),id:"outline",modelMatrix:Matrix4.fromRotationTranslation(this.boundingVolume.halfAxes,this.boundingVolume.center),attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})},Cesium3DTile._deprecationWarning=deprecationWarning,Object.defineProperties(Cesium3DTile.prototype,{tileset:{get:function(){return this._tileset}},content:{get:function(){return this._content}},boundingVolume:{get:function(){return this._boundingVolume}},contentBoundingVolume:{get:function(){return defaultValue(this._contentBoundingVolume,this._boundingVolume)}},boundingSphere:{get:function(){return this._boundingVolume.boundingSphere}},extras:{get:function(){return this._header.extras}},color:{get:function(){return defined(this._color)||(this._color=new Color),Color.clone(this._color)},set:function(e){this._color=Color.clone(e,this._color),this._colorDirty=!0}},contentAvailable:{get:function(){return this.contentReady&&!this.hasEmptyContent&&!this.hasTilesetContent&&!this.hasImplicitContent||defined(this._expiredContent)&&!this.contentFailed}},contentReady:{get:function(){return this._contentState===Cesium3DTileContentState$1.READY}},contentUnloaded:{get:function(){return this._contentState===Cesium3DTileContentState$1.UNLOADED}},contentExpired:{get:function(){return this._contentState===Cesium3DTileContentState$1.EXPIRED}},contentFailed:{get:function(){return this._contentState===Cesium3DTileContentState$1.FAILED}},contentReadyToProcessPromise:{get:function(){if(defined(this._contentReadyToProcessPromise))return this._contentReadyToProcessPromise.promise}},contentReadyPromise:{get:function(){if(defined(this._contentReadyPromise))return this._contentReadyPromise.promise}},commandsLength:{get:function(){return this._commandsLength}}});var scratchCartesian$5=new Cartesian3;function isPriorityDeferred(e,t){var i=e._tileset,r=t.camera,n=e.boundingSphere,a=n.radius,o=Cartesian3.multiplyByScalar(r.directionWC,e._centerZDepth,scratchCartesian$5),s=Cartesian3.add(r.positionWC,o,scratchCartesian$5),l=Cartesian3.subtract(s,n.center,scratchCartesian$5);if(Cartesian3.magnitude(l)>a){var c=Cartesian3.normalize(l,scratchCartesian$5),u=Cartesian3.multiplyByScalar(c,a,scratchCartesian$5),d=Cartesian3.add(n.center,u,scratchCartesian$5),h=Cartesian3.subtract(d,r.positionWC,scratchCartesian$5),p=Cartesian3.normalize(h,scratchCartesian$5);e._foveatedFactor=1-Math.abs(Cartesian3.dot(r.directionWC,p))}else e._foveatedFactor=0;var f=e.refine===Cesium3DTileRefine$1.REPLACE,m=i._skipLevelOfDetail;if(f&&!m||!i.foveatedScreenSpaceError||1===i.foveatedConeSize||e._priorityProgressiveResolution&&f&&m||i._pass===Cesium3DTilePass$1.PRELOAD_FLIGHT||i._pass===Cesium3DTilePass$1.PRELOAD)return!1;var g=1-Math.cos(.5*r.frustum.fov),_=i.foveatedConeSize*g;if(e._foveatedFactor<=_)return!1;var y=g-_,v=CesiumMath.clamp((e._foveatedFactor-_)/y,0,1),C=i.foveatedInterpolationCallback(i.foveatedMinimumScreenSpaceErrorRelaxation,i.maximumScreenSpaceError,v),T=0===e._screenSpaceError&&defined(e.parent)?.5*e.parent._screenSpaceError:e._screenSpaceError;return i.maximumScreenSpaceError-C<=T}var scratchJulianDate$1=new JulianDate;function isPriorityProgressiveResolution(e,t){if(e.progressiveResolutionHeightFraction<=0||e.progressiveResolutionHeightFraction>.5)return!1;var i=t._screenSpaceErrorProgressiveResolution>e._maximumScreenSpaceError;t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1;var r=t.parent,n=e._maximumScreenSpaceError,a=t._screenSpaceErrorProgressiveResolution<=n,o=defined(r)&&r._screenSpaceErrorProgressiveResolution>n;return a&&o&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!0,i=!0),i}function getPriorityReverseScreenSpaceError(e,t){var i=t.parent,r=defined(i)&&(!e._skipLevelOfDetail||0===t._screenSpaceError||i.hasTilesetContent||i.hasImplicitContent)?i._screenSpaceError:t._screenSpaceError;return e.root._screenSpaceError-r}function updateExpireDate(e){if(defined(e.expireDuration)){var t=JulianDate.now(scratchJulianDate$1);JulianDate.addSeconds(t,e.expireDuration,t),defined(e.expireDate)?JulianDate.lessThan(e.expireDate,t)&&JulianDate.clone(t,e.expireDate):e.expireDate=JulianDate.clone(t)}}function createPriorityFunction(e){return function(){return e._priority}}function requestMultipleContents(e){var t=e._content,i=e._tileset;if(!defined(t)){var r=e._header.extensions["3DTILES_multiple_contents"];t=new Multiple3DTileContent(i,e,e._contentResource.clone(),r),e._content=t}var n=t.requestInnerContents();return n>0?n:(e._contentState=Cesium3DTileContentState$1.LOADING,e._contentReadyToProcessPromise=when.defer(),e._contentReadyPromise=when.defer(),t.contentsFetchedPromise.then((function(){if(e._contentState===Cesium3DTileContentState$1.LOADING){if(!e.isDestroyed())return e._contentState=Cesium3DTileContentState$1.PROCESSING,e._contentReadyToProcessPromise.resolve(t),t.readyPromise.then((function(t){e.isDestroyed()?multipleContentFailed(e,i,"Tile was unloaded while content was processing"):(e._selectedFrame=0,e.lastStyleTime=0,JulianDate.now(e._loadTimestamp),e._contentState=Cesium3DTileContentState$1.READY,e._contentReadyPromise.resolve(t))}));multipleContentFailed(e,i,"Tile was unloaded while content was loading")}})).otherwise((function(t){multipleContentFailed(e,i,t)})),0)}function multipleContentFailed(e,t,i){e._contentState===Cesium3DTileContentState$1.PROCESSING&&--t.statistics.numberOfTilesProcessing,e._contentState=Cesium3DTileContentState$1.FAILED,e._contentReadyPromise.reject(i),e._contentReadyToProcessPromise.reject(i)}function requestSingleContent(e){var t=e._contentResource.clone(),i=e.contentExpired;i&&t.setQueryParameters({expired:e.expireDate.toString()});var r=new Request({throttle:!0,throttleByServer:!0,type:RequestType$1.TILES3D,priorityFunction:createPriorityFunction(e),serverKey:e._serverKey});e._request=r,t.request=r;var n=t.fetchArrayBuffer();if(!defined(n))return 1;var a=e._contentState,o=e._tileset;return e._contentState=Cesium3DTileContentState$1.LOADING,e._contentReadyToProcessPromise=when.defer(),e._contentReadyPromise=when.defer(),++o.statistics.numberOfPendingRequests,n.then((function(t){if(!e.isDestroyed()){var r=makeContent(e,t);return i&&(e.expireDate=void 0),e._content=r,e._contentState=Cesium3DTileContentState$1.PROCESSING,e._contentReadyToProcessPromise.resolve(r),--o.statistics.numberOfPendingRequests,r.readyPromise.then((function(t){e.isDestroyed()?singleContentFailed(e,o):(updateExpireDate(e),e._selectedFrame=0,e.lastStyleTime=0,JulianDate.now(e._loadTimestamp),e._contentState=Cesium3DTileContentState$1.READY,e._contentReadyPromise.resolve(t))}))}singleContentFailed(e,o)})).otherwise((function(t){if(r.state===RequestState$1.CANCELLED)return e._contentState=a,--o.statistics.numberOfPendingRequests,void++o.statistics.numberOfAttemptedRequests;singleContentFailed(e,o,t)})),0}function singleContentFailed(e,t,i){e._contentState===Cesium3DTileContentState$1.PROCESSING?--t.statistics.numberOfTilesProcessing:--t.statistics.numberOfPendingRequests,e._contentState=Cesium3DTileContentState$1.FAILED,e._contentReadyPromise.reject(i),e._contentReadyToProcessPromise.reject(i)}function makeContent(e,t){var i,r=preprocess3DTileContent(t),n=e._tileset;n._disableSkipLevelOfDetail=n._disableSkipLevelOfDetail||r.contentType===Cesium3DTileContentType$1.GEOMETRY||r.contentType===Cesium3DTileContentType$1.VECTOR,r.contentType===Cesium3DTileContentType$1.IMPLICIT_SUBTREE&&(e.hasImplicitContent=!0),r.contentType===Cesium3DTileContentType$1.EXTERNAL_TILESET&&(e.hasTilesetContent=!0);var a=Cesium3DTileContentFactory[r.contentType];i=defined(r.binaryPayload)?a(n,e,e._contentResource,r.binaryPayload.buffer,0):a(n,e,e._contentResource,r.jsonPayload);var o=e._header.content;return i.groupMetadata=findGroupMetadata(n,o),i}Cesium3DTile.prototype.getScreenSpaceError=function(e,t,i){var r=this._tileset,n=defaultValue(i,1),a=defined(this.parent)?this.parent.geometricError:r._geometricError,o=t?a:this.geometricError;if(0===o)return 0;var s,l=e.camera,c=l.frustum,u=e.context,d=u.drawingBufferWidth,h=u.drawingBufferHeight*n;if(e.mode===SceneMode$1.SCENE2D||c instanceof OrthographicFrustum){defined(c._offCenterFrustum)&&(c=c._offCenterFrustum),s=o/(Math.max(c.top-c.bottom,c.right-c.left)/Math.max(d,h))}else{var p=Math.max(this._distanceToCamera,CesiumMath.EPSILON7);if(s=o*h/(p*l.frustum.sseDenominator),r.dynamicScreenSpaceError){var f=r._dynamicScreenSpaceErrorComputedDensity,m=r.dynamicScreenSpaceErrorFactor;s-=CesiumMath.fog(p,f)*m}}return s/=e.pixelRatio},Cesium3DTile.prototype.updateVisibility=function(e){var t=this.parent,i=this._tileset,r=defined(t)?t.computedTransform:i.modelMatrix,n=defined(t)?t._visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.updateTransform(r),this._distanceToCamera=this.distanceToTile(e),this._centerZDepth=this.distanceToTileCenter(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(e,!1,i.progressiveResolutionHeightFraction),this._visibilityPlaneMask=this.visibility(e,n),this._visible=this._visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._priorityReverseScreenSpaceError=getPriorityReverseScreenSpaceError(i,this),this._priorityProgressiveResolution=isPriorityProgressiveResolution(i,this),this.priorityDeferred=isPriorityDeferred(this,e)},Cesium3DTile.prototype.updateExpiration=function(){if(defined(this.expireDate)&&this.contentReady&&!this.hasEmptyContent&&!this.hasMultipleContents){var e=JulianDate.now(scratchJulianDate$1);JulianDate.lessThan(this.expireDate,e)&&(this._contentState=Cesium3DTileContentState$1.EXPIRED,this._expiredContent=this._content)}},Cesium3DTile.prototype.requestContent=function(){return this.hasEmptyContent?0:this.hasMultipleContents?requestMultipleContents(this):requestSingleContent(this)},Cesium3DTile.prototype.cancelRequests=function(){this.hasMultipleContents?this._content.cancelRequests():this._request.cancel()},Cesium3DTile.prototype.unloadContent=function(){this.hasEmptyContent||this.hasTilesetContent||this.hasImplicitContent||(this._content=this._content&&this._content.destroy(),this._contentState=Cesium3DTileContentState$1.UNLOADED,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this.lastStyleTime=0,this.clippingPlanesDirty=0===this._clippingPlanesState,this._clippingPlanesState=0,this._debugColorizeTiles=!1,this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy())};var scratchProjectedBoundingSphere=new BoundingSphere;function getBoundingVolume(e,t){if(t.mode!==SceneMode$1.SCENE3D&&!defined(e._boundingVolume2D)){var i=e._boundingVolume.boundingSphere,r=BoundingSphere.projectTo2D(i,t.mapProjection,scratchProjectedBoundingSphere);e._boundingVolume2D=new TileBoundingSphere(r.center,r.radius)}return t.mode!==SceneMode$1.SCENE3D?e._boundingVolume2D:e._boundingVolume}function getContentBoundingVolume(e,t){if(t.mode!==SceneMode$1.SCENE3D&&!defined(e._contentBoundingVolume2D)){var i=e._contentBoundingVolume.boundingSphere,r=BoundingSphere.projectTo2D(i,t.mapProjection,scratchProjectedBoundingSphere);e._contentBoundingVolume2D=new TileBoundingSphere(r.center,r.radius)}return t.mode!==SceneMode$1.SCENE3D?e._contentBoundingVolume2D:e._contentBoundingVolume}Cesium3DTile.prototype.visibility=function(e,t){var i=e.cullingVolume,r=getBoundingVolume(this,e),n=this._tileset,a=n.clippingPlanes;if(defined(a)&&a.enabled){var o=a.computeIntersectionWithBoundingVolume(r,n.clippingPlanesOriginMatrix);if(this._isClipped=o!==Intersect$1.INSIDE,o===Intersect$1.OUTSIDE)return CullingVolume.MASK_OUTSIDE}return i.computeVisibilityWithPlaneMask(r,t)},Cesium3DTile.prototype.contentVisibility=function(e){if(!defined(this._contentBoundingVolume))return Intersect$1.INSIDE;if(this._visibilityPlaneMask===CullingVolume.MASK_INSIDE)return Intersect$1.INSIDE;var t=e.cullingVolume,i=getContentBoundingVolume(this,e),r=this._tileset,n=r.clippingPlanes;if(defined(n)&&n.enabled){var a=n.computeIntersectionWithBoundingVolume(i,r.clippingPlanesOriginMatrix);if(this._isClipped=a!==Intersect$1.INSIDE,a===Intersect$1.OUTSIDE)return Intersect$1.OUTSIDE}return t.computeVisibility(i)},Cesium3DTile.prototype.distanceToTile=function(e){return getBoundingVolume(this,e).distanceToCamera(e)};var scratchToTileCenter=new Cartesian3;Cesium3DTile.prototype.distanceToTileCenter=function(e){var t=getBoundingVolume(this,e).boundingVolume,i=Cartesian3.subtract(t.center,e.camera.positionWC,scratchToTileCenter);return Cartesian3.dot(e.camera.directionWC,i)},Cesium3DTile.prototype.insideViewerRequestVolume=function(e){var t=this._viewerRequestVolume;return!defined(t)||0===t.distanceToCamera(e)};var scratchMatrix$2=new Matrix3,scratchScale$2=new Cartesian3,scratchHalfAxes=new Matrix3,scratchCenter$4=new Cartesian3,scratchRectangle$5=new Rectangle,scratchOrientedBoundingBox=new OrientedBoundingBox,scratchTransform=new Matrix4;function createBox(e,t,i){var r=Cartesian3.fromElements(e[0],e[1],e[2],scratchCenter$4),n=Matrix3.fromArray(e,3,scratchHalfAxes);r=Matrix4.multiplyByPoint(t,r,r);var a=Matrix4.getMatrix3(t,scratchMatrix$2);return n=Matrix3.multiply(a,n,n),defined(i)?(i.update(r,n),i):new TileOrientedBoundingBox(r,n)}function createBoxFromTransformedRegion(e,t,i,r){var n=Rectangle.unpack(e,0,scratchRectangle$5),a=e[4],o=e[5],s=OrientedBoundingBox.fromRectangle(n,a,o,Ellipsoid.WGS84,scratchOrientedBoundingBox),l=s.center,c=s.halfAxes;t=Matrix4.multiplyTransformation(t,Matrix4.inverseTransformation(i,scratchTransform),scratchTransform),l=Matrix4.multiplyByPoint(t,l,l);var u=Matrix4.getMatrix3(t,scratchMatrix$2);return c=Matrix3.multiply(u,c,c),defined(r)&&r instanceof TileOrientedBoundingBox?(r.update(l,c),r):new TileOrientedBoundingBox(l,c)}function createRegion(e,t,i,r){return Matrix4.equalsEpsilon(t,i,CesiumMath.EPSILON8)?defined(r)?r:new TileBoundingRegion({rectangle:Rectangle.unpack(e,0,scratchRectangle$5),minimumHeight:e[4],maximumHeight:e[5]}):createBoxFromTransformedRegion(e,t,i,r)}function createSphere(e,t,i){var r=Cartesian3.fromElements(e[0],e[1],e[2],scratchCenter$4),n=e[3];r=Matrix4.multiplyByPoint(t,r,r);var a=Matrix4.getScale(t,scratchScale$2);return n*=Cartesian3.maximumComponent(a),defined(i)?(i.update(r,n),i):new TileBoundingSphere(r,n)}function applyDebugSettings$1(e,t,i,r){if(r.isRender){var n=defined(e._header.content)&&defined(e._header.content.boundingVolume),a=e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent,o=t.debugShowBoundingVolume||t.debugShowContentBoundingVolume&&!n;if(o){var s;s=e._finalResolution?a?Color.DARKGRAY:Color.WHITE:Color.YELLOW,defined(e._debugBoundingVolume)||(e._debugBoundingVolume=e._boundingVolume.createDebugVolume(s)),e._debugBoundingVolume.update(i);var l=e._debugBoundingVolume.getGeometryInstanceAttributes("outline");l.color=ColorGeometryInstanceAttribute.toValue(s,l.color)}else!o&&defined(e._debugBoundingVolume)&&(e._debugBoundingVolume=e._debugBoundingVolume.destroy());t.debugShowContentBoundingVolume&&n?(defined(e._debugContentBoundingVolume)||(e._debugContentBoundingVolume=e._contentBoundingVolume.createDebugVolume(Color.BLUE)),e._debugContentBoundingVolume.update(i)):!t.debugShowContentBoundingVolume&&defined(e._debugContentBoundingVolume)&&(e._debugContentBoundingVolume=e._debugContentBoundingVolume.destroy()),t.debugShowViewerRequestVolume&&defined(e._viewerRequestVolume)?(defined(e._debugViewerRequestVolume)||(e._debugViewerRequestVolume=e._viewerRequestVolume.createDebugVolume(Color.YELLOW)),e._debugViewerRequestVolume.update(i)):!t.debugShowViewerRequestVolume&&defined(e._debugViewerRequestVolume)&&(e._debugViewerRequestVolume=e._debugViewerRequestVolume.destroy());var c=t.debugColorizeTiles&&!e._debugColorizeTiles||defined(t._heatmap.tilePropertyName),u=!t.debugColorizeTiles&&e._debugColorizeTiles;c?(t._heatmap.colorize(e,i),e._debugColorizeTiles=!0,e.color=e._debugColor):u&&(e._debugColorizeTiles=!1,e.color=Color.WHITE),e._colorDirty&&(e._colorDirty=!1,e._content.applyDebugSettings(!0,e._color)),u&&t.makeStyleDirty()}}function updateContent(e,t,i){var r=e._content,n=e._expiredContent;if(!e.hasMultipleContents&&defined(n)){if(!e.contentReady)return void n.update(t,i);e._expiredContent.destroy(),e._expiredContent=void 0}r.update(t,i)}function updateClippingPlanes(e,t){var i=t.clippingPlanes,r=0;defined(i)&&e._isClipped&&i.enabled&&(r=i.clippingPlanesState),r!==e._clippingPlanesState&&(e._clippingPlanesState=r,e.clippingPlanesDirty=!0)}Cesium3DTile.prototype.createBoundingVolume=function(e,t,i){if(!defined(e))throw new RuntimeError("boundingVolume must be defined");if(hasExtension(e,"3DTILES_bounding_volume_S2"))return new TileBoundingS2Cell(e.extensions["3DTILES_bounding_volume_S2"]);if(defined(e.box))return createBox(e.box,t,i);if(defined(e.region))return createRegion(e.region,t,this._initialTransform,i);if(defined(e.sphere))return createSphere(e.sphere,t,i);throw new RuntimeError("boundingVolume must contain a sphere, region, or box")},Cesium3DTile.prototype.updateTransform=function(e){e=defaultValue(e,Matrix4.IDENTITY);var t=Matrix4.multiply(e,this.transform,scratchTransform);if(!Matrix4.equals(t,this.computedTransform)){Matrix4.clone(t,this.computedTransform);var i=this._header,r=this._header.content;this._boundingVolume=this.createBoundingVolume(i.boundingVolume,this.computedTransform,this._boundingVolume),defined(this._contentBoundingVolume)&&(this._contentBoundingVolume=this.createBoundingVolume(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),defined(this._viewerRequestVolume)&&(this._viewerRequestVolume=this.createBoundingVolume(i.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)),this.updateGeometricErrorScale(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy()}},Cesium3DTile.prototype.updateGeometricErrorScale=function(){var e=Matrix4.getScale(this.computedTransform,scratchScale$2),t=Cartesian3.maximumComponent(e);this.geometricError=this._geometricError*t},Cesium3DTile.prototype.update=function(e,t,i){var r=t.commandList.length;updateClippingPlanes(this,e),applyDebugSettings$1(this,e,t,i),updateContent(this,e,t);var n=t.commandList.length-r;this._commandsLength=n;for(var a=0;a<n;++a){var o=t.commandList[r+a],s=o.pass===Pass$1.TRANSLUCENT;o.depthForTranslucentClassification=s}this.clippingPlanesDirty=!1};var scratchCommandList$1=[];function isolateDigits(e,t,i){var r=e*Math.pow(10,t);return parseInt(r)*Math.pow(10,i)}function priorityNormalizeAndClamp(e,t,i){return Math.max(CesiumMath.normalize(e,t,i)-CesiumMath.EPSILON7,0)}function GroupMetadata(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id,i=e.group,r=defined(i.properties)?i.properties:{};this._class=e.class,this._properties=r,this._id=t,this._extras=i.extras,this._extensions=i.extensions}function TilesetMetadata(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).tileset,i=defined(t.properties)?t.properties:{};this._class=e.class,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}function Cesium3DTilesetMetadata(e){var t,i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).extension,r=e.schema,n={};if(defined(i.groups))for(var a in i.groups)if(i.groups.hasOwnProperty(a)){var o=i.groups[a];n[a]=new GroupMetadata({id:a,group:i.groups[a],class:r.classes[o.class]})}defined(i.tileset)&&(t=new TilesetMetadata({tileset:i.tileset,class:r.classes[i.tileset.class]})),this._schema=r,this._groups=n,this._tileset=t,this._statistics=i.statistics,this._extras=i.extras,this._extensions=i.extensions}Cesium3DTile.prototype.process=function(e,t){var i=t.commandList;t.commandList=scratchCommandList$1,this._content.update(e,t),scratchCommandList$1.length=0,t.commandList=i},Cesium3DTile.prototype.updatePriority=function(){var e=this.tileset,t=e.preferLeaves,i=e._minimumPriority,r=e._maximumPriority,n=Math.pow(10,8),a=Math.pow(10,9),o=Math.pow(10,10),s=priorityNormalizeAndClamp(this._depth,i.depth,r.depth);s=t?1-s:s;var l=isolateDigits(!e._skipLevelOfDetail&&this.refine===Cesium3DTileRefine$1.REPLACE?priorityNormalizeAndClamp(this._priorityHolder._distanceToCamera,i.distance,r.distance):priorityNormalizeAndClamp(this._priorityReverseScreenSpaceError,i.reverseScreenSpaceError,r.reverseScreenSpaceError),4,0),c=this._priorityProgressiveResolution?0:n,u=isolateDigits(priorityNormalizeAndClamp(this._priorityHolder._foveatedFactor,i.foveatedFactor,r.foveatedFactor),4,4),d=this.priorityDeferred?a:0,h=e._pass===Cesium3DTilePass$1.PRELOAD_FLIGHT?0:o;this._priority=s+l+c+u+d+h},Cesium3DTile.prototype.isDestroyed=function(){return!1},Cesium3DTile.prototype.destroy=function(){return this._content=this._content&&this._content.destroy(),this._expiredContent=this._expiredContent&&!this._expiredContent.isDestroyed()&&this._expiredContent.destroy(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy(),destroyObject(this)},Object.defineProperties(GroupMetadata.prototype,{class:{get:function(){return this._class}},id:{get:function(){return this._id}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),GroupMetadata.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},GroupMetadata.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},GroupMetadata.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},GroupMetadata.prototype.getProperty=function(e){return MetadataEntity.getProperty(e,this._properties,this._class)},GroupMetadata.prototype.setProperty=function(e,t){return MetadataEntity.setProperty(e,t,this._properties,this._class)},GroupMetadata.prototype.getPropertyBySemantic=function(e){return MetadataEntity.getPropertyBySemantic(e,this._properties,this._class)},GroupMetadata.prototype.setPropertyBySemantic=function(e,t){return MetadataEntity.setPropertyBySemantic(e,t,this._properties,this._class)},Object.defineProperties(TilesetMetadata.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),TilesetMetadata.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},TilesetMetadata.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},TilesetMetadata.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},TilesetMetadata.prototype.getProperty=function(e){return MetadataEntity.getProperty(e,this._properties,this._class)},TilesetMetadata.prototype.setProperty=function(e,t){return MetadataEntity.setProperty(e,t,this._properties,this._class)},TilesetMetadata.prototype.getPropertyBySemantic=function(e){return MetadataEntity.getPropertyBySemantic(e,this._properties,this._class)},TilesetMetadata.prototype.setPropertyBySemantic=function(e,t){return MetadataEntity.setPropertyBySemantic(e,t,this._properties,this._class)},Object.defineProperties(Cesium3DTilesetMetadata.prototype,{schema:{get:function(){return this._schema}},groups:{get:function(){return this._groups}},tileset:{get:function(){return this._tileset}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});var Cesium3DTileOptimizations={},scratchAxis$1=new Cartesian3;function Cesium3DTilesetCache(){this._list=new DoublyLinkedList,this._sentinel=this._list.add(),this._trimTiles=!1}function Cesium3DTilesetHeatmap(e){this.tilePropertyName=e,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE,this._previousMinimum=Number.MAX_VALUE,this._previousMaximum=-Number.MAX_VALUE,this._referenceMinimum={},this._referenceMaximum={}}function getHeatmapValue(e,t){return"_loadTimestamp"===t?JulianDate.toDate(e).getTime():e}function getHeatmapValueAndUpdateMinimumMaximum(e,t){var i=e.tilePropertyName;if(defined(i)){var r=getHeatmapValue(t[i],i);return defined(r)?(e._maximum=Math.max(r,e._maximum),e._minimum=Math.min(r,e._minimum),r):(e.tilePropertyName=void 0,r)}}Cesium3DTileOptimizations.checkChildrenWithinParent=function(e){var t=e.children,i=t.length,r=e.boundingVolume;if(r instanceof TileOrientedBoundingBox||r instanceof TileBoundingRegion){var n=r._orientedBoundingBox;e._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.USE_OPTIMIZATION;for(var a=0;a<i;++a){var o=t[a].boundingVolume;if(!(o instanceof TileOrientedBoundingBox||o instanceof TileBoundingRegion)){e._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.SKIP_OPTIMIZATION;break}var s=o._orientedBoundingBox,l=Cartesian3.subtract(s.center,n.center,scratchAxis$1),c=Cartesian3.magnitude(l);if(Cartesian3.divideByScalar(l,c,l),Math.abs(n.halfAxes[0]*l.x)+Math.abs(n.halfAxes[1]*l.y)+Math.abs(n.halfAxes[2]*l.z)+Math.abs(n.halfAxes[3]*l.x)+Math.abs(n.halfAxes[4]*l.y)+Math.abs(n.halfAxes[5]*l.z)+Math.abs(n.halfAxes[6]*l.x)+Math.abs(n.halfAxes[7]*l.y)+Math.abs(n.halfAxes[8]*l.z)<=Math.abs(s.halfAxes[0]*l.x)+Math.abs(s.halfAxes[1]*l.y)+Math.abs(s.halfAxes[2]*l.z)+Math.abs(s.halfAxes[3]*l.x)+Math.abs(s.halfAxes[4]*l.y)+Math.abs(s.halfAxes[5]*l.z)+Math.abs(s.halfAxes[6]*l.x)+Math.abs(s.halfAxes[7]*l.y)+Math.abs(s.halfAxes[8]*l.z)+c){e._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.SKIP_OPTIMIZATION;break}}}return e._optimChildrenWithinParent===Cesium3DTileOptimizationHint$1.USE_OPTIMIZATION},Cesium3DTilesetCache.prototype.reset=function(){this._list.splice(this._list.tail,this._sentinel)},Cesium3DTilesetCache.prototype.touch=function(e){var t=e.cacheNode;defined(t)&&this._list.splice(this._sentinel,t)},Cesium3DTilesetCache.prototype.add=function(e){defined(e.cacheNode)||(e.cacheNode=this._list.add(e))},Cesium3DTilesetCache.prototype.unloadTile=function(e,t,i){var r=t.cacheNode;defined(r)&&(this._list.remove(r),t.cacheNode=void 0,i(e,t))},Cesium3DTilesetCache.prototype.unloadTiles=function(e,t){var i=this._trimTiles;this._trimTiles=!1;for(var r=this._list,n=1024*e.maximumMemoryUsage*1024,a=this._sentinel,o=r.head;o!==a&&(e.totalMemoryUsageInBytes>n||i);){var s=o.item;o=o.next,this.unloadTile(e,s,t)}},Cesium3DTilesetCache.prototype.trim=function(){this._trimTiles=!0},Cesium3DTilesetHeatmap.prototype.setReferenceMinimumMaximum=function(e,t,i){this._referenceMinimum[i]=getHeatmapValue(e,i),this._referenceMaximum[i]=getHeatmapValue(t,i)};var heatmapColors=[new Color(.1,.1,.1,1),new Color(.153,.278,.878,1),new Color(.827,.231,.49,1),new Color(.827,.188,.22,1),new Color(1,.592,.259,1),new Color(1,.843,0,1)];function Cesium3DTilesetStatistics(){this.selected=0,this.visited=0,this.numberOfCommands=0,this.numberOfAttemptedRequests=0,this.numberOfPendingRequests=0,this.numberOfTilesProcessing=0,this.numberOfTilesWithContentReady=0,this.numberOfTilesTotal=0,this.numberOfLoadedTilesTotal=0,this.numberOfFeaturesSelected=0,this.numberOfFeaturesLoaded=0,this.numberOfPointsSelected=0,this.numberOfPointsLoaded=0,this.numberOfTrianglesSelected=0,this.numberOfTilesStyled=0,this.numberOfFeaturesStyled=0,this.numberOfTilesCulledWithChildrenUnion=0,this.geometryByteLength=0,this.texturesByteLength=0,this.batchTableByteLength=0}function updatePointAndFeatureCounts(e,t,i,r){var n=t.innerContents,a=t.pointsLength,o=t.trianglesLength,s=t.featuresLength,l=t.geometryByteLength,c=t.texturesByteLength,u=t.batchTableByteLength;if(r?(e.numberOfFeaturesLoaded+=i?-s:s,e.numberOfPointsLoaded+=i?-a:a,e.geometryByteLength+=i?-l:l,e.texturesByteLength+=i?-c:c,e.batchTableByteLength+=i?-u:u):(e.numberOfFeaturesSelected+=i?-s:s,e.numberOfPointsSelected+=i?-a:a,e.numberOfTrianglesSelected+=i?-o:o),defined(n))for(var d=n.length,h=0;h<d;++h)updatePointAndFeatureCounts(e,n[h],i,r)}function Cesium3DTileStyleEngine(){this._style=void 0,this._styleDirty=!1,this._lastStyleTime=0}function ImplicitTileset(e,t,i){var r=t.extensions["3DTILES_implicit_tiling"];if(this.baseResource=e,this.geometricError=t.geometricError,this.metadataSchema=i,!defined(t.boundingVolume.box)&&!defined(t.boundingVolume.region)&&!hasExtension(t.boundingVolume,"3DTILES_bounding_volume_S2"))throw new RuntimeError("Only box, region and 3DTILES_bounding_volume_S2 are supported for implicit tiling");this.boundingVolume=t.boundingVolume,this.refine=t.refine,this.subtreeUriTemplate=new Resource({url:r.subtrees.uri}),this.contentUriTemplates=[],this.contentHeaders=[];for(var n=gatherContentHeaders(t),a=0;a<n.length;a++){var o=n[a];this.contentHeaders.push(clone$1(o,!0));var s=new Resource({url:o.uri});this.contentUriTemplates.push(s)}this.contentCount=this.contentHeaders.length,this.tileHeader=makeTileHeaderTemplate(t),this.subdivisionScheme=ImplicitSubdivisionScheme$1[r.subdivisionScheme],this.branchingFactor=ImplicitSubdivisionScheme$1.getBranchingFactor(this.subdivisionScheme),this.subtreeLevels=r.subtreeLevels,this.maximumLevel=r.maximumLevel}function gatherContentHeaders(e){return hasExtension(e,"3DTILES_multiple_contents")?e.extensions["3DTILES_multiple_contents"].content:defined(e.content)?[e.content]:[]}function makeTileHeaderTemplate(e){var t=clone$1(e,!0);return delete t.extensions["3DTILES_implicit_tiling"],delete t.content,delete t.extensions["3DTILES_multiple_contents"],0===Object.keys(t.extensions).length&&delete t.extensions,t}function ImplicitTileCoordinates(e){this.subdivisionScheme=e.subdivisionScheme,this.subtreeLevels=e.subtreeLevels,this.level=e.level,this.x=e.x,this.y=e.y,this.z=void 0,e.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE&&(this.z=e.z)}Cesium3DTilesetHeatmap.prototype.colorize=function(e,t){if(defined(this.tilePropertyName)&&e.contentAvailable&&e._selectedFrame===t.frameNumber){var i=getHeatmapValueAndUpdateMinimumMaximum(this,e),r=this._previousMinimum,n=this._previousMaximum;if(r!==Number.MAX_VALUE&&n!==-Number.MAX_VALUE){var a=n-r+CesiumMath.EPSILON7,o=CesiumMath.clamp(i-r,0,a)/a*(heatmapColors.length-1),s=Math.floor(o),l=Math.ceil(o),c=o-s,u=heatmapColors[s],d=heatmapColors[l],h=Color.clone(Color.WHITE);h.red=CesiumMath.lerp(u.red,d.red,c),h.green=CesiumMath.lerp(u.green,d.green,c),h.blue=CesiumMath.lerp(u.blue,d.blue,c),e._debugColor=h}}},Cesium3DTilesetHeatmap.prototype.resetMinimumMaximum=function(){var e=this.tilePropertyName;if(defined(e)){var t=this._referenceMinimum[e],i=this._referenceMaximum[e],r=defined(t)&&defined(i);this._previousMinimum=r?t:this._minimum,this._previousMaximum=r?i:this._maximum,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE}},Cesium3DTilesetStatistics.prototype.clear=function(){this.selected=0,this.visited=0,this.numberOfCommands=0,this.numberOfAttemptedRequests=0,this.numberOfFeaturesSelected=0,this.numberOfPointsSelected=0,this.numberOfTrianglesSelected=0,this.numberOfTilesStyled=0,this.numberOfFeaturesStyled=0,this.numberOfTilesCulledWithChildrenUnion=0},Cesium3DTilesetStatistics.prototype.incrementSelectionCounts=function(e){updatePointAndFeatureCounts(this,e,!1,!1)},Cesium3DTilesetStatistics.prototype.incrementLoadCounts=function(e){updatePointAndFeatureCounts(this,e,!1,!0)},Cesium3DTilesetStatistics.prototype.decrementLoadCounts=function(e){updatePointAndFeatureCounts(this,e,!0,!0)},Cesium3DTilesetStatistics.clone=function(e,t){t.selected=e.selected,t.visited=e.visited,t.numberOfCommands=e.numberOfCommands,t.selected=e.selected,t.numberOfAttemptedRequests=e.numberOfAttemptedRequests,t.numberOfPendingRequests=e.numberOfPendingRequests,t.numberOfTilesProcessing=e.numberOfTilesProcessing,t.numberOfTilesWithContentReady=e.numberOfTilesWithContentReady,t.numberOfTilesTotal=e.numberOfTilesTotal,t.numberOfFeaturesSelected=e.numberOfFeaturesSelected,t.numberOfFeaturesLoaded=e.numberOfFeaturesLoaded,t.numberOfPointsSelected=e.numberOfPointsSelected,t.numberOfPointsLoaded=e.numberOfPointsLoaded,t.numberOfTrianglesSelected=e.numberOfTrianglesSelected,t.numberOfTilesStyled=e.numberOfTilesStyled,t.numberOfFeaturesStyled=e.numberOfFeaturesStyled,t.numberOfTilesCulledWithChildrenUnion=e.numberOfTilesCulledWithChildrenUnion,t.geometryByteLength=e.geometryByteLength,t.texturesByteLength=e.texturesByteLength,t.batchTableByteLength=e.batchTableByteLength},Object.defineProperties(Cesium3DTileStyleEngine.prototype,{style:{get:function(){return this._style},set:function(e){e!==this._style&&(this._style=e,this._styleDirty=!0)}}}),Cesium3DTileStyleEngine.prototype.makeDirty=function(){this._styleDirty=!0},Cesium3DTileStyleEngine.prototype.resetDirty=function(){this._styleDirty=!1},Cesium3DTileStyleEngine.prototype.applyStyle=function(e){if(e.ready&&(!defined(this._style)||this._style.ready)){var t=this._styleDirty;t&&++this._lastStyleTime;for(var i=this._lastStyleTime,r=e._statistics,n=t?e._selectedTiles:e._selectedTilesToStyle,a=n.length,o=0;o<a;++o){var s=n[o];if(s.lastStyleTime!==i){var l=s.content;s.lastStyleTime=i,l.applyStyle(this._style),r.numberOfFeaturesStyled+=l.featuresLength,++r.numberOfTilesStyled}}}},Object.defineProperties(ImplicitTileCoordinates.prototype,{childIndex:{get:function(){var e=0;return e|=1&this.x,e|=(1&this.y)<<1,this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE&&(e|=(1&this.z)<<2),e}},mortonIndex:{get:function(){return this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE?MortonOrder.encode3D(this.x,this.y,this.z):MortonOrder.encode2D(this.x,this.y)}},tileIndex:{get:function(){return(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE?((1<<3*this.level)-1)/7:((1<<2*this.level)-1)/3)+this.mortonIndex}}}),ImplicitTileCoordinates.prototype.getDescendantCoordinates=function(e){var t=this.level+e.level,i=(this.x<<e.level)+e.x,r=(this.y<<e.level)+e.y;if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){var n=(this.z<<e.level)+e.z;return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:r,z:n})}return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:r})},ImplicitTileCoordinates.prototype.getAncestorCoordinates=function(e){var t=1<<e,i=this.level-e,r=Math.floor(this.x/t),n=Math.floor(this.y/t);if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){var a=Math.floor(this.z/t);return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:i,x:r,y:n,z:a})}return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:i,x:r,y:n})},ImplicitTileCoordinates.prototype.getOffsetCoordinates=function(e){var t=e.level-this.level,i=1<<t,r=e.x%i,n=e.y%i;if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){var a=e.z%i;return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:r,y:n,z:a})}return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:r,y:n})},ImplicitTileCoordinates.prototype.getChildCoordinates=function(e){var t=this.level+1,i=2*this.x+e%2,r=2*this.y+Math.floor(e/2)%2;if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){var n=2*this.z+Math.floor(e/4)%2;return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:r,z:n})}return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:r})},ImplicitTileCoordinates.prototype.getSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels)},ImplicitTileCoordinates.prototype.getParentSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels+this.subtreeLevels)},ImplicitTileCoordinates.prototype.isAncestor=function(e){var t=e.level-this.level;if(t<=0)return!1;var i=e.x>>t,r=e.y>>t,n=this.x===i,a=this.y===r;if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){var o=e.z>>t,s=this.z===o;return n&&a&&s}return n&&a},ImplicitTileCoordinates.prototype.isEqual=function(e){return this.subdivisionScheme===e.subdivisionScheme&&this.subtreeLevels===e.subtreeLevels&&this.level===e.level&&this.x===e.x&&this.y===e.y&&(this.subdivisionScheme!==ImplicitSubdivisionScheme$1.OCTREE||this.z===e.z)},ImplicitTileCoordinates.prototype.isImplicitTilesetRoot=function(){return 0===this.level},ImplicitTileCoordinates.prototype.isSubtreeRoot=function(){return this.level%this.subtreeLevels==0},ImplicitTileCoordinates.prototype.isBottomOfSubtree=function(){return this.level%this.subtreeLevels==this.subtreeLevels-1},ImplicitTileCoordinates.prototype.getTemplateValues=function(){var e={level:this.level,x:this.x,y:this.y};return this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE&&(e.z=this.z),e};var scratchCoordinatesArray=[0,0,0];function Cesium3DTileset(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._url=void 0,this._basePath=void 0,this._root=void 0,this._resource=void 0,this._asset=void 0,this._properties=void 0,this._geometricError=void 0,this._extensionsUsed=void 0,this._extensions=void 0,this._gltfUpAxis=void 0,this._cache=new Cesium3DTilesetCache,this._processingQueue=[],this._selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this._selectedTilesToStyle=[],this._loadTimestamp=void 0,this._timeSinceLoad=0,this._updatedVisibilityFrame=0,this._updatedModelMatrixFrame=0,this._modelMatrixChanged=!1,this._previousModelMatrix=void 0,this._extras=void 0,this._credits=void 0,this._cullWithChildrenBounds=defaultValue(e.cullWithChildrenBounds,!0),this._allTilesAdditive=!0,this._hasMixedContent=!1,this._stencilClearCommand=void 0,this._backfaceCommands=new ManagedArray,this._maximumScreenSpaceError=defaultValue(e.maximumScreenSpaceError,16),this._maximumMemoryUsage=defaultValue(e.maximumMemoryUsage,512),this._fShaderBody=defaultValue(e.fShaderBody,""),this._vShader=defaultValue(e.vShader,""),this._fShader=defaultValue(e.fShader,""),this._availability=void 0,this._definitionChanged=new Event,this.availability=defaultValue(this.availability,e.availability),this._styleEngine=new Cesium3DTileStyleEngine,this._modelMatrix=defined(e.modelMatrix)?Matrix4.clone(e.modelMatrix):Matrix4.clone(Matrix4.IDENTITY),this._statistics=new Cesium3DTilesetStatistics,this._statisticsLast=new Cesium3DTilesetStatistics,this._statisticsPerPass=new Array(Cesium3DTilePass$1.NUMBER_OF_PASSES);for(var t=0;t<Cesium3DTilePass$1.NUMBER_OF_PASSES;++t)this._statisticsPerPass[t]=new Cesium3DTilesetStatistics;this._requestedTilesInFlight=[],this._maximumPriority={foveatedFactor:-Number.MAX_VALUE,depth:-Number.MAX_VALUE,distance:-Number.MAX_VALUE,reverseScreenSpaceError:-Number.MAX_VALUE},this._minimumPriority={foveatedFactor:Number.MAX_VALUE,depth:Number.MAX_VALUE,distance:Number.MAX_VALUE,reverseScreenSpaceError:Number.MAX_VALUE},this._heatmap=new Cesium3DTilesetHeatmap(e.debugHeatmapTilePropertyName),this.cullRequestsWhileMoving=defaultValue(e.cullRequestsWhileMoving,!0),this._cullRequestsWhileMoving=!1,this.cullRequestsWhileMovingMultiplier=defaultValue(e.cullRequestsWhileMovingMultiplier,60),this.progressiveResolutionHeightFraction=CesiumMath.clamp(defaultValue(e.progressiveResolutionHeightFraction,.3),0,.5),this.preferLeaves=defaultValue(e.preferLeaves,!1),this._tilesLoaded=!1,this._initialTilesLoaded=!1,this._tileDebugLabels=void 0,this._readyPromise=when.defer(),this._classificationType=e.classificationType,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._initialClippingPlanesOriginMatrix=Matrix4.IDENTITY,this._clippingPlanesOriginMatrix=void 0,this._clippingPlanesOriginMatrixDirty=!0,this._vectorClassificationOnly=defaultValue(e.vectorClassificationOnly,!1),this._vectorKeepDecodedPositions=defaultValue(e.vectorKeepDecodedPositions,!1),this.preloadWhenHidden=defaultValue(e.preloadWhenHidden,!1),this.preloadFlightDestinations=defaultValue(e.preloadFlightDestinations,!0),this._pass=void 0,this.dynamicScreenSpaceError=defaultValue(e.dynamicScreenSpaceError,!1),this.foveatedScreenSpaceError=defaultValue(e.foveatedScreenSpaceError,!0),this._foveatedConeSize=defaultValue(e.foveatedConeSize,.1),this._foveatedMinimumScreenSpaceErrorRelaxation=defaultValue(e.foveatedMinimumScreenSpaceErrorRelaxation,0),this.foveatedInterpolationCallback=defaultValue(e.foveatedInterpolationCallback,CesiumMath.lerp),this.foveatedTimeDelay=defaultValue(e.foveatedTimeDelay,.2),this.dynamicScreenSpaceErrorDensity=.00278,this.dynamicScreenSpaceErrorFactor=4,this.dynamicScreenSpaceErrorHeightFalloff=.25,this._dynamicScreenSpaceErrorComputedDensity=0,this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this.show=defaultValue(e.show,!0),this.colorBlendMode=Cesium3DTileColorBlendMode$1.HIGHLIGHT,this.colorBlendAmount=.5,this.pointCloudShading=new PointCloudShading(e.pointCloudShading),this._pointCloudEyeDomeLighting=new PointCloudEyeDomeLighting,this.loadProgress=new Event,this.allTilesLoaded=new Event,this.initialTilesLoaded=new Event,this.tileLoad=new Event,this.tileUnload=new Event,this.tileFailed=new Event,this.tileVisible=new Event,this.skipLevelOfDetail=defaultValue(e.skipLevelOfDetail,!1),this._skipLevelOfDetail=this.skipLevelOfDetail,this._disableSkipLevelOfDetail=!1,this.baseScreenSpaceError=defaultValue(e.baseScreenSpaceError,1024),this.skipScreenSpaceErrorFactor=defaultValue(e.skipScreenSpaceErrorFactor,16),this.skipLevels=defaultValue(e.skipLevels,1),this.immediatelyLoadDesiredLevelOfDetail=defaultValue(e.immediatelyLoadDesiredLevelOfDetail,!1),this.loadSiblings=defaultValue(e.loadSiblings,!1),this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._imageBasedLightingFactor=new Cartesian2(1,1),Cartesian2.clone(e.imageBasedLightingFactor,this._imageBasedLightingFactor),this.lightColor=e.lightColor,this.luminanceAtZenith=defaultValue(e.luminanceAtZenith,.2),this.sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,this.specularEnvironmentMaps=e.specularEnvironmentMaps,this.backFaceCulling=defaultValue(e.backFaceCulling,!0),this.showOutline=defaultValue(e.showOutline,!0),this.debugFreezeFrame=defaultValue(e.debugFreezeFrame,!1),this.debugColorizeTiles=defaultValue(e.debugColorizeTiles,!1),this.debugWireframe=defaultValue(e.debugWireframe,!1),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowContentBoundingVolume=defaultValue(e.debugShowContentBoundingVolume,!1),this.debugShowViewerRequestVolume=defaultValue(e.debugShowViewerRequestVolume,!1),this._tileDebugLabels=void 0,this.debugPickedTileLabelOnly=!1,this.debugPickedTile=void 0,this.debugPickPosition=void 0,this.debugShowGeometricError=defaultValue(e.debugShowGeometricError,!1),this.debugShowRenderingStatistics=defaultValue(e.debugShowRenderingStatistics,!1),this.debugShowMemoryUsage=defaultValue(e.debugShowMemoryUsage,!1),this.debugShowUrl=defaultValue(e.debugShowUrl,!1),this.examineVectorLinesFunction=void 0,this.metadata=void 0,this._customShader=e.customShader,this._schemaLoader=void 0;var i,r=this;when(e.url).then((function(e){var t;return i=Resource.createIfNeeded(e),r._resource=i,r._credits=i.credits,"json"===i.extension?t=i.getBaseUri(!0):i.isDataUri&&(t=""),r._url=i.url,r._basePath=t,Cesium3DTileset.loadJson(i)})).then((function(e){return processMetadataExtension(r,e)})).then((function(e){r._root=r.loadTileset(i,e);var t=defined(e.asset.gltfUpAxis)?Axis$1.fromName(e.asset.gltfUpAxis):Axis$1.Y,n=e.asset;r._asset=n,r._properties=e.properties,r._geometricError=e.geometricError,r._extensionsUsed=e.extensionsUsed,r._extensions=e.extensions,r._gltfUpAxis=t,r._extras=e.extras;var a=n.extras;if(defined(a)&&defined(a.cesium)&&defined(a.cesium.credits)){var o=a.cesium.credits,s=r._credits;defined(s)||(s=[],r._credits=s);for(var l=0;l<o.length;++l){var c=o[l];s.push(new Credit(c.html,c.showOnScreen))}}var u=r._root.createBoundingVolume(e.root.boundingVolume,Matrix4.IDENTITY).boundingSphere.center,d=r._ellipsoid.cartesianToCartographic(u);defined(d)&&d.height>ApproximateTerrainHeights._defaultMinTerrainHeight&&(r._initialClippingPlanesOriginMatrix=Transforms.eastNorthUpToFixedFrame(u)),r._clippingPlanesOriginMatrix=Matrix4.clone(r._initialClippingPlanesOriginMatrix),r._readyPromise.resolve(r)})).otherwise((function(e){r._readyPromise.reject(e)}))}function makeTile(e,t,i,r){if(hasExtension(i,"3DTILES_implicit_tiling")){var n=new ImplicitTileset(t,i,defined(e.metadata)?e.metadata.schema:void 0),a=new ImplicitTileCoordinates({subdivisionScheme:n.subdivisionScheme,subtreeLevels:n.subtreeLevels,level:0,x:0,y:0,z:0}),o=combine$2({content:{uri:n.subtreeUriTemplate.getDerivedResource({templateValues:a.getTemplateValues()}).url}},i,!0);delete o.extensions;var s=new Cesium3DTile(e,t,o,r);return s.implicitTileset=n,s.implicitCoordinates=a,s}return new Cesium3DTile(e,t,i,r)}function processMetadataExtension(e,t){if(!hasExtension(t,"3DTILES_metadata"))return when.resolve(t);var i,r=t.extensions["3DTILES_metadata"];if(defined(r.schemaUri)){var n=e._resource.getDerivedResource({url:r.schemaUri});i=ResourceCache.loadSchema({resource:n})}else i=ResourceCache.loadSchema({schema:r.schema});return e._schemaLoader=i,i.promise.then((function(i){return e.metadata=new Cesium3DTilesetMetadata({schema:i.schema,extension:r}),t}))}ImplicitTileCoordinates.fromMortonIndex=function(e,t,i,r){var n;return e===ImplicitSubdivisionScheme$1.OCTREE?new ImplicitTileCoordinates({subdivisionScheme:e,subtreeLevels:t,level:i,x:(n=MortonOrder.decode3D(r,scratchCoordinatesArray))[0],y:n[1],z:n[2]}):new ImplicitTileCoordinates({subdivisionScheme:e,subtreeLevels:t,level:i,x:(n=MortonOrder.decode2D(r,scratchCoordinatesArray))[0],y:n[1]})},ImplicitTileCoordinates.fromTileIndex=function(e,t,i){var r,n;return n=e===ImplicitSubdivisionScheme$1.OCTREE?i-((1<<3*(r=Math.floor(CesiumMath.log2(7*i+1)/3)))-1)/7:i-((1<<2*(r=Math.floor(CesiumMath.log2(3*i+1)/2)))-1)/3,ImplicitTileCoordinates.fromMortonIndex(e,t,r,n)},Cesium3DTileset.prototype.isAvailable=function(e){var t=this._availability;return!defined(t)||t.contains(e)},Object.defineProperties(Cesium3DTileset.prototype,{availability:createRawPropertyDescriptor("availability"),definitionChanged:{get:function(){return this._definitionChanged}},isCesium3DTileset:{get:function(){return!0}},asset:{get:function(){return this._asset}},extensions:{get:function(){return this._extensions}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}},properties:{get:function(){return this._properties}},ready:{get:function(){return defined(this._root)}},readyPromise:{get:function(){return this._readyPromise.promise}},tilesLoaded:{get:function(){return this._tilesLoaded}},resource:{get:function(){return this._resource}},basePath:{get:function(){return deprecationWarning("Cesium3DTileset.basePath","Cesium3DTileset.basePath has been deprecated. All tiles are relative to the url of the tileset JSON file that contains them. Use the url property instead."),this._basePath}},style:{get:function(){return this._styleEngine.style},set:function(e){this._styleEngine.style=e}},maximumScreenSpaceError:{get:function(){return this._maximumScreenSpaceError},set:function(e){this._maximumScreenSpaceError=e}},maximumMemoryUsage:{get:function(){return this._maximumMemoryUsage},set:function(e){this._maximumMemoryUsage=e}},root:{get:function(){return this._root}},boundingSphere:{get:function(){return this._root.updateTransform(this._modelMatrix),this._root.boundingSphere}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=Matrix4.clone(e,this._modelMatrix)}},timeSinceLoad:{get:function(){return this._timeSinceLoad}},totalMemoryUsageInBytes:{get:function(){var e=this._statistics;return e.texturesByteLength+e.geometryByteLength+e.batchTableByteLength}},clippingPlanesOriginMatrix:{get:function(){return defined(this._clippingPlanesOriginMatrix)?(this._clippingPlanesOriginMatrixDirty&&(Matrix4.multiply(this.root.computedTransform,this._initialClippingPlanesOriginMatrix,this._clippingPlanesOriginMatrix),this._clippingPlanesOriginMatrixDirty=!1),this._clippingPlanesOriginMatrix):Matrix4.IDENTITY}},styleEngine:{get:function(){return this._styleEngine}},statistics:{get:function(){return this._statistics}},classificationType:{get:function(){return this._classificationType}},ellipsoid:{get:function(){return this._ellipsoid}},foveatedConeSize:{get:function(){return this._foveatedConeSize},set:function(e){this._foveatedConeSize=e}},foveatedMinimumScreenSpaceErrorRelaxation:{get:function(){return this._foveatedMinimumScreenSpaceErrorRelaxation},set:function(e){this._foveatedMinimumScreenSpaceErrorRelaxation=e}},extras:{get:function(){return this._extras}},imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){Cartesian2.clone(e,this._imageBasedLightingFactor)}},vectorClassificationOnly:{get:function(){return this._vectorClassificationOnly}}}),Cesium3DTileset.loadJson=function(e){return Resource.createIfNeeded(e).fetchJson()},Cesium3DTileset.prototype.makeStyleDirty=function(){this._styleEngine.makeDirty()},Cesium3DTileset.prototype.loadTileset=function(e,t,i){var r=t.asset;if(!defined(r))throw new RuntimeError("Tileset must have an asset property.");if("0.0"!==r.version&&"1.0"!==r.version)throw new RuntimeError("The tileset must be 3D Tiles version 0.0 or 1.0.");defined(t.extensionsRequired)&&Cesium3DTileset.checkSupportedExtensions(t.extensionsRequired);var n=this._statistics,a=r.tilesetVersion;defined(a)&&(this._basePath+="?v="+a,(e=e.clone()).setQueryParameters({v:a}));var o=makeTile(this,e,t.root,i);defined(i)&&(i.children.push(o),o._depth=i._depth+1);var s=[];for(s.push(o);s.length>0;){var l=s.pop();++n.numberOfTilesTotal,this._allTilesAdditive=this._allTilesAdditive&&l.refine===Cesium3DTileRefine$1.ADD;var c=l._header.children;if(defined(c))for(var u=c.length,d=0;d<u;++d){var h=makeTile(this,e,c[d],l);l.children.push(h),h._depth=l._depth+1,s.push(h)}this._cullWithChildrenBounds&&Cesium3DTileOptimizations.checkChildrenWithinParent(l)}return o};var scratchPositionNormal$2=new Cartesian3,scratchCartographic$a=new Cartographic,scratchMatrix$1=new Matrix4,scratchCenter$3=new Cartesian3,scratchPosition$3=new Cartesian3,scratchDirection$1=new Cartesian3;function updateDynamicScreenSpaceError(e,t){var i,r,n,a,o,s=t.camera,l=e._root,c=l.contentBoundingVolume;if(c instanceof TileBoundingRegion)i=Cartesian3.normalize(s.positionWC,scratchPositionNormal$2),r=s.directionWC,n=s.positionCartographic.height,a=c.minimumHeight,o=c.maximumHeight;else{var u=Matrix4.inverseTransformation(l.computedTransform,scratchMatrix$1),d=t.mapProjection.ellipsoid,h=c.boundingVolume,p=Matrix4.multiplyByPoint(u,h.center,scratchCenter$3);if(Cartesian3.magnitude(p)>d.minimumRadius){var f=Cartographic.fromCartesian(p,d,scratchCartographic$a);i=Cartesian3.normalize(s.positionWC,scratchPositionNormal$2),r=s.directionWC,n=s.positionCartographic.height,a=0,o=2*f.height}else{var m=Matrix4.multiplyByPoint(u,s.positionWC,scratchPosition$3);if(i=Cartesian3.UNIT_Z,r=Matrix4.multiplyByPointAsVector(u,s.directionWC,scratchDirection$1),r=Cartesian3.normalize(r,r),n=m.z,c instanceof TileOrientedBoundingBox){var g=l._header.boundingVolume.box[11];a=p.z-g,o=p.z+g}else if(c instanceof TileBoundingSphere){var _=h.radius;a=p.z-_,o=p.z+_}}}var y=a+(o-a)*e.dynamicScreenSpaceErrorHeightFalloff,v=o,C=CesiumMath.clamp((n-y)/(v-y),0,1),T=1-Math.abs(Cartesian3.dot(r,i));T*=1-C;var S=e.dynamicScreenSpaceErrorDensity;S*=T,e._dynamicScreenSpaceErrorComputedDensity=S}function requestContent(e,t){if(!t.hasEmptyContent){var i=e._statistics,r=t.contentExpired,n=t.requestContent();n>0?i.numberOfAttemptedRequests+=n:(r&&(t.hasTilesetContent||t.hasImplicitContent?destroySubtree(e,t):(i.decrementLoadCounts(t.content),--i.numberOfTilesWithContentReady)),e._requestedTilesInFlight.push(t),t.contentReadyToProcessPromise.then(addToProcessingQueue(e,t)),t.contentReadyPromise.then(handleTileSuccess(e,t)).otherwise(handleTileFailure(e,t)))}}function sortRequestByPriority(e,t){return e._priority-t._priority}function cancelOutOfViewRequests(e,t){for(var i=e._requestedTilesInFlight,r=0,n=i.length,a=0;a<n;++a){var o=i[a],s=t.frameNumber-o._touchedFrame>=1;o._contentState===Cesium3DTileContentState$1.LOADING?s?(o.cancelRequests(),++r):r>0&&(i[a-r]=o):++r}i.length-=r}function requestTiles(e,t){var i=e._requestedTiles,r=i.length;i.sort(sortRequestByPriority);for(var n=0;n<r;++n)requestContent(e,i[n])}function addToProcessingQueue(e,t){return function(){e._processingQueue.push(t),++e._statistics.numberOfTilesProcessing}}function handleTileFailure(e,t){return function(i){var r=t._contentResource.url,n=defined(i.message)?i.message:i.toString();e.tileFailed.numberOfListeners>0?e.tileFailed.raiseEvent({url:r,message:n}):(console.log("A 3D tile failed to load: "+r),console.log("Error: "+n))}}function handleTileSuccess(e,t){return function(){--e._statistics.numberOfTilesProcessing,t.hasTilesetContent||t.hasImplicitContent||(e._statistics.incrementLoadCounts(t.content),++e._statistics.numberOfTilesWithContentReady,++e._statistics.numberOfLoadedTilesTotal,e._cache.add(t)),e.tileLoad.raiseEvent(t)}}function filterProcessingQueue(e){for(var t=e._processingQueue,i=t.length,r=0,n=0;n<i;++n){var a=t[n];a._contentState===Cesium3DTileContentState$1.PROCESSING?r>0&&(t[n-r]=a):++r}t.length-=r}function processTiles(e,t){filterProcessingQueue(e);for(var i=e._processingQueue,r=i.length,n=0;n<r;++n)i[n].process(e,t)}Cesium3DTileset.prototype.postPassesUpdate=function(e){this.ready&&(cancelOutOfViewRequests(this,e),raiseLoadProgressEvent(this,e),this._cache.unloadTiles(this,unloadTile),this._styleEngine.resetDirty())},Cesium3DTileset.prototype.prePassesUpdate=function(e){if(this.ready){processTiles(this,e);var t=this._clippingPlanes;this._clippingPlanesOriginMatrixDirty=!0,defined(t)&&t.enabled&&t.update(e),defined(this._loadTimestamp)||(this._loadTimestamp=JulianDate.clone(e.time)),this._timeSinceLoad=Math.max(1e3*JulianDate.secondsDifference(e.time,this._loadTimestamp),0),this._skipLevelOfDetail=this.skipLevelOfDetail&&!defined(this._classificationType)&&!this._disableSkipLevelOfDetail&&!this._allTilesAdditive,this.dynamicScreenSpaceError&&updateDynamicScreenSpaceError(this,e),e.newFrame&&this._cache.reset()}};var scratchCartesian$4=new Cartesian3,stringOptions$1={maximumFractionDigits:3};function formatMemoryString$1(e){var t=e/1048576;return t<1?t.toLocaleString(void 0,stringOptions$1):Math.round(t).toLocaleString()}function computeTileLabelPosition(e){var t=e.boundingVolume.boundingVolume,i=t.halfAxes,r=t.radius,n=Cartesian3.clone(t.center,scratchCartesian$4);if(defined(i))n.x+=.75*(i[0]+i[3]+i[6]),n.y+=.75*(i[1]+i[4]+i[7]),n.z+=.75*(i[2]+i[5]+i[8]);else if(defined(r)){var a=Cartesian3.normalize(t.center,scratchCartesian$4);a=Cartesian3.multiplyByScalar(a,.75*r,scratchCartesian$4),n=Cartesian3.add(a,t.center,scratchCartesian$4)}return n}function addTileDebugLabel(e,t,i){var r="",n=0;(t.debugShowGeometricError&&(r+="\nGeometric error: "+e.geometricError,n++),t.debugShowRenderingStatistics)&&(r+="\nCommands: "+e.commandsLength,n++,e.content.pointsLength>0&&(r+="\nPoints: "+e.content.pointsLength,n++),e.content.trianglesLength>0&&(r+="\nTriangles: "+e.content.trianglesLength,n++),r+="\nFeatures: "+e.content.featuresLength,n++);if(t.debugShowMemoryUsage&&(r+="\nTexture Memory: "+formatMemoryString$1(e.content.texturesByteLength),r+="\nGeometry Memory: "+formatMemoryString$1(e.content.geometryByteLength),n+=2),t.debugShowUrl)if(e.hasMultipleContents){r+="\nUrls:";for(var a=e.content.innerContentUrls,o=0;o<a.length;o++)r+="\n- "+a[o];n+=a.length}else r+="\nUrl: "+e._header.content.uri,n++;var s={text:r.substring(1),position:i,font:19-n+"px sans-serif",showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY};return t._tileDebugLabels.add(s)}function updateTileDebugLabels(e,t){var i,r,n=e._selectedTiles,a=n.length,o=e._emptyTiles,s=o.length;if(e._tileDebugLabels.removeAll(),e.debugPickedTileLabelOnly){if(defined(e.debugPickedTile)){var l=defined(e.debugPickPosition)?e.debugPickPosition:computeTileLabelPosition(e.debugPickedTile);addTileDebugLabel(e.debugPickedTile,e,l).pixelOffset=new Cartesian2(15,-15)}}else{for(i=0;i<a;++i)addTileDebugLabel(r=n[i],e,computeTileLabelPosition(r));for(i=0;i<s;++i)((r=o[i]).hasTilesetContent||r.hasImplicitContent)&&addTileDebugLabel(r,e,computeTileLabelPosition(r))}e._tileDebugLabels.update(t)}function updateTiles(e,t,i){e._styleEngine.applyStyle(e);var r,n,a=i.isRender,o=e._statistics,s=t.commandList,l=s.length,c=e._selectedTiles,u=c.length,d=e._emptyTiles,h=d.length,p=e.tileVisible,f=e._skipLevelOfDetail&&e._hasMixedContent&&t.context.stencilBuffer&&u>0;e._backfaceCommands.length=0,f&&(defined(e._stencilClearCommand)||(e._stencilClearCommand=new ClearCommand({stencil:0,pass:Pass$1.CESIUM_3D_TILE,renderState:RenderState.fromCache({stencilMask:StencilConstants$1.SKIP_LOD_MASK})})),s.push(e._stencilClearCommand));var m=s.length;for(r=0;r<u;++r)n=c[r],a&&p.raiseEvent(n),n.update(e,t,i),o.incrementSelectionCounts(n.content),++o.selected;for(r=0;r<h;++r)(n=d[r]).update(e,t,i);var g=s.length-m;if(e._backfaceCommands.trim(),f){var _=e._backfaceCommands.values,y=_.length;for(s.length+=y,r=g-1;r>=0;--r)s[m+y+r]=s[m+r];for(r=0;r<y;++r)s[m+r]=_[r]}g=s.length-l,o.numberOfCommands=g,a&&e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&g>0&&e._pointCloudEyeDomeLighting.update(t,l,e.pointCloudShading,e.boundingSphere),a&&(e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(defined(e._tileDebugLabels)||(e._tileDebugLabels=new LabelCollection),updateTileDebugLabels(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}var scratchStack=[];function destroySubtree(e,t){var i=t,r=scratchStack;for(r.push(t);r.length>0;){for(var n=(t=r.pop()).children,a=n.length,o=0;o<a;++o)r.push(n[o]);t!==i&&(destroyTile(e,t),--e._statistics.numberOfTilesTotal)}i.children=[]}function unloadTile(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function destroyTile(e,t){e._cache.unloadTile(e,t,unloadTile),t.destroy()}function raiseLoadProgressEvent(e,t){var i=e._statistics,r=e._statisticsLast,n=i.numberOfPendingRequests,a=i.numberOfTilesProcessing,o=r.numberOfPendingRequests,s=r.numberOfTilesProcessing;Cesium3DTilesetStatistics.clone(i,r);var l=n!==o||a!==s;l&&t.afterRender.push((function(){e.loadProgress.raiseEvent(n,a)})),e._tilesLoaded=0===i.numberOfPendingRequests&&0===i.numberOfTilesProcessing&&0===i.numberOfAttemptedRequests,l&&e._tilesLoaded&&(t.afterRender.push((function(){e.allTilesLoaded.raiseEvent()})),e._initialTilesLoaded||(e._initialTilesLoaded=!0,t.afterRender.push((function(){e.initialTilesLoaded.raiseEvent()}))))}function resetMinimumMaximum(e){e._heatmap.resetMinimumMaximum(),e._minimumPriority.depth=Number.MAX_VALUE,e._maximumPriority.depth=-Number.MAX_VALUE,e._minimumPriority.foveatedFactor=Number.MAX_VALUE,e._maximumPriority.foveatedFactor=-Number.MAX_VALUE,e._minimumPriority.distance=Number.MAX_VALUE,e._maximumPriority.distance=-Number.MAX_VALUE,e._minimumPriority.reverseScreenSpaceError=Number.MAX_VALUE,e._maximumPriority.reverseScreenSpaceError=-Number.MAX_VALUE}function detectModelMatrixChanged(e,t){t.frameNumber===e._updatedModelMatrixFrame&&defined(e._previousModelMatrix)||(e._updatedModelMatrixFrame=t.frameNumber,e._modelMatrixChanged=!Matrix4.equals(e.modelMatrix,e._previousModelMatrix),e._modelMatrixChanged&&(e._previousModelMatrix=Matrix4.clone(e.modelMatrix,e._previousModelMatrix)))}function update$1(e,t,i,r){if(t.mode===SceneMode$1.MORPHING)return!1;if(!e.ready)return!1;var n=e._statistics;n.clear();var a=r.isRender;++e._updatedVisibilityFrame,resetMinimumMaximum(e),detectModelMatrixChanged(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;var o=r.traversal.selectTiles(e,t);if(r.requestTiles&&requestTiles(e),updateTiles(e,t,r),Cesium3DTilesetStatistics.clone(n,i),a){var s=e._credits;if(defined(s)&&0!==n.selected)for(var l=s.length,c=0;c<l;++c)t.creditDisplay.addCredit(s[c])}return o}Cesium3DTileset.prototype.trimLoadedTiles=function(){this._cache.trim()},Cesium3DTileset.prototype.update=function(e){this.updateForPass(e,e.tilesetPassState)},Cesium3DTileset.prototype.updateForPass=function(e,t){var i=t.pass;if((i!==Cesium3DTilePass$1.PRELOAD||this.preloadWhenHidden&&!this.show)&&(i!==Cesium3DTilePass$1.PRELOAD_FLIGHT||this.preloadFlightDestinations&&(this.show||this.preloadWhenHidden))&&(i!==Cesium3DTilePass$1.REQUEST_RENDER_MODE_DEFER_CHECK||!(!this._cullRequestsWhileMoving&&this.foveatedTimeDelay<=0||!this.show))){var r=e.commandList,n=e.camera,a=e.cullingVolume;t.ready=!1;var o=Cesium3DTilePass$1.getPassOptions(i),s=o.ignoreCommands,l=defaultValue(t.commandList,r),c=l.length;e.commandList=l,e.camera=defaultValue(t.camera,n),e.cullingVolume=defaultValue(t.cullingVolume,a);var u=this._statisticsPerPass[i];(this.show||s)&&(this._pass=i,t.ready=update$1(this,e,u,o)),s&&(l.length=c),e.commandList=r,e.camera=n,e.cullingVolume=a}},Cesium3DTileset.prototype.hasExtension=function(e){return!!defined(this._extensionsUsed)&&this._extensionsUsed.indexOf(e)>-1},Cesium3DTileset.prototype.isDestroyed=function(){return!1},Cesium3DTileset.prototype.destroy=function(){if(this._tileDebugLabels=this._tileDebugLabels&&this._tileDebugLabels.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),defined(this._schemaLoader)&&ResourceCache.unload(this._schemaLoader),defined(this._root)){var e=scratchStack;for(e.push(this._root);e.length>0;){var t=e.pop();t.destroy();for(var i=t.children,r=i.length,n=0;n<r;++n)e.push(i[n])}}return this._root=void 0,destroyObject(this)},Cesium3DTileset.supportedExtensions={"3DTILES_metadata":!0,"3DTILES_implicit_tiling":!0,"3DTILES_content_gltf":!0,"3DTILES_multiple_contents":!0,"3DTILES_bounding_volume_S2":!0,"3DTILES_batch_table_hierarchy":!0,"3DTILES_draco_point_compression":!0},Cesium3DTileset.checkSupportedExtensions=function(e){for(var t=0;t<e.length;t++)if(!Cesium3DTileset.supportedExtensions[e[t]])throw new RuntimeError("Unsupported 3D Tiles Extension: "+e[t])};var modelMatrixScratch$1=new Matrix4;function Cesium3DTilesetVisualizer(e,t){t.collectionChanged.addEventListener(Cesium3DTilesetVisualizer.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._tilesetHash={},this._entitiesToVisualize=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function removeTileset(e,t,i,r){var n=i[t.id];defined(n)&&(r.removeAndDestroy(n.tilesetPrimitive),delete i[t.id])}function checkLoad(e,t,i){e.readyPromise.otherwise((function(e){console.error(e),i[t.id].loadFail=!0}))}Cesium3DTilesetVisualizer.prototype.update=function(e){for(var t=this._entitiesToVisualize.values,i=this._tilesetHash,r=this._primitives,n=0,a=t.length;n<a;n++){var o,s,l=t[n],c=l._tileset,u=i[l.id],d=l.isShowing&&l.isAvailable(e)&&Property.getValueOrDefault(c._show,e,!0);if(d&&(s=l.computeModelMatrix(e,modelMatrixScratch$1),o=Resource.createIfNeeded(Property.getValueOrUndefined(c._uri,e))),d){var h=defined(u)?u.tilesetPrimitive:void 0;defined(h)&&o.url===u.url||(defined(h)&&(r.removeAndDestroy(h),delete i[l.id]),(h=new Cesium3DTileset({url:o})).id=l,r.add(h),u={tilesetPrimitive:h,url:o.url,loadFail:!1},i[l.id]=u,checkLoad(h,l,i)),h.show=!0,defined(s)&&(h.modelMatrix=s),h.maximumScreenSpaceError=Property.getValueOrDefault(c.maximumScreenSpaceError,e,h.maximumScreenSpaceError)}else defined(u)&&(u.tilesetPrimitive.show=!1)}return!0},Cesium3DTilesetVisualizer.prototype.isDestroyed=function(){return!1},Cesium3DTilesetVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Cesium3DTilesetVisualizer.prototype._onCollectionChanged,this);for(var e=this._entitiesToVisualize.values,t=this._tilesetHash,i=this._primitives,r=e.length-1;r>-1;r--)removeTileset(this,e[r],t,i);return destroyObject(this)},Cesium3DTilesetVisualizer.prototype.getBoundingSphere=function(e,t){var i=this._tilesetHash[e.id];if(!defined(i)||i.loadFail)return BoundingSphereState$1.FAILED;var r=i.tilesetPrimitive;return defined(r)&&r.show?r.ready?(BoundingSphere.clone(r.boundingSphere,t),BoundingSphereState$1.DONE):BoundingSphereState$1.PENDING:BoundingSphereState$1.FAILED},Cesium3DTilesetVisualizer.prototype._onCollectionChanged=function(e,t,i,r){var n,a,o=this._entitiesToVisualize,s=this._tilesetHash,l=this._primitives;for(n=t.length-1;n>-1;n--)defined((a=t[n])._tileset)&&o.set(a.id,a);for(n=r.length-1;n>-1;n--)defined((a=r[n])._tileset)?o.set(a.id,a):(removeTileset(this,a,s,l),o.remove(a.id));for(n=i.length-1;n>-1;n--)removeTileset(this,a=i[n],s,l),o.remove(a.id)};var defaultEvenColor$1=Color.WHITE,defaultOddColor$1=Color.BLACK,defaultRepeat$1=new Cartesian2(2,2);function CheckerboardMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.repeat=e.repeat}Object.defineProperties(CheckerboardMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._evenColor)&&Property.isConstant(this._oddColor)&&Property.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},evenColor:createPropertyDescriptor("evenColor"),oddColor:createPropertyDescriptor("oddColor"),repeat:createPropertyDescriptor("repeat")}),CheckerboardMaterialProperty.prototype.getType=function(e){return"Checkerboard"},CheckerboardMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.lightColor=Property.getValueOrClonedDefault(this._evenColor,e,defaultEvenColor$1,t.lightColor),t.darkColor=Property.getValueOrClonedDefault(this._oddColor,e,defaultOddColor$1,t.darkColor),t.repeat=Property.getValueOrDefault(this._repeat,e,defaultRepeat$1),t},CheckerboardMaterialProperty.prototype.equals=function(e){return this===e||e instanceof CheckerboardMaterialProperty&&Property.equals(this._evenColor,e._evenColor)&&Property.equals(this._oddColor,e._oddColor)&&Property.equals(this._repeat,e._repeat)};var entityOptionsScratch$1={id:void 0};function fireChangedEvent(e){if(e._firing)e._refire=!0;else if(0===e._suspendCount){var t=e._addedEntities,i=e._removedEntities,r=e._changedEntities;if(0!==r.length||0!==t.length||0!==i.length){e._firing=!0;do{e._refire=!1;var n=t.values.slice(0),a=i.values.slice(0),o=r.values.slice(0);t.removeAll(),i.removeAll(),r.removeAll(),e._collectionChanged.raiseEvent(e,n,a,o)}while(e._refire);e._firing=!1}}}function EntityCollection(e){this._owner=e,this._entities=new AssociativeArray,this._addedEntities=new AssociativeArray,this._removedEntities=new AssociativeArray,this._changedEntities=new AssociativeArray,this._suspendCount=0,this._collectionChanged=new Event,this._id=createGuid(),this._show=!0,this._firing=!1,this._refire=!1}EntityCollection.prototype.suspendEvents=function(){this._suspendCount++},EntityCollection.prototype.resumeEvents=function(){this._suspendCount--,fireChangedEvent(this)},EntityCollection.collectionChangedEventCallback=void 0,Object.defineProperties(EntityCollection.prototype,{collectionChanged:{get:function(){return this._collectionChanged}},id:{get:function(){return this._id}},values:{get:function(){return this._entities.values}},show:{get:function(){return this._show},set:function(e){if(e!==this._show){var t;this.suspendEvents();var i=[],r=this._entities.values,n=r.length;for(t=0;t<n;t++)i.push(r[t].isShowing);for(this._show=e,t=0;t<n;t++){var a=i[t],o=r[t];a!==o.isShowing&&o.definitionChanged.raiseEvent(o,"isShowing",o.isShowing,a)}this.resumeEvents()}}},owner:{get:function(){return this._owner}}}),EntityCollection.prototype.computeAvailability=function(){for(var e=Iso8601.MAXIMUM_VALUE,t=Iso8601.MINIMUM_VALUE,i=this._entities.values,r=0,n=i.length;r<n;r++){var a=i[r].availability;if(defined(a)){var o=a.start,s=a.stop;JulianDate.lessThan(o,e)&&!o.equals(Iso8601.MINIMUM_VALUE)&&(e=o),JulianDate.greaterThan(s,t)&&!s.equals(Iso8601.MAXIMUM_VALUE)&&(t=s)}}return Iso8601.MAXIMUM_VALUE.equals(e)&&(e=Iso8601.MINIMUM_VALUE),Iso8601.MINIMUM_VALUE.equals(t)&&(t=Iso8601.MAXIMUM_VALUE),new TimeInterval({start:e,stop:t})},EntityCollection.prototype.add=function(e){e instanceof Entity||(e=new Entity(e));var t=e.id,i=this._entities;if(i.contains(t))throw new RuntimeError("An entity with id "+t+" already exists in this collection.");return e.entityCollection=this,i.set(t,e),this._removedEntities.remove(t)||this._addedEntities.set(t,e),e.definitionChanged.addEventListener(EntityCollection.prototype._onEntityDefinitionChanged,this),fireChangedEvent(this),e},EntityCollection.prototype.remove=function(e){return!!defined(e)&&this.removeById(e.id)},EntityCollection.prototype.contains=function(e){return this._entities.get(e.id)===e},EntityCollection.prototype.removeById=function(e){if(!defined(e))return!1;var t=this._entities.get(e);return!!this._entities.remove(e)&&(this._addedEntities.remove(e)||(this._removedEntities.set(e,t),this._changedEntities.remove(e)),this._entities.remove(e),t.definitionChanged.removeEventListener(EntityCollection.prototype._onEntityDefinitionChanged,this),fireChangedEvent(this),!0)},EntityCollection.prototype.removeAll=function(){for(var e=this._entities,t=e.length,i=e.values,r=this._addedEntities,n=this._removedEntities,a=0;a<t;a++){var o=i[a],s=o.id;defined(r.get(s))||(o.definitionChanged.removeEventListener(EntityCollection.prototype._onEntityDefinitionChanged,this),n.set(s,o))}e.removeAll(),r.removeAll(),this._changedEntities.removeAll(),fireChangedEvent(this)},EntityCollection.prototype.getById=function(e){return this._entities.get(e)},EntityCollection.prototype.getOrCreateEntity=function(e){var t=this._entities.get(e);return defined(t)||(entityOptionsScratch$1.id=e,t=new Entity(entityOptionsScratch$1),this.add(t)),t},EntityCollection.prototype._onEntityDefinitionChanged=function(e){var t=e.id;this._addedEntities.contains(t)||this._changedEntities.set(t,e),fireChangedEvent(this)};var entityOptionsScratch={id:void 0},entityIdScratch=new Array(2);function clean(e){for(var t=e.propertyNames,i=t.length,r=0;r<i;r++)e[t[r]]=void 0;e._name=void 0,e._availability=void 0}function subscribeToEntity(e,t,i,r){entityIdScratch[0]=i,entityIdScratch[1]=r.id,t[JSON.stringify(entityIdScratch)]=r.definitionChanged.addEventListener(CompositeEntityCollection.prototype._onDefinitionChanged,e)}function unsubscribeFromEntity(e,t,i,r){entityIdScratch[0]=i,entityIdScratch[1]=r.id;var n=JSON.stringify(entityIdScratch);t[n](),t[n]=void 0}function recomposite(e){if(e._shouldRecomposite=!0,0===e._suspendCount){var t,i,r,n,a,o,s=e._collections,l=s.length,c=e._collectionsCopy,u=c.length,d=e._composite,h=new EntityCollection(e),p=e._eventHash;for(t=0;t<u;t++)for((a=c[t]).collectionChanged.removeEventListener(CompositeEntityCollection.prototype._onCollectionChanged,e),r=a.values,o=a.id,n=r.length-1;n>-1;n--)unsubscribeFromEntity(e,p,o,i=r[n]);for(t=l-1;t>=0;t--)for((a=s[t]).collectionChanged.addEventListener(CompositeEntityCollection.prototype._onCollectionChanged,e),r=a.values,o=a.id,n=r.length-1;n>-1;n--){subscribeToEntity(e,p,o,i=r[n]);var f=h.getById(i.id);defined(f)||(defined(f=d.getById(i.id))?clean(f):(entityOptionsScratch.id=i.id,f=new Entity(entityOptionsScratch)),h.add(f)),f.merge(i)}e._collectionsCopy=s.slice(0),d.suspendEvents(),d.removeAll();var m=h.values;for(t=0;t<m.length;t++)d.add(m[t]);d.resumeEvents()}}function CompositeEntityCollection(e,t){this._owner=t,this._composite=new EntityCollection(this),this._suspendCount=0,this._collections=defined(e)?e.slice():[],this._collectionsCopy=[],this._id=createGuid(),this._eventHash={},recomposite(this),this._shouldRecomposite=!1}function getCollectionIndex(e,t){return e.indexOf(t)}function swapCollections(e,t,i){var r=e._collections;if((t=CesiumMath.clamp(t,0,r.length-1))!==(i=CesiumMath.clamp(i,0,r.length-1))){var n=r[t];r[t]=r[i],r[i]=n,recomposite(e)}}function subscribeAll(e,t,i,r){function n(){i.raiseEvent(e)}var a=[];t.removeAll();for(var o=r.length,s=0;s<o;s++){var l=r.get(s);defined(l.data)&&-1===a.indexOf(l.data)&&t.add(l.data.definitionChanged,n)}}function CompositeProperty(){this._eventHelper=new EventHelper,this._definitionChanged=new Event,this._intervals=new TimeIntervalCollection,this._intervals.changedEvent.addEventListener(CompositeProperty.prototype._intervalsChanged,this)}function CompositeMaterialProperty(){this._definitionChanged=new Event,this._composite=new CompositeProperty,this._composite.definitionChanged.addEventListener(CompositeMaterialProperty.prototype._raiseDefinitionChanged,this)}function CompositePositionProperty(e){this._referenceFrame=defaultValue(e,ReferenceFrame$1.FIXED),this._definitionChanged=new Event,this._composite=new CompositeProperty,this._composite.definitionChanged.addEventListener(CompositePositionProperty.prototype._raiseDefinitionChanged,this)}Object.defineProperties(CompositeEntityCollection.prototype,{collectionChanged:{get:function(){return this._composite._collectionChanged}},id:{get:function(){return this._id}},values:{get:function(){return this._composite.values}},owner:{get:function(){return this._owner}}}),CompositeEntityCollection.prototype.addCollection=function(e,t){defined(t)?this._collections.splice(t,0,e):(t=this._collections.length,this._collections.push(e)),recomposite(this)},CompositeEntityCollection.prototype.removeCollection=function(e){var t=this._collections.indexOf(e);return-1!==t&&(this._collections.splice(t,1),recomposite(this),!0)},CompositeEntityCollection.prototype.removeAllCollections=function(){this._collections.length=0,recomposite(this)},CompositeEntityCollection.prototype.containsCollection=function(e){return-1!==this._collections.indexOf(e)},CompositeEntityCollection.prototype.contains=function(e){return this._composite.contains(e)},CompositeEntityCollection.prototype.indexOfCollection=function(e){return this._collections.indexOf(e)},CompositeEntityCollection.prototype.getCollection=function(e){return this._collections[e]},CompositeEntityCollection.prototype.getCollectionsLength=function(){return this._collections.length},CompositeEntityCollection.prototype.raiseCollection=function(e){var t=getCollectionIndex(this._collections,e);swapCollections(this,t,t+1)},CompositeEntityCollection.prototype.lowerCollection=function(e){var t=getCollectionIndex(this._collections,e);swapCollections(this,t,t-1)},CompositeEntityCollection.prototype.raiseCollectionToTop=function(e){var t=getCollectionIndex(this._collections,e);t!==this._collections.length-1&&(this._collections.splice(t,1),this._collections.push(e),recomposite(this))},CompositeEntityCollection.prototype.lowerCollectionToBottom=function(e){var t=getCollectionIndex(this._collections,e);0!==t&&(this._collections.splice(t,1),this._collections.splice(0,0,e),recomposite(this))},CompositeEntityCollection.prototype.suspendEvents=function(){this._suspendCount++,this._composite.suspendEvents()},CompositeEntityCollection.prototype.resumeEvents=function(){this._suspendCount--,this._shouldRecomposite&&0===this._suspendCount&&(recomposite(this),this._shouldRecomposite=!1),this._composite.resumeEvents()},CompositeEntityCollection.prototype.computeAvailability=function(){return this._composite.computeAvailability()},CompositeEntityCollection.prototype.getById=function(e){return this._composite.getById(e)},CompositeEntityCollection.prototype._onCollectionChanged=function(e,t,i){var r,n,a,o,s=this._collectionsCopy,l=s.length,c=this._composite;c.suspendEvents();var u=i.length,d=this._eventHash,h=e.id;for(r=0;r<u;r++){var p=i[r];unsubscribeFromEntity(this,d,h,p);var f=p.id;for(n=l-1;n>=0;n--)defined(a=s[n].getById(f))&&(defined(o)||clean(o=c.getById(f)),o.merge(a));defined(o)||c.removeById(f),o=void 0}var m=t.length;for(r=0;r<m;r++){var g=t[r];subscribeToEntity(this,d,h,g);var _=g.id;for(n=l-1;n>=0;n--)defined(a=s[n].getById(_))&&(defined(o)||(defined(o=c.getById(_))?clean(o):(entityOptionsScratch.id=_,o=new Entity(entityOptionsScratch),c.add(o))),o.merge(a));o=void 0}c.resumeEvents()},CompositeEntityCollection.prototype._onDefinitionChanged=function(e,t,i,r){for(var n=this._collections,a=this._composite,o=n.length,s=e.id,l=a.getById(s),c=l[t],u=!defined(c),d=!0,h=o-1;h>=0;h--){var p=n[h].getById(e.id);if(defined(p)){var f=p[t];if(defined(f)){if(d){if(d=!1,!defined(f.merge)||!defined(f.clone)){c=f;break}c=f.clone(c)}c.merge(f)}}}u&&-1===l.propertyNames.indexOf(t)&&l.addProperty(t),l[t]=c},Object.defineProperties(CompositeProperty.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),CompositeProperty.prototype.getValue=function(e,t){var i=this._intervals.findDataForIntervalContainingDate(e);if(defined(i))return i.getValue(e,t)},CompositeProperty.prototype.equals=function(e){return this===e||e instanceof CompositeProperty&&this._intervals.equals(e._intervals,Property.equals)},CompositeProperty.prototype._intervalsChanged=function(){subscribeAll(this,this._eventHelper,this._definitionChanged,this._intervals),this._definitionChanged.raiseEvent(this)},Object.defineProperties(CompositeMaterialProperty.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite._intervals}}}),CompositeMaterialProperty.prototype.getType=function(e){var t=this._composite._intervals.findDataForIntervalContainingDate(e);if(defined(t))return t.getType(e)},CompositeMaterialProperty.prototype.getValue=function(e,t){var i=this._composite._intervals.findDataForIntervalContainingDate(e);if(defined(i))return i.getValue(e,t)},CompositeMaterialProperty.prototype.equals=function(e){return this===e||e instanceof CompositeMaterialProperty&&this._composite.equals(e._composite,Property.equals)},CompositeMaterialProperty.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(CompositePositionProperty.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite.intervals}},referenceFrame:{get:function(){return this._referenceFrame},set:function(e){this._referenceFrame=e}}}),CompositePositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},CompositePositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){var r=this._composite._intervals.findDataForIntervalContainingDate(e);if(defined(r))return r.getValueInReferenceFrame(e,t,i)},CompositePositionProperty.prototype.equals=function(e){return this===e||e instanceof CompositePositionProperty&&this._referenceFrame===e._referenceFrame&&this._composite.equals(e._composite,Property.equals)},CompositePositionProperty.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var defaultZIndex$1=new ConstantProperty(0);function GroundGeometryUpdater(e){GeometryUpdater.call(this,e),this._zIndex=0,this._terrainOffsetProperty=void 0}defined(Object.create)&&(GroundGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),GroundGeometryUpdater.prototype.constructor=GroundGeometryUpdater),Object.defineProperties(GroundGeometryUpdater.prototype,{zIndex:{get:function(){return this._zIndex}},terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),GroundGeometryUpdater.prototype._isOnTerrain=function(e,t){return this._fillEnabled&&!defined(t.height)&&!defined(t.extrudedHeight)&&GroundPrimitive.isSupported(this._scene)},GroundGeometryUpdater.prototype._getIsClosed=function(e){var t=e.height,i=e.extrudedHeight;return 0===t||defined(i)&&i!==t},GroundGeometryUpdater.prototype._computeCenter=DeveloperError.throwInstantiationError,GroundGeometryUpdater.prototype._onEntityPropertyChanged=function(e,t,i,r){if(GeometryUpdater.prototype._onEntityPropertyChanged.call(this,e,t,i,r),-1!==this._observedPropertyNames.indexOf(t)){var n=this._entity[this._geometryPropertyName];if(defined(n)){defined(n.zIndex)&&(defined(n.height)||defined(n.extrudedHeight))&&oneTimeWarning(oneTimeWarning.geometryZIndex),this._zIndex=defaultValue(n.zIndex,defaultZIndex$1),defined(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);var a=n.heightReference,o=n.extrudedHeightReference;if(defined(a)||defined(o)){var s=new CallbackProperty(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new TerrainOffsetProperty(this._scene,s,a,o)}}}},GroundGeometryUpdater.prototype.destroy=function(){defined(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0),GeometryUpdater.prototype.destroy.call(this)},GroundGeometryUpdater.getGeometryHeight=function(e,t){if(defined(e))return t!==HeightReference$1.CLAMP_TO_GROUND?e:0;t!==HeightReference$1.NONE&&oneTimeWarning(oneTimeWarning.geometryHeightReference)},GroundGeometryUpdater.getGeometryExtrudedHeight=function(e,t){if(defined(e))return t!==HeightReference$1.CLAMP_TO_GROUND?e:GroundGeometryUpdater.CLAMP_TO_GROUND;t!==HeightReference$1.NONE&&oneTimeWarning(oneTimeWarning.geometryExtrudedHeightReference)},GroundGeometryUpdater.CLAMP_TO_GROUND="clamp",GroundGeometryUpdater.computeGeometryOffsetAttribute=function(e,t,i,r){defined(e)&&defined(t)||(t=HeightReference$1.NONE),defined(i)&&defined(r)||(r=HeightReference$1.NONE);var n=0;return t!==HeightReference$1.NONE&&n++,r===HeightReference$1.RELATIVE_TO_GROUND&&n++,2===n?GeometryOffsetAttribute$1.ALL:1===n?GeometryOffsetAttribute$1.TOP:void 0};var scratchColor$d=new Color,defaultOffset$9=Cartesian3.ZERO,offsetScratch$8=new Cartesian3,scratchRectangle$4=new Rectangle;function CorridorGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.cornerType=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.offsetAttribute=void 0}function CorridorGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new CorridorGeometryOptions(e),geometryPropertyName:"corridor",observedPropertyNames:["availability","corridor"]}),this._onEntityPropertyChanged(e,"corridor",e.corridor,void 0)}function DynamicCorridorGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}function DataSource(){DeveloperError.throwInstantiationError()}function PointPrimitive(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucencyByDistance,r=e.scaleByDistance,n=e.distanceDisplayCondition;defined(i)&&(i=NearFarScalar.clone(i)),defined(r)&&(r=NearFarScalar.clone(r)),defined(n)&&(n=DistanceDisplayCondition.clone(n)),this._show=defaultValue(e.show,!0),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this._actualPosition=Cartesian3.clone(this._position),this._color=Color.clone(defaultValue(e.color,Color.WHITE)),this._outlineColor=Color.clone(defaultValue(e.outlineColor,Color.TRANSPARENT)),this._outlineWidth=defaultValue(e.outlineWidth,0),this._pixelSize=defaultValue(e.pixelSize,10),this._scaleByDistance=r,this._translucencyByDistance=i,this._distanceDisplayCondition=n,this._disableDepthTestDistance=defaultValue(e.disableDepthTestDistance,0),this._id=e.id,this._collection=defaultValue(e.collection,t),this._clusterShow=!0,this._pickId=void 0,this._pointPrimitiveCollection=t,this._dirty=!1,this._index=-1}defined(Object.create)&&(CorridorGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),CorridorGeometryUpdater.prototype.constructor=CorridorGeometryUpdater),CorridorGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n={show:new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$d)),defined(t)||(t=Color.WHITE),n.color=ColorGeometryInstanceAttribute.fromColor(t));return defined(this._options.offsetAttribute)&&(n.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$9,offsetScratch$8))),new GeometryInstance({id:i,geometry:new CorridorGeometry(this._options),attributes:n})},CorridorGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$d),n={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0};return defined(this._options.offsetAttribute)&&(n.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$9,offsetScratch$8))),new GeometryInstance({id:t,geometry:new CorridorOutlineGeometry(this._options),attributes:n})},CorridorGeometryUpdater.prototype._computeCenter=function(e,t){var i=Property.getValueOrUndefined(this._entity.corridor.positions,e);if(defined(i)&&0!==i.length)return Cartesian3.clone(i[Math.floor(i.length/2)],t)},CorridorGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.positions)||!defined(t.width)||GeometryUpdater.prototype._isHidden.call(this,e,t)},CorridorGeometryUpdater.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.width)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.cornerType)||!Property.isConstant(t.zIndex)||this._onTerrain&&!Property.isConstant(this._materialProperty)&&!(this._materialProperty instanceof ColorMaterialProperty)},CorridorGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE),r=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),n=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE),a=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);defined(n)&&!defined(i)&&(i=0);var o=this._options;o.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,o.positions=t.positions.getValue(Iso8601.MINIMUM_VALUE,o.positions),o.width=t.width.getValue(Iso8601.MINIMUM_VALUE),o.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),o.cornerType=Property.getValueOrUndefined(t.cornerType,Iso8601.MINIMUM_VALUE),o.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(i,r,n,a),o.height=GroundGeometryUpdater.getGeometryHeight(i,r),(n=GroundGeometryUpdater.getGeometryExtrudedHeight(n,a))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(n=ApproximateTerrainHeights.getMinimumMaximumHeights(CorridorGeometry.computeRectangle(o,scratchRectangle$4)).minimumTerrainHeight),o.extrudedHeight=n},CorridorGeometryUpdater.DynamicGeometryUpdater=DynamicCorridorGeometryUpdater,defined(Object.create)&&(DynamicCorridorGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicCorridorGeometryUpdater.prototype.constructor=DynamicCorridorGeometryUpdater),DynamicCorridorGeometryUpdater.prototype._isHidden=function(e,t,i){var r=this._options;return!defined(r.positions)||!defined(r.width)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicCorridorGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options,n=Property.getValueOrUndefined(t.height,i),a=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),o=Property.getValueOrUndefined(t.extrudedHeight,i),s=Property.getValueOrDefault(t.extrudedHeightReference,i,HeightReference$1.NONE);defined(o)&&!defined(n)&&(n=0),r.positions=Property.getValueOrUndefined(t.positions,i),r.width=Property.getValueOrUndefined(t.width,i),r.granularity=Property.getValueOrUndefined(t.granularity,i),r.cornerType=Property.getValueOrUndefined(t.cornerType,i),r.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(n,a,o,s),r.height=GroundGeometryUpdater.getGeometryHeight(n,a),(o=GroundGeometryUpdater.getGeometryExtrudedHeight(o,s))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(o=ApproximateTerrainHeights.getMinimumMaximumHeights(CorridorGeometry.computeRectangle(r,scratchRectangle$4)).minimumTerrainHeight),r.extrudedHeight=o},Object.defineProperties(DataSource.prototype,{name:{get:DeveloperError.throwInstantiationError},clock:{get:DeveloperError.throwInstantiationError},entities:{get:DeveloperError.throwInstantiationError},isLoading:{get:DeveloperError.throwInstantiationError},changedEvent:{get:DeveloperError.throwInstantiationError},errorEvent:{get:DeveloperError.throwInstantiationError},loadingEvent:{get:DeveloperError.throwInstantiationError},show:{get:DeveloperError.throwInstantiationError},clustering:{get:DeveloperError.throwInstantiationError}}),DataSource.prototype.update=function(e){DeveloperError.throwInstantiationError()},DataSource.setLoading=function(e,t){e._isLoading!==t&&(t?e._entityCollection.suspendEvents():e._entityCollection.resumeEvents(),e._isLoading=t,e._loading.raiseEvent(e,t))};var SHOW_INDEX$3=PointPrimitive.SHOW_INDEX=0,POSITION_INDEX$3=PointPrimitive.POSITION_INDEX=1,COLOR_INDEX$3=PointPrimitive.COLOR_INDEX=2,OUTLINE_COLOR_INDEX$1=PointPrimitive.OUTLINE_COLOR_INDEX=3,OUTLINE_WIDTH_INDEX$1=PointPrimitive.OUTLINE_WIDTH_INDEX=4,PIXEL_SIZE_INDEX$1=PointPrimitive.PIXEL_SIZE_INDEX=5,SCALE_BY_DISTANCE_INDEX$1=PointPrimitive.SCALE_BY_DISTANCE_INDEX=6,TRANSLUCENCY_BY_DISTANCE_INDEX$1=PointPrimitive.TRANSLUCENCY_BY_DISTANCE_INDEX=7,DISTANCE_DISPLAY_CONDITION_INDEX$1=PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX=8,DISABLE_DEPTH_DISTANCE_INDEX$1=PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX=9;function makeDirty$1(e,t){var i=e._pointPrimitiveCollection;defined(i)&&(i._updatePointPrimitive(e,t),e._dirty=!0)}PointPrimitive.NUMBER_OF_PROPERTIES=10,Object.defineProperties(PointPrimitive.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,makeDirty$1(this,SHOW_INDEX$3))}},position:{get:function(){return this._position},set:function(e){var t=this._position;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),Cartesian3.clone(e,this._actualPosition),makeDirty$1(this,POSITION_INDEX$3))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){var t=this._scaleByDistance;NearFarScalar.equals(t,e)||(this._scaleByDistance=NearFarScalar.clone(e,t),makeDirty$1(this,SCALE_BY_DISTANCE_INDEX$1))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;NearFarScalar.equals(t,e)||(this._translucencyByDistance=NearFarScalar.clone(e,t),makeDirty$1(this,TRANSLUCENCY_BY_DISTANCE_INDEX$1))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){this._pixelSize!==e&&(this._pixelSize=e,makeDirty$1(this,PIXEL_SIZE_INDEX$1))}},color:{get:function(){return this._color},set:function(e){var t=this._color;Color.equals(t,e)||(Color.clone(e,t),makeDirty$1(this,COLOR_INDEX$3))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;Color.equals(t,e)||(Color.clone(e,t),makeDirty$1(this,OUTLINE_COLOR_INDEX$1))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,makeDirty$1(this,OUTLINE_WIDTH_INDEX$1))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){DistanceDisplayCondition.equals(this._distanceDisplayCondition,e)||(this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition),makeDirty$1(this,DISTANCE_DISPLAY_CONDITION_INDEX$1))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,makeDirty$1(this,DISABLE_DEPTH_DISTANCE_INDEX$1))}},id:{get:function(){return this._id},set:function(e){this._id=e,defined(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,makeDirty$1(this,SHOW_INDEX$3))}}}),PointPrimitive.prototype.getPickId=function(e){return defined(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId},PointPrimitive.prototype._getActualPosition=function(){return this._actualPosition},PointPrimitive.prototype._setActualPosition=function(e){Cartesian3.clone(e,this._actualPosition),makeDirty$1(this,POSITION_INDEX$3)};var tempCartesian3=new Cartesian4;PointPrimitive._computeActualPosition=function(e,t,i){return t.mode===SceneMode$1.SCENE3D?e:(Matrix4.multiplyByPoint(i,e,tempCartesian3),SceneTransforms.computeActualWgs84Position(t,tempCartesian3))};var scratchCartesian4$2=new Cartesian4;PointPrimitive._computeScreenSpacePosition=function(e,t,i,r){var n=Matrix4.multiplyByVector(e,Cartesian4.fromElements(t.x,t.y,t.z,1,scratchCartesian4$2),scratchCartesian4$2);return SceneTransforms.wgs84ToWindowCoordinates(i,n,r)},PointPrimitive.prototype.computeScreenSpacePosition=function(e,t){var i=this._pointPrimitiveCollection;defined(t)||(t=new Cartesian2);var r=i.modelMatrix,n=PointPrimitive._computeScreenSpacePosition(r,this._actualPosition,e,t);if(defined(n))return n.y=e.canvas.clientHeight-n.y,n},PointPrimitive.getScreenSpaceBoundingBox=function(e,t,i){var r=e.pixelSize,n=.5*r,a=t.x-n,o=t.y-n,s=r,l=r;return defined(i)||(i=new BoundingRectangle),i.x=a,i.y=o,i.width=s,i.height=l,i},PointPrimitive.prototype.equals=function(e){return this===e||defined(e)&&this._id===e._id&&Cartesian3.equals(this._position,e._position)&&Color.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&Color.equals(this._outlineColor,e._outlineColor)&&NearFarScalar.equals(this._scaleByDistance,e._scaleByDistance)&&NearFarScalar.equals(this._translucencyByDistance,e._translucencyByDistance)&&DistanceDisplayCondition.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance},PointPrimitive.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0};var PointPrimitiveCollectionFS="varying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\nvarying vec4 v_pickColor;\nvoid main()\n{\nfloat distanceToCenter = length(gl_PointCoord - vec2(0.5));\nfloat maxDistance = max(0.0, 0.5 - v_pixelDistance);\nfloat wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\nfloat innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\nvec4 color = mix(v_outlineColor, v_color, innerAlpha);\ncolor.a *= wholeAlpha;\n#if !defined(OPAQUE) && !defined(TRANSLUCENT)\nif (color.a < 0.005)\n{\ndiscard;\n}\n#else\n#ifdef OPAQUE\nif (color.a < 0.995)\n{\ndiscard;\n}\n#else\nif (color.a >= 0.995)\n{\ndiscard;\n}\n#endif\n#endif\ngl_FragColor = czm_gammaCorrect(color);\nczm_writeLogDepth();\n}\n",PointPrimitiveCollectionVS="uniform float u_maxTotalPointSize;\nattribute vec4 positionHighAndSize;\nattribute vec4 positionLowAndOutline;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 scaleByDistance;\nattribute vec3 distanceDisplayConditionAndDisableDepth;\nvarying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\nvarying vec4 v_pickColor;\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nvoid main()\n{\nvec3 positionHigh = positionHighAndSize.xyz;\nvec3 positionLow = positionLowAndOutline.xyz;\nfloat outlineWidthBothSides = 2.0 * positionLowAndOutline.w;\nfloat totalSize = positionHighAndSize.w + outlineWidthBothSides;\nfloat outlinePercent = outlineWidthBothSides / totalSize;\ntotalSize *= czm_pixelRatio;\ntotalSize += 3.0;\nfloat temp = compressedAttribute1.x * SHIFT_RIGHT8;\nfloat show = floor(temp);\n#ifdef EYE_DISTANCE_TRANSLUCENCY\nvec4 translucencyByDistance;\ntranslucencyByDistance.x = compressedAttribute1.z;\ntranslucencyByDistance.z = compressedAttribute1.w;\ntranslucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\ntemp = compressedAttribute1.y * SHIFT_RIGHT8;\ntranslucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\nvec4 color;\nvec4 outlineColor;\nvec4 pickColor;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\npickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor.r = floor(temp);\ntemp = compressedAttribute0.x * SHIFT_RIGHT8;\ncolor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\ncolor.g = (temp - floor(temp)) * SHIFT_LEFT8;\ncolor.r = floor(temp);\ntemp = compressedAttribute0.y * SHIFT_RIGHT8;\noutlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.r = floor(temp);\ntemp = compressedAttribute0.w * SHIFT_RIGHT8;\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor = pickColor / 255.0;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor /= 255.0;\ncolor.a = floor(temp);\ncolor /= 255.0;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\n#endif\n#ifdef EYE_DISTANCE_SCALING\ntotalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);\n#endif\ntotalSize = min(totalSize, u_maxTotalPointSize);\nif (totalSize < 1.0)\n{\npositionEC.xyz = vec3(0.0);\ntotalSize = 1.0;\n}\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency < 0.004)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\n#ifdef DISTANCE_DISPLAY_CONDITION\nfloat nearSq = distanceDisplayConditionAndDisableDepth.x;\nfloat farSq = distanceDisplayConditionAndDisableDepth.y;\nif (lengthSq < nearSq || lengthSq > farSq) {\npositionEC.xyz = vec3(0.0, 0.0, 1.0);\n}\n#endif\ngl_Position = czm_projection * positionEC;\nczm_vertexLogDepth();\n#ifdef DISABLE_DEPTH_DISTANCE\nfloat disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;\nif (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n{\ndisableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n}\nif (disableDepthTestDistance != 0.0)\n{\nfloat zclip = gl_Position.z / gl_Position.w;\nbool clipped = (zclip < -1.0 || zclip > 1.0);\nif (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n{\ngl_Position.z = -gl_Position.w;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth(vec4(czm_currentFrustum.x));\n#endif\n}\n}\n#endif\nv_color = color;\nv_color.a *= translucency * show;\nv_outlineColor = outlineColor;\nv_outlineColor.a *= translucency * show;\nv_innerPercent = 1.0 - outlinePercent;\nv_pixelDistance = 2.0 / totalSize;\ngl_PointSize = totalSize * show;\ngl_Position *= show;\nv_pickColor = pickColor;\n}\n",SHOW_INDEX$2=PointPrimitive.SHOW_INDEX,POSITION_INDEX$2=PointPrimitive.POSITION_INDEX,COLOR_INDEX$2=PointPrimitive.COLOR_INDEX,OUTLINE_COLOR_INDEX=PointPrimitive.OUTLINE_COLOR_INDEX,OUTLINE_WIDTH_INDEX=PointPrimitive.OUTLINE_WIDTH_INDEX,PIXEL_SIZE_INDEX=PointPrimitive.PIXEL_SIZE_INDEX,SCALE_BY_DISTANCE_INDEX=PointPrimitive.SCALE_BY_DISTANCE_INDEX,TRANSLUCENCY_BY_DISTANCE_INDEX=PointPrimitive.TRANSLUCENCY_BY_DISTANCE_INDEX,DISTANCE_DISPLAY_CONDITION_INDEX=PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX,DISABLE_DEPTH_DISTANCE_INDEX=PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX,NUMBER_OF_PROPERTIES$1=PointPrimitive.NUMBER_OF_PROPERTIES,attributeLocations$2={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function PointPrimitiveCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$1),this._maxPixelSize=1,this._baseVolume=new BoundingSphere,this._baseVolumeWC=new BoundingSphere,this._baseVolume2D=new BoundingSphere,this._boundingVolume=new BoundingSphere,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.blendOption=defaultValue(e.blendOption,BlendOption$1.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=SceneMode$1.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW];var t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}function destroyPointPrimitives(e){for(var t=e.length,i=0;i<t;++i)e[i]&&e[i]._destroy()}function removePointPrimitives(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;for(var t=[],i=e._pointPrimitives,r=i.length,n=0,a=0;n<r;++n){var o=i[n];o&&(o._index=a++,t.push(o))}e._pointPrimitives=t}}function createVAF$1(e,t,i){return new VertexArrayFacade(e,[{index:attributeLocations$2.positionHighAndSize,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[POSITION_INDEX$2]},{index:attributeLocations$2.positionLowAndShow,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[POSITION_INDEX$2]},{index:attributeLocations$2.compressedAttribute0,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[COLOR_INDEX$2]},{index:attributeLocations$2.compressedAttribute1,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[TRANSLUCENCY_BY_DISTANCE_INDEX]},{index:attributeLocations$2.scaleByDistance,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[SCALE_BY_DISTANCE_INDEX]},{index:attributeLocations$2.distanceDisplayConditionAndDisableDepth,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[DISTANCE_DISPLAY_CONDITION_INDEX]}],t)}Object.defineProperties(PointPrimitiveCollection.prototype,{length:{get:function(){return removePointPrimitives(this),this._pointPrimitives.length}}}),PointPrimitiveCollection.prototype.add=function(e){var t=new PointPrimitive(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t},PointPrimitiveCollection.prototype.remove=function(e){return!!this.contains(e)&&(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},PointPrimitiveCollection.prototype.removeAll=function(){destroyPointPrimitives(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0},PointPrimitiveCollection.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]},PointPrimitiveCollection.prototype.contains=function(e){return defined(e)&&e._pointPrimitiveCollection===this},PointPrimitiveCollection.prototype.get=function(e){return removePointPrimitives(this),this._pointPrimitives[e]},PointPrimitiveCollection.prototype.computeNewBuffersUsage=function(){for(var e=this._buffersUsage,t=!1,i=this._propertiesChanged,r=0;r<NUMBER_OF_PROPERTIES$1;++r){var n=0===i[r]?BufferUsage$1.STATIC_DRAW:BufferUsage$1.STREAM_DRAW;t=t||e[r]!==n,e[r]=n}return t};var writePositionScratch$1=new EncodedCartesian3;function writePositionSizeAndOutline(e,t,i,r){var n=r._index,a=r._getActualPosition();e._mode===SceneMode$1.SCENE3D&&(BoundingSphere.expand(e._baseVolume,a,e._baseVolume),e._boundingVolumeDirty=!0),EncodedCartesian3.fromCartesian(a,writePositionScratch$1);var o=r.pixelSize,s=r.outlineWidth;e._maxPixelSize=Math.max(e._maxPixelSize,o+s);var l=i[attributeLocations$2.positionHighAndSize],c=writePositionScratch$1.high;l(n,c.x,c.y,c.z,o);var u=i[attributeLocations$2.positionLowAndOutline],d=writePositionScratch$1.low;u(n,d.x,d.y,d.z,s)}var LEFT_SHIFT16=65536,LEFT_SHIFT8=256;function writeCompressedAttrib0(e,t,i,r){var n=r._index,a=r.color,o=r.getPickId(t).color,s=r.outlineColor,l=Color.floatToByte(a.red),c=Color.floatToByte(a.green),u=Color.floatToByte(a.blue),d=l*LEFT_SHIFT16+c*LEFT_SHIFT8+u;l=Color.floatToByte(s.red),c=Color.floatToByte(s.green),u=Color.floatToByte(s.blue);var h=l*LEFT_SHIFT16+c*LEFT_SHIFT8+u;l=Color.floatToByte(o.red),c=Color.floatToByte(o.green),u=Color.floatToByte(o.blue);var p=l*LEFT_SHIFT16+c*LEFT_SHIFT8+u,f=Color.floatToByte(a.alpha)*LEFT_SHIFT16+Color.floatToByte(s.alpha)*LEFT_SHIFT8+Color.floatToByte(o.alpha);(0,i[attributeLocations$2.compressedAttribute0])(n,d,h,p,f)}function writeCompressedAttrib1(e,t,i,r){var n=r._index,a=0,o=1,s=1,l=1,c=r.translucencyByDistance;defined(c)&&(a=c.near,o=c.nearValue,s=c.far,l=c.farValue,1===o&&1===l||(e._shaderTranslucencyByDistance=!0));var u=r.show&&r.clusterShow;0===r.color.alpha&&0===r.outlineColor.alpha&&(u=!1),o=CesiumMath.clamp(o,0,1);var d=(u?1:0)*LEFT_SHIFT8+(o=1===o?255:255*o|0),h=l=1===(l=CesiumMath.clamp(l,0,1))?255:255*l|0;(0,i[attributeLocations$2.compressedAttribute1])(n,d,h,a,s)}function writeScaleByDistance(e,t,i,r){var n=r._index,a=i[attributeLocations$2.scaleByDistance],o=0,s=1,l=1,c=1,u=r.scaleByDistance;defined(u)&&(o=u.near,s=u.nearValue,l=u.far,c=u.farValue,1===s&&1===c||(e._shaderScaleByDistance=!0)),a(n,o,s,l,c)}function writeDistanceDisplayConditionAndDepthDisable(e,t,i,r){var n=r._index,a=i[attributeLocations$2.distanceDisplayConditionAndDisableDepth],o=0,s=Number.MAX_VALUE,l=r.distanceDisplayCondition;defined(l)&&(o=l.near,s=l.far,o*=o,s*=s,e._shaderDistanceDisplayCondition=!0);var c=r.disableDepthTestDistance;(c*=c)>0&&(e._shaderDisableDepthDistance=!0,c===Number.POSITIVE_INFINITY&&(c=-1)),a(n,o,s,c)}function writePointPrimitive(e,t,i,r){writePositionSizeAndOutline(e,t,i,r),writeCompressedAttrib0(e,t,i,r),writeCompressedAttrib1(e,t,i,r),writeScaleByDistance(e,t,i,r),writeDistanceDisplayConditionAndDepthDisable(e,t,i,r)}function recomputeActualPositions(e,t,i,r,n,a){var o;r.mode===SceneMode$1.SCENE3D?(o=e._baseVolume,e._boundingVolumeDirty=!0):o=e._baseVolume2D;for(var s=[],l=0;l<i;++l){var c=t[l],u=c.position,d=PointPrimitive._computeActualPosition(u,r,n);defined(d)&&(c._setActualPosition(d),a?s.push(d):BoundingSphere.expand(o,d,o))}a&&BoundingSphere.fromPoints(s,o)}function updateMode(e,t){var i=t.mode,r=e._pointPrimitives,n=e._pointPrimitivesToUpdate,a=e._modelMatrix;e._createVertexArray||e._mode!==i||i!==SceneMode$1.SCENE3D&&!Matrix4.equals(a,e.modelMatrix)?(e._mode=i,Matrix4.clone(e.modelMatrix,a),e._createVertexArray=!0,i!==SceneMode$1.SCENE3D&&i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions(e,r,r.length,t,a,!0)):i===SceneMode$1.MORPHING?recomputeActualPositions(e,r,r.length,t,a,!0):i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions(e,n,e._pointPrimitivesToUpdateIndex,t,a,!1)}function updateBoundingVolume(e,t,i){var r=t.camera.getPixelSize(i,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*e._maxPixelSize;i.radius+=r}var scratchWriterArray$1=[];function sortKD(e,t,i,r,n,a){if(n-r<=i)return;const o=r+n>>1;select(e,t,o,r,n,a%2),sortKD(e,t,i,r,o-1,a+1),sortKD(e,t,i,o+1,n,a+1)}function select(e,t,i,r,n,a){for(;n>r;){if(n-r>600){const o=n-r+1,s=i-r+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1);select(e,t,i,Math.max(r,Math.floor(i-s*c/o+u)),Math.min(n,Math.floor(i+(o-s)*c/o+u)),a)}const o=t[2*i+a];let s=r,l=n;for(swapItem(e,t,r,i),t[2*n+a]>o&&swapItem(e,t,r,n);s<l;){for(swapItem(e,t,s,l),s++,l--;t[2*s+a]<o;)s++;for(;t[2*l+a]>o;)l--}t[2*r+a]===o?swapItem(e,t,r,l):(l++,swapItem(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function swapItem(e,t,i,r){swap(e,i,r),swap(t,2*i,2*r),swap(t,2*i+1,2*r+1)}function swap(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function range(e,t,i,r,n,a,o){const s=[0,e.length-1,0],l=[];let c,u;for(;s.length;){const d=s.pop(),h=s.pop(),p=s.pop();if(h-p<=o){for(let o=p;o<=h;o++)c=t[2*o],u=t[2*o+1],c>=i&&c<=n&&u>=r&&u<=a&&l.push(e[o]);continue}const f=Math.floor((p+h)/2);c=t[2*f],u=t[2*f+1],c>=i&&c<=n&&u>=r&&u<=a&&l.push(e[f]);const m=(d+1)%2;(0===d?i<=c:r<=u)&&(s.push(p),s.push(f-1),s.push(m)),(0===d?n>=c:a>=u)&&(s.push(f+1),s.push(h),s.push(m))}return l}function within(e,t,i,r,n,a){const o=[0,e.length-1,0],s=[],l=n*n;for(;o.length;){const c=o.pop(),u=o.pop(),d=o.pop();if(u-d<=a){for(let n=d;n<=u;n++)sqDist(t[2*n],t[2*n+1],i,r)<=l&&s.push(e[n]);continue}const h=Math.floor((d+u)/2),p=t[2*h],f=t[2*h+1];sqDist(p,f,i,r)<=l&&s.push(e[h]);const m=(c+1)%2;(0===c?i-n<=p:r-n<=f)&&(o.push(d),o.push(h-1),o.push(m)),(0===c?i+n>=p:r+n>=f)&&(o.push(h+1),o.push(u),o.push(m))}return s}function sqDist(e,t,i,r){const n=e-i,a=t-r;return n*n+a*a}PointPrimitiveCollection.prototype.update=function(e){if(removePointPrimitives(this),this.show){this._maxTotalPointSize=ContextLimits.maximumAliasedPointSize,updateMode(this,e);var t,i=this._pointPrimitives.length,r=this._pointPrimitivesToUpdate,n=this._pointPrimitivesToUpdateIndex,a=this._propertiesChanged,o=this._createVertexArray,s=e.context,l=e.passes,c=l.pick;if(o||!c&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(var u=0;u<NUMBER_OF_PROPERTIES$1;++u)a[u]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),i>0){this._vaf=createVAF$1(s,i,this._buffersUsage),t=this._vaf.writers;for(var d=0;d<i;++d){var h=this._pointPrimitives[d];h._dirty=!1,writePointPrimitive(this,s,t,h)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(n>0){var p=scratchWriterArray$1;p.length=0,(a[POSITION_INDEX$2]||a[OUTLINE_WIDTH_INDEX]||a[PIXEL_SIZE_INDEX])&&p.push(writePositionSizeAndOutline),(a[COLOR_INDEX$2]||a[OUTLINE_COLOR_INDEX])&&p.push(writeCompressedAttrib0),(a[SHOW_INDEX$2]||a[TRANSLUCENCY_BY_DISTANCE_INDEX])&&p.push(writeCompressedAttrib1),a[SCALE_BY_DISTANCE_INDEX]&&p.push(writeScaleByDistance),(a[DISTANCE_DISPLAY_CONDITION_INDEX]||a[DISABLE_DEPTH_DISTANCE_INDEX])&&p.push(writeDistanceDisplayConditionAndDepthDisable);var f=p.length;if(t=this._vaf.writers,n/i>.1){for(var m=0;m<n;++m){var g=r[m];g._dirty=!1;for(var _=0;_<f;++_)p[_](this,s,t,g)}this._vaf.commit()}else{for(var y=0;y<n;++y){var v=r[y];v._dirty=!1;for(var C=0;C<f;++C)p[C](this,s,t,v);this._vaf.subCommit(v._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(n>1.5*i&&(r.length=i),defined(this._vaf)&&defined(this._vaf.va)){var T;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,BoundingSphere.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));var S=Matrix4.IDENTITY;e.mode===SceneMode$1.SCENE3D?(S=this.modelMatrix,T=BoundingSphere.clone(this._baseVolumeWC,this._boundingVolume)):T=BoundingSphere.clone(this._baseVolume2D,this._boundingVolume),updateBoundingVolume(this,e,T);var A,x,E,b,P,D,w=this._blendOption!==this.blendOption;this._blendOption=this.blendOption,w&&(this._blendOption===BlendOption$1.OPAQUE||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LEQUAL},depthMask:!0}):this._rsOpaque=void 0,this._blendOption===BlendOption$1.TRANSLUCENT||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LEQUAL},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND}):this._rsTranslucent=void 0),this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||0!==e.minimumDisableDepthTestDistance,(w||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance||this._shaderDistanceDisplayCondition&&!this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance)&&(A=new ShaderSource({sources:[PointPrimitiveCollectionVS]}),this._shaderScaleByDistance&&A.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&A.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderDistanceDisplayCondition&&A.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&A.defines.push("DISABLE_DEPTH_DISTANCE"),this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT&&(x=new ShaderSource({defines:["OPAQUE"],sources:[PointPrimitiveCollectionFS]}),this._sp=ShaderProgram.replaceCache({context:s,shaderProgram:this._sp,vertexShaderSource:A,fragmentShaderSource:x,attributeLocations:attributeLocations$2}),x=new ShaderSource({defines:["TRANSLUCENT"],sources:[PointPrimitiveCollectionFS]}),this._spTranslucent=ShaderProgram.replaceCache({context:s,shaderProgram:this._spTranslucent,vertexShaderSource:A,fragmentShaderSource:x,attributeLocations:attributeLocations$2})),this._blendOption===BlendOption$1.OPAQUE&&(x=new ShaderSource({sources:[PointPrimitiveCollectionFS]}),this._sp=ShaderProgram.replaceCache({context:s,shaderProgram:this._sp,vertexShaderSource:A,fragmentShaderSource:x,attributeLocations:attributeLocations$2})),this._blendOption===BlendOption$1.TRANSLUCENT&&(x=new ShaderSource({sources:[PointPrimitiveCollectionFS]}),this._spTranslucent=ShaderProgram.replaceCache({context:s,shaderProgram:this._spTranslucent,vertexShaderSource:A,fragmentShaderSource:x,attributeLocations:attributeLocations$2})),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance);var M=e.commandList;if(l.render||c){var I=this._colorCommands,R=this._blendOption===BlendOption$1.OPAQUE,O=this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT;b=(E=this._vaf.va).length,I.length=b;var B=O?2*b:b;for(D=0;D<B;++D){var L=R||O&&D%2==0;defined(P=I[D])||(P=I[D]=new DrawCommand),P.primitiveType=PrimitiveType$1.POINTS,P.pass=L||!O?Pass$1.OPAQUE:Pass$1.TRANSLUCENT,P.owner=this;var F=O?Math.floor(D/2):D;P.boundingVolume=T,P.modelMatrix=S,P.shaderProgram=L?this._sp:this._spTranslucent,P.uniformMap=this._uniforms,P.vertexArray=E[F].va,P.renderState=L?this._rsOpaque:this._rsTranslucent,P.debugShowBoundingVolume=this.debugShowBoundingVolume,P.pickId="v_pickColor",M.push(P)}}}}},PointPrimitiveCollection.prototype.isDestroyed=function(){return!1},PointPrimitiveCollection.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._spTranslucent=this._spTranslucent&&this._spTranslucent.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),destroyPointPrimitives(this._pointPrimitives),destroyObject(this)};const defaultGetX=e=>e[0],defaultGetY=e=>e[1];class KDBush{constructor(e,t=defaultGetX,i=defaultGetY,r=64,n=Float64Array){this.nodeSize=r,this.points=e;const a=e.length<65536?Uint16Array:Uint32Array,o=this.ids=new a(e.length),s=this.coords=new n(2*e.length);for(let r=0;r<e.length;r++)o[r]=r,s[2*r]=t(e[r]),s[2*r+1]=i(e[r]);sortKD(o,s,r,0,o.length-1,0)}range(e,t,i,r){return range(this.ids,this.coords,e,t,i,r,this.nodeSize)}within(e,t,i){return within(this.ids,this.coords,e,t,i,this.nodeSize)}}function EntityCluster(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._enabled=defaultValue(e.enabled,!1),this._pixelRange=defaultValue(e.pixelRange,80),this._minimumClusterSize=defaultValue(e.minimumClusterSize,2),this._clusterBillboards=defaultValue(e.clusterBillboards,!0),this._clusterLabels=defaultValue(e.clusterLabels,!0),this._clusterPoints=defaultValue(e.clusterPoints,!0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity={},this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._clusterDirty=!1,this._cluster=void 0,this._removeEventListener=void 0,this._clusterEvent=new Event,this.show=defaultValue(e.show,!0)}function getX(e){return e.coord.x}function getY(e){return e.coord.y}function expandBoundingBox(e,t){e.x-=t,e.y-=t,e.width+=2*t,e.height+=2*t}var labelBoundingBoxScratch=new BoundingRectangle;function getBoundingBox(e,t,i,r,n){if(defined(e._labelCollection)&&r._clusterLabels?n=Label.getScreenSpaceBoundingBox(e,t,n):defined(e._billboardCollection)&&r._clusterBillboards?n=Billboard.getScreenSpaceBoundingBox(e,t,n):defined(e._pointPrimitiveCollection)&&r._clusterPoints&&(n=PointPrimitive.getScreenSpaceBoundingBox(e,t,n)),expandBoundingBox(n,i),r._clusterLabels&&!defined(e._labelCollection)&&defined(e.id)&&hasLabelIndex(r,e.id.id)&&defined(e.id._label)){var a=r._collectionIndicesByEntity[e.id.id].labelIndex,o=r._labelCollection.get(a),s=Label.getScreenSpaceBoundingBox(o,t,labelBoundingBoxScratch);expandBoundingBox(s,i),n=BoundingRectangle.union(n,s,n)}return n}function addNonClusteredItem(e,t){if(e.clusterShow=!0,!defined(e._labelCollection)&&defined(e.id)&&hasLabelIndex(t,e.id.id)&&defined(e.id._label)){var i=t._collectionIndicesByEntity[e.id.id].labelIndex;t._labelCollection.get(i).clusterShow=!0}}function addCluster(e,t,i,r){var n={billboard:r._clusterBillboardCollection.add(),label:r._clusterLabelCollection.add(),point:r._clusterPointCollection.add()};n.billboard.show=!1,n.point.show=!1,n.label.show=!0,n.label.text=t.toLocaleString(),n.label.id=i,n.billboard.position=n.label.position=n.point.position=e,r._clusterEvent.raiseEvent(i,n)}function hasLabelIndex(e,t){return defined(e)&&defined(e._collectionIndicesByEntity[t])&&defined(e._collectionIndicesByEntity[t].labelIndex)}function getScreenSpacePositions(e,t,i,r,n){if(defined(e))for(var a=e.length,o=0;o<a;++o){var s=e.get(o);if(s.clusterShow=!1,s.show&&(n._scene.mode!==SceneMode$1.SCENE3D||r.isPointVisible(s.position))){var l=n._clusterLabels&&defined(s._labelCollection),c=n._clusterBillboards&&defined(s.id._billboard),u=n._clusterPoints&&defined(s.id._point);if(!l||!u&&!c){var d=s.computeScreenSpacePosition(i);defined(d)&&t.push({index:o,collection:e,clustered:!1,coord:d})}}}}var pointBoundinRectangleScratch=new BoundingRectangle,totalBoundingRectangleScratch=new BoundingRectangle,neighborBoundingRectangleScratch=new BoundingRectangle;function createDeclutterCallback(e){return function(t){if(!(defined(t)&&t<.05)&&e.enabled){var i=e._scene,r=e._labelCollection,n=e._billboardCollection,a=e._pointCollection;if((defined(r)||defined(n)||defined(a))&&(e._clusterBillboards||e._clusterLabels||e._clusterPoints)){var o=e._clusterLabelCollection,s=e._clusterBillboardCollection,l=e._clusterPointCollection;defined(o)?o.removeAll():o=e._clusterLabelCollection=new LabelCollection({scene:i}),defined(s)?s.removeAll():s=e._clusterBillboardCollection=new BillboardCollection({scene:i}),defined(l)?l.removeAll():l=e._clusterPointCollection=new PointPrimitiveCollection;var c,u,d,h,p,f,m,g,_,y,v,C=e._pixelRange,T=e._minimumClusterSize,S=e._previousClusters,A=[],x=e._previousHeight,E=i.camera.positionCartographic.height,b=new EllipsoidalOccluder(i.mapProjection.ellipsoid,i.camera.positionWC),P=[];e._clusterLabels&&getScreenSpacePositions(r,P,i,b,e),e._clusterBillboards&&getScreenSpacePositions(n,P,i,b,e),e._clusterPoints&&getScreenSpacePositions(a,P,i,b,e);var D=new KDBush(P,getX,getY,64,Int32Array);if(E<x)for(d=S.length,c=0;c<d;++c){var w=S[c];if(b.isPointVisible(w.position)){var M=Billboard._computeScreenSpacePosition(Matrix4.IDENTITY,w.position,Cartesian3.ZERO,Cartesian2.ZERO,i);if(defined(M)){var I=1-E/x,R=w.width=w.width*I,O=w.height=w.height*I;R=Math.max(R,w.minimumWidth),O=Math.max(O,w.minimumHeight);var B=M.x-.5*R,L=M.y-.5*O,F=M.x+R,N=M.y+O;for(f=(p=D.range(B,L,F,N)).length,_=0,g=[],u=0;u<f;++u)(m=P[p[u]]).clustered||(++_,y=m.collection,v=m.index,g.push(y.get(v).id));if(_>=T)for(addCluster(w.position,_,g,e),A.push(w),u=0;u<f;++u)P[p[u]].clustered=!0}}}for(d=P.length,c=0;c<d;++c){var V=P[c];if(!V.clustered){V.clustered=!0,y=V.collection,v=V.index;var k=y.get(v);h=getBoundingBox(k,V.coord,C,e,pointBoundinRectangleScratch);var U=BoundingRectangle.clone(h,totalBoundingRectangleScratch);f=(p=D.range(h.x,h.y,h.x+h.width,h.y+h.height)).length;var G=Cartesian3.clone(k.position);for(_=1,g=[k.id],u=0;u<f;++u)if(!(m=P[p[u]]).clustered){var $=m.collection.get(m.index),z=getBoundingBox($,m.coord,C,e,neighborBoundingRectangleScratch);Cartesian3.add($.position,G,G),BoundingRectangle.union(U,z,U),++_,g.push($.id)}if(_>=T){var H=Cartesian3.multiplyByScalar(G,1/_,G);for(addCluster(H,_,g,e),A.push({position:H,width:U.width,height:U.height,minimumWidth:h.width,minimumHeight:h.height}),u=0;u<f;++u)P[p[u]].clustered=!0}else addNonClusteredItem(k,e)}}0===o.length&&(o.destroy(),e._clusterLabelCollection=void 0),0===s.length&&(s.destroy(),e._clusterBillboardCollection=void 0),0===l.length&&(l.destroy(),e._clusterPointCollection=void 0),e._previousClusters=A,e._previousHeight=E}}}}function createGetEntity(e,t,i,r){return function(n){var a=this[e];defined(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});var o,s,l=this._collectionIndicesByEntity[n.id];if(defined(l)||(l=this._collectionIndicesByEntity[n.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),defined(a)&&defined(l[r]))return a.get(l[r]);defined(a)||(a=this[e]=new t({scene:this._scene}));var c=this[i];return c.length>0?(o=c.pop(),s=a.get(o)):(s=a.add(),o=a.length-1),l[r]=o,this._clusterDirty=!0,s}}function removeEntityIndicesIfUnused(e,t){var i=e._collectionIndicesByEntity[t];defined(i.billboardIndex)||defined(i.labelIndex)||defined(i.pointIndex)||delete e._collectionIndicesByEntity[t]}function disableCollectionClustering(e){if(defined(e))for(var t=e.length,i=0;i<t;++i)e.get(i).clusterShow=!0}function updateEnable(e){e.enabled||(defined(e._clusterLabelCollection)&&e._clusterLabelCollection.destroy(),defined(e._clusterBillboardCollection)&&e._clusterBillboardCollection.destroy(),defined(e._clusterPointCollection)&&e._clusterPointCollection.destroy(),e._clusterLabelCollection=void 0,e._clusterBillboardCollection=void 0,e._clusterPointCollection=void 0,disableCollectionClustering(e._labelCollection),disableCollectionClustering(e._billboardCollection),disableCollectionClustering(e._pointCollection))}function CustomDataSource(e){this._name=e,this._clock=void 0,this._changed=new Event,this._error=new Event,this._isLoading=!1,this._loading=new Event,this._entityCollection=new EntityCollection(this),this._entityCluster=new EntityCluster}EntityCluster.prototype._initialize=function(e){this._scene=e;var t=createDeclutterCallback(this);this._cluster=t,this._removeEventListener=e.camera.changed.addEventListener(t)},Object.defineProperties(EntityCluster.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this._enabledDirty=e!==this._enabled,this._enabled=e}},pixelRange:{get:function(){return this._pixelRange},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._pixelRange,this._pixelRange=e}},minimumClusterSize:{get:function(){return this._minimumClusterSize},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._minimumClusterSize,this._minimumClusterSize=e}},clusterEvent:{get:function(){return this._clusterEvent}},clusterBillboards:{get:function(){return this._clusterBillboards},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterBillboards,this._clusterBillboards=e}},clusterLabels:{get:function(){return this._clusterLabels},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterLabels,this._clusterLabels=e}},clusterPoints:{get:function(){return this._clusterPoints},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterPoints,this._clusterPoints=e}}}),EntityCluster.prototype.getLabel=createGetEntity("_labelCollection",LabelCollection,"_unusedLabelIndices","labelIndex"),EntityCluster.prototype.removeLabel=function(e){var t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(defined(this._labelCollection)&&defined(t)&&defined(t.labelIndex)){var i=t.labelIndex;t.labelIndex=void 0,removeEntityIndicesIfUnused(this,e.id);var r=this._labelCollection.get(i);r.show=!1,r.text="",r.id=void 0,this._unusedLabelIndices.push(i),this._clusterDirty=!0}},EntityCluster.prototype.getBillboard=createGetEntity("_billboardCollection",BillboardCollection,"_unusedBillboardIndices","billboardIndex"),EntityCluster.prototype.removeBillboard=function(e){var t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(defined(this._billboardCollection)&&defined(t)&&defined(t.billboardIndex)){var i=t.billboardIndex;t.billboardIndex=void 0,removeEntityIndicesIfUnused(this,e.id);var r=this._billboardCollection.get(i);r.id=void 0,r.show=!1,r.image=void 0,this._unusedBillboardIndices.push(i),this._clusterDirty=!0}},EntityCluster.prototype.getPoint=createGetEntity("_pointCollection",PointPrimitiveCollection,"_unusedPointIndices","pointIndex"),EntityCluster.prototype.removePoint=function(e){var t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(defined(this._pointCollection)&&defined(t)&&defined(t.pointIndex)){var i=t.pointIndex;t.pointIndex=void 0,removeEntityIndicesIfUnused(this,e.id);var r=this._pointCollection.get(i);r.show=!1,r.id=void 0,this._unusedPointIndices.push(i),this._clusterDirty=!0}},EntityCluster.prototype.update=function(e){var t;this.show&&(defined(this._labelCollection)&&this._labelCollection.length>0&&0===this._labelCollection.get(0)._glyphs.length&&(t=e.commandList,e.commandList=[],this._labelCollection.update(e),e.commandList=t),defined(this._billboardCollection)&&this._billboardCollection.length>0&&!defined(this._billboardCollection.get(0).width)&&(t=e.commandList,e.commandList=[],this._billboardCollection.update(e),e.commandList=t),this._enabledDirty&&(this._enabledDirty=!1,updateEnable(this),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),defined(this._clusterLabelCollection)&&this._clusterLabelCollection.update(e),defined(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(e),defined(this._clusterPointCollection)&&this._clusterPointCollection.update(e),defined(this._labelCollection)&&this._labelCollection.update(e),defined(this._billboardCollection)&&this._billboardCollection.update(e),defined(this._pointCollection)&&this._pointCollection.update(e))},EntityCluster.prototype.destroy=function(){this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._pointCollection=this._pointCollection&&this._pointCollection.destroy(),this._clusterLabelCollection=this._clusterLabelCollection&&this._clusterLabelCollection.destroy(),this._clusterBillboardCollection=this._clusterBillboardCollection&&this._clusterBillboardCollection.destroy(),this._clusterPointCollection=this._clusterPointCollection&&this._clusterPointCollection.destroy(),defined(this._removeEventListener)&&(this._removeEventListener(),this._removeEventListener=void 0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity=void 0,this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._pixelRangeDirty=!1,this._minimumClusterSizeDirty=!1},Object.defineProperties(CustomDataSource.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{get:function(){return this._clock},set:function(e){this._clock!==e&&(this._clock=e,this._changed.raiseEvent(this))}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading},set:function(e){DataSource.setLoading(this,e)}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}}}),CustomDataSource.prototype.update=function(e){return!0};var defaultOffset$8=Cartesian3.ZERO,offsetScratch$7=new Cartesian3,positionScratch$4=new Cartesian3,scratchColor$c=new Color;function CylinderGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.length=void 0,this.topRadius=void 0,this.bottomRadius=void 0,this.slices=void 0,this.numberOfVerticalLines=void 0,this.offsetAttribute=void 0}function CylinderGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new CylinderGeometryOptions(e),geometryPropertyName:"cylinder",observedPropertyNames:["availability","position","orientation","cylinder"]}),this._onEntityPropertyChanged(e,"cylinder",e.cylinder,void 0)}function DynamicCylinderGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}function DataSourceClock(){this._definitionChanged=new Event,this._startTime=void 0,this._stopTime=void 0,this._currentTime=void 0,this._clockRange=void 0,this._clockStep=void 0,this._multiplier=void 0}defined(Object.create)&&(CylinderGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),CylinderGeometryUpdater.prototype.constructor=CylinderGeometryUpdater),Object.defineProperties(CylinderGeometryUpdater.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),CylinderGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n=new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),o={show:n,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a),color:void 0,offset:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$c)),defined(t)||(t=Color.WHITE),o.color=ColorGeometryInstanceAttribute.fromColor(t));return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$8,offsetScratch$7))),new GeometryInstance({id:i,geometry:new CylinderGeometry(this._options),modelMatrix:i.computeModelMatrixForHeightReference(e,i.cylinder.heightReference,.5*this._options.length,this._scene.mapProjection.ellipsoid),attributes:o})},CylinderGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$c),n=this._distanceDisplayConditionProperty.getValue(e),a={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n),offset:void 0};return defined(this._options.offsetAttribute)&&(a.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$8,offsetScratch$7))),new GeometryInstance({id:t,geometry:new CylinderOutlineGeometry(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,.5*this._options.length,this._scene.mapProjection.ellipsoid),attributes:a})},CylinderGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},CylinderGeometryUpdater.prototype._isHidden=function(e,t){return!defined(e.position)||!defined(t.length)||!defined(t.topRadius)||!defined(t.bottomRadius)||GeometryUpdater.prototype._isHidden.call(this,e,t)},CylinderGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.length.isConstant&&t.topRadius.isConstant&&t.bottomRadius.isConstant&&Property.isConstant(t.slices)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.numberOfVerticalLines))},CylinderGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),r=this._options;r.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,r.length=t.length.getValue(Iso8601.MINIMUM_VALUE),r.topRadius=t.topRadius.getValue(Iso8601.MINIMUM_VALUE),r.bottomRadius=t.bottomRadius.getValue(Iso8601.MINIMUM_VALUE),r.slices=Property.getValueOrUndefined(t.slices,Iso8601.MINIMUM_VALUE),r.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,Iso8601.MINIMUM_VALUE),r.offsetAttribute=i!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},CylinderGeometryUpdater.prototype._onEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,CylinderGeometryUpdater.DynamicGeometryUpdater=DynamicCylinderGeometryUpdater,defined(Object.create)&&(DynamicCylinderGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicCylinderGeometryUpdater.prototype.constructor=DynamicCylinderGeometryUpdater),DynamicCylinderGeometryUpdater.prototype._isHidden=function(e,t,i){var r=this._options;return!defined(Property.getValueOrUndefined(e.position,i,positionScratch$4))||!defined(r.length)||!defined(r.topRadius)||!defined(r.bottomRadius)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicCylinderGeometryUpdater.prototype._setOptions=function(e,t,i){var r=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),n=this._options;n.length=Property.getValueOrUndefined(t.length,i),n.topRadius=Property.getValueOrUndefined(t.topRadius,i),n.bottomRadius=Property.getValueOrUndefined(t.bottomRadius,i),n.slices=Property.getValueOrUndefined(t.slices,i),n.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,i),n.offsetAttribute=r!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},Object.defineProperties(DataSourceClock.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},startTime:createRawPropertyDescriptor("startTime"),stopTime:createRawPropertyDescriptor("stopTime"),currentTime:createRawPropertyDescriptor("currentTime"),clockRange:createRawPropertyDescriptor("clockRange"),clockStep:createRawPropertyDescriptor("clockStep"),multiplier:createRawPropertyDescriptor("multiplier")}),DataSourceClock.prototype.clone=function(e){return defined(e)||(e=new DataSourceClock),e.startTime=this.startTime,e.stopTime=this.stopTime,e.currentTime=this.currentTime,e.clockRange=this.clockRange,e.clockStep=this.clockStep,e.multiplier=this.multiplier,e},DataSourceClock.prototype.equals=function(e){return this===e||defined(e)&&JulianDate.equals(this.startTime,e.startTime)&&JulianDate.equals(this.stopTime,e.stopTime)&&JulianDate.equals(this.currentTime,e.currentTime)&&this.clockRange===e.clockRange&&this.clockStep===e.clockStep&&this.multiplier===e.multiplier},DataSourceClock.prototype.merge=function(e){this.startTime=defaultValue(this.startTime,e.startTime),this.stopTime=defaultValue(this.stopTime,e.stopTime),this.currentTime=defaultValue(this.currentTime,e.currentTime),this.clockRange=defaultValue(this.clockRange,e.clockRange),this.clockStep=defaultValue(this.clockStep,e.clockStep),this.multiplier=defaultValue(this.multiplier,e.multiplier)},DataSourceClock.prototype.getValue=function(e){return defined(e)||(e=new Clock),e.startTime=defaultValue(this.startTime,e.startTime),e.stopTime=defaultValue(this.stopTime,e.stopTime),e.currentTime=defaultValue(this.currentTime,e.currentTime),e.clockRange=defaultValue(this.clockRange,e.clockRange),e.multiplier=defaultValue(this.multiplier,e.multiplier),e.clockStep=defaultValue(this.clockStep,e.clockStep),e};var defaultColor$6=Color.WHITE,defaultCellAlpha=.1,defaultLineCount=new Cartesian2(8,8),defaultLineOffset=new Cartesian2(0,0),defaultLineThickness=new Cartesian2(1,1);function GridMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._cellAlpha=void 0,this._cellAlphaSubscription=void 0,this._lineCount=void 0,this._lineCountSubscription=void 0,this._lineThickness=void 0,this._lineThicknessSubscription=void 0,this._lineOffset=void 0,this._lineOffsetSubscription=void 0,this.color=e.color,this.cellAlpha=e.cellAlpha,this.lineCount=e.lineCount,this.lineThickness=e.lineThickness,this.lineOffset=e.lineOffset}function PolylineArrowMaterialProperty(e){this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(GridMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._cellAlpha)&&Property.isConstant(this._lineCount)&&Property.isConstant(this._lineThickness)&&Property.isConstant(this._lineOffset)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),cellAlpha:createPropertyDescriptor("cellAlpha"),lineCount:createPropertyDescriptor("lineCount"),lineThickness:createPropertyDescriptor("lineThickness"),lineOffset:createPropertyDescriptor("lineOffset")}),GridMaterialProperty.prototype.getType=function(e){return"Grid"},GridMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$6,t.color),t.cellAlpha=Property.getValueOrDefault(this._cellAlpha,e,defaultCellAlpha),t.lineCount=Property.getValueOrClonedDefault(this._lineCount,e,defaultLineCount,t.lineCount),t.lineThickness=Property.getValueOrClonedDefault(this._lineThickness,e,defaultLineThickness,t.lineThickness),t.lineOffset=Property.getValueOrClonedDefault(this._lineOffset,e,defaultLineOffset,t.lineOffset),t},GridMaterialProperty.prototype.equals=function(e){return this===e||e instanceof GridMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._cellAlpha,e._cellAlpha)&&Property.equals(this._lineCount,e._lineCount)&&Property.equals(this._lineThickness,e._lineThickness)&&Property.equals(this._lineOffset,e._lineOffset)},Object.defineProperties(PolylineArrowMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color")}),PolylineArrowMaterialProperty.prototype.getType=function(e){return"PolylineArrow"},PolylineArrowMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,Color.WHITE,t.color),t},PolylineArrowMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineArrowMaterialProperty&&Property.equals(this._color,e._color)};var defaultColor$5=Color.WHITE,defaultGapColor=Color.TRANSPARENT,defaultDashLength=16,defaultDashPattern=255;function PolylineDashMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._gapColor=void 0,this._gapColorSubscription=void 0,this._dashLength=void 0,this._dashLengthSubscription=void 0,this._dashPattern=void 0,this._dashPatternSubscription=void 0,this.color=e.color,this.gapColor=e.gapColor,this.dashLength=e.dashLength,this.dashPattern=e.dashPattern}Object.defineProperties(PolylineDashMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._gapColor)&&Property.isConstant(this._dashLength)&&Property.isConstant(this._dashPattern)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),gapColor:createPropertyDescriptor("gapColor"),dashLength:createPropertyDescriptor("dashLength"),dashPattern:createPropertyDescriptor("dashPattern")}),PolylineDashMaterialProperty.prototype.getType=function(e){return"PolylineDash"},PolylineDashMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$5,t.color),t.gapColor=Property.getValueOrClonedDefault(this._gapColor,e,defaultGapColor,t.gapColor),t.dashLength=Property.getValueOrDefault(this._dashLength,e,defaultDashLength,t.dashLength),t.dashPattern=Property.getValueOrDefault(this._dashPattern,e,defaultDashPattern,t.dashPattern),t},PolylineDashMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineDashMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._gapColor,e._gapColor)&&Property.equals(this._dashLength,e._dashLength)&&Property.equals(this._dashPattern,e._dashPattern)};var defaultColor$4=Color.WHITE,defaultGlowPower=.25,defaultTaperPower=1;function PolylineGlowMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._glowPower=void 0,this._glowPowerSubscription=void 0,this._taperPower=void 0,this._taperPowerSubscription=void 0,this.color=e.color,this.glowPower=e.glowPower,this.taperPower=e.taperPower}Object.defineProperties(PolylineGlowMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._glow)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),glowPower:createPropertyDescriptor("glowPower"),taperPower:createPropertyDescriptor("taperPower")}),PolylineGlowMaterialProperty.prototype.getType=function(e){return"PolylineGlow"},PolylineGlowMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$4,t.color),t.glowPower=Property.getValueOrDefault(this._glowPower,e,defaultGlowPower,t.glowPower),t.taperPower=Property.getValueOrDefault(this._taperPower,e,defaultTaperPower,t.taperPower),t},PolylineGlowMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineGlowMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._glowPower,e._glowPower)&&Property.equals(this._taperPower,e._taperPower)};var defaultColor$3=Color.WHITE,defaultOutlineColor$2=Color.BLACK,defaultOutlineWidth$2=1;function PolylineOutlineMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this.color=e.color,this.outlineColor=e.outlineColor,this.outlineWidth=e.outlineWidth}function PositionPropertyArray(e,t){this._value=void 0,this._definitionChanged=new Event,this._eventHelper=new EventHelper,this._referenceFrame=defaultValue(t,ReferenceFrame$1.FIXED),this.setValue(e)}function PropertyArray(e){this._value=void 0,this._definitionChanged=new Event,this._eventHelper=new EventHelper,this.setValue(e)}function resolve(e){var t=e._targetProperty;if(!defined(t)){var i=e._targetEntity;if(!defined(i)){if(!defined(i=e._targetCollection.getById(e._targetId)))return void(e._targetEntity=e._targetProperty=void 0);i.definitionChanged.addEventListener(ReferenceProperty.prototype._onTargetEntityDefinitionChanged,e),e._targetEntity=i}var r=e._targetPropertyNames;t=e._targetEntity;for(var n=0,a=r.length;n<a&&defined(t);++n)t=t[r[n]];e._targetProperty=t}return t}function ReferenceProperty(e,t,i){this._targetCollection=e,this._targetId=t,this._targetPropertyNames=i,this._targetProperty=void 0,this._targetEntity=void 0,this._definitionChanged=new Event,e.collectionChanged.addEventListener(ReferenceProperty.prototype._onCollectionChanged,this)}Object.defineProperties(PolylineOutlineMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._outlineColor)&&Property.isConstant(this._outlineWidth)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth")}),PolylineOutlineMaterialProperty.prototype.getType=function(e){return"PolylineOutline"},PolylineOutlineMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$3,t.color),t.outlineColor=Property.getValueOrClonedDefault(this._outlineColor,e,defaultOutlineColor$2,t.outlineColor),t.outlineWidth=Property.getValueOrDefault(this._outlineWidth,e,defaultOutlineWidth$2),t},PolylineOutlineMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineOutlineMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._outlineColor,e._outlineColor)&&Property.equals(this._outlineWidth,e._outlineWidth)},Object.defineProperties(PositionPropertyArray.prototype,{isConstant:{get:function(){var e=this._value;if(!defined(e))return!0;for(var t=e.length,i=0;i<t;i++)if(!Property.isConstant(e[i]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}}),PositionPropertyArray.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},PositionPropertyArray.prototype.getValueInReferenceFrame=function(e,t,i){var r=this._value;if(defined(r)){var n=r.length;defined(i)||(i=new Array(n));for(var a=0,o=0;a<n;){var s=r[a].getValueInReferenceFrame(e,t,i[a]);defined(s)&&(i[o]=s,o++),a++}return i.length=o,i}},PositionPropertyArray.prototype.setValue=function(e){var t=this._eventHelper;if(t.removeAll(),defined(e)){this._value=e.slice();for(var i=e.length,r=0;r<i;r++){var n=e[r];defined(n)&&t.add(n.definitionChanged,PositionPropertyArray.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)},PositionPropertyArray.prototype.equals=function(e){return this===e||e instanceof PositionPropertyArray&&this._referenceFrame===e._referenceFrame&&Property.arrayEquals(this._value,e._value)},PositionPropertyArray.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(PropertyArray.prototype,{isConstant:{get:function(){var e=this._value;if(!defined(e))return!0;for(var t=e.length,i=0;i<t;i++)if(!Property.isConstant(e[i]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}}),PropertyArray.prototype.getValue=function(e,t){var i=this._value;if(defined(i)){var r=i.length;defined(t)||(t=new Array(r));for(var n=0,a=0;n<r;){var o=this._value[n].getValue(e,t[n]);defined(o)&&(t[a]=o,a++),n++}return t.length=a,t}},PropertyArray.prototype.setValue=function(e){var t=this._eventHelper;if(t.removeAll(),defined(e)){this._value=e.slice();for(var i=e.length,r=0;r<i;r++){var n=e[r];defined(n)&&t.add(n.definitionChanged,PropertyArray.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)},PropertyArray.prototype.equals=function(e){return this===e||e instanceof PropertyArray&&Property.arrayEquals(this._value,e._value)},PropertyArray.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(ReferenceProperty.prototype,{isConstant:{get:function(){return Property.isConstant(resolve(this))}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){var e=resolve(this);return defined(e)?e.referenceFrame:void 0}},targetId:{get:function(){return this._targetId}},targetCollection:{get:function(){return this._targetCollection}},targetPropertyNames:{get:function(){return this._targetPropertyNames}},resolvedProperty:{get:function(){return resolve(this)}}}),ReferenceProperty.fromString=function(e,t){for(var i,r=[],n=!0,a=!1,o="",s=0;s<t.length;++s){var l=t.charAt(s);a?(o+=l,a=!1):"\\"===l?a=!0:n&&"#"===l?(i=o,n=!1,o=""):n||"."!==l?o+=l:(r.push(o),o="")}return r.push(o),new ReferenceProperty(e,i,r)},ReferenceProperty.prototype.getValue=function(e,t){var i=resolve(this);return defined(i)?i.getValue(e,t):void 0},ReferenceProperty.prototype.getValueInReferenceFrame=function(e,t,i){var r=resolve(this);return defined(r)?r.getValueInReferenceFrame(e,t,i):void 0},ReferenceProperty.prototype.getType=function(e){var t=resolve(this);return defined(t)?t.getType(e):void 0},ReferenceProperty.prototype.equals=function(e){if(this===e)return!0;var t=this._targetPropertyNames,i=e._targetPropertyNames;if(this._targetCollection!==e._targetCollection||this._targetId!==e._targetId||t.length!==i.length)return!1;for(var r=this._targetPropertyNames.length,n=0;n<r;n++)if(t[n]!==i[n])return!1;return!0},ReferenceProperty.prototype._onTargetEntityDefinitionChanged=function(e,t,i,r){defined(this._targetProperty)&&this._targetPropertyNames[0]===t&&(this._targetProperty=void 0,this._definitionChanged.raiseEvent(this))},ReferenceProperty.prototype._onCollectionChanged=function(e,t,i){var r=this._targetEntity;defined(r)&&-1!==i.indexOf(r)?(r.definitionChanged.removeEventListener(ReferenceProperty.prototype._onTargetEntityDefinitionChanged,this),this._targetEntity=this._targetProperty=void 0):defined(r)||defined(r=resolve(this))&&this._definitionChanged.raiseEvent(this)};var Rotation={packedLength:1,pack:function(e,t,i){return t[i=defaultValue(i,0)]=e,t},unpack:function(e,t,i){return e[t=defaultValue(t,0)]},convertPackedArrayForInterpolation:function(e,t,i,r){var n;defined(r)||(r=[]),t=defaultValue(t,0);for(var a=0,o=(i=defaultValue(i,e.length))-t+1;a<o;a++){var s=e[t+a];0===a||Math.abs(n-s)<Math.PI?r[a]=s:r[a]=s-CesiumMath.TWO_PI,n=s}},unpackInterpolationResult:function(e,t,i,r,n){return(n=e[0])<0?n+CesiumMath.TWO_PI:n}},PackableNumber={packedLength:1,pack:function(e,t,i){t[i=defaultValue(i,0)]=e},unpack:function(e,t,i){return e[t=defaultValue(t,0)]}};function arrayInsert(e,t,i){var r,n=e.length,a=i.length,o=n+a;if(e.length=o,n!==t){var s=n-1;for(r=o-1;r>=t;r--)e[r]=e[s--]}for(r=0;r<a;r++)e[t++]=i[r]}function convertDate(e,t){return e instanceof JulianDate?e:"string"==typeof e?JulianDate.fromIso8601(e):JulianDate.addSeconds(t,e,new JulianDate)}var timesSpliceArgs=[],valuesSpliceArgs=[];function mergeNewSamples(e,t,i,r,n){for(var a,o,s,l,c,u,d=0;d<r.length;){var h=0,p=0;if((s=binarySearch(t,c=convertDate(r[d],e),JulianDate.compare))<0){for(l=(s=~s)*n,o=void 0,u=t[s];d<r.length&&(c=convertDate(r[d],e),!(defined(o)&&JulianDate.compare(o,c)>=0||defined(u)&&JulianDate.compare(c,u)>=0));){for(timesSpliceArgs[h++]=c,d+=1,a=0;a<n;a++)valuesSpliceArgs[p++]=r[d],d+=1;o=c}h>0&&(valuesSpliceArgs.length=p,arrayInsert(i,l,valuesSpliceArgs),timesSpliceArgs.length=h,arrayInsert(t,s,timesSpliceArgs))}else{for(a=0;a<n;a++)d++,i[s*n+a]=r[d];d++}}}function SampledProperty(e,t){var i=e;i===Number&&(i=PackableNumber);var r,n=i.packedLength,a=defaultValue(i.packedInterpolationLength,n),o=0;if(defined(t)){var s=t.length;r=new Array(s);for(var l=0;l<s;l++){var c=t[l];c===Number&&(c=PackableNumber);var u=c.packedLength;n+=u,a+=defaultValue(c.packedInterpolationLength,u),r[l]=c}o=s}this._type=e,this._innerType=i,this._interpolationDegree=1,this._interpolationAlgorithm=LinearApproximation,this._numberOfPoints=0,this._times=[],this._values=[],this._xTable=[],this._yTable=[],this._packedLength=n,this._packedInterpolationLength=a,this._updateTableLength=!0,this._interpolationResult=new Array(a),this._definitionChanged=new Event,this._derivativeTypes=t,this._innerDerivativeTypes=r,this._inputOrder=o,this._forwardExtrapolationType=ExtrapolationType$1.NONE,this._forwardExtrapolationDuration=0,this._backwardExtrapolationType=ExtrapolationType$1.NONE,this._backwardExtrapolationDuration=0}function removeSamples(e,t,i){var r=e._packedLength;e._times.splice(t,i),e._values.splice(t*r,i*r),e._updateTableLength=!0,e._definitionChanged.raiseEvent(e)}function SampledPositionProperty(e,t){var i;if((t=defaultValue(t,0))>0){i=new Array(t);for(var r=0;r<t;r++)i[r]=Cartesian3}this._numberOfDerivatives=t,this._property=new SampledProperty(Cartesian3,i),this._definitionChanged=new Event,this._referenceFrame=defaultValue(e,ReferenceFrame$1.FIXED),this._property._definitionChanged.addEventListener((function(){this._definitionChanged.raiseEvent(this)}),this)}Object.defineProperties(SampledProperty.prototype,{isConstant:{get:function(){return 0===this._values.length}},definitionChanged:{get:function(){return this._definitionChanged}},type:{get:function(){return this._type}},derivativeTypes:{get:function(){return this._derivativeTypes}},interpolationDegree:{get:function(){return this._interpolationDegree}},interpolationAlgorithm:{get:function(){return this._interpolationAlgorithm}},forwardExtrapolationType:{get:function(){return this._forwardExtrapolationType},set:function(e){this._forwardExtrapolationType!==e&&(this._forwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},forwardExtrapolationDuration:{get:function(){return this._forwardExtrapolationDuration},set:function(e){this._forwardExtrapolationDuration!==e&&(this._forwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationType:{get:function(){return this._backwardExtrapolationType},set:function(e){this._backwardExtrapolationType!==e&&(this._backwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationDuration:{get:function(){return this._backwardExtrapolationDuration},set:function(e){this._backwardExtrapolationDuration!==e&&(this._backwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}}}),SampledProperty.prototype.getValue=function(e,t){var i=this._times,r=i.length;if(0!==r){var n,a=this._innerType,o=this._values,s=binarySearch(i,e,JulianDate.compare);if(s<0){if(0===(s=~s)){var l=i[s];if(n=this._backwardExtrapolationDuration,this._backwardExtrapolationType===ExtrapolationType$1.NONE||0!==n&&JulianDate.secondsDifference(l,e)>n)return;if(this._backwardExtrapolationType===ExtrapolationType$1.HOLD)return a.unpack(o,0,t)}if(s>=r){var c=i[s=r-1];if(n=this._forwardExtrapolationDuration,this._forwardExtrapolationType===ExtrapolationType$1.NONE||0!==n&&JulianDate.secondsDifference(e,c)>n)return;if(this._forwardExtrapolationType===ExtrapolationType$1.HOLD)return s=r-1,a.unpack(o,s*a.packedLength,t)}var u=this._xTable,d=this._yTable,h=this._interpolationAlgorithm,p=this._packedInterpolationLength,f=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;var m=Math.min(h.getRequiredDataPoints(this._interpolationDegree,f),r);m!==this._numberOfPoints&&(this._numberOfPoints=m,u.length=m,d.length=m*p)}var g=this._numberOfPoints-1;if(g<1)return;var _=0,y=r-1;if(y-_+1>=g+1){var v=s-(g/2|0)-1;v<_&&(v=_);var C=v+g;C>y&&(v=(C=y)-g)<_&&(v=_),_=v,y=C}for(var T=y-_+1,S=0;S<T;++S)u[S]=JulianDate.secondsDifference(i[_+S],i[y]);if(defined(a.convertPackedArrayForInterpolation))a.convertPackedArrayForInterpolation(o,_,y,d);else for(var A=0,x=this._packedLength,E=_*x,b=(y+1)*x;E<b;)d[A]=o[E],E++,A++;var P,D=JulianDate.secondsDifference(e,i[y]);if(0!==f&&defined(h.interpolate)){var w=Math.floor(p/(f+1));P=h.interpolate(D,u,d,w,f,f,this._interpolationResult)}else P=h.interpolateOrderZero(D,u,d,p,this._interpolationResult);return defined(a.unpackInterpolationResult)?a.unpackInterpolationResult(P,o,_,y,t):a.unpack(P,0,t)}return a.unpack(o,s*this._packedLength,t)}},SampledProperty.prototype.setInterpolationOptions=function(e){if(defined(e)){var t=!1,i=e.interpolationAlgorithm,r=e.interpolationDegree;defined(i)&&this._interpolationAlgorithm!==i&&(this._interpolationAlgorithm=i,t=!0),defined(r)&&this._interpolationDegree!==r&&(this._interpolationDegree=r,t=!0),t&&(this._updateTableLength=!0,this._definitionChanged.raiseEvent(this))}},SampledProperty.prototype.addSample=function(e,t,i){var r=this._innerDerivativeTypes,n=defined(r),a=this._innerType,o=[];if(o.push(e),a.pack(t,o,o.length),n)for(var s=r.length,l=0;l<s;l++)r[l].pack(i[l],o,o.length);mergeNewSamples(void 0,this._times,this._values,o,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},SampledProperty.prototype.addSamples=function(e,t,i){for(var r=this._innerDerivativeTypes,n=defined(r),a=this._innerType,o=e.length,s=[],l=0;l<o;l++)if(s.push(e[l]),a.pack(t[l],s,s.length),n)for(var c=i[l],u=r.length,d=0;d<u;d++)r[d].pack(c[d],s,s.length);mergeNewSamples(void 0,this._times,this._values,s,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},SampledProperty.prototype.addSamplesPackedArray=function(e,t){mergeNewSamples(t,this._times,this._values,e,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},SampledProperty.prototype.removeSample=function(e){var t=binarySearch(this._times,e,JulianDate.compare);return!(t<0)&&(removeSamples(this,t,1),!0)},SampledProperty.prototype.removeSamples=function(e){var t=this._times,i=binarySearch(t,e.start,JulianDate.compare);i<0?i=~i:e.isStartIncluded||++i;var r=binarySearch(t,e.stop,JulianDate.compare);r<0?r=~r:e.isStopIncluded&&++r,removeSamples(this,i,r-i)},SampledProperty.prototype.equals=function(e){if(this===e)return!0;if(!defined(e))return!1;if(this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;var t,i,r=this._derivativeTypes,n=defined(r),a=e._derivativeTypes;if(n!==defined(a))return!1;if(n){if((i=r.length)!==a.length)return!1;for(t=0;t<i;t++)if(r[t]!==a[t])return!1}var o=this._times,s=e._times;if((i=o.length)!==s.length)return!1;for(t=0;t<i;t++)if(!JulianDate.equals(o[t],s[t]))return!1;var l=this._values,c=e._values;for(i=l.length,t=0;t<i;t++)if(l[t]!==c[t])return!1;return!0},SampledProperty._mergeNewSamples=mergeNewSamples,Object.defineProperties(SampledPositionProperty.prototype,{isConstant:{get:function(){return this._property.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}},interpolationDegree:{get:function(){return this._property.interpolationDegree}},interpolationAlgorithm:{get:function(){return this._property.interpolationAlgorithm}},numberOfDerivatives:{get:function(){return this._numberOfDerivatives}},forwardExtrapolationType:{get:function(){return this._property.forwardExtrapolationType},set:function(e){this._property.forwardExtrapolationType=e}},forwardExtrapolationDuration:{get:function(){return this._property.forwardExtrapolationDuration},set:function(e){this._property.forwardExtrapolationDuration=e}},backwardExtrapolationType:{get:function(){return this._property.backwardExtrapolationType},set:function(e){this._property.backwardExtrapolationType=e}},backwardExtrapolationDuration:{get:function(){return this._property.backwardExtrapolationDuration},set:function(e){this._property.backwardExtrapolationDuration=e}}}),SampledPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},SampledPositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){if(defined(i=this._property.getValue(e,i)))return PositionProperty.convertToReferenceFrame(e,i,this._referenceFrame,t,i)},SampledPositionProperty.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)},SampledPositionProperty.prototype.addSample=function(e,t,i){this._numberOfDerivatives,this._property.addSample(e,t,i)},SampledPositionProperty.prototype.addSamples=function(e,t,i){this._property.addSamples(e,t,i)},SampledPositionProperty.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)},SampledPositionProperty.prototype.removeSample=function(e){return this._property.removeSample(e)},SampledPositionProperty.prototype.removeSamples=function(e){this._property.removeSamples(e)},SampledPositionProperty.prototype.equals=function(e){return this===e||e instanceof SampledPositionProperty&&Property.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame};var StripeOrientation={HORIZONTAL:0,VERTICAL:1},StripeOrientation$1=Object.freeze(StripeOrientation),defaultOrientation=StripeOrientation$1.HORIZONTAL,defaultEvenColor=Color.WHITE,defaultOddColor=Color.BLACK,defaultOffset$7=0,defaultRepeat=1;function StripeMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._orientation=void 0,this._orientationSubscription=void 0,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._offset=void 0,this._offsetSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.orientation=e.orientation,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.offset=e.offset,this.repeat=e.repeat}function TimeIntervalCollectionPositionProperty(e){this._definitionChanged=new Event,this._intervals=new TimeIntervalCollection,this._intervals.changedEvent.addEventListener(TimeIntervalCollectionPositionProperty.prototype._intervalsChanged,this),this._referenceFrame=defaultValue(e,ReferenceFrame$1.FIXED)}function TimeIntervalCollectionProperty(){this._definitionChanged=new Event,this._intervals=new TimeIntervalCollection,this._intervals.changedEvent.addEventListener(TimeIntervalCollectionProperty.prototype._intervalsChanged,this)}function VelocityVectorProperty(e,t){this._position=void 0,this._subscription=void 0,this._definitionChanged=new Event,this._normalize=defaultValue(t,!0),this.position=e}Object.defineProperties(StripeMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._orientation)&&Property.isConstant(this._evenColor)&&Property.isConstant(this._oddColor)&&Property.isConstant(this._offset)&&Property.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},orientation:createPropertyDescriptor("orientation"),evenColor:createPropertyDescriptor("evenColor"),oddColor:createPropertyDescriptor("oddColor"),offset:createPropertyDescriptor("offset"),repeat:createPropertyDescriptor("repeat")}),StripeMaterialProperty.prototype.getType=function(e){return"Stripe"},StripeMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.horizontal=Property.getValueOrDefault(this._orientation,e,defaultOrientation)===StripeOrientation$1.HORIZONTAL,t.evenColor=Property.getValueOrClonedDefault(this._evenColor,e,defaultEvenColor,t.evenColor),t.oddColor=Property.getValueOrClonedDefault(this._oddColor,e,defaultOddColor,t.oddColor),t.offset=Property.getValueOrDefault(this._offset,e,defaultOffset$7),t.repeat=Property.getValueOrDefault(this._repeat,e,defaultRepeat),t},StripeMaterialProperty.prototype.equals=function(e){return this===e||e instanceof StripeMaterialProperty&&Property.equals(this._orientation,e._orientation)&&Property.equals(this._evenColor,e._evenColor)&&Property.equals(this._oddColor,e._oddColor)&&Property.equals(this._offset,e._offset)&&Property.equals(this._repeat,e._repeat)},Object.defineProperties(TimeIntervalCollectionPositionProperty.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}},referenceFrame:{get:function(){return this._referenceFrame}}}),TimeIntervalCollectionPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},TimeIntervalCollectionPositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){var r=this._intervals.findDataForIntervalContainingDate(e);if(defined(r))return PositionProperty.convertToReferenceFrame(e,r,this._referenceFrame,t,i)},TimeIntervalCollectionPositionProperty.prototype.equals=function(e){return this===e||e instanceof TimeIntervalCollectionPositionProperty&&this._intervals.equals(e._intervals,Property.equals)&&this._referenceFrame===e._referenceFrame},TimeIntervalCollectionPositionProperty.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(TimeIntervalCollectionProperty.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),TimeIntervalCollectionProperty.prototype.getValue=function(e,t){var i=this._intervals.findDataForIntervalContainingDate(e);return defined(i)&&"function"==typeof i.clone?i.clone(t):i},TimeIntervalCollectionProperty.prototype.equals=function(e){return this===e||e instanceof TimeIntervalCollectionProperty&&this._intervals.equals(e._intervals,Property.equals)},TimeIntervalCollectionProperty.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(VelocityVectorProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._position)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._position},set:function(e){var t=this._position;t!==e&&(defined(t)&&this._subscription(),this._position=e,defined(e)&&(this._subscription=e._definitionChanged.addEventListener((function(){this._definitionChanged.raiseEvent(this)}),this)),this._definitionChanged.raiseEvent(this))}},normalize:{get:function(){return this._normalize},set:function(e){this._normalize!==e&&(this._normalize=e,this._definitionChanged.raiseEvent(this))}}});var position1Scratch=new Cartesian3,position2Scratch=new Cartesian3,timeScratch=new JulianDate,step=1/60;function VelocityOrientationProperty(e,t){this._velocityVectorProperty=new VelocityVectorProperty(e,!0),this._subscription=void 0,this._ellipsoid=void 0,this._definitionChanged=new Event,this.ellipsoid=defaultValue(t,Ellipsoid.WGS84);var i=this;this._velocityVectorProperty.definitionChanged.addEventListener((function(){i._definitionChanged.raiseEvent(i)}))}VelocityVectorProperty.prototype.getValue=function(e,t){return this._getValue(e,t)},VelocityVectorProperty.prototype._getValue=function(e,t,i){defined(t)||(t=new Cartesian3);var r=this._position;if(Property.isConstant(r))return this._normalize?void 0:Cartesian3.clone(Cartesian3.ZERO,t);var n=r.getValue(e,position1Scratch),a=r.getValue(JulianDate.addSeconds(e,step,timeScratch),position2Scratch);if(defined(n)&&(defined(a)||(a=n,defined(n=r.getValue(JulianDate.addSeconds(e,-step,timeScratch),position2Scratch))))){if(Cartesian3.equals(n,a))return this._normalize?void 0:Cartesian3.clone(Cartesian3.ZERO,t);defined(i)&&n.clone(i);var o=Cartesian3.subtract(a,n,t);return this._normalize?Cartesian3.normalize(o,t):Cartesian3.divideByScalar(o,step,t)}},VelocityVectorProperty.prototype.equals=function(e){return this===e||e instanceof VelocityVectorProperty&&Property.equals(this._position,e._position)},Object.defineProperties(VelocityOrientationProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._velocityVectorProperty)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._velocityVectorProperty.position},set:function(e){this._velocityVectorProperty.position=e}},ellipsoid:{get:function(){return this._ellipsoid},set:function(e){this._ellipsoid!==e&&(this._ellipsoid=e,this._definitionChanged.raiseEvent(this))}}});var positionScratch$3=new Cartesian3,velocityScratch=new Cartesian3,rotationScratch$1=new Matrix3,currentId;function UnitCartesian3(){}function createReferenceProperty(e,t){return"#"===t[0]&&(t=currentId+t),ReferenceProperty.fromString(e,t)}function createSpecializedProperty(e,t,i){if(defined(i.reference))return createReferenceProperty(t,i.reference);if(defined(i.velocityReference)){var r=createReferenceProperty(t,i.velocityReference);switch(e){case Cartesian3:case UnitCartesian3:return new VelocityVectorProperty(r,e===UnitCartesian3);case Quaternion:return new VelocityOrientationProperty(r)}}throw new RuntimeError(JSON.stringify(i)+" is not valid CZML.")}function createAdapterProperty(e,t){return new CallbackProperty((function(i,r){return t(e.getValue(i,r))}),e.isConstant)}VelocityOrientationProperty.prototype.getValue=function(e,t){var i=this._velocityVectorProperty._getValue(e,velocityScratch,positionScratch$3);if(defined(i))return Transforms.rotationMatrixFromPositionVelocity(positionScratch$3,i,this._ellipsoid,rotationScratch$1),Quaternion.fromRotationMatrix(rotationScratch$1,t)},VelocityOrientationProperty.prototype.equals=function(e){return this===e||e instanceof VelocityOrientationProperty&&Property.equals(this._velocityVectorProperty,e._velocityVectorProperty)&&(this._ellipsoid===e._ellipsoid||this._ellipsoid.equals(e._ellipsoid))},UnitCartesian3.packedLength=Cartesian3.packedLength,UnitCartesian3.unpack=Cartesian3.unpack,UnitCartesian3.pack=Cartesian3.pack;var scratchCartesian$3=new Cartesian3,scratchSpherical=new Spherical,scratchCartographic$9=new Cartographic,scratchTimeInterval$1=new TimeInterval,scratchQuaternion=new Quaternion;function unwrapColorInterval(e){var t=e.rgbaf;if(defined(t))return t;var i=e.rgba;if(defined(i)){var r=i.length;if(r===Color.packedLength)return[Color.byteToFloat(i[0]),Color.byteToFloat(i[1]),Color.byteToFloat(i[2]),Color.byteToFloat(i[3])];t=new Array(r);for(var n=0;n<r;n+=5)t[n]=i[n],t[n+1]=Color.byteToFloat(i[n+1]),t[n+2]=Color.byteToFloat(i[n+2]),t[n+3]=Color.byteToFloat(i[n+3]),t[n+4]=Color.byteToFloat(i[n+4]);return t}}function unwrapUriInterval(e,t){var i=defaultValue(e.uri,e);return defined(t)?t.getDerivedResource({url:i}):Resource.createIfNeeded(i)}function unwrapRectangleInterval(e){var t=e.wsen;if(defined(t))return t;var i=e.wsenDegrees;if(defined(i)){var r=i.length;if(r===Rectangle.packedLength)return[CesiumMath.toRadians(i[0]),CesiumMath.toRadians(i[1]),CesiumMath.toRadians(i[2]),CesiumMath.toRadians(i[3])];t=new Array(r);for(var n=0;n<r;n+=5)t[n]=i[n],t[n+1]=CesiumMath.toRadians(i[n+1]),t[n+2]=CesiumMath.toRadians(i[n+2]),t[n+3]=CesiumMath.toRadians(i[n+3]),t[n+4]=CesiumMath.toRadians(i[n+4]);return t}}function convertUnitSphericalToCartesian(e){var t=e.length;if(scratchSpherical.magnitude=1,2===t)return scratchSpherical.clock=e[0],scratchSpherical.cone=e[1],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$3),[scratchCartesian$3.x,scratchCartesian$3.y,scratchCartesian$3.z];for(var i=new Array(t/3*4),r=0,n=0;r<t;r+=3,n+=4)i[n]=e[r],scratchSpherical.clock=e[r+1],scratchSpherical.cone=e[r+2],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$3),i[n+1]=scratchCartesian$3.x,i[n+2]=scratchCartesian$3.y,i[n+3]=scratchCartesian$3.z;return i}function convertSphericalToCartesian(e){var t=e.length;if(3===t)return scratchSpherical.clock=e[0],scratchSpherical.cone=e[1],scratchSpherical.magnitude=e[2],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$3),[scratchCartesian$3.x,scratchCartesian$3.y,scratchCartesian$3.z];for(var i=new Array(t),r=0;r<t;r+=4)i[r]=e[r],scratchSpherical.clock=e[r+1],scratchSpherical.cone=e[r+2],scratchSpherical.magnitude=e[r+3],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$3),i[r+1]=scratchCartesian$3.x,i[r+2]=scratchCartesian$3.y,i[r+3]=scratchCartesian$3.z;return i}function convertCartographicRadiansToCartesian(e){var t=e.length;if(3===t)return scratchCartographic$9.longitude=e[0],scratchCartographic$9.latitude=e[1],scratchCartographic$9.height=e[2],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$9,scratchCartesian$3),[scratchCartesian$3.x,scratchCartesian$3.y,scratchCartesian$3.z];for(var i=new Array(t),r=0;r<t;r+=4)i[r]=e[r],scratchCartographic$9.longitude=e[r+1],scratchCartographic$9.latitude=e[r+2],scratchCartographic$9.height=e[r+3],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$9,scratchCartesian$3),i[r+1]=scratchCartesian$3.x,i[r+2]=scratchCartesian$3.y,i[r+3]=scratchCartesian$3.z;return i}function convertCartographicDegreesToCartesian(e){var t=e.length;if(3===t)return scratchCartographic$9.longitude=CesiumMath.toRadians(e[0]),scratchCartographic$9.latitude=CesiumMath.toRadians(e[1]),scratchCartographic$9.height=e[2],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$9,scratchCartesian$3),[scratchCartesian$3.x,scratchCartesian$3.y,scratchCartesian$3.z];for(var i=new Array(t),r=0;r<t;r+=4)i[r]=e[r],scratchCartographic$9.longitude=CesiumMath.toRadians(e[r+1]),scratchCartographic$9.latitude=CesiumMath.toRadians(e[r+2]),scratchCartographic$9.height=e[r+3],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$9,scratchCartesian$3),i[r+1]=scratchCartesian$3.x,i[r+2]=scratchCartesian$3.y,i[r+3]=scratchCartesian$3.z;return i}function unwrapCartesianInterval(e){var t=e.cartesian;if(defined(t))return t;var i=e.cartesianVelocity;if(defined(i))return i;var r=e.unitCartesian;if(defined(r))return r;var n=e.unitSpherical;if(defined(n))return convertUnitSphericalToCartesian(n);var a=e.spherical;if(defined(a))return convertSphericalToCartesian(a);var o=e.cartographicRadians;if(defined(o))return convertCartographicRadiansToCartesian(o);var s=e.cartographicDegrees;if(defined(s))return convertCartographicDegreesToCartesian(s);throw new RuntimeError(JSON.stringify(e)+" is not a valid CZML interval.")}function normalizePackedCartesianArray(e,t){Cartesian3.unpack(e,t,scratchCartesian$3),Cartesian3.normalize(scratchCartesian$3,scratchCartesian$3),Cartesian3.pack(scratchCartesian$3,e,t)}function unwrapUnitCartesianInterval(e){var t=unwrapCartesianInterval(e);if(3===t.length)return normalizePackedCartesianArray(t,0),t;for(var i=1;i<t.length;i+=4)normalizePackedCartesianArray(t,i);return t}function normalizePackedQuaternionArray(e,t){Quaternion.unpack(e,t,scratchQuaternion),Quaternion.normalize(scratchQuaternion,scratchQuaternion),Quaternion.pack(scratchQuaternion,e,t)}function unwrapQuaternionInterval(e){var t=e.unitQuaternion;if(defined(t)){if(4===t.length)return normalizePackedQuaternionArray(t,0),t;for(var i=1;i<t.length;i+=5)normalizePackedQuaternionArray(t,i)}return t}function getPropertyType(e){return"boolean"==typeof e?Boolean:"number"==typeof e?Number:"string"==typeof e?String:e.hasOwnProperty("array")?Array:e.hasOwnProperty("boolean")?Boolean:e.hasOwnProperty("boundingRectangle")?BoundingRectangle:e.hasOwnProperty("cartesian2")?Cartesian2:e.hasOwnProperty("cartesian")||e.hasOwnProperty("spherical")||e.hasOwnProperty("cartographicRadians")||e.hasOwnProperty("cartographicDegrees")?Cartesian3:e.hasOwnProperty("unitCartesian")||e.hasOwnProperty("unitSpherical")?UnitCartesian3:e.hasOwnProperty("rgba")||e.hasOwnProperty("rgbaf")?Color:e.hasOwnProperty("arcType")?ArcType$1:e.hasOwnProperty("classificationType")?ClassificationType$1:e.hasOwnProperty("colorBlendMode")?ColorBlendMode$1:e.hasOwnProperty("cornerType")?CornerType$1:e.hasOwnProperty("heightReference")?HeightReference$1:e.hasOwnProperty("horizontalOrigin")?HorizontalOrigin$1:e.hasOwnProperty("date")?JulianDate:e.hasOwnProperty("labelStyle")?LabelStyle$1:e.hasOwnProperty("number")?Number:e.hasOwnProperty("nearFarScalar")?NearFarScalar:e.hasOwnProperty("distanceDisplayCondition")?DistanceDisplayCondition:e.hasOwnProperty("object")||e.hasOwnProperty("value")?Object:e.hasOwnProperty("unitQuaternion")?Quaternion:e.hasOwnProperty("shadowMode")?ShadowMode$1:e.hasOwnProperty("string")?String:e.hasOwnProperty("stripeOrientation")?StripeOrientation$1:e.hasOwnProperty("wsen")||e.hasOwnProperty("wsenDegrees")?Rectangle:e.hasOwnProperty("uri")?URI:e.hasOwnProperty("verticalOrigin")?VerticalOrigin$1:Object}function unwrapInterval(e,t,i){switch(e){case ArcType$1:return ArcType$1[defaultValue(t.arcType,t)];case Array:return t.array;case Boolean:return defaultValue(t.boolean,t);case BoundingRectangle:return t.boundingRectangle;case Cartesian2:return t.cartesian2;case Cartesian3:return unwrapCartesianInterval(t);case UnitCartesian3:return unwrapUnitCartesianInterval(t);case Color:return unwrapColorInterval(t);case ClassificationType$1:return ClassificationType$1[defaultValue(t.classificationType,t)];case ColorBlendMode$1:return ColorBlendMode$1[defaultValue(t.colorBlendMode,t)];case CornerType$1:return CornerType$1[defaultValue(t.cornerType,t)];case HeightReference$1:return HeightReference$1[defaultValue(t.heightReference,t)];case HorizontalOrigin$1:return HorizontalOrigin$1[defaultValue(t.horizontalOrigin,t)];case Image:return unwrapUriInterval(t,i);case JulianDate:return JulianDate.fromIso8601(defaultValue(t.date,t));case LabelStyle$1:return LabelStyle$1[defaultValue(t.labelStyle,t)];case Number:return defaultValue(t.number,t);case NearFarScalar:return t.nearFarScalar;case DistanceDisplayCondition:return t.distanceDisplayCondition;case Object:return defaultValue(defaultValue(t.object,t.value),t);case Quaternion:return unwrapQuaternionInterval(t);case Rotation:return defaultValue(t.number,t);case ShadowMode$1:return ShadowMode$1[defaultValue(defaultValue(t.shadowMode,t.shadows),t)];case String:return defaultValue(t.string,t);case StripeOrientation$1:return StripeOrientation$1[defaultValue(t.stripeOrientation,t)];case Rectangle:return unwrapRectangleInterval(t);case URI:return unwrapUriInterval(t,i);case VerticalOrigin$1:return VerticalOrigin$1[defaultValue(t.verticalOrigin,t)];default:throw new RuntimeError(e)}}var interpolators={HERMITE:HermitePolynomialApproximation,LAGRANGE:LagrangePolynomialApproximation,LINEAR:LinearApproximation};function updateInterpolationSettings(e,t){var i=e.interpolationAlgorithm,r=e.interpolationDegree;(defined(i)||defined(r))&&t.setInterpolationOptions({interpolationAlgorithm:interpolators[i],interpolationDegree:r});var n=e.forwardExtrapolationType;defined(n)&&(t.forwardExtrapolationType=ExtrapolationType$1[n]);var a=e.forwardExtrapolationDuration;defined(a)&&(t.forwardExtrapolationDuration=a);var o=e.backwardExtrapolationType;defined(o)&&(t.backwardExtrapolationType=ExtrapolationType$1[o]);var s=e.backwardExtrapolationDuration;defined(s)&&(t.backwardExtrapolationDuration=s)}var iso8601Scratch={iso8601:void 0};function intervalFromString(e){if(defined(e))return iso8601Scratch.iso8601=e,TimeInterval.fromIso8601(iso8601Scratch)}function wrapPropertyInInfiniteInterval(e){var t=Iso8601.MAXIMUM_INTERVAL.clone();return t.data=e,t}function convertPropertyToComposite(e){var t=new CompositeProperty;return t.intervals.addInterval(wrapPropertyInInfiniteInterval(e)),t}function convertPositionPropertyToComposite(e){var t=new CompositePositionProperty(e.referenceFrame);return t.intervals.addInterval(wrapPropertyInInfiniteInterval(e)),t}function processProperty(e,t,i,r,n,a,o){var s,l,c,u=intervalFromString(r.interval);defined(n)&&(u=defined(u)?TimeInterval.intersect(u,n,scratchTimeInterval$1):n);var d=!defined(r.reference)&&!defined(r.velocityReference),h=defined(u)&&!u.equals(Iso8601.MAXIMUM_INTERVAL);if(!0===r.delete)return h?removePropertyData(t[i],u):void(t[i]=void 0);var p=!1;if(d){if(!defined(l=unwrapInterval(e,r,a)))return;s=defaultValue(e.packedLength,1),c=defaultValue(l.length,1),p=!defined(r.array)&&"string"!=typeof l&&c>s&&e!==Object}var f="function"==typeof e.unpack&&e!==Rotation;if(p||h){var m,g,_=t[i],y=r.epoch;if(defined(y)&&(m=JulianDate.fromIso8601(y)),p&&!h)return _ instanceof SampledProperty||(t[i]=_=new SampledProperty(e)),_.addSamplesPackedArray(l,m),void updateInterpolationSettings(r,_);if(!p&&h)return(u=u.clone()).data=d?f?e.unpack(l,0):l:createSpecializedProperty(e,o,r),defined(_)||(t[i]=_=d?new TimeIntervalCollectionProperty:new CompositeProperty),void(d&&_ instanceof TimeIntervalCollectionProperty?_.intervals.addInterval(u):_ instanceof CompositeProperty?(d&&(u.data=new ConstantProperty(u.data)),_.intervals.addInterval(u)):(t[i]=_=convertPropertyToComposite(_),d&&(u.data=new ConstantProperty(u.data)),_.intervals.addInterval(u)));defined(_)||(t[i]=_=new CompositeProperty),_ instanceof CompositeProperty||(t[i]=_=convertPropertyToComposite(_));var v=_.intervals;defined(g=v.findInterval(u))&&g.data instanceof SampledProperty||((g=u.clone()).data=new SampledProperty(e),v.addInterval(g)),g.data.addSamplesPackedArray(l,m),updateInterpolationSettings(r,g.data)}else t[i]=d?new ConstantProperty(f?e.unpack(l,0):l):createSpecializedProperty(e,o,r)}function removePropertyData(e,t){if(e instanceof SampledProperty)e.removeSamples(t);else if(e instanceof TimeIntervalCollectionProperty)e.intervals.removeInterval(t);else if(e instanceof CompositeProperty){for(var i=e.intervals,r=0;r<i.length;++r){var n=TimeInterval.intersect(i.get(r),t,scratchTimeInterval$1);n.isEmpty||removePropertyData(n.data,t)}i.removeInterval(t)}else;}function processPacketData(e,t,i,r,n,a,o){if(defined(r))if(Array.isArray(r))for(var s=0,l=r.length;s<l;++s)processProperty(e,t,i,r[s],n,a,o);else processProperty(e,t,i,r,n,a,o)}function processPositionProperty(e,t,i,r,n,a){var o=intervalFromString(i.interval);defined(r)&&(o=defined(o)?TimeInterval.intersect(o,r,scratchTimeInterval$1):r);var s,l,c=defined(i.cartesianVelocity)?1:0,u=Cartesian3.packedLength*(c+1),d=!defined(i.reference),h=defined(o)&&!o.equals(Iso8601.MAXIMUM_INTERVAL);if(!0===i.delete)return h?removePositionPropertyData(e[t],o):void(e[t]=void 0);var p=!1;if(d&&(defined(i.referenceFrame)&&(l=ReferenceFrame$1[i.referenceFrame]),l=defaultValue(l,ReferenceFrame$1.FIXED),p=defaultValue((s=unwrapCartesianInterval(i)).length,1)>u),p||h){var f,m,g=e[t],_=i.epoch;if(defined(_)&&(f=JulianDate.fromIso8601(_)),p&&!h)return g instanceof SampledPositionProperty&&(!defined(l)||g.referenceFrame===l)||(e[t]=g=new SampledPositionProperty(l,c)),g.addSamplesPackedArray(s,f),void updateInterpolationSettings(i,g);if(!p&&h)return(o=o.clone()).data=d?Cartesian3.unpack(s):createReferenceProperty(a,i.reference),defined(g)||(g=d?new TimeIntervalCollectionPositionProperty(l):new CompositePositionProperty(l),e[t]=g),void(d&&g instanceof TimeIntervalCollectionPositionProperty&&defined(l)&&g.referenceFrame===l?g.intervals.addInterval(o):g instanceof CompositePositionProperty?(d&&(o.data=new ConstantPositionProperty(o.data,l)),g.intervals.addInterval(o)):(e[t]=g=convertPositionPropertyToComposite(g),d&&(o.data=new ConstantPositionProperty(o.data,l)),g.intervals.addInterval(o)));defined(g)?g instanceof CompositePositionProperty||(e[t]=g=convertPositionPropertyToComposite(g)):e[t]=g=new CompositePositionProperty(l);var y=g.intervals;defined(m=y.findInterval(o))&&m.data instanceof SampledPositionProperty&&(!defined(l)||m.data.referenceFrame===l)||((m=o.clone()).data=new SampledPositionProperty(l,c),y.addInterval(m)),m.data.addSamplesPackedArray(s,f),updateInterpolationSettings(i,m.data)}else e[t]=d?new ConstantPositionProperty(Cartesian3.unpack(s),l):createReferenceProperty(a,i.reference)}function removePositionPropertyData(e,t){if(e instanceof SampledPositionProperty)e.removeSamples(t);else if(e instanceof TimeIntervalCollectionPositionProperty)e.intervals.removeInterval(t);else if(e instanceof CompositePositionProperty){for(var i=e.intervals,r=0;r<i.length;++r){var n=TimeInterval.intersect(i.get(r),t,scratchTimeInterval$1);n.isEmpty||removePositionPropertyData(n.data,t)}i.removeInterval(t)}else;}function processPositionPacketData(e,t,i,r,n,a){if(defined(i))if(Array.isArray(i))for(var o=0,s=i.length;o<s;++o)processPositionProperty(e,t,i[o],r,n,a);else processPositionProperty(e,t,i,r,n,a)}function processShapePacketData(e,t,i,r){defined(i.references)?processReferencesArrayPacketData(e,t,i.references,i.interval,r,PropertyArray,CompositeProperty):(defined(i.cartesian2)?i.array=Cartesian2.unpackArray(i.cartesian2):defined(i.cartesian)&&(i.array=Cartesian2.unpackArray(i.cartesian)),defined(i.array)&&processPacketData(Array,e,t,i,void 0,void 0,r))}function processMaterialProperty(e,t,i,r,n,a){var o=intervalFromString(i.interval);defined(r)&&(o=defined(o)?TimeInterval.intersect(o,r,scratchTimeInterval$1):r);var s,l,c,u=e[t];if(defined(o)){u instanceof CompositeMaterialProperty||(u=new CompositeMaterialProperty,e[t]=u);var d=u.intervals;defined(l=d.findInterval({start:o.start,stop:o.stop}))?s=l.data:(l=o.clone(),d.addInterval(l))}else s=u;defined(i.solidColor)?(s instanceof ColorMaterialProperty||(s=new ColorMaterialProperty),processPacketData(Color,s,"color",(c=i.solidColor).color,void 0,void 0,a)):defined(i.grid)?(s instanceof GridMaterialProperty||(s=new GridMaterialProperty),processPacketData(Color,s,"color",(c=i.grid).color,void 0,n,a),processPacketData(Number,s,"cellAlpha",c.cellAlpha,void 0,n,a),processPacketData(Cartesian2,s,"lineCount",c.lineCount,void 0,n,a),processPacketData(Cartesian2,s,"lineThickness",c.lineThickness,void 0,n,a),processPacketData(Cartesian2,s,"lineOffset",c.lineOffset,void 0,n,a)):defined(i.image)?(s instanceof ImageMaterialProperty||(s=new ImageMaterialProperty),c=i.image,processPacketData(Image,s,"image",c.image,void 0,n,a),processPacketData(Cartesian2,s,"repeat",c.repeat,void 0,n,a),processPacketData(Color,s,"color",c.color,void 0,n,a),processPacketData(Boolean,s,"transparent",c.transparent,void 0,n,a)):defined(i.stripe)?(s instanceof StripeMaterialProperty||(s=new StripeMaterialProperty),c=i.stripe,processPacketData(StripeOrientation$1,s,"orientation",c.orientation,void 0,n,a),processPacketData(Color,s,"evenColor",c.evenColor,void 0,n,a),processPacketData(Color,s,"oddColor",c.oddColor,void 0,n,a),processPacketData(Number,s,"offset",c.offset,void 0,n,a),processPacketData(Number,s,"repeat",c.repeat,void 0,n,a)):defined(i.polylineOutline)?(s instanceof PolylineOutlineMaterialProperty||(s=new PolylineOutlineMaterialProperty),processPacketData(Color,s,"color",(c=i.polylineOutline).color,void 0,n,a),processPacketData(Color,s,"outlineColor",c.outlineColor,void 0,n,a),processPacketData(Number,s,"outlineWidth",c.outlineWidth,void 0,n,a)):defined(i.polylineGlow)?(s instanceof PolylineGlowMaterialProperty||(s=new PolylineGlowMaterialProperty),processPacketData(Color,s,"color",(c=i.polylineGlow).color,void 0,n,a),processPacketData(Number,s,"glowPower",c.glowPower,void 0,n,a),processPacketData(Number,s,"taperPower",c.taperPower,void 0,n,a)):defined(i.polylineArrow)?(s instanceof PolylineArrowMaterialProperty||(s=new PolylineArrowMaterialProperty),processPacketData(Color,s,"color",(c=i.polylineArrow).color,void 0,void 0,a)):defined(i.polylineDash)?(s instanceof PolylineDashMaterialProperty||(s=new PolylineDashMaterialProperty),processPacketData(Color,s,"color",(c=i.polylineDash).color,void 0,void 0,a),processPacketData(Color,s,"gapColor",c.gapColor,void 0,void 0,a),processPacketData(Number,s,"dashLength",c.dashLength,void 0,n,a),processPacketData(Number,s,"dashPattern",c.dashPattern,void 0,n,a)):defined(i.checkerboard)&&(s instanceof CheckerboardMaterialProperty||(s=new CheckerboardMaterialProperty),processPacketData(Color,s,"evenColor",(c=i.checkerboard).evenColor,void 0,n,a),processPacketData(Color,s,"oddColor",c.oddColor,void 0,n,a),processPacketData(Cartesian2,s,"repeat",c.repeat,void 0,n,a)),defined(l)?l.data=s:e[t]=s}function processMaterialPacketData(e,t,i,r,n,a){if(defined(i))if(Array.isArray(i))for(var o=0,s=i.length;o<s;++o)processMaterialProperty(e,t,i[o],r,n,a);else processMaterialProperty(e,t,i,r,n,a)}function processName(e,t,i,r){defined(t.name)&&(e.name=t.name)}function processDescription$1(e,t,i,r){var n=t.description;defined(n)&&processPacketData(String,e,"description",n,void 0,r,i)}function processPosition(e,t,i,r){var n=t.position;defined(n)&&processPositionPacketData(e,"position",n,void 0,r,i)}function processViewFrom(e,t,i,r){var n=t.viewFrom;defined(n)&&processPacketData(Cartesian3,e,"viewFrom",n,void 0,r,i)}function processOrientation(e,t,i,r){var n=t.orientation;defined(n)&&processPacketData(Quaternion,e,"orientation",n,void 0,r,i)}function processProperties(e,t,i,r){var n=t.properties;if(defined(n))for(var a in defined(e.properties)||(e.properties=new PropertyBag),n)if(n.hasOwnProperty(a)){e.properties.hasProperty(a)||e.properties.addProperty(a);var o=n[a];if(Array.isArray(o))for(var s=0,l=o.length;s<l;++s)processProperty(getPropertyType(o[s]),e.properties,a,o[s],void 0,r,i);else processProperty(getPropertyType(o),e.properties,a,o,void 0,r,i)}}function processReferencesArrayPacketData(e,t,i,r,n,a,o){var s=i.map((function(e){return createReferenceProperty(n,e)}));if(defined(r)){r=intervalFromString(r);var l=e[t];if(!(l instanceof o)){var c=new o;c.intervals.addInterval(wrapPropertyInInfiniteInterval(l)),e[t]=l=c}r.data=new a(s),l.intervals.addInterval(r)}else e[t]=new a(s)}function processArrayPacketData(e,t,i,r){var n=i.references;defined(n)?processReferencesArrayPacketData(e,t,n,i.interval,r,PropertyArray,CompositeProperty):processPacketData(Array,e,t,i,void 0,void 0,r)}function processArray(e,t,i,r){if(defined(i))if(Array.isArray(i))for(var n=0,a=i.length;n<a;++n)processArrayPacketData(e,t,i[n],r);else processArrayPacketData(e,t,i,r)}function processPositionArrayPacketData(e,t,i,r){var n=i.references;defined(n)?processReferencesArrayPacketData(e,t,n,i.interval,r,PositionPropertyArray,CompositePositionProperty):(defined(i.cartesian)?i.array=Cartesian3.unpackArray(i.cartesian):defined(i.cartographicRadians)?i.array=Cartesian3.fromRadiansArrayHeights(i.cartographicRadians):defined(i.cartographicDegrees)&&(i.array=Cartesian3.fromDegreesArrayHeights(i.cartographicDegrees)),defined(i.array)&&processPacketData(Array,e,t,i,void 0,void 0,r))}function processPositionArray(e,t,i,r){if(defined(i))if(Array.isArray(i))for(var n=0,a=i.length;n<a;++n)processPositionArrayPacketData(e,t,i[n],r);else processPositionArrayPacketData(e,t,i,r)}function unpackCartesianArray(e){return Cartesian3.unpackArray(e)}function unpackCartographicRadiansArray(e){return Cartesian3.fromRadiansArrayHeights(e)}function unpackCartographicDegreesArray(e){return Cartesian3.fromDegreesArrayHeights(e)}function processPositionArrayOfArraysPacketData(e,t,i,r){var n=i.references;if(defined(n)){var a=n.map((function(e){var t={};return processReferencesArrayPacketData(t,"positions",e,i.interval,r,PositionPropertyArray,CompositePositionProperty),t.positions}));e[t]=new PositionPropertyArray(a)}else defined(i.cartesian)?i.array=i.cartesian.map(unpackCartesianArray):defined(i.cartographicRadians)?i.array=i.cartographicRadians.map(unpackCartographicRadiansArray):defined(i.cartographicDegrees)&&(i.array=i.cartographicDegrees.map(unpackCartographicDegreesArray)),defined(i.array)&&processPacketData(Array,e,t,i,void 0,void 0,r)}function processPositionArrayOfArrays(e,t,i,r){if(defined(i))if(Array.isArray(i))for(var n=0,a=i.length;n<a;++n)processPositionArrayOfArraysPacketData(e,t,i[n],r);else processPositionArrayOfArraysPacketData(e,t,i,r)}function processShape(e,t,i,r){if(defined(i))if(Array.isArray(i))for(var n=0,a=i.length;n<a;n++)processShapePacketData(e,t,i[n],r);else processShapePacketData(e,t,i,r)}function processAvailability(e,t,i,r){var n=t.availability;if(defined(n)){var a;if(Array.isArray(n))for(var o=0,s=n.length;o<s;++o)defined(a)||(a=new TimeIntervalCollection),a.addInterval(intervalFromString(n[o]));else(a=new TimeIntervalCollection).addInterval(intervalFromString(n));e.availability=a}}function processAlignedAxis(e,t,i,r,n){defined(t)&&processPacketData(UnitCartesian3,e,"alignedAxis",t,i,r,n)}function processBillboard(e,t,i,r){var n=t.billboard;if(defined(n)){var a=intervalFromString(n.interval),o=e.billboard;defined(o)||(e.billboard=o=new BillboardGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Image,o,"image",n.image,a,r,i),processPacketData(Number,o,"scale",n.scale,a,r,i),processPacketData(Cartesian2,o,"pixelOffset",n.pixelOffset,a,r,i),processPacketData(Cartesian3,o,"eyeOffset",n.eyeOffset,a,r,i),processPacketData(HorizontalOrigin$1,o,"horizontalOrigin",n.horizontalOrigin,a,r,i),processPacketData(VerticalOrigin$1,o,"verticalOrigin",n.verticalOrigin,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Color,o,"color",n.color,a,r,i),processPacketData(Rotation,o,"rotation",n.rotation,a,r,i),processAlignedAxis(o,n.alignedAxis,a,r,i),processPacketData(Boolean,o,"sizeInMeters",n.sizeInMeters,a,r,i),processPacketData(Number,o,"width",n.width,a,r,i),processPacketData(Number,o,"height",n.height,a,r,i),processPacketData(NearFarScalar,o,"scaleByDistance",n.scaleByDistance,a,r,i),processPacketData(NearFarScalar,o,"translucencyByDistance",n.translucencyByDistance,a,r,i),processPacketData(NearFarScalar,o,"pixelOffsetScaleByDistance",n.pixelOffsetScaleByDistance,a,r,i),processPacketData(BoundingRectangle,o,"imageSubRegion",n.imageSubRegion,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(Number,o,"disableDepthTestDistance",n.disableDepthTestDistance,a,r,i)}}function processBox(e,t,i,r){var n=t.box;if(defined(n)){var a=intervalFromString(n.interval),o=e.box;defined(o)||(e.box=o=new BoxGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Cartesian3,o,"dimensions",n.dimensions,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i)}}function processCorridor(e,t,i,r){var n=t.corridor;if(defined(n)){var a=intervalFromString(n.interval),o=e.corridor;defined(o)||(e.corridor=o=new CorridorGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPositionArray(o,"positions",n.positions,i),processPacketData(Number,o,"width",n.width,a,r,i),processPacketData(Number,o,"height",n.height,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Number,o,"extrudedHeight",n.extrudedHeight,a,r,i),processPacketData(HeightReference$1,o,"extrudedHeightReference",n.extrudedHeightReference,a,r,i),processPacketData(CornerType$1,o,"cornerType",n.cornerType,a,r,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(ClassificationType$1,o,"classificationType",n.classificationType,a,r,i),processPacketData(Number,o,"zIndex",n.zIndex,a,r,i)}}function processCylinder(e,t,i,r){var n=t.cylinder;if(defined(n)){var a=intervalFromString(n.interval),o=e.cylinder;defined(o)||(e.cylinder=o=new CylinderGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Number,o,"length",n.length,a,r,i),processPacketData(Number,o,"topRadius",n.topRadius,a,r,i),processPacketData(Number,o,"bottomRadius",n.bottomRadius,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(Number,o,"numberOfVerticalLines",n.numberOfVerticalLines,a,r,i),processPacketData(Number,o,"slices",n.slices,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i)}}function processDocument$1(e,t){var i=e.version;if(defined(i)&&"string"==typeof i){var r=i.split(".");if(2===r.length){if("1"!==r[0])throw new RuntimeError("Cesium only supports CZML version 1.");t._version=i}}if(!defined(t._version))throw new RuntimeError("CZML version information invalid. It is expected to be a property on the document object in the <Major>.<Minor> version format.");var n=t._documentPacket;defined(e.name)&&(n.name=e.name);var a=e.clock;if(defined(a)){var o=n.clock;defined(o)?(o.interval=defaultValue(a.interval,o.interval),o.currentTime=defaultValue(a.currentTime,o.currentTime),o.range=defaultValue(a.range,o.range),o.step=defaultValue(a.step,o.step),o.multiplier=defaultValue(a.multiplier,o.multiplier)):n.clock={interval:a.interval,currentTime:a.currentTime,range:a.range,step:a.step,multiplier:a.multiplier}}}function processEllipse(e,t,i,r){var n=t.ellipse;if(defined(n)){var a=intervalFromString(n.interval),o=e.ellipse;defined(o)||(e.ellipse=o=new EllipseGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Number,o,"semiMajorAxis",n.semiMajorAxis,a,r,i),processPacketData(Number,o,"semiMinorAxis",n.semiMinorAxis,a,r,i),processPacketData(Number,o,"height",n.height,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Number,o,"extrudedHeight",n.extrudedHeight,a,r,i),processPacketData(HeightReference$1,o,"extrudedHeightReference",n.extrudedHeightReference,a,r,i),processPacketData(Rotation,o,"rotation",n.rotation,a,r,i),processPacketData(Rotation,o,"stRotation",n.stRotation,a,r,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(Number,o,"numberOfVerticalLines",n.numberOfVerticalLines,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(ClassificationType$1,o,"classificationType",n.classificationType,a,r,i),processPacketData(Number,o,"zIndex",n.zIndex,a,r,i)}}function processEllipsoid(e,t,i,r){var n=t.ellipsoid;if(defined(n)){var a=intervalFromString(n.interval),o=e.ellipsoid;defined(o)||(e.ellipsoid=o=new EllipsoidGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Cartesian3,o,"radii",n.radii,a,r,i),processPacketData(Cartesian3,o,"innerRadii",n.innerRadii,a,r,i),processPacketData(Number,o,"minimumClock",n.minimumClock,a,r,i),processPacketData(Number,o,"maximumClock",n.maximumClock,a,r,i),processPacketData(Number,o,"minimumCone",n.minimumCone,a,r,i),processPacketData(Number,o,"maximumCone",n.maximumCone,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(Number,o,"stackPartitions",n.stackPartitions,a,r,i),processPacketData(Number,o,"slicePartitions",n.slicePartitions,a,r,i),processPacketData(Number,o,"subdivisions",n.subdivisions,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i)}}function processLabel(e,t,i,r){var n=t.label;if(defined(n)){var a=intervalFromString(n.interval),o=e.label;defined(o)||(e.label=o=new LabelGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(String,o,"text",n.text,a,r,i),processPacketData(String,o,"font",n.font,a,r,i),processPacketData(LabelStyle$1,o,"style",n.style,a,r,i),processPacketData(Number,o,"scale",n.scale,a,r,i),processPacketData(Boolean,o,"showBackground",n.showBackground,a,r,i),processPacketData(Color,o,"backgroundColor",n.backgroundColor,a,r,i),processPacketData(Cartesian2,o,"backgroundPadding",n.backgroundPadding,a,r,i),processPacketData(Cartesian2,o,"pixelOffset",n.pixelOffset,a,r,i),processPacketData(Cartesian3,o,"eyeOffset",n.eyeOffset,a,r,i),processPacketData(HorizontalOrigin$1,o,"horizontalOrigin",n.horizontalOrigin,a,r,i),processPacketData(VerticalOrigin$1,o,"verticalOrigin",n.verticalOrigin,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Color,o,"fillColor",n.fillColor,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(NearFarScalar,o,"translucencyByDistance",n.translucencyByDistance,a,r,i),processPacketData(NearFarScalar,o,"pixelOffsetScaleByDistance",n.pixelOffsetScaleByDistance,a,r,i),processPacketData(NearFarScalar,o,"scaleByDistance",n.scaleByDistance,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(Number,o,"disableDepthTestDistance",n.disableDepthTestDistance,a,r,i)}}function processModel(e,t,i,r){var n=t.model;if(defined(n)){var a,o,s=intervalFromString(n.interval),l=e.model;defined(l)||(e.model=l=new ModelGraphics),processPacketData(Boolean,l,"show",n.show,s,r,i),processPacketData(URI,l,"uri",n.gltf,s,r,i),processPacketData(Number,l,"scale",n.scale,s,r,i),processPacketData(Number,l,"minimumPixelSize",n.minimumPixelSize,s,r,i),processPacketData(Number,l,"maximumScale",n.maximumScale,s,r,i),processPacketData(Boolean,l,"incrementallyLoadTextures",n.incrementallyLoadTextures,s,r,i),processPacketData(Boolean,l,"runAnimations",n.runAnimations,s,r,i),processPacketData(Boolean,l,"clampAnimations",n.clampAnimations,s,r,i),processPacketData(ShadowMode$1,l,"shadows",n.shadows,s,r,i),processPacketData(HeightReference$1,l,"heightReference",n.heightReference,s,r,i),processPacketData(Color,l,"silhouetteColor",n.silhouetteColor,s,r,i),processPacketData(Number,l,"silhouetteSize",n.silhouetteSize,s,r,i),processPacketData(Color,l,"color",n.color,s,r,i),processPacketData(ColorBlendMode$1,l,"colorBlendMode",n.colorBlendMode,s,r,i),processPacketData(Number,l,"colorBlendAmount",n.colorBlendAmount,s,r,i),processPacketData(DistanceDisplayCondition,l,"distanceDisplayCondition",n.distanceDisplayCondition,s,r,i);var c=n.nodeTransformations;if(defined(c))if(Array.isArray(c))for(a=0,o=c.length;a<o;++a)processNodeTransformations(l,c[a],s,r,i);else processNodeTransformations(l,c,s,r,i);var u=n.articulations;if(defined(u))if(Array.isArray(u))for(a=0,o=u.length;a<o;++a)processArticulations(l,u[a],s,r,i);else processArticulations(l,u,s,r,i)}}function processNodeTransformations(e,t,i,r,n){var a=intervalFromString(t.interval);defined(i)&&(a=defined(a)?TimeInterval.intersect(a,i,scratchTimeInterval$1):i);for(var o=e.nodeTransformations,s=Object.keys(t),l=0,c=s.length;l<c;++l){var u=s[l];if("interval"!==u){var d=t[u];if(defined(d)){defined(o)||(e.nodeTransformations=o=new PropertyBag),o.hasProperty(u)||o.addProperty(u);var h=o[u];defined(h)||(o[u]=h=new NodeTransformationProperty),processPacketData(Cartesian3,h,"translation",d.translation,a,r,n),processPacketData(Quaternion,h,"rotation",d.rotation,a,r,n),processPacketData(Cartesian3,h,"scale",d.scale,a,r,n)}}}}function processArticulations(e,t,i,r,n){var a=intervalFromString(t.interval);defined(i)&&(a=defined(a)?TimeInterval.intersect(a,i,scratchTimeInterval$1):i);for(var o=e.articulations,s=Object.keys(t),l=0,c=s.length;l<c;++l){var u=s[l];if("interval"!==u){var d=t[u];defined(d)&&(defined(o)||(e.articulations=o=new PropertyBag),o.hasProperty(u)||o.addProperty(u),processPacketData(Number,o,u,d,a,r,n))}}}function processPath(e,t,i,r){var n=t.path;if(defined(n)){var a=intervalFromString(n.interval),o=e.path;defined(o)||(e.path=o=new PathGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Number,o,"leadTime",n.leadTime,a,r,i),processPacketData(Number,o,"trailTime",n.trailTime,a,r,i),processPacketData(Number,o,"width",n.width,a,r,i),processPacketData(Number,o,"resolution",n.resolution,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i)}}function processPoint$2(e,t,i,r){var n=t.point;if(defined(n)){var a=intervalFromString(n.interval),o=e.point;defined(o)||(e.point=o=new PointGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Number,o,"pixelSize",n.pixelSize,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Color,o,"color",n.color,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(NearFarScalar,o,"scaleByDistance",n.scaleByDistance,a,r,i),processPacketData(NearFarScalar,o,"translucencyByDistance",n.translucencyByDistance,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(Number,o,"disableDepthTestDistance",n.disableDepthTestDistance,a,r,i)}}function PolygonHierarchyProperty(e){this.polygon=e,this._definitionChanged=new Event}function processPolygon$2(e,t,i,r){var n=t.polygon;if(defined(n)){var a=intervalFromString(n.interval),o=e.polygon;defined(o)||(e.polygon=o=new PolygonGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPositionArray(o,"_positions",n.positions,i),processPositionArrayOfArrays(o,"_holes",n.holes,i),(defined(o._positions)||defined(o._holes))&&(o.hierarchy=new PolygonHierarchyProperty(o)),processPacketData(Number,o,"height",n.height,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Number,o,"extrudedHeight",n.extrudedHeight,a,r,i),processPacketData(HeightReference$1,o,"extrudedHeightReference",n.extrudedHeightReference,a,r,i),processPacketData(Rotation,o,"stRotation",n.stRotation,a,r,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(Boolean,o,"perPositionHeight",n.perPositionHeight,a,r,i),processPacketData(Boolean,o,"closeTop",n.closeTop,a,r,i),processPacketData(Boolean,o,"closeBottom",n.closeBottom,a,r,i),processPacketData(ArcType$1,o,"arcType",n.arcType,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(ClassificationType$1,o,"classificationType",n.classificationType,a,r,i),processPacketData(Number,o,"zIndex",n.zIndex,a,r,i)}}function adaptFollowSurfaceToArcType(e){return e?ArcType$1.GEODESIC:ArcType$1.NONE}function processPolyline(e,t,i,r){var n=t.polyline;if(defined(n)){var a=intervalFromString(n.interval),o=e.polyline;if(defined(o)||(e.polyline=o=new PolylineGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPositionArray(o,"positions",n.positions,i),processPacketData(Number,o,"width",n.width,a,r,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processMaterialPacketData(o,"depthFailMaterial",n.depthFailMaterial,a,r,i),processPacketData(ArcType$1,o,"arcType",n.arcType,a,r,i),processPacketData(Boolean,o,"clampToGround",n.clampToGround,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(ClassificationType$1,o,"classificationType",n.classificationType,a,r,i),processPacketData(Number,o,"zIndex",n.zIndex,a,r,i),defined(n.followSurface)&&!defined(n.arcType)){var s={};processPacketData(Boolean,s,"followSurface",n.followSurface,a,r,i),o.arcType=createAdapterProperty(s.followSurface,adaptFollowSurfaceToArcType)}}}function processPolylineVolume(e,t,i,r){var n=t.polylineVolume;if(defined(n)){var a=intervalFromString(n.interval),o=e.polylineVolume;defined(o)||(e.polylineVolume=o=new PolylineVolumeGraphics),processPositionArray(o,"positions",n.positions,i),processShape(o,"shape",n.shape,i),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(CornerType$1,o,"cornerType",n.cornerType,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i)}}function processRectangle(e,t,i,r){var n=t.rectangle;if(defined(n)){var a=intervalFromString(n.interval),o=e.rectangle;defined(o)||(e.rectangle=o=new RectangleGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Rectangle,o,"coordinates",n.coordinates,a,r,i),processPacketData(Number,o,"height",n.height,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Number,o,"extrudedHeight",n.extrudedHeight,a,r,i),processPacketData(HeightReference$1,o,"extrudedHeightReference",n.extrudedHeightReference,a,r,i),processPacketData(Rotation,o,"rotation",n.rotation,a,r,i),processPacketData(Rotation,o,"stRotation",n.stRotation,a,r,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(ClassificationType$1,o,"classificationType",n.classificationType,a,r,i),processPacketData(Number,o,"zIndex",n.zIndex,a,r,i)}}function processTileset(e,t,i,r){var n=t.tileset;if(defined(n)){var a=intervalFromString(n.interval),o=e.tileset;defined(o)||(e.tileset=o=new Cesium3DTilesetGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(URI,o,"uri",n.uri,a,r,i),processPacketData(Number,o,"maximumScreenSpaceError",n.maximumScreenSpaceError,a,r,i)}}function processWall(e,t,i,r){var n=t.wall;if(defined(n)){var a=intervalFromString(n.interval),o=e.wall;defined(o)||(e.wall=o=new WallGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPositionArray(o,"positions",n.positions,i),processArray(o,"minimumHeights",n.minimumHeights,i),processArray(o,"maximumHeights",n.maximumHeights,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i)}}function processCzmlPacket(e,t,i,r,n){var a=e.id;if(defined(a)||(a=createGuid()),currentId=a,!defined(n._version)&&"document"!==a)throw new RuntimeError("The first CZML packet is required to be the document object.");if(!0===e.delete)t.removeById(a);else if("document"===a)processDocument$1(e,n);else{var o=t.getOrCreateEntity(a),s=e.parent;defined(s)&&(o.parent=t.getOrCreateEntity(s));for(var l=i.length-1;l>-1;l--)i[l](o,e,t,r)}currentId=void 0}function updateClock(e){var t,i=e._documentPacket.clock;if(!defined(i)){if(!defined(e._clock)){var r=e._entityCollection.computeAvailability();if(!r.start.equals(Iso8601.MINIMUM_VALUE)){var n=r.start,a=r.stop,o=JulianDate.secondsDifference(a,n),s=Math.round(o/120);return(t=new DataSourceClock).startTime=JulianDate.clone(n),t.stopTime=JulianDate.clone(a),t.clockRange=ClockRange$1.LOOP_STOP,t.multiplier=s,t.currentTime=JulianDate.clone(n),t.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,e._clock=t,!0}}return!1}defined(e._clock)?t=e._clock.clone():((t=new DataSourceClock).startTime=Iso8601.MINIMUM_VALUE.clone(),t.stopTime=Iso8601.MAXIMUM_VALUE.clone(),t.currentTime=Iso8601.MINIMUM_VALUE.clone(),t.clockRange=ClockRange$1.LOOP_STOP,t.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,t.multiplier=1);var l=intervalFromString(i.interval);return defined(l)&&(t.startTime=l.start,t.stopTime=l.stop),defined(i.currentTime)&&(t.currentTime=JulianDate.fromIso8601(i.currentTime)),defined(i.range)&&(t.clockRange=defaultValue(ClockRange$1[i.range],ClockRange$1.LOOP_STOP)),defined(i.step)&&(t.clockStep=defaultValue(ClockStep$1[i.step],ClockStep$1.SYSTEM_CLOCK_MULTIPLIER)),defined(i.multiplier)&&(t.multiplier=i.multiplier),!t.equals(e._clock)&&(e._clock=t.clone(e._clock),!0)}function load$2(e,t,i,r){var n=t,a=(i=defaultValue(i,defaultValue.EMPTY_OBJECT)).sourceUri,o=i.credit;if("string"==typeof o&&(o=new Credit(o)),e._credit=o,"string"==typeof t||t instanceof Resource){n=(t=Resource.createIfNeeded(t)).fetchJson(),a=defaultValue(a,t.clone());var s=e._resourceCredits,l=t.credits;if(defined(l))for(var c=l.length,u=0;u<c;u++)s.push(l[u])}return a=Resource.createIfNeeded(a),DataSource.setLoading(e,!0),when(n,(function(t){return loadCzml(e,t,a,r)})).otherwise((function(t){return DataSource.setLoading(e,!1),e._error.raiseEvent(e,t),console.log(t),when.reject(t)}))}function loadCzml(e,t,i,r){DataSource.setLoading(e,!0);var n=e._entityCollection;r&&(e._version=void 0,e._documentPacket=new DocumentPacket,n.removeAll()),CzmlDataSource._processCzml(t,n,i,void 0,e);var a=updateClock(e),o=e._documentPacket;return defined(o.name)&&e._name!==o.name?(e._name=o.name,a=!0):!defined(e._name)&&defined(i)&&(e._name=getFilenameFromUri(i.getUrlComponent()),a=!0),DataSource.setLoading(e,!1),a&&e._changed.raiseEvent(e),e}function DocumentPacket(){this.name=void 0,this.clock=void 0}function CzmlDataSource(e){this._name=e,this._changed=new Event,this._error=new Event,this._isLoading=!1,this._loading=new Event,this._clock=void 0,this._documentPacket=new DocumentPacket,this._version=void 0,this._entityCollection=new EntityCollection(this),this._entityCluster=new EntityCluster,this._credit=void 0,this._resourceCredits=[]}function DataSourceCollection(){this._dataSources=[],this._dataSourceAdded=new Event,this._dataSourceRemoved=new Event,this._dataSourceMoved=new Event}function getIndex(e,t){return e.indexOf(t)}function swapDataSources(e,t,i){var r=e._dataSources,n=r.length-1;if((t=CesiumMath.clamp(t,0,n))!==(i=CesiumMath.clamp(i,0,n))){var a=r[t];r[t]=r[i],r[i]=a,e.dataSourceMoved.raiseEvent(a,i,t)}}function PrimitiveCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._primitives=[],this._guid=createGuid(),this._zIndex=void 0,this.show=defaultValue(e.show,!0),this.destroyPrimitives=defaultValue(e.destroyPrimitives,!0)}function getPrimitiveIndex(e,t){return e._primitives.indexOf(t)}function OrderedGroundPrimitiveCollection(){this._length=0,this._collections={},this._collectionsArray=[],this.show=!0}function DynamicGeometryBatch(e,t){this._primitives=e,this._orderedGroundPrimitives=t,this._dynamicUpdaters=new AssociativeArray}Object.defineProperties(PolygonHierarchyProperty.prototype,{isConstant:{get:function(){var e=this.polygon._positions,t=this.polygon._holes;return(!defined(e)||e.isConstant)&&(!defined(t)||t.isConstant)}},definitionChanged:{get:function(){return this._definitionChanged}}}),PolygonHierarchyProperty.prototype.getValue=function(e,t){var i,r;return defined(this.polygon._positions)&&(i=this.polygon._positions.getValue(e)),defined(this.polygon._holes)&&defined(r=this.polygon._holes.getValue(e))&&(r=r.map((function(e){return new PolygonHierarchy(e)}))),defined(t)?(t.positions=i,t.holes=r,t):new PolygonHierarchy(i,r)},PolygonHierarchyProperty.prototype.equals=function(e){return this===e||e instanceof PolygonHierarchyProperty&&Property.equals(this.polygon._positions,e.polygon._positions)&&Property.equals(this.polygon._holes,e.polygon._holes)},CzmlDataSource.load=function(e,t){return(new CzmlDataSource).load(e,t)},Object.defineProperties(CzmlDataSource.prototype,{name:{get:function(){return this._name}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}},credit:{get:function(){return this._credit}}}),CzmlDataSource.updaters=[processBillboard,processBox,processCorridor,processCylinder,processEllipse,processEllipsoid,processLabel,processModel,processName,processDescription$1,processPath,processPoint$2,processPolygon$2,processPolyline,processPolylineVolume,processProperties,processRectangle,processPosition,processTileset,processViewFrom,processWall,processOrientation,processAvailability],CzmlDataSource.prototype.process=function(e,t){return load$2(this,e,t,!1)},CzmlDataSource.prototype.load=function(e,t){return load$2(this,e,t,!0)},CzmlDataSource.prototype.update=function(e){return!0},CzmlDataSource.processPacketData=processPacketData,CzmlDataSource.processPositionPacketData=processPositionPacketData,CzmlDataSource.processMaterialPacketData=processMaterialPacketData,CzmlDataSource._processCzml=function(e,t,i,r,n){if(r=defaultValue(r,CzmlDataSource.updaters),Array.isArray(e))for(var a=0,o=e.length;a<o;++a)processCzmlPacket(e[a],t,r,i,n);else processCzmlPacket(e,t,r,i,n)},Object.defineProperties(DataSourceCollection.prototype,{length:{get:function(){return this._dataSources.length}},dataSourceAdded:{get:function(){return this._dataSourceAdded}},dataSourceRemoved:{get:function(){return this._dataSourceRemoved}},dataSourceMoved:{get:function(){return this._dataSourceMoved}}}),DataSourceCollection.prototype.add=function(e){var t=this,i=this._dataSources;return when(e,(function(e){return i===t._dataSources&&(t._dataSources.push(e),t._dataSourceAdded.raiseEvent(t,e)),e}))},DataSourceCollection.prototype.remove=function(e,t){t=defaultValue(t,!1);var i=this._dataSources.indexOf(e);return-1!==i&&(this._dataSources.splice(i,1),this._dataSourceRemoved.raiseEvent(this,e),t&&"function"==typeof e.destroy&&e.destroy(),!0)},DataSourceCollection.prototype.removeAll=function(e){e=defaultValue(e,!1);for(var t=this._dataSources,i=0,r=t.length;i<r;++i){var n=t[i];this._dataSourceRemoved.raiseEvent(this,n),e&&"function"==typeof n.destroy&&n.destroy()}this._dataSources=[]},DataSourceCollection.prototype.contains=function(e){return-1!==this.indexOf(e)},DataSourceCollection.prototype.indexOf=function(e){return this._dataSources.indexOf(e)},DataSourceCollection.prototype.get=function(e){return this._dataSources[e]},DataSourceCollection.prototype.getByName=function(e){return this._dataSources.filter((function(t){return t.name===e}))},DataSourceCollection.prototype.raise=function(e){var t=getIndex(this._dataSources,e);swapDataSources(this,t,t+1)},DataSourceCollection.prototype.lower=function(e){var t=getIndex(this._dataSources,e);swapDataSources(this,t,t-1)},DataSourceCollection.prototype.raiseToTop=function(e){var t=getIndex(this._dataSources,e);t!==this._dataSources.length-1&&(this._dataSources.splice(t,1),this._dataSources.push(e),this.dataSourceMoved.raiseEvent(e,this._dataSources.length-1,t))},DataSourceCollection.prototype.lowerToBottom=function(e){var t=getIndex(this._dataSources,e);0!==t&&(this._dataSources.splice(t,1),this._dataSources.splice(0,0,e),this.dataSourceMoved.raiseEvent(e,0,t))},DataSourceCollection.prototype.isDestroyed=function(){return!1},DataSourceCollection.prototype.destroy=function(){return this.removeAll(!0),destroyObject(this)},Object.defineProperties(PrimitiveCollection.prototype,{length:{get:function(){return this._primitives.length}}}),PrimitiveCollection.prototype.add=function(e,t,i){t&&t instanceof TimeIntervalCollection?(e._availability=t,e.isAvailable=function(e){var t=this._availability;return!defined(t)||t.contains(e)}):t&&"number"==typeof t&&(i=t);var r=defined(i),n=e._external=e._external||{};return(n._composites=n._composites||{})[this._guid]={collection:this},r?this._primitives.splice(i,0,e):this._primitives.push(e),e},PrimitiveCollection.prototype.remove=function(e){if(this.contains(e)){var t=this._primitives.indexOf(e);if(-1!==t)return this._primitives.splice(t,1),delete e._external._composites[this._guid],this.destroyPrimitives&&e.destroy(),!0}return!1},PrimitiveCollection.prototype.removeAndDestroy=function(e){var t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t},PrimitiveCollection.prototype.removeAll=function(){for(var e=this._primitives,t=e.length,i=0;i<t;++i)delete e[i]._external._composites[this._guid],this.destroyPrimitives&&e[i].destroy();this._primitives=[]},PrimitiveCollection.prototype.contains=function(e){return!!(defined(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])},PrimitiveCollection.prototype.raise=function(e){if(defined(e)){var t=getPrimitiveIndex(this,e),i=this._primitives;if(t!==i.length-1){var r=i[t];i[t]=i[t+1],i[t+1]=r}}},PrimitiveCollection.prototype.raiseToTop=function(e){if(defined(e)){var t=getPrimitiveIndex(this,e),i=this._primitives;t!==i.length-1&&(i.splice(t,1),i.push(e))}},PrimitiveCollection.prototype.lower=function(e){if(defined(e)){var t=getPrimitiveIndex(this,e),i=this._primitives;if(0!==t){var r=i[t];i[t]=i[t-1],i[t-1]=r}}},PrimitiveCollection.prototype.lowerToBottom=function(e){if(defined(e)){var t=getPrimitiveIndex(this,e),i=this._primitives;0!==t&&(i.splice(t,1),i.unshift(e))}},PrimitiveCollection.prototype.get=function(e){return this._primitives[e]},PrimitiveCollection.prototype.update=function(e){if(this.show)for(var t=this._primitives,i=0;i<t.length;++i)t[i]&&t[i]._availability&&(t[i].show=t[i].isAvailable(e.time)),t[i].update(e)},PrimitiveCollection.prototype.prePassesUpdate=function(e){for(var t=this._primitives,i=0;i<t.length;++i){var r=t[i];defined(r.prePassesUpdate)&&r.prePassesUpdate(e)}},PrimitiveCollection.prototype.updateForPass=function(e,t){for(var i=this._primitives,r=0;r<i.length;++r){var n=i[r];defined(n.updateForPass)&&n.updateForPass(e,t)}},PrimitiveCollection.prototype.postPassesUpdate=function(e){for(var t=this._primitives,i=0;i<t.length;++i){var r=t[i];defined(r.postPassesUpdate)&&r.postPassesUpdate(e)}},PrimitiveCollection.prototype.isDestroyed=function(){return!1},PrimitiveCollection.prototype.destroy=function(){return this.removeAll(),destroyObject(this)},Object.defineProperties(OrderedGroundPrimitiveCollection.prototype,{length:{get:function(){return this._length}}}),OrderedGroundPrimitiveCollection.prototype.add=function(e,t){t=defaultValue(t,0);var i=this._collections[t];if(!defined(i)){(i=new PrimitiveCollection({destroyPrimitives:!1}))._zIndex=t,this._collections[t]=i;for(var r=this._collectionsArray,n=0;n<r.length&&r[n]._zIndex<t;)n++;r.splice(n,0,i)}return i.add(e),this._length++,e._zIndex=t,e},OrderedGroundPrimitiveCollection.prototype.set=function(e,t){return t===e._zIndex||(this.remove(e,!0),this.add(e,t)),e},OrderedGroundPrimitiveCollection.prototype.remove=function(e,t){if(this.contains(e)){var i,r=e._zIndex,n=this._collections[r];return(i=t?n.remove(e):n.removeAndDestroy(e))&&this._length--,0===n.length&&(this._collectionsArray.splice(this._collectionsArray.indexOf(n),1),this._collections[r]=void 0,n.destroy()),i}return!1},OrderedGroundPrimitiveCollection.prototype.removeAll=function(){for(var e=this._collectionsArray,t=0;t<e.length;t++){var i=e[t];i.destroyPrimitives=!0,i.destroy()}this._collections={},this._collectionsArray=[],this._length=0},OrderedGroundPrimitiveCollection.prototype.contains=function(e){if(!defined(e))return!1;var t=this._collections[e._zIndex];return defined(t)&&t.contains(e)},OrderedGroundPrimitiveCollection.prototype.update=function(e){if(this.show)for(var t=this._collectionsArray,i=0;i<t.length;i++)t[i].update(e)},OrderedGroundPrimitiveCollection.prototype.isDestroyed=function(){return!1},OrderedGroundPrimitiveCollection.prototype.destroy=function(){return this.removeAll(),destroyObject(this)},DynamicGeometryBatch.prototype.add=function(e,t){this._dynamicUpdaters.set(t.id,t.createDynamicUpdater(this._primitives,this._orderedGroundPrimitives))},DynamicGeometryBatch.prototype.remove=function(e){var t=e.id,i=this._dynamicUpdaters.get(t);defined(i)&&(this._dynamicUpdaters.remove(t),i.destroy())},DynamicGeometryBatch.prototype.update=function(e){for(var t=this._dynamicUpdaters.values,i=0,r=t.length;i<r;i++)t[i].update(e);return!0},DynamicGeometryBatch.prototype.removeAllPrimitives=function(){for(var e=this._dynamicUpdaters.values,t=0,i=e.length;t<i;t++)e[t].destroy();this._dynamicUpdaters.removeAll()},DynamicGeometryBatch.prototype.getBoundingSphere=function(e,t){return defined(e=this._dynamicUpdaters.get(e.id))&&defined(e.getBoundingSphere)?e.getBoundingSphere(t):BoundingSphereState$1.FAILED};var scratchColor$b=new Color,defaultOffset$6=Cartesian3.ZERO,offsetScratch$6=new Cartesian3,scratchRectangle$3=new Rectangle;function EllipseGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.center=void 0,this.semiMajorAxis=void 0,this.semiMinorAxis=void 0,this.rotation=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.numberOfVerticalLines=void 0,this.offsetAttribute=void 0}function EllipseGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new EllipseGeometryOptions(e),geometryPropertyName:"ellipse",observedPropertyNames:["availability","position","ellipse"]}),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}function DynamicEllipseGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}defined(Object.create)&&(EllipseGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),EllipseGeometryUpdater.prototype.constructor=EllipseGeometryUpdater),EllipseGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n={show:new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$b)),defined(t)||(t=Color.WHITE),n.color=ColorGeometryInstanceAttribute.fromColor(t));return defined(this._options.offsetAttribute)&&(n.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$6,offsetScratch$6))),new GeometryInstance({id:i,geometry:new EllipseGeometry(this._options),attributes:n})},EllipseGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$b),n=this._distanceDisplayConditionProperty.getValue(e),a={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n),offset:void 0};return defined(this._options.offsetAttribute)&&(a.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$6,offsetScratch$6))),new GeometryInstance({id:t,geometry:new EllipseOutlineGeometry(this._options),attributes:a})},EllipseGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},EllipseGeometryUpdater.prototype._isHidden=function(e,t){return!defined(e.position)||!defined(t.semiMajorAxis)||!defined(t.semiMinorAxis)||GeometryUpdater.prototype._isHidden.call(this,e,t)},EllipseGeometryUpdater.prototype._isDynamic=function(e,t){return!e.position.isConstant||!t.semiMajorAxis.isConstant||!t.semiMinorAxis.isConstant||!Property.isConstant(t.rotation)||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.stRotation)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.numberOfVerticalLines)||!Property.isConstant(t.zIndex)||this._onTerrain&&!Property.isConstant(this._materialProperty)&&!(this._materialProperty instanceof ColorMaterialProperty)},EllipseGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE),r=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),n=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE),a=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);defined(n)&&!defined(i)&&(i=0);var o=this._options;o.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,o.center=e.position.getValue(Iso8601.MINIMUM_VALUE,o.center),o.semiMajorAxis=t.semiMajorAxis.getValue(Iso8601.MINIMUM_VALUE,o.semiMajorAxis),o.semiMinorAxis=t.semiMinorAxis.getValue(Iso8601.MINIMUM_VALUE,o.semiMinorAxis),o.rotation=Property.getValueOrUndefined(t.rotation,Iso8601.MINIMUM_VALUE),o.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),o.stRotation=Property.getValueOrUndefined(t.stRotation,Iso8601.MINIMUM_VALUE),o.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,Iso8601.MINIMUM_VALUE),o.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(i,r,n,a),o.height=GroundGeometryUpdater.getGeometryHeight(i,r),(n=GroundGeometryUpdater.getGeometryExtrudedHeight(n,a))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(n=ApproximateTerrainHeights.getMinimumMaximumHeights(EllipseGeometry.computeRectangle(o,scratchRectangle$3)).minimumTerrainHeight),o.extrudedHeight=n},EllipseGeometryUpdater.DynamicGeometryUpdater=DynamicEllipseGeometryUpdater,defined(Object.create)&&(DynamicEllipseGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicEllipseGeometryUpdater.prototype.constructor=DynamicEllipseGeometryUpdater),DynamicEllipseGeometryUpdater.prototype._isHidden=function(e,t,i){var r=this._options;return!defined(r.center)||!defined(r.semiMajorAxis)||!defined(r.semiMinorAxis)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicEllipseGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options,n=Property.getValueOrUndefined(t.height,i),a=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),o=Property.getValueOrUndefined(t.extrudedHeight,i),s=Property.getValueOrDefault(t.extrudedHeightReference,i,HeightReference$1.NONE);defined(o)&&!defined(n)&&(n=0),r.center=Property.getValueOrUndefined(e.position,i,r.center),r.semiMajorAxis=Property.getValueOrUndefined(t.semiMajorAxis,i),r.semiMinorAxis=Property.getValueOrUndefined(t.semiMinorAxis,i),r.rotation=Property.getValueOrUndefined(t.rotation,i),r.granularity=Property.getValueOrUndefined(t.granularity,i),r.stRotation=Property.getValueOrUndefined(t.stRotation,i),r.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,i),r.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(n,a,o,s),r.height=GroundGeometryUpdater.getGeometryHeight(n,a),(o=GroundGeometryUpdater.getGeometryExtrudedHeight(o,s))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(o=ApproximateTerrainHeights.getMinimumMaximumHeights(EllipseGeometry.computeRectangle(r,scratchRectangle$3)).minimumTerrainHeight),r.extrudedHeight=o};var defaultMaterial$1=new ColorMaterialProperty(Color.WHITE),defaultOffset$5=Cartesian3.ZERO,offsetScratch$5=new Cartesian3,radiiScratch=new Cartesian3,innerRadiiScratch=new Cartesian3,scratchColor$a=new Color,unitSphere=new Cartesian3(1,1,1);function EllipsoidGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.radii=void 0,this.innerRadii=void 0,this.minimumClock=void 0,this.maximumClock=void 0,this.minimumCone=void 0,this.maximumCone=void 0,this.stackPartitions=void 0,this.slicePartitions=void 0,this.subdivisions=void 0,this.offsetAttribute=void 0}function EllipsoidGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new EllipsoidGeometryOptions(e),geometryPropertyName:"ellipsoid",observedPropertyNames:["availability","position","orientation","ellipsoid"]}),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}function DynamicEllipsoidGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i),this._scene=e._scene,this._modelMatrix=new Matrix4,this._attributes=void 0,this._outlineAttributes=void 0,this._lastSceneMode=void 0,this._lastShow=void 0,this._lastOutlineShow=void 0,this._lastOutlineWidth=void 0,this._lastOutlineColor=void 0,this._lastOffset=new Cartesian3,this._material={}}defined(Object.create)&&(EllipsoidGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),EllipsoidGeometryUpdater.prototype.constructor=EllipsoidGeometryUpdater),Object.defineProperties(EllipsoidGeometryUpdater.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),EllipsoidGeometryUpdater.prototype.createFillGeometryInstance=function(e,t,i){var r,n,a=this._entity,o=a.isAvailable(e),s=new ShowGeometryInstanceAttribute(o&&a.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),l=this._distanceDisplayConditionProperty.getValue(e),c={show:s,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(l),color:void 0,offset:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||o)&&(n=this._materialProperty.color.getValue(e,scratchColor$a)),defined(n)||(n=Color.WHITE),r=ColorGeometryInstanceAttribute.fromColor(n),c.color=r);return defined(this._options.offsetAttribute)&&(c.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$5,offsetScratch$5))),new GeometryInstance({id:a,geometry:new EllipsoidGeometry(this._options),modelMatrix:t?void 0:a.computeModelMatrixForHeightReference(e,a.ellipsoid.heightReference,.5*this._options.radii.z,this._scene.mapProjection.ellipsoid,i),attributes:c})},EllipsoidGeometryUpdater.prototype.createOutlineGeometryInstance=function(e,t,i){var r=this._entity,n=r.isAvailable(e),a=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$a),o=this._distanceDisplayConditionProperty.getValue(e),s={show:new ShowGeometryInstanceAttribute(n&&r.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(a),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(o),offset:void 0};return defined(this._options.offsetAttribute)&&(s.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$5,offsetScratch$5))),new GeometryInstance({id:r,geometry:new EllipsoidOutlineGeometry(this._options),modelMatrix:t?void 0:r.computeModelMatrixForHeightReference(e,r.ellipsoid.heightReference,.5*this._options.radii.z,this._scene.mapProjection.ellipsoid,i),attributes:s})},EllipsoidGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},EllipsoidGeometryUpdater.prototype._isHidden=function(e,t){return!defined(e.position)||!defined(t.radii)||GeometryUpdater.prototype._isHidden.call(this,e,t)},EllipsoidGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.radii.isConstant&&Property.isConstant(t.innerRadii)&&Property.isConstant(t.stackPartitions)&&Property.isConstant(t.slicePartitions)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.minimumClock)&&Property.isConstant(t.maximumClock)&&Property.isConstant(t.minimumCone)&&Property.isConstant(t.maximumCone)&&Property.isConstant(t.subdivisions))},EllipsoidGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),r=this._options;r.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,r.radii=t.radii.getValue(Iso8601.MINIMUM_VALUE,r.radii),r.innerRadii=Property.getValueOrUndefined(t.innerRadii,r.radii),r.minimumClock=Property.getValueOrUndefined(t.minimumClock,Iso8601.MINIMUM_VALUE),r.maximumClock=Property.getValueOrUndefined(t.maximumClock,Iso8601.MINIMUM_VALUE),r.minimumCone=Property.getValueOrUndefined(t.minimumCone,Iso8601.MINIMUM_VALUE),r.maximumCone=Property.getValueOrUndefined(t.maximumCone,Iso8601.MINIMUM_VALUE),r.stackPartitions=Property.getValueOrUndefined(t.stackPartitions,Iso8601.MINIMUM_VALUE),r.slicePartitions=Property.getValueOrUndefined(t.slicePartitions,Iso8601.MINIMUM_VALUE),r.subdivisions=Property.getValueOrUndefined(t.subdivisions,Iso8601.MINIMUM_VALUE),r.offsetAttribute=i!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},EllipsoidGeometryUpdater.prototype._onEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,EllipsoidGeometryUpdater.DynamicGeometryUpdater=DynamicEllipsoidGeometryUpdater,defined(Object.create)&&(DynamicEllipsoidGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicEllipsoidGeometryUpdater.prototype.constructor=DynamicEllipsoidGeometryUpdater),DynamicEllipsoidGeometryUpdater.prototype.update=function(e){var t=this._entity,i=t.ellipsoid;if(!t.isShowing||!t.isAvailable(e)||!Property.getValueOrDefault(i.show,e,!0))return defined(this._primitive)&&(this._primitive.show=!1),void(defined(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));var r=Property.getValueOrUndefined(i.radii,e,radiiScratch),n=defined(r)?t.computeModelMatrixForHeightReference(e,i.heightReference,.5*r.z,this._scene.mapProjection.ellipsoid,this._modelMatrix):void 0;if(!defined(n)||!defined(r))return defined(this._primitive)&&(this._primitive.show=!1),void(defined(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));var a=Property.getValueOrDefault(i.fill,e,!0),o=Property.getValueOrDefault(i.outline,e,!1),s=Property.getValueOrClonedDefault(i.outlineColor,e,Color.BLACK,scratchColor$a),l=MaterialProperty.getValue(e,defaultValue(i.material,defaultMaterial$1),this._material),c=Property.getValueOrUndefined(i.innerRadii,e,innerRadiiScratch),u=Property.getValueOrUndefined(i.minimumClock,e),d=Property.getValueOrUndefined(i.maximumClock,e),h=Property.getValueOrUndefined(i.minimumCone,e),p=Property.getValueOrUndefined(i.maximumCone,e),f=Property.getValueOrUndefined(i.stackPartitions,e),m=Property.getValueOrUndefined(i.slicePartitions,e),g=Property.getValueOrUndefined(i.subdivisions,e),_=Property.getValueOrDefault(i.outlineWidth,e,1),y=Property.getValueOrDefault(i.heightReference,e,HeightReference$1.NONE),v=y!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0,C=this._scene.mode,T=C===SceneMode$1.SCENE3D&&y===HeightReference$1.NONE,S=this._options,A=this._geometryUpdater.shadowsProperty.getValue(e),x=this._geometryUpdater.distanceDisplayConditionProperty.getValue(e),E=Property.getValueOrDefault(this._geometryUpdater.terrainOffsetProperty,e,defaultOffset$5,offsetScratch$5);if(!T||this._lastSceneMode!==C||!defined(this._primitive)||S.stackPartitions!==f||S.slicePartitions!==m||defined(c)&&!Cartesian3.equals(S.innerRadii!==c)||S.minimumClock!==u||S.maximumClock!==d||S.minimumCone!==h||S.maximumCone!==p||S.subdivisions!==g||this._lastOutlineWidth!==_||S.offsetAttribute!==v){var b=this._primitives;if(b.removeAndDestroy(this._primitive),b.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=C,this._lastOutlineWidth=_,S.stackPartitions=f,S.slicePartitions=m,S.subdivisions=g,S.offsetAttribute=v,S.radii=Cartesian3.clone(T?unitSphere:r,S.radii),defined(c))if(T){var P=Cartesian3.magnitude(r);S.innerRadii=Cartesian3.fromElements(c.x/P,c.y/P,c.z/P,S.innerRadii)}else S.innerRadii=Cartesian3.clone(c,S.innerRadii);else S.innerRadii=void 0;S.minimumClock=u,S.maximumClock=d,S.minimumCone=h,S.maximumCone=p;var D=new MaterialAppearance({material:l,translucent:l.isTranslucent(),closed:!0});S.vertexFormat=D.vertexFormat;var w=this._geometryUpdater.createFillGeometryInstance(e,T,this._modelMatrix);this._primitive=b.add(new Primitive$2({geometryInstances:w,appearance:D,asynchronous:!1,shadows:A}));var M=this._geometryUpdater.createOutlineGeometryInstance(e,T,this._modelMatrix);this._outlinePrimitive=b.add(new Primitive$2({geometryInstances:M,appearance:new PerInstanceColorAppearance({flat:!0,translucent:255!==M.attributes.color.value[3],renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(_)}}),asynchronous:!1,shadows:A})),this._lastShow=a,this._lastOutlineShow=o,this._lastOutlineColor=Color.clone(s,this._lastOutlineColor),this._lastDistanceDisplayCondition=x,this._lastOffset=Cartesian3.clone(E,this._lastOffset)}else if(this._primitive.ready){var I=this._primitive,R=this._outlinePrimitive;I.show=!0,R.show=!0,I.appearance.material=l;var O=this._attributes;defined(O)||(O=I.getGeometryInstanceAttributes(t),this._attributes=O),a!==this._lastShow&&(O.show=ShowGeometryInstanceAttribute.toValue(a,O.show),this._lastShow=a);var B=this._outlineAttributes;defined(B)||(B=R.getGeometryInstanceAttributes(t),this._outlineAttributes=B),o!==this._lastOutlineShow&&(B.show=ShowGeometryInstanceAttribute.toValue(o,B.show),this._lastOutlineShow=o),Color.equals(s,this._lastOutlineColor)||(B.color=ColorGeometryInstanceAttribute.toValue(s,B.color),Color.clone(s,this._lastOutlineColor)),DistanceDisplayCondition.equals(x,this._lastDistanceDisplayCondition)||(O.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(x,O.distanceDisplayCondition),B.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(x,B.distanceDisplayCondition),DistanceDisplayCondition.clone(x,this._lastDistanceDisplayCondition)),Cartesian3.equals(E,this._lastOffset)||(O.offset=OffsetGeometryInstanceAttribute.toValue(E,O.offset),B.offset=OffsetGeometryInstanceAttribute.toValue(E,O.offset),Cartesian3.clone(E,this._lastOffset))}T&&(r.x=Math.max(r.x,.001),r.y=Math.max(r.y,.001),r.z=Math.max(r.z,.001),n=Matrix4.multiplyByScale(n,r,n),this._primitive.modelMatrix=n,this._outlinePrimitive.modelMatrix=n)};var positionScratch$2=new Cartesian3,scratchColor$9=new Color;function PlaneGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.plane=void 0,this.dimensions=void 0}function PlaneGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new PlaneGeometryOptions(e),geometryPropertyName:"plane",observedPropertyNames:["availability","position","orientation","plane"]}),this._onEntityPropertyChanged(e,"plane",e.plane,void 0)}function DynamicPlaneGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}defined(Object.create)&&(PlaneGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),PlaneGeometryUpdater.prototype.constructor=PlaneGeometryUpdater),PlaneGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i,r=this._entity,n=r.isAvailable(e),a=new ShowGeometryInstanceAttribute(n&&r.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),s=DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(o);this._materialProperty instanceof ColorMaterialProperty?(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(i=this._materialProperty.color.getValue(e,scratchColor$9)),defined(i)||(i=Color.WHITE),t={show:a,distanceDisplayCondition:s,color:ColorGeometryInstanceAttribute.fromColor(i)}):t={show:a,distanceDisplayCondition:s};var l=r.plane,c=this._options,u=r.computeModelMatrix(e),d=Property.getValueOrDefault(l.plane,e,c.plane),h=Property.getValueOrUndefined(l.dimensions,e,c.dimensions);return c.plane=d,c.dimensions=h,u=createPrimitiveMatrix(d,h,u,u),new GeometryInstance({id:r,geometry:new PlaneGeometry(this._options),modelMatrix:u,attributes:t})},PlaneGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$9),n=this._distanceDisplayConditionProperty.getValue(e),a=t.plane,o=this._options,s=t.computeModelMatrix(e),l=Property.getValueOrDefault(a.plane,e,o.plane),c=Property.getValueOrUndefined(a.dimensions,e,o.dimensions);return o.plane=l,o.dimensions=c,s=createPrimitiveMatrix(l,c,s,s),new GeometryInstance({id:t,geometry:new PlaneOutlineGeometry,modelMatrix:s,attributes:{show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n)}})},PlaneGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.plane)||!defined(t.dimensions)||!defined(e.position)||GeometryUpdater.prototype._isHidden.call(this,e,t)},PlaneGeometryUpdater.prototype._getIsClosed=function(e){return!1},PlaneGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.plane.isConstant&&t.dimensions.isConstant&&Property.isConstant(t.outlineWidth))},PlaneGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=this._materialProperty instanceof ColorMaterialProperty,r=this._options;r.vertexFormat=i?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,r.plane=t.plane.getValue(Iso8601.MINIMUM_VALUE,r.plane),r.dimensions=t.dimensions.getValue(Iso8601.MINIMUM_VALUE,r.dimensions)},PlaneGeometryUpdater.DynamicGeometryUpdater=DynamicPlaneGeometryUpdater,defined(Object.create)&&(DynamicPlaneGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicPlaneGeometryUpdater.prototype.constructor=DynamicPlaneGeometryUpdater),DynamicPlaneGeometryUpdater.prototype._isHidden=function(e,t,i){var r=this._options;return!defined(Property.getValueOrUndefined(e.position,i,positionScratch$2))||!defined(r.plane)||!defined(r.dimensions)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicPlaneGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options;r.plane=Property.getValueOrDefault(t.plane,i,r.plane),r.dimensions=Property.getValueOrUndefined(t.dimensions,i,r.dimensions)};var scratchAxis=new Cartesian3,scratchUp$2=new Cartesian3,scratchTranslation$1=new Cartesian3,scratchScale$1=new Cartesian3,scratchRotation$1=new Matrix3,scratchRotationScale=new Matrix3,scratchLocalTransform=new Matrix4;function createPrimitiveMatrix(e,t,i,r){var n=e.normal,a=e.distance,o=Cartesian3.multiplyByScalar(n,-a,scratchTranslation$1),s=Cartesian3.clone(Cartesian3.UNIT_Z,scratchUp$2);CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(s,n)),1,CesiumMath.EPSILON8)&&(s=Cartesian3.clone(Cartesian3.UNIT_Y,s));var l=Cartesian3.cross(s,n,scratchAxis);s=Cartesian3.cross(n,l,s),Cartesian3.normalize(l,l),Cartesian3.normalize(s,s);var c=scratchRotation$1;Matrix3.setColumn(c,0,l,c),Matrix3.setColumn(c,1,s,c),Matrix3.setColumn(c,2,n,c);var u=Cartesian3.fromElements(t.x,t.y,1,scratchScale$1),d=Matrix3.multiplyByScale(c,u,scratchRotationScale),h=Matrix4.fromRotationTranslation(d,o,scratchLocalTransform);return Matrix4.multiplyTransformation(i,h,r)}PlaneGeometryUpdater.createPrimitiveMatrix=createPrimitiveMatrix;var heightAndPerPositionHeightWarning="Entity polygons cannot have both height and perPositionHeight. height will be ignored",heightReferenceAndPerPositionHeightWarning="heightReference is not supported for entity polygons with perPositionHeight. heightReference will be ignored",scratchColor$8=new Color,defaultOffset$4=Cartesian3.ZERO,offsetScratch$4=new Cartesian3,scratchRectangle$2=new Rectangle,scratch2DPositions=[],cart2Scratch=new Cartesian2;function PolygonGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.polygonHierarchy=void 0,this.perPositionHeight=void 0,this.closeTop=void 0,this.closeBottom=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.offsetAttribute=void 0,this.arcType=void 0}function PolygonGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new PolygonGeometryOptions(e),geometryPropertyName:"polygon",observedPropertyNames:["availability","polygon"]}),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}function DyanmicPolygonGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}defined(Object.create)&&(PolygonGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),PolygonGeometryUpdater.prototype.constructor=PolygonGeometryUpdater),PolygonGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n=this._options,a={show:new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$8)),defined(t)||(t=Color.WHITE),a.color=ColorGeometryInstanceAttribute.fromColor(t));return defined(n.offsetAttribute)&&(a.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$4,offsetScratch$4))),new GeometryInstance({id:i,geometry:n.perPositionHeight&&!defined(n.extrudedHeight)?new CoplanarPolygonGeometry(n):new PolygonGeometry(n),attributes:a})},PolygonGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=this._options,n=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$8),a=this._distanceDisplayConditionProperty.getValue(e),o={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(n),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a),offset:void 0};return defined(r.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$4,offsetScratch$4))),new GeometryInstance({id:t,geometry:r.perPositionHeight&&!defined(r.extrudedHeight)?new CoplanarPolygonOutlineGeometry(r):new PolygonOutlineGeometry(r),attributes:o})},PolygonGeometryUpdater.prototype._computeCenter=function(e,t){var i=Property.getValueOrUndefined(this._entity.polygon.hierarchy,e);if(defined(i)){var r=i.positions;if(0!==r.length){for(var n=this._scene.mapProjection.ellipsoid,a=EllipsoidTangentPlane.fromPoints(r,n),o=a.projectPointsOntoPlane(r,scratch2DPositions),s=o.length,l=0,c=s-1,u=new Cartesian2,d=0;d<s;c=d++){var h=o[d],p=o[c],f=h.x*p.y-p.x*h.y,m=Cartesian2.add(h,p,cart2Scratch);m=Cartesian2.multiplyByScalar(m,f,m),u=Cartesian2.add(u,m,u),l+=f}var g=1/(3*l);return u=Cartesian2.multiplyByScalar(u,g,u),a.projectPointOntoEllipsoid(u,t)}}},PolygonGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.hierarchy)||GeometryUpdater.prototype._isHidden.call(this,e,t)},PolygonGeometryUpdater.prototype._isOnTerrain=function(e,t){var i=GroundGeometryUpdater.prototype._isOnTerrain.call(this,e,t),r=t.perPositionHeight,n=defined(r)&&(!r.isConstant||r.getValue(Iso8601.MINIMUM_VALUE));return i&&!n},PolygonGeometryUpdater.prototype._isDynamic=function(e,t){return!t.hierarchy.isConstant||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.stRotation)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.perPositionHeight)||!Property.isConstant(t.closeTop)||!Property.isConstant(t.closeBottom)||!Property.isConstant(t.zIndex)||!Property.isConstant(t.arcType)||this._onTerrain&&!Property.isConstant(this._materialProperty)&&!(this._materialProperty instanceof ColorMaterialProperty)},PolygonGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=this._materialProperty instanceof ColorMaterialProperty,r=this._options;r.vertexFormat=i?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat;var n,a=t.hierarchy.getValue(Iso8601.MINIMUM_VALUE),o=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE),s=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),l=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE),c=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),u=Property.getValueOrDefault(t.perPositionHeight,Iso8601.MINIMUM_VALUE,!1);o=GroundGeometryUpdater.getGeometryHeight(o,s),u?(defined(o)&&(o=void 0,oneTimeWarning(heightAndPerPositionHeightWarning)),s!==HeightReference$1.NONE&&u&&(o=void 0,oneTimeWarning(heightReferenceAndPerPositionHeightWarning))):(defined(l)&&!defined(o)&&(o=0),n=GroundGeometryUpdater.computeGeometryOffsetAttribute(o,s,l,c)),r.polygonHierarchy=a,r.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),r.stRotation=Property.getValueOrUndefined(t.stRotation,Iso8601.MINIMUM_VALUE),r.perPositionHeight=u,r.closeTop=Property.getValueOrDefault(t.closeTop,Iso8601.MINIMUM_VALUE,!0),r.closeBottom=Property.getValueOrDefault(t.closeBottom,Iso8601.MINIMUM_VALUE,!0),r.offsetAttribute=n,r.height=o,r.arcType=Property.getValueOrDefault(t.arcType,Iso8601.MINIMUM_VALUE,ArcType$1.GEODESIC),(l=GroundGeometryUpdater.getGeometryExtrudedHeight(l,c))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(l=ApproximateTerrainHeights.getMinimumMaximumHeights(PolygonGeometry.computeRectangle(r,scratchRectangle$2)).minimumTerrainHeight),r.extrudedHeight=l},PolygonGeometryUpdater.prototype._getIsClosed=function(e){var t=e.height,i=e.extrudedHeight,r=defined(i)&&i!==t;return!e.perPositionHeight&&(!r&&0===t||r&&e.closeTop&&e.closeBottom)},PolygonGeometryUpdater.DynamicGeometryUpdater=DyanmicPolygonGeometryUpdater,defined(Object.create)&&(DyanmicPolygonGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DyanmicPolygonGeometryUpdater.prototype.constructor=DyanmicPolygonGeometryUpdater),DyanmicPolygonGeometryUpdater.prototype._isHidden=function(e,t,i){return!defined(this._options.polygonHierarchy)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DyanmicPolygonGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options;r.polygonHierarchy=Property.getValueOrUndefined(t.hierarchy,i);var n,a=Property.getValueOrUndefined(t.height,i),o=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),s=Property.getValueOrDefault(t.extrudedHeightReference,i,HeightReference$1.NONE),l=Property.getValueOrUndefined(t.extrudedHeight,i),c=Property.getValueOrUndefined(t.perPositionHeight,i);a=GroundGeometryUpdater.getGeometryHeight(a,s),c?(defined(a)&&(a=void 0,oneTimeWarning(heightAndPerPositionHeightWarning)),o!==HeightReference$1.NONE&&c&&(a=void 0,oneTimeWarning(heightReferenceAndPerPositionHeightWarning))):(defined(l)&&!defined(a)&&(a=0),n=GroundGeometryUpdater.computeGeometryOffsetAttribute(a,o,l,s)),r.granularity=Property.getValueOrUndefined(t.granularity,i),r.stRotation=Property.getValueOrUndefined(t.stRotation,i),r.perPositionHeight=Property.getValueOrUndefined(t.perPositionHeight,i),r.closeTop=Property.getValueOrDefault(t.closeTop,i,!0),r.closeBottom=Property.getValueOrDefault(t.closeBottom,i,!0),r.offsetAttribute=n,r.height=a,r.arcType=Property.getValueOrDefault(t.arcType,i,ArcType$1.GEODESIC),(l=GroundGeometryUpdater.getGeometryExtrudedHeight(l,s))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(l=ApproximateTerrainHeights.getMinimumMaximumHeights(PolygonGeometry.computeRectangle(r,scratchRectangle$2)).minimumTerrainHeight),r.extrudedHeight=l};var scratchColor$7=new Color;function PolylineVolumeGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.polylinePositions=void 0,this.shapePositions=void 0,this.cornerType=void 0,this.granularity=void 0}function PolylineVolumeGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new PolylineVolumeGeometryOptions(e),geometryPropertyName:"polylineVolume",observedPropertyNames:["availability","polylineVolume"]}),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}function DynamicPolylineVolumeGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}defined(Object.create)&&(PolylineVolumeGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),PolylineVolumeGeometryUpdater.prototype.constructor=PolylineVolumeGeometryUpdater),PolylineVolumeGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i,r=this._entity,n=r.isAvailable(e),a=new ShowGeometryInstanceAttribute(n&&r.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),s=DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(o);this._materialProperty instanceof ColorMaterialProperty?(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(i=this._materialProperty.color.getValue(e,scratchColor$7)),defined(i)||(i=Color.WHITE),t={show:a,distanceDisplayCondition:s,color:ColorGeometryInstanceAttribute.fromColor(i)}):t={show:a,distanceDisplayCondition:s};return new GeometryInstance({id:r,geometry:new PolylineVolumeGeometry(this._options),attributes:t})},PolylineVolumeGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$7),n=this._distanceDisplayConditionProperty.getValue(e);return new GeometryInstance({id:t,geometry:new PolylineVolumeOutlineGeometry(this._options),attributes:{show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n)}})},PolylineVolumeGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.positions)||!defined(t.shape)||GeometryUpdater.prototype._isHidden.call(this,e,t)},PolylineVolumeGeometryUpdater.prototype._isDynamic=function(e,t){return!(t.positions.isConstant&&t.shape.isConstant&&Property.isConstant(t.granularity)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.cornerType))},PolylineVolumeGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=t.granularity,r=t.cornerType,n=this._options,a=this._materialProperty instanceof ColorMaterialProperty;n.vertexFormat=a?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,n.polylinePositions=t.positions.getValue(Iso8601.MINIMUM_VALUE,n.polylinePositions),n.shapePositions=t.shape.getValue(Iso8601.MINIMUM_VALUE,n.shape),n.granularity=defined(i)?i.getValue(Iso8601.MINIMUM_VALUE):void 0,n.cornerType=defined(r)?r.getValue(Iso8601.MINIMUM_VALUE):void 0},PolylineVolumeGeometryUpdater.DynamicGeometryUpdater=DynamicPolylineVolumeGeometryUpdater,defined(Object.create)&&(DynamicPolylineVolumeGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicPolylineVolumeGeometryUpdater.prototype.constructor=DynamicPolylineVolumeGeometryUpdater),DynamicPolylineVolumeGeometryUpdater.prototype._isHidden=function(e,t,i){var r=this._options;return!defined(r.polylinePositions)||!defined(r.shapePositions)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicPolylineVolumeGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options;r.polylinePositions=Property.getValueOrUndefined(t.positions,i,r.polylinePositions),r.shapePositions=Property.getValueOrUndefined(t.shape,i),r.granularity=Property.getValueOrUndefined(t.granularity,i),r.cornerType=Property.getValueOrUndefined(t.cornerType,i)};var scratchColor$6=new Color,defaultOffset$3=Cartesian3.ZERO,offsetScratch$3=new Cartesian3,scratchRectangle$1=new Rectangle,scratchCenterRect=new Rectangle,scratchCarto=new Cartographic;function RectangleGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.rectangle=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.rotation=void 0,this.offsetAttribute=void 0}function RectangleGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new RectangleGeometryOptions(e),geometryPropertyName:"rectangle",observedPropertyNames:["availability","rectangle"]}),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}function DynamicRectangleGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}defined(Object.create)&&(RectangleGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),RectangleGeometryUpdater.prototype.constructor=RectangleGeometryUpdater),RectangleGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n={show:new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$6)),defined(t)||(t=Color.WHITE),n.color=ColorGeometryInstanceAttribute.fromColor(t));return defined(this._options.offsetAttribute)&&(n.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$3,offsetScratch$3))),new GeometryInstance({id:i,geometry:new RectangleGeometry(this._options),attributes:n})},RectangleGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$6),n=this._distanceDisplayConditionProperty.getValue(e),a={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n),offset:void 0};return defined(this._options.offsetAttribute)&&(a.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$3,offsetScratch$3))),new GeometryInstance({id:t,geometry:new RectangleOutlineGeometry(this._options),attributes:a})},RectangleGeometryUpdater.prototype._computeCenter=function(e,t){var i=Property.getValueOrUndefined(this._entity.rectangle.coordinates,e,scratchCenterRect);if(defined(i)){var r=Rectangle.center(i,scratchCarto);return Cartographic.toCartesian(r,Ellipsoid.WGS84,t)}},RectangleGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.coordinates)||GeometryUpdater.prototype._isHidden.call(this,e,t)},RectangleGeometryUpdater.prototype._isDynamic=function(e,t){return!t.coordinates.isConstant||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.stRotation)||!Property.isConstant(t.rotation)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.zIndex)||this._onTerrain&&!Property.isConstant(this._materialProperty)&&!(this._materialProperty instanceof ColorMaterialProperty)},RectangleGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=this._materialProperty instanceof ColorMaterialProperty,r=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE),n=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),a=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE),o=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);defined(a)&&!defined(r)&&(r=0);var s=this._options;s.vertexFormat=i?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,s.rectangle=t.coordinates.getValue(Iso8601.MINIMUM_VALUE,s.rectangle),s.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),s.stRotation=Property.getValueOrUndefined(t.stRotation,Iso8601.MINIMUM_VALUE),s.rotation=Property.getValueOrUndefined(t.rotation,Iso8601.MINIMUM_VALUE),s.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(r,n,a,o),s.height=GroundGeometryUpdater.getGeometryHeight(r,n),(a=GroundGeometryUpdater.getGeometryExtrudedHeight(a,o))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(a=ApproximateTerrainHeights.getMinimumMaximumHeights(RectangleGeometry.computeRectangle(s,scratchRectangle$1)).minimumTerrainHeight),s.extrudedHeight=a},RectangleGeometryUpdater.DynamicGeometryUpdater=DynamicRectangleGeometryUpdater,defined(Object.create)&&(DynamicRectangleGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicRectangleGeometryUpdater.prototype.constructor=DynamicRectangleGeometryUpdater),DynamicRectangleGeometryUpdater.prototype._isHidden=function(e,t,i){return!defined(this._options.rectangle)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicRectangleGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options,n=Property.getValueOrUndefined(t.height,i),a=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),o=Property.getValueOrUndefined(t.extrudedHeight,i),s=Property.getValueOrDefault(t.extrudedHeightReference,i,HeightReference$1.NONE);defined(o)&&!defined(n)&&(n=0),r.rectangle=Property.getValueOrUndefined(t.coordinates,i,r.rectangle),r.granularity=Property.getValueOrUndefined(t.granularity,i),r.stRotation=Property.getValueOrUndefined(t.stRotation,i),r.rotation=Property.getValueOrUndefined(t.rotation,i),r.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(n,a,o,s),r.height=GroundGeometryUpdater.getGeometryHeight(n,a),(o=GroundGeometryUpdater.getGeometryExtrudedHeight(o,s))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(o=ApproximateTerrainHeights.getMinimumMaximumHeights(RectangleGeometry.computeRectangle(r,scratchRectangle$1)).minimumTerrainHeight),r.extrudedHeight=o};var colorScratch$5=new Color,distanceDisplayConditionScratch$7=new DistanceDisplayCondition,defaultDistanceDisplayCondition$6=new DistanceDisplayCondition,defaultOffset$2=Cartesian3.ZERO,offsetScratch$2=new Cartesian3;function Batch$5(e,t,i,r,n,a,o){var s;this.translucent=t,this.appearanceType=i,this.depthFailAppearanceType=r,this.depthFailMaterialProperty=n,this.depthFailMaterial=void 0,this.closed=a,this.shadows=o,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.updaters=new AssociativeArray,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.itemsToRemove=[],this.invalidated=!1,defined(n)&&(s=n.definitionChanged.addEventListener(Batch$5.prototype.onMaterialChanged,this)),this.removeMaterialSubscription=s}function StaticGeometryColorBatch(e,t,i,r,n){this._solidItems=[],this._translucentItems=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=i,this._closed=r,this._shadows=n}function removeItem(e,t){for(var i=e.length-1;i>=0;i--){var r=e[i];if(r.remove(t))return 0===r.updaters.length&&(e.splice(i,1),r.destroy()),!0}return!1}function moveItems(e,t,i){for(var r=!1,n=t.length,a=0;a<n;++a){var o=t[a],s=o.itemsToRemove,l=s.length;if(l>0)for(a=0;a<l;a++){var c=s[a];o.remove(c),e.add(i,c),r=!0}}return r}function updateItems(e,t,i,r){var n,a=t.length;for(n=a-1;n>=0;n--){var o=t[n];if(o.invalidated){t.splice(n,1);for(var s=o.updaters.values,l=s.length,c=0;c<l;c++)e.add(i,s[c]);o.destroy()}}for(a=t.length,n=0;n<a;++n)r=t[n].update(i)&&r;return r}function getBoundingSphere(e,t,i){for(var r=e.length,n=0;n<r;n++){var a=e[n];if(a.contains(t))return a.getBoundingSphere(t,i)}return BoundingSphereState$1.FAILED}function removeAllPrimitives(e){for(var t=e.length,i=0;i<t;i++)e[i].destroy();e.length=0}Batch$5.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch$5.prototype.isMaterial=function(e){var t=this.depthFailMaterialProperty,i=e.depthFailMaterialProperty;return i===t||!!defined(t)&&t.equals(i)},Batch$5.prototype.add=function(e,t){var i=e.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),e.hasConstantFill&&e.fillMaterialProperty.isConstant&&Property.isConstant(e.distanceDisplayConditionProperty)&&Property.isConstant(e.terrainOffsetProperty)){var r=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener((function(t,i,n,a){"isShowing"===i&&r.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(i,e)},Batch$5.prototype.remove=function(e){var t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);return defined(i)&&(i(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},Batch$5.prototype.update=function(e){var t,i=!0,r=0,n=this.primitive,a=this.primitives;if(this.createPrimitive){var o=this.geometry.values;if(o.length>0){var s;defined(n)&&(defined(this.oldPrimitive)?a.remove(n):this.oldPrimitive=n),defined(this.depthFailAppearanceType)&&(defined(this.depthFailMaterialProperty)&&(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),s=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),n=new Primitive$2({show:!1,asynchronous:!0,geometryInstances:o.slice(),appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed}),depthFailAppearance:s,shadows:this.shadows}),a.add(n),i=!1}else{defined(n)&&(a.remove(n),n=void 0);var l=this.oldPrimitive;defined(l)&&(a.remove(l),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(defined(n)&&n.ready){n.show=!0,defined(this.oldPrimitive)&&(a.remove(this.oldPrimitive),this.oldPrimitive=void 0),!defined(this.depthFailAppearanceType)||this.depthFailMaterialProperty instanceof ColorMaterialProperty||(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);var c=this.updatersWithAttributes.values,u=c.length,d=this.waitingOnCreate;for(t=0;t<u;t++){var h=c[t],p=this.geometry.get(h.id),f=this.attributes.get(p.id.id);if(defined(f)||(f=n.getGeometryInstanceAttributes(p.id),this.attributes.set(p.id.id,f)),!h.fillMaterialProperty.isConstant||d){var m=h.fillMaterialProperty.color,g=Property.getValueOrDefault(m,e,Color.WHITE,colorScratch$5);Color.equals(f._lastColor,g)||(f._lastColor=Color.clone(g,f._lastColor),f.color=ColorGeometryInstanceAttribute.toValue(g,f.color),(this.translucent&&255===f.color[3]||!this.translucent&&255!==f.color[3])&&(this.itemsToRemove[r++]=h))}if(defined(this.depthFailAppearanceType)&&h.depthFailMaterialProperty instanceof ColorMaterialProperty&&(!h.depthFailMaterialProperty.isConstant||d)){var _=h.depthFailMaterialProperty.color,y=Property.getValueOrDefault(_,e,Color.WHITE,colorScratch$5);Color.equals(f._lastDepthFailColor,y)||(f._lastDepthFailColor=Color.clone(y,f._lastDepthFailColor),f.depthFailColor=ColorGeometryInstanceAttribute.toValue(y,f.depthFailColor))}var v=h.entity.isShowing&&(h.hasConstantFill||h.isFilled(e));v!==(1===f.show[0])&&(f.show=ShowGeometryInstanceAttribute.toValue(v,f.show));var C=h.distanceDisplayConditionProperty;if(!Property.isConstant(C)){var T=Property.getValueOrDefault(C,e,defaultDistanceDisplayCondition$6,distanceDisplayConditionScratch$7);DistanceDisplayCondition.equals(T,f._lastDistanceDisplayCondition)||(f._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(T,f._lastDistanceDisplayCondition),f.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(T,f.distanceDisplayCondition))}var S=h.terrainOffsetProperty;if(!Property.isConstant(S)){var A=Property.getValueOrDefault(S,e,defaultOffset$2,offsetScratch$2);Cartesian3.equals(A,f._lastOffset)||(f._lastOffset=Cartesian3.clone(A,f._lastOffset),f.offset=OffsetGeometryInstanceAttribute.toValue(A,f.offset))}}this.updateShows(n),this.waitingOnCreate=!1}else defined(n)&&!n.ready&&(i=!1);return this.itemsToRemove.length=r,i},Batch$5.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,r=0;r<i;r++){var n=t[r],a=this.geometry.get(n.id),o=this.attributes.get(a.id.id);defined(o)||(o=e.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,o));var s=n.entity.isShowing;s!==(1===o.show[0])&&(o.show=ShowGeometryInstanceAttribute.toValue(s,o.show),a.attributes.show.value[0]=o.show[0])}this.showsUpdated.removeAll()},Batch$5.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$5.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;var r=i.getGeometryInstanceAttributes(e.entity);return!defined(r)||!defined(r.boundingSphere)||defined(r.show)&&0===r.show[0]?BoundingSphereState$1.FAILED:(r.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$5.prototype.destroy=function(){var e=this.primitive,t=this.primitives;defined(e)&&t.remove(e);var i=this.oldPrimitive;defined(i)&&t.remove(i),defined(this.removeMaterialSubscription)&&this.removeMaterialSubscription()},StaticGeometryColorBatch.prototype.add=function(e,t){var i,r,n=t.createFillGeometryInstance(e);255===n.attributes.color.value[3]?(i=this._solidItems,r=!1):(i=this._translucentItems,r=!0);for(var a=i.length,o=0;o<a;o++){var s=i[o];if(s.isMaterial(t))return void s.add(t,n)}var l=new Batch$5(this._primitives,r,this._appearanceType,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);l.add(t,n),i.push(l)},StaticGeometryColorBatch.prototype.remove=function(e){removeItem(this._solidItems,e)||removeItem(this._translucentItems,e)},StaticGeometryColorBatch.prototype.update=function(e){var t=updateItems(this,this._solidItems,e,!0);t=updateItems(this,this._translucentItems,e,t)&&t;var i=moveItems(this,this._solidItems,e),r=moveItems(this,this._translucentItems,e);return(i||r)&&(t=updateItems(this,this._solidItems,e,t)&&t,t=updateItems(this,this._translucentItems,e,t)&&t),t},StaticGeometryColorBatch.prototype.getBoundingSphere=function(e,t){var i=getBoundingSphere(this._solidItems,e,t);return i===BoundingSphereState$1.FAILED?getBoundingSphere(this._translucentItems,e,t):i},StaticGeometryColorBatch.prototype.removeAllPrimitives=function(){removeAllPrimitives(this._solidItems),removeAllPrimitives(this._translucentItems)};var distanceDisplayConditionScratch$6=new DistanceDisplayCondition,defaultDistanceDisplayCondition$5=new DistanceDisplayCondition,defaultOffset$1=Cartesian3.ZERO,offsetScratch$1=new Cartesian3;function Batch$4(e,t,i,r,n,a,o){this.primitives=e,this.appearanceType=t,this.materialProperty=i,this.depthFailAppearanceType=r,this.depthFailMaterialProperty=n,this.closed=a,this.shadows=o,this.updaters=new AssociativeArray,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.material=void 0,this.depthFailMaterial=void 0,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(Batch$4.prototype.onMaterialChanged,this),this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray}Batch$4.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch$4.prototype.isMaterial=function(e){var t=this.materialProperty,i=e.fillMaterialProperty,r=this.depthFailMaterialProperty,n=e.depthFailMaterialProperty;if(i===t&&n===r)return!0;var a=defined(t)&&t.equals(i);return a=(!defined(r)&&!defined(n)||defined(r)&&r.equals(n))&&a},Batch$4.prototype.add=function(e,t){var i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,t.createFillGeometryInstance(e)),t.hasConstantFill&&t.fillMaterialProperty.isConstant&&Property.isConstant(t.distanceDisplayConditionProperty)&&Property.isConstant(t.terrainOffsetProperty)){var r=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener((function(e,i,n,a){"isShowing"===i&&r.showsUpdated.set(t.id,t)})))}else this.updatersWithAttributes.set(i,t);this.createPrimitive=!0},Batch$4.prototype.remove=function(e){var t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);return defined(i)&&(i(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};var colorScratch$4=new Color;function StaticGeometryPerMaterialBatch(e,t,i,r,n){this._items=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=i,this._closed=r,this._shadows=n}Batch$4.prototype.update=function(e){var t,i=!0,r=this.primitive,n=this.primitives,a=this.geometry.values;if(this.createPrimitive){if(a.length>0){var o;defined(r)&&(defined(this.oldPrimitive)?n.remove(r):this.oldPrimitive=r),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),defined(this.depthFailMaterialProperty)&&(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),o=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.depthFailMaterial.isTranslucent(),closed:this.closed})),r=new Primitive$2({show:!1,asynchronous:!0,geometryInstances:a.slice(),appearance:new this.appearanceType({material:this.material,translucent:this.material.isTranslucent(),closed:this.closed}),depthFailAppearance:o,shadows:this.shadows}),n.add(r),i=!1}else{defined(r)&&(n.remove(r),r=void 0);var s=this.oldPrimitive;defined(s)&&(n.remove(s),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=r,this.createPrimitive=!1}else if(defined(r)&&r.ready){r.show=!0,defined(this.oldPrimitive)&&(n.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material,!defined(this.depthFailAppearanceType)||this.depthFailMaterialProperty instanceof ColorMaterialProperty||(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);var l=this.updatersWithAttributes.values,c=l.length;for(t=0;t<c;t++){var u=l[t],d=u.entity,h=this.geometry.get(u.id),p=this.attributes.get(h.id.id);if(defined(p)||(p=r.getGeometryInstanceAttributes(h.id),this.attributes.set(h.id.id,p)),defined(this.depthFailAppearanceType)&&this.depthFailMaterialProperty instanceof ColorMaterialProperty&&!u.depthFailMaterialProperty.isConstant){var f=u.depthFailMaterialProperty.color,m=Property.getValueOrDefault(f,e,Color.WHITE,colorScratch$4);Color.equals(p._lastDepthFailColor,m)||(p._lastDepthFailColor=Color.clone(m,p._lastDepthFailColor),p.depthFailColor=ColorGeometryInstanceAttribute.toValue(m,p.depthFailColor))}var g=d.isShowing&&(u.hasConstantFill||u.isFilled(e));g!==(1===p.show[0])&&(p.show=ShowGeometryInstanceAttribute.toValue(g,p.show));var _=u.distanceDisplayConditionProperty;if(!Property.isConstant(_)){var y=Property.getValueOrDefault(_,e,defaultDistanceDisplayCondition$5,distanceDisplayConditionScratch$6);DistanceDisplayCondition.equals(y,p._lastDistanceDisplayCondition)||(p._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(y,p._lastDistanceDisplayCondition),p.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(y,p.distanceDisplayCondition))}var v=u.terrainOffsetProperty;if(!Property.isConstant(v)){var C=Property.getValueOrDefault(v,e,defaultOffset$1,offsetScratch$1);Cartesian3.equals(C,p._lastOffset)||(p._lastOffset=Cartesian3.clone(C,p._lastOffset),p.offset=OffsetGeometryInstanceAttribute.toValue(C,p.offset))}}this.updateShows(r)}else defined(r)&&!r.ready&&(i=!1);return i},Batch$4.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,r=0;r<i;r++){var n=t[r],a=n.entity,o=this.geometry.get(n.id),s=this.attributes.get(o.id.id);defined(s)||(s=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,s));var l=a.isShowing;l!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(l,s.show),o.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()},Batch$4.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$4.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;var r=i.getGeometryInstanceAttributes(e.entity);return!defined(r)||!defined(r.boundingSphere)||defined(r.show)&&0===r.show[0]?BoundingSphereState$1.FAILED:(r.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$4.prototype.destroy=function(){var e=this.primitive,t=this.primitives;defined(e)&&t.remove(e);var i=this.oldPrimitive;defined(i)&&t.remove(i),this.removeMaterialSubscription()},StaticGeometryPerMaterialBatch.prototype.add=function(e,t){for(var i=this._items,r=i.length,n=0;n<r;n++){var a=i[n];if(a.isMaterial(t))return void a.add(e,t)}var o=new Batch$4(this._primitives,this._appearanceType,t.fillMaterialProperty,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);o.add(e,t),i.push(o)},StaticGeometryPerMaterialBatch.prototype.remove=function(e){for(var t=this._items,i=t.length-1;i>=0;i--){var r=t[i];if(r.remove(e)){0===r.updaters.length&&(t.splice(i,1),r.destroy());break}}},StaticGeometryPerMaterialBatch.prototype.update=function(e){var t,i=this._items;for(t=i.length-1;t>=0;t--){var r=i[t];if(r.invalidated){i.splice(t,1);for(var n=r.updaters.values,a=n.length,o=0;o<a;o++)this.add(e,n[o]);r.destroy()}}var s=!0;for(t=0;t<i.length;t++)s=i[t].update(e)&&s;return s},StaticGeometryPerMaterialBatch.prototype.getBoundingSphere=function(e,t){for(var i=this._items,r=i.length,n=0;n<r;n++){var a=i[n];if(a.contains(e))return a.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGeometryPerMaterialBatch.prototype.removeAllPrimitives=function(){for(var e=this._items,t=e.length,i=0;i<t;i++)e[i].destroy();this._items.length=0};var colorScratch$3=new Color,distanceDisplayConditionScratch$5=new DistanceDisplayCondition,defaultDistanceDisplayCondition$4=new DistanceDisplayCondition;function Batch$3(e,t,i,r){this.primitives=e,this.zIndex=r,this.classificationType=t,this.color=i,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.updaters=new AssociativeArray,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.itemsToRemove=[],this.isDirty=!1,this.rectangleCollisionCheck=new RectangleCollisionChecker}function StaticGroundGeometryColorBatch(e,t){this._batches=[],this._primitives=e,this._classificationType=t}Batch$3.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)},Batch$3.prototype.add=function(e,t){var i=e.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),this.rectangleCollisionCheck.insert(i,t.geometry.rectangle),e.hasConstantFill&&e.fillMaterialProperty.isConstant&&Property.isConstant(e.distanceDisplayConditionProperty)){var r=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener((function(t,i,n,a){"isShowing"===i&&r.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(i,e)},Batch$3.prototype.remove=function(e){var t=e.id,i=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,i.geometry.rectangle),this.updatersWithAttributes.remove(t);var r=this.subscriptions.get(t);return defined(r)&&(r(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},Batch$3.prototype.update=function(e){var t,i=!0,r=this.primitive,n=this.primitives;if(this.createPrimitive){var a=this.geometry.values;if(a.length>0)defined(r)&&(defined(this.oldPrimitive)?n.remove(r):this.oldPrimitive=r),r=new GroundPrimitive({show:!1,asynchronous:!0,geometryInstances:a.slice(),classificationType:this.classificationType}),n.add(r,this.zIndex),i=!1;else{defined(r)&&(n.remove(r),r=void 0);var o=this.oldPrimitive;defined(o)&&(n.remove(o),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=r,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(defined(r)&&r.ready){r.show=!0,defined(this.oldPrimitive)&&(n.remove(this.oldPrimitive),this.oldPrimitive=void 0);var s=this.updatersWithAttributes.values,l=s.length,c=this.waitingOnCreate;for(t=0;t<l;t++){var u=s[t],d=this.geometry.get(u.id),h=this.attributes.get(d.id.id);if(defined(h)||(h=r.getGeometryInstanceAttributes(d.id),this.attributes.set(d.id.id,h)),!u.fillMaterialProperty.isConstant||c){var p=u.fillMaterialProperty.color,f=Property.getValueOrDefault(p,e,Color.WHITE,colorScratch$3);Color.equals(h._lastColor,f)||(h._lastColor=Color.clone(f,h._lastColor),h.color=ColorGeometryInstanceAttribute.toValue(f,h.color))}var m=u.entity.isShowing&&(u.hasConstantFill||u.isFilled(e));m!==(1===h.show[0])&&(h.show=ShowGeometryInstanceAttribute.toValue(m,h.show));var g=u.distanceDisplayConditionProperty;if(!Property.isConstant(g)){var _=Property.getValueOrDefault(g,e,defaultDistanceDisplayCondition$4,distanceDisplayConditionScratch$5);DistanceDisplayCondition.equals(_,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(_,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(_,h.distanceDisplayCondition))}}this.updateShows(r),this.waitingOnCreate=!1}else defined(r)&&!r.ready&&(i=!1);return this.itemsToRemove.length=0,i},Batch$3.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,r=0;r<i;r++){var n=t[r],a=this.geometry.get(n.id),o=this.attributes.get(a.id.id);defined(o)||(o=e.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,o));var s=n.entity.isShowing;s!==(1===o.show[0])&&(o.show=ShowGeometryInstanceAttribute.toValue(s,o.show),a.attributes.show.value[0]=o.show[0])}this.showsUpdated.removeAll()},Batch$3.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$3.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;var r=i.getBoundingSphere(e.entity);return defined(r)?(r.clone(t),BoundingSphereState$1.DONE):BoundingSphereState$1.FAILED},Batch$3.prototype.removeAllPrimitives=function(){var e=this.primitives,t=this.primitive;defined(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());var i=this.oldPrimitive;defined(i)&&(e.remove(i),this.oldPrimitive=void 0)},StaticGroundGeometryColorBatch.prototype.add=function(e,t){for(var i,r=t.createFillGeometryInstance(e),n=this._batches,a=Property.getValueOrDefault(t.zIndex,0),o=n.length,s=0;s<o;++s){var l=n[s];if(l.zIndex===a&&!l.overlapping(r.geometry.rectangle)){i=l;break}}return defined(i)||(i=new Batch$3(this._primitives,this._classificationType,r.attributes.color.value,a),n.push(i)),i.add(t,r),i},StaticGroundGeometryColorBatch.prototype.remove=function(e){for(var t=this._batches,i=t.length,r=0;r<i;++r)if(t[r].remove(e))return},StaticGroundGeometryColorBatch.prototype.update=function(e){var t,i,r=!0,n=this._batches,a=n.length;for(t=0;t<a;++t)r=n[t].update(e)&&r;for(t=0;t<a;++t)for(var o=n[t],s=o.itemsToRemove,l=s.length,c=0;c<l;c++){i=s[c],o.remove(i);var u=this.add(e,i);o.isDirty=!0,u.isDirty=!0}for(t=a-1;t>=0;--t){var d=n[t];d.isDirty&&(r=n[t].update(e)&&r,d.isDirty=!1),0===d.geometry.length&&n.splice(t,1)}return r},StaticGroundGeometryColorBatch.prototype.getBoundingSphere=function(e,t){for(var i=this._batches,r=i.length,n=0;n<r;++n){var a=i[n];if(a.contains(e))return a.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGroundGeometryColorBatch.prototype.removeAllPrimitives=function(){for(var e=this._batches,t=e.length,i=0;i<t;++i)e[i].removeAllPrimitives()};var distanceDisplayConditionScratch$4=new DistanceDisplayCondition,defaultDistanceDisplayCondition$3=new DistanceDisplayCondition;function Batch$2(e,t,i,r,n,a){this.primitives=e,this.classificationType=t,this.appearanceType=i,this.materialProperty=r,this.updaters=new AssociativeArray,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.material=void 0,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.invalidated=!1,this.removeMaterialSubscription=r.definitionChanged.addEventListener(Batch$2.prototype.onMaterialChanged,this),this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.usingSphericalTextureCoordinates=n,this.zIndex=a,this.rectangleCollisionCheck=new RectangleCollisionChecker}function StaticGroundGeometryPerMaterialBatch(e,t,i){this._items=[],this._primitives=e,this._classificationType=t,this._appearanceType=i}Batch$2.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch$2.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)},Batch$2.prototype.isMaterial=function(e){var t=this.materialProperty,i=e.fillMaterialProperty;return i===t||i instanceof ColorMaterialProperty&&t instanceof ColorMaterialProperty||defined(t)&&t.equals(i)},Batch$2.prototype.add=function(e,t,i){var r=t.id;if(this.updaters.set(r,t),this.geometry.set(r,i),this.rectangleCollisionCheck.insert(r,i.geometry.rectangle),t.hasConstantFill&&t.fillMaterialProperty.isConstant&&Property.isConstant(t.distanceDisplayConditionProperty)){var n=this;this.subscriptions.set(r,t.entity.definitionChanged.addEventListener((function(e,i,r,a){"isShowing"===i&&n.showsUpdated.set(t.id,t)})))}else this.updatersWithAttributes.set(r,t);this.createPrimitive=!0},Batch$2.prototype.remove=function(e){var t=e.id,i=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,i.geometry.rectangle),this.updatersWithAttributes.remove(t);var r=this.subscriptions.get(t);return defined(r)&&(r(),this.subscriptions.remove(t)),!0}return!1},Batch$2.prototype.update=function(e){var t,i=!0,r=this.primitive,n=this.primitives,a=this.geometry.values;if(this.createPrimitive){if(a.length>0)defined(r)&&(defined(this.oldPrimitive)?n.remove(r):this.oldPrimitive=r),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),r=new GroundPrimitive({show:!1,asynchronous:!0,geometryInstances:a.slice(),appearance:new this.appearanceType({material:this.material}),classificationType:this.classificationType}),n.add(r,this.zIndex),i=!1;else{defined(r)&&(n.remove(r),r=void 0);var o=this.oldPrimitive;defined(o)&&(n.remove(o),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=r,this.createPrimitive=!1}else if(defined(r)&&r.ready){r.show=!0,defined(this.oldPrimitive)&&(n.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;var s=this.updatersWithAttributes.values,l=s.length;for(t=0;t<l;t++){var c=s[t],u=c.entity,d=this.geometry.get(c.id),h=this.attributes.get(d.id.id);defined(h)||(h=r.getGeometryInstanceAttributes(d.id),this.attributes.set(d.id.id,h));var p=u.isShowing&&(c.hasConstantFill||c.isFilled(e));p!==(1===h.show[0])&&(h.show=ShowGeometryInstanceAttribute.toValue(p,h.show));var f=c.distanceDisplayConditionProperty;if(!Property.isConstant(f)){var m=Property.getValueOrDefault(f,e,defaultDistanceDisplayCondition$3,distanceDisplayConditionScratch$4);DistanceDisplayCondition.equals(m,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(m,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(m,h.distanceDisplayCondition))}}this.updateShows(r)}else defined(r)&&!r.ready&&(i=!1);return i},Batch$2.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,r=0;r<i;r++){var n=t[r],a=n.entity,o=this.geometry.get(n.id),s=this.attributes.get(o.id.id);defined(s)||(s=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,s));var l=a.isShowing;l!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(l,s.show),o.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()},Batch$2.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$2.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;var r=i.getGeometryInstanceAttributes(e.entity);return!defined(r)||!defined(r.boundingSphere)||defined(r.show)&&0===r.show[0]?BoundingSphereState$1.FAILED:(r.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$2.prototype.destroy=function(){var e=this.primitive,t=this.primitives;defined(e)&&t.remove(e);var i=this.oldPrimitive;defined(i)&&t.remove(i),this.removeMaterialSubscription()},StaticGroundGeometryPerMaterialBatch.prototype.add=function(e,t){for(var i=this._items,r=i.length,n=t.createFillGeometryInstance(e),a=ShadowVolumeAppearance.shouldUseSphericalCoordinates(n.geometry.rectangle),o=Property.getValueOrDefault(t.zIndex,0),s=0;s<r;++s){var l=i[s];if(l.isMaterial(t)&&l.usingSphericalTextureCoordinates===a&&l.zIndex===o&&!l.overlapping(n.geometry.rectangle))return void l.add(e,t,n)}var c=new Batch$2(this._primitives,this._classificationType,this._appearanceType,t.fillMaterialProperty,a,o);c.add(e,t,n),i.push(c)},StaticGroundGeometryPerMaterialBatch.prototype.remove=function(e){for(var t=this._items,i=t.length-1;i>=0;i--){var r=t[i];if(r.remove(e)){0===r.updaters.length&&(t.splice(i,1),r.destroy());break}}},StaticGroundGeometryPerMaterialBatch.prototype.update=function(e){var t,i=this._items;for(t=i.length-1;t>=0;t--){var r=i[t];if(r.invalidated){i.splice(t,1);for(var n=r.updaters.values,a=n.length,o=0;o<a;o++)this.add(e,n[o]);r.destroy()}}var s=!0;for(t=0;t<i.length;t++)s=i[t].update(e)&&s;return s},StaticGroundGeometryPerMaterialBatch.prototype.getBoundingSphere=function(e,t){for(var i=this._items,r=i.length,n=0;n<r;n++){var a=i[n];if(a.contains(e))return a.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGroundGeometryPerMaterialBatch.prototype.removeAllPrimitives=function(){for(var e=this._items,t=e.length,i=0;i<t;i++)e[i].destroy();this._items.length=0};var colorScratch$2=new Color,distanceDisplayConditionScratch$3=new DistanceDisplayCondition,defaultDistanceDisplayCondition$2=new DistanceDisplayCondition,defaultOffset=Cartesian3.ZERO,offsetScratch=new Cartesian3;function Batch$1(e,t,i,r){this.translucent=t,this.width=i,this.shadows=r,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.updaters=new AssociativeArray,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.itemsToRemove=[],this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray}function StaticOutlineGeometryBatch(e,t,i){this._primitives=e,this._scene=t,this._shadows=i,this._solidBatches=new AssociativeArray,this._translucentBatches=new AssociativeArray}Batch$1.prototype.add=function(e,t){var i=e.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),e.hasConstantOutline&&e.outlineColorProperty.isConstant&&Property.isConstant(e.distanceDisplayConditionProperty)&&Property.isConstant(e.terrainOffsetProperty)){var r=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener((function(t,i,n,a){"isShowing"===i&&r.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(i,e)},Batch$1.prototype.remove=function(e){var t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);return defined(i)&&(i(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},Batch$1.prototype.update=function(e){var t,i=!0,r=0,n=this.primitive,a=this.primitives;if(this.createPrimitive){var o=this.geometry.values;if(o.length>0)defined(n)&&(defined(this.oldPrimitive)?a.remove(n):this.oldPrimitive=n),n=new Primitive$2({show:!1,asynchronous:!0,geometryInstances:o.slice(),appearance:new PerInstanceColorAppearance({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}}),shadows:this.shadows}),a.add(n),i=!1;else{defined(n)&&(a.remove(n),n=void 0);var s=this.oldPrimitive;defined(s)&&(a.remove(s),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(defined(n)&&n.ready){n.show=!0,defined(this.oldPrimitive)&&(a.remove(this.oldPrimitive),this.oldPrimitive=void 0);var l=this.updatersWithAttributes.values,c=l.length,u=this.waitingOnCreate;for(t=0;t<c;t++){var d=l[t],h=this.geometry.get(d.id),p=this.attributes.get(h.id.id);if(defined(p)||(p=n.getGeometryInstanceAttributes(h.id),this.attributes.set(h.id.id,p)),!d.outlineColorProperty.isConstant||u){var f=d.outlineColorProperty,m=Property.getValueOrDefault(f,e,Color.WHITE,colorScratch$2);Color.equals(p._lastColor,m)||(p._lastColor=Color.clone(m,p._lastColor),p.color=ColorGeometryInstanceAttribute.toValue(m,p.color),(this.translucent&&255===p.color[3]||!this.translucent&&255!==p.color[3])&&(this.itemsToRemove[r++]=d))}var g=d.entity.isShowing&&(d.hasConstantOutline||d.isOutlineVisible(e));g!==(1===p.show[0])&&(p.show=ShowGeometryInstanceAttribute.toValue(g,p.show));var _=d.distanceDisplayConditionProperty;if(!Property.isConstant(_)){var y=Property.getValueOrDefault(_,e,defaultDistanceDisplayCondition$2,distanceDisplayConditionScratch$3);DistanceDisplayCondition.equals(y,p._lastDistanceDisplayCondition)||(p._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(y,p._lastDistanceDisplayCondition),p.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(y,p.distanceDisplayCondition))}var v=d.terrainOffsetProperty;if(!Property.isConstant(v)){var C=Property.getValueOrDefault(v,e,defaultOffset,offsetScratch);Cartesian3.equals(C,p._lastOffset)||(p._lastOffset=Cartesian3.clone(C,p._lastOffset),p.offset=OffsetGeometryInstanceAttribute.toValue(C,p.offset))}}this.updateShows(n),this.waitingOnCreate=!1}else defined(n)&&!n.ready&&(i=!1);return this.itemsToRemove.length=r,i},Batch$1.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,r=0;r<i;r++){var n=t[r],a=this.geometry.get(n.id),o=this.attributes.get(a.id.id);defined(o)||(o=e.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,o));var s=n.entity.isShowing;s!==(1===o.show[0])&&(o.show=ShowGeometryInstanceAttribute.toValue(s,o.show),a.attributes.show.value[0]=o.show[0])}this.showsUpdated.removeAll()},Batch$1.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$1.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;var r=i.getGeometryInstanceAttributes(e.entity);return!defined(r)||!defined(r.boundingSphere)||defined(r.show)&&0===r.show[0]?BoundingSphereState$1.FAILED:(r.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$1.prototype.removeAllPrimitives=function(){var e=this.primitives,t=this.primitive;defined(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());var i=this.oldPrimitive;defined(i)&&(e.remove(i),this.oldPrimitive=void 0)},StaticOutlineGeometryBatch.prototype.add=function(e,t){var i,r,n=t.createOutlineGeometryInstance(e),a=this._scene.clampLineWidth(t.outlineWidth);255===n.attributes.color.value[3]?(defined(r=(i=this._solidBatches).get(a))||(r=new Batch$1(this._primitives,!1,a,this._shadows),i.set(a,r)),r.add(t,n)):(defined(r=(i=this._translucentBatches).get(a))||(r=new Batch$1(this._primitives,!0,a,this._shadows),i.set(a,r)),r.add(t,n))},StaticOutlineGeometryBatch.prototype.remove=function(e){var t,i=this._solidBatches.values,r=i.length;for(t=0;t<r;t++)if(i[t].remove(e))return;var n=this._translucentBatches.values,a=n.length;for(t=0;t<a;t++)if(n[t].remove(e))return},StaticOutlineGeometryBatch.prototype.update=function(e){var t,i,r,n,a,o=this._solidBatches.values,s=o.length,l=this._translucentBatches.values,c=l.length,u=!0,d=!1;do{for(d=!1,i=0;i<s;i++){u=(n=o[i]).update(e);var h=(a=n.itemsToRemove).length;if(h>0)for(d=!0,t=0;t<h;t++)r=a[t],n.remove(r),this.add(e,r)}for(i=0;i<c;i++){u=(n=l[i]).update(e);var p=(a=n.itemsToRemove).length;if(p>0)for(d=!0,t=0;t<p;t++)r=a[t],n.remove(r),this.add(e,r)}}while(d);return u},StaticOutlineGeometryBatch.prototype.getBoundingSphere=function(e,t){var i,r=this._solidBatches.values,n=r.length;for(i=0;i<n;i++){var a=r[i];if(a.contains(e))return a.getBoundingSphere(e,t)}var o=this._translucentBatches.values,s=o.length;for(i=0;i<s;i++){var l=o[i];if(l.contains(e))return l.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticOutlineGeometryBatch.prototype.removeAllPrimitives=function(){var e,t=this._solidBatches.values,i=t.length;for(e=0;e<i;e++)t[e].removeAllPrimitives();var r=this._translucentBatches.values,n=r.length;for(e=0;e<n;e++)r[e].removeAllPrimitives()};var scratchColor$5=new Color;function WallGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.minimumHeights=void 0,this.maximumHeights=void 0,this.granularity=void 0}function WallGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new WallGeometryOptions(e),geometryPropertyName:"wall",observedPropertyNames:["availability","wall"]}),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}function DynamicWallGeometryUpdater(e,t,i){DynamicGeometryUpdater$1.call(this,e,t,i)}defined(Object.create)&&(WallGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),WallGeometryUpdater.prototype.constructor=WallGeometryUpdater),WallGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i,r=this._entity,n=r.isAvailable(e),a=new ShowGeometryInstanceAttribute(n&&r.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),s=DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(o);this._materialProperty instanceof ColorMaterialProperty?(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(i=this._materialProperty.color.getValue(e,scratchColor$5)),defined(i)||(i=Color.WHITE),t={show:a,distanceDisplayCondition:s,color:ColorGeometryInstanceAttribute.fromColor(i)}):t={show:a,distanceDisplayCondition:s};return new GeometryInstance({id:r,geometry:new WallGeometry(this._options),attributes:t})},WallGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$5),n=this._distanceDisplayConditionProperty.getValue(e);return new GeometryInstance({id:t,geometry:new WallOutlineGeometry(this._options),attributes:{show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n)}})},WallGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.positions)||GeometryUpdater.prototype._isHidden.call(this,e,t)},WallGeometryUpdater.prototype._getIsClosed=function(e){return!1},WallGeometryUpdater.prototype._isDynamic=function(e,t){return!(t.positions.isConstant&&Property.isConstant(t.minimumHeights)&&Property.isConstant(t.maximumHeights)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.granularity))},WallGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=t.minimumHeights,r=t.maximumHeights,n=t.granularity,a=this._materialProperty instanceof ColorMaterialProperty,o=this._options;o.vertexFormat=a?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,o.positions=t.positions.getValue(Iso8601.MINIMUM_VALUE,o.positions),o.minimumHeights=defined(i)?i.getValue(Iso8601.MINIMUM_VALUE,o.minimumHeights):void 0,o.maximumHeights=defined(r)?r.getValue(Iso8601.MINIMUM_VALUE,o.maximumHeights):void 0,o.granularity=defined(n)?n.getValue(Iso8601.MINIMUM_VALUE):void 0},WallGeometryUpdater.DynamicGeometryUpdater=DynamicWallGeometryUpdater,defined(Object.create)&&(DynamicWallGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicWallGeometryUpdater.prototype.constructor=DynamicWallGeometryUpdater),DynamicWallGeometryUpdater.prototype._isHidden=function(e,t,i){return!defined(this._options.positions)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,i)},DynamicWallGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options;r.positions=Property.getValueOrUndefined(t.positions,i,r.positions),r.minimumHeights=Property.getValueOrUndefined(t.minimumHeights,i,r.minimumHeights),r.maximumHeights=Property.getValueOrUndefined(t.maximumHeights,i,r.maximumHeights),r.granularity=Property.getValueOrUndefined(t.granularity,i)};var emptyArray$1=[],geometryUpdaters=[BoxGeometryUpdater,CylinderGeometryUpdater,CorridorGeometryUpdater,EllipseGeometryUpdater,EllipsoidGeometryUpdater,PlaneGeometryUpdater,PolygonGeometryUpdater,PolylineVolumeGeometryUpdater,RectangleGeometryUpdater,WallGeometryUpdater];function GeometryUpdaterSet(e,t){this.entity=e,this.scene=t;var i=new Array(geometryUpdaters.length),r=new Event;function n(e){r.raiseEvent(e)}for(var a=new EventHelper,o=0;o<i.length;o++){var s=new geometryUpdaters[o](e,t);a.add(s.geometryChanged,n),i[o]=s}this.updaters=i,this.geometryChanged=r,this.eventHelper=a,this._removeEntitySubscription=e.definitionChanged.addEventListener(GeometryUpdaterSet.prototype._onEntityPropertyChanged,this)}function GeometryVisualizer(e,t,i,r){i=defaultValue(i,e.primitives),r=defaultValue(r,e.groundPrimitives),this._scene=e,this._primitives=i,this._groundPrimitives=r,this._entityCollection=void 0,this._addedObjects=new AssociativeArray,this._removedObjects=new AssociativeArray,this._changedObjects=new AssociativeArray;var n=ShadowMode$1.NUMBER_OF_SHADOW_MODES;this._outlineBatches=new Array(2*n),this._closedColorBatches=new Array(2*n),this._closedMaterialBatches=new Array(2*n),this._openColorBatches=new Array(2*n),this._openMaterialBatches=new Array(2*n);var a,o=Entity.supportsMaterialsforEntitiesOnTerrain(e);for(this._supportsMaterialsforEntitiesOnTerrain=o,a=0;a<n;++a)this._outlineBatches[a]=new StaticOutlineGeometryBatch(i,e,a,!1),this._outlineBatches[n+a]=new StaticOutlineGeometryBatch(i,e,a,!0),this._closedColorBatches[a]=new StaticGeometryColorBatch(i,PerInstanceColorAppearance,void 0,!0,a,!0),this._closedColorBatches[n+a]=new StaticGeometryColorBatch(i,PerInstanceColorAppearance,void 0,!0,a,!1),this._closedMaterialBatches[a]=new StaticGeometryPerMaterialBatch(i,MaterialAppearance,void 0,!0,a,!0),this._closedMaterialBatches[n+a]=new StaticGeometryPerMaterialBatch(i,MaterialAppearance,void 0,!0,a,!1),this._openColorBatches[a]=new StaticGeometryColorBatch(i,PerInstanceColorAppearance,void 0,!1,a,!0),this._openColorBatches[n+a]=new StaticGeometryColorBatch(i,PerInstanceColorAppearance,void 0,!1,a,!1),this._openMaterialBatches[a]=new StaticGeometryPerMaterialBatch(i,MaterialAppearance,void 0,!1,a,!0),this._openMaterialBatches[n+a]=new StaticGeometryPerMaterialBatch(i,MaterialAppearance,void 0,!1,a,!1);var s=ClassificationType$1.NUMBER_OF_CLASSIFICATION_TYPES,l=new Array(s),c=[];if(o)for(a=0;a<s;++a)c.push(new StaticGroundGeometryPerMaterialBatch(r,a,MaterialAppearance)),l[a]=new StaticGroundGeometryColorBatch(r,a);else for(a=0;a<s;++a)l[a]=new StaticGroundGeometryColorBatch(r,a);this._groundColorBatches=l,this._groundMaterialBatches=c,this._dynamicBatch=new DynamicGeometryBatch(i,r),this._batches=this._outlineBatches.concat(this._closedColorBatches,this._closedMaterialBatches,this._openColorBatches,this._openMaterialBatches,this._groundColorBatches,this._groundMaterialBatches,this._dynamicBatch),this._subscriptions=new AssociativeArray,this._updaterSets=new AssociativeArray,this._entityCollection=t,t.collectionChanged.addEventListener(GeometryVisualizer.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,emptyArray$1)}GeometryUpdaterSet.prototype._onEntityPropertyChanged=function(e,t,i,r){for(var n=this.updaters,a=0;a<n.length;a++)n[a]._onEntityPropertyChanged(e,t,i,r)},GeometryUpdaterSet.prototype.forEach=function(e){for(var t=this.updaters,i=0;i<t.length;i++)e(t[i])},GeometryUpdaterSet.prototype.destroy=function(){this.eventHelper.removeAll();for(var e=this.updaters,t=0;t<e.length;t++)e[t].destroy();this._removeEntitySubscription(),destroyObject(this)},GeometryVisualizer.prototype.update=function(e){var t,i,r,n,a=this._addedObjects,o=a.values,s=this._removedObjects,l=s.values,c=this._changedObjects,u=c.values,d=this;for(t=u.length-1;t>-1;t--)r=(i=u[t]).id,(n=this._updaterSets.get(r)).entity===i?n.forEach((function(t){d._removeUpdater(t),d._insertUpdaterIntoBatch(e,t)})):(l.push(i),o.push(i));for(t=l.length-1;t>-1;t--)r=(i=l[t]).id,(n=this._updaterSets.get(r)).forEach(this._removeUpdater.bind(this)),n.destroy(),this._updaterSets.remove(r),this._subscriptions.get(r)(),this._subscriptions.remove(r);for(t=o.length-1;t>-1;t--)r=(i=o[t]).id,n=new GeometryUpdaterSet(i,this._scene),this._updaterSets.set(r,n),n.forEach((function(t){d._insertUpdaterIntoBatch(e,t)})),this._subscriptions.set(r,n.geometryChanged.addEventListener(GeometryVisualizer._onGeometryChanged,this));a.removeAll(),s.removeAll(),c.removeAll();var h=!0,p=this._batches,f=p.length;for(t=0;t<f;t++)h=p[t].update(e)&&h;return h};var getBoundingSphereArrayScratch$2=[],getBoundingSphereBoundingSphereScratch$2=new BoundingSphere;GeometryVisualizer.prototype.getBoundingSphere=function(e,t){for(var i=getBoundingSphereArrayScratch$2,r=getBoundingSphereBoundingSphereScratch$2,n=0,a=BoundingSphereState$1.DONE,o=this._batches,s=o.length,l=e.id,c=this._updaterSets.get(l).updaters,u=0;u<c.length;u++)for(var d=c[u],h=0;h<s;h++){if((a=o[h].getBoundingSphere(d,r))===BoundingSphereState$1.PENDING)return BoundingSphereState$1.PENDING;a===BoundingSphereState$1.DONE&&(i[n]=BoundingSphere.clone(r,i[n]),n++)}return 0===n?BoundingSphereState$1.FAILED:(i.length=n,BoundingSphere.fromBoundingSpheres(i,t),BoundingSphereState$1.DONE)},GeometryVisualizer.prototype.isDestroyed=function(){return!1},GeometryVisualizer.prototype.destroy=function(){var e;this._entityCollection.collectionChanged.removeEventListener(GeometryVisualizer.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();var t=this._batches,i=t.length;for(e=0;e<i;e++)t[e].removeAllPrimitives();var r=this._subscriptions.values;for(i=r.length,e=0;e<i;e++)r[e]();this._subscriptions.removeAll();var n=this._updaterSets.values;for(i=n.length,e=0;e<i;e++)n[e].destroy();return this._updaterSets.removeAll(),destroyObject(this)},GeometryVisualizer.prototype._removeUpdater=function(e){for(var t=this._batches,i=t.length,r=0;r<i;r++)t[r].remove(e)},GeometryVisualizer.prototype._insertUpdaterIntoBatch=function(e,t){if(t.isDynamic)this._dynamicBatch.add(e,t);else{var i;(t.outlineEnabled||t.fillEnabled)&&(i=t.shadowsProperty.getValue(e));var r=ShadowMode$1.NUMBER_OF_SHADOW_MODES;if(t.outlineEnabled&&(defined(t.terrainOffsetProperty)?this._outlineBatches[r+i].add(e,t):this._outlineBatches[i].add(e,t)),t.fillEnabled)if(t.onTerrain){var n=t.classificationTypeProperty.getValue(e);t.fillMaterialProperty instanceof ColorMaterialProperty?this._groundColorBatches[n].add(e,t):this._groundMaterialBatches[n].add(e,t)}else t.isClosed?t.fillMaterialProperty instanceof ColorMaterialProperty?defined(t.terrainOffsetProperty)?this._closedColorBatches[r+i].add(e,t):this._closedColorBatches[i].add(e,t):defined(t.terrainOffsetProperty)?this._closedMaterialBatches[r+i].add(e,t):this._closedMaterialBatches[i].add(e,t):t.fillMaterialProperty instanceof ColorMaterialProperty?defined(t.terrainOffsetProperty)?this._openColorBatches[r+i].add(e,t):this._openColorBatches[i].add(e,t):defined(t.terrainOffsetProperty)?this._openMaterialBatches[r+i].add(e,t):this._openMaterialBatches[i].add(e,t)}},GeometryVisualizer._onGeometryChanged=function(e){var t=this._removedObjects,i=this._changedObjects,r=e.entity,n=r.id;defined(t.get(n))||defined(i.get(n))||i.set(n,r)},GeometryVisualizer.prototype._onCollectionChanged=function(e,t,i){var r,n,a,o=this._addedObjects,s=this._removedObjects,l=this._changedObjects;for(r=i.length-1;r>-1;r--)n=(a=i[r]).id,o.remove(n)||(s.set(n,a),l.remove(n));for(r=t.length-1;r>-1;r--)n=(a=t[r]).id,s.remove(n)?l.set(n,a):o.set(n,a)};var defaultScale$1=1,defaultFont="30px sans-serif",defaultStyle=LabelStyle$1.FILL,defaultFillColor=Color.WHITE,defaultOutlineColor$1=Color.BLACK,defaultOutlineWidth$1=1,defaultShowBackground=!1,defaultBackgroundColor$1=new Color(.165,.165,.165,.8),defaultBackgroundPadding=new Cartesian2(7,5),defaultPixelOffset=Cartesian2.ZERO,defaultEyeOffset=Cartesian3.ZERO,defaultHeightReference$1=HeightReference$1.NONE,defaultHorizontalOrigin=HorizontalOrigin$1.CENTER,defaultVerticalOrigin=VerticalOrigin$1.CENTER,positionScratch$1=new Cartesian3,fillColorScratch=new Color,outlineColorScratch$1=new Color,backgroundColorScratch=new Color,backgroundPaddingScratch=new Cartesian2,eyeOffsetScratch=new Cartesian3,pixelOffsetScratch=new Cartesian2,translucencyByDistanceScratch$1=new NearFarScalar,pixelOffsetScaleByDistanceScratch=new NearFarScalar,scaleByDistanceScratch$1=new NearFarScalar,distanceDisplayConditionScratch$2=new DistanceDisplayCondition;function EntityData$2(e){this.entity=e,this.label=void 0,this.index=void 0}function LabelVisualizer(e,t){t.collectionChanged.addEventListener(LabelVisualizer.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function returnPrimitive$1(e,t,i){defined(e)&&(e.label=void 0,i.removeLabel(t))}LabelVisualizer.prototype.update=function(e){for(var t=this._items.values,i=this._cluster,r=0,n=t.length;r<n;r++){var a,o,s=t[r],l=s.entity,c=l._label,u=s.label,d=l.isShowing&&l.isAvailable(e)&&Property.getValueOrDefault(c._show,e,!0);if(d&&(o=Property.getValueOrUndefined(l._position,e,positionScratch$1),a=Property.getValueOrUndefined(c._text,e),d=defined(o)&&defined(a)),d){Property.isConstant(l._position)||(i._clusterDirty=!0);var h=!1,p=Property.getValueOrDefault(c._heightReference,e,defaultHeightReference$1);defined(u)||((u=i.getLabel(l)).id=l,s.label=u,h=Cartesian3.equals(u.position,o)&&u.heightReference===p),u.show=!0,u.position=o,u.text=a,u.scale=Property.getValueOrDefault(c._scale,e,defaultScale$1),u.font=Property.getValueOrDefault(c._font,e,defaultFont),u.style=Property.getValueOrDefault(c._style,e,defaultStyle),u.fillColor=Property.getValueOrDefault(c._fillColor,e,defaultFillColor,fillColorScratch),u.outlineColor=Property.getValueOrDefault(c._outlineColor,e,defaultOutlineColor$1,outlineColorScratch$1),u.outlineWidth=Property.getValueOrDefault(c._outlineWidth,e,defaultOutlineWidth$1),u.showBackground=Property.getValueOrDefault(c._showBackground,e,defaultShowBackground),u.backgroundColor=Property.getValueOrDefault(c._backgroundColor,e,defaultBackgroundColor$1,backgroundColorScratch),u.backgroundPadding=Property.getValueOrDefault(c._backgroundPadding,e,defaultBackgroundPadding,backgroundPaddingScratch),u.pixelOffset=Property.getValueOrDefault(c._pixelOffset,e,defaultPixelOffset,pixelOffsetScratch),u.eyeOffset=Property.getValueOrDefault(c._eyeOffset,e,defaultEyeOffset,eyeOffsetScratch),u.heightReference=p,u.horizontalOrigin=Property.getValueOrDefault(c._horizontalOrigin,e,defaultHorizontalOrigin),u.verticalOrigin=Property.getValueOrDefault(c._verticalOrigin,e,defaultVerticalOrigin),u.translucencyByDistance=Property.getValueOrUndefined(c._translucencyByDistance,e,translucencyByDistanceScratch$1),u.pixelOffsetScaleByDistance=Property.getValueOrUndefined(c._pixelOffsetScaleByDistance,e,pixelOffsetScaleByDistanceScratch),u.scaleByDistance=Property.getValueOrUndefined(c._scaleByDistance,e,scaleByDistanceScratch$1),u.distanceDisplayCondition=Property.getValueOrUndefined(c._distanceDisplayCondition,e,distanceDisplayConditionScratch$2),u.disableDepthTestDistance=Property.getValueOrUndefined(c._disableDepthTestDistance,e),h&&u._updateClamping()}else returnPrimitive$1(s,l,i)}return!0},LabelVisualizer.prototype.getBoundingSphere=function(e,t){var i=this._items.get(e.id);if(!defined(i)||!defined(i.label))return BoundingSphereState$1.FAILED;var r=i.label;return t.center=Cartesian3.clone(defaultValue(r._clampedPosition,r.position),t.center),t.radius=0,BoundingSphereState$1.DONE},LabelVisualizer.prototype.isDestroyed=function(){return!1},LabelVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(LabelVisualizer.prototype._onCollectionChanged,this);for(var e=this._entityCollection.values,t=0;t<e.length;t++)this._cluster.removeLabel(e[t]);return destroyObject(this)},LabelVisualizer.prototype._onCollectionChanged=function(e,t,i,r){var n,a,o=this._items,s=this._cluster;for(n=t.length-1;n>-1;n--)defined((a=t[n])._label)&&defined(a._position)&&o.set(a.id,new EntityData$2(a));for(n=r.length-1;n>-1;n--)defined((a=r[n])._label)&&defined(a._position)?o.contains(a.id)||o.set(a.id,new EntityData$2(a)):(returnPrimitive$1(o.get(a.id),a,s),o.remove(a.id));for(n=i.length-1;n>-1;n--)a=i[n],returnPrimitive$1(o.get(a.id),a,s),o.remove(a.id)};var defaultScale=1,defaultMinimumPixelSize=0,defaultIncrementallyLoadTextures=!0,defaultClampAnimations=!0,defaultShadows$1=ShadowMode$1.ENABLED,defaultHeightReference=HeightReference$1.NONE,defaultSilhouetteColor=Color.RED,defaultSilhouetteSize=0,defaultColor$2=Color.WHITE,defaultColorBlendMode=ColorBlendMode$1.HIGHLIGHT,defaultColorBlendAmount=.5,defaultImageBasedLightingFactor=new Cartesian2(1,1),modelMatrixScratch=new Matrix4,nodeMatrixScratch=new Matrix4;function ModelVisualizer(e,t){t.collectionChanged.addEventListener(ModelVisualizer.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._modelHash={},this._entitiesToVisualize=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function removeModel(e,t,i,r){var n=i[t.id];defined(n)&&(r.removeAndDestroy(n.modelPrimitive),delete i[t.id])}function clearNodeTransformationsArticulationsScratch(e,t){var i=t[e.id];defined(i)&&(i.nodeTransformationsScratch={},i.articulationsScratch={})}function checkModelLoad(e,t,i){e.readyPromise.otherwise((function(e){console.error(e),i[t.id].loadFail=!0}))}function ScaledPositionProperty(e){this._definitionChanged=new Event,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}ModelVisualizer.prototype.update=function(e){for(var t=this._entitiesToVisualize.values,i=this._modelHash,r=this._primitives,n=0,a=t.length;n<a;n++){var o,s,l=t[n],c=l._model,u=i[l.id],d=l.isShowing&&l.isAvailable(e)&&Property.getValueOrDefault(c._show,e,!0);if(d&&(s=l.computeModelMatrix(e,modelMatrixScratch),o=Resource.createIfNeeded(Property.getValueOrUndefined(c._uri,e)),d=defined(s)&&defined(o)),d){var h=defined(u)?u.modelPrimitive:void 0;if(defined(h)&&o.url===u.url||(defined(h)&&(r.removeAndDestroy(h),delete i[l.id]),(h=Model.fromGltf({url:o,incrementallyLoadTextures:Property.getValueOrDefault(c._incrementallyLoadTextures,e,defaultIncrementallyLoadTextures),scene:this._scene})).id=l,r.add(h),u={modelPrimitive:h,url:o.url,animationsRunning:!1,nodeTransformationsScratch:{},articulationsScratch:{},loadFail:!1},i[l.id]=u,checkModelLoad(h,l,i)),h.show=!0,h.scale=Property.getValueOrDefault(c._scale,e,defaultScale),h.minimumPixelSize=Property.getValueOrDefault(c._minimumPixelSize,e,defaultMinimumPixelSize),h.maximumScale=Property.getValueOrUndefined(c._maximumScale,e),h.modelMatrix=Matrix4.clone(s,h.modelMatrix),h.shadows=Property.getValueOrDefault(c._shadows,e,defaultShadows$1),h.heightReference=Property.getValueOrDefault(c._heightReference,e,defaultHeightReference),h.distanceDisplayCondition=Property.getValueOrUndefined(c._distanceDisplayCondition,e),h.silhouetteColor=Property.getValueOrDefault(c._silhouetteColor,e,defaultSilhouetteColor,h._silhouetteColor),h.silhouetteSize=Property.getValueOrDefault(c._silhouetteSize,e,defaultSilhouetteSize),h.color=Property.getValueOrDefault(c._color,e,defaultColor$2,h._color),h.colorBlendMode=Property.getValueOrDefault(c._colorBlendMode,e,defaultColorBlendMode),h.colorBlendAmount=Property.getValueOrDefault(c._colorBlendAmount,e,defaultColorBlendAmount),h.clippingPlanes=Property.getValueOrUndefined(c._clippingPlanes,e),h.clampAnimations=Property.getValueOrDefault(c._clampAnimations,e,defaultClampAnimations),h.imageBasedLightingFactor=Property.getValueOrDefault(c._imageBasedLightingFactor,e,defaultImageBasedLightingFactor),h.lightColor=Property.getValueOrUndefined(c._lightColor,e),h.ready){var p=Property.getValueOrDefault(c._runAnimations,e,!0);u.animationsRunning!==p&&(p?h.activeAnimations.addAll({loop:ModelAnimationLoop$1.REPEAT}):h.activeAnimations.removeAll(),u.animationsRunning=p);var f=Property.getValueOrUndefined(c._nodeTransformations,e,u.nodeTransformationsScratch);if(defined(f))for(var m=Object.keys(f),g=0,_=m.length;g<_;++g){var y=m[g],v=f[y];if(defined(v)){var C=h.getNode(y);if(defined(C)){var T=Matrix4.fromTranslationRotationScale(v,nodeMatrixScratch);C.matrix=Matrix4.multiply(C.originalMatrix,T,T)}}}var S=!1,A=Property.getValueOrUndefined(c._articulations,e,u.articulationsScratch);if(defined(A))for(var x=Object.keys(A),E=0,b=x.length;E<b;++E){var P=x[E],D=A[P];defined(D)&&(S=!0,h.setArticulationStage(P,D))}S&&h.applyArticulations()}}else defined(u)&&(u.modelPrimitive.show=!1)}return!0},ModelVisualizer.prototype.isDestroyed=function(){return!1},ModelVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(ModelVisualizer.prototype._onCollectionChanged,this);for(var e=this._entitiesToVisualize.values,t=this._modelHash,i=this._primitives,r=e.length-1;r>-1;r--)removeModel(this,e[r],t,i);return destroyObject(this)},ModelVisualizer.prototype.getBoundingSphere=function(e,t){var i=this._modelHash[e.id];if(!defined(i)||i.loadFail)return BoundingSphereState$1.FAILED;var r=i.modelPrimitive;if(!defined(r)||!r.show)return BoundingSphereState$1.FAILED;if(!r.ready)return BoundingSphereState$1.PENDING;if(r.heightReference===HeightReference$1.NONE)BoundingSphere.transform(r.boundingSphere,r.modelMatrix,t);else{if(!defined(r._clampedModelMatrix))return BoundingSphereState$1.PENDING;BoundingSphere.transform(r.boundingSphere,r._clampedModelMatrix,t)}return BoundingSphereState$1.DONE},ModelVisualizer.prototype._onCollectionChanged=function(e,t,i,r){var n,a,o=this._entitiesToVisualize,s=this._modelHash,l=this._primitives;for(n=t.length-1;n>-1;n--)defined((a=t[n])._model)&&defined(a._position)&&o.set(a.id,a);for(n=r.length-1;n>-1;n--)defined((a=r[n])._model)&&defined(a._position)?(clearNodeTransformationsArticulationsScratch(a,s),o.set(a.id,a)):(removeModel(this,a,s,l),o.remove(a.id));for(n=i.length-1;n>-1;n--)removeModel(this,a=i[n],s,l),o.remove(a.id)},Object.defineProperties(ScaledPositionProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return defined(this._value)?this._value.referenceFrame:ReferenceFrame$1.FIXED}}}),ScaledPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},ScaledPositionProperty.prototype.setValue=function(e){this._value!==e&&(this._value=e,defined(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),defined(e)&&(this._removeSubscription=e.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))},ScaledPositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){if(defined(this._value))return defined(i=this._value.getValueInReferenceFrame(e,t,i))?Ellipsoid.WGS84.scaleToGeodeticSurface(i,i):void 0},ScaledPositionProperty.prototype.equals=function(e){return this===e||e instanceof ScaledPositionProperty&&this._value===e._value},ScaledPositionProperty.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var defaultResolution=60,defaultWidth=1,scratchTimeInterval=new TimeInterval,subSampleCompositePropertyScratch=new TimeInterval,subSampleIntervalPropertyScratch=new TimeInterval;function EntityData$1(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function subSampleSampledProperty(e,t,i,r,n,a,o,s,l){var c,u=s;defined(c=e.getValueInReferenceFrame(t,a,l[u]))&&(l[u++]=c);for(var d,h,p,f=!defined(n)||JulianDate.lessThanOrEquals(n,t)||JulianDate.greaterThanOrEquals(n,i),m=0,g=r.length,_=r[m],y=i,v=!1;m<g;){if(!f&&JulianDate.greaterThanOrEquals(_,n)&&(defined(c=e.getValueInReferenceFrame(n,a,l[u]))&&(l[u++]=c),f=!0),JulianDate.greaterThan(_,t)&&JulianDate.lessThan(_,y)&&!_.equals(n)&&defined(c=e.getValueInReferenceFrame(_,a,l[u]))&&(l[u++]=c),m<g-1){if(o>0&&!v){var C=r[m+1],T=JulianDate.secondsDifference(C,_);(v=T>o)&&(d=Math.ceil(T/o),h=0,p=T/Math.max(d,2),d=Math.max(d-1,1))}if(v&&h<d){_=JulianDate.addSeconds(_,p,new JulianDate),h++;continue}}v=!1,_=r[++m]}return defined(c=e.getValueInReferenceFrame(i,a,l[u]))&&(l[u++]=c),u}function subSampleGenericProperty(e,t,i,r,n,a,o,s){for(var l,c=0,u=o,d=t,h=Math.max(a,60),p=!defined(r)||JulianDate.lessThanOrEquals(r,t)||JulianDate.greaterThanOrEquals(r,i);JulianDate.lessThan(d,i);)!p&&JulianDate.greaterThanOrEquals(d,r)&&(p=!0,defined(l=e.getValueInReferenceFrame(r,n,s[u]))&&(s[u]=l,u++)),defined(l=e.getValueInReferenceFrame(d,n,s[u]))&&(s[u]=l,u++),c++,d=JulianDate.addSeconds(t,h*c,new JulianDate);return defined(l=e.getValueInReferenceFrame(i,n,s[u]))&&(s[u]=l,u++),u}function subSampleIntervalProperty(e,t,i,r,n,a,o,s){subSampleIntervalPropertyScratch.start=t,subSampleIntervalPropertyScratch.stop=i;for(var l=o,c=e.intervals,u=0;u<c.length;u++){var d=c.get(u);if(!TimeInterval.intersect(d,subSampleIntervalPropertyScratch,scratchTimeInterval).isEmpty){var h=d.start;d.isStartIncluded||(h=d.isStopIncluded?d.stop:JulianDate.addSeconds(d.start,JulianDate.secondsDifference(d.stop,d.start)/2,new JulianDate));var p=e.getValueInReferenceFrame(h,n,s[l]);defined(p)&&(s[l]=p,l++)}}return l}function subSampleConstantProperty(e,t,i,r,n,a,o,s){var l=e.getValueInReferenceFrame(t,n,s[o]);return defined(l)&&(s[o++]=l),o}function subSampleCompositeProperty(e,t,i,r,n,a,o,s){subSampleCompositePropertyScratch.start=t,subSampleCompositePropertyScratch.stop=i;for(var l=o,c=e.intervals,u=0;u<c.length;u++){var d=c.get(u);if(!TimeInterval.intersect(d,subSampleCompositePropertyScratch,scratchTimeInterval).isEmpty){var h=d.start,p=d.stop,f=t;JulianDate.greaterThan(h,f)&&(f=h);var m=i;JulianDate.lessThan(p,m)&&(m=p),l=reallySubSample(d.data,f,m,r,n,a,l,s)}}return l}function reallySubSample(e,t,i,r,n,a,o,s){for(;e instanceof ReferenceProperty;)e=e.resolvedProperty;e instanceof SampledPositionProperty?o=subSampleSampledProperty(e,t,i,e._property._times,r,n,a,o,s):o=e instanceof CompositePositionProperty?subSampleCompositeProperty(e,t,i,r,n,a,o,s):e instanceof TimeIntervalCollectionPositionProperty?subSampleIntervalProperty(e,t,i,r,n,a,o,s):e instanceof ConstantPositionProperty||e instanceof ScaledPositionProperty&&Property.isConstant(e)?subSampleConstantProperty(e,t,i,r,n,a,o,s):subSampleGenericProperty(e,t,i,r,n,a,o,s);return o}function subSample(e,t,i,r,n,a,o){defined(o)||(o=[]);var s=reallySubSample(e,t,i,r,n,a,0,o);return o.length=s,o}var toFixedScratch=new Matrix3;function PolylineUpdater(e,t){this._unusedIndexes=[],this._polylineCollection=new PolylineCollection,this._scene=e,this._referenceFrame=t,e.primitives.add(this._polylineCollection)}function PathVisualizer(e,t){t.collectionChanged.addEventListener(PathVisualizer.prototype._onCollectionChanged,this),this._scene=e,this._updaters={},this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}PolylineUpdater.prototype.update=function(e){if(this._referenceFrame===ReferenceFrame$1.INERTIAL){var t=Transforms.computeIcrfToFixedMatrix(e,toFixedScratch);defined(t)||(t=Transforms.computeTemeToPseudoFixedMatrix(e,toFixedScratch)),Matrix4.fromRotationTranslation(t,Cartesian3.ZERO,this._polylineCollection.modelMatrix)}},PolylineUpdater.prototype.updateObject=function(e,t){var i,r,n=t.entity,a=n._path,o=n._position,s=a._show,l=t.polyline,c=n.isShowing&&(!defined(s)||s.getValue(e));if(c){var u=Property.getValueOrUndefined(a._leadTime,e),d=Property.getValueOrUndefined(a._trailTime,e),h=n._availability,p=defined(h),f=defined(u),m=defined(d);if(c=p||f&&m){if(m&&(i=JulianDate.addSeconds(e,-d,new JulianDate)),f&&(r=JulianDate.addSeconds(e,u,new JulianDate)),p){var g=h.start,_=h.stop;m&&!JulianDate.greaterThan(g,i)||(i=g),f&&!JulianDate.lessThan(_,r)||(r=_)}c=JulianDate.lessThan(i,r)}}if(c){if(!defined(l)){var y=this._unusedIndexes;if(y.length>0){var v=y.pop();l=this._polylineCollection.get(v),t.index=v}else t.index=this._polylineCollection.length,l=this._polylineCollection.add();l.id=n,t.polyline=l}var C=Property.getValueOrDefault(a._resolution,e,defaultResolution);l.show=!0,l.positions=subSample(o,i,r,e,this._referenceFrame,C,l.positions.slice()),l.material=MaterialProperty.getValue(e,a._material,l.material),l.width=Property.getValueOrDefault(a._width,e,defaultWidth),l.distanceDisplayCondition=Property.getValueOrUndefined(a._distanceDisplayCondition,e,l.distanceDisplayCondition)}else defined(l)&&(this._unusedIndexes.push(t.index),t.polyline=void 0,l.show=!1,t.index=void 0)},PolylineUpdater.prototype.removeObject=function(e){var t=e.polyline;defined(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,t.id=void 0,e.index=void 0)},PolylineUpdater.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),destroyObject(this)},PathVisualizer.prototype.update=function(e){var t=this._updaters;for(var i in t)t.hasOwnProperty(i)&&t[i].update(e);var r=this._items.values;if(0===r.length&&defined(this._updaters)&&Object.keys(this._updaters).length>0){for(var n in t)t.hasOwnProperty(n)&&t[n].destroy();this._updaters={}}for(var a=0,o=r.length;a<o;a++){var s=r[a],l=s.entity._position,c=s.updater,u=ReferenceFrame$1.FIXED;this._scene.mode===SceneMode$1.SCENE3D&&(u=l.referenceFrame);var d=this._updaters[u];c===d&&defined(d)?d.updateObject(e,s):(defined(c)&&c.removeObject(s),defined(d)||((d=new PolylineUpdater(this._scene,u)).update(e),this._updaters[u]=d),s.updater=d,defined(d)&&d.updateObject(e,s))}return!0},PathVisualizer.prototype.isDestroyed=function(){return!1},PathVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(PathVisualizer.prototype._onCollectionChanged,this);var e=this._updaters;for(var t in e)e.hasOwnProperty(t)&&e[t].destroy();return destroyObject(this)},PathVisualizer.prototype._onCollectionChanged=function(e,t,i,r){var n,a,o,s=this._items;for(n=t.length-1;n>-1;n--)defined((a=t[n])._path)&&defined(a._position)&&s.set(a.id,new EntityData$1(a));for(n=r.length-1;n>-1;n--)defined((a=r[n])._path)&&defined(a._position)?s.contains(a.id)||s.set(a.id,new EntityData$1(a)):defined(o=s.get(a.id))&&(defined(o.updater)&&o.updater.removeObject(o),s.remove(a.id));for(n=i.length-1;n>-1;n--)a=i[n],defined(o=s.get(a.id))&&(defined(o.updater)&&o.updater.removeObject(o),s.remove(a.id))},PathVisualizer._subSample=subSample;var defaultColor$1=Color.WHITE,defaultOutlineColor=Color.BLACK,defaultOutlineWidth=0,defaultPixelSize=1,defaultDisableDepthTestDistance=0,colorScratch$1=new Color,positionScratch=new Cartesian3,outlineColorScratch=new Color,scaleByDistanceScratch=new NearFarScalar,translucencyByDistanceScratch=new NearFarScalar,distanceDisplayConditionScratch$1=new DistanceDisplayCondition;function EntityData(e){this.entity=e,this.pointPrimitive=void 0,this.billboard=void 0,this.color=void 0,this.outlineColor=void 0,this.pixelSize=void 0,this.outlineWidth=void 0}function PointVisualizer(e,t){t.collectionChanged.addEventListener(PointVisualizer.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function returnPrimitive(e,t,i){if(defined(e)){if(defined(e.pointPrimitive))return e.pointPrimitive=void 0,void i.removePoint(t);defined(e.billboard)&&(e.billboard=void 0,i.removeBillboard(t))}}PointVisualizer.prototype.update=function(e){for(var t=this._items.values,i=this._cluster,r=0,n=t.length;r<n;r++){var a,o=t[r],s=o.entity,l=s._point,c=o.pointPrimitive,u=o.billboard,d=Property.getValueOrDefault(l._heightReference,e,HeightReference$1.NONE),h=s.isShowing&&s.isAvailable(e)&&Property.getValueOrDefault(l._show,e,!0);if(h&&(h=defined(a=Property.getValueOrUndefined(s._position,e,positionScratch))),h){Property.isConstant(s._position)||(i._clusterDirty=!0);var p=!1,f=!1;if(d===HeightReference$1.NONE||defined(u)?d!==HeightReference$1.NONE||defined(c)||(defined(u)&&(returnPrimitive(o,s,i),u=void 0),(c=i.getPoint(s)).id=s,o.pointPrimitive=c):(defined(c)&&(returnPrimitive(o,s,i),c=void 0),(u=i.getBillboard(s)).id=s,u.image=void 0,o.billboard=u,p=!0,f=Cartesian3.equals(u.position,a)&&u.heightReference===d),defined(c))c.show=!0,c.position=a,c.scaleByDistance=Property.getValueOrUndefined(l._scaleByDistance,e,scaleByDistanceScratch),c.translucencyByDistance=Property.getValueOrUndefined(l._translucencyByDistance,e,translucencyByDistanceScratch),c.color=Property.getValueOrDefault(l._color,e,defaultColor$1,colorScratch$1),c.outlineColor=Property.getValueOrDefault(l._outlineColor,e,defaultOutlineColor,outlineColorScratch),c.outlineWidth=Property.getValueOrDefault(l._outlineWidth,e,defaultOutlineWidth),c.pixelSize=Property.getValueOrDefault(l._pixelSize,e,defaultPixelSize),c.distanceDisplayCondition=Property.getValueOrUndefined(l._distanceDisplayCondition,e,distanceDisplayConditionScratch$1),c.disableDepthTestDistance=Property.getValueOrDefault(l._disableDepthTestDistance,e,defaultDisableDepthTestDistance);else if(defined(u)){u.show=!0,u.position=a,u.scaleByDistance=Property.getValueOrUndefined(l._scaleByDistance,e,scaleByDistanceScratch),u.translucencyByDistance=Property.getValueOrUndefined(l._translucencyByDistance,e,translucencyByDistanceScratch),u.distanceDisplayCondition=Property.getValueOrUndefined(l._distanceDisplayCondition,e,distanceDisplayConditionScratch$1),u.disableDepthTestDistance=Property.getValueOrDefault(l._disableDepthTestDistance,e,defaultDisableDepthTestDistance),u.heightReference=d;var m=Property.getValueOrDefault(l._color,e,defaultColor$1,colorScratch$1),g=Property.getValueOrDefault(l._outlineColor,e,defaultOutlineColor,outlineColorScratch),_=Math.round(Property.getValueOrDefault(l._outlineWidth,e,defaultOutlineWidth)),y=Math.max(1,Math.round(Property.getValueOrDefault(l._pixelSize,e,defaultPixelSize)));if(_>0?(u.scale=1,p=p||_!==o.outlineWidth||y!==o.pixelSize||!Color.equals(m,o.color)||!Color.equals(g,o.outlineColor)):(u.scale=y/50,y=50,p=p||_!==o.outlineWidth||!Color.equals(m,o.color)||!Color.equals(g,o.outlineColor)),p){o.color=Color.clone(m,o.color),o.outlineColor=Color.clone(g,o.outlineColor),o.pixelSize=y,o.outlineWidth=_;var v=m.alpha,C=m.toCssColorString(),T=g.toCssColorString(),S=JSON.stringify([C,y,T,_]);u.setImage(S,createBillboardPointCallback(v,C,T,_,y))}f&&u._updateClamping()}}else returnPrimitive(o,s,i)}return!0},PointVisualizer.prototype.getBoundingSphere=function(e,t){var i=this._items.get(e.id);if(!defined(i)||!defined(i.pointPrimitive)&&!defined(i.billboard))return BoundingSphereState$1.FAILED;if(defined(i.pointPrimitive))t.center=Cartesian3.clone(i.pointPrimitive.position,t.center);else{var r=i.billboard;if(!defined(r._clampedPosition))return BoundingSphereState$1.PENDING;t.center=Cartesian3.clone(r._clampedPosition,t.center)}return t.radius=0,BoundingSphereState$1.DONE},PointVisualizer.prototype.isDestroyed=function(){return!1},PointVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(PointVisualizer.prototype._onCollectionChanged,this);for(var e=this._entityCollection.values,t=0;t<e.length;t++)this._cluster.removePoint(e[t]);return destroyObject(this)},PointVisualizer.prototype._onCollectionChanged=function(e,t,i,r){var n,a,o=this._items,s=this._cluster;for(n=t.length-1;n>-1;n--)defined((a=t[n])._point)&&defined(a._position)&&o.set(a.id,new EntityData(a));for(n=r.length-1;n>-1;n--)defined((a=r[n])._point)&&defined(a._position)?o.contains(a.id)||o.set(a.id,new EntityData(a)):(returnPrimitive(o.get(a.id),a,s),o.remove(a.id));for(n=i.length-1;n>-1;n--)a=i[n],returnPrimitive(o.get(a.id),a,s),o.remove(a.id)};var defaultZIndex=new ConstantProperty(0),polylineCollections={},scratchColor$4=new Color,defaultMaterial=new ColorMaterialProperty(Color.WHITE),defaultShow=new ConstantProperty(!0),defaultShadows=new ConstantProperty(ShadowMode$1.DISABLED),defaultDistanceDisplayCondition$1=new ConstantProperty(new DistanceDisplayCondition),defaultClassificationType=new ConstantProperty(ClassificationType$1.BOTH);function GeometryOptions(){this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function GroundGeometryOptions(){this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function PolylineGeometryUpdater(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(PolylineGeometryUpdater.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new Event,this._showProperty=void 0,this._materialProperty=void 0,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._depthFailMaterialProperty=void 0,this._geometryOptions=new GeometryOptions,this._groundGeometryOptions=new GroundGeometryOptions,this._id="polyline-"+e.id,this._clampToGround=!1,this._supportsPolylinesOnTerrain=Entity.supportsPolylinesOnTerrain(t),this._zIndex=0,this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}Object.defineProperties(PolylineGeometryUpdater.prototype,{id:{get:function(){return this._id}},entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!defined(this._entity.availability)&&Property.isConstant(this._showProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},depthFailMaterialProperty:{get:function(){return this._depthFailMaterialProperty}},outlineEnabled:{value:!1},hasConstantOutline:{value:!0},outlineColorProperty:{value:void 0},shadowsProperty:{get:function(){return this._shadowsProperty}},distanceDisplayConditionProperty:{get:function(){return this._distanceDisplayConditionProperty}},classificationTypeProperty:{get:function(){return this._classificationTypeProperty}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!1},geometryChanged:{get:function(){return this._geometryChanged}},arcType:{get:function(){return this._arcType}},clampToGround:{get:function(){return this._clampToGround&&this._supportsPolylinesOnTerrain}},zIndex:{get:function(){return this._zIndex}}}),PolylineGeometryUpdater.prototype.isOutlineVisible=function(e){return!1},PolylineGeometryUpdater.prototype.isFilled=function(e){var t=this._entity;return defaultValue(this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e),!1)},PolylineGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n=new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),o={show:n,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a)};return this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$4)),defined(t)||(t=Color.WHITE),o.color=ColorGeometryInstanceAttribute.fromColor(t)),this.clampToGround?new GeometryInstance({id:i,geometry:new GroundPolylineGeometry(this._groundGeometryOptions),attributes:o}):(defined(this._depthFailMaterialProperty)&&this._depthFailMaterialProperty instanceof ColorMaterialProperty&&(defined(this._depthFailMaterialProperty.color)&&(this._depthFailMaterialProperty.color.isConstant||r)&&(t=this._depthFailMaterialProperty.color.getValue(e,scratchColor$4)),defined(t)||(t=Color.WHITE),o.depthFailColor=ColorGeometryInstanceAttribute.fromColor(t)),new GeometryInstance({id:i,geometry:new PolylineGeometry(this._geometryOptions),attributes:o}))},PolylineGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){},PolylineGeometryUpdater.prototype.isDestroyed=function(){return!1},PolylineGeometryUpdater.prototype.destroy=function(){this._entitySubscription(),destroyObject(this)},PolylineGeometryUpdater.prototype._onEntityPropertyChanged=function(e,t,i,r){if("availability"===t||"polyline"===t){var n=this._entity.polyline;if(defined(n)){var a=n.positions,o=n.show;if(defined(o)&&o.isConstant&&!o.getValue(Iso8601.MINIMUM_VALUE)||!defined(a))this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));else{var s=n.zIndex,l=defaultValue(n.material,defaultMaterial),c=l instanceof ColorMaterialProperty;this._materialProperty=l,this._depthFailMaterialProperty=n.depthFailMaterial,this._showProperty=defaultValue(o,defaultShow),this._shadowsProperty=defaultValue(n.shadows,defaultShadows),this._distanceDisplayConditionProperty=defaultValue(n.distanceDisplayCondition,defaultDistanceDisplayCondition$1),this._classificationTypeProperty=defaultValue(n.classificationType,defaultClassificationType),this._fillEnabled=!0,this._zIndex=defaultValue(s,defaultZIndex);var u=n.width,d=n.arcType,h=n.clampToGround,p=n.granularity;if(a.isConstant&&Property.isConstant(u)&&Property.isConstant(d)&&Property.isConstant(p)&&Property.isConstant(h)&&Property.isConstant(s)){var f,m=this._geometryOptions,g=a.getValue(Iso8601.MINIMUM_VALUE,m.positions);if(!defined(g)||g.length<2)return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));f=c&&(!defined(this._depthFailMaterialProperty)||this._depthFailMaterialProperty instanceof ColorMaterialProperty)?PolylineColorAppearance.VERTEX_FORMAT:PolylineMaterialAppearance.VERTEX_FORMAT,m.vertexFormat=f,m.positions=g,m.width=defined(u)?u.getValue(Iso8601.MINIMUM_VALUE):void 0,m.arcType=defined(d)?d.getValue(Iso8601.MINIMUM_VALUE):void 0,m.granularity=defined(p)?p.getValue(Iso8601.MINIMUM_VALUE):void 0;var _=this._groundGeometryOptions;_.positions=g,_.width=m.width,_.arcType=m.arcType,_.granularity=m.granularity,this._clampToGround=!!defined(h)&&h.getValue(Iso8601.MINIMUM_VALUE),!this._clampToGround&&defined(s)&&oneTimeWarning("Entity polylines must have clampToGround: true when using zIndex. zIndex will be ignored."),this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}}else this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this))}},PolylineGeometryUpdater.prototype.createDynamicUpdater=function(e,t){return new DynamicGeometryUpdater(e,t,this)};var generateCartesianArcOptions={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};function DynamicGeometryUpdater(e,t,i){this._line=void 0,this._primitives=e,this._groundPrimitives=t,this._groundPolylinePrimitive=void 0,this._material=void 0,this._geometryUpdater=i,this._positions=[]}function getLine(e){if(defined(e._line))return e._line;var t=e._geometryUpdater._scene.id,i=polylineCollections[t],r=e._primitives;!defined(i)||i.isDestroyed()?(i=new PolylineCollection,polylineCollections[t]=i,r.add(i)):r.contains(i)||r.add(i);var n=i.add();return n.id=e._geometryUpdater._entity,e._line=n,n}DynamicGeometryUpdater.prototype.update=function(e){var t=this._geometryUpdater,i=t._entity,r=i.polyline,n=r.positions,a=Property.getValueOrUndefined(n,e,this._positions);t._clampToGround=Property.getValueOrDefault(r._clampToGround,e,!1),t._groundGeometryOptions.positions=a,t._groundGeometryOptions.width=Property.getValueOrDefault(r._width,e,1),t._groundGeometryOptions.arcType=Property.getValueOrDefault(r._arcType,e,ArcType$1.GEODESIC),t._groundGeometryOptions.granularity=Property.getValueOrDefault(r._granularity,e,9999);var o=this._groundPrimitives;if(defined(this._groundPolylinePrimitive)&&(o.remove(this._groundPolylinePrimitive),this._groundPolylinePrimitive=void 0),t.clampToGround){if(!i.isShowing||!i.isAvailable(e)||!Property.getValueOrDefault(r._show,e,!0))return;if(!defined(a)||a.length<2)return;var s,l=t.fillMaterialProperty;if(l instanceof ColorMaterialProperty)s=new PolylineColorAppearance;else{var c=MaterialProperty.getValue(e,l,this._material);s=new PolylineMaterialAppearance({material:c,translucent:c.isTranslucent()}),this._material=c}return this._groundPolylinePrimitive=o.add(new GroundPolylinePrimitive({geometryInstances:t.createFillGeometryInstance(e),appearance:s,classificationType:t.classificationTypeProperty.getValue(e),asynchronous:!1}),Property.getValueOrUndefined(t.zIndex,e)),void(defined(this._line)&&(this._line.show=!1))}var u=getLine(this);if(i.isShowing&&i.isAvailable(e)&&Property.getValueOrDefault(r._show,e,!0))if(!defined(a)||a.length<2)u.show=!1;else{var d=ArcType$1.GEODESIC;d=Property.getValueOrDefault(r._arcType,e,d);var h=t._scene.globe;d!==ArcType$1.NONE&&defined(h)&&(generateCartesianArcOptions.ellipsoid=h.ellipsoid,generateCartesianArcOptions.positions=a,generateCartesianArcOptions.granularity=Property.getValueOrUndefined(r._granularity,e),generateCartesianArcOptions.height=PolylinePipeline.extractHeights(a,h.ellipsoid),a=d===ArcType$1.GEODESIC?PolylinePipeline.generateCartesianArc(generateCartesianArcOptions):PolylinePipeline.generateCartesianRhumbArc(generateCartesianArcOptions)),u.show=!0,u.positions=a.slice(),u.material=MaterialProperty.getValue(e,t.fillMaterialProperty,u.material),u.width=Property.getValueOrDefault(r._width,e,1),u.distanceDisplayCondition=Property.getValueOrUndefined(r._distanceDisplayCondition,e,u.distanceDisplayCondition)}else u.show=!1},DynamicGeometryUpdater.prototype.getBoundingSphere=function(e){if(this._geometryUpdater.clampToGround){var t=this._groundPolylinePrimitive;if(defined(t)&&t.show&&t.ready){var i=t.getGeometryInstanceAttributes(this._geometryUpdater._entity);if(defined(i)&&defined(i.boundingSphere))return BoundingSphere.clone(i.boundingSphere,e),BoundingSphereState$1.DONE}return defined(t)&&!t.ready?BoundingSphereState$1.PENDING:BoundingSphereState$1.DONE}var r=getLine(this);return r.show&&r.positions.length>0?(BoundingSphere.fromPoints(r.positions,e),BoundingSphereState$1.DONE):BoundingSphereState$1.FAILED},DynamicGeometryUpdater.prototype.isDestroyed=function(){return!1},DynamicGeometryUpdater.prototype.destroy=function(){var e=this._geometryUpdater._scene.id,t=polylineCollections[e];defined(t)&&(t.remove(this._line),0===t.length&&(this._primitives.removeAndDestroy(t),delete polylineCollections[e])),defined(this._groundPolylinePrimitive)&&this._groundPrimitives.remove(this._groundPolylinePrimitive),destroyObject(this)};var scratchColor$3=new Color,distanceDisplayConditionScratch=new DistanceDisplayCondition,defaultDistanceDisplayCondition=new DistanceDisplayCondition;function Batch(e,t,i,r,n){var a;a=i instanceof ColorMaterialProperty?PolylineColorAppearance:PolylineMaterialAppearance,this.orderedGroundPrimitives=e,this.classificationType=t,this.appearanceType=a,this.materialProperty=i,this.updaters=new AssociativeArray,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.material=void 0,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(Batch.prototype.onMaterialChanged,this),this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.zIndex=r,this._asynchronous=n}function StaticGroundPolylinePerMaterialBatch(e,t,i){this._items=[],this._orderedGroundPrimitives=e,this._classificationType=t,this._asynchronous=defaultValue(i,!0)}Batch.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch.prototype.isMaterial=function(e){var t=this.materialProperty,i=e.fillMaterialProperty;return i===t||i instanceof ColorMaterialProperty&&t instanceof ColorMaterialProperty||defined(t)&&t.equals(i)},Batch.prototype.add=function(e,t,i){var r=t.id;if(this.updaters.set(r,t),this.geometry.set(r,i),t.hasConstantFill&&t.fillMaterialProperty.isConstant&&Property.isConstant(t.distanceDisplayConditionProperty)){var n=this;this.subscriptions.set(r,t.entity.definitionChanged.addEventListener((function(e,i,r,a){"isShowing"===i&&n.showsUpdated.set(t.id,t)})))}else this.updatersWithAttributes.set(r,t);this.createPrimitive=!0},Batch.prototype.remove=function(e){var t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);return defined(i)&&(i(),this.subscriptions.remove(t)),!0}return!1},Batch.prototype.update=function(e){var t,i=!0,r=this.primitive,n=this.orderedGroundPrimitives,a=this.geometry.values;if(this.createPrimitive){if(a.length>0)defined(r)&&(defined(this.oldPrimitive)?n.remove(r):this.oldPrimitive=r),r=new GroundPolylinePrimitive({show:!1,asynchronous:this._asynchronous,geometryInstances:a.slice(),appearance:new this.appearanceType,classificationType:this.classificationType}),this.appearanceType===PolylineMaterialAppearance&&(this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),r.appearance.material=this.material),n.add(r,this.zIndex),i=!1;else{defined(r)&&(n.remove(r),r=void 0);var o=this.oldPrimitive;defined(o)&&(n.remove(o),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=r,this.createPrimitive=!1}else if(defined(r)&&r.ready){r.show=!0,defined(this.oldPrimitive)&&(n.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.appearanceType===PolylineMaterialAppearance&&(this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material);var s=this.updatersWithAttributes.values,l=s.length;for(t=0;t<l;t++){var c=s[t],u=c.entity,d=this.geometry.get(c.id),h=this.attributes.get(d.id.id);if(defined(h)||(h=r.getGeometryInstanceAttributes(d.id),this.attributes.set(d.id.id,h)),!c.fillMaterialProperty.isConstant){var p=c.fillMaterialProperty.color,f=Property.getValueOrDefault(p,e,Color.WHITE,scratchColor$3);Color.equals(h._lastColor,f)||(h._lastColor=Color.clone(f,h._lastColor),h.color=ColorGeometryInstanceAttribute.toValue(f,h.color))}var m=u.isShowing&&(c.hasConstantFill||c.isFilled(e));m!==(1===h.show[0])&&(h.show=ShowGeometryInstanceAttribute.toValue(m,h.show));var g=c.distanceDisplayConditionProperty;if(!Property.isConstant(g)){var _=Property.getValueOrDefault(g,e,defaultDistanceDisplayCondition,distanceDisplayConditionScratch);DistanceDisplayCondition.equals(_,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(_,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(_,h.distanceDisplayCondition))}}this.updateShows(r)}else defined(r)&&!r.ready&&(i=!1);return i},Batch.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,r=0;r<i;r++){var n=t[r],a=n.entity,o=this.geometry.get(n.id),s=this.attributes.get(o.id.id);defined(s)||(s=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,s));var l=a.isShowing;l!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(l,s.show),o.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()},Batch.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;var r=i.getGeometryInstanceAttributes(e.entity);return!defined(r)||!defined(r.boundingSphere)||defined(r.show)&&0===r.show[0]?BoundingSphereState$1.FAILED:(r.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch.prototype.destroy=function(){var e=this.primitive,t=this.orderedGroundPrimitives;defined(e)&&t.remove(e);var i=this.oldPrimitive;defined(i)&&t.remove(i),this.removeMaterialSubscription()},StaticGroundPolylinePerMaterialBatch.prototype.add=function(e,t){for(var i=this._items,r=i.length,n=t.createFillGeometryInstance(e),a=Property.getValueOrDefault(t.zIndex,0),o=0;o<r;++o){var s=i[o];if(s.isMaterial(t)&&s.zIndex===a)return void s.add(e,t,n)}var l=new Batch(this._orderedGroundPrimitives,this._classificationType,t.fillMaterialProperty,a,this._asynchronous);l.add(e,t,n),i.push(l)},StaticGroundPolylinePerMaterialBatch.prototype.remove=function(e){for(var t=this._items,i=t.length-1;i>=0;i--){var r=t[i];if(r.remove(e)){0===r.updaters.length&&(t.splice(i,1),r.destroy());break}}},StaticGroundPolylinePerMaterialBatch.prototype.update=function(e){var t,i=this._items;for(t=i.length-1;t>=0;t--){var r=i[t];if(r.invalidated){i.splice(t,1);for(var n=r.updaters.values,a=n.length,o=0;o<a;o++)this.add(e,n[o]);r.destroy()}}var s=!0;for(t=0;t<i.length;t++)s=i[t].update(e)&&s;return s},StaticGroundPolylinePerMaterialBatch.prototype.getBoundingSphere=function(e,t){for(var i=this._items,r=i.length,n=0;n<r;n++){var a=i[n];if(a.contains(e))return a.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGroundPolylinePerMaterialBatch.prototype.removeAllPrimitives=function(){for(var e=this._items,t=e.length,i=0;i<t;i++)e[i].destroy();this._items.length=0};var emptyArray=[];function removeUpdater(e,t){for(var i=e._batches,r=i.length,n=0;n<r;n++)i[n].remove(t)}function insertUpdaterIntoBatch(e,t,i){if(i.isDynamic)e._dynamicBatch.add(t,i);else if(i.clampToGround&&i.fillEnabled){var r=i.classificationTypeProperty.getValue(t);e._groundBatches[r].add(t,i)}else{var n;i.fillEnabled&&(n=i.shadowsProperty.getValue(t));var a,o=0;defined(i.depthFailMaterialProperty)&&(o=i.depthFailMaterialProperty instanceof ColorMaterialProperty?1:2),defined(n)&&(a=n+o*ShadowMode$1.NUMBER_OF_SHADOW_MODES),i.fillEnabled&&(i.fillMaterialProperty instanceof ColorMaterialProperty?e._colorBatches[a].add(t,i):e._materialBatches[a].add(t,i))}}function PolylineVisualizer(e,t,i,r){var n;r=defaultValue(r,e.groundPrimitives),i=defaultValue(i,e.primitives),this._scene=e,this._primitives=i,this._entityCollection=void 0,this._addedObjects=new AssociativeArray,this._removedObjects=new AssociativeArray,this._changedObjects=new AssociativeArray;var a=ShadowMode$1.NUMBER_OF_SHADOW_MODES;for(this._colorBatches=new Array(3*a),this._materialBatches=new Array(3*a),n=0;n<a;++n)this._colorBatches[n]=new StaticGeometryColorBatch(i,PolylineColorAppearance,void 0,!1,n),this._materialBatches[n]=new StaticGeometryPerMaterialBatch(i,PolylineMaterialAppearance,void 0,!1,n),this._colorBatches[n+a]=new StaticGeometryColorBatch(i,PolylineColorAppearance,PolylineColorAppearance,!1,n),this._materialBatches[n+a]=new StaticGeometryPerMaterialBatch(i,PolylineMaterialAppearance,PolylineColorAppearance,!1,n),this._colorBatches[n+2*a]=new StaticGeometryColorBatch(i,PolylineColorAppearance,PolylineMaterialAppearance,!1,n),this._materialBatches[n+2*a]=new StaticGeometryPerMaterialBatch(i,PolylineMaterialAppearance,PolylineMaterialAppearance,!1,n);this._dynamicBatch=new DynamicGeometryBatch(i,r);var o=ClassificationType$1.NUMBER_OF_CLASSIFICATION_TYPES;for(this._groundBatches=new Array(o),n=0;n<o;++n)this._groundBatches[n]=new StaticGroundPolylinePerMaterialBatch(r,n);this._batches=this._colorBatches.concat(this._materialBatches,this._dynamicBatch,this._groundBatches),this._subscriptions=new AssociativeArray,this._updaters=new AssociativeArray,this._entityCollection=t,t.collectionChanged.addEventListener(PolylineVisualizer.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,emptyArray)}PolylineVisualizer.prototype.update=function(e){var t,i,r,n,a=this._addedObjects,o=a.values,s=this._removedObjects,l=s.values,c=this._changedObjects,u=c.values;for(t=u.length-1;t>-1;t--)r=(i=u[t]).id,(n=this._updaters.get(r)).entity===i?(removeUpdater(this,n),insertUpdaterIntoBatch(this,e,n)):(l.push(i),o.push(i));for(t=l.length-1;t>-1;t--)r=(i=l[t]).id,removeUpdater(this,n=this._updaters.get(r)),n.destroy(),this._updaters.remove(r),this._subscriptions.get(r)(),this._subscriptions.remove(r);for(t=o.length-1;t>-1;t--)r=(i=o[t]).id,n=new PolylineGeometryUpdater(i,this._scene),this._updaters.set(r,n),insertUpdaterIntoBatch(this,e,n),this._subscriptions.set(r,n.geometryChanged.addEventListener(PolylineVisualizer._onGeometryChanged,this));a.removeAll(),s.removeAll(),c.removeAll();var d=!0,h=this._batches,p=h.length;for(t=0;t<p;t++)d=h[t].update(e)&&d;return d};var getBoundingSphereArrayScratch$1=[],getBoundingSphereBoundingSphereScratch$1=new BoundingSphere;function DataSourceDisplay(e){GroundPrimitive.initializeTerrainHeights(),GroundPolylinePrimitive.initializeTerrainHeights();var t=e.scene,i=e.dataSourceCollection;this._eventHelper=new EventHelper,this._eventHelper.add(i.dataSourceAdded,this._onDataSourceAdded,this),this._eventHelper.add(i.dataSourceRemoved,this._onDataSourceRemoved,this),this._eventHelper.add(i.dataSourceMoved,this._onDataSourceMoved,this),this._eventHelper.add(t.postRender,this._postRender,this),this._dataSourceCollection=i,this._scene=t,this._visualizersCallback=defaultValue(e.visualizersCallback,DataSourceDisplay.defaultVisualizersCallback);var r=!1,n=new PrimitiveCollection,a=new PrimitiveCollection;i.length>0&&(t.primitives.add(n),t.groundPrimitives.add(a),r=!0),this._primitives=n,this._groundPrimitives=a;for(var o=0,s=i.length;o<s;o++)this._onDataSourceAdded(i,i.get(o));var l,c,u=new CustomDataSource;if(this._onDataSourceAdded(void 0,u),this._defaultDataSource=u,!r){var d=this,h=function(){t.primitives.add(n),t.groundPrimitives.add(a),l(),c(),d._removeDefaultDataSourceListener=void 0,d._removeDataSourceCollectionListener=void 0};l=u.entities.collectionChanged.addEventListener(h),c=i.dataSourceAdded.addEventListener(h)}this._removeDefaultDataSourceListener=l,this._removeDataSourceCollectionListener=c,this._ready=!1}PolylineVisualizer.prototype.getBoundingSphere=function(e,t){for(var i=getBoundingSphereArrayScratch$1,r=getBoundingSphereBoundingSphereScratch$1,n=0,a=BoundingSphereState$1.DONE,o=this._batches,s=o.length,l=this._updaters.get(e.id),c=0;c<s;c++){if((a=o[c].getBoundingSphere(l,r))===BoundingSphereState$1.PENDING)return BoundingSphereState$1.PENDING;a===BoundingSphereState$1.DONE&&(i[n]=BoundingSphere.clone(r,i[n]),n++)}return 0===n?BoundingSphereState$1.FAILED:(i.length=n,BoundingSphere.fromBoundingSpheres(i,t),BoundingSphereState$1.DONE)},PolylineVisualizer.prototype.isDestroyed=function(){return!1},PolylineVisualizer.prototype.destroy=function(){var e;this._entityCollection.collectionChanged.removeEventListener(PolylineVisualizer.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();var t=this._batches,i=t.length;for(e=0;e<i;e++)t[e].removeAllPrimitives();var r=this._subscriptions.values;for(i=r.length,e=0;e<i;e++)r[e]();return this._subscriptions.removeAll(),destroyObject(this)},PolylineVisualizer._onGeometryChanged=function(e){var t=this._removedObjects,i=this._changedObjects,r=e.entity,n=r.id;defined(t.get(n))||defined(i.get(n))||i.set(n,r)},PolylineVisualizer.prototype._onCollectionChanged=function(e,t,i){var r,n,a,o=this._addedObjects,s=this._removedObjects,l=this._changedObjects;for(r=i.length-1;r>-1;r--)n=(a=i[r]).id,o.remove(n)||(s.set(n,a),l.remove(n));for(r=t.length-1;r>-1;r--)n=(a=t[r]).id,s.remove(n)?l.set(n,a):o.set(n,a)},DataSourceDisplay.defaultVisualizersCallback=function(e,t,i){var r=i.entities;return[new BillboardVisualizer(t,r),new GeometryVisualizer(e,r,i._primitives,i._groundPrimitives),new LabelVisualizer(t,r),new ModelVisualizer(e,r),new Cesium3DTilesetVisualizer(e,r),new PointVisualizer(t,r),new PathVisualizer(e,r),new PolylineVisualizer(e,r,i._primitives,i._groundPrimitives)]},Object.defineProperties(DataSourceDisplay.prototype,{scene:{get:function(){return this._scene}},dataSources:{get:function(){return this._dataSourceCollection}},defaultDataSource:{get:function(){return this._defaultDataSource}},ready:{get:function(){return this._ready}}}),DataSourceDisplay.prototype.isDestroyed=function(){return!1},DataSourceDisplay.prototype.destroy=function(){this._eventHelper.removeAll();for(var e=this._dataSourceCollection,t=0,i=e.length;t<i;++t)this._onDataSourceRemoved(this._dataSourceCollection,e.get(t));return this._onDataSourceRemoved(void 0,this._defaultDataSource),defined(this._removeDefaultDataSourceListener)?(this._removeDefaultDataSourceListener(),this._removeDataSourceCollectionListener()):(this._scene.primitives.remove(this._primitives),this._scene.groundPrimitives.remove(this._groundPrimitives)),destroyObject(this)},DataSourceDisplay.prototype.update=function(e){if(!ApproximateTerrainHeights.initialized)return this._ready=!1,!1;var t,i,r,n,a=!0,o=this._dataSourceCollection,s=o.length;for(t=0;t<s;t++){var l=o.get(t);for(defined(l.update)&&(a=l.update(e)&&a),n=(r=l._visualizers).length,i=0;i<n;i++)a=r[i].update(e)&&a}for(n=(r=this._defaultDataSource._visualizers).length,i=0;i<n;i++)a=r[i].update(e)&&a;return this._ready=a,a},DataSourceDisplay.prototype._postRender=function(){for(var e=this._scene.frameState,t=this._dataSourceCollection,i=t.length,r=0;r<i;r++){var n=t.get(r),a=n.credit;defined(a)&&e.creditDisplay.addCredit(a);var o=n._resourceCredits;if(defined(o))for(var s=o.length,l=0;l<s;l++)e.creditDisplay.addCredit(o[l])}};var getBoundingSphereArrayScratch=[],getBoundingSphereBoundingSphereScratch=new BoundingSphere;DataSourceDisplay.prototype.getBoundingSphere=function(e,t,i){if(!this._ready)return BoundingSphereState$1.PENDING;var r,n,a=this._defaultDataSource;if(!a.entities.contains(e)){a=void 0;var o=this._dataSourceCollection;for(n=o.length,r=0;r<n;r++){var s=o.get(r);if(s.entities.contains(e)){a=s;break}}}if(!defined(a))return BoundingSphereState$1.FAILED;var l=getBoundingSphereArrayScratch,c=getBoundingSphereBoundingSphereScratch,u=0,d=BoundingSphereState$1.DONE,h=a._visualizers,p=h.length;for(r=0;r<p;r++){if(defined(h[r].getBoundingSphere)){if(d=h[r].getBoundingSphere(e,c),!t&&d===BoundingSphereState$1.PENDING)return BoundingSphereState$1.PENDING;d===BoundingSphereState$1.DONE&&(l[u]=BoundingSphere.clone(c,l[u]),u++)}}return 0===u?BoundingSphereState$1.FAILED:(l.length=u,BoundingSphere.fromBoundingSpheres(l,i),BoundingSphereState$1.DONE)},DataSourceDisplay.prototype._onDataSourceAdded=function(e,t){var i=this._scene,r=this._primitives,n=this._groundPrimitives,a=r.add(new PrimitiveCollection),o=n.add(new OrderedGroundPrimitiveCollection);t._primitives=a,t._groundPrimitives=o;var s=t.clustering;s._initialize(i),a.add(s),t._visualizers=this._visualizersCallback(i,s,t)},DataSourceDisplay.prototype._onDataSourceRemoved=function(e,t){var i=this._primitives,r=this._groundPrimitives,n=t._primitives,a=t._groundPrimitives,o=t.clustering;n.remove(o);for(var s=t._visualizers,l=s.length,c=0;c<l;c++)s[c].destroy();i.remove(n),r.remove(a),t._visualizers=void 0},DataSourceDisplay.prototype._onDataSourceMoved=function(e,t,i){var r=this._primitives,n=this._groundPrimitives,a=e._primitives,o=e._groundPrimitives;t===i+1?(r.raise(a),n.raise(o)):t===i-1?(r.lower(a),n.lower(o)):0===t?(r.lowerToBottom(a),n.lowerToBottom(o),r.raise(a),n.raise(o)):(r.raiseToTop(a),n.raiseToTop(o))};var updateTransformMatrix3Scratch1=new Matrix3,updateTransformMatrix3Scratch2=new Matrix3,updateTransformMatrix3Scratch3=new Matrix3,updateTransformMatrix4Scratch=new Matrix4,updateTransformCartesian3Scratch1=new Cartesian3,updateTransformCartesian3Scratch2=new Cartesian3,updateTransformCartesian3Scratch3=new Cartesian3,updateTransformCartesian3Scratch4=new Cartesian3,updateTransformCartesian3Scratch5=new Cartesian3,updateTransformCartesian3Scratch6=new Cartesian3,deltaTime=new JulianDate,northUpAxisFactor=1.25;function updateTransform(e,t,i,r,n,a,o){var s=e.scene.mode,l=n.getValue(a,e._lastCartesian);if(defined(l)){var c,u,d,h,p,f,m=!1,g=!1;if(s===SceneMode$1.SCENE3D){JulianDate.addSeconds(a,.001,deltaTime);var _=n.getValue(deltaTime,updateTransformCartesian3Scratch1);if(defined(_)||(JulianDate.addSeconds(a,-.001,deltaTime),_=n.getValue(deltaTime,updateTransformCartesian3Scratch1),g=!0),defined(_)){var y,v=Transforms.computeFixedToIcrfMatrix(a,updateTransformMatrix3Scratch1),C=Transforms.computeFixedToIcrfMatrix(deltaTime,updateTransformMatrix3Scratch2);defined(v)&&defined(C)?y=Matrix3.transpose(v,updateTransformMatrix3Scratch3):(y=Transforms.computeTemeToPseudoFixedMatrix(a,updateTransformMatrix3Scratch3),v=Matrix3.transpose(y,updateTransformMatrix3Scratch1),C=Transforms.computeTemeToPseudoFixedMatrix(deltaTime,updateTransformMatrix3Scratch2),Matrix3.transpose(C,C));var T=Matrix3.multiplyByVector(v,l,updateTransformCartesian3Scratch5),S=Matrix3.multiplyByVector(C,_,updateTransformCartesian3Scratch6);Cartesian3.subtract(T,S,updateTransformCartesian3Scratch4);var A=1e3*Cartesian3.magnitude(updateTransformCartesian3Scratch4),x=CesiumMath.GRAVITATIONALPARAMETER,E=-x/(A*A-2*x/Cartesian3.magnitude(T));E<0||E>northUpAxisFactor*o.maximumRadius?(c=updateTransformCartesian3Scratch2,Cartesian3.normalize(l,c),Cartesian3.negate(c,c),d=Cartesian3.clone(Cartesian3.UNIT_Z,updateTransformCartesian3Scratch3),u=Cartesian3.cross(d,c,updateTransformCartesian3Scratch1),Cartesian3.magnitude(u)>CesiumMath.EPSILON7&&(Cartesian3.normalize(c,c),Cartesian3.normalize(u,u),d=Cartesian3.cross(c,u,updateTransformCartesian3Scratch3),Cartesian3.normalize(d,d),m=!0)):Cartesian3.equalsEpsilon(l,_,CesiumMath.EPSILON7)||(d=updateTransformCartesian3Scratch2,Cartesian3.normalize(T,d),Cartesian3.normalize(S,S),u=Cartesian3.cross(d,S,updateTransformCartesian3Scratch3),g&&(u=Cartesian3.multiplyByScalar(u,-1,u)),Cartesian3.equalsEpsilon(u,Cartesian3.ZERO,CesiumMath.EPSILON7)||(c=Cartesian3.cross(u,d,updateTransformCartesian3Scratch1),Matrix3.multiplyByVector(y,c,c),Matrix3.multiplyByVector(y,u,u),Matrix3.multiplyByVector(y,d,d),Cartesian3.normalize(c,c),Cartesian3.normalize(u,u),Cartesian3.normalize(d,d),m=!0))}}defined(e.boundingSphere)&&(l=e.boundingSphere.center),r&&(h=Cartesian3.clone(t.position,updateTransformCartesian3Scratch4),p=Cartesian3.clone(t.direction,updateTransformCartesian3Scratch5),f=Cartesian3.clone(t.up,updateTransformCartesian3Scratch6));var b=updateTransformMatrix4Scratch;m?(b[0]=c.x,b[1]=c.y,b[2]=c.z,b[3]=0,b[4]=u.x,b[5]=u.y,b[6]=u.z,b[7]=0,b[8]=d.x,b[9]=d.y,b[10]=d.z,b[11]=0,b[12]=l.x,b[13]=l.y,b[14]=l.z,b[15]=0):Transforms.eastNorthUpToFixedFrame(l,o,b),t._setTransform(b),r&&(Cartesian3.clone(h,t.position),Cartesian3.clone(p,t.direction),Cartesian3.clone(f,t.up),Cartesian3.cross(p,f,t.right))}if(i){var P=s===SceneMode$1.SCENE2D||Cartesian3.equals(e._offset3D,Cartesian3.ZERO)?void 0:e._offset3D;t.lookAtTransform(t.transform,P)}}function EntityView(e,t,i){this.entity=e,this.scene=t,this.ellipsoid=defaultValue(i,Ellipsoid.WGS84),this.boundingSphere=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new Cartesian3,this._defaultOffset3D=void 0,this._offset3D=new Cartesian3}Object.defineProperties(EntityView,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=Cartesian3.clone(e,new Cartesian3)}}}),EntityView.defaultOffset3D=new Cartesian3(-14e3,3500,3500);var scratchHeadingPitchRange=new HeadingPitchRange,scratchCartesian$2=new Cartesian3;EntityView.prototype.update=function(e,t){var i=this.scene,r=this.ellipsoid,n=i.mode;if(n!==SceneMode$1.MORPHING){var a=this.entity,o=a.position;if(defined(o)){var s=a!==this._lastEntity,l=n!==this._mode,c=i.camera,u=s||l,d=!0;if(s){var h=a.viewFrom,p=defined(h);if(!p&&defined(t)){scratchHeadingPitchRange.pitch=-CesiumMath.PI_OVER_FOUR,scratchHeadingPitchRange.range=0;var f=o.getValue(e,scratchCartesian$2);if(defined(f)){var m=2-1/Math.max(1,Cartesian3.magnitude(f)/r.maximumRadius);scratchHeadingPitchRange.pitch*=m}c.viewBoundingSphere(t,scratchHeadingPitchRange),this.boundingSphere=t,u=!1,d=!1}else p&&defined(h.getValue(e,this._offset3D))||Cartesian3.clone(EntityView._defaultOffset3D,this._offset3D)}else l||this._mode===SceneMode$1.SCENE2D||Cartesian3.clone(c.position,this._offset3D);this._lastEntity=a,this._mode=n,updateTransform(this,c,u,d,o,e,r)}}};const MAX_BITS$1=15,D_CODES=30,BL_CODES=19,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,HEAP_SIZE=2*L_CODES+1,END_BLOCK=256,MAX_BL_BITS=7,REP_3_6=16,REPZ_3_10=17,REPZ_11_138=18,Buf_size=16,Z_DEFAULT_COMPRESSION=-1,Z_FILTERED=1,Z_HUFFMAN_ONLY=2,Z_DEFAULT_STRATEGY=0,Z_NO_FLUSH$1=0,Z_PARTIAL_FLUSH=1,Z_FULL_FLUSH=3,Z_FINISH$1=4,Z_OK$1=0,Z_STREAM_END$1=1,Z_NEED_DICT$1=2,Z_STREAM_ERROR$1=-2,Z_DATA_ERROR$1=-3,Z_BUF_ERROR$1=-5;function extractArray(e){return flatArray(e.map((([e,t])=>new Array(e).fill(t,0,e))))}function flatArray(e){return e.reduce(((e,t)=>e.concat(Array.isArray(t)?flatArray(t):t)),[])}const _dist_code=[0,1,2,3].concat(...extractArray([[2,4],[2,5],[4,6],[4,7],[8,8],[8,9],[16,10],[16,11],[32,12],[32,13],[64,14],[64,15],[2,0],[1,16],[1,17],[2,18],[2,19],[4,20],[4,21],[8,22],[8,23],[16,24],[16,25],[32,26],[32,27],[64,28],[64,29]]));function Tree(){const e=this;function t(e,t){let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1}e.build_tree=function(i){const r=e.dyn_tree,n=e.stat_desc.static_tree,a=e.stat_desc.elems;let o,s,l,c=-1;for(i.heap_len=0,i.heap_max=HEAP_SIZE,o=0;o<a;o++)0!==r[2*o]?(i.heap[++i.heap_len]=c=o,i.depth[o]=0):r[2*o+1]=0;for(;i.heap_len<2;)l=i.heap[++i.heap_len]=c<2?++c:0,r[2*l]=1,i.depth[l]=0,i.opt_len--,n&&(i.static_len-=n[2*l+1]);for(e.max_code=c,o=Math.floor(i.heap_len/2);o>=1;o--)i.pqdownheap(r,o);l=a;do{o=i.heap[1],i.heap[1]=i.heap[i.heap_len--],i.pqdownheap(r,1),s=i.heap[1],i.heap[--i.heap_max]=o,i.heap[--i.heap_max]=s,r[2*l]=r[2*o]+r[2*s],i.depth[l]=Math.max(i.depth[o],i.depth[s])+1,r[2*o+1]=r[2*s+1]=l,i.heap[1]=l++,i.pqdownheap(r,1)}while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],function(t){const i=e.dyn_tree,r=e.stat_desc.static_tree,n=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,o=e.stat_desc.max_length;let s,l,c,u,d,h,p=0;for(u=0;u<=MAX_BITS$1;u++)t.bl_count[u]=0;for(i[2*t.heap[t.heap_max]+1]=0,s=t.heap_max+1;s<HEAP_SIZE;s++)l=t.heap[s],u=i[2*i[2*l+1]+1]+1,u>o&&(u=o,p++),i[2*l+1]=u,l>e.max_code||(t.bl_count[u]++,d=0,l>=a&&(d=n[l-a]),h=i[2*l],t.opt_len+=h*(u+d),r&&(t.static_len+=h*(r[2*l+1]+d)));if(0!==p){do{for(u=o-1;0===t.bl_count[u];)u--;t.bl_count[u]--,t.bl_count[u+1]+=2,t.bl_count[o]--,p-=2}while(p>0);for(u=o;0!==u;u--)for(l=t.bl_count[u];0!==l;)c=t.heap[--s],c>e.max_code||(i[2*c+1]!=u&&(t.opt_len+=(u-i[2*c+1])*i[2*c],i[2*c+1]=u),l--)}}(i),function(e,i,r){const n=[];let a,o,s,l=0;for(a=1;a<=MAX_BITS$1;a++)n[a]=l=l+r[a-1]<<1;for(o=0;o<=i;o++)s=e[2*o+1],0!==s&&(e[2*o]=t(n[s]++,s))}(r,e.max_code,i.bl_count)}}function StaticTree(e,t,i,r,n){const a=this;a.static_tree=e,a.extra_bits=t,a.extra_base=i,a.elems=r,a.max_length=n}Tree._length_code=[0,1,2,3,4,5,6,7].concat(...extractArray([[2,8],[2,9],[2,10],[2,11],[4,12],[4,13],[4,14],[4,15],[8,16],[8,17],[8,18],[8,19],[16,20],[16,21],[16,22],[16,23],[32,24],[32,25],[32,26],[31,27],[1,28]])),Tree.base_length=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],Tree.base_dist=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],Tree.d_code=function(e){return e<256?_dist_code[e]:_dist_code[256+(e>>>7)]},Tree.extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Tree.extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Tree.extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Tree.bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],StaticTree.static_ltree=[12,8,140,8,76,8,204,8,44,8,172,8,108,8,236,8,28,8,156,8,92,8,220,8,60,8,188,8,124,8,252,8,2,8,130,8,66,8,194,8,34,8,162,8,98,8,226,8,18,8,146,8,82,8,210,8,50,8,178,8,114,8,242,8,10,8,138,8,74,8,202,8,42,8,170,8,106,8,234,8,26,8,154,8,90,8,218,8,58,8,186,8,122,8,250,8,6,8,134,8,70,8,198,8,38,8,166,8,102,8,230,8,22,8,150,8,86,8,214,8,54,8,182,8,118,8,246,8,14,8,142,8,78,8,206,8,46,8,174,8,110,8,238,8,30,8,158,8,94,8,222,8,62,8,190,8,126,8,254,8,1,8,129,8,65,8,193,8,33,8,161,8,97,8,225,8,17,8,145,8,81,8,209,8,49,8,177,8,113,8,241,8,9,8,137,8,73,8,201,8,41,8,169,8,105,8,233,8,25,8,153,8,89,8,217,8,57,8,185,8,121,8,249,8,5,8,133,8,69,8,197,8,37,8,165,8,101,8,229,8,21,8,149,8,85,8,213,8,53,8,181,8,117,8,245,8,13,8,141,8,77,8,205,8,45,8,173,8,109,8,237,8,29,8,157,8,93,8,221,8,61,8,189,8,125,8,253,8,19,9,275,9,147,9,403,9,83,9,339,9,211,9,467,9,51,9,307,9,179,9,435,9,115,9,371,9,243,9,499,9,11,9,267,9,139,9,395,9,75,9,331,9,203,9,459,9,43,9,299,9,171,9,427,9,107,9,363,9,235,9,491,9,27,9,283,9,155,9,411,9,91,9,347,9,219,9,475,9,59,9,315,9,187,9,443,9,123,9,379,9,251,9,507,9,7,9,263,9,135,9,391,9,71,9,327,9,199,9,455,9,39,9,295,9,167,9,423,9,103,9,359,9,231,9,487,9,23,9,279,9,151,9,407,9,87,9,343,9,215,9,471,9,55,9,311,9,183,9,439,9,119,9,375,9,247,9,503,9,15,9,271,9,143,9,399,9,79,9,335,9,207,9,463,9,47,9,303,9,175,9,431,9,111,9,367,9,239,9,495,9,31,9,287,9,159,9,415,9,95,9,351,9,223,9,479,9,63,9,319,9,191,9,447,9,127,9,383,9,255,9,511,9,0,7,64,7,32,7,96,7,16,7,80,7,48,7,112,7,8,7,72,7,40,7,104,7,24,7,88,7,56,7,120,7,4,7,68,7,36,7,100,7,20,7,84,7,52,7,116,7,3,8,131,8,67,8,195,8,35,8,163,8,99,8,227,8],StaticTree.static_dtree=[0,5,16,5,8,5,24,5,4,5,20,5,12,5,28,5,2,5,18,5,10,5,26,5,6,5,22,5,14,5,30,5,1,5,17,5,9,5,25,5,5,5,21,5,13,5,29,5,3,5,19,5,11,5,27,5,7,5,23,5],StaticTree.static_l_desc=new StaticTree(StaticTree.static_ltree,Tree.extra_lbits,LITERALS+1,L_CODES,MAX_BITS$1),StaticTree.static_d_desc=new StaticTree(StaticTree.static_dtree,Tree.extra_dbits,0,D_CODES,MAX_BITS$1),StaticTree.static_bl_desc=new StaticTree(null,Tree.extra_blbits,0,BL_CODES,MAX_BL_BITS);const MAX_MEM_LEVEL=9,DEF_MEM_LEVEL=8;function Config(e,t,i,r,n){const a=this;a.good_length=e,a.max_lazy=t,a.nice_length=i,a.max_chain=r,a.func=n}const STORED$1=0,FAST=1,SLOW=2,config_table=[new Config(0,0,0,0,STORED$1),new Config(4,4,8,4,FAST),new Config(4,5,16,8,FAST),new Config(4,6,32,32,FAST),new Config(4,4,16,16,SLOW),new Config(8,16,32,32,SLOW),new Config(8,16,128,128,SLOW),new Config(8,32,128,256,SLOW),new Config(32,128,258,1024,SLOW),new Config(32,258,258,4096,SLOW)],z_errmsg=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],NeedMore=0,BlockDone=1,FinishStarted=2,FinishDone=3,PRESET_DICT$1=32,INIT_STATE=42,BUSY_STATE=113,FINISH_STATE=666,Z_DEFLATED$1=8,STORED_BLOCK=0,STATIC_TREES=1,DYN_TREES=2,MIN_MATCH=3,MAX_MATCH=258,MIN_LOOKAHEAD=MAX_MATCH+MIN_MATCH+1;function smaller(e,t,i,r){const n=e[2*t],a=e[2*i];return n<a||n==a&&r[t]<=r[i]}function Deflate$1(){const e=this;let t,i,r,n,a,o,s,l,c,u,d,h,p,f,m,g,_,y,v,C,T,S,A,x,E,b,P,D,w,M,I,R,O;const B=new Tree,L=new Tree,F=new Tree;let N,V,k,U,G,$,z,H;function W(){let t;for(t=0;t<L_CODES;t++)I[2*t]=0;for(t=0;t<D_CODES;t++)R[2*t]=0;for(t=0;t<BL_CODES;t++)O[2*t]=0;I[2*END_BLOCK]=1,e.opt_len=e.static_len=0,k=G=0}function j(e,t){let i,r=-1,n=e[1],a=0,o=7,s=4;0===n&&(o=138,s=3),e[2*(t+1)+1]=65535;for(let l=0;l<=t;l++)i=n,n=e[2*(l+1)+1],++a<o&&i==n||(a<s?O[2*i]+=a:0!==i?(i!=r&&O[2*i]++,O[2*REP_3_6]++):a<=10?O[2*REPZ_3_10]++:O[2*REPZ_11_138]++,a=0,r=i,0===n?(o=138,s=3):i==n?(o=6,s=3):(o=7,s=4))}function q(t){e.pending_buf[e.pending++]=t}function X(e){q(255&e),q(e>>>8&255)}function Y(e,t){let i;const r=t;H>Buf_size-r?(i=e,z|=i<<H&65535,X(z),z=i>>>Buf_size-H,H+=r-Buf_size):(z|=e<<H&65535,H+=r)}function K(e,t){const i=2*e;Y(65535&t[i],65535&t[i+1])}function J(e,t){let i,r,n=-1,a=e[1],o=0,s=7,l=4;for(0===a&&(s=138,l=3),i=0;i<=t;i++)if(r=a,a=e[2*(i+1)+1],!(++o<s&&r==a)){if(o<l)do{K(r,O)}while(0!=--o);else 0!==r?(r!=n&&(K(r,O),o--),K(REP_3_6,O),Y(o-3,2)):o<=10?(K(REPZ_3_10,O),Y(o-3,3)):(K(REPZ_11_138,O),Y(o-11,7));o=0,n=r,0===a?(s=138,l=3):r==a?(s=6,l=3):(s=7,l=4)}}function Q(){16==H?(X(z),z=0,H=0):H>=8&&(q(255&z),z>>>=8,H-=8)}function Z(t,i){let r,n,a;if(e.pending_buf[U+2*k]=t>>>8&255,e.pending_buf[U+2*k+1]=255&t,e.pending_buf[N+k]=255&i,k++,0===t?I[2*i]++:(G++,t--,I[2*(Tree._length_code[i]+LITERALS+1)]++,R[2*Tree.d_code(t)]++),0==(8191&k)&&P>2){for(r=8*k,n=T-_,a=0;a<D_CODES;a++)r+=R[2*a]*(5+Tree.extra_dbits[a]);if(r>>>=3,G<Math.floor(k/2)&&r<Math.floor(n/2))return!0}return k==V-1}function ee(t,i){let r,n,a,o,s=0;if(0!==k)do{r=e.pending_buf[U+2*s]<<8&65280|255&e.pending_buf[U+2*s+1],n=255&e.pending_buf[N+s],s++,0===r?K(n,t):(a=Tree._length_code[n],K(a+LITERALS+1,t),o=Tree.extra_lbits[a],0!==o&&(n-=Tree.base_length[a],Y(n,o)),r--,a=Tree.d_code(r),K(a,i),o=Tree.extra_dbits[a],0!==o&&(r-=Tree.base_dist[a],Y(r,o)))}while(s<k);K(END_BLOCK,t),$=t[2*END_BLOCK+1]}function te(){H>8?X(z):H>0&&q(255&z),z=0,H=0}function ie(t,i,r){Y((STORED_BLOCK<<1)+(r?1:0),3),function(t,i,r){te(),$=8,r&&(X(i),X(~i)),e.pending_buf.set(l.subarray(t,t+i),e.pending),e.pending+=i}(t,i,!0)}function re(t,i,r){let n,a,o=0;P>0?(B.build_tree(e),L.build_tree(e),o=function(){let t;for(j(I,B.max_code),j(R,L.max_code),F.build_tree(e),t=BL_CODES-1;t>=3&&0===O[2*Tree.bl_order[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(),n=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=n&&(n=a)):n=a=i+5,i+4<=n&&-1!=t?ie(t,i,r):a==n?(Y((STATIC_TREES<<1)+(r?1:0),3),ee(StaticTree.static_ltree,StaticTree.static_dtree)):(Y((DYN_TREES<<1)+(r?1:0),3),function(e,t,i){let r;for(Y(e-257,5),Y(t-1,5),Y(i-4,4),r=0;r<i;r++)Y(O[2*Tree.bl_order[r]+1],3);J(I,e-1),J(R,t-1)}(B.max_code+1,L.max_code+1,o+1),ee(I,R)),W(),r&&te()}function ne(e){re(_>=0?_:-1,T-_,e),_=T,t.flush_pending()}function ae(){let e,i,r,n;do{if(n=c-A-T,0===n&&0===T&&0===A)n=a;else if(-1==n)n--;else if(T>=a+a-MIN_LOOKAHEAD){l.set(l.subarray(a,a+a),0),S-=a,T-=a,_-=a,e=p,r=e;do{i=65535&d[--r],d[r]=i>=a?i-a:0}while(0!=--e);e=a,r=e;do{i=65535&u[--r],u[r]=i>=a?i-a:0}while(0!=--e);n+=a}if(0===t.avail_in)return;e=t.read_buf(l,T+A,n),A+=e,A>=MIN_MATCH&&(h=255&l[T],h=(h<<g^255&l[T+1])&m)}while(A<MIN_LOOKAHEAD&&0!==t.avail_in)}function oe(e){let t,i,r=E,n=T,o=x;const c=T>a-MIN_LOOKAHEAD?T-(a-MIN_LOOKAHEAD):0;let d=M;const h=s,p=T+MAX_MATCH;let f=l[n+o-1],m=l[n+o];x>=w&&(r>>=2),d>A&&(d=A);do{if(t=e,l[t+o]==m&&l[t+o-1]==f&&l[t]==l[n]&&l[++t]==l[n+1]){n+=2,t++;do{}while(l[++n]==l[++t]&&l[++n]==l[++t]&&l[++n]==l[++t]&&l[++n]==l[++t]&&l[++n]==l[++t]&&l[++n]==l[++t]&&l[++n]==l[++t]&&l[++n]==l[++t]&&n<p);if(i=MAX_MATCH-(p-n),n=p-MAX_MATCH,i>o){if(S=e,o=i,i>=d)break;f=l[n+o-1],m=l[n+o]}}}while((e=65535&u[e&h])>c&&0!=--r);return o<=A?o:A}function se(t){return t.total_in=t.total_out=0,t.msg=null,e.pending=0,e.pending_out=0,i=BUSY_STATE,n=Z_NO_FLUSH$1,B.dyn_tree=I,B.stat_desc=StaticTree.static_l_desc,L.dyn_tree=R,L.stat_desc=StaticTree.static_d_desc,F.dyn_tree=O,F.stat_desc=StaticTree.static_bl_desc,z=0,H=0,$=8,W(),function(){c=2*a,d[p-1]=0;for(let e=0;e<p-1;e++)d[e]=0;b=config_table[P].max_lazy,w=config_table[P].good_length,M=config_table[P].nice_length,E=config_table[P].max_chain,T=0,_=0,A=0,y=x=MIN_MATCH-1,C=0,h=0}(),Z_OK$1}e.depth=[],e.bl_count=[],e.heap=[],I=[],R=[],O=[],e.pqdownheap=function(t,i){const r=e.heap,n=r[i];let a=i<<1;for(;a<=e.heap_len&&(a<e.heap_len&&smaller(t,r[a+1],r[a],e.depth)&&a++,!smaller(t,n,r[a],e.depth));)r[i]=r[a],i=a,a<<=1;r[i]=n},e.deflateInit=function(t,i,n,c,h,_){return c||(c=Z_DEFLATED$1),h||(h=DEF_MEM_LEVEL),_||(_=Z_DEFAULT_STRATEGY),t.msg=null,i==Z_DEFAULT_COMPRESSION&&(i=6),h<1||h>MAX_MEM_LEVEL||c!=Z_DEFLATED$1||n<9||n>15||i<0||i>9||_<0||_>Z_HUFFMAN_ONLY?Z_STREAM_ERROR$1:(t.dstate=e,o=n,a=1<<o,s=a-1,f=h+7,p=1<<f,m=p-1,g=Math.floor((f+MIN_MATCH-1)/MIN_MATCH),l=new Uint8Array(2*a),u=[],d=[],V=1<<h+6,e.pending_buf=new Uint8Array(4*V),r=4*V,U=Math.floor(V/2),N=3*V,P=i,D=_,se(t))},e.deflateEnd=function(){return i!=INIT_STATE&&i!=BUSY_STATE&&i!=FINISH_STATE?Z_STREAM_ERROR$1:(e.pending_buf=null,d=null,u=null,l=null,e.dstate=null,i==BUSY_STATE?Z_DATA_ERROR$1:Z_OK$1)},e.deflateParams=function(e,t,i){let r=Z_OK$1;return t==Z_DEFAULT_COMPRESSION&&(t=6),t<0||t>9||i<0||i>Z_HUFFMAN_ONLY?Z_STREAM_ERROR$1:(config_table[P].func!=config_table[t].func&&0!==e.total_in&&(r=e.deflate(Z_PARTIAL_FLUSH)),P!=t&&(P=t,b=config_table[P].max_lazy,w=config_table[P].good_length,M=config_table[P].nice_length,E=config_table[P].max_chain),D=i,r)},e.deflateSetDictionary=function(e,t,r){let n,o=r,c=0;if(!t||i!=INIT_STATE)return Z_STREAM_ERROR$1;if(o<MIN_MATCH)return Z_OK$1;for(o>a-MIN_LOOKAHEAD&&(o=a-MIN_LOOKAHEAD,c=r-o),l.set(t.subarray(c,c+o),0),T=o,_=o,h=255&l[0],h=(h<<g^255&l[1])&m,n=0;n<=o-MIN_MATCH;n++)h=(h<<g^255&l[n+(MIN_MATCH-1)])&m,u[n&s]=d[h],d[h]=n;return Z_OK$1},e.deflate=function(c,f){let E,w,M,I,R;if(f>Z_FINISH$1||f<0)return Z_STREAM_ERROR$1;if(!c.next_out||!c.next_in&&0!==c.avail_in||i==FINISH_STATE&&f!=Z_FINISH$1)return c.msg=z_errmsg[Z_NEED_DICT$1-Z_STREAM_ERROR$1],Z_STREAM_ERROR$1;if(0===c.avail_out)return c.msg=z_errmsg[Z_NEED_DICT$1-Z_BUF_ERROR$1],Z_BUF_ERROR$1;var O;if(t=c,I=n,n=f,i==INIT_STATE&&(w=Z_DEFLATED$1+(o-8<<4)<<8,M=(P-1&255)>>1,M>3&&(M=3),w|=M<<6,0!==T&&(w|=PRESET_DICT$1),w+=31-w%31,i=BUSY_STATE,q((O=w)>>8&255),q(255&O)),0!==e.pending){if(t.flush_pending(),0===t.avail_out)return n=-1,Z_OK$1}else if(0===t.avail_in&&f<=I&&f!=Z_FINISH$1)return t.msg=z_errmsg[Z_NEED_DICT$1-Z_BUF_ERROR$1],Z_BUF_ERROR$1;if(i==FINISH_STATE&&0!==t.avail_in)return c.msg=z_errmsg[Z_NEED_DICT$1-Z_BUF_ERROR$1],Z_BUF_ERROR$1;if(0!==t.avail_in||0!==A||f!=Z_NO_FLUSH$1&&i!=FINISH_STATE){switch(R=-1,config_table[P].func){case STORED$1:R=function(e){let i,n=65535;for(n>r-5&&(n=r-5);;){if(A<=1){if(ae(),0===A&&e==Z_NO_FLUSH$1)return NeedMore;if(0===A)break}if(T+=A,A=0,i=_+n,(0===T||T>=i)&&(A=T-i,T=i,ne(!1),0===t.avail_out))return NeedMore;if(T-_>=a-MIN_LOOKAHEAD&&(ne(!1),0===t.avail_out))return NeedMore}return ne(e==Z_FINISH$1),0===t.avail_out?e==Z_FINISH$1?FinishStarted:NeedMore:e==Z_FINISH$1?FinishDone:BlockDone}(f);break;case FAST:R=function(e){let i,r=0;for(;;){if(A<MIN_LOOKAHEAD){if(ae(),A<MIN_LOOKAHEAD&&e==Z_NO_FLUSH$1)return NeedMore;if(0===A)break}if(A>=MIN_MATCH&&(h=(h<<g^255&l[T+(MIN_MATCH-1)])&m,r=65535&d[h],u[T&s]=d[h],d[h]=T),0!==r&&(T-r&65535)<=a-MIN_LOOKAHEAD&&D!=Z_HUFFMAN_ONLY&&(y=oe(r)),y>=MIN_MATCH)if(i=Z(T-S,y-MIN_MATCH),A-=y,y<=b&&A>=MIN_MATCH){y--;do{T++,h=(h<<g^255&l[T+(MIN_MATCH-1)])&m,r=65535&d[h],u[T&s]=d[h],d[h]=T}while(0!=--y);T++}else T+=y,y=0,h=255&l[T],h=(h<<g^255&l[T+1])&m;else i=Z(0,255&l[T]),A--,T++;if(i&&(ne(!1),0===t.avail_out))return NeedMore}return ne(e==Z_FINISH$1),0===t.avail_out?e==Z_FINISH$1?FinishStarted:NeedMore:e==Z_FINISH$1?FinishDone:BlockDone}(f);break;case SLOW:R=function(e){let i,r,n=0;for(;;){if(A<MIN_LOOKAHEAD){if(ae(),A<MIN_LOOKAHEAD&&e==Z_NO_FLUSH$1)return NeedMore;if(0===A)break}if(A>=MIN_MATCH&&(h=(h<<g^255&l[T+(MIN_MATCH-1)])&m,n=65535&d[h],u[T&s]=d[h],d[h]=T),x=y,v=S,y=MIN_MATCH-1,0!==n&&x<b&&(T-n&65535)<=a-MIN_LOOKAHEAD&&(D!=Z_HUFFMAN_ONLY&&(y=oe(n)),y<=5&&(D==Z_FILTERED||y==MIN_MATCH&&T-S>4096)&&(y=MIN_MATCH-1)),x>=MIN_MATCH&&y<=x){r=T+A-MIN_MATCH,i=Z(T-1-v,x-MIN_MATCH),A-=x-1,x-=2;do{++T<=r&&(h=(h<<g^255&l[T+(MIN_MATCH-1)])&m,n=65535&d[h],u[T&s]=d[h],d[h]=T)}while(0!=--x);if(C=0,y=MIN_MATCH-1,T++,i&&(ne(!1),0===t.avail_out))return NeedMore}else if(0!==C){if(i=Z(0,255&l[T-1]),i&&ne(!1),T++,A--,0===t.avail_out)return NeedMore}else C=1,T++,A--}return 0!==C&&(i=Z(0,255&l[T-1]),C=0),ne(e==Z_FINISH$1),0===t.avail_out?e==Z_FINISH$1?FinishStarted:NeedMore:e==Z_FINISH$1?FinishDone:BlockDone}(f)}if(R!=FinishStarted&&R!=FinishDone||(i=FINISH_STATE),R==NeedMore||R==FinishStarted)return 0===t.avail_out&&(n=-1),Z_OK$1;if(R==BlockDone){if(f==Z_PARTIAL_FLUSH)Y(STATIC_TREES<<1,3),K(END_BLOCK,StaticTree.static_ltree),Q(),1+$+10-H<9&&(Y(STATIC_TREES<<1,3),K(END_BLOCK,StaticTree.static_ltree),Q()),$=7;else if(ie(0,0,!1),f==Z_FULL_FLUSH)for(E=0;E<p;E++)d[E]=0;if(t.flush_pending(),0===t.avail_out)return n=-1,Z_OK$1}}return f!=Z_FINISH$1?Z_OK$1:Z_STREAM_END$1}}function ZStream$1(){const e=this;e.next_in_index=0,e.next_out_index=0,e.avail_in=0,e.total_in=0,e.avail_out=0,e.total_out=0}function ZipDeflate(e){const t=new ZStream$1,i=getMaximumCompressedSize$1(e&&e.chunkSize?e.chunkSize:65536),r=Z_NO_FLUSH$1,n=new Uint8Array(i);let a=e?e.level:Z_DEFAULT_COMPRESSION;void 0===a&&(a=Z_DEFAULT_COMPRESSION),t.deflateInit(a),t.next_out=n,this.append=function(e,a){let o,s,l=0,c=0,u=0;const d=[];if(e.length){t.next_in_index=0,t.next_in=e,t.avail_in=e.length;do{if(t.next_out_index=0,t.avail_out=i,o=t.deflate(r),o!=Z_OK$1)throw new Error("deflating: "+t.msg);t.next_out_index&&(t.next_out_index==i?d.push(new Uint8Array(n)):d.push(n.slice(0,t.next_out_index))),u+=t.next_out_index,a&&t.next_in_index>0&&t.next_in_index!=l&&(a(t.next_in_index),l=t.next_in_index)}while(t.avail_in>0||0===t.avail_out);return d.length>1?(s=new Uint8Array(u),d.forEach((function(e){s.set(e,c),c+=e.length}))):s=d[0]||new Uint8Array(0),s}},this.flush=function(){let e,r,a=0,o=0;const s=[];do{if(t.next_out_index=0,t.avail_out=i,e=t.deflate(Z_FINISH$1),e!=Z_STREAM_END$1&&e!=Z_OK$1)throw new Error("deflating: "+t.msg);i-t.avail_out>0&&s.push(n.slice(0,t.next_out_index)),o+=t.next_out_index}while(t.avail_in>0||0===t.avail_out);return t.deflateEnd(),r=new Uint8Array(o),s.forEach((function(e){r.set(e,a),a+=e.length})),r}}function getMaximumCompressedSize$1(e){return e+5*(Math.floor(e/16383)+1)}ZStream$1.prototype={deflateInit:function(e,t){const i=this;return i.dstate=new Deflate$1,t||(t=MAX_BITS$1),i.dstate.deflateInit(i,e,t)},deflate:function(e){const t=this;return t.dstate?t.dstate.deflate(t,e):Z_STREAM_ERROR$1},deflateEnd:function(){const e=this;if(!e.dstate)return Z_STREAM_ERROR$1;const t=e.dstate.deflateEnd();return e.dstate=null,t},deflateParams:function(e,t){const i=this;return i.dstate?i.dstate.deflateParams(i,e,t):Z_STREAM_ERROR$1},deflateSetDictionary:function(e,t){const i=this;return i.dstate?i.dstate.deflateSetDictionary(i,e,t):Z_STREAM_ERROR$1},read_buf:function(e,t,i){const r=this;let n=r.avail_in;return n>i&&(n=i),0===n?0:(r.avail_in-=n,e.set(r.next_in.subarray(r.next_in_index,r.next_in_index+n),t),r.next_in_index+=n,r.total_in+=n,n)},flush_pending:function(){const e=this;let t=e.dstate.pending;t>e.avail_out&&(t=e.avail_out),0!==t&&(e.next_out.set(e.dstate.pending_buf.subarray(e.dstate.pending_out,e.dstate.pending_out+t),e.next_out_index),e.next_out_index+=t,e.dstate.pending_out+=t,e.total_out+=t,e.avail_out-=t,e.dstate.pending-=t,0===e.dstate.pending&&(e.dstate.pending_out=0))}};const MAX_BITS=15,Z_OK$2=0,Z_STREAM_END$2=1,Z_NEED_DICT$2=2,Z_STREAM_ERROR$2=-2,Z_DATA_ERROR$2=-3,Z_MEM_ERROR$1=-4,Z_BUF_ERROR$2=-5,inflate_mask=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],MANY=1440,Z_NO_FLUSH=0,Z_FINISH$2=4,fixed_bl=9,fixed_bd=5,fixed_tl=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],fixed_td=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],cplens=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],cplext=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,112,112],cpdist=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],cpdext=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],BMAX=15;function InfTree(){let e,t,i,r,n,a;function o(e,t,o,s,l,c,u,d,h,p,f){let m,g,_,y,v,C,T,S,A,x,E,b,P,D,w;x=0,v=o;do{i[e[t+x]]++,x++,v--}while(0!==v);if(i[0]==o)return u[0]=-1,d[0]=0,Z_OK$2;for(S=d[0],C=1;C<=BMAX&&0===i[C];C++);for(T=C,S<C&&(S=C),v=BMAX;0!==v&&0===i[v];v--);for(_=v,S>v&&(S=v),d[0]=S,D=1<<C;C<v;C++,D<<=1)if((D-=i[C])<0)return Z_DATA_ERROR$2;if((D-=i[v])<0)return Z_DATA_ERROR$2;for(i[v]+=D,a[1]=C=0,x=1,P=2;0!=--v;)a[P]=C+=i[x],P++,x++;v=0,x=0;do{0!==(C=e[t+x])&&(f[a[C]++]=v),x++}while(++v<o);for(o=a[_],a[0]=v=0,x=0,y=-1,b=-S,n[0]=0,E=0,w=0;T<=_;T++)for(m=i[T];0!=m--;){for(;T>b+S;){if(y++,b+=S,w=_-b,w=w>S?S:w,(g=1<<(C=T-b))>m+1&&(g-=m+1,P=T,C<w))for(;++C<w&&!((g<<=1)<=i[++P]);)g-=i[P];if(w=1<<C,p[0]+w>MANY)return Z_DATA_ERROR$2;n[y]=E=p[0],p[0]+=w,0!==y?(a[y]=v,r[0]=C,r[1]=S,C=v>>>b-S,r[2]=E-n[y-1]-C,h.set(r,3*(n[y-1]+C))):u[0]=E}for(r[1]=T-b,x>=o?r[0]=192:f[x]<s?(r[0]=f[x]<256?0:96,r[2]=f[x++]):(r[0]=c[f[x]-s]+16+64,r[2]=l[f[x++]-s]),g=1<<T-b,C=v>>>b;C<w;C+=g)h.set(r,3*(E+C));for(C=1<<T-1;0!=(v&C);C>>>=1)v^=C;for(v^=C,A=(1<<b)-1;(v&A)!=a[y];)y--,b-=S,A=(1<<b)-1}return 0!==D&&1!=_?Z_BUF_ERROR$2:Z_OK$2}function s(o){let s;for(e||(e=[],t=[],i=new Int32Array(BMAX+1),r=[],n=new Int32Array(BMAX),a=new Int32Array(BMAX+1)),t.length<o&&(t=[]),s=0;s<o;s++)t[s]=0;for(s=0;s<BMAX+1;s++)i[s]=0;for(s=0;s<3;s++)r[s]=0;n.set(i.subarray(0,BMAX),0),a.set(i.subarray(0,BMAX+1),0)}this.inflate_trees_bits=function(i,r,n,a,l){let c;return s(19),e[0]=0,c=o(i,0,19,19,null,null,n,r,a,e,t),c==Z_DATA_ERROR$2?l.msg="oversubscribed dynamic bit lengths tree":c!=Z_BUF_ERROR$2&&0!==r[0]||(l.msg="incomplete dynamic bit lengths tree",c=Z_DATA_ERROR$2),c},this.inflate_trees_dynamic=function(i,r,n,a,l,c,u,d,h){let p;return s(288),e[0]=0,p=o(n,0,i,257,cplens,cplext,c,a,d,e,t),p!=Z_OK$2||0===a[0]?(p==Z_DATA_ERROR$2?h.msg="oversubscribed literal/length tree":p!=Z_MEM_ERROR$1&&(h.msg="incomplete literal/length tree",p=Z_DATA_ERROR$2),p):(s(288),p=o(n,i,r,0,cpdist,cpdext,u,l,d,e,t),p!=Z_OK$2||0===l[0]&&i>257?(p==Z_DATA_ERROR$2?h.msg="oversubscribed distance tree":p==Z_BUF_ERROR$2?(h.msg="incomplete distance tree",p=Z_DATA_ERROR$2):p!=Z_MEM_ERROR$1&&(h.msg="empty distance tree with lengths",p=Z_DATA_ERROR$2),p):Z_OK$2)}}InfTree.inflate_trees_fixed=function(e,t,i,r){return e[0]=fixed_bl,t[0]=fixed_bd,i[0]=fixed_tl,r[0]=fixed_td,Z_OK$2};const START=0,LEN$1=1,LENEXT$1=2,DIST$1=3,DISTEXT$1=4,COPY$1=5,LIT$1=6,WASH=7,END=8,BADCODE=9;function InfCodes(){const e=this;let t,i,r,n,a=0,o=0,s=0,l=0,c=0,u=0,d=0,h=0,p=0,f=0;function m(e,t,i,r,n,a,o,s){let l,c,u,d,h,p,f,m,g,_,y,v,C,T,S,A;f=s.next_in_index,m=s.avail_in,h=o.bitb,p=o.bitk,g=o.write,_=g<o.read?o.read-g-1:o.end-g,y=inflate_mask[e],v=inflate_mask[t];do{for(;p<20;)m--,h|=(255&s.read_byte(f++))<<p,p+=8;if(l=h&y,c=i,u=r,A=3*(u+l),0!==(d=c[A]))for(;;){if(h>>=c[A+1],p-=c[A+1],0!=(16&d)){for(d&=15,C=c[A+2]+(h&inflate_mask[d]),h>>=d,p-=d;p<15;)m--,h|=(255&s.read_byte(f++))<<p,p+=8;for(l=h&v,c=n,u=a,A=3*(u+l),d=c[A];;){if(h>>=c[A+1],p-=c[A+1],0!=(16&d)){for(d&=15;p<d;)m--,h|=(255&s.read_byte(f++))<<p,p+=8;if(T=c[A+2]+(h&inflate_mask[d]),h>>=d,p-=d,_-=C,g>=T)S=g-T,g-S>0&&2>g-S?(o.window[g++]=o.window[S++],o.window[g++]=o.window[S++],C-=2):(o.window.set(o.window.subarray(S,S+2),g),g+=2,S+=2,C-=2);else{S=g-T;do{S+=o.end}while(S<0);if(d=o.end-S,C>d){if(C-=d,g-S>0&&d>g-S)do{o.window[g++]=o.window[S++]}while(0!=--d);else o.window.set(o.window.subarray(S,S+d),g),g+=d,S+=d,d=0;S=0}}if(g-S>0&&C>g-S)do{o.window[g++]=o.window[S++]}while(0!=--C);else o.window.set(o.window.subarray(S,S+C),g),g+=C,S+=C,C=0;break}if(0!=(64&d))return s.msg="invalid distance code",C=s.avail_in-m,C=p>>3<C?p>>3:C,m+=C,f-=C,p-=C<<3,o.bitb=h,o.bitk=p,s.avail_in=m,s.total_in+=f-s.next_in_index,s.next_in_index=f,o.write=g,Z_DATA_ERROR$2;l+=c[A+2],l+=h&inflate_mask[d],A=3*(u+l),d=c[A]}break}if(0!=(64&d))return 0!=(32&d)?(C=s.avail_in-m,C=p>>3<C?p>>3:C,m+=C,f-=C,p-=C<<3,o.bitb=h,o.bitk=p,s.avail_in=m,s.total_in+=f-s.next_in_index,s.next_in_index=f,o.write=g,Z_STREAM_END$2):(s.msg="invalid literal/length code",C=s.avail_in-m,C=p>>3<C?p>>3:C,m+=C,f-=C,p-=C<<3,o.bitb=h,o.bitk=p,s.avail_in=m,s.total_in+=f-s.next_in_index,s.next_in_index=f,o.write=g,Z_DATA_ERROR$2);if(l+=c[A+2],l+=h&inflate_mask[d],A=3*(u+l),0===(d=c[A])){h>>=c[A+1],p-=c[A+1],o.window[g++]=c[A+2],_--;break}}else h>>=c[A+1],p-=c[A+1],o.window[g++]=c[A+2],_--}while(_>=258&&m>=10);return C=s.avail_in-m,C=p>>3<C?p>>3:C,m+=C,f-=C,p-=C<<3,o.bitb=h,o.bitk=p,s.avail_in=m,s.total_in+=f-s.next_in_index,s.next_in_index=f,o.write=g,Z_OK$2}e.init=function(e,a,o,s,l,c){t=START,d=e,h=a,r=o,p=s,n=l,f=c,i=null},e.proc=function(e,g,_){let y,v,C,T,S,A,x,E=0,b=0,P=0;for(P=g.next_in_index,T=g.avail_in,E=e.bitb,b=e.bitk,S=e.write,A=S<e.read?e.read-S-1:e.end-S;;)switch(t){case START:if(A>=258&&T>=10&&(e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,_=m(d,h,r,p,n,f,e,g),P=g.next_in_index,T=g.avail_in,E=e.bitb,b=e.bitk,S=e.write,A=S<e.read?e.read-S-1:e.end-S,_!=Z_OK$2)){t=_==Z_STREAM_END$2?WASH:BADCODE;break}s=d,i=r,o=p,t=LEN$1;case LEN$1:for(y=s;b<y;){if(0===T)return e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,e.inflate_flush(g,_);_=Z_OK$2,T--,E|=(255&g.read_byte(P++))<<b,b+=8}if(v=3*(o+(E&inflate_mask[y])),E>>>=i[v+1],b-=i[v+1],C=i[v],0===C){l=i[v+2],t=LIT$1;break}if(0!=(16&C)){c=15&C,a=i[v+2],t=LENEXT$1;break}if(0==(64&C)){s=C,o=v/3+i[v+2];break}if(0!=(32&C)){t=WASH;break}return t=BADCODE,g.msg="invalid literal/length code",_=Z_DATA_ERROR$2,e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,e.inflate_flush(g,_);case LENEXT$1:for(y=c;b<y;){if(0===T)return e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,e.inflate_flush(g,_);_=Z_OK$2,T--,E|=(255&g.read_byte(P++))<<b,b+=8}a+=E&inflate_mask[y],E>>=y,b-=y,s=h,i=n,o=f,t=DIST$1;case DIST$1:for(y=s;b<y;){if(0===T)return e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,e.inflate_flush(g,_);_=Z_OK$2,T--,E|=(255&g.read_byte(P++))<<b,b+=8}if(v=3*(o+(E&inflate_mask[y])),E>>=i[v+1],b-=i[v+1],C=i[v],0!=(16&C)){c=15&C,u=i[v+2],t=DISTEXT$1;break}if(0==(64&C)){s=C,o=v/3+i[v+2];break}return t=BADCODE,g.msg="invalid distance code",_=Z_DATA_ERROR$2,e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,e.inflate_flush(g,_);case DISTEXT$1:for(y=c;b<y;){if(0===T)return e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,e.inflate_flush(g,_);_=Z_OK$2,T--,E|=(255&g.read_byte(P++))<<b,b+=8}u+=E&inflate_mask[y],E>>=y,b-=y,t=COPY$1;case COPY$1:for(x=S-u;x<0;)x+=e.end;for(;0!==a;){if(0===A&&(S==e.end&&0!==e.read&&(S=0,A=S<e.read?e.read-S-1:e.end-S),0===A&&(e.write=S,_=e.inflate_flush(g,_),S=e.write,A=S<e.read?e.read-S-1:e.end-S,S==e.end&&0!==e.read&&(S=0,A=S<e.read?e.read-S-1:e.end-S),0===A)))return e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,e.inflate_flush(g,_);e.window[S++]=e.window[x++],A--,x==e.end&&(x=0),a--}t=START;break;case LIT$1:if(0===A&&(S==e.end&&0!==e.read&&(S=0,A=S<e.read?e.read-S-1:e.end-S),0===A&&(e.write=S,_=e.inflate_flush(g,_),S=e.write,A=S<e.read?e.read-S-1:e.end-S,S==e.end&&0!==e.read&&(S=0,A=S<e.read?e.read-S-1:e.end-S),0===A)))return e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,e.inflate_flush(g,_);_=Z_OK$2,e.window[S++]=l,A--,t=START;break;case WASH:if(b>7&&(b-=8,T++,P--),e.write=S,_=e.inflate_flush(g,_),S=e.write,A=S<e.read?e.read-S-1:e.end-S,e.read!=e.write)return e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,e.inflate_flush(g,_);t=END;case END:return _=Z_STREAM_END$2,e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,e.inflate_flush(g,_);case BADCODE:return _=Z_DATA_ERROR$2,e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,e.inflate_flush(g,_);default:return _=Z_STREAM_ERROR$2,e.bitb=E,e.bitk=b,g.avail_in=T,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=S,e.inflate_flush(g,_)}},e.free=function(){}}const border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],TYPE$2=0,LENS$2=1,STORED$2=2,TABLE$1=3,BTREE=4,DTREE=5,CODES$2=6,DRY=7,DONELOCKS=8,BADBLOCKS=9;function InfBlocks(e,t){const i=this;let r,n=TYPE$2,a=0,o=0,s=0;const l=[0],c=[0],u=new InfCodes;let d=0,h=new Int32Array(3*MANY);const p=new InfTree;i.bitk=0,i.bitb=0,i.window=new Uint8Array(t),i.end=t,i.read=0,i.write=0,i.reset=function(e,t){t&&(t[0]=0),n==CODES$2&&u.free(e),n=TYPE$2,i.bitk=0,i.bitb=0,i.read=i.write=0},i.reset(e,null),i.inflate_flush=function(e,t){let r,n,a;return n=e.next_out_index,a=i.read,r=(a<=i.write?i.write:i.end)-a,r>e.avail_out&&(r=e.avail_out),0!==r&&t==Z_BUF_ERROR$2&&(t=Z_OK$2),e.avail_out-=r,e.total_out+=r,e.next_out.set(i.window.subarray(a,a+r),n),n+=r,a+=r,a==i.end&&(a=0,i.write==i.end&&(i.write=0),r=i.write-a,r>e.avail_out&&(r=e.avail_out),0!==r&&t==Z_BUF_ERROR$2&&(t=Z_OK$2),e.avail_out-=r,e.total_out+=r,e.next_out.set(i.window.subarray(a,a+r),n),n+=r,a+=r),e.next_out_index=n,i.read=a,t},i.proc=function(e,t){let f,m,g,_,y,v,C,T;for(_=e.next_in_index,y=e.avail_in,m=i.bitb,g=i.bitk,v=i.write,C=v<i.read?i.read-v-1:i.end-v;;){let S,A,x,E,b,P,D,w;switch(n){case TYPE$2:for(;g<3;){if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}switch(f=7&m,d=1&f,f>>>1){case 0:m>>>=3,g-=3,f=7&g,m>>>=f,g-=f,n=LENS$2;break;case 1:S=[],A=[],x=[[]],E=[[]],InfTree.inflate_trees_fixed(S,A,x,E),u.init(S[0],A[0],x[0],0,E[0],0),m>>>=3,g-=3,n=CODES$2;break;case 2:m>>>=3,g-=3,n=TABLE$1;break;case 3:return m>>>=3,g-=3,n=BADBLOCKS,e.msg="invalid block type",t=Z_DATA_ERROR$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t)}break;case LENS$2:for(;g<32;){if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}if((~m>>>16&65535)!=(65535&m))return n=BADBLOCKS,e.msg="invalid stored block lengths",t=Z_DATA_ERROR$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);a=65535&m,m=g=0,n=0!==a?STORED$2:0!==d?DRY:TYPE$2;break;case STORED$2:if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);if(0===C&&(v==i.end&&0!==i.read&&(v=0,C=v<i.read?i.read-v-1:i.end-v),0===C&&(i.write=v,t=i.inflate_flush(e,t),v=i.write,C=v<i.read?i.read-v-1:i.end-v,v==i.end&&0!==i.read&&(v=0,C=v<i.read?i.read-v-1:i.end-v),0===C)))return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);if(t=Z_OK$2,f=a,f>y&&(f=y),f>C&&(f=C),i.window.set(e.read_buf(_,f),v),_+=f,y-=f,v+=f,C-=f,0!=(a-=f))break;n=0!==d?DRY:TYPE$2;break;case TABLE$1:for(;g<14;){if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}if(o=f=16383&m,(31&f)>29||(f>>5&31)>29)return n=BADBLOCKS,e.msg="too many length or distance symbols",t=Z_DATA_ERROR$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);if(f=258+(31&f)+(f>>5&31),!r||r.length<f)r=[];else for(T=0;T<f;T++)r[T]=0;m>>>=14,g-=14,s=0,n=BTREE;case BTREE:for(;s<4+(o>>>10);){for(;g<3;){if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}r[border[s++]]=7&m,m>>>=3,g-=3}for(;s<19;)r[border[s++]]=0;if(l[0]=7,f=p.inflate_trees_bits(r,l,c,h,e),f!=Z_OK$2)return(t=f)==Z_DATA_ERROR$2&&(r=null,n=BADBLOCKS),i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);s=0,n=DTREE;case DTREE:for(;f=o,!(s>=258+(31&f)+(f>>5&31));){let a,u;for(f=l[0];g<f;){if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}if(f=h[3*(c[0]+(m&inflate_mask[f]))+1],u=h[3*(c[0]+(m&inflate_mask[f]))+2],u<16)m>>>=f,g-=f,r[s++]=u;else{for(T=18==u?7:u-14,a=18==u?11:3;g<f+T;){if(0===y)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}if(m>>>=f,g-=f,a+=m&inflate_mask[T],m>>>=T,g-=T,T=s,f=o,T+a>258+(31&f)+(f>>5&31)||16==u&&T<1)return r=null,n=BADBLOCKS,e.msg="invalid bit length repeat",t=Z_DATA_ERROR$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);u=16==u?r[T-1]:0;do{r[T++]=u}while(0!=--a);s=T}}if(c[0]=-1,b=[],P=[],D=[],w=[],b[0]=9,P[0]=6,f=o,f=p.inflate_trees_dynamic(257+(31&f),1+(f>>5&31),r,b,P,D,w,h,e),f!=Z_OK$2)return f==Z_DATA_ERROR$2&&(r=null,n=BADBLOCKS),t=f,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);u.init(b[0],P[0],h,D[0],h,w[0]),n=CODES$2;case CODES$2:if(i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,(t=u.proc(i,e,t))!=Z_STREAM_END$2)return i.inflate_flush(e,t);if(t=Z_OK$2,u.free(e),_=e.next_in_index,y=e.avail_in,m=i.bitb,g=i.bitk,v=i.write,C=v<i.read?i.read-v-1:i.end-v,0===d){n=TYPE$2;break}n=DRY;case DRY:if(i.write=v,t=i.inflate_flush(e,t),v=i.write,C=v<i.read?i.read-v-1:i.end-v,i.read!=i.write)return i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);n=DONELOCKS;case DONELOCKS:return t=Z_STREAM_END$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);case BADBLOCKS:return t=Z_DATA_ERROR$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t);default:return t=Z_STREAM_ERROR$2,i.bitb=m,i.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,i.write=v,i.inflate_flush(e,t)}}},i.free=function(e){i.reset(e,null),i.window=null,h=null},i.set_dictionary=function(e,t,r){i.window.set(e.subarray(t,t+r),0),i.read=i.write=r},i.sync_point=function(){return n==LENS$2?1:0}}const PRESET_DICT=32,Z_DEFLATED$2=8,METHOD=0,FLAG=1,DICT4=2,DICT3=3,DICT2=4,DICT1=5,DICT0=6,BLOCKS=7,DONE$1=12,BAD$2=13,mark=[0,0,255,255];function Inflate$1(){const e=this;function t(e){return e&&e.istate?(e.total_in=e.total_out=0,e.msg=null,e.istate.mode=BLOCKS,e.istate.blocks.reset(e,null),Z_OK$2):Z_STREAM_ERROR$2}e.mode=0,e.method=0,e.was=[0],e.need=0,e.marker=0,e.wbits=0,e.inflateEnd=function(t){return e.blocks&&e.blocks.free(t),e.blocks=null,Z_OK$2},e.inflateInit=function(i,r){return i.msg=null,e.blocks=null,r<8||r>15?(e.inflateEnd(i),Z_STREAM_ERROR$2):(e.wbits=r,i.istate.blocks=new InfBlocks(i,1<<r),t(i),Z_OK$2)},e.inflate=function(e,t){let i,r;if(!e||!e.istate||!e.next_in)return Z_STREAM_ERROR$2;const n=e.istate;for(t=t==Z_FINISH$2?Z_BUF_ERROR$2:Z_OK$2,i=Z_BUF_ERROR$2;;)switch(n.mode){case METHOD:if(0===e.avail_in)return i;if(i=t,e.avail_in--,e.total_in++,(15&(n.method=e.read_byte(e.next_in_index++)))!=Z_DEFLATED$2){n.mode=BAD$2,e.msg="unknown compression method",n.marker=5;break}if(8+(n.method>>4)>n.wbits){n.mode=BAD$2,e.msg="invalid window size",n.marker=5;break}n.mode=FLAG;case FLAG:if(0===e.avail_in)return i;if(i=t,e.avail_in--,e.total_in++,r=255&e.read_byte(e.next_in_index++),((n.method<<8)+r)%31!=0){n.mode=BAD$2,e.msg="incorrect header check",n.marker=5;break}if(0==(r&PRESET_DICT)){n.mode=BLOCKS;break}n.mode=DICT4;case DICT4:if(0===e.avail_in)return i;i=t,e.avail_in--,e.total_in++,n.need=(255&e.read_byte(e.next_in_index++))<<24&4278190080,n.mode=DICT3;case DICT3:if(0===e.avail_in)return i;i=t,e.avail_in--,e.total_in++,n.need+=(255&e.read_byte(e.next_in_index++))<<16&16711680,n.mode=DICT2;case DICT2:if(0===e.avail_in)return i;i=t,e.avail_in--,e.total_in++,n.need+=(255&e.read_byte(e.next_in_index++))<<8&65280,n.mode=DICT1;case DICT1:return 0===e.avail_in?i:(i=t,e.avail_in--,e.total_in++,n.need+=255&e.read_byte(e.next_in_index++),n.mode=DICT0,Z_NEED_DICT$2);case DICT0:return n.mode=BAD$2,e.msg="need dictionary",n.marker=0,Z_STREAM_ERROR$2;case BLOCKS:if(i=n.blocks.proc(e,i),i==Z_DATA_ERROR$2){n.mode=BAD$2,n.marker=0;break}if(i==Z_OK$2&&(i=t),i!=Z_STREAM_END$2)return i;i=t,n.blocks.reset(e,n.was),n.mode=DONE$1;case DONE$1:return Z_STREAM_END$2;case BAD$2:return Z_DATA_ERROR$2;default:return Z_STREAM_ERROR$2}},e.inflateSetDictionary=function(e,t,i){let r=0,n=i;if(!e||!e.istate||e.istate.mode!=DICT0)return Z_STREAM_ERROR$2;const a=e.istate;return n>=1<<a.wbits&&(n=(1<<a.wbits)-1,r=i-n),a.blocks.set_dictionary(t,r,n),a.mode=BLOCKS,Z_OK$2},e.inflateSync=function(e){let i,r,n,a,o;if(!e||!e.istate)return Z_STREAM_ERROR$2;const s=e.istate;if(s.mode!=BAD$2&&(s.mode=BAD$2,s.marker=0),0===(i=e.avail_in))return Z_BUF_ERROR$2;for(r=e.next_in_index,n=s.marker;0!==i&&n<4;)e.read_byte(r)==mark[n]?n++:n=0!==e.read_byte(r)?0:4-n,r++,i--;return e.total_in+=r-e.next_in_index,e.next_in_index=r,e.avail_in=i,s.marker=n,4!=n?Z_DATA_ERROR$2:(a=e.total_in,o=e.total_out,t(e),e.total_in=a,e.total_out=o,s.mode=BLOCKS,Z_OK$2)},e.inflateSyncPoint=function(e){return e&&e.istate&&e.istate.blocks?e.istate.blocks.sync_point():Z_STREAM_ERROR$2}}function ZStream$2(){}function ZipInflate(e){const t=new ZStream$2,i=e&&e.chunkSize?Math.floor(2*e.chunkSize):131072,r=Z_NO_FLUSH,n=new Uint8Array(i);let a=!1;t.inflateInit(),t.next_out=n,this.append=function(e,o){const s=[];let l,c,u=0,d=0,h=0;if(0!==e.length){t.next_in_index=0,t.next_in=e,t.avail_in=e.length;do{if(t.next_out_index=0,t.avail_out=i,0!==t.avail_in||a||(t.next_in_index=0,a=!0),l=t.inflate(r),a&&l===Z_BUF_ERROR$2){if(0!==t.avail_in)throw new Error("inflating: bad input")}else if(l!==Z_OK$2&&l!==Z_STREAM_END$2)throw new Error("inflating: "+t.msg);if((a||l===Z_STREAM_END$2)&&t.avail_in===e.length)throw new Error("inflating: bad input");t.next_out_index&&(t.next_out_index===i?s.push(new Uint8Array(n)):s.push(n.slice(0,t.next_out_index))),h+=t.next_out_index,o&&t.next_in_index>0&&t.next_in_index!=u&&(o(t.next_in_index),u=t.next_in_index)}while(t.avail_in>0||0===t.avail_out);return s.length>1?(c=new Uint8Array(h),s.forEach((function(e){c.set(e,d),d+=e.length}))):c=s[0]||new Uint8Array(0),c}},this.flush=function(){t.inflateEnd()}}ZStream$2.prototype={inflateInit:function(e){const t=this;return t.istate=new Inflate$1,e||(e=MAX_BITS),t.istate.inflateInit(t,e)},inflate:function(e){const t=this;return t.istate?t.istate.inflate(t,e):Z_STREAM_ERROR$2},inflateEnd:function(){const e=this;if(!e.istate)return Z_STREAM_ERROR$2;const t=e.istate.inflateEnd(e);return e.istate=null,t},inflateSync:function(){const e=this;return e.istate?e.istate.inflateSync(e):Z_STREAM_ERROR$2},inflateSetDictionary:function(e,t){const i=this;return i.istate?i.istate.inflateSetDictionary(i,e,t):Z_STREAM_ERROR$2},read_byte:function(e){return this.next_in[e]},read_buf:function(e,t){return this.next_in.subarray(e,e+t)}};const DEFAULT_CONFIGURATION={chunkSize:524288,maxWorkers:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,terminateWorkerTimeout:5e3,useWebWorkers:!0,workerScripts:void 0},config=Object.assign({},DEFAULT_CONFIGURATION);function getConfiguration(){return config}function configure(e){if(void 0!==e.chunkSize&&(config.chunkSize=e.chunkSize),void 0!==e.maxWorkers&&(config.maxWorkers=e.maxWorkers),void 0!==e.terminateWorkerTimeout&&(config.terminateWorkerTimeout=e.terminateWorkerTimeout),void 0!==e.useWebWorkers&&(config.useWebWorkers=e.useWebWorkers),void 0!==e.Deflate&&(config.Deflate=e.Deflate),void 0!==e.Inflate&&(config.Inflate=e.Inflate),void 0!==e.workerScripts){if(e.workerScripts.deflate){if(!Array.isArray(e.workerScripts.deflate))throw new Error("workerScripts.deflate must be an array");config.workerScripts||(config.workerScripts={}),config.workerScripts.deflate=e.workerScripts.deflate}if(e.workerScripts.inflate){if(!Array.isArray(e.workerScripts.inflate))throw new Error("workerScripts.inflate must be an array");config.workerScripts||(config.workerScripts={}),config.workerScripts.inflate=e.workerScripts.inflate}}}function getMimeType(){return"application/octet-stream"}const MINIMUM_CHUNK_SIZE=64,ERR_ABORT="Abort error";async function processData(e,t,i,r,n,a,o){const s=Math.max(a.chunkSize,MINIMUM_CHUNK_SIZE);return async function a(l=0,c=0){const u=o.signal;if(l<n){testAborted(u,e);const d=await t.readUint8Array(l+r,Math.min(s,n-l)),h=d.length;testAborted(u,e);const p=await e.append(d);if(testAborted(u,e),c+=await writeData(i,p),o.onprogress)try{o.onprogress(l+h,n)}catch(e){}return a(l+s,c)}{const t=await e.flush();return c+=await writeData(i,t.data),{signature:t.signature,length:c}}}()}function testAborted(e,t){if(e&&e.aborted)throw t.flush(),new Error(ERR_ABORT)}async function writeData(e,t){return t.length&&await e.writeUint8Array(t),t.length}const ERR_HTTP_STATUS="HTTP error ",ERR_HTTP_RANGE="HTTP Range not supported",CONTENT_TYPE_TEXT_PLAIN="text/plain",HTTP_HEADER_CONTENT_LENGTH="Content-Length",HTTP_HEADER_ACCEPT_RANGES="Accept-Ranges",HTTP_HEADER_RANGE="Range",HTTP_METHOD_HEAD="HEAD",HTTP_METHOD_GET="GET",HTTP_RANGE_UNIT="bytes";class Stream{constructor(){this.size=0}init(){this.initialized=!0}}class Reader extends Stream{}class Writer extends Stream{writeUint8Array(e){this.size+=e.length}}class TextReader extends Reader{constructor(e){super(),this.blobReader=new BlobReader(new Blob([e],{type:CONTENT_TYPE_TEXT_PLAIN}))}async init(){super.init(),this.blobReader.init(),this.size=this.blobReader.size}async readUint8Array(e,t){return this.blobReader.readUint8Array(e,t)}}class TextWriter extends Writer{constructor(e){super(),this.encoding=e,this.blob=new Blob([],{type:CONTENT_TYPE_TEXT_PLAIN})}async writeUint8Array(e){super.writeUint8Array(e),this.blob=new Blob([this.blob,e.buffer],{type:CONTENT_TYPE_TEXT_PLAIN})}getData(){if(this.blob.text)return this.blob.text();{const e=new FileReader;return new Promise(((t,i)=>{e.onload=e=>t(e.target.result),e.onerror=()=>i(e.error),e.readAsText(this.blob,this.encoding)}))}}}class Data64URIReader extends Reader{constructor(e){super(),this.dataURI=e;let t=e.length;for(;"="==e.charAt(t-1);)t--;this.dataStart=e.indexOf(",")+1,this.size=Math.floor(.75*(t-this.dataStart))}async readUint8Array(e,t){const i=new Uint8Array(t),r=4*Math.floor(e/3),n=atob(this.dataURI.substring(r+this.dataStart,4*Math.ceil((e+t)/3)+this.dataStart)),a=e-3*Math.floor(r/4);for(let e=a;e<a+t;e++)i[e-a]=n.charCodeAt(e);return i}}class Data64URIWriter extends Writer{constructor(e){super(),this.data="data:"+(e||"")+";base64,",this.pending=[]}async writeUint8Array(e){super.writeUint8Array(e);let t=0,i=this.pending;const r=this.pending.length;for(this.pending="",t=0;t<3*Math.floor((r+e.length)/3)-r;t++)i+=String.fromCharCode(e[t]);for(;t<e.length;t++)this.pending+=String.fromCharCode(e[t]);i.length>2?this.data+=btoa(i):this.pending=i}getData(){return this.data+btoa(this.pending)}}class BlobReader extends Reader{constructor(e){super(),this.blob=e,this.size=e.size}async readUint8Array(e,t){if(this.blob.arrayBuffer)return new Uint8Array(await this.blob.slice(e,e+t).arrayBuffer());{const i=new FileReader;return new Promise(((r,n)=>{i.onload=e=>r(new Uint8Array(e.target.result)),i.onerror=()=>n(i.error),i.readAsArrayBuffer(this.blob.slice(e,e+t))}))}}}class BlobWriter extends Writer{constructor(e){super(),this.contentType=e,this.arrayBuffers=[]}async writeUint8Array(e){super.writeUint8Array(e),this.arrayBuffers.push(e.buffer)}getData(){return this.blob||(this.blob=new Blob(this.arrayBuffers,{type:this.contentType})),this.blob}}class FetchReader extends Reader{constructor(e,t){super(),this.url=e,this.preventHeadRequest=t.preventHeadRequest,this.useRangeHeader=t.useRangeHeader,this.forceRangeRequests=t.forceRangeRequests,this.options=Object.assign({},t),delete this.options.preventHeadRequest,delete this.options.useRangeHeader,delete this.options.forceRangeRequests,delete this.options.useXHR}async init(){if(super.init(),isHttpFamily(this.url)&&!this.preventHeadRequest){const e=await sendFetchRequest(HTTP_METHOD_HEAD,this.url,this.options);if(this.size=Number(e.headers.get(HTTP_HEADER_CONTENT_LENGTH)),!this.forceRangeRequests&&this.useRangeHeader&&e.headers.get(HTTP_HEADER_ACCEPT_RANGES)!=HTTP_RANGE_UNIT)throw new Error(ERR_HTTP_RANGE);void 0===this.size&&await getFetchData(this,this.options)}else await getFetchData(this,this.options)}async readUint8Array(e,t){if(this.useRangeHeader){const i=await sendFetchRequest(HTTP_METHOD_GET,this.url,this.options,Object.assign({},this.options.headers,{[HTTP_HEADER_RANGE]:HTTP_RANGE_UNIT+"="+e+"-"+(e+t-1)}));if(206!=i.status)throw new Error(ERR_HTTP_RANGE);return new Uint8Array(await i.arrayBuffer())}return this.data||await getFetchData(this,this.options),new Uint8Array(this.data.subarray(e,e+t))}}async function getFetchData(e,t){const i=await sendFetchRequest(HTTP_METHOD_GET,e.url,t);e.data=new Uint8Array(await i.arrayBuffer()),e.size||(e.size=e.data.length)}async function sendFetchRequest(e,t,i,r){r=Object.assign({},i.headers,r);const n=await fetch(t,Object.assign({},i,{method:e,headers:r}));if(n.status<400)return n;throw new Error(ERR_HTTP_STATUS+(n.statusText||n.status))}class XHRReader extends Reader{constructor(e,t){super(),this.url=e,this.preventHeadRequest=t.preventHeadRequest,this.useRangeHeader=t.useRangeHeader,this.forceRangeRequests=t.forceRangeRequests}async init(){if(super.init(),isHttpFamily(this.url)&&!this.preventHeadRequest)return new Promise(((e,t)=>sendXHR(HTTP_METHOD_HEAD,this.url,(i=>{this.size=Number(i.getResponseHeader(HTTP_HEADER_CONTENT_LENGTH)),this.useRangeHeader?this.forceRangeRequests||i.getResponseHeader(HTTP_HEADER_ACCEPT_RANGES)==HTTP_RANGE_UNIT?e():t(new Error(ERR_HTTP_RANGE)):void 0===this.size?getXHRData(this,this.url).then((()=>e())).catch(t):e()}),t)));await getXHRData(this,this.url)}async readUint8Array(e,t){if(this.useRangeHeader){const i=await new Promise(((i,r)=>sendXHR(HTTP_METHOD_GET,this.url,(e=>i(e)),r,[[HTTP_HEADER_RANGE,HTTP_RANGE_UNIT+"="+e+"-"+(e+t-1)]])));if(206!=i.status)throw new Error(ERR_HTTP_RANGE);return new Uint8Array(i.response)}return this.data||await getXHRData(this,this.url),new Uint8Array(this.data.subarray(e,e+t))}}function getXHRData(e,t){return new Promise(((i,r)=>sendXHR(HTTP_METHOD_GET,t,(t=>{e.data=new Uint8Array(t.response),e.size||(e.size=e.data.length),i()}),r)))}function sendXHR(e,t,i,r,n=[]){const a=new XMLHttpRequest;return a.addEventListener("load",(()=>{a.status<400?i(a):r(ERR_HTTP_STATUS+(a.statusText||a.status))}),!1),a.addEventListener("error",r,!1),a.open(e,t),n.forEach((e=>a.setRequestHeader(e[0],e[1]))),a.responseType="arraybuffer",a.send(),a}class HttpReader extends Reader{constructor(e,t={}){super(),this.url=e,t.useXHR?this.reader=new XHRReader(e,t):this.reader=new FetchReader(e,t)}set size(e){}get size(){return this.reader.size}async init(){super.init(),await this.reader.init()}async readUint8Array(e,t){return this.reader.readUint8Array(e,t)}}class HttpRangeReader extends HttpReader{constructor(e,t={}){t.useRangeHeader=!0,super(e,t)}}class Uint8ArrayReader extends Reader{constructor(e){super(),this.array=e,this.size=e.length}async readUint8Array(e,t){return this.array.slice(e,e+t)}}class Uint8ArrayWriter extends Writer{constructor(){super(),this.array=new Uint8Array(0)}async writeUint8Array(e){super.writeUint8Array(e);const t=this.array;this.array=new Uint8Array(t.length+e.length),this.array.set(t),this.array.set(e,t.length)}getData(){return this.array}}function isHttpFamily(e){if("undefined"!=typeof document){const t=document.createElement("a");return t.href=e,"http:"==t.protocol||"https:"==t.protocol}return/^https?:\/\//i.test(e)}const MAX_32_BITS=4294967295,MAX_16_BITS=65535,COMPRESSION_METHOD_DEFLATE=8,COMPRESSION_METHOD_STORE=0,COMPRESSION_METHOD_AES=99,LOCAL_FILE_HEADER_SIGNATURE=67324752,DATA_DESCRIPTOR_RECORD_SIGNATURE=134695760,CENTRAL_FILE_HEADER_SIGNATURE=33639248,END_OF_CENTRAL_DIR_SIGNATURE=101010256,ZIP64_END_OF_CENTRAL_DIR_SIGNATURE=101075792,ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE=117853008,END_OF_CENTRAL_DIR_LENGTH=22,ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH=20,ZIP64_END_OF_CENTRAL_DIR_LENGTH=56,ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH=END_OF_CENTRAL_DIR_LENGTH+ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH+ZIP64_END_OF_CENTRAL_DIR_LENGTH,ZIP64_TOTAL_NUMBER_OF_DISKS=1,EXTRAFIELD_TYPE_ZIP64=1,EXTRAFIELD_TYPE_AES=39169,EXTRAFIELD_TYPE_NTFS=10,EXTRAFIELD_TYPE_NTFS_TAG1=1,EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP=21589,EXTRAFIELD_TYPE_UNICODE_PATH=28789,EXTRAFIELD_TYPE_UNICODE_COMMENT=25461,BITFLAG_ENCRYPTED=1,BITFLAG_LEVEL=6,BITFLAG_DATA_DESCRIPTOR=8,BITFLAG_LANG_ENCODING_FLAG=2048,FILE_ATTR_MSDOS_DIR_MASK=16,VERSION_DEFLATE=20,VERSION_ZIP64=45,VERSION_AES=51,DIRECTORY_SIGNATURE="/",MAX_DATE=new Date(2107,11,31),MIN_DATE=new Date(1980,0,1),CP437="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");var decodeCP437=e=>{let t="";for(let i=0;i<e.length;i++)t+=CP437[e[i]];return t};const table=[];for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)1&t?t=t>>>1^3988292384:t>>>=1;table[e]=t}class Crc32{constructor(e){this.crc=e||-1}append(e){let t=0|this.crc;for(let i=0,r=0|e.length;i<r;i++)t=t>>>8^table[255&(t^e[i])];this.crc=t}get(){return~this.crc}}const bitArray={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const i=e[e.length-1],r=bitArray.getPartial(i);return 32===r?e.concat(t):bitArray._shiftRight(t,r,0|i,e.slice(0,e.length-1))},bitLength(e){const t=e.length;if(0===t)return 0;const i=e[t-1];return 32*(t-1)+bitArray.getPartial(i)},clamp(e,t){if(32*e.length<t)return e;const i=(e=e.slice(0,Math.ceil(t/32))).length;return t&=31,i>0&&t&&(e[i-1]=bitArray.partial(t,e[i-1]&2147483648>>t-1,1)),e},partial:(e,t,i)=>32===e?t:(i?0|t:t<<32-e)+1099511627776*e,getPartial:e=>Math.round(e/1099511627776)||32,_shiftRight(e,t,i,r){for(void 0===r&&(r=[]);t>=32;t-=32)r.push(i),i=0;if(0===t)return r.concat(e);for(let n=0;n<e.length;n++)r.push(i|e[n]>>>t),i=e[n]<<32-t;const n=e.length?e[e.length-1]:0,a=bitArray.getPartial(n);return r.push(bitArray.partial(t+a&31,t+a>32?i:r.pop(),1)),r}},codec={bytes:{fromBits(e){const t=bitArray.bitLength(e)/8,i=new Uint8Array(t);let r;for(let n=0;n<t;n++)0==(3&n)&&(r=e[n/4]),i[n]=r>>>24,r<<=8;return i},toBits(e){const t=[];let i,r=0;for(i=0;i<e.length;i++)r=r<<8|e[i],3==(3&i)&&(t.push(r),r=0);return 3&i&&t.push(bitArray.partial(8*(3&i),r)),t}}},hash={sha1:function(e){e?(this._h=e._h.slice(0),this._buffer=e._buffer.slice(0),this._length=e._length):this.reset()}};hash.sha1.prototype={blockSize:512,reset:function(){const e=this;return e._h=this._init.slice(0),e._buffer=[],e._length=0,e},update:function(e){const t=this;"string"==typeof e&&(e=codec.utf8String.toBits(e));const i=t._buffer=bitArray.concat(t._buffer,e),r=t._length,n=t._length=r+bitArray.bitLength(e);if(n>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");const a=new Uint32Array(i);let o=0;for(let e=t.blockSize+r-(t.blockSize+r&t.blockSize-1);e<=n;e+=t.blockSize)t._block(a.subarray(16*o,16*(o+1))),o+=1;return i.splice(0,16*o),t},finalize:function(){const e=this;let t=e._buffer;const i=e._h;t=bitArray.concat(t,[bitArray.partial(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(Math.floor(e._length/4294967296)),t.push(0|e._length);t.length;)e._block(t.splice(0,16));return e.reset(),i},_init:[1732584193,4023233417,2562383102,271733878,3285377520],_key:[1518500249,1859775393,2400959708,3395469782],_f:function(e,t,i,r){return e<=19?t&i|~t&r:e<=39?t^i^r:e<=59?t&i|t&r|i&r:e<=79?t^i^r:void 0},_S:function(e,t){return t<<e|t>>>32-e},_block:function(e){const t=this,i=t._h,r=Array(80);for(let t=0;t<16;t++)r[t]=e[t];let n=i[0],a=i[1],o=i[2],s=i[3],l=i[4];for(let e=0;e<=79;e++){e>=16&&(r[e]=t._S(1,r[e-3]^r[e-8]^r[e-14]^r[e-16]));const i=t._S(5,n)+t._f(e,a,o,s)+l+r[e]+t._key[Math.floor(e/20)]|0;l=s,s=o,o=t._S(30,a),a=n,n=i}i[0]=i[0]+n|0,i[1]=i[1]+a|0,i[2]=i[2]+o|0,i[3]=i[3]+s|0,i[4]=i[4]+l|0}};const cipher={aes:class{constructor(e){const t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();const i=t._tables[0][4],r=t._tables[1],n=e.length;let a,o,s,l=1;if(4!==n&&6!==n&&8!==n)throw new Error("invalid aes key size");for(t._key=[o=e.slice(0),s=[]],a=n;a<4*n+28;a++){let e=o[a-1];(a%n==0||8===n&&a%n==4)&&(e=i[e>>>24]<<24^i[e>>16&255]<<16^i[e>>8&255]<<8^i[255&e],a%n==0&&(e=e<<8^e>>>24^l<<24,l=l<<1^283*(l>>7))),o[a]=o[a-n]^e}for(let e=0;a;e++,a--){const t=o[3&e?a:a-4];s[e]=a<=4||e<4?t:r[0][i[t>>>24]]^r[1][i[t>>16&255]]^r[2][i[t>>8&255]]^r[3][i[255&t]]}}encrypt(e){return this._crypt(e,0)}decrypt(e){return this._crypt(e,1)}_precompute(){const e=this._tables[0],t=this._tables[1],i=e[4],r=t[4],n=[],a=[];let o,s,l,c;for(let e=0;e<256;e++)a[(n[e]=e<<1^283*(e>>7))^e]=e;for(let u=o=0;!i[u];u^=s||1,o=a[o]||1){let a=o^o<<1^o<<2^o<<3^o<<4;a=a>>8^255&a^99,i[u]=a,r[a]=u,c=n[l=n[s=n[u]]];let d=16843009*c^65537*l^257*s^16843008*u,h=257*n[a]^16843008*a;for(let i=0;i<4;i++)e[i][u]=h=h<<24^h>>>8,t[i][a]=d=d<<24^d>>>8}for(let i=0;i<5;i++)e[i]=e[i].slice(0),t[i]=t[i].slice(0)}_crypt(e,t){if(4!==e.length)throw new Error("invalid aes block size");const i=this._key[t],r=i.length/4-2,n=[0,0,0,0],a=this._tables[t],o=a[0],s=a[1],l=a[2],c=a[3],u=a[4];let d,h,p,f=e[0]^i[0],m=e[t?3:1]^i[1],g=e[2]^i[2],_=e[t?1:3]^i[3],y=4;for(let e=0;e<r;e++)d=o[f>>>24]^s[m>>16&255]^l[g>>8&255]^c[255&_]^i[y],h=o[m>>>24]^s[g>>16&255]^l[_>>8&255]^c[255&f]^i[y+1],p=o[g>>>24]^s[_>>16&255]^l[f>>8&255]^c[255&m]^i[y+2],_=o[_>>>24]^s[f>>16&255]^l[m>>8&255]^c[255&g]^i[y+3],y+=4,f=d,m=h,g=p;for(let e=0;e<4;e++)n[t?3&-e:e]=u[f>>>24]<<24^u[m>>16&255]<<16^u[g>>8&255]<<8^u[255&_]^i[y++],d=f,f=m,m=g,g=_,_=d;return n}}},mode={ctrGladman:class{constructor(e,t){this._prf=e,this._initIv=t,this._iv=t}reset(){this._iv=this._initIv}update(e){return this.calculate(this._prf,e,this._iv)}incWord(e){if(255==(e>>24&255)){let t=e>>16&255,i=e>>8&255,r=255&e;255===t?(t=0,255===i?(i=0,255===r?r=0:++r):++i):++t,e=0,e+=t<<16,e+=i<<8,e+=r}else e+=1<<24;return e}incCounter(e){0===(e[0]=this.incWord(e[0]))&&(e[1]=this.incWord(e[1]))}calculate(e,t,i){let r;if(!(r=t.length))return[];const n=bitArray.bitLength(t);for(let n=0;n<r;n+=4){this.incCounter(i);const r=e.encrypt(i);t[n]^=r[0],t[n+1]^=r[1],t[n+2]^=r[2],t[n+3]^=r[3]}return bitArray.clamp(t,n)}}},misc={hmacSha1:class{constructor(e){const t=this,i=t._hash=hash.sha1,r=[[],[]],n=i.prototype.blockSize/32;t._baseHash=[new i,new i],e.length>n&&(e=i.hash(e));for(let t=0;t<n;t++)r[0][t]=909522486^e[t],r[1][t]=1549556828^e[t];t._baseHash[0].update(r[0]),t._baseHash[1].update(r[1]),t._resultHash=new i(t._baseHash[0])}reset(){const e=this;e._resultHash=new e._hash(e._baseHash[0]),e._updated=!1}update(e){this._updated=!0,this._resultHash.update(e)}digest(){const e=this,t=e._resultHash.finalize(),i=new e._hash(e._baseHash[1]).update(t).finalize();return e.reset(),i}}},ERR_INVALID_PASSWORD="Invalid pasword",BLOCK_LENGTH=16,RAW_FORMAT="raw",PBKDF2_ALGORITHM={name:"PBKDF2"},HASH_ALGORITHM={name:"HMAC"},HASH_FUNCTION="SHA-1",BASE_KEY_ALGORITHM=Object.assign({hash:HASH_ALGORITHM},PBKDF2_ALGORITHM),DERIVED_BITS_ALGORITHM=Object.assign({iterations:1e3,hash:{name:HASH_FUNCTION}},PBKDF2_ALGORITHM),DERIVED_BITS_USAGE=["deriveBits"],SALT_LENGTH=[8,12,16],KEY_LENGTH=[16,24,32],SIGNATURE_LENGTH=10,COUNTER_DEFAULT_VALUE=[0,0,0,0],codecBytes=codec.bytes,Aes=cipher.aes,CtrGladman=mode.ctrGladman,HmacSha1=misc.hmacSha1;class AESDecrypt{constructor(e,t,i){Object.assign(this,{password:e,signed:t,strength:i-1,pendingInput:new Uint8Array(0)})}async append(e){const t=this;if(t.password){const i=subarray(e,0,SALT_LENGTH[t.strength]+2);await createDecryptionKeys(t,i,t.password),t.password=null,t.aesCtrGladman=new CtrGladman(new Aes(t.keys.key),Array.from(COUNTER_DEFAULT_VALUE)),t.hmac=new HmacSha1(t.keys.authentication),e=subarray(e,SALT_LENGTH[t.strength]+2)}return append(t,e,new Uint8Array(e.length-SIGNATURE_LENGTH-(e.length-SIGNATURE_LENGTH)%BLOCK_LENGTH),0,SIGNATURE_LENGTH,!0)}flush(){const e=this,t=e.pendingInput,i=subarray(t,0,t.length-SIGNATURE_LENGTH),r=subarray(t,t.length-SIGNATURE_LENGTH);let n=new Uint8Array(0);if(i.length){const t=codecBytes.toBits(i);e.hmac.update(t);const r=e.aesCtrGladman.update(t);n=codecBytes.fromBits(r)}let a=!0;if(e.signed){const t=subarray(codecBytes.fromBits(e.hmac.digest()),0,SIGNATURE_LENGTH);for(let e=0;e<SIGNATURE_LENGTH;e++)t[e]!=r[e]&&(a=!1)}return{valid:a,data:n}}}class AESEncrypt{constructor(e,t){Object.assign(this,{password:e,strength:t-1,pendingInput:new Uint8Array(0)})}async append(e){const t=this;let i=new Uint8Array(0);t.password&&(i=await createEncryptionKeys(t,t.password),t.password=null,t.aesCtrGladman=new CtrGladman(new Aes(t.keys.key),Array.from(COUNTER_DEFAULT_VALUE)),t.hmac=new HmacSha1(t.keys.authentication));const r=new Uint8Array(i.length+e.length-e.length%BLOCK_LENGTH);return r.set(i,0),append(t,e,r,i.length,0)}flush(){const e=this;let t=new Uint8Array(0);if(e.pendingInput.length){const i=e.aesCtrGladman.update(codecBytes.toBits(e.pendingInput));e.hmac.update(i),t=codecBytes.fromBits(i)}const i=subarray(codecBytes.fromBits(e.hmac.digest()),0,SIGNATURE_LENGTH);return{data:concat(t,i),signature:i}}}function append(e,t,i,r,n,a){const o=t.length-n;let s;for(e.pendingInput.length&&(t=concat(e.pendingInput,t),i=expand(i,o-o%BLOCK_LENGTH)),s=0;s<=o-BLOCK_LENGTH;s+=BLOCK_LENGTH){const n=codecBytes.toBits(subarray(t,s,s+BLOCK_LENGTH));a&&e.hmac.update(n);const o=e.aesCtrGladman.update(n);a||e.hmac.update(o),i.set(codecBytes.fromBits(o),s+r)}return e.pendingInput=subarray(t,s),i}async function createDecryptionKeys(e,t,i){await createKeys$1(e,i,subarray(t,0,SALT_LENGTH[e.strength]));const r=subarray(t,SALT_LENGTH[e.strength]),n=e.keys.passwordVerification;if(n[0]!=r[0]||n[1]!=r[1])throw new Error(ERR_INVALID_PASSWORD)}async function createEncryptionKeys(e,t){const i=crypto.getRandomValues(new Uint8Array(SALT_LENGTH[e.strength]));return await createKeys$1(e,t,i),concat(i,e.keys.passwordVerification)}async function createKeys$1(e,t,i){const r=(new TextEncoder).encode(t),n=await crypto.subtle.importKey(RAW_FORMAT,r,BASE_KEY_ALGORITHM,!1,DERIVED_BITS_USAGE),a=await crypto.subtle.deriveBits(Object.assign({salt:i},DERIVED_BITS_ALGORITHM),n,8*(2*KEY_LENGTH[e.strength]+2)),o=new Uint8Array(a);e.keys={key:codecBytes.toBits(subarray(o,0,KEY_LENGTH[e.strength])),authentication:codecBytes.toBits(subarray(o,KEY_LENGTH[e.strength],2*KEY_LENGTH[e.strength])),passwordVerification:subarray(o,2*KEY_LENGTH[e.strength])}}function concat(e,t){let i=e;return e.length+t.length&&(i=new Uint8Array(e.length+t.length),i.set(e,0),i.set(t,e.length)),i}function expand(e,t){if(t&&t>e.length){const i=e;(e=new Uint8Array(t)).set(i,0)}return e}function subarray(e,t,i){return e.subarray(t,i)}const HEADER_LENGTH=12;class ZipCryptoDecrypt{constructor(e,t){Object.assign(this,{password:e,passwordVerification:t}),createKeys(this,e)}append(e){const t=this;if(t.password){const i=decrypt(t,e.subarray(0,HEADER_LENGTH));if(t.password=null,i[HEADER_LENGTH-1]!=t.passwordVerification)throw new Error(ERR_INVALID_PASSWORD);e=e.subarray(HEADER_LENGTH)}return decrypt(t,e)}flush(){return{valid:!0,data:new Uint8Array(0)}}}class ZipCryptoEncrypt{constructor(e,t){Object.assign(this,{password:e,passwordVerification:t}),createKeys(this,e)}append(e){const t=this;let i,r;if(t.password){t.password=null;const n=crypto.getRandomValues(new Uint8Array(HEADER_LENGTH));n[HEADER_LENGTH-1]=t.passwordVerification,i=new Uint8Array(e.length+n.length),i.set(encrypt(t,n),0),r=HEADER_LENGTH}else i=new Uint8Array(e.length),r=0;return i.set(encrypt(t,e),r),i}flush(){return{data:new Uint8Array(0)}}}function decrypt(e,t){const i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=getByte(e)^t[r],updateKeys(e,i[r]);return i}function encrypt(e,t){const i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=getByte(e)^t[r],updateKeys(e,t[r]);return i}function createKeys(e,t){e.keys=[305419896,591751049,878082192],e.crcKey0=new Crc32(e.keys[0]),e.crcKey2=new Crc32(e.keys[2]);for(let i=0;i<t.length;i++)updateKeys(e,t.charCodeAt(i))}function updateKeys(e,t){e.crcKey0.append([t]),e.keys[0]=~e.crcKey0.get(),e.keys[1]=getInt32(e.keys[1]+getInt8(e.keys[0])),e.keys[1]=getInt32(Math.imul(e.keys[1],134775813)+1),e.crcKey2.append([e.keys[1]>>>24]),e.keys[2]=~e.crcKey2.get()}function getByte(e){const t=2|e.keys[2];return getInt8(Math.imul(t,1^t)>>>8)}function getInt8(e){return 255&e}function getInt32(e){return 4294967295&e}const CODEC_DEFLATE="deflate",CODEC_INFLATE="inflate",ERR_INVALID_SIGNATURE="Invalid signature";class Inflate$2{constructor(e,{signature:t,password:i,signed:r,compressed:n,zipCrypto:a,passwordVerification:o,encryptionStrength:s},{chunkSize:l}){const c=Boolean(i);Object.assign(this,{signature:t,encrypted:c,signed:r,compressed:n,inflate:n&&new e({chunkSize:l}),crc32:r&&new Crc32,zipCrypto:a,decrypt:c&&a?new ZipCryptoDecrypt(i,o):new AESDecrypt(i,r,s)})}async append(e){const t=this;return t.encrypted&&e.length&&(e=await t.decrypt.append(e)),t.compressed&&e.length&&(e=await t.inflate.append(e)),(!t.encrypted||t.zipCrypto)&&t.signed&&e.length&&t.crc32.append(e),e}async flush(){const e=this;let t,i=new Uint8Array(0);if(e.encrypted){const t=e.decrypt.flush();if(!t.valid)throw new Error(ERR_INVALID_SIGNATURE);i=t.data}if((!e.encrypted||e.zipCrypto)&&e.signed){const i=new DataView(new Uint8Array(4).buffer);if(t=e.crc32.get(),i.setUint32(0,t),e.signature!=i.getUint32(0,!1))throw new Error(ERR_INVALID_SIGNATURE)}return e.compressed&&(i=await e.inflate.append(i)||new Uint8Array(0),await e.inflate.flush()),{data:i,signature:t}}}class Deflate{constructor(e,{encrypted:t,signed:i,compressed:r,level:n,zipCrypto:a,password:o,passwordVerification:s,encryptionStrength:l},{chunkSize:c}){Object.assign(this,{encrypted:t,signed:i,compressed:r,deflate:r&&new e({level:n||5,chunkSize:c}),crc32:i&&new Crc32,zipCrypto:a,encrypt:t&&a?new ZipCryptoEncrypt(o,s):new AESEncrypt(o,l)})}async append(e){const t=this;let i=e;return t.compressed&&e.length&&(i=await t.deflate.append(e)),t.encrypted&&i.length&&(i=await t.encrypt.append(i)),(!t.encrypted||t.zipCrypto)&&t.signed&&e.length&&t.crc32.append(e),i}async flush(){const e=this;let t,i=new Uint8Array(0);if(e.compressed&&(i=await e.deflate.flush()||new Uint8Array(0)),e.encrypted){i=await e.encrypt.append(i);const r=e.encrypt.flush();t=r.signature;const n=new Uint8Array(i.length+r.data.length);n.set(i,0),n.set(r.data,i.length),i=n}return e.encrypted&&!e.zipCrypto||!e.signed||(t=e.crc32.get()),{data:i,signature:t}}}function createCodec$1(e,t,i){return t.codecType.startsWith(CODEC_DEFLATE)?new Deflate(e,t,i):t.codecType.startsWith(CODEC_INFLATE)?new Inflate$2(e,t,i):void 0}const MESSAGE_INIT="init",MESSAGE_APPEND="append",MESSAGE_FLUSH="flush",MESSAGE_EVENT_TYPE="message";let classicWorkersSupported=!0;var getWorker=(e,t,i,r,n,a,o)=>(Object.assign(e,{busy:!0,codecConstructor:t,options:Object.assign({},i),scripts:o,terminate(){e.worker&&!e.busy&&(e.worker.terminate(),e.interface=null)},onTaskFinished(){e.busy=!1,n(e)}}),a?createWebWorkerInterface(e,r):createWorkerInterface(e,r));function createWorkerInterface(e,t){const i=createCodec$1(e.codecConstructor,e.options,t);return{async append(t){try{return await i.append(t)}catch(t){throw e.onTaskFinished(),t}},async flush(){try{return await i.flush()}finally{e.onTaskFinished()}}}}function createWebWorkerInterface(e,t){let i;const r={type:"module"};if(!e.interface){if(classicWorkersSupported)try{e.worker=n()}catch(t){classicWorkersSupported=!1,e.worker=n(r)}else e.worker=n(r);e.worker.addEventListener(MESSAGE_EVENT_TYPE,(function(t){const r=t.data;if(i){const t=r.error,n=r.type;if(t){const r=new Error(t.message);r.stack=t.stack,i.reject(r),i=null,e.onTaskFinished()}else if(n==MESSAGE_INIT||n==MESSAGE_FLUSH||n==MESSAGE_APPEND){const t=r.data;n==MESSAGE_FLUSH?(i.resolve({data:new Uint8Array(t),signature:r.signature}),i=null,e.onTaskFinished()):i.resolve(t&&new Uint8Array(t))}}}),!1),e.interface={append:e=>a({type:MESSAGE_APPEND,data:e}),flush:()=>a({type:MESSAGE_FLUSH})}}return e.interface;function n(t={}){return new Worker(new URL(e.scripts[0],"undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("Cesium.js",document.baseURI).href),t)}async function a(r){if(!i){const i=e.options,r=e.scripts.slice(1);await o({scripts:r,type:MESSAGE_INIT,options:i,config:{chunkSize:t.chunkSize}})}return o(r)}function o(t){const r=e.worker,n=new Promise(((e,t)=>i={resolve:e,reject:t}));try{if(t.data)try{t.data=t.data.buffer,r.postMessage(t,[t.data])}catch(e){r.postMessage(t)}else r.postMessage(t)}catch(t){i.reject(t),i=null,e.onTaskFinished()}return n}}let pool=[],pendingRequests=[];function createCodec(e,t,i){const r=!(!t.compressed&&!t.signed&&!t.encrypted)&&(t.useWebWorkers||void 0===t.useWebWorkers&&i.useWebWorkers),n=r&&i.workerScripts?i.workerScripts[t.codecType]:[];if(pool.length<i.maxWorkers){const o={};return pool.push(o),getWorker(o,e,t,i,a,r,n)}{const o=pool.find((e=>!e.busy));return o?(clearTerminateTimeout(o),getWorker(o,e,t,i,a,r,n)):new Promise((i=>pendingRequests.push({resolve:i,codecConstructor:e,options:t,webWorker:r,scripts:n})))}function a(e){if(pendingRequests.length){const[{resolve:t,codecConstructor:r,options:n,webWorker:o,scripts:s}]=pendingRequests.splice(0,1);t(getWorker(e,r,n,i,a,o,s))}else e.worker?(clearTerminateTimeout(e),Number.isFinite(i.terminateWorkerTimeout)&&i.terminateWorkerTimeout>=0&&(e.terminateTimeout=setTimeout((()=>{pool=pool.filter((t=>t!=e)),e.terminate()}),i.terminateWorkerTimeout))):pool=pool.filter((t=>t!=e))}}function clearTerminateTimeout(e){e.terminateTimeout&&(clearTimeout(e.terminateTimeout),e.terminateTimeout=null)}const PROPERTY_NAMES=["filename","rawFilename","directory","encrypted","compressedSize","uncompressedSize","lastModDate","rawLastModDate","comment","rawComment","signature","extraField","rawExtraField","bitFlag","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","filenameUTF8","commentUTF8","offset","zip64","compressionMethod","extraFieldNTFS","lastAccessDate","creationDate","extraFieldExtendedTimestamp","version","versionMadeBy","msDosCompatible","internalFileAttribute","externalFileAttribute"];class Entry{constructor(e){PROPERTY_NAMES.forEach((t=>this[t]=e[t]))}}const ERR_BAD_FORMAT="File format is not recognized",ERR_EOCDR_NOT_FOUND="End of central directory not found",ERR_EOCDR_ZIP64_NOT_FOUND="End of Zip64 central directory not found",ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND="End of Zip64 central directory locator not found",ERR_CENTRAL_DIRECTORY_NOT_FOUND="Central directory header not found",ERR_LOCAL_FILE_HEADER_NOT_FOUND="Local file header not found",ERR_EXTRAFIELD_ZIP64_NOT_FOUND="Zip64 extra field not found",ERR_ENCRYPTED="File contains encrypted entry",ERR_UNSUPPORTED_ENCRYPTION="Encryption method not supported",ERR_UNSUPPORTED_COMPRESSION="Compression method not supported",CHARSET_UTF8="utf-8",ZIP64_PROPERTIES=["uncompressedSize","compressedSize","offset"];class ZipReader{constructor(e,t={}){Object.assign(this,{reader:e,options:t,config:getConfiguration()})}async getEntries(e={}){const t=this,i=t.reader;if(i.initialized||await i.init(),i.size<END_OF_CENTRAL_DIR_LENGTH)throw new Error(ERR_BAD_FORMAT);const r=await seekSignature(i,END_OF_CENTRAL_DIR_SIGNATURE,i.size,END_OF_CENTRAL_DIR_LENGTH,16*MAX_16_BITS);if(!r)throw new Error(ERR_EOCDR_NOT_FOUND);const n=getDataView$1(r);let a=getUint32(n,12),o=getUint32(n,16),s=getUint16(n,8),l=0;if(o==MAX_32_BITS||a==MAX_32_BITS||s==MAX_16_BITS){const e=getDataView$1(await readUint8Array(i,r.offset-ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH,ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH));if(getUint32(e,0)!=ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE)throw new Error(ERR_EOCDR_ZIP64_NOT_FOUND);o=getBigUint64(e,8);let t=await readUint8Array(i,o,ZIP64_END_OF_CENTRAL_DIR_LENGTH),n=getDataView$1(t);const c=r.offset-ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH-ZIP64_END_OF_CENTRAL_DIR_LENGTH;if(getUint32(n,0)!=ZIP64_END_OF_CENTRAL_DIR_SIGNATURE&&o!=c){const e=o;o=c,l=o-e,t=await readUint8Array(i,o,ZIP64_END_OF_CENTRAL_DIR_LENGTH),n=getDataView$1(t)}if(getUint32(n,0)!=ZIP64_END_OF_CENTRAL_DIR_SIGNATURE)throw new Error(ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND);s=getBigUint64(n,32),a=getBigUint64(n,40),o-=a}if(o<0||o>=i.size)throw new Error(ERR_BAD_FORMAT);let c=0,u=await readUint8Array(i,o,a),d=getDataView$1(u);const h=r.offset-a;if(getUint32(d,c)!=CENTRAL_FILE_HEADER_SIGNATURE&&o!=h){const e=o;o=h,l=o-e,u=await readUint8Array(i,o,a),d=getDataView$1(u)}if(o<0||o>=i.size)throw new Error(ERR_BAD_FORMAT);const p=[];for(let r=0;r<s;r++){const n=new ZipEntry(i,t.config,t.options);if(getUint32(d,c)!=CENTRAL_FILE_HEADER_SIGNATURE)throw new Error(ERR_CENTRAL_DIRECTORY_NOT_FOUND);readCommonHeader(n,d,c+6);const a=Boolean(n.bitFlag.languageEncodingFlag),o=c+46,h=o+n.filenameLength,f=h+n.extraFieldLength,m=getUint16(d,c+4),g=0==(0&m);Object.assign(n,{versionMadeBy:m,msDosCompatible:g,compressedSize:0,uncompressedSize:0,commentLength:getUint16(d,c+32),directory:g&&(getUint8(d,c+38)&FILE_ATTR_MSDOS_DIR_MASK)==FILE_ATTR_MSDOS_DIR_MASK,offset:getUint32(d,c+42)+l,internalFileAttribute:getUint32(d,c+34),externalFileAttribute:getUint32(d,c+38),rawFilename:u.subarray(o,h),filenameUTF8:a,commentUTF8:a,rawExtraField:u.subarray(h,f)});const _=f+n.commentLength;n.rawComment=u.subarray(f,_),n.filename=decodeString(n.rawFilename,n.filenameUTF8?CHARSET_UTF8:getOptionValue$1(t,e,"filenameEncoding")),n.comment=decodeString(n.rawComment,n.commentUTF8?CHARSET_UTF8:getOptionValue$1(t,e,"commentEncoding")),!n.directory&&n.filename.endsWith(DIRECTORY_SIGNATURE)&&(n.directory=!0),readCommonFooter(n,n,d,c+6);const y=new Entry(n);if(y.getData=(e,t)=>n.getData(e,y,t),p.push(y),c=_,e.onprogress)try{e.onprogress(r+1,s,new Entry(n))}catch(e){}}return p}async close(){}}class ZipEntry{constructor(e,t,i){Object.assign(this,{reader:e,config:t,options:i})}async getData(e,t,i={}){const r=this,{reader:n,offset:a,extraFieldAES:o,compressionMethod:s,config:l,bitFlag:c,signature:u,rawLastModDate:d,compressedSize:h}=r,p=r.localDirectory={};n.initialized||await n.init();let f=await readUint8Array(n,a,30);const m=getDataView$1(f);let g=getOptionValue$1(r,i,"password");if(g=g&&g.length&&g,o&&o.originalCompressionMethod!=COMPRESSION_METHOD_AES)throw new Error(ERR_UNSUPPORTED_COMPRESSION);if(s!=COMPRESSION_METHOD_STORE&&s!=COMPRESSION_METHOD_DEFLATE)throw new Error(ERR_UNSUPPORTED_COMPRESSION);if(getUint32(m,0)!=LOCAL_FILE_HEADER_SIGNATURE)throw new Error(ERR_LOCAL_FILE_HEADER_NOT_FOUND);readCommonHeader(p,m,4),f=await readUint8Array(n,a,30+p.filenameLength+p.extraFieldLength),p.rawExtraField=f.subarray(30+p.filenameLength),readCommonFooter(r,p,m,4),t.lastAccessDate=p.lastAccessDate,t.creationDate=p.creationDate;const _=r.encrypted&&p.encrypted,y=_&&!o;if(_){if(!y&&void 0===o.strength)throw new Error(ERR_UNSUPPORTED_ENCRYPTION);if(!g)throw new Error(ERR_ENCRYPTED)}const v=await createCodec(l.Inflate,{codecType:CODEC_INFLATE,password:g,zipCrypto:y,encryptionStrength:o&&o.strength,signed:getOptionValue$1(r,i,"checkSignature"),passwordVerification:y&&(c.dataDescriptor?d>>>8&255:u>>>24&255),signature:u,compressed:0!=s,encrypted:_,useWebWorkers:getOptionValue$1(r,i,"useWebWorkers")},l);e.initialized||await e.init();const C=getOptionValue$1(r,i,"signal"),T=a+30+p.filenameLength+p.extraFieldLength;return await processData(v,n,e,T,h,l,{onprogress:i.onprogress,signal:C}),e.getData()}}function readCommonHeader(e,t,i){const r=e.rawBitFlag=getUint16(t,i+2),n=(r&BITFLAG_ENCRYPTED)==BITFLAG_ENCRYPTED,a=getUint32(t,i+6);Object.assign(e,{encrypted:n,version:getUint16(t,i),bitFlag:{level:(r&BITFLAG_LEVEL)>>1,dataDescriptor:(r&BITFLAG_DATA_DESCRIPTOR)==BITFLAG_DATA_DESCRIPTOR,languageEncodingFlag:(r&BITFLAG_LANG_ENCODING_FLAG)==BITFLAG_LANG_ENCODING_FLAG},rawLastModDate:a,lastModDate:getDate(a),filenameLength:getUint16(t,i+22),extraFieldLength:getUint16(t,i+24)})}function readCommonFooter(e,t,i,r){const n=t.rawExtraField,a=t.extraField=new Map,o=getDataView$1(new Uint8Array(n));let s=0;try{for(;s<n.length;){const e=getUint16(o,s),t=getUint16(o,s+2);a.set(e,{type:e,data:n.slice(s+4,s+4+t)}),s+=4+t}}catch(e){}const l=getUint16(i,r+4);t.signature=getUint32(i,r+10),t.uncompressedSize=getUint32(i,r+18),t.compressedSize=getUint32(i,r+14);const c=a.get(EXTRAFIELD_TYPE_ZIP64);c&&(readExtraFieldZip64(c,t),t.extraFieldZip64=c);const u=a.get(EXTRAFIELD_TYPE_UNICODE_PATH);u&&(readExtraFieldUnicode(u,"filename","rawFilename",t,e),t.extraFieldUnicodePath=u);const d=a.get(EXTRAFIELD_TYPE_UNICODE_COMMENT);d&&(readExtraFieldUnicode(d,"comment","rawComment",t,e),t.extraFieldUnicodeComment=d);const h=a.get(EXTRAFIELD_TYPE_AES);h?(readExtraFieldAES(h,t,l),t.extraFieldAES=h):t.compressionMethod=l;const p=a.get(EXTRAFIELD_TYPE_NTFS);p&&(readExtraFieldNTFS(p,t),t.extraFieldNTFS=p);const f=a.get(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);f&&(readExtraFieldExtendedTimestamp(f,t),t.extraFieldExtendedTimestamp=f)}function readExtraFieldZip64(e,t){t.zip64=!0;const i=getDataView$1(e.data);e.values=[];for(let t=0;t<Math.floor(e.data.length/8);t++)e.values.push(getBigUint64(i,0+8*t));const r=ZIP64_PROPERTIES.filter((e=>t[e]==MAX_32_BITS));for(let t=0;t<r.length;t++)e[r[t]]=e.values[t];ZIP64_PROPERTIES.forEach((i=>{if(t[i]==MAX_32_BITS){if(void 0===e[i])throw new Error(ERR_EXTRAFIELD_ZIP64_NOT_FOUND);t[i]=e[i]}}))}function readExtraFieldUnicode(e,t,i,r,n){const a=getDataView$1(e.data);e.version=getUint8(a,0),e.signature=getUint32(a,1);const o=new Crc32;o.append(n[i]);const s=getDataView$1(new Uint8Array(4));s.setUint32(0,o.get(),!0),e[t]=(new TextDecoder).decode(e.data.subarray(5)),e.valid=!n.bitFlag.languageEncodingFlag&&e.signature==getUint32(s,0),e.valid&&(r[t]=e[t],r[t+"UTF8"]=!0)}function readExtraFieldAES(e,t,i){const r=getDataView$1(e.data);e.vendorVersion=getUint8(r,0),e.vendorId=getUint8(r,2);const n=getUint8(r,4);e.strength=n,e.originalCompressionMethod=i,t.compressionMethod=e.compressionMethod=getUint16(r,5)}function readExtraFieldNTFS(e,t){const i=getDataView$1(e.data);let r,n=4;try{for(;n<e.data.length&&!r;){const t=getUint16(i,n),a=getUint16(i,n+2);t==EXTRAFIELD_TYPE_NTFS_TAG1&&(r=e.data.slice(n+4,n+4+a)),n+=4+a}}catch(e){}try{if(r&&24==r.length){const i=getDataView$1(r),n=i.getBigUint64(0,!0),a=i.getBigUint64(8,!0),o=i.getBigUint64(16,!0);Object.assign(e,{rawLastModDate:n,rawLastAccessDate:a,rawCreationDate:o});const s=getDateNTFS(n),l=getDateNTFS(a),c={lastModDate:s,lastAccessDate:l,creationDate:getDateNTFS(o)};Object.assign(e,c),Object.assign(t,c)}}catch(e){}}function readExtraFieldExtendedTimestamp(e,t){const i=getDataView$1(e.data),r=getUint8(i,0),n=[],a=[];1==(1&r)&&(n.push("lastModDate"),a.push("rawLastModDate")),2==(2&r)&&(n.push("lastAccessDate"),a.push("rawLastAccessDate")),4==(4&r)&&(n.push("creationDate"),a.push("rawCreationDate"));let o=1;n.forEach(((r,n)=>{if(e.data.length>=o+4){const s=getUint32(i,o);t[r]=e[r]=new Date(1e3*s);const l=a[n];e[l]=s}o+=4}))}async function seekSignature(e,t,i,r,n){const a=new Uint8Array(4);setUint32$1(getDataView$1(a),0,t);const o=r+n;return await s(r)||await s(Math.min(o,i));async function s(t){const n=i-t,o=await readUint8Array(e,n,t);for(let e=o.length-r;e>=0;e--)if(o[e]==a[0]&&o[e+1]==a[1]&&o[e+2]==a[2]&&o[e+3]==a[3])return{offset:n+e,buffer:o.slice(e,e+r).buffer}}}function getOptionValue$1(e,t,i){return void 0===t[i]?e.options[i]:t[i]}function decodeString(e,t){return t&&"cp437"!=t.trim().toLowerCase()?new TextDecoder(t).decode(e):decodeCP437(e)}function getDate(e){const t=(4294901760&e)>>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(e){}}function getDateNTFS(e){return new Date(Number(e/BigInt(1e4)-BigInt(116444736e5)))}function getUint8(e,t){return e.getUint8(t)}function getUint16(e,t){return e.getUint16(t,!0)}function getUint32(e,t){return e.getUint32(t,!0)}function getBigUint64(e,t){return Number(e.getBigUint64(t,!0))}function setUint32$1(e,t,i){e.setUint32(t,i,!0)}function getDataView$1(e){return new DataView(e.buffer)}function readUint8Array(e,t,i){return e.readUint8Array(t,i)}const ERR_DUPLICATED_NAME="File already exists",ERR_INVALID_COMMENT="Zip file comment exceeds 64KB",ERR_INVALID_ENTRY_COMMENT="File entry comment exceeds 64KB",ERR_INVALID_ENTRY_NAME="File entry name exceeds 64KB",ERR_INVALID_VERSION="Version exceeds 65535",ERR_INVALID_ENCRYPTION_STRENGTH="The strength must equal 1, 2, or 3",ERR_INVALID_EXTRAFIELD_TYPE="Extra field type exceeds 65535",ERR_INVALID_EXTRAFIELD_DATA="Extra field data exceeds 64KB",ERR_UNSUPPORTED_FORMAT="Zip64 is not supported",EXTRAFIELD_DATA_AES=new Uint8Array([7,0,2,0,65,69,3,0,0]),EXTRAFIELD_LENGTH_ZIP64=24;let workers=0;class ZipWriter{constructor(e,t={}){Object.assign(this,{writer:e,options:t,config:getConfiguration(),files:new Map,offset:e.size,pendingCompressedSize:0,pendingEntries:[]})}async add(e="",t,i={}){const r=this;if(!(workers<r.config.maxWorkers))return new Promise(((n,a)=>r.pendingEntries.push({name:e,reader:t,options:i,resolve:n,reject:a})));workers++;try{return await addFile(r,e,t,i)}finally{workers--;const e=r.pendingEntries.shift();e&&r.add(e.name,e.reader,e.options).then(e.resolve).catch(e.reject)}}async close(e=new Uint8Array(0),t={}){return await closeFile(this,e,t),this.writer.getData()}}async function addFile(e,t,i,r){if(t=t.trim(),r.directory&&!t.endsWith(DIRECTORY_SIGNATURE)?t+=DIRECTORY_SIGNATURE:r.directory=t.endsWith(DIRECTORY_SIGNATURE),e.files.has(t))throw new Error(ERR_DUPLICATED_NAME);const n=(new TextEncoder).encode(t);if(n.length>MAX_16_BITS)throw new Error(ERR_INVALID_ENTRY_NAME);const a=r.comment||"",o=(new TextEncoder).encode(a);if(o.length>MAX_16_BITS)throw new Error(ERR_INVALID_ENTRY_COMMENT);const s=e.options.version||r.version||0;if(s>MAX_16_BITS)throw new Error(ERR_INVALID_VERSION);const l=e.options.versionMadeBy||r.versionMadeBy||20;if(l>MAX_16_BITS)throw new Error(ERR_INVALID_VERSION);const c=getOptionValue(e,r,"lastModDate")||new Date,u=getOptionValue(e,r,"lastAccessDate"),d=getOptionValue(e,r,"creationDate"),h=getOptionValue(e,r,"password"),p=getOptionValue(e,r,"encryptionStrength")||3,f=getOptionValue(e,r,"zipCrypto");if(void 0!==h&&void 0!==p&&(p<1||p>3))throw new Error(ERR_INVALID_ENCRYPTION_STRENGTH);let m=new Uint8Array(0);const g=r.extraField;if(g){let e=0,t=0;g.forEach((t=>e+=4+t.length)),m=new Uint8Array(e),g.forEach(((e,i)=>{if(i>MAX_16_BITS)throw new Error(ERR_INVALID_EXTRAFIELD_TYPE);if(e.length>MAX_16_BITS)throw new Error(ERR_INVALID_EXTRAFIELD_DATA);arraySet(m,new Uint16Array([i]),t),arraySet(m,new Uint16Array([e.length]),t+2),arraySet(m,e,t+4),t+=4+e.length}))}let _=getOptionValue(e,r,"extendedTimestamp");void 0===_&&(_=!0);let y=0,v=getOptionValue(e,r,"keepOrder");void 0===v&&(v=!0);let C=0,T=getOptionValue(e,r,"msDosCompatible");void 0===T&&(T=!0);const S=getOptionValue(e,r,"internalFileAttribute")||0,A=getOptionValue(e,r,"externalFileAttribute")||0;i&&(i.initialized||await i.init(),C=i.size,y=getMaximumCompressedSize(C));let x=r.zip64||e.options.zip64||!1;if(e.offset+e.pendingCompressedSize>=MAX_32_BITS||C>=MAX_32_BITS||y>=MAX_32_BITS){if(!1===r.zip64||!1===e.options.zip64||!v)throw new Error(ERR_UNSUPPORTED_FORMAT);x=!0}e.pendingCompressedSize+=y,await Promise.resolve();const E=getOptionValue(e,r,"level"),b=getOptionValue(e,r,"useWebWorkers"),P=getOptionValue(e,r,"bufferedWrite");let D=getOptionValue(e,r,"dataDescriptor"),w=getOptionValue(e,r,"dataDescriptorSignature");const M=getOptionValue(e,r,"signal");void 0===D&&(D=!0),D&&void 0===w&&(w=!0);const I=await getFileEntry(e,t,i,Object.assign({},r,{rawFilename:n,rawComment:o,version:s,versionMadeBy:l,lastModDate:c,lastAccessDate:u,creationDate:d,rawExtraField:m,zip64:x,password:h,level:E,useWebWorkers:b,encryptionStrength:p,extendedTimestamp:_,zipCrypto:f,bufferedWrite:P,keepOrder:v,dataDescriptor:D,dataDescriptorSignature:w,signal:M,msDosCompatible:T,internalFileAttribute:S,externalFileAttribute:A}));return y&&(e.pendingCompressedSize-=y),Object.assign(I,{name:t,comment:a,extraField:g}),new Entry(I)}async function getFileEntry(e,t,i,r){const n=e.files,a=e.writer,o=Array.from(n.values()).pop();let s,l,c,u={};n.set(t,u);try{let d,h,p;if(r.keepOrder&&(d=o&&o.lock),u.lock=p=new Promise((e=>c=e)),r.bufferedWrite||e.lockWrite||!r.dataDescriptor?(h=new BlobWriter,h.init(),s=!0):(e.lockWrite=new Promise((e=>l=e)),a.initialized||await a.init(),h=a),u=await createFileEntry(i,h,e.config,r),u.lock=p,n.set(t,u),u.filename=t,s){let t=0;const i=h.getData();let o;await Promise.all([e.lockWrite,d]);do{o=Array.from(n.values()).find((e=>e.writingBufferedData)),o&&await o.lock}while(o&&o.lock);if(u.writingBufferedData=!0,!r.dataDescriptor){const e=26,n=await sliceAsArrayBuffer(i,0,e),o=new DataView(n);u.encrypted&&!r.zipCrypto||setUint32(o,14,u.signature),u.zip64?(setUint32(o,18,MAX_32_BITS),setUint32(o,22,MAX_32_BITS)):(setUint32(o,18,u.compressedSize),setUint32(o,22,u.uncompressedSize)),await a.writeUint8Array(new Uint8Array(n)),t=e}await writeBlob(a,i,t),delete u.writingBufferedData}if(u.offset=e.offset,u.zip64){setBigUint64(getDataView(u.rawExtraFieldZip64),20,BigInt(u.offset))}else if(u.offset>=MAX_32_BITS)throw new Error(ERR_UNSUPPORTED_FORMAT);return e.offset+=u.length,u}catch(i){throw(s&&u.writingBufferedData||!s&&u.dataWritten)&&(i.corruptedEntry=e.hasCorruptedEntries=!0,u.uncompressedSize&&(e.offset+=u.uncompressedSize)),n.delete(t),i}finally{c(),l&&l()}}async function createFileEntry(e,t,i,r){const{rawFilename:n,lastAccessDate:a,creationDate:o,password:s,level:l,zip64:c,zipCrypto:u,dataDescriptor:d,dataDescriptorSignature:h,directory:p,version:f,versionMadeBy:m,rawComment:g,rawExtraField:_,useWebWorkers:y,onprogress:v,signal:C,encryptionStrength:T,extendedTimestamp:S,msDosCompatible:A,internalFileAttribute:x,externalFileAttribute:E}=r,b=Boolean(s&&s.length),P=0!==l&&!p;let D,w,M;if(b&&!u){D=new Uint8Array(EXTRAFIELD_DATA_AES.length+2);const e=getDataView(D);setUint16(e,0,EXTRAFIELD_TYPE_AES),arraySet(D,EXTRAFIELD_DATA_AES,2),setUint8(e,8,T)}else D=new Uint8Array(0);if(S){M=new Uint8Array(9+(a?4:0)+(o?4:0));const e=getDataView(M);setUint16(e,0,EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP),setUint16(e,2,M.length-4);setUint8(e,4,1+(a?2:0)+(o?4:0)),setUint32(e,5,Math.floor(r.lastModDate.getTime()/1e3)),a&&setUint32(e,9,Math.floor(a.getTime()/1e3)),o&&setUint32(e,13,Math.floor(o.getTime()/1e3));try{w=new Uint8Array(36);const e=getDataView(w),t=getTimeNTFS(r.lastModDate);setUint16(e,0,EXTRAFIELD_TYPE_NTFS),setUint16(e,2,32),setUint16(e,8,EXTRAFIELD_TYPE_NTFS_TAG1),setUint16(e,10,24),setBigUint64(e,12,t),setBigUint64(e,20,getTimeNTFS(a)||t),setBigUint64(e,28,getTimeNTFS(o)||t)}catch(e){w=new Uint8Array(0)}}else w=M=new Uint8Array(0);const I={version:f||VERSION_DEFLATE,versionMadeBy:m,zip64:c,directory:Boolean(p),filenameUTF8:!0,rawFilename:n,commentUTF8:!0,rawComment:g,rawExtraFieldZip64:c?new Uint8Array(EXTRAFIELD_LENGTH_ZIP64+4):new Uint8Array(0),rawExtraFieldExtendedTimestamp:M,rawExtraFieldNTFS:w,rawExtraFieldAES:D,rawExtraField:_,extendedTimestamp:S,msDosCompatible:A,internalFileAttribute:x,externalFileAttribute:E};let R=I.uncompressedSize=0,O=BITFLAG_LANG_ENCODING_FLAG;d&&(O|=BITFLAG_DATA_DESCRIPTOR);let B=COMPRESSION_METHOD_STORE;P&&(B=COMPRESSION_METHOD_DEFLATE),c&&(I.version=I.version>VERSION_ZIP64?I.version:VERSION_ZIP64),b&&(O|=BITFLAG_ENCRYPTED,u||(I.version=I.version>VERSION_AES?I.version:VERSION_AES,B=COMPRESSION_METHOD_AES,P&&(I.rawExtraFieldAES[9]=COMPRESSION_METHOD_DEFLATE))),I.compressionMethod=B;const L=I.headerArray=new Uint8Array(26),F=getDataView(L);setUint16(F,0,I.version),setUint16(F,2,O),setUint16(F,4,B);const N=new Uint32Array(1),V=getDataView(N);let k;k=r.lastModDate<MIN_DATE?MIN_DATE:r.lastModDate>MAX_DATE?MAX_DATE:r.lastModDate,setUint16(V,0,(k.getHours()<<6|k.getMinutes())<<5|k.getSeconds()/2),setUint16(V,2,(k.getFullYear()-1980<<4|k.getMonth()+1)<<5|k.getDate());const U=N[0];setUint32(F,6,U),setUint16(F,22,n.length);const G=D.length+M.length+w.length+I.rawExtraField.length;setUint16(F,24,G);const $=new Uint8Array(30+n.length+G);let z;setUint32(getDataView($),0,LOCAL_FILE_HEADER_SIGNATURE),arraySet($,L,4),arraySet($,n,30),arraySet($,D,30+n.length),arraySet($,M,30+n.length+D.length),arraySet($,w,30+n.length+D.length+M.length),arraySet($,I.rawExtraField,30+n.length+D.length+M.length+w.length);let H=0;if(e){R=I.uncompressedSize=e.size;const r=await createCodec(i.Deflate,{codecType:CODEC_DEFLATE,level:l,password:s,encryptionStrength:T,zipCrypto:b&&u,passwordVerification:b&&u&&U>>8&255,signed:!0,compressed:P,encrypted:b,useWebWorkers:y},i);await t.writeUint8Array($),I.dataWritten=!0,z=await processData(r,e,t,0,R,i,{onprogress:v,signal:C}),H=z.length}else await t.writeUint8Array($),I.dataWritten=!0;let W,j=new Uint8Array(0),q=0;if(d&&(j=new Uint8Array(c?h?24:20:h?16:12),W=getDataView(j),h&&(q=4,setUint32(W,0,DATA_DESCRIPTOR_RECORD_SIGNATURE))),e){const e=z.signature;if(b&&!u||void 0===e||(setUint32(F,10,e),I.signature=e,d&&setUint32(W,q,e)),c){const e=getDataView(I.rawExtraFieldZip64);setUint16(e,0,EXTRAFIELD_TYPE_ZIP64),setUint16(e,2,EXTRAFIELD_LENGTH_ZIP64),setUint32(F,14,MAX_32_BITS),setBigUint64(e,12,BigInt(H)),setUint32(F,18,MAX_32_BITS),setBigUint64(e,4,BigInt(R)),d&&(setBigUint64(W,q+4,BigInt(H)),setBigUint64(W,q+12,BigInt(R)))}else setUint32(F,14,H),setUint32(F,18,R),d&&(setUint32(W,q+4,H),setUint32(W,q+8,R))}d&&await t.writeUint8Array(j);const X=$.length+H+j.length;return Object.assign(I,{compressedSize:H,lastModDate:k,rawLastModDate:U,creationDate:o,lastAccessDate:a,encrypted:b,length:X}),I}async function closeFile(e,t,i){const r=e.writer,n=e.files;let a=0,o=0,s=e.offset,l=n.size;for(const[,e]of n)o+=46+e.rawFilename.length+e.rawComment.length+e.rawExtraFieldZip64.length+e.rawExtraFieldAES.length+e.rawExtraFieldExtendedTimestamp.length+e.rawExtraFieldNTFS.length+e.rawExtraField.length;let c=i.zip64||e.options.zip64||!1;if(s>=MAX_32_BITS||o>=MAX_32_BITS||l>=MAX_16_BITS){if(!1===i.zip64||!1===e.options.zip64)throw new Error(ERR_UNSUPPORTED_FORMAT);c=!0}const u=new Uint8Array(o+(c?ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH:END_OF_CENTRAL_DIR_LENGTH)),d=getDataView(u);if(t&&t.length){if(!(t.length<=MAX_16_BITS))throw new Error(ERR_INVALID_COMMENT);setUint16(d,a+20,t.length)}for(const[e,t]of Array.from(n.values()).entries()){const{rawFilename:r,rawExtraFieldZip64:o,rawExtraFieldAES:s,rawExtraField:l,rawComment:c,versionMadeBy:h,headerArray:p,directory:f,zip64:m,msDosCompatible:g,internalFileAttribute:_,externalFileAttribute:y}=t;let v,C;if(t.extendedTimestamp){C=t.rawExtraFieldNTFS,v=new Uint8Array(9);const e=getDataView(v);setUint16(e,0,EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP),setUint16(e,2,v.length-4),setUint8(e,4,1),setUint32(e,5,Math.floor(t.lastModDate.getTime()/1e3))}else C=v=new Uint8Array(0);const T=o.length+s.length+v.length+C.length+l.length;if(setUint32(d,a,CENTRAL_FILE_HEADER_SIGNATURE),setUint16(d,a+4,h),arraySet(u,p,a+6),setUint16(d,a+30,T),setUint16(d,a+32,c.length),setUint32(d,a+34,_),y?setUint32(d,a+38,y):f&&g&&setUint8(d,a+38,FILE_ATTR_MSDOS_DIR_MASK),setUint32(d,a+42,m?MAX_32_BITS:t.offset),arraySet(u,r,a+46),arraySet(u,o,a+46+r.length),arraySet(u,s,a+46+r.length+o.length),arraySet(u,v,a+46+r.length+o.length+s.length),arraySet(u,C,a+46+r.length+o.length+s.length+v.length),arraySet(u,l,a+46+r.length+o.length+s.length+v.length+C.length),arraySet(u,c,a+46+r.length+T),a+=46+r.length+T+c.length,i.onprogress)try{i.onprogress(e+1,n.size,new Entry(t))}catch(e){}}c&&(setUint32(d,a,ZIP64_END_OF_CENTRAL_DIR_SIGNATURE),setBigUint64(d,a+4,BigInt(44)),setUint16(d,a+12,45),setUint16(d,a+14,45),setBigUint64(d,a+24,BigInt(l)),setBigUint64(d,a+32,BigInt(l)),setBigUint64(d,a+40,BigInt(o)),setBigUint64(d,a+48,BigInt(s)),setUint32(d,a+56,ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE),setBigUint64(d,a+64,BigInt(s)+BigInt(o)),setUint32(d,a+72,ZIP64_TOTAL_NUMBER_OF_DISKS),l=MAX_16_BITS,s=MAX_32_BITS,o=MAX_32_BITS,a+=76),setUint32(d,a,END_OF_CENTRAL_DIR_SIGNATURE),setUint16(d,a+8,l),setUint16(d,a+10,l),setUint32(d,a+12,o),setUint32(d,a+16,s),await r.writeUint8Array(u),t&&t.length&&await r.writeUint8Array(t)}function sliceAsArrayBuffer(e,t,i){if(e.arrayBuffer)return t||i?e.slice(t,i).arrayBuffer():e.arrayBuffer();{const r=new FileReader;return new Promise(((n,a)=>{r.onload=e=>n(e.target.result),r.onerror=()=>a(r.error),r.readAsArrayBuffer(t||i?e.slice(t,i):e)}))}}async function writeBlob(e,t,i=0){const r=536870912;await async function n(){if(i<t.size){const a=await sliceAsArrayBuffer(t,i,i+r);await e.writeUint8Array(new Uint8Array(a)),i+=r,await n()}}()}function getTimeNTFS(e){if(e)return(BigInt(e.getTime())+BigInt(116444736e5))*BigInt(1e4)}function getOptionValue(e,t,i){return void 0===t[i]?e.options[i]:t[i]}function getMaximumCompressedSize(e){return e+5*(Math.floor(e/16383)+1)}function setUint8(e,t,i){e.setUint8(t,i)}function setUint16(e,t,i){e.setUint16(t,i,!0)}function setUint32(e,t,i){e.setUint32(t,i,!0)}function setBigUint64(e,t,i){e.setBigUint64(t,i,!0)}function arraySet(e,t,i){e.set(t,i)}function getDataView(e){return new DataView(e.buffer)}configure({Deflate:ZipDeflate,Inflate:ZipInflate});var zipNoWorker=Object.freeze({__proto__:null,configure:configure,getMimeType:getMimeType,ERR_ABORT:ERR_ABORT,Reader:Reader,Writer:Writer,TextReader:TextReader,TextWriter:TextWriter,Data64URIReader:Data64URIReader,Data64URIWriter:Data64URIWriter,BlobReader:BlobReader,BlobWriter:BlobWriter,Uint8ArrayReader:Uint8ArrayReader,Uint8ArrayWriter:Uint8ArrayWriter,HttpReader:HttpReader,HttpRangeReader:HttpRangeReader,ERR_HTTP_RANGE:ERR_HTTP_RANGE,ZipReader:ZipReader,ERR_BAD_FORMAT:ERR_BAD_FORMAT,ERR_EOCDR_NOT_FOUND:ERR_EOCDR_NOT_FOUND,ERR_EOCDR_ZIP64_NOT_FOUND:ERR_EOCDR_ZIP64_NOT_FOUND,ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND:ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,ERR_CENTRAL_DIRECTORY_NOT_FOUND:ERR_CENTRAL_DIRECTORY_NOT_FOUND,ERR_LOCAL_FILE_HEADER_NOT_FOUND:ERR_LOCAL_FILE_HEADER_NOT_FOUND,ERR_EXTRAFIELD_ZIP64_NOT_FOUND:ERR_EXTRAFIELD_ZIP64_NOT_FOUND,ERR_ENCRYPTED:ERR_ENCRYPTED,ERR_UNSUPPORTED_ENCRYPTION:ERR_UNSUPPORTED_ENCRYPTION,ERR_UNSUPPORTED_COMPRESSION:ERR_UNSUPPORTED_COMPRESSION,ERR_INVALID_SIGNATURE:ERR_INVALID_SIGNATURE,ERR_INVALID_PASSWORD:ERR_INVALID_PASSWORD,ZipWriter:ZipWriter,ERR_DUPLICATED_NAME:ERR_DUPLICATED_NAME,ERR_INVALID_COMMENT:ERR_INVALID_COMMENT,ERR_INVALID_ENTRY_NAME:ERR_INVALID_ENTRY_NAME,ERR_INVALID_ENTRY_COMMENT:ERR_INVALID_ENTRY_COMMENT,ERR_INVALID_VERSION:ERR_INVALID_VERSION,ERR_INVALID_EXTRAFIELD_TYPE:ERR_INVALID_EXTRAFIELD_TYPE,ERR_INVALID_EXTRAFIELD_DATA:ERR_INVALID_EXTRAFIELD_DATA,ERR_INVALID_ENCRYPTION_STRENGTH:ERR_INVALID_ENCRYPTION_STRENGTH,ERR_UNSUPPORTED_FORMAT:ERR_UNSUPPORTED_FORMAT}),BILLBOARD_SIZE$1=32,kmlNamespace="http://www.opengis.net/kml/2.2",gxNamespace="http://www.google.com/kml/ext/2.2",xmlnsNamespace="http://www.w3.org/2000/xmlns/";function ExternalFileHandler(e){this._files={},this._promises=[],this._count=0,this._modelCallback=e}var imageTypeRegex=/^data:image\/([^,;]+)/;function getModelBlobHander(e,t){return function(i){e._files[t]=i}}function ValueGetter(e){this._time=e}function StyleCache(){this._ids={},this._styles={},this._count=0}function IdManager(){this._ids={}}function exportKml(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).entities,i=defaultValue(e.kmz,!1),r=exportKml._createState(e),n=t.values.filter((function(e){return!defined(e.parent)})),a=r.kmlDoc,o=a.documentElement;o.setAttributeNS(xmlnsNamespace,"xmlns:gx",gxNamespace);var s=a.createElement("Document");o.appendChild(s),recurseEntities(r,s,n),r.styleCache.save(s);var l=r.externalFileHandler;return l.promise.then((function(){var e=(new XMLSerializer).serializeToString(r.kmlDoc);return i?createKmz(e,l.files):{kml:e,externalFiles:l.files}}))}function createKmz(e,t){var i=buildModuleUrl("ThirdParty/Workers/z-worker-pako.js");zipNoWorker.configure({workerScripts:{deflate:[i,"./pako_deflate.min.js"],inflate:[i,"./pako_inflate.min.js"]}});var r=new zipNoWorker.BlobWriter,n=new zipNoWorker.ZipWriter(r);return when(n.add("doc.kml",new zipNoWorker.TextReader(e))).then((function(){var e=Object.keys(t);return addExternalFilesToZip(n,e,t,0)})).then((function(){return when(n.close()).then((function(e){return{kmz:e}}))}))}function addExternalFilesToZip(e,t,i,r){if(t.length!==r){var n=t[r];return when(e.add(n,new zipNoWorker.BlobReader(i[n]))).then((function(){return addExternalFilesToZip(e,t,i,r+1)}))}}function recurseEntities(e,t,i){for(var r,n,a,o=e.kmlDoc,s=e.styleCache,l=e.valueGetter,c=e.idManager,u=i.length,d=0;d<u;++d){var h,p=i[d];r=[],createPoint$1(e,p,n=[],a=[]),createLineString$1(e,p.polyline,n,a),createPolygon$1(e,p.rectangle,n,a,r),createPolygon$1(e,p.polygon,n,a,r),createModel(e,p,p.model,n,a);var f=p.availability;defined(f)&&(h=o.createElement("TimeSpan"),JulianDate.equals(f.start,Iso8601.MINIMUM_VALUE)||h.appendChild(createBasicElementWithText(o,"begin",JulianDate.toIso8601(f.start))),JulianDate.equals(f.stop,Iso8601.MAXIMUM_VALUE)||h.appendChild(createBasicElementWithText(o,"end",JulianDate.toIso8601(f.stop))));for(var m=0;m<r.length;++m){var g=r[m];g.setAttribute("id",c.get(p.id)),g.appendChild(createBasicElementWithText(o,"name",p.name)),g.appendChild(createBasicElementWithText(o,"visibility",p.show)),g.appendChild(createBasicElementWithText(o,"description",p.description)),defined(h)&&g.appendChild(h),t.appendChild(g)}var _=n.length;if(_>0){var y=o.createElement("Placemark");y.setAttribute("id",c.get(p.id));var v=p.name,C=p.label;if(defined(C)){var T=o.createElement("LabelStyle"),S=l.get(C.text);v=defined(S)&&S.length>0?S:v;var A=l.getColor(C.fillColor);defined(A)&&(T.appendChild(createBasicElementWithText(o,"color",A)),T.appendChild(createBasicElementWithText(o,"colorMode","normal")));var x=l.get(C.scale);defined(x)&&T.appendChild(createBasicElementWithText(o,"scale",x)),a.push(T)}y.appendChild(createBasicElementWithText(o,"name",v)),y.appendChild(createBasicElementWithText(o,"visibility",p.show)),y.appendChild(createBasicElementWithText(o,"description",p.description)),defined(h)&&y.appendChild(h),t.appendChild(y);var E=a.length;if(E>0){for(var b=o.createElement("Style"),P=0;P<E;++P)b.appendChild(a[P]);y.appendChild(createBasicElementWithText(o,"styleUrl",s.get(b)))}if(1===n.length)y.appendChild(n[0]);else if(n.length>1){for(var D=o.createElement("MultiGeometry"),w=0;w<_;++w)D.appendChild(n[w]);y.appendChild(D)}}var M=p._children;if(M.length>0){var I=o.createElement("Folder");I.setAttribute("id",c.get(p.id)),I.appendChild(createBasicElementWithText(o,"name",p.name)),I.appendChild(createBasicElementWithText(o,"visibility",p.show)),I.appendChild(createBasicElementWithText(o,"description",p.description)),t.appendChild(I),recurseEntities(e,I,M)}}}ExternalFileHandler.prototype.texture=function(e){var t,i=this;if("string"==typeof e||e instanceof Resource){if(!(e=Resource.createIfNeeded(e)).isDataUri)return e.url;var r=e.url.match(imageTypeRegex);t="texture_"+ ++this._count,defined(r)&&(t+="."+r[1]);var n=e.fetchBlob().then((function(e){i._files[t]=e}));return this._promises.push(n),t}if(e instanceof HTMLCanvasElement){var a=when.defer();return this._promises.push(a.promise),t="texture_"+ ++this._count+".png",e.toBlob((function(e){i._files[t]=e,a.resolve()})),t}return""},ExternalFileHandler.prototype.model=function(e,t){var i=this._modelCallback;if(!defined(i))throw new RuntimeError("Encountered a model entity while exporting to KML, but no model callback was supplied.");var r={},n=i(e,t,r);for(var a in r)if(r.hasOwnProperty(a)){var o=when(r[a]);this._promises.push(o),o.then(getModelBlobHander(this,a))}return n},Object.defineProperties(ExternalFileHandler.prototype,{promise:{get:function(){return when.all(this._promises)}},files:{get:function(){return this._files}}}),ValueGetter.prototype.get=function(e,t,i){var r;return defined(e)&&(r=defined(e.getValue)?e.getValue(this._time,i):e),defaultValue(r,t)},ValueGetter.prototype.getColor=function(e,t){var i=this.get(e,t);if(defined(i))return colorToString(i)},ValueGetter.prototype.getMaterialType=function(e){if(defined(e))return e.getType(this._time)},StyleCache.prototype.get=function(e){var t=this._ids,i=e.innerHTML;if(defined(t[i]))return t[i];var r="style-"+ ++this._count;return e.setAttribute("id",r),r="#"+r,t[i]=r,this._styles[i]=e,r},StyleCache.prototype.save=function(e){var t=this._styles,i=e.childNodes[0];for(var r in t)t.hasOwnProperty(r)&&e.insertBefore(t[r],i)},IdManager.prototype.get=function(e){if(!defined(e))return this.get(createGuid());var t=this._ids;return defined(t[e])?e.toString()+"-"+ ++t[e]:(t[e]=0,e)},exportKml._createState=function(e){var t=e.entities,i=new StyleCache,r=t.computeAvailability(),n=defined(e.time)?e.time:r.start,a=defaultValue(e.defaultAvailability,r),o=defaultValue(e.sampleDuration,60);a.start===Iso8601.MINIMUM_VALUE?a.stop===Iso8601.MAXIMUM_VALUE?a=new TimeInterval:JulianDate.addSeconds(a.stop,-10*o,a.start):a.stop===Iso8601.MAXIMUM_VALUE&&JulianDate.addSeconds(a.start,10*o,a.stop);var s=new ExternalFileHandler(e.modelCallback);return{kmlDoc:document.implementation.createDocument(kmlNamespace,"kml"),ellipsoid:defaultValue(e.ellipsoid,Ellipsoid.WGS84),idManager:new IdManager,styleCache:i,externalFileHandler:s,time:n,valueGetter:new ValueGetter(n),sampleDuration:o,defaultAvailability:new TimeIntervalCollection([a])}};var scratchCartesian3$3=new Cartesian3,scratchCartographic$8=new Cartographic,scratchJulianDate=new JulianDate;function createPoint$1(e,t,i,r){var n=e.kmlDoc,a=e.ellipsoid,o=e.valueGetter,s=defaultValue(t.billboard,t.point);if(defined(s)||defined(t.path)){var l=t.position;if(l.isConstant){o.get(l,void 0,scratchCartesian3$3);var c=createBasicElementWithText(n,"coordinates",getCoordinates(scratchCartesian3$3,a)),u=n.createElement("Point"),d=n.createElement("altitudeMode");d.appendChild(getAltitudeMode(e,s.heightReference)),u.appendChild(d),u.appendChild(c),i.push(u);var h=s instanceof BillboardGraphics?createIconStyleFromBillboard(e,s):createIconStyleFromPoint(e,s);r.push(h)}else createTracks(e,t,s,i,r)}}function createTracks(e,t,i,r,n){var a,o=e.kmlDoc,s=e.ellipsoid,l=e.valueGetter,c=t.position,u=!0;c instanceof CompositePositionProperty?(a=c.intervals,u=!1):a=defaultValue(t.availability,e.defaultAvailability);var d,h,p,f=i instanceof ModelGraphics,m=[];for(d=0;d<a.length;++d){var g=a.get(d),_=u?c:g.data,y=o.createElement("altitudeMode");_ instanceof ScaledPositionProperty?(_=_._value,y.appendChild(getAltitudeMode(e,HeightReference$1.CLAMP_TO_GROUND))):defined(i)?y.appendChild(getAltitudeMode(e,i.heightReference)):y.appendChild(getAltitudeMode(e,HeightReference$1.NONE));var v=[],C=[];if(_.isConstant){l.get(_,void 0,scratchCartesian3$3);var T=createBasicElementWithText(o,"coordinates",getCoordinates(scratchCartesian3$3,s));v.push(JulianDate.toIso8601(g.start)),C.push(T),v.push(JulianDate.toIso8601(g.stop)),C.push(T)}else if(_ instanceof SampledPositionProperty)for(p=_._property._times,h=0;h<p.length;++h)v.push(JulianDate.toIso8601(p[h])),_.getValueInReferenceFrame(p[h],ReferenceFrame$1.FIXED,scratchCartesian3$3),C.push(getCoordinates(scratchCartesian3$3,s));else if(_ instanceof SampledProperty){p=_._times;var S=_._values;for(h=0;h<p.length;++h)v.push(JulianDate.toIso8601(p[h])),Cartesian3.fromArray(S,3*h,scratchCartesian3$3),C.push(getCoordinates(scratchCartesian3$3,s))}else{var A=e.sampleDuration;g.start.clone(scratchJulianDate),g.isStartIncluded||JulianDate.addSeconds(scratchJulianDate,A,scratchJulianDate);for(var x=g.stop;JulianDate.lessThan(scratchJulianDate,x);)_.getValue(scratchJulianDate,scratchCartesian3$3),v.push(JulianDate.toIso8601(scratchJulianDate)),C.push(getCoordinates(scratchCartesian3$3,s)),JulianDate.addSeconds(scratchJulianDate,A,scratchJulianDate);g.isStopIncluded&&JulianDate.equals(scratchJulianDate,x)&&(_.getValue(scratchJulianDate,scratchCartesian3$3),v.push(JulianDate.toIso8601(scratchJulianDate)),C.push(getCoordinates(scratchCartesian3$3,s)))}var E=o.createElementNS(gxNamespace,"Track");E.appendChild(y);for(var b=0;b<v.length;++b){var P=createBasicElementWithText(o,"when",v[b]),D=createBasicElementWithText(o,"coord",C[b],gxNamespace);E.appendChild(P),E.appendChild(D)}f&&E.appendChild(createModelGeometry(e,i)),m.push(E)}if(1===m.length)r.push(m[0]);else if(m.length>1){var w=o.createElementNS(gxNamespace,"MultiTrack");for(d=0;d<m.length;++d)w.appendChild(m[d]);r.push(w)}if(defined(i)&&!f){var M=i instanceof BillboardGraphics?createIconStyleFromBillboard(e,i):createIconStyleFromPoint(e,i);n.push(M)}var I=t.path;if(defined(I)){var R=l.get(I.width),O=I.material;if(defined(O)||defined(R)){var B=o.createElement("LineStyle");defined(R)&&B.appendChild(createBasicElementWithText(o,"width",R)),processMaterial(e,O,B),n.push(B)}}}function createIconStyleFromPoint(e,t){var i=e.kmlDoc,r=e.valueGetter,n=i.createElement("IconStyle"),a=r.getColor(t.color);defined(a)&&(n.appendChild(createBasicElementWithText(i,"color",a)),n.appendChild(createBasicElementWithText(i,"colorMode","normal")));var o=r.get(t.pixelSize);return defined(o)&&n.appendChild(createBasicElementWithText(i,"scale",o/BILLBOARD_SIZE$1)),n}function createIconStyleFromBillboard(e,t){var i=e.kmlDoc,r=e.valueGetter,n=e.externalFileHandler,a=i.createElement("IconStyle"),o=r.get(t.image);if(defined(o)){o=n.texture(o);var s=i.createElement("Icon");s.appendChild(createBasicElementWithText(i,"href",o));var l=r.get(t.imageSubRegion);defined(l)&&(s.appendChild(createBasicElementWithText(i,"x",l.x,gxNamespace)),s.appendChild(createBasicElementWithText(i,"y",l.y,gxNamespace)),s.appendChild(createBasicElementWithText(i,"w",l.width,gxNamespace)),s.appendChild(createBasicElementWithText(i,"h",l.height,gxNamespace))),a.appendChild(s)}var c=r.getColor(t.color);defined(c)&&(a.appendChild(createBasicElementWithText(i,"color",c)),a.appendChild(createBasicElementWithText(i,"colorMode","normal")));var u=r.get(t.scale);defined(u)&&a.appendChild(createBasicElementWithText(i,"scale",u));var d=r.get(t.pixelOffset);if(defined(d)){u=defaultValue(u,1),Cartesian2.divideByScalar(d,u,d);var h=r.get(t.width,BILLBOARD_SIZE$1),p=r.get(t.height,BILLBOARD_SIZE$1),f=r.get(t.horizontalOrigin,HorizontalOrigin$1.CENTER);f===HorizontalOrigin$1.CENTER?d.x-=.5*h:f===HorizontalOrigin$1.RIGHT&&(d.x-=h);var m=r.get(t.verticalOrigin,VerticalOrigin$1.CENTER);m===VerticalOrigin$1.TOP?d.y+=p:m===VerticalOrigin$1.CENTER&&(d.y+=.5*p);var g=i.createElement("hotSpot");g.setAttribute("x",-d.x),g.setAttribute("y",d.y),g.setAttribute("xunits","pixels"),g.setAttribute("yunits","pixels"),a.appendChild(g)}var _=r.get(t.rotation),y=r.get(t.alignedAxis);return defined(_)&&Cartesian3.equals(Cartesian3.UNIT_Z,y)&&(0===(_=CesiumMath.toDegrees(-_))&&(_=360),a.appendChild(createBasicElementWithText(i,"heading",_))),a}function createLineString$1(e,t,i,r){var n=e.kmlDoc,a=e.ellipsoid,o=e.valueGetter;if(defined(t)){var s,l=n.createElement("LineString"),c=n.createElement("altitudeMode"),u=o.get(t.clampToGround,!1);u?(l.appendChild(createBasicElementWithText(n,"tessellate",!0)),s=n.createTextNode("clampToGround")):s=n.createTextNode("absolute"),c.appendChild(s),l.appendChild(c);var d=t.positions,h=createBasicElementWithText(n,"coordinates",getCoordinates(o.get(d),a));l.appendChild(h);var p=o.get(t.zIndex);u&&defined(p)&&l.appendChild(createBasicElementWithText(n,"drawOrder",p,gxNamespace)),i.push(l);var f=n.createElement("LineStyle"),m=o.get(t.width);defined(m)&&f.appendChild(createBasicElementWithText(n,"width",m)),processMaterial(e,t.material,f),r.push(f)}}function getRectangleBoundaries(e,t,i){var r,n=e.kmlDoc,a=e.valueGetter,o=a.get(t.height,0);i>0&&(o=i);for(var s=t.coordinates,l=a.get(s),c=[],u=[Rectangle.northeast,Rectangle.southeast,Rectangle.southwest,Rectangle.northwest],d=0;d<4;++d)u[d](l,scratchCartographic$8),c.push(CesiumMath.toDegrees(scratchCartographic$8.longitude)+","+CesiumMath.toDegrees(scratchCartographic$8.latitude)+","+o);r=createBasicElementWithText(n,"coordinates",c.join(" "));var h=n.createElement("outerBoundaryIs"),p=n.createElement("LinearRing");return p.appendChild(r),h.appendChild(p),[h]}function getLinearRing(e,t,i,r){for(var n=e.kmlDoc,a=e.ellipsoid,o=[],s=t.length,l=0;l<s;++l)Cartographic.fromCartesian(t[l],a,scratchCartographic$8),o.push(CesiumMath.toDegrees(scratchCartographic$8.longitude)+","+CesiumMath.toDegrees(scratchCartographic$8.latitude)+","+(r?scratchCartographic$8.height:i));var c=createBasicElementWithText(n,"coordinates",o.join(" ")),u=n.createElement("LinearRing");return u.appendChild(c),u}function getPolygonBoundaries(e,t,i){var r=e.kmlDoc,n=e.valueGetter,a=n.get(t.height,0),o=n.get(t.perPositionHeight,!1);!o&&i>0&&(a=i);var s=[],l=t.hierarchy,c=n.get(l),u=Array.isArray(c)?c:c.positions,d=r.createElement("outerBoundaryIs");d.appendChild(getLinearRing(e,u,a,o)),s.push(d);var h=c.holes;if(defined(h))for(var p=h.length,f=0;f<p;++f){var m=r.createElement("innerBoundaryIs");m.appendChild(getLinearRing(e,h[f].positions,a,o)),s.push(m)}return s}function createPolygon$1(e,t,i,r,n){var a=e.kmlDoc,o=e.valueGetter;if(defined(t)){var s=t instanceof RectangleGraphics;if(s&&"Image"===o.getMaterialType(t.material))createGroundOverlay(e,t,n);else{var l=a.createElement("Polygon"),c=o.get(t.extrudedHeight,0);c>0&&l.appendChild(createBasicElementWithText(a,"extrude",!0));for(var u=s?getRectangleBoundaries(e,t,c):getPolygonBoundaries(e,t,c),d=u.length,h=0;h<d;++h)l.appendChild(u[h]);var p=a.createElement("altitudeMode");p.appendChild(getAltitudeMode(e,t.heightReference)),l.appendChild(p),i.push(l);var f=a.createElement("PolyStyle"),m=o.get(t.fill,!1);m&&f.appendChild(createBasicElementWithText(a,"fill",m)),processMaterial(e,t.material,f);var g=o.get(t.outline,!1);if(g){f.appendChild(createBasicElementWithText(a,"outline",g));var _=a.createElement("LineStyle"),y=o.get(t.outlineWidth,1);_.appendChild(createBasicElementWithText(a,"width",y));var v=o.getColor(t.outlineColor,Color.BLACK);_.appendChild(createBasicElementWithText(a,"color",v)),_.appendChild(createBasicElementWithText(a,"colorMode","normal")),r.push(_)}r.push(f)}}}function createGroundOverlay(e,t,i){var r=e.kmlDoc,n=e.valueGetter,a=e.externalFileHandler,o=r.createElement("GroundOverlay"),s=r.createElement("altitudeMode");s.appendChild(getAltitudeMode(e,t.heightReference)),o.appendChild(s);var l=n.get(t.height);defined(l)&&o.appendChild(createBasicElementWithText(r,"altitude",l));var c=n.get(t.coordinates),u=r.createElement("LatLonBox");u.appendChild(createBasicElementWithText(r,"north",CesiumMath.toDegrees(c.north))),u.appendChild(createBasicElementWithText(r,"south",CesiumMath.toDegrees(c.south))),u.appendChild(createBasicElementWithText(r,"east",CesiumMath.toDegrees(c.east))),u.appendChild(createBasicElementWithText(r,"west",CesiumMath.toDegrees(c.west))),o.appendChild(u);var d=n.get(t.material),h=a.texture(d.image),p=r.createElement("Icon");p.appendChild(createBasicElementWithText(r,"href",h)),o.appendChild(p),defined(d.color)&&o.appendChild(createBasicElementWithText(r,"color",colorToString(d.color))),i.push(o)}function createModelGeometry(e,t){var i=e.kmlDoc,r=e.valueGetter,n=e.externalFileHandler,a=i.createElement("Model"),o=r.get(t.scale);if(defined(o)){var s=i.createElement("scale");s.appendChild(createBasicElementWithText(i,"x",o)),s.appendChild(createBasicElementWithText(i,"y",o)),s.appendChild(createBasicElementWithText(i,"z",o)),a.appendChild(s)}var l=i.createElement("Link"),c=n.model(t,e.time);return l.appendChild(createBasicElementWithText(i,"href",c)),a.appendChild(l),a}function createModel(e,t,i,r,n){var a=e.kmlDoc,o=e.ellipsoid,s=e.valueGetter;if(defined(i)){var l=t.position;if(l.isConstant){var c=createModelGeometry(e,i),u=a.createElement("altitudeMode");u.appendChild(getAltitudeMode(e,i.heightReference)),c.appendChild(u),s.get(l,void 0,scratchCartesian3$3),Cartographic.fromCartesian(scratchCartesian3$3,o,scratchCartographic$8);var d=a.createElement("Location");d.appendChild(createBasicElementWithText(a,"longitude",CesiumMath.toDegrees(scratchCartographic$8.longitude))),d.appendChild(createBasicElementWithText(a,"latitude",CesiumMath.toDegrees(scratchCartographic$8.latitude))),d.appendChild(createBasicElementWithText(a,"altitude",scratchCartographic$8.height)),c.appendChild(d),r.push(c)}else createTracks(e,t,i,r,n)}}function processMaterial(e,t,i){var r=e.kmlDoc,n=e.valueGetter;if(defined(t)){var a=n.get(t);if(defined(a)){var o;switch(n.getMaterialType(t)){case"Image":o=colorToString(Color.WHITE);break;case"Color":case"Grid":case"PolylineGlow":case"PolylineArrow":case"PolylineDash":o=colorToString(a.color);break;case"PolylineOutline":o=colorToString(a.color);var s=colorToString(a.outlineColor),l=a.outlineWidth;i.appendChild(createBasicElementWithText(r,"outerColor",s,gxNamespace)),i.appendChild(createBasicElementWithText(r,"outerWidth",l,gxNamespace));break;case"Stripe":o=colorToString(a.oddColor)}defined(o)&&(i.appendChild(createBasicElementWithText(r,"color",o)),i.appendChild(createBasicElementWithText(r,"colorMode","normal")))}}}function getAltitudeMode(e,t){var i,r=e.kmlDoc;switch(e.valueGetter.get(t,HeightReference$1.NONE)){case HeightReference$1.NONE:i=r.createTextNode("absolute");break;case HeightReference$1.CLAMP_TO_GROUND:i=r.createTextNode("clampToGround");break;case HeightReference$1.RELATIVE_TO_GROUND:i=r.createTextNode("relativeToGround")}return i}function getCoordinates(e,t){Array.isArray(e)||(e=[e]);for(var i=e.length,r=[],n=0;n<i;++n)Cartographic.fromCartesian(e[n],t,scratchCartographic$8),r.push(CesiumMath.toDegrees(scratchCartographic$8.longitude)+","+CesiumMath.toDegrees(scratchCartographic$8.latitude)+","+scratchCartographic$8.height);return r.join(" ")}function createBasicElementWithText(e,t,i,r){"boolean"==typeof(i=defaultValue(i,""))&&(i=i?"1":"0");var n=defined(r)?e.createElementNS(r,t):e.createElement(t),a="string"===i&&-1!==i.indexOf("<")?e.createCDATASection(i):e.createTextNode(i);return n.appendChild(a),n}function colorToString(e){for(var t="",i=e.toBytes(),r=3;r>=0;--r)t+=i[r]<16?"0"+i[r].toString(16):i[r].toString(16);return t}function identity(e){return e}function transform$1(e){if(null==e)return identity;var t,i,r=e.scale[0],n=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=i=0);var l=2,c=e.length,u=new Array(c);for(u[0]=(t+=e[0])*r+a,u[1]=(i+=e[1])*n+o;l<c;)u[l]=e[l],++l;return u}}function bbox(e){var t,i=transform$1(e.transform),r=1/0,n=r,a=-r,o=-r;function s(e){(e=i(e))[0]<r&&(r=e[0]),e[0]>a&&(a=e[0]),e[1]<n&&(n=e[1]),e[1]>o&&(o=e[1])}function l(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(l);break;case"Point":s(e.coordinates);break;case"MultiPoint":e.coordinates.forEach(s)}}for(t in e.arcs.forEach((function(e){for(var t,s=-1,l=e.length;++s<l;)(t=i(e[s],s))[0]<r&&(r=t[0]),t[0]>a&&(a=t[0]),t[1]<n&&(n=t[1]),t[1]>o&&(o=t[1])})),e.objects)l(e.objects[t]);return[r,n,a,o]}function reverse(e,t){for(var i,r=e.length,n=r-t;n<--r;)i=e[n],e[n++]=e[r],e[r]=i}function feature(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return feature$1(e,t)}))}:feature$1(e,t)}function feature$1(e,t){var i=t.id,r=t.bbox,n=null==t.properties?{}:t.properties,a=object(e,t);return null==i&&null==r?{type:"Feature",properties:n,geometry:a}:null==r?{type:"Feature",id:i,properties:n,geometry:a}:{type:"Feature",id:i,bbox:r,properties:n,geometry:a}}function object(e,t){var i=transform$1(e.transform),r=e.arcs;function n(e,t){t.length&&t.pop();for(var n=r[e<0?~e:e],a=0,o=n.length;a<o;++a)t.push(i(n[a],a));e<0&&reverse(t,o)}function a(e){return i(e)}function o(e){for(var t=[],i=0,r=e.length;i<r;++i)n(e[i],t);return t.length<2&&t.push(t[0]),t}function s(e){for(var t=o(e);t.length<4;)t.push(t[0]);return t}function l(e){return e.map(s)}return function e(t){var i,r=t.type;switch(r){case"GeometryCollection":return{type:r,geometries:t.geometries.map(e)};case"Point":i=a(t.coordinates);break;case"MultiPoint":i=t.coordinates.map(a);break;case"LineString":i=o(t.arcs);break;case"MultiLineString":i=t.arcs.map(o);break;case"Polygon":i=l(t.arcs);break;case"MultiPolygon":i=t.arcs.map(l);break;default:return null}return{type:r,coordinates:i}}(t)}function stitch(e,t){var i={},r={},n={},a=[],o=-1;function s(e,t){for(var r in e){var n=e[r];delete t[n.start],delete n.start,delete n.end,n.forEach((function(e){i[e<0?~e:e]=1})),a.push(n)}}return t.forEach((function(i,r){var n,a=e.arcs[i<0?~i:i];a.length<3&&!a[1][0]&&!a[1][1]&&(n=t[++o],t[o]=i,t[r]=n)})),t.forEach((function(t){var i,a,o=function(t){var i,r=e.arcs[t<0?~t:t],n=r[0];e.transform?(i=[0,0],r.forEach((function(e){i[0]+=e[0],i[1]+=e[1]}))):i=r[r.length-1];return t<0?[i,n]:[n,i]}(t),s=o[0],l=o[1];if(i=n[s])if(delete n[i.end],i.push(t),i.end=l,a=r[l]){delete r[a.start];var c=a===i?i:i.concat(a);r[c.start=i.start]=n[c.end=a.end]=c}else r[i.start]=n[i.end]=i;else if(i=r[l])if(delete r[i.start],i.unshift(t),i.start=s,a=n[s]){delete n[a.end];var u=a===i?i:a.concat(i);r[u.start=a.start]=n[u.end=i.end]=u}else r[i.start]=n[i.end]=i;else r[(i=[t]).start=s]=n[i.end=l]=i})),s(n,r),s(r,n),t.forEach((function(e){i[e<0?~e:e]||a.push([e])})),a}function mesh(e){return object(e,meshArcs.apply(this,arguments))}function meshArcs(e,t,i){var r,n,a;if(arguments.length>1)r=extractArcs(e,t,i);else for(n=0,r=new Array(a=e.arcs.length);n<a;++n)r[n]=n;return{type:"MultiLineString",arcs:stitch(e,r)}}function extractArcs(e,t,i){var r,n=[],a=[];function o(e){var t=e<0?~e:e;(a[t]||(a[t]=[])).push({i:e,g:r})}function s(e){e.forEach(o)}function l(e){e.forEach(s)}return function e(t){switch(r=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":s(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":!function(e){e.forEach(l)}(t.arcs)}}(t),a.forEach(null==i?function(e){n.push(e[0].i)}:function(e){i(e[0].g,e[e.length-1].g)&&n.push(e[0].i)}),n}function planarRingArea(e){for(var t,i=-1,r=e.length,n=e[r-1],a=0;++i<r;)t=n,n=e[i],a+=t[0]*n[1]-t[1]*n[0];return Math.abs(a)}function merge(e){return object(e,mergeArcs.apply(this,arguments))}function mergeArcs(e,t){var i={},r=[],n=[];function a(e){e.forEach((function(t){t.forEach((function(t){(i[t=t<0?~t:t]||(i[t]=[])).push(e)}))})),r.push(e)}function o(t){return planarRingArea(object(e,{type:"Polygon",arcs:[t]}).coordinates[0])}return t.forEach((function e(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"Polygon":a(t.arcs);break;case"MultiPolygon":t.arcs.forEach(a)}})),r.forEach((function(e){if(!e._){var t=[],r=[e];for(e._=1,n.push(t);e=r.pop();)t.push(e),e.forEach((function(e){e.forEach((function(e){i[e<0?~e:e].forEach((function(e){e._||(e._=1,r.push(e))}))}))}))}})),r.forEach((function(e){delete e._})),{type:"MultiPolygon",arcs:n.map((function(t){var r,n=[];if(t.forEach((function(e){e.forEach((function(e){e.forEach((function(e){i[e<0?~e:e].length<2&&n.push(e)}))}))})),(r=(n=stitch(e,n)).length)>1)for(var a,s,l=1,c=o(n[0]);l<r;++l)(a=o(n[l]))>c&&(s=n[0],n[0]=n[l],n[l]=s,c=a);return n})).filter((function(e){return e.length>0}))}}function bisect(e,t){for(var i=0,r=e.length;i<r;){var n=i+r>>>1;e[n]<t?i=n+1:r=n}return i}function neighbors(e){var t={},i=e.map((function(){return[]}));function r(e,i){e.forEach((function(e){e<0&&(e=~e);var r=t[e];r?r.push(i):t[e]=[i]}))}function n(e,t){e.forEach((function(e){r(e,t)}))}var a={LineString:r,MultiLineString:n,Polygon:n,MultiPolygon:function(e,t){e.forEach((function(e){n(e,t)}))}};for(var o in e.forEach((function e(t,i){"GeometryCollection"===t.type?t.geometries.forEach((function(t){e(t,i)})):t.type in a&&a[t.type](t.arcs,i)})),t)for(var s=t[o],l=s.length,c=0;c<l;++c)for(var u=c+1;u<l;++u){var d,h=s[c],p=s[u];(d=i[h])[o=bisect(d,p)]!==p&&d.splice(o,0,p),(d=i[p])[o=bisect(d,h)]!==h&&d.splice(o,0,h)}return i}function untransform(e){if(null==e)return identity;var t,i,r=e.scale[0],n=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=i=0);var l=2,c=e.length,u=new Array(c),d=Math.round((e[0]-a)/r),h=Math.round((e[1]-o)/n);for(u[0]=d-t,t=d,u[1]=h-i,i=h;l<c;)u[l]=e[l],++l;return u}}function quantize(e,t){if(e.transform)throw new Error("already quantized");if(t&&t.scale)s=e.bbox;else{if(!((i=Math.floor(t))>=2))throw new Error("n must be ≥2");var i,r=(s=e.bbox||bbox(e))[0],n=s[1],a=s[2],o=s[3];t={scale:[a-r?(a-r)/(i-1):1,o-n?(o-n)/(i-1):1],translate:[r,n]}}var s,l,c=untransform(t),u=e.objects,d={};function h(e){return c(e)}function p(e){var t;switch(e.type){case"GeometryCollection":t={type:"GeometryCollection",geometries:e.geometries.map(p)};break;case"Point":t={type:"Point",coordinates:h(e.coordinates)};break;case"MultiPoint":t={type:"MultiPoint",coordinates:e.coordinates.map(h)};break;default:return e}return null!=e.id&&(t.id=e.id),null!=e.bbox&&(t.bbox=e.bbox),null!=e.properties&&(t.properties=e.properties),t}for(l in u)d[l]=p(u[l]);return{type:"Topology",bbox:s,transform:t,objects:d,arcs:e.arcs.map((function(e){var t,i=0,r=1,n=e.length,a=new Array(n);for(a[0]=c(e[0],0);++i<n;)((t=c(e[i],i))[0]||t[1])&&(a[r++]=t);return 1===r&&(a[r++]=[0,0]),a.length=r,a}))}}var index=Object.freeze({__proto__:null,bbox:bbox,feature:feature,mesh:mesh,meshArcs:meshArcs,merge:merge,mergeArcs:mergeArcs,neighbors:neighbors,quantize:quantize,transform:transform$1,untransform:untransform});function defaultCrsFunction(e){return Cartesian3.fromDegrees(e[0],e[1],e[2])}var crsNames={"urn:ogc:def:crs:OGC:1.3:CRS84":defaultCrsFunction,"EPSG:4326":defaultCrsFunction,"urn:ogc:def:crs:EPSG::4326":defaultCrsFunction,"EPSG:4490":defaultCrsFunction,"urn:ogc:def:crs:EPSG::4490":defaultCrsFunction},crsLinkHrefs={},crsLinkTypes={},defaultMarkerSize=48,defaultMarkerSymbol,defaultMarkerColor=Color.ROYALBLUE,defaultStroke=Color.YELLOW,defaultStrokeWidth=2,defaultFill=Color.fromBytes(255,255,0,100),defaultClampToGround=!1,sizes={small:24,medium:48,large:64},simpleStyleIdentifiers=["title","description","marker-size","marker-symbol","marker-color","stroke","stroke-opacity","stroke-width","fill","fill-opacity"];function defaultDescribe(e,t){var i="";for(var r in e)if(e.hasOwnProperty(r)){if(r===t||-1!==simpleStyleIdentifiers.indexOf(r))continue;var n=e[r];defined(n)&&(i+="object"==typeof n?"<tr><th>"+r+"</th><td>"+defaultDescribe(n)+"</td></tr>":"<tr><th>"+r+"</th><td>"+n+"</td></tr>")}return i.length>0&&(i='<table class="cesium-infoBox-defaultTable"><tbody>'+i+"</tbody></table>"),i}function createDescriptionCallback(e,t,i){var r;return function(n,a){return defined(r)||(r=e(t,i)),r}}function defaultDescribeProperty(e,t){return new CallbackProperty(createDescriptionCallback(defaultDescribe,e,t),!0)}function createObject(e,t,i){var r=e.id;if(defined(r)&&"Feature"===e.type){for(var n=2,a=r;defined(t.getById(a));)a=r+"_"+n,n++;r=a}else r=createGuid();var o=t.getOrCreateEntity(r),s=e.properties;if(defined(s)){var l;o.properties=s;var c=s.title;if(defined(c))o.name=c,l="title";else{var u=Number.MAX_VALUE;for(var d in s)if(s.hasOwnProperty(d)&&s[d]){var h=d.toLowerCase();if(u>1&&"title"===h){u=1,l=d;break}u>2&&"name"===h?(u=2,l=d):u>3&&/title/i.test(d)?(u=3,l=d):u>4&&/name/i.test(d)&&(u=4,l=d)}defined(l)&&(o.name=s[l])}var p=s.description;null!==p&&(o.description=defined(p)?new ConstantProperty(p):i(s,l))}return o}function coordinatesArrayToCartesianArray(e,t){for(var i=new Array(e.length),r=0;r<e.length;r++)i[r]=t(e[r]);return i}var geoJsonObjectTypes={Feature:processFeature$1,FeatureCollection:processFeatureCollection,GeometryCollection:processGeometryCollection,LineString:processLineString,MultiLineString:processMultiLineString,MultiPoint:processMultiPoint,MultiPolygon:processMultiPolygon,Point:processPoint$1,Polygon:processPolygon$1,Topology:processTopology},geometryTypes$1={GeometryCollection:processGeometryCollection,LineString:processLineString,MultiLineString:processMultiLineString,MultiPoint:processMultiPoint,MultiPolygon:processMultiPolygon,Point:processPoint$1,Polygon:processPolygon$1,Topology:processTopology};function processFeature$1(e,t,i,r,n){if(null!==t.geometry){if(!defined(t.geometry))throw new RuntimeError("feature.geometry is required.");var a=t.geometry.type,o=geometryTypes$1[a];if(!defined(o))throw new RuntimeError("Unknown geometry type: "+a);o(e,t,t.geometry,r,n)}else createObject(t,e._entityCollection,n.describe)}function processFeatureCollection(e,t,i,r,n){for(var a=t.features,o=0,s=a.length;o<s;o++)processFeature$1(e,a[o],void 0,r,n)}function processGeometryCollection(e,t,i,r,n){for(var a=i.geometries,o=0,s=a.length;o<s;o++){var l=a[o],c=l.type,u=geometryTypes$1[c];if(!defined(u))throw new RuntimeError("Unknown geometry type: "+c);u(e,t,l,r,n)}}function createPoint(e,t,i,r,n){var a,o=n.markerSymbol,s=n.markerColor,l=n.markerSize,c=t.properties;if(defined(c)){var u=c["marker-color"];defined(u)&&(s=Color.fromCssColorString(u)),l=defaultValue(sizes[c["marker-size"]],l);var d=c["marker-symbol"];defined(d)&&(o=d)}a=defined(o)?1===o.length?e._pinBuilder.fromText(o.toUpperCase(),s,l):e._pinBuilder.fromMakiIconId(o,s,l):e._pinBuilder.fromColor(s,l);var h=new BillboardGraphics;h.verticalOrigin=new ConstantProperty(VerticalOrigin$1.BOTTOM),2===r.length&&n.clampToGround&&(h.heightReference=HeightReference$1.CLAMP_TO_GROUND);var p=createObject(t,e._entityCollection,n.describe);p.billboard=h,p.position=new ConstantPositionProperty(i(r));var f=when(a).then((function(e){h.image=new ConstantProperty(e)})).otherwise((function(){h.image=new ConstantProperty(e._pinBuilder.fromColor(s,l))}));e._promises.push(f)}function processPoint$1(e,t,i,r,n){createPoint(e,t,r,i.coordinates,n)}function processMultiPoint(e,t,i,r,n){for(var a=i.coordinates,o=0;o<a.length;o++)createPoint(e,t,r,a[o],n)}function createLineString(e,t,i,r,n){var a=n.strokeMaterialProperty,o=n.strokeWidthProperty,s=t.properties;if(defined(s)){var l,c=s["stroke-width"];defined(c)&&(o=new ConstantProperty(c));var u=s.stroke;defined(u)&&(l=Color.fromCssColorString(u));var d=s["stroke-opacity"];defined(d)&&1!==d&&(defined(l)||(l=a.color.clone()),l.alpha=d),defined(l)&&(a=new ColorMaterialProperty(l))}var h=createObject(t,e._entityCollection,n.describe),p=new PolylineGraphics;h.polyline=p,p.clampToGround=n.clampToGround,p.material=a,p.width=o,p.positions=new ConstantProperty(coordinatesArrayToCartesianArray(r,i)),p.arcType=ArcType$1.RHUMB}function processLineString(e,t,i,r,n){createLineString(e,t,r,i.coordinates,n)}function processMultiLineString(e,t,i,r,n){for(var a=i.coordinates,o=0;o<a.length;o++)createLineString(e,t,r,a[o],n)}function createPolygon(e,t,i,r,n){if(0!==r.length&&0!==r[0].length){var a=n.strokeMaterialProperty.color,o=n.fillMaterialProperty,s=n.strokeWidthProperty,l=t.properties;if(defined(l)){var c,u=l["stroke-width"];defined(u)&&(s=new ConstantProperty(u));var d=l.stroke;defined(d)&&(c=Color.fromCssColorString(d));var h,p=l["stroke-opacity"];defined(p)&&1!==p&&(defined(c)||(c=n.strokeMaterialProperty.color.clone()),c.alpha=p),defined(c)&&(a=new ConstantProperty(c));var f=l.fill;defined(f)&&((h=Color.fromCssColorString(f)).alpha=o.color.alpha),defined(p=l["fill-opacity"])&&p!==o.color.alpha&&(defined(h)||(h=o.color.clone()),h.alpha=p),defined(h)&&(o=new ColorMaterialProperty(h))}var m=new PolygonGraphics;m.outline=new ConstantProperty(!0),m.outlineColor=a,m.outlineWidth=s,m.material=o,m.arcType=ArcType$1.RHUMB;for(var g=[],_=1,y=r.length;_<y;_++)g.push(new PolygonHierarchy(coordinatesArrayToCartesianArray(r[_],i)));var v=r[0];m.hierarchy=new ConstantProperty(new PolygonHierarchy(coordinatesArrayToCartesianArray(v,i),g)),v[0].length>2?m.perPositionHeight=new ConstantProperty(!0):n.clampToGround||(m.height=0),createObject(t,e._entityCollection,n.describe).polygon=m}}function processPolygon$1(e,t,i,r,n){createPolygon(e,t,r,i.coordinates,n)}function processMultiPolygon(e,t,i,r,n){for(var a=i.coordinates,o=0;o<a.length;o++)createPolygon(e,t,r,a[o],n)}function processTopology(e,t,i,r,n){for(var a in i.objects)if(i.objects.hasOwnProperty(a)){var o=index.feature(i,i.objects[a]);(0,geoJsonObjectTypes[o.type])(e,o,o,r,n)}}function GeoJsonDataSource(e){this._name=e,this._changed=new Event,this._error=new Event,this._isLoading=!1,this._loading=new Event,this._entityCollection=new EntityCollection(this),this._promises=[],this._pinBuilder=new PinBuilder,this._entityCluster=new EntityCluster,this._credit=void 0,this._resourceCredits=[]}function load$1(e,t,i,r){var n;defined(r)&&(n=getFilenameFromUri(r)),defined(n)&&e._name!==n&&(e._name=n,e._changed.raiseEvent(e));var a=geoJsonObjectTypes[t.type];if(!defined(a))throw new RuntimeError("Unsupported GeoJSON object type: "+t.type);var o=t.crs,s=null!==o?defaultCrsFunction:null;if(defined(o)){if(!defined(o.properties))throw new RuntimeError("crs.properties is undefined.");var l=o.properties;if("name"===o.type){if(!defined(s=crsNames[l.name]))throw new RuntimeError("Unknown crs name: "+l.name)}else if("link"===o.type){var c=crsLinkHrefs[l.href];if(defined(c)||(c=crsLinkTypes[l.type]),!defined(c))throw new RuntimeError("Unable to resolve crs link: "+JSON.stringify(l));s=c(l)}else{if("EPSG"!==o.type)throw new RuntimeError("Unknown crs type: "+o.type);if(!defined(s=crsNames["EPSG:"+l.code]))throw new RuntimeError("Unknown crs EPSG code: "+l.code)}}return when(s,(function(r){return e._entityCollection.removeAll(),null!==r&&a(e,t,t,r,i),when.all(e._promises,(function(){return e._promises.length=0,DataSource.setLoading(e,!1),e}))}))}function KmlCamera(e,t){this.position=e,this.headingPitchRoll=t}function defaults(e,t){for(var i in t)t.hasOwnProperty(i)&&void 0===e[i]&&(e[i]=t[i]);return e}function ellipsis(e,t,i){var r;return e.length>t&&(null==i?(i="…",r=3):r=i.length,e=e.substring(0,t-r)+i),e}function indexOf(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var i=0,r=e.length;i<r;i++)if(e[i]===t)return i;return-1}function remove$1(e,t){for(var i=e.length-1;i>=0;i--)!0===t(e[i])&&e.splice(i,1)}function splitAndCapture(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var i,r=[],n=0;i=t.exec(e);)r.push(e.substring(n,i.index)),r.push(i[0]),n=i.index+i[0].length;return r.push(e.substring(n)),r}function throwUnhandledCaseError(e){throw new Error("Unhandled case for value: '"+e+"'")}GeoJsonDataSource.load=function(e,t){return(new GeoJsonDataSource).load(e,t)},Object.defineProperties(GeoJsonDataSource,{markerSize:{get:function(){return defaultMarkerSize},set:function(e){defaultMarkerSize=e}},markerSymbol:{get:function(){return defaultMarkerSymbol},set:function(e){defaultMarkerSymbol=e}},markerColor:{get:function(){return defaultMarkerColor},set:function(e){defaultMarkerColor=e}},stroke:{get:function(){return defaultStroke},set:function(e){defaultStroke=e}},strokeWidth:{get:function(){return defaultStrokeWidth},set:function(e){defaultStrokeWidth=e}},fill:{get:function(){return defaultFill},set:function(e){defaultFill=e}},clampToGround:{get:function(){return defaultClampToGround},set:function(e){defaultClampToGround=e}},crsNames:{get:function(){return crsNames}},crsLinkHrefs:{get:function(){return crsLinkHrefs}},crsLinkTypes:{get:function(){return crsLinkTypes}}}),Object.defineProperties(GeoJsonDataSource.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{value:void 0,writable:!1},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}},credit:{get:function(){return this._credit}}}),GeoJsonDataSource.prototype.load=function(e,t){DataSource.setLoading(this,!0);var i=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i;var r=e,n=t.sourceUri;if("string"==typeof e||e instanceof Resource){r=(e=Resource.createIfNeeded(e)).fetchJson(),n=defaultValue(n,e.getUrlComponent());var a=this._resourceCredits,o=e.credits;if(defined(o))for(var s=o.length,l=0;l<s;l++)a.push(o[l])}t={describe:defaultValue(t.describe,defaultDescribeProperty),markerSize:defaultValue(t.markerSize,defaultMarkerSize),markerSymbol:defaultValue(t.markerSymbol,defaultMarkerSymbol),markerColor:defaultValue(t.markerColor,defaultMarkerColor),strokeWidthProperty:new ConstantProperty(defaultValue(t.strokeWidth,defaultStrokeWidth)),strokeMaterialProperty:new ColorMaterialProperty(defaultValue(t.stroke,defaultStroke)),fillMaterialProperty:new ColorMaterialProperty(defaultValue(t.fill,defaultFill)),clampToGround:defaultValue(t.clampToGround,defaultClampToGround)};var c=this;return when(r,(function(e){return load$1(c,e,t,n)})).otherwise((function(e){return DataSource.setLoading(c,!1),c._error.raiseEvent(c,e),console.log(e),when.reject(e)}))},GeoJsonDataSource.prototype.update=function(e){return!0};var HtmlTag=function(){function e(e){void 0===e&&(e={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=e.tagName||"",this.attrs=e.attrs||{},this.innerHTML=e.innerHtml||e.innerHTML||""}return e.prototype.setTagName=function(e){return this.tagName=e,this},e.prototype.getTagName=function(){return this.tagName||""},e.prototype.setAttr=function(e,t){return this.getAttrs()[e]=t,this},e.prototype.getAttr=function(e){return this.getAttrs()[e]},e.prototype.setAttrs=function(e){return Object.assign(this.getAttrs(),e),this},e.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},e.prototype.setClass=function(e){return this.setAttr("class",e)},e.prototype.addClass=function(e){for(var t,i=this.getClass(),r=this.whitespaceRegex,n=i?i.split(r):[],a=e.split(r);t=a.shift();)-1===indexOf(n,t)&&n.push(t);return this.getAttrs().class=n.join(" "),this},e.prototype.removeClass=function(e){for(var t,i=this.getClass(),r=this.whitespaceRegex,n=i?i.split(r):[],a=e.split(r);n.length&&(t=a.shift());){var o=indexOf(n,t);-1!==o&&n.splice(o,1)}return this.getAttrs().class=n.join(" "),this},e.prototype.getClass=function(){return this.getAttrs().class||""},e.prototype.hasClass=function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},e.prototype.setInnerHTML=function(e){return this.innerHTML=e,this},e.prototype.setInnerHtml=function(e){return this.setInnerHTML(e)},e.prototype.getInnerHTML=function(){return this.innerHTML||""},e.prototype.getInnerHtml=function(){return this.getInnerHTML()},e.prototype.toAnchorString=function(){var e=this.getTagName(),t=this.buildAttrsStr();return["<",e,t=t?" "+t:"",">",this.getInnerHtml(),"</",e,">"].join("")},e.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(i+'="'+e[i]+'"');return t.join(" ")},e}();function truncateSmart(e,t,i){var r,n;null==i?(i="…",n=3,r=8):(n=i.length,r=i.length);var a=function(e){var t="";return e.scheme&&e.host&&(t+=e.scheme+"://"),e.host&&(t+=e.host),e.path&&(t+="/"+e.path),e.query&&(t+="?"+e.query),e.fragment&&(t+="#"+e.fragment),t},o=function(e,t){var r=t/2,n=Math.ceil(r),a=-1*Math.floor(r),o="";return a<0&&(o=e.substr(a)),e.substr(0,n)+i+o};if(e.length<=t)return e;var s=t-n,l=function(e){var t={},i=e,r=i.match(/^([a-z]+):\/\//i);return r&&(t.scheme=r[1],i=i.substr(r[0].length)),(r=i.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(t.host=r[1],i=i.substr(r[0].length)),(r=i.match(/^\/(.*?)(?=(\?|#|$))/i))&&(t.path=r[1],i=i.substr(r[0].length)),(r=i.match(/^\?(.*?)(?=(#|$))/i))&&(t.query=r[1],i=i.substr(r[0].length)),(r=i.match(/^#(.*?)$/i))&&(t.fragment=r[1]),t}(e);if(l.query){var c=l.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);c&&(l.query=l.query.substr(0,c[1].length),e=a(l))}if(e.length<=t)return e;if(l.host&&(l.host=l.host.replace(/^www\./,""),e=a(l)),e.length<=t)return e;var u="";if(l.host&&(u+=l.host),u.length>=s)return l.host.length==t?(l.host.substr(0,t-n)+i).substr(0,s+r):o(u,s).substr(0,s+r);var d="";if(l.path&&(d+="/"+l.path),l.query&&(d+="?"+l.query),d){if((u+d).length>=s)return(u+d).length==t?(u+d).substr(0,t):(u+o(d,s-u.length)).substr(0,s+r);u+=d}if(l.fragment){var h="#"+l.fragment;if((u+h).length>=s)return(u+h).length==t?(u+h).substr(0,t):(u+o(h,s-u.length)).substr(0,s+r);u+=h}if(l.scheme&&l.host){var p=l.scheme+"://";if((u+p).length<s)return(p+u).substr(0,t)}if(u.length<=t)return u;var f="";return s>0&&(f=u.substr(-1*Math.floor(s/2))),(u.substr(0,Math.ceil(s/2))+i+f).substr(0,s+r)}function truncateMiddle(e,t,i){if(e.length<=t)return e;var r,n;null==i?(i="…",r=8,n=3):(r=i.length,n=i.length);var a=t-n,o="";return a>0&&(o=e.substr(-1*Math.floor(a/2))),(e.substr(0,Math.ceil(a/2))+i+o).substr(0,a+r)}function truncateEnd(e,t,i){return ellipsis(e,t,i)}var AnchorTagBuilder=function(){function e(e){void 0===e&&(e={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=e.newWindow||!1,this.truncate=e.truncate||{},this.className=e.className||""}return e.prototype.build=function(e){return new HtmlTag({tagName:"a",attrs:this.createAttrs(e),innerHtml:this.processAnchorText(e.getAnchorText())})},e.prototype.createAttrs=function(e){var t={href:e.getAnchorHref()},i=this.createCssClass(e);return i&&(t.class=i),this.newWindow&&(t.target="_blank",t.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<e.getAnchorText().length&&(t.title=e.getAnchorHref()),t},e.prototype.createCssClass=function(e){var t=this.className;if(t){for(var i=[t],r=e.getCssClassSuffixes(),n=0,a=r.length;n<a;n++)i.push(t+"-"+r[n]);return i.join(" ")}return""},e.prototype.processAnchorText=function(e){return e=this.doTruncate(e)},e.prototype.doTruncate=function(e){var t=this.truncate;if(!t||!t.length)return e;var i=t.length,r=t.location;return"smart"===r?truncateSmart(e,i):"middle"===r?truncateMiddle(e,i):truncateEnd(e,i)},e}(),Match=function(){function e(e){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=e.tagBuilder,this.matchedText=e.matchedText,this.offset=e.offset}return e.prototype.getMatchedText=function(){return this.matchedText},e.prototype.setOffset=function(e){this.offset=e},e.prototype.getOffset=function(){return this.offset},e.prototype.getCssClassSuffixes=function(){return[this.getType()]},e.prototype.buildTag=function(){return this.tagBuilder.build(this)},e}(),extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},extendStatics(e,t)};function __extends(e,t){function i(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var __assign=function(){return __assign=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},__assign.apply(this,arguments)},EmailMatch=function(e){function t(t){var i=e.call(this,t)||this;return i.email="",i.email=t.email,i}return __extends(t,e),t.prototype.getType=function(){return"email"},t.prototype.getEmail=function(){return this.email},t.prototype.getAnchorHref=function(){return"mailto:"+this.email},t.prototype.getAnchorText=function(){return this.email},t}(Match),HashtagMatch=function(e){function t(t){var i=e.call(this,t)||this;return i.serviceName="",i.hashtag="",i.serviceName=t.serviceName,i.hashtag=t.hashtag,i}return __extends(t,e),t.prototype.getType=function(){return"hashtag"},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getHashtag=function(){return this.hashtag},t.prototype.getAnchorHref=function(){var e=this.serviceName,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;case"instagram":return"https://instagram.com/explore/tags/"+t;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(Match),MentionMatch=function(e){function t(t){var i=e.call(this,t)||this;return i.serviceName="twitter",i.mention="",i.mention=t.mention,i.serviceName=t.serviceName,i}return __extends(t,e),t.prototype.getType=function(){return"mention"},t.prototype.getMention=function(){return this.mention},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;default:throw new Error("Unknown service name to point mention to: "+this.serviceName)}},t.prototype.getAnchorText=function(){return"@"+this.mention},t.prototype.getCssClassSuffixes=function(){var t=e.prototype.getCssClassSuffixes.call(this),i=this.getServiceName();return i&&t.push(i),t},t}(Match),PhoneMatch=function(e){function t(t){var i=e.call(this,t)||this;return i.number="",i.plusSign=!1,i.number=t.number,i.plusSign=t.plusSign,i}return __extends(t,e),t.prototype.getType=function(){return"phone"},t.prototype.getPhoneNumber=function(){return this.number},t.prototype.getNumber=function(){return this.getPhoneNumber()},t.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},t.prototype.getAnchorText=function(){return this.matchedText},t}(Match),UrlMatch=function(e){function t(t){var i=e.call(this,t)||this;return i.url="",i.urlMatchType="scheme",i.protocolUrlMatch=!1,i.protocolRelativeMatch=!1,i.stripPrefix={scheme:!0,www:!0},i.stripTrailingSlash=!0,i.decodePercentEncoding=!0,i.schemePrefixRegex=/^(https?:\/\/)?/i,i.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,i.protocolRelativeRegex=/^\/\//,i.protocolPrepended=!1,i.urlMatchType=t.urlMatchType,i.url=t.url,i.protocolUrlMatch=t.protocolUrlMatch,i.protocolRelativeMatch=t.protocolRelativeMatch,i.stripPrefix=t.stripPrefix,i.stripTrailingSlash=t.stripTrailingSlash,i.decodePercentEncoding=t.decodePercentEncoding,i}return __extends(t,e),t.prototype.getType=function(){return"url"},t.prototype.getUrlMatchType=function(){return this.urlMatchType},t.prototype.getUrl=function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},t.prototype.getAnchorHref=function(){return this.getUrl().replace(/&/g,"&")},t.prototype.getAnchorText=function(){var e=this.getMatchedText();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix.scheme&&(e=this.stripSchemePrefix(e)),this.stripPrefix.www&&(e=this.stripWwwPrefix(e)),this.stripTrailingSlash&&(e=this.removeTrailingSlash(e)),this.decodePercentEncoding&&(e=this.removePercentEncoding(e)),e},t.prototype.stripSchemePrefix=function(e){return e.replace(this.schemePrefixRegex,"")},t.prototype.stripWwwPrefix=function(e){return e.replace(this.wwwPrefixRegex,"$1")},t.prototype.stripProtocolRelativePrefix=function(e){return e.replace(this.protocolRelativeRegex,"")},t.prototype.removeTrailingSlash=function(e){return"/"===e.charAt(e.length-1)&&(e=e.slice(0,-1)),e},t.prototype.removePercentEncoding=function(e){var t=e.replace(/%22/gi,""").replace(/%26/gi,"&").replace(/%27/gi,"'").replace(/%3C/gi,"<").replace(/%3E/gi,">");try{return decodeURIComponent(t)}catch(e){return t}},t}(Match),Matcher=function(e){this.__jsduckDummyDocProp=null,this.tagBuilder=e.tagBuilder},letterRe=/[A-Za-z]/,digitRe=/[\d]/,nonDigitRe=/[\D]/,whitespaceRe=/\s/,quoteRe=/['"]/,controlCharsRe=/[\x00-\x1F\x7F]/,alphaCharsStr=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source,emojiStr=/\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source,marksStr=/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source,alphaCharsAndMarksStr=alphaCharsStr+emojiStr+marksStr,decimalNumbersStr=/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source,alphaNumericCharsStr=alphaCharsAndMarksStr+decimalNumbersStr,alphaNumericAndMarksCharsStr=alphaCharsAndMarksStr+decimalNumbersStr,ipStr="(?:["+decimalNumbersStr+"]{1,3}\\.){3}["+decimalNumbersStr+"]{1,3}",domainLabelStr="["+alphaNumericAndMarksCharsStr+"](?:["+alphaNumericAndMarksCharsStr+"\\-]{0,61}["+alphaNumericAndMarksCharsStr+"])?",getDomainLabelStr=function(e){return"(?=("+domainLabelStr+"))\\"+e},getDomainNameStr=function(e){return"(?:"+getDomainLabelStr(e)+"(?:\\."+getDomainLabelStr(e+1)+"){0,126}|"+ipStr+")"},domainNameCharRegex=new RegExp("["+alphaNumericAndMarksCharsStr+"]"),tldRegex=/(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|rightathome|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pbt977c|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|newholland|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|telefonica|university|vistaprint|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|honeywell|institute|insurance|kuokgroup|ladbrokes|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--tckwe|xn--vhquv|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|chrysler|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|esurance|etisalat|everbank|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|movistar|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|symantec|training|uconnect|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|cartier|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|iselect|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lancome|lanxess|lasalle|latrobe|leclerc|liaison|limited|lincoln|markets|metlife|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|shriram|singles|staples|starhub|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|الجزائر|العليان|پاکستان|كاثوليك|موبايلي|இந்தியா|abarth|abbott|abbvie|active|africa|agency|airbus|airtel|alipay|alsace|alstom|anquan|aramco|author|bayern|beauty|berlin|bharti|blanco|bostik|boston|broker|camera|career|caseih|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|mobily|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|piaget|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|warman|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|dodge|drive|dubai|earth|edeka|email|epost|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|intel|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|lupin|macys|mango|media|miami|money|mopar|movie|nadex|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|zippo|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|aigo|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|doha|duck|duns|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scor|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bnl|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceb|ceo|cfa|cfd|com|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jcp|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|srl|srt|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ストア|セール|みんな|中文网|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,localPartCharRegex=new RegExp("["+alphaNumericAndMarksCharsStr+"!#$%&'*+/=?^_`{|}~-]"),strictTldRegex=new RegExp("^"+tldRegex.source+"$"),EmailMatcher=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.localPartCharRegex=localPartCharRegex,t.strictTldRegex=strictTldRegex,t}return __extends(t,e),t.prototype.parseMatches=function(e){for(var t=this.tagBuilder,i=this.localPartCharRegex,r=this.strictTldRegex,n=[],a=e.length,o=new CurrentEmailMatch,s={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},l=0,c=0,u=o;l<a;){var d=e.charAt(l);switch(c){case 0:h(d);break;case 1:p(e.charAt(l-1),d);break;case 2:f(d);break;case 3:m(d);break;case 4:g(d);break;case 5:_(d);break;case 6:y(d);break;case 7:v(d);break;default:throwUnhandledCaseError(c)}l++}return S(),n;function h(e){"m"===e?C(1):i.test(e)&&C()}function p(e,t){":"===e?i.test(t)?(c=2,u=new CurrentEmailMatch(__assign(__assign({},u),{hasMailtoPrefix:!0}))):T():s[e]===t||(i.test(t)?c=2:"."===t?c=3:"@"===t?c=4:T())}function f(e){"."===e?c=3:"@"===e?c=4:i.test(e)||T()}function m(e){"."===e||"@"===e?T():i.test(e)?c=2:T()}function g(e){domainNameCharRegex.test(e)?c=5:T()}function _(e){"."===e?c=7:"-"===e?c=6:domainNameCharRegex.test(e)||S()}function y(e){"-"===e||"."===e?S():domainNameCharRegex.test(e)?c=5:S()}function v(e){"."===e||"-"===e?S():domainNameCharRegex.test(e)?(c=5,u=new CurrentEmailMatch(__assign(__assign({},u),{hasDomainDot:!0}))):S()}function C(e){void 0===e&&(e=2),c=e,u=new CurrentEmailMatch({idx:l})}function T(){c=0,u=o}function S(){if(u.hasDomainDot){var i=e.slice(u.idx,l);/[-.]$/.test(i)&&(i=i.slice(0,-1));var a=u.hasMailtoPrefix?i.slice("mailto:".length):i;(function(e){var t=(e.split(".").pop()||"").toLowerCase();return r.test(t)})(a)&&n.push(new EmailMatch({tagBuilder:t,matchedText:i,offset:u.idx,email:a}))}T()}},t}(Matcher),CurrentEmailMatch=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.hasMailtoPrefix=!!e.hasMailtoPrefix,this.hasDomainDot=!!e.hasDomainDot},UrlMatchValidator=function(){function e(){}return e.isValid=function(e,t){return!(t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)&&!this.isValidIpAddress(e)||this.containsMultipleDots(e))},e.isValidIpAddress=function(e){var t=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return null!==e.match(t)},e.containsMultipleDots=function(e){var t=e;return this.hasFullProtocolRegex.test(e)&&(t=e.split("://")[1]),t.split("/")[0].indexOf("..")>-1},e.isValidUriScheme=function(e){var t=e.match(this.uriSchemeRegex),i=t&&t[0].toLowerCase();return"javascript:"!==i&&"vbscript:"!==i},e.urlMatchDoesNotHaveProtocolOrDot=function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},e.urlMatchDoesNotHaveAtLeastOneWordChar=function(e,t){return!(!e||!t)&&(!this.hasFullProtocolRegex.test(t)&&!this.hasWordCharAfterProtocolRegex.test(e))},e.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,e.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,e.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+alphaCharsStr+"]"),e.ipRegex=/[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/,e}(),matcherRegex$1=(urlSuffixRegex=new RegExp("[/?#](?:["+alphaNumericAndMarksCharsStr+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+alphaNumericAndMarksCharsStr+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,getDomainNameStr(2),")","|","(","(//)?",/(?:www\.)/.source,getDomainNameStr(6),")","|","(","(//)?",getDomainNameStr(10)+"\\.",tldRegex.source,"(?![-"+alphaNumericCharsStr+"])",")",")","(?::[0-9]+)?","(?:"+urlSuffixRegex.source+")?"].join(""),"gi")),urlSuffixRegex,wordCharRegExp=new RegExp("["+alphaNumericAndMarksCharsStr+"]"),UrlMatcher=function(e){function t(t){var i=e.call(this,t)||this;return i.stripPrefix={scheme:!0,www:!0},i.stripTrailingSlash=!0,i.decodePercentEncoding=!0,i.matcherRegex=matcherRegex$1,i.wordCharRegExp=wordCharRegExp,i.stripPrefix=t.stripPrefix,i.stripTrailingSlash=t.stripTrailingSlash,i.decodePercentEncoding=t.decodePercentEncoding,i}return __extends(t,e),t.prototype.parseMatches=function(e){for(var t,i=this.matcherRegex,r=this.stripPrefix,n=this.stripTrailingSlash,a=this.decodePercentEncoding,o=this.tagBuilder,s=[],l=function(){var i=t[0],l=t[1],u=t[4],d=t[5],h=t[9],p=t.index,f=d||h,m=e.charAt(p-1);if(!UrlMatchValidator.isValid(i,l))return"continue";if(p>0&&"@"===m)return"continue";if(p>0&&f&&c.wordCharRegExp.test(m))return"continue";if(/\?$/.test(i)&&(i=i.substr(0,i.length-1)),c.matchHasUnbalancedClosingParen(i))i=i.substr(0,i.length-1);else{var g=c.matchHasInvalidCharAfterTld(i,l);g>-1&&(i=i.substr(0,g))}var _=["http://","https://"].find((function(e){return!!l&&-1!==l.indexOf(e)}));if(_){var y=i.indexOf(_);i=i.substr(y),l=l.substr(y),p+=y}var v=l?"scheme":u?"www":"tld",C=!!l;s.push(new UrlMatch({tagBuilder:o,matchedText:i,offset:p,urlMatchType:v,url:i,protocolUrlMatch:C,protocolRelativeMatch:!!f,stripPrefix:r,stripTrailingSlash:n,decodePercentEncoding:a}))},c=this;null!==(t=i.exec(e));)l();return s},t.prototype.matchHasUnbalancedClosingParen=function(e){var t,i=e.charAt(e.length-1);if(")"===i)t="(";else if("]"===i)t="[";else{if("}"!==i)return!1;t="{"}for(var r=0,n=0,a=e.length-1;n<a;n++){var o=e.charAt(n);o===t?r++:o===i&&(r=Math.max(r-1,0))}return 0===r},t.prototype.matchHasInvalidCharAfterTld=function(e,t){if(!e)return-1;var i=0;t&&(i=e.indexOf(":"),e=e.slice(i));var r=new RegExp("^((.?//)?[-."+alphaNumericAndMarksCharsStr+"]*[-"+alphaNumericAndMarksCharsStr+"]\\.[-"+alphaNumericAndMarksCharsStr+"]+)").exec(e);return null===r?-1:(i+=r[1].length,e=e.slice(r[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?i:-1)},t}(Matcher),matcherRegex=new RegExp("#[_"+alphaNumericAndMarksCharsStr+"]{1,139}(?![_"+alphaNumericAndMarksCharsStr+"])","g"),nonWordCharRegex$1=new RegExp("[^"+alphaNumericAndMarksCharsStr+"]"),HashtagMatcher=function(e){function t(t){var i=e.call(this,t)||this;return i.serviceName="twitter",i.matcherRegex=matcherRegex,i.nonWordCharRegex=nonWordCharRegex$1,i.serviceName=t.serviceName,i}return __extends(t,e),t.prototype.parseMatches=function(e){for(var t,i=this.matcherRegex,r=this.nonWordCharRegex,n=this.serviceName,a=this.tagBuilder,o=[];null!==(t=i.exec(e));){var s=t.index,l=e.charAt(s-1);if(0===s||r.test(l)){var c=t[0],u=t[0].slice(1);o.push(new HashtagMatch({tagBuilder:a,matchedText:c,offset:s,serviceName:n,hashtag:u}))}}return o},t}(Matcher),mostPhoneNumbers=/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/,japanesePhoneRe=/(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/,phoneMatcherRegex=new RegExp(mostPhoneNumbers.source+"|"+japanesePhoneRe.source,"g"),PhoneMatcher=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.matcherRegex=phoneMatcherRegex,t}return __extends(t,e),t.prototype.parseMatches=function(e){for(var t,i=this.matcherRegex,r=this.tagBuilder,n=[];null!==(t=i.exec(e));){var a=t[0],o=a.replace(/[^0-9,;#]/g,""),s=!(!t[1]&&!t[2]),l=0==t.index?"":e.substr(t.index-1,1),c=e.substr(t.index+a.length,1),u=!l.match(/\d/)&&!c.match(/\d/);this.testMatch(t[3])&&this.testMatch(a)&&u&&n.push(new PhoneMatch({tagBuilder:r,matchedText:a,offset:t.index,number:o,plusSign:s}))}return n},t.prototype.testMatch=function(e){return nonDigitRe.test(e)},t}(Matcher),twitterRegex=new RegExp("@[_"+alphaNumericAndMarksCharsStr+"]{1,50}(?![_"+alphaNumericAndMarksCharsStr+"])","g"),instagramRegex=new RegExp("@[_."+alphaNumericAndMarksCharsStr+"]{1,30}(?![_"+alphaNumericAndMarksCharsStr+"])","g"),soundcloudRegex=new RegExp("@[-_."+alphaNumericAndMarksCharsStr+"]{1,50}(?![-_"+alphaNumericAndMarksCharsStr+"])","g"),nonWordCharRegex=new RegExp("[^"+alphaNumericAndMarksCharsStr+"]"),MentionMatcher=function(e){function t(t){var i=e.call(this,t)||this;return i.serviceName="twitter",i.matcherRegexes={twitter:twitterRegex,instagram:instagramRegex,soundcloud:soundcloudRegex},i.nonWordCharRegex=nonWordCharRegex,i.serviceName=t.serviceName,i}return __extends(t,e),t.prototype.parseMatches=function(e){var t,i=this.serviceName,r=this.matcherRegexes[this.serviceName],n=this.nonWordCharRegex,a=this.tagBuilder,o=[];if(!r)return o;for(;null!==(t=r.exec(e));){var s=t.index,l=e.charAt(s-1);if(0===s||n.test(l)){var c=t[0].replace(/\.+$/g,""),u=c.slice(1);o.push(new MentionMatch({tagBuilder:a,matchedText:c,offset:s,serviceName:i,mention:u}))}}return o},t}(Matcher);function parseHtml(e,t){for(var i=t.onOpenTag,r=t.onCloseTag,n=t.onText,a=t.onComment,o=t.onDoctype,s=new CurrentTag,l=0,c=e.length,u=0,d=0,h=s;l<c;){var p=e.charAt(l);switch(u){case 0:f(p);break;case 1:m(p);break;case 2:_(p);break;case 3:g(p);break;case 4:y(p);break;case 5:v(p);break;case 6:C(p);break;case 7:T(p);break;case 8:S(p);break;case 9:A(p);break;case 10:x(p);break;case 11:E(p);break;case 12:b(p);break;case 13:P();break;case 14:D(p);break;case 15:w(p);break;case 16:M(p);break;case 17:I(p);break;case 18:R(p);break;case 19:O(p);break;case 20:B(p);break;default:throwUnhandledCaseError(u)}l++}function f(e){"<"===e&&F()}function m(e){"!"===e?u=13:"/"===e?(u=2,h=new CurrentTag(__assign(__assign({},h),{isClosing:!0}))):"<"===e?F():letterRe.test(e)?(u=3,h=new CurrentTag(__assign(__assign({},h),{isOpening:!0}))):(u=0,h=s)}function g(e){whitespaceRe.test(e)?(h=new CurrentTag(__assign(__assign({},h),{name:V()})),u=4):"<"===e?F():"/"===e?(h=new CurrentTag(__assign(__assign({},h),{name:V()})),u=12):">"===e?(h=new CurrentTag(__assign(__assign({},h),{name:V()})),N()):letterRe.test(e)||digitRe.test(e)||":"===e||L()}function _(e){">"===e?L():letterRe.test(e)?u=3:L()}function y(e){whitespaceRe.test(e)||("/"===e?u=12:">"===e?N():"<"===e?F():"="===e||quoteRe.test(e)||controlCharsRe.test(e)?L():u=5)}function v(e){whitespaceRe.test(e)?u=6:"/"===e?u=12:"="===e?u=7:">"===e?N():"<"===e?F():quoteRe.test(e)&&L()}function C(e){whitespaceRe.test(e)||("/"===e?u=12:"="===e?u=7:">"===e?N():"<"===e?F():quoteRe.test(e)?L():u=5)}function T(e){whitespaceRe.test(e)||('"'===e?u=8:"'"===e?u=9:/[>=`]/.test(e)?L():"<"===e?F():u=10)}function S(e){'"'===e&&(u=11)}function A(e){"'"===e&&(u=11)}function x(e){whitespaceRe.test(e)?u=4:">"===e?N():"<"===e&&F()}function E(e){whitespaceRe.test(e)?u=4:"/"===e?u=12:">"===e?N():"<"===e?F():(u=4,l--)}function b(e){">"===e?(h=new CurrentTag(__assign(__assign({},h),{isClosing:!0})),N()):u=4}function P(t){"--"===e.substr(l,2)?(l+=2,h=new CurrentTag(__assign(__assign({},h),{type:"comment"})),u=14):"DOCTYPE"===e.substr(l,7).toUpperCase()?(l+=7,h=new CurrentTag(__assign(__assign({},h),{type:"doctype"})),u=20):L()}function D(e){"-"===e?u=15:">"===e?L():u=16}function w(e){"-"===e?u=18:">"===e?L():u=16}function M(e){"-"===e&&(u=17)}function I(e){u="-"===e?18:16}function R(e){">"===e?N():"!"===e?u=19:"-"===e||(u=16)}function O(e){"-"===e?u=17:">"===e?N():u=16}function B(e){">"===e?N():"<"===e&&F()}function L(){u=0,h=s}function F(){u=1,h=new CurrentTag({idx:l})}function N(){var t=e.slice(d,h.idx);t&&n(t,d),"comment"===h.type?a(h.idx):"doctype"===h.type?o(h.idx):(h.isOpening&&i(h.name,h.idx),h.isClosing&&r(h.name,h.idx)),L(),d=l+1}function V(){var t=h.idx+(h.isClosing?2:1);return e.slice(t,l).toLowerCase()}d<l&&function(){var t=e.slice(d,l);n(t,d),d=l+1}()}var CurrentTag=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.type=e.type||"tag",this.name=e.name||"",this.isOpening=!!e.isOpening,this.isClosing=!!e.isClosing},Autolinker=function(){function e(t){void 0===t&&(t={}),this.version=e.version,this.urls={},this.email=!0,this.phone=!0,this.hashtag=!1,this.mention=!1,this.newWindow=!0,this.stripPrefix={scheme:!0,www:!0},this.stripTrailingSlash=!0,this.decodePercentEncoding=!0,this.truncate={length:0,location:"end"},this.className="",this.replaceFn=null,this.context=void 0,this.sanitizeHtml=!1,this.matchers=null,this.tagBuilder=null,this.urls=this.normalizeUrlsCfg(t.urls),this.email="boolean"==typeof t.email?t.email:this.email,this.phone="boolean"==typeof t.phone?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow="boolean"==typeof t.newWindow?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash="boolean"==typeof t.stripTrailingSlash?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding="boolean"==typeof t.decodePercentEncoding?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var i=this.mention;if(!1!==i&&"twitter"!==i&&"instagram"!==i&&"soundcloud"!==i)throw new Error("invalid `mention` cfg - see docs");var r=this.hashtag;if(!1!==r&&"twitter"!==r&&"facebook"!==r&&"instagram"!==r)throw new Error("invalid `hashtag` cfg - see docs");this.truncate=this.normalizeTruncateCfg(t.truncate),this.className=t.className||this.className,this.replaceFn=t.replaceFn||this.replaceFn,this.context=t.context||this}return e.link=function(t,i){return new e(i).link(t)},e.parse=function(t,i){return new e(i).parse(t)},e.prototype.normalizeUrlsCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{schemeMatches:e,wwwMatches:e,tldMatches:e}:{schemeMatches:"boolean"!=typeof e.schemeMatches||e.schemeMatches,wwwMatches:"boolean"!=typeof e.wwwMatches||e.wwwMatches,tldMatches:"boolean"!=typeof e.tldMatches||e.tldMatches}},e.prototype.normalizeStripPrefixCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{scheme:e,www:e}:{scheme:"boolean"!=typeof e.scheme||e.scheme,www:"boolean"!=typeof e.www||e.www}},e.prototype.normalizeTruncateCfg=function(e){return"number"==typeof e?{length:e,location:"end"}:defaults(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})},e.prototype.parse=function(e){var t=this,i=["a","style","script"],r=0,n=[];return parseHtml(e,{onOpenTag:function(e){i.indexOf(e)>=0&&r++},onText:function(e,i){if(0===r){var a=splitAndCapture(e,/( | |<|<|>|>|"|"|')/gi),o=i;a.forEach((function(e,i){if(i%2==0){var r=t.parseText(e,o);n.push.apply(n,r)}o+=e.length}))}},onCloseTag:function(e){i.indexOf(e)>=0&&(r=Math.max(r-1,0))},onComment:function(e){},onDoctype:function(e){}}),n=this.compactMatches(n),n=this.removeUnwantedMatches(n)},e.prototype.compactMatches=function(e){e.sort((function(e,t){return e.getOffset()-t.getOffset()}));for(var t=0;t<e.length-1;t++){var i=e[t],r=i.getOffset(),n=i.getMatchedText().length,a=r+n;if(t+1<e.length){if(e[t+1].getOffset()===r){var o=e[t+1].getMatchedText().length>n?t:t+1;e.splice(o,1);continue}e[t+1].getOffset()<a&&e.splice(t+1,1)}}return e},e.prototype.removeUnwantedMatches=function(e){return this.hashtag||remove$1(e,(function(e){return"hashtag"===e.getType()})),this.email||remove$1(e,(function(e){return"email"===e.getType()})),this.phone||remove$1(e,(function(e){return"phone"===e.getType()})),this.mention||remove$1(e,(function(e){return"mention"===e.getType()})),this.urls.schemeMatches||remove$1(e,(function(e){return"url"===e.getType()&&"scheme"===e.getUrlMatchType()})),this.urls.wwwMatches||remove$1(e,(function(e){return"url"===e.getType()&&"www"===e.getUrlMatchType()})),this.urls.tldMatches||remove$1(e,(function(e){return"url"===e.getType()&&"tld"===e.getUrlMatchType()})),e},e.prototype.parseText=function(e,t){void 0===t&&(t=0),t=t||0;for(var i=this.getMatchers(),r=[],n=0,a=i.length;n<a;n++){for(var o=i[n].parseMatches(e),s=0,l=o.length;s<l;s++)o[s].setOffset(t+o[s].getOffset());r.push.apply(r,o)}return r},e.prototype.link=function(e){if(!e)return"";this.sanitizeHtml&&(e=e.replace(/</g,"<").replace(/>/g,">"));for(var t=this.parse(e),i=[],r=0,n=0,a=t.length;n<a;n++){var o=t[n];i.push(e.substring(r,o.getOffset())),i.push(this.createMatchReturnVal(o)),r=o.getOffset()+o.getMatchedText().length}return i.push(e.substring(r)),i.join("")},e.prototype.createMatchReturnVal=function(e){var t;return this.replaceFn&&(t=this.replaceFn.call(this.context,e)),"string"==typeof t?t:!1===t?e.getMatchedText():t instanceof HtmlTag?t.toAnchorString():e.buildTag().toAnchorString()},e.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var e=this.getTagBuilder(),t=[new HashtagMatcher({tagBuilder:e,serviceName:this.hashtag}),new EmailMatcher({tagBuilder:e}),new PhoneMatcher({tagBuilder:e}),new MentionMatcher({tagBuilder:e,serviceName:this.mention}),new UrlMatcher({tagBuilder:e,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=t},e.prototype.getTagBuilder=function(){var e=this.tagBuilder;return e||(e=this.tagBuilder=new AnchorTagBuilder({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),e},e.version="3.14.3",e.AnchorTagBuilder=AnchorTagBuilder,e.HtmlTag=HtmlTag,e.matcher={Email:EmailMatcher,Hashtag:HashtagMatcher,Matcher:Matcher,Mention:MentionMatcher,Phone:PhoneMatcher,Url:UrlMatcher},e.match={Email:EmailMatch,Hashtag:HashtagMatch,Match:Match,Mention:MentionMatch,Phone:PhoneMatch,Url:UrlMatch},e}();function getElement(e){"string"==typeof e&&(e=document.getElementById(e));return e}function KmlLookAt(e,t){this.position=e,this.headingPitchRange=t}function KmlTour(e,t){this.id=t,this.name=e,this.playlistIndex=0,this.playlist=[],this.tourStart=new Event,this.tourEnd=new Event,this.entryStart=new Event,this.entryEnd=new Event,this._activeEntries=[]}function cancelAllEntries(e){for(var t=e.pop();void 0!==t;t=e.pop())t.stop()}function playEntry(e,t,i){var r=this.playlist[this.playlistIndex];if(r){var n=playNext.bind(this,e,t,i);if(this._activeEntries.push(r),this.entryStart.raiseEvent(r),r.blocking)r.play(n,e.scene.camera,t);else{var a=this;r.play((function(){a.entryEnd.raiseEvent(r);var e=a._activeEntries.indexOf(r);e>=0&&a._activeEntries.splice(e,1)})),n(e,t,i)}}else defined(i)&&i(!1)}function playNext(e,t,i,r){var n=this.playlist[this.playlistIndex];if(this.entryEnd.raiseEvent(n,r),r)i(r);else{var a=this._activeEntries.indexOf(n);a>=0&&this._activeEntries.splice(a,1),this.playlistIndex++,playEntry.call(this,e,t,i)}}function KmlTourFlyTo(e,t,i){this.type="KmlTourFlyTo",this.blocking=!0,this.activeCamera=null,this.activeCallback=null,this.duration=e,this.view=i,this.flyToMode=t}function KmlTourWait(e){this.type="KmlTourWait",this.blocking=!0,this.duration=e,this.timeout=null}KmlTour.prototype.addPlaylistEntry=function(e){this.playlist.push(e)},KmlTour.prototype.play=function(e,t){this.tourStart.raiseEvent();var i=this;playEntry.call(this,e,t,(function(e){i.playlistIndex=0,e||cancelAllEntries(i._activeEntries),i.tourEnd.raiseEvent(e)}))},KmlTour.prototype.stop=function(){cancelAllEntries(this._activeEntries)},KmlTourFlyTo.prototype.play=function(e,t,i){if(this.activeCamera=t,defined(e)&&null!==e){var r=this;this.activeCallback=function(t){delete r.activeCallback,delete r.activeCamera,e(!defined(t)&&t)}}var n=this.getCameraOptions(i);if(this.view.headingPitchRoll)t.flyTo(n);else if(this.view.headingPitchRange){var a=new BoundingSphere(this.view.position);t.flyToBoundingSphere(a,n)}},KmlTourFlyTo.prototype.stop=function(){defined(this.activeCamera)&&this.activeCamera.cancelFlight(),defined(this.activeCallback)&&this.activeCallback(!0)},KmlTourFlyTo.prototype.getCameraOptions=function(e){var t={duration:this.duration};return defined(this.activeCallback)&&(t.complete=this.activeCallback),"smooth"===this.flyToMode&&(t.easingFunction=EasingFunction$1.LINEAR_NONE),this.view.headingPitchRoll?(t.destination=this.view.position,t.orientation=this.view.headingPitchRoll):this.view.headingPitchRange&&(t.offset=this.view.headingPitchRange),defined(e)&&(t=combine$2(t,e)),t},KmlTourWait.prototype.play=function(e){var t=this;this.activeCallback=e,this.timeout=setTimeout((function(){delete t.activeCallback,e(!1)}),1e3*this.duration)},KmlTourWait.prototype.stop=function(){clearTimeout(this.timeout),defined(this.activeCallback)&&this.activeCallback(!0)};var MimeTypes={avi:"video/x-msvideo",bmp:"image/bmp",bz2:"application/x-bzip2",chm:"application/vnd.ms-htmlhelp",css:"text/css",csv:"text/csv",doc:"application/msword",dvi:"application/x-dvi",eps:"application/postscript",flv:"video/x-flv",gif:"image/gif",gz:"application/x-gzip",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",jnlp:"application/x-java-jnlp-file",jpeg:"image/jpeg",jpg:"image/jpeg",m3u:"audio/x-mpegurl",m4v:"video/mp4",mathml:"application/mathml+xml",mid:"audio/midi",midi:"audio/midi",mov:"video/quicktime",mp3:"audio/mpeg",mp4:"video/mp4",mp4v:"video/mp4",mpeg:"video/mpeg",mpg:"video/mpeg",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet",odt:"application/vnd.oasis.opendocument.text",ogg:"application/ogg",pdf:"application/pdf",png:"image/png",pps:"application/vnd.ms-powerpoint",ppt:"application/vnd.ms-powerpoint",ps:"application/postscript",qt:"video/quicktime",rdf:"application/rdf+xml",rss:"application/rss+xml",rtf:"application/rtf",svg:"image/svg+xml",swf:"application/x-shockwave-flash",text:"text/plain",tif:"image/tiff",tiff:"image/tiff",txt:"text/plain",wav:"audio/x-wav",wma:"audio/x-ms-wma",wmv:"video/x-ms-wmv",xml:"application/xml",zip:"application/zip",detectFromFilename:function(e){var t=e.toLowerCase();return t=getExtensionFromUri(t),MimeTypes[t]}},parser;"undefined"!=typeof DOMParser&&(parser=new DOMParser);var autolinker=new Autolinker({stripPrefix:!1,email:!1,replaceFn:function(e){if(!e.protocolUrlMatch)return!1}}),BILLBOARD_SIZE=32,BILLBOARD_NEAR_DISTANCE=2414016,BILLBOARD_NEAR_RATIO=1,BILLBOARD_FAR_DISTANCE=16093e3,BILLBOARD_FAR_RATIO=.1,kmlNamespaces=[null,void 0,"http://www.opengis.net/kml/2.2","http://earth.google.com/kml/2.2","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.0"],gxNamespaces=["http://www.google.com/kml/ext/2.2"],atomNamespaces=["http://www.w3.org/2005/Atom"],namespaces={kml:kmlNamespaces,gx:gxNamespaces,atom:atomNamespaces,kmlgx:kmlNamespaces.concat(gxNamespaces)},featureTypes={Document:processDocument,Folder:processFolder,Placemark:processPlacemark,NetworkLink:processNetworkLink,GroundOverlay:processGroundOverlay,PhotoOverlay:processUnsupportedFeature,ScreenOverlay:processScreenOverlay,Tour:processTour};function DeferredLoading(e){this._dataSource=e,this._deferred=when.defer(),this._stack=[],this._promises=[],this._timeoutSet=!1,this._used=!1,this._started=0,this._timeThreshold=1e3}function isZipFile(e){var t=e.slice(0,Math.min(4,e.size)),i=when.defer(),r=new FileReader;return r.addEventListener("load",(function(){i.resolve(1347093252===new DataView(r.result).getUint32(0,!1))})),r.addEventListener("error",(function(){i.reject(r.error)})),r.readAsArrayBuffer(t),i.promise}function readBlobAsText(e){var t=when.defer(),i=new FileReader;return i.addEventListener("load",(function(){t.resolve(i.result)})),i.addEventListener("error",(function(){t.reject(i.error)})),i.readAsText(e),t.promise}function insertNamespaces(e){var t,i,r,n={xsi:"http://www.w3.org/2001/XMLSchema-instance"};for(var a in n)n.hasOwnProperty(a)&&(r="xmlns:"+a+"=",RegExp("[< ]"+a+":").test(e)&&-1===e.indexOf(r)&&(defined(t)||(t=e.substr(0,e.indexOf("<kml")+4),i=e.substr(t.length)),t+=" "+r+'"'+n[a]+'"'));return defined(t)&&(e=t+i),e}function removeDuplicateNamespaces(e){for(var t,i,r,n=e.indexOf("xmlns:"),a=e.indexOf(">",n);-1!==n&&n<a;)t=e.slice(n,e.indexOf('"',n)),i=n,-1!==(n=e.indexOf(t,n+1))?(r=e.indexOf('"',e.indexOf('"',n)+1),n=(e=e.slice(0,n-1)+e.slice(r+1,e.length)).indexOf("xmlns:",i-1)):n=e.indexOf("xmlns:",i+1);return e}function loadXmlFromZip(e,t){return when(e.getData(new zipNoWorker.TextWriter)).then((function(e){e=removeDuplicateNamespaces(e=insertNamespaces(e)),t.kml=parser.parseFromString(e,"application/xml")}))}function loadDataUriFromZip(e,t){var i=defaultValue(MimeTypes.detectFromFilename(e.filename),"application/octet-stream");return when(e.getData(new zipNoWorker.Data64URIWriter(i))).then((function(i){t[e.filename]=i}))}function embedDataUris(e,t,i,r){for(var n=r.keys,a=new URI("."),o=e.querySelectorAll(t),s=0;s<o.length;s++){var l=o[s],c=l.getAttribute(i),u=new URI(c).absoluteTo(a).toString(),d=n.indexOf(u);if(-1!==d){var h=n[d];l.setAttribute(i,r[h]),"a"===t&&null===l.getAttribute("download")&&l.setAttribute("download",h)}}}function applyBasePath(e,t,i,r){for(var n=e.querySelectorAll(t),a=0;a<n.length;a++){var o=n[a],s=resolveHref(o.getAttribute(i),r);o.setAttribute(i,s.url)}}function createEntity(e,t,i){var r=queryStringAttribute(e,"id");r=defined(r)&&0!==r.length?r:createGuid(),defined(i)&&(r=i+r);var n=t.getById(r);return defined(n)&&(r=createGuid(),defined(i)&&(r=i+r)),defined((n=t.add(new Entity({id:r}))).kml)||(n.addProperty("kml"),n.kml=new KmlFeatureData),n}function isExtrudable(e,t){return"absolute"===e||"relativeToGround"===e||"relativeToSeaFloor"===t}function readCoordinate(e,t){if(!defined(e))return Cartesian3.fromDegrees(0,0,0,t);var i=e.match(/[^\s,\n]+/g);if(!defined(i))return Cartesian3.fromDegrees(0,0,0,t);var r=parseFloat(i[0]),n=parseFloat(i[1]),a=parseFloat(i[2]);return r=isNaN(r)?0:r,n=isNaN(n)?0:n,a=isNaN(a)?0:a,Cartesian3.fromDegrees(r,n,a,t)}function readCoordinates(e,t){if(defined(e)){var i=e.textContent.match(/[^\s\n]+/g);if(defined(i)){for(var r=i.length,n=new Array(r),a=0,o=0;o<r;o++)n[a++]=readCoordinate(i[o],t);return n}}}function queryNumericAttribute(e,t){if(defined(e)){var i=e.getAttribute(t);if(null!==i){var r=parseFloat(i);return isNaN(r)?void 0:r}}}function queryStringAttribute(e,t){if(defined(e)){var i=e.getAttribute(t);return null!==i?i:void 0}}function queryFirstNode(e,t,i){if(defined(e))for(var r=e.childNodes,n=r.length,a=0;a<n;a++){var o=r[a];if(o.localName===t&&-1!==i.indexOf(o.namespaceURI))return o}}function queryNodes(e,t,i){if(defined(e)){for(var r=[],n=e.getElementsByTagNameNS("*",t),a=n.length,o=0;o<a;o++){var s=n[o];s.localName===t&&-1!==i.indexOf(s.namespaceURI)&&r.push(s)}return r}}function queryChildNodes(e,t,i){if(!defined(e))return[];for(var r=[],n=e.childNodes,a=n.length,o=0;o<a;o++){var s=n[o];s.localName===t&&-1!==i.indexOf(s.namespaceURI)&&r.push(s)}return r}function queryNumericValue(e,t,i){var r=queryFirstNode(e,t,i);if(defined(r)){var n=parseFloat(r.textContent);return isNaN(n)?void 0:n}}function queryStringValue(e,t,i){var r=queryFirstNode(e,t,i);if(defined(r))return r.textContent.trim()}function queryBooleanValue(e,t,i){var r=queryFirstNode(e,t,i);if(defined(r)){var n=r.textContent.trim();return"1"===n||/^true$/i.test(n)}}function resolveHref(e,t,i){if(defined(e)){var r;if(defined(i)){var n=i[e=e.replace(/\\/g,"/")];if(defined(n))r=new Resource({url:n});else{var a=new URI(t.getUrlComponent());defined(n=i[new URI(e).absoluteTo(a)])&&(r=new Resource({url:n}))}}return defined(r)||(r=t.getDerivedResource({url:e})),r}}Object.defineProperties(DeferredLoading.prototype,{dataSource:{get:function(){return this._dataSource}}}),DeferredLoading.prototype.addNodes=function(e,t){this._stack.push({nodes:e,index:0,processingData:t}),this._used=!0},DeferredLoading.prototype.addPromise=function(e){this._promises.push(e)},DeferredLoading.prototype.wait=function(){var e=this._deferred;return this._used||e.resolve(),when.join(e.promise,when.all(this._promises))},DeferredLoading.prototype.process=function(){var e=1===this._stack.length;return e&&(this._started=KmlDataSource._getTimestamp()),this._process(e)},DeferredLoading.prototype._giveUpTime=function(){if(!this._timeoutSet){this._timeoutSet=!0,this._timeThreshold=50;var e=this;setTimeout((function(){e._timeoutSet=!1,e._started=KmlDataSource._getTimestamp(),e._process(!0)}),0)}},DeferredLoading.prototype._nextNode=function(){var e=this._stack,t=e[e.length-1],i=t.index,r=t.nodes;if(i!==r.length)return++t.index,r[i]},DeferredLoading.prototype._pop=function(){var e=this._stack;return e.pop(),0!==e.length||(this._deferred.resolve(),!1)},DeferredLoading.prototype._process=function(e){for(var t=this.dataSource,i=this._stack[this._stack.length-1].processingData,r=this._nextNode();defined(r);){var n=featureTypes[r.localName];if(defined(n)&&(-1!==namespaces.kml.indexOf(r.namespaceURI)||-1!==namespaces.gx.indexOf(r.namespaceURI))&&(n(t,r,i,this),this._timeoutSet||KmlDataSource._getTimestamp()>this._started+this._timeThreshold))return void this._giveUpTime();r=this._nextNode()}this._pop()&&e&&this._process(!0)};var colorOptions={maximumRed:void 0,red:void 0,maximumGreen:void 0,green:void 0,maximumBlue:void 0,blue:void 0};function parseColorString(e,t){if(defined(e)&&!/^\s*$/gm.test(e)){"#"===e[0]&&(e=e.substring(1));var i=parseInt(e.substring(0,2),16)/255,r=parseInt(e.substring(2,4),16)/255,n=parseInt(e.substring(4,6),16)/255,a=parseInt(e.substring(6,8),16)/255;return t?(a>0?(colorOptions.maximumRed=a,colorOptions.red=void 0):(colorOptions.maximumRed=void 0,colorOptions.red=0),n>0?(colorOptions.maximumGreen=n,colorOptions.green=void 0):(colorOptions.maximumGreen=void 0,colorOptions.green=0),r>0?(colorOptions.maximumBlue=r,colorOptions.blue=void 0):(colorOptions.maximumBlue=void 0,colorOptions.blue=0),colorOptions.alpha=i,Color.fromRandom(colorOptions)):new Color(a,n,r,i)}}function queryColorValue(e,t,i){var r=queryStringValue(e,t,i);if(defined(r))return parseColorString(r,"random"===queryStringValue(e,"colorMode",i))}function processTimeStamp(e){var t=queryFirstNode(e,"TimeStamp",namespaces.kmlgx),i=queryStringValue(t,"when",namespaces.kmlgx);if(defined(t)&&defined(i)&&0!==i.length){var r=JulianDate.fromIso8601(i),n=new TimeIntervalCollection;return n.addInterval(new TimeInterval({start:r,stop:Iso8601.MAXIMUM_VALUE})),n}}function processTimeSpan(e){var t=queryFirstNode(e,"TimeSpan",namespaces.kmlgx);if(defined(t)){var i,r=queryFirstNode(t,"begin",namespaces.kmlgx),n=defined(r)?JulianDate.fromIso8601(r.textContent):void 0,a=queryFirstNode(t,"end",namespaces.kmlgx),o=defined(a)?JulianDate.fromIso8601(a.textContent):void 0;if(defined(n)&&defined(o)){if(JulianDate.lessThan(o,n)){var s=n;n=o,o=s}(i=new TimeIntervalCollection).addInterval(new TimeInterval({start:n,stop:o}))}else defined(n)?(i=new TimeIntervalCollection).addInterval(new TimeInterval({start:n,stop:Iso8601.MAXIMUM_VALUE})):defined(o)&&(i=new TimeIntervalCollection).addInterval(new TimeInterval({start:Iso8601.MINIMUM_VALUE,stop:o}));return i}}function createDefaultBillboard(){var e=new BillboardGraphics;return e.width=BILLBOARD_SIZE,e.height=BILLBOARD_SIZE,e.scaleByDistance=new NearFarScalar(BILLBOARD_NEAR_DISTANCE,BILLBOARD_NEAR_RATIO,BILLBOARD_FAR_DISTANCE,BILLBOARD_FAR_RATIO),e.pixelOffsetScaleByDistance=new NearFarScalar(BILLBOARD_NEAR_DISTANCE,BILLBOARD_NEAR_RATIO,BILLBOARD_FAR_DISTANCE,BILLBOARD_FAR_RATIO),e}function createDefaultPolygon(){var e=new PolygonGraphics;return e.outline=!0,e.outlineColor=Color.WHITE,e}function createDefaultLabel(){var e=new LabelGraphics;return e.translucencyByDistance=new NearFarScalar(3e6,1,5e6,0),e.pixelOffset=new Cartesian2(17,0),e.horizontalOrigin=HorizontalOrigin$1.LEFT,e.font="16px sans-serif",e.style=LabelStyle$1.FILL_AND_OUTLINE,e}function getIconHref(e,t,i,r,n){var a=queryStringValue(e,"href",namespaces.kml);if(defined(a)&&0!==a.length){if(0===a.indexOf("root://icons/palette-")){var o=a.charAt(21),s=defaultValue(queryNumericValue(e,"x",namespaces.gx),0),l=defaultValue(queryNumericValue(e,"y",namespaces.gx),0);s=Math.min(s/32,7),a="https://maps.google.com/mapfiles/kml/pal"+o+"/icon"+(8*(l=7-Math.min(l/32,7))+s)+".png"}var c=resolveHref(a,i,r);if(n){var u=queryStringValue(e,"refreshMode",namespaces.kml),d=queryStringValue(e,"viewRefreshMode",namespaces.kml);"onInterval"===u||"onExpire"===u?oneTimeWarning("kml-refreshMode-"+u,"KML - Unsupported Icon refreshMode: "+u):"onStop"!==d&&"onRegion"!==d||oneTimeWarning("kml-refreshMode-"+d,"KML - Unsupported Icon viewRefreshMode: "+d);var h=defaultValue(queryStringValue(e,"viewBoundScale",namespaces.kml),1),p="onStop"===d?"BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]":"",f=defaultValue(queryStringValue(e,"viewFormat",namespaces.kml),p),m=queryStringValue(e,"httpQuery",namespaces.kml);defined(f)&&c.setQueryParameters(queryToObject(cleanupString(f))),defined(m)&&c.setQueryParameters(queryToObject(cleanupString(m)));var g=t._ellipsoid;return processNetworkLinkQueryString(c,t._camera,t._canvas,h,t._lastCameraView.bbox,g),c}return c}}function processBillboardIcon(e,t,i,r,n){var a=queryNumericValue(t,"scale",namespaces.kml),o=queryNumericValue(t,"heading",namespaces.kml),s=queryColorValue(t,"color",namespaces.kml),l=queryFirstNode(t,"Icon",namespaces.kml),c=getIconHref(l,e,r,n,!1);defined(l)&&!defined(c)&&(c=!1);var u,d,h=queryNumericValue(l,"x",namespaces.gx),p=queryNumericValue(l,"y",namespaces.gx),f=queryNumericValue(l,"w",namespaces.gx),m=queryNumericValue(l,"h",namespaces.gx),g=queryFirstNode(t,"hotSpot",namespaces.kml),_=queryNumericAttribute(g,"x"),y=queryNumericAttribute(g,"y"),v=queryStringAttribute(g,"xunits"),C=queryStringAttribute(g,"yunits"),T=i.billboard;defined(T)||(T=createDefaultBillboard(),i.billboard=T),T.image=c,T.scale=a,T.color=s,(defined(h)||defined(p)||defined(f)||defined(m))&&(T.imageSubRegion=new BoundingRectangle(h,p,f,m)),defined(o)&&0!==o&&(T.rotation=CesiumMath.toRadians(-o),T.alignedAxis=Cartesian3.UNIT_Z),a=defaultValue(a,1),defined(_)&&("pixels"===v?u=-_*a:"insetPixels"===v?u=(_-BILLBOARD_SIZE)*a:"fraction"===v&&(u=-_*BILLBOARD_SIZE*a),u+=.5*BILLBOARD_SIZE*a),defined(y)&&("pixels"===C?d=y*a:"insetPixels"===C?d=(-y+BILLBOARD_SIZE)*a:"fraction"===C&&(d=y*BILLBOARD_SIZE*a),d-=.5*BILLBOARD_SIZE*a),(defined(u)||defined(d))&&(T.pixelOffset=new Cartesian2(u,d))}function applyStyle(e,t,i,r,n){for(var a=0,o=t.childNodes.length;a<o;a++){var s=t.childNodes.item(a);if("IconStyle"===s.localName)processBillboardIcon(e,s,i,r,n);else if("LabelStyle"===s.localName){var l=i.label;defined(l)||(l=createDefaultLabel(),i.label=l),l.scale=defaultValue(queryNumericValue(s,"scale",namespaces.kml),l.scale),l.fillColor=defaultValue(queryColorValue(s,"color",namespaces.kml),l.fillColor),l.text=i.name}else if("LineStyle"===s.localName){var c=i.polyline;defined(c)||(c=new PolylineGraphics,i.polyline=c),c.width=queryNumericValue(s,"width",namespaces.kml),c.material=queryColorValue(s,"color",namespaces.kml),defined(queryColorValue(s,"outerColor",namespaces.gx))&&oneTimeWarning("kml-gx:outerColor","KML - gx:outerColor is not supported in a LineStyle"),defined(queryNumericValue(s,"outerWidth",namespaces.gx))&&oneTimeWarning("kml-gx:outerWidth","KML - gx:outerWidth is not supported in a LineStyle"),defined(queryNumericValue(s,"physicalWidth",namespaces.gx))&&oneTimeWarning("kml-gx:physicalWidth","KML - gx:physicalWidth is not supported in a LineStyle"),defined(queryBooleanValue(s,"labelVisibility",namespaces.gx))&&oneTimeWarning("kml-gx:labelVisibility","KML - gx:labelVisibility is not supported in a LineStyle")}else if("PolyStyle"===s.localName){var u=i.polygon;defined(u)||(u=createDefaultPolygon(),i.polygon=u),u.material=defaultValue(queryColorValue(s,"color",namespaces.kml),u.material),u.fill=defaultValue(queryBooleanValue(s,"fill",namespaces.kml),u.fill),u.outline=defaultValue(queryBooleanValue(s,"outline",namespaces.kml),u.outline)}else if("BalloonStyle"===s.localName){var d=defaultValue(parseColorString(queryStringValue(s,"bgColor",namespaces.kml)),Color.WHITE),h=defaultValue(parseColorString(queryStringValue(s,"textColor",namespaces.kml)),Color.BLACK),p=queryStringValue(s,"text",namespaces.kml);i.addProperty("balloonStyle"),i.balloonStyle={bgColor:d,textColor:h,text:p}}else if("ListStyle"===s.localName){var f=queryStringValue(s,"listItemType",namespaces.kml);"radioFolder"!==f&&"checkOffOnly"!==f||oneTimeWarning("kml-listStyle-"+f,"KML - Unsupported ListStyle with listItemType: "+f)}}}function computeFinalStyle(e,t,i,r,n){for(var a,o=new Entity,s=-1,l=t.childNodes,c=l.length,u=0;u<c;u++){var d=l[u];"Style"!==d.localName&&"StyleMap"!==d.localName||(s=u)}if(-1!==s){var h=l[s];if("Style"===h.localName)applyStyle(e,h,o,r,n);else for(var p=queryChildNodes(h,"Pair",namespaces.kml),f=0;f<p.length;f++){var m=p[f],g=queryStringValue(m,"key",namespaces.kml);if("normal"===g){var _=queryStringValue(m,"styleUrl",namespaces.kml);if(defined(_))defined(a=i.getById(_))||(a=i.getById("#"+_)),defined(a)&&o.merge(a);else applyStyle(e,queryFirstNode(m,"Style",namespaces.kml),o,r,n)}else oneTimeWarning("kml-styleMap-"+g,"KML - Unsupported StyleMap key: "+g)}}var y=queryStringValue(t,"styleUrl",namespaces.kml);if(defined(y)){var v=y;if("#"!==y[0]&&-1!==y.indexOf("#")){var C=y.split("#"),T=C[0];v=r.getDerivedResource({url:T}).getUrlComponent()+"#"+C[1]}defined(a=i.getById(v))||(a=i.getById("#"+v)),defined(a)&&o.merge(a)}return o}function processExternalStyles(e,t,i){return t.fetchXML().then((function(r){return processStyles(e,r,i,t,!0)}))}function processStyles(e,t,i,r,n,a){var o,s,l,c,u=queryNodes(t,"Style",namespaces.kml);if(defined(u)){var d=u.length;for(o=0;o<d;o++)defined(s=queryStringAttribute(c=u[o],"id"))&&(s="#"+s,n&&defined(r)&&(s=r.getUrlComponent()+s),defined(i.getById(s))||(l=new Entity({id:s}),i.add(l),applyStyle(e,c,l,r,a)))}var h=queryNodes(t,"StyleMap",namespaces.kml);if(defined(h)){var p=h.length;for(o=0;o<p;o++){var f=h[o];if(defined(s=queryStringAttribute(f,"id")))for(var m=queryChildNodes(f,"Pair",namespaces.kml),g=0;g<m.length;g++){var _=m[g],y=queryStringValue(_,"key",namespaces.kml);if("normal"===y){if(s="#"+s,n&&defined(r)&&(s=r.getUrlComponent()+s),!defined(i.getById(s))){l=i.getOrCreateEntity(s);var v=queryStringValue(_,"styleUrl",namespaces.kml);if(defined(v)){"#"!==v[0]&&(v="#"+v),n&&defined(r)&&(v=r.getUrlComponent()+v);var C=i.getById(v);defined(C)&&l.merge(C)}else applyStyle(e,c=queryFirstNode(_,"Style",namespaces.kml),l,r,a)}}else oneTimeWarning("kml-styleMap-"+y,"KML - Unsupported StyleMap key: "+y)}}}var T=[],S=t.getElementsByTagName("styleUrl"),A=S.length;for(o=0;o<A;o++){var x=S[o].textContent;if("#"!==x[0]){var E=x.split("#");if(2===E.length){var b=E[0],P=r.getDerivedResource({url:b});T.push(processExternalStyles(e,P,i))}}}return T}function createDropLine(e,t,i){var r=new ReferenceProperty(e,t.id,["position"]),n=new ScaledPositionProperty(t.position);t.polyline=defined(i.polyline)?i.polyline.clone():new PolylineGraphics,t.polyline.positions=new PositionPropertyArray([r,n])}function heightReferenceFromAltitudeMode(e,t){return!defined(e)&&!defined(t)||"clampToGround"===e?HeightReference$1.CLAMP_TO_GROUND:"relativeToGround"===e?HeightReference$1.RELATIVE_TO_GROUND:"absolute"===e?HeightReference$1.NONE:"clampToSeaFloor"===t?(oneTimeWarning("kml-gx:altitudeMode-clampToSeaFloor","KML - <gx:altitudeMode>:clampToSeaFloor is currently not supported, using <kml:altitudeMode>:clampToGround."),HeightReference$1.CLAMP_TO_GROUND):"relativeToSeaFloor"===t?(oneTimeWarning("kml-gx:altitudeMode-relativeToSeaFloor","KML - <gx:altitudeMode>:relativeToSeaFloor is currently not supported, using <kml:altitudeMode>:relativeToGround."),HeightReference$1.RELATIVE_TO_GROUND):(defined(e)?oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown <kml:altitudeMode>:"+e+", using <kml:altitudeMode>:CLAMP_TO_GROUND."):oneTimeWarning("kml-gx:altitudeMode-unknown","KML - Unknown <gx:altitudeMode>:"+t+", using <kml:altitudeMode>:CLAMP_TO_GROUND."),HeightReference$1.CLAMP_TO_GROUND)}function createPositionPropertyFromAltitudeMode(e,t,i){return"relativeToSeaFloor"===i||"absolute"===t||"relativeToGround"===t?e:((defined(t)&&"clampToGround"!==t||defined(i)&&"clampToSeaFloor"!==i)&&oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown altitudeMode: "+defaultValue(t,i)),new ScaledPositionProperty(e))}function createPositionPropertyArrayFromAltitudeMode(e,t,i,r){if(defined(e)){if("relativeToSeaFloor"===i||"absolute"===t||"relativeToGround"===t)return e;(defined(t)&&"clampToGround"!==t||defined(i)&&"clampToSeaFloor"!==i)&&oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown altitudeMode: "+defaultValue(t,i));for(var n=e.length,a=0;a<n;a++){var o=e[a];r.scaleToGeodeticSurface(o,o)}return e}}function processPositionGraphics(e,t,i,r){var n=t.label;defined(n)||(n=defined(i.label)?i.label.clone():createDefaultLabel(),t.label=n),n.text=t.name;var a=t.billboard;defined(a)||(a=defined(i.billboard)?i.billboard.clone():createDefaultBillboard(),t.billboard=a),defined(a.image)?a.image.getValue()||(a.image=void 0):a.image=e._pinBuilder.fromColor(Color.YELLOW,64);var o=1;defined(a.scale)&&(0!==(o=a.scale.getValue())?n.pixelOffset=new Cartesian2(16*o+1,0):(n.pixelOffset=void 0,n.horizontalOrigin=void 0)),defined(r)&&e._clampToGround&&(a.heightReference=r,n.heightReference=r)}function processPathGraphics(e,t){var i=e.path;defined(i)||((i=new PathGraphics).leadTime=0,e.path=i);var r=t.polyline;defined(r)&&(i.material=r.material,i.width=r.width)}function processPoint(e,t,i,r,n){var a=queryStringValue(i,"coordinates",namespaces.kml),o=queryStringValue(i,"altitudeMode",namespaces.kml),s=queryStringValue(i,"altitudeMode",namespaces.gx),l=queryBooleanValue(i,"extrude",namespaces.kml),c=readCoordinate(a,e._ellipsoid);return r.position=c,processPositionGraphics(e,r,n,heightReferenceFromAltitudeMode(o,s)),l&&isExtrudable(o,s)&&createDropLine(t,r,n),!0}function processLineStringOrLinearRing(e,t,i,r,n){var a=queryFirstNode(i,"coordinates",namespaces.kml),o=queryStringValue(i,"altitudeMode",namespaces.kml),s=queryStringValue(i,"altitudeMode",namespaces.gx),l=queryBooleanValue(i,"extrude",namespaces.kml),c=queryBooleanValue(i,"tessellate",namespaces.kml),u=isExtrudable(o,s),d=queryNumericValue(i,"drawOrder",namespaces.gx),h=e._ellipsoid,p=readCoordinates(a,h),f=n.polyline;if(u&&l){var m=new WallGraphics;r.wall=m,m.positions=p;var g=n.polygon;defined(g)&&(m.fill=g.fill,m.material=g.material),m.outline=!0,defined(f)?(m.outlineColor=defined(f.material)?f.material.color:Color.WHITE,m.outlineWidth=f.width):defined(g)&&(m.outlineColor=defined(g.material)?g.material.color:Color.WHITE)}else if(e._clampToGround&&!u&&c){var _=new PolylineGraphics;_.clampToGround=!0,r.polyline=_,_.positions=p,defined(f)?(_.material=defined(f.material)?f.material.color.getValue(Iso8601.MINIMUM_VALUE):Color.WHITE,_.width=defaultValue(f.width,1)):(_.material=Color.WHITE,_.width=1),_.zIndex=d}else defined(d)&&oneTimeWarning("kml-gx:drawOrder","KML - gx:drawOrder is not supported in LineStrings when clampToGround is false"),e._clampToGround&&!c&&oneTimeWarning("kml-line-tesselate","Ignoring clampToGround for KML lines without the tessellate flag."),f=defined(f)?f.clone():new PolylineGraphics,r.polyline=f,f.positions=createPositionPropertyArrayFromAltitudeMode(p,o,s,h),c&&!u||(f.arcType=ArcType$1.NONE);return!0}function processPolygon(e,t,i,r,n){var a=queryFirstNode(i,"outerBoundaryIs",namespaces.kml),o=queryFirstNode(a,"LinearRing",namespaces.kml),s=queryFirstNode(o,"coordinates",namespaces.kml),l=e._ellipsoid,c=readCoordinates(s,l),u=queryBooleanValue(i,"extrude",namespaces.kml),d=isExtrudable(queryStringValue(i,"altitudeMode",namespaces.kml),queryStringValue(i,"altitudeMode",namespaces.gx)),h=defined(n.polygon)?n.polygon.clone():createDefaultPolygon(),p=n.polyline;if(defined(p)&&(h.outlineColor=defined(p.material)?p.material.color:Color.WHITE,h.outlineWidth=p.width),r.polygon=h,d?(h.perPositionHeight=!0,h.extrudedHeight=u?0:void 0):e._clampToGround||(h.height=0),defined(c)){for(var f=new PolygonHierarchy(c),m=queryChildNodes(i,"innerBoundaryIs",namespaces.kml),g=0;g<m.length;g++){o=queryChildNodes(m[g],"LinearRing",namespaces.kml);for(var _=0;_<o.length;_++)defined(c=readCoordinates(s=queryFirstNode(o[_],"coordinates",namespaces.kml),l))&&f.holes.push(new PolygonHierarchy(c))}h.hierarchy=f}return!0}function processTrack(e,t,i,r,n){var a=queryStringValue(i,"altitudeMode",namespaces.kml),o=queryStringValue(i,"altitudeMode",namespaces.gx),s=queryChildNodes(i,"coord",namespaces.gx),l=queryChildNodes(i,"angles",namespaces.gx),c=queryChildNodes(i,"when",namespaces.kml),u=queryBooleanValue(i,"extrude",namespaces.kml),d=isExtrudable(a,o),h=e._ellipsoid;l.length>0&&oneTimeWarning("kml-gx:angles","KML - gx:angles are not supported in gx:Tracks");for(var p=Math.min(s.length,c.length),f=[],m=[],g=0;g<p;g++){var _=readCoordinate(s[g].textContent,h);f.push(_),m.push(JulianDate.fromIso8601(c[g].textContent))}var y=new SampledPositionProperty;return y.addSamples(m,f),r.position=y,processPositionGraphics(e,r,n,heightReferenceFromAltitudeMode(a,o)),processPathGraphics(r,n),r.availability=new TimeIntervalCollection,c.length>0&&r.availability.addInterval(new TimeInterval({start:m[0],stop:m[m.length-1]})),d&&u&&createDropLine(t,r,n),!0}function addToMultiTrack(e,t,i,r,n,a,o,s,l){var c=e[0],u=e[e.length-1],d=new SampledPositionProperty;d.addSamples(e,t),i.intervals.addInterval(new TimeInterval({start:c,stop:u,isStartIncluded:l,isStopIncluded:l,data:createPositionPropertyFromAltitudeMode(d,o,s)})),r.addInterval(new TimeInterval({start:c,stop:u,isStartIncluded:l,isStopIncluded:l})),n.intervals.addInterval(new TimeInterval({start:c,stop:u,isStartIncluded:l,isStopIncluded:l,data:a}))}function processMultiTrack(e,t,i,r,n){for(var a,o,s,l=queryBooleanValue(i,"interpolate",namespaces.gx),c=queryChildNodes(i,"Track",namespaces.gx),u=!1,d=new TimeIntervalCollectionProperty,h=new TimeIntervalCollection,p=new CompositePositionProperty,f=e._ellipsoid,m=0,g=c.length;m<g;m++){var _=c[m],y=queryChildNodes(_,"when",namespaces.kml),v=queryChildNodes(_,"coord",namespaces.gx),C=queryStringValue(_,"altitudeMode",namespaces.kml),T=queryStringValue(_,"altitudeMode",namespaces.gx),S=isExtrudable(C,T),A=queryBooleanValue(_,"extrude",namespaces.kml),x=Math.min(v.length,y.length),E=[];a=[];for(var b=0;b<x;b++){var P=readCoordinate(v[b].textContent,f);E.push(P),a.push(JulianDate.fromIso8601(y[b].textContent))}l&&(defined(o)&&addToMultiTrack([o,a[0]],[s,E[0]],p,h,d,!1,"absolute",void 0,!1),o=a[x-1],s=E[E.length-1]),addToMultiTrack(a,E,p,h,d,S&&A,C,T,!0),u=u||S&&A}return r.availability=h,r.position=p,processPositionGraphics(e,r,n),processPathGraphics(r,n),u&&(createDropLine(t,r,n),r.polyline.show=d),!0}var geometryTypes={Point:processPoint,LineString:processLineStringOrLinearRing,LinearRing:processLineStringOrLinearRing,Polygon:processPolygon,Track:processTrack,MultiTrack:processMultiTrack,MultiGeometry:processMultiGeometry,Model:processUnsupportedGeometry},scratchDiv;function processMultiGeometry(e,t,i,r,n,a){for(var o=i.childNodes,s=!1,l=0,c=o.length;l<c;l++){var u=o.item(l),d=geometryTypes[u.localName];if(defined(d)){var h=createEntity(u,t,a);h.parent=r,h.name=r.name,h.availability=r.availability,h.description=r.description,h.kml=r.kml,d(e,t,u,h,n)&&(s=!0)}}return s}function processUnsupportedGeometry(e,t,i,r,n){return oneTimeWarning("kml-unsupportedGeometry","KML - Unsupported geometry: "+i.localName),!1}function processExtendedData(e,t){var i=queryFirstNode(e,"ExtendedData",namespaces.kml);if(defined(i)){defined(queryFirstNode(i,"SchemaData",namespaces.kml))&&oneTimeWarning("kml-schemaData","KML - SchemaData is unsupported"),defined(queryStringAttribute(i,"xmlns:prefix"))&&oneTimeWarning("kml-extendedData","KML - ExtendedData with xmlns:prefix is unsupported");var r={},n=queryChildNodes(i,"Data",namespaces.kml);if(defined(n))for(var a=n.length,o=0;o<a;o++){var s=n[o],l=queryStringAttribute(s,"name");defined(l)&&(r[l]={displayName:queryStringValue(s,"displayName",namespaces.kml),value:queryStringValue(s,"value",namespaces.kml)})}t.kml.extendedData=r}}function processDescription(e,t,i,r,n){var a,o,s,l,c=t.kml,u=c.extendedData,d=queryStringValue(e,"description",namespaces.kml),h=defaultValue(t.balloonStyle,i.balloonStyle),p=Color.WHITE,f=Color.BLACK,m=d;if(defined(h)&&(p=defaultValue(h.bgColor,Color.WHITE),f=defaultValue(h.textColor,Color.BLACK),m=defaultValue(h.text,d)),defined(m)){if(m=(m=(m=(m=(m=(m=m.replace("$[name]",defaultValue(t.name,""))).replace("$[description]",defaultValue(d,""))).replace("$[address]",defaultValue(c.address,""))).replace("$[Snippet]",defaultValue(c.snippet,""))).replace("$[id]",t.id)).replace("$[geDirections]",""),defined(u)){var g=m.match(/\$\[.+?\]/g);if(null!==g)for(a=0;a<g.length;a++){var _=g[a],y=_.substr(2,_.length-3),v=/\/displayName$/.test(y);defined(l=u[y=y.replace(/\/displayName$/,"")])&&(l=v?l.displayName:l.value),defined(l)&&(m=m.replace(_,defaultValue(l,"")))}}}else if(defined(u)&&(s=Object.keys(u)).length>0){for(m='<table class="cesium-infoBox-defaultTable cesium-infoBox-defaultTable-lighter"><tbody>',a=0;a<s.length;a++)m+="<tr><th>"+defaultValue((l=u[o=s[a]]).displayName,o)+"</th><td>"+defaultValue(l.value,"")+"</td></tr>";m+="</tbody></table>"}if(defined(m)){m=autolinker.link(m),scratchDiv.innerHTML=m;var C=scratchDiv.querySelectorAll("a");for(a=0;a<C.length;a++)C[a].setAttribute("target","_blank");defined(r)&&r.keys.length>1&&(embedDataUris(scratchDiv,"a","href",r),embedDataUris(scratchDiv,"img","src",r)),applyBasePath(scratchDiv,"a","href",n),applyBasePath(scratchDiv,"img","src",n);var T='<div class="cesium-infoBox-description-lighter" style="';T+="overflow:auto;",T+="word-wrap:break-word;",T+="background-color:"+p.toCssColorString()+";",T+="color:"+f.toCssColorString()+";",T+='">',T+=scratchDiv.innerHTML+"</div>",scratchDiv.innerHTML="",t.description=T}}function processFeature(e,t,i){var r=i.entityCollection,n=i.parentEntity,a=i.sourceResource,o=i.uriResolver,s=createEntity(t,r,i.context),l=s.kml,c=computeFinalStyle(e,t,i.styleCollection,a,o),u=queryStringValue(t,"name",namespaces.kml);s.name=u,s.parent=n;var d=processTimeSpan(t);defined(d)||(d=processTimeStamp(t)),s.availability=d,mergeAvailabilityWithParent(s);var h=queryBooleanValue(t,"visibility",namespaces.kml);s.show=function e(t){return!t||t.show&&e(t.parent)}(n)&&defaultValue(h,!0);var p=queryFirstNode(t,"author",namespaces.atom),f=l.author;f.name=queryStringValue(p,"name",namespaces.atom),f.uri=queryStringValue(p,"uri",namespaces.atom),f.email=queryStringValue(p,"email",namespaces.atom);var m=queryFirstNode(t,"link",namespaces.atom),g=l.link;g.href=queryStringAttribute(m,"href"),g.hreflang=queryStringAttribute(m,"hreflang"),g.rel=queryStringAttribute(m,"rel"),g.type=queryStringAttribute(m,"type"),g.title=queryStringAttribute(m,"title"),g.length=queryStringAttribute(m,"length"),l.address=queryStringValue(t,"address",namespaces.kml),l.phoneNumber=queryStringValue(t,"phoneNumber",namespaces.kml),l.snippet=queryStringValue(t,"Snippet",namespaces.kml),processExtendedData(t,s),processDescription(t,s,c,o,a);var _=e._ellipsoid;return processLookAt(t,s,_),processCamera(t,s,_),defined(queryFirstNode(t,"Region",namespaces.kml))&&oneTimeWarning("kml-region","KML - Placemark Regions are unsupported"),{entity:s,styleEntity:c}}function processDocument(e,t,i,r){r.addNodes(t.childNodes,i),r.process()}function processFolder(e,t,i,r){var n=processFeature(e,t,i),a=clone$1(i);a.parentEntity=n.entity,processDocument(e,t,a,r)}function processPlacemark(e,t,i,r){for(var n=processFeature(e,t,i),a=n.entity,o=n.styleEntity,s=!1,l=t.childNodes,c=0,u=l.length;c<u&&!s;c++){var d=l.item(c),h=geometryTypes[d.localName];defined(h)&&(h(e,i.entityCollection,d,a,o,a.id),s=!0)}s||(a.merge(o),processPositionGraphics(e,a,o))}"undefined"!=typeof document&&(scratchDiv=document.createElement("div"));var playlistNodeProcessors={FlyTo:processTourFlyTo,Wait:processTourWait,SoundCue:processTourUnsupportedNode,AnimatedUpdate:processTourUnsupportedNode,TourControl:processTourUnsupportedNode};function processTour(e,t,i,r){var n=new KmlTour(queryStringValue(t,"name",namespaces.kml),queryStringAttribute(t,"id")),a=queryFirstNode(t,"Playlist",namespaces.gx);if(a)for(var o=e._ellipsoid,s=a.childNodes,l=0;l<s.length;l++){var c=s[l];if(c.localName){var u=playlistNodeProcessors[c.localName];u?u(n,c,o):console.log("Unknown KML Tour playlist entry type "+c.localName)}}e._kmlTours.push(n)}function processTourUnsupportedNode(e,t){oneTimeWarning("KML Tour unsupported node "+t.localName)}function processTourWait(e,t){var i=queryNumericValue(t,"duration",namespaces.gx);e.addPlaylistEntry(new KmlTourWait(i))}function processTourFlyTo(e,t,i){var r=queryNumericValue(t,"duration",namespaces.gx),n=queryStringValue(t,"flyToMode",namespaces.gx),a={kml:{}};processLookAt(t,a,i),processCamera(t,a,i);var o=new KmlTourFlyTo(r,n,a.kml.lookAt||a.kml.camera);e.addPlaylistEntry(o)}function processCamera(e,t,i){var r=queryFirstNode(e,"Camera",namespaces.kml);if(defined(r)){var n=defaultValue(queryNumericValue(r,"longitude",namespaces.kml),0),a=defaultValue(queryNumericValue(r,"latitude",namespaces.kml),0),o=defaultValue(queryNumericValue(r,"altitude",namespaces.kml),0),s=defaultValue(queryNumericValue(r,"heading",namespaces.kml),0),l=defaultValue(queryNumericValue(r,"tilt",namespaces.kml),0),c=defaultValue(queryNumericValue(r,"roll",namespaces.kml),0),u=Cartesian3.fromDegrees(n,a,o,i),d=HeadingPitchRoll.fromDegrees(s,l-90,c);t.kml.camera=new KmlCamera(u,d)}}function processLookAt(e,t,i){var r=queryFirstNode(e,"LookAt",namespaces.kml);if(defined(r)){var n=defaultValue(queryNumericValue(r,"longitude",namespaces.kml),0),a=defaultValue(queryNumericValue(r,"latitude",namespaces.kml),0),o=defaultValue(queryNumericValue(r,"altitude",namespaces.kml),0),s=queryNumericValue(r,"heading",namespaces.kml),l=queryNumericValue(r,"tilt",namespaces.kml),c=defaultValue(queryNumericValue(r,"range",namespaces.kml),0);l=CesiumMath.toRadians(defaultValue(l,0));var u=new HeadingPitchRange(s=CesiumMath.toRadians(defaultValue(s,0)),l-CesiumMath.PI_OVER_TWO,c),d=Cartesian3.fromDegrees(n,a,o,i);t.kml.lookAt=new KmlLookAt(d,u)}}function processScreenOverlay(e,t,i,r){var n=i.screenOverlayContainer;if(defined(n)){var a=i.sourceResource,o=i.uriResolver,s=getIconHref(queryFirstNode(t,"Icon",namespaces.kml),e,a,o,!1);if(defined(s)){var l=document.createElement("img");e._screenOverlays.push(l),l.src=s.url,l.onload=function(){var e,i,r,n,a,o,s=["position: absolute"],c=queryFirstNode(t,"screenXY",namespaces.kml),u=queryFirstNode(t,"overlayXY",namespaces.kml),d=queryFirstNode(t,"size",namespaces.kml);defined(d)&&(e=queryNumericAttribute(d,"x"),i=queryNumericAttribute(d,"y"),r=queryStringAttribute(d,"xunits"),n=queryStringAttribute(d,"yunits"),defined(e)&&-1!==e&&0!==e&&("fraction"===r?a="width: "+Math.floor(100*e)+"%":"pixels"===r&&(a="width: "+e+"px"),s.push(a)),defined(i)&&-1!==i&&0!==i&&("fraction"===n?o="height: "+Math.floor(100*i)+"%":"pixels"===n&&(o="height: "+i+"px"),s.push(o))),l.style=s.join(";");var h=0,p=l.height;defined(u)&&(e=queryNumericAttribute(u,"x"),i=queryNumericAttribute(u,"y"),r=queryStringAttribute(u,"xunits"),n=queryStringAttribute(u,"yunits"),defined(e)&&("fraction"===r?h=e*l.width:("pixels"===r||"insetPixels"===r)&&(h=e)),defined(i)&&("fraction"===n?p=i*l.height:("pixels"===n||"insetPixels"===n)&&(p=i))),defined(c)&&(e=queryNumericAttribute(c,"x"),i=queryNumericAttribute(c,"y"),r=queryStringAttribute(c,"xunits"),n=queryStringAttribute(c,"yunits"),defined(e)&&("fraction"===r?a="left: calc("+Math.floor(100*e)+"% - "+h+"px)":"pixels"===r?a="left: "+(e-h)+"px":"insetPixels"===r&&(a="right: "+(e-h)+"px"),s.push(a)),defined(i)&&("fraction"===n?o="bottom: calc("+Math.floor(100*i)+"% - "+p+"px)":"pixels"===n?o="bottom: "+(i-p)+"px":"insetPixels"===n&&(o="top: "+(i-p)+"px"),s.push(o))),l.style=s.join(";")},n.appendChild(l)}}}function processGroundOverlay(e,t,i,r){var n,a=processFeature(e,t,i).entity,o=!1,s=e._ellipsoid,l=readCoordinates(queryFirstNode(t,"LatLonQuad",namespaces.gx),s),c=queryNumericValue(t,"drawOrder",namespaces.kml);if(defined(l))(n=createDefaultPolygon()).hierarchy=new PolygonHierarchy(l),n.zIndex=c,a.polygon=n,o=!0;else{(n=new RectangleGraphics).zIndex=c,a.rectangle=n;var u=queryFirstNode(t,"LatLonBox",namespaces.kml);if(defined(u)){var d=queryNumericValue(u,"west",namespaces.kml),h=queryNumericValue(u,"south",namespaces.kml),p=queryNumericValue(u,"east",namespaces.kml),f=queryNumericValue(u,"north",namespaces.kml);defined(d)&&(d=CesiumMath.negativePiToPi(CesiumMath.toRadians(d))),defined(h)&&(h=CesiumMath.clampToLatitudeRange(CesiumMath.toRadians(h))),defined(p)&&(p=CesiumMath.negativePiToPi(CesiumMath.toRadians(p))),defined(f)&&(f=CesiumMath.clampToLatitudeRange(CesiumMath.toRadians(f))),n.coordinates=new Rectangle(d,h,p,f);var m=queryNumericValue(u,"rotation",namespaces.kml);if(defined(m)){var g=CesiumMath.toRadians(m);n.rotation=g,n.stRotation=g}}}var _=queryFirstNode(t,"Icon",namespaces.kml),y=getIconHref(_,e,i.sourceResource,i.uriResolver,!0);if(defined(y)){o&&oneTimeWarning("kml-gx:LatLonQuad","KML - gx:LatLonQuad Icon does not support texture projection.");var v=queryNumericValue(_,"x",namespaces.gx),C=queryNumericValue(_,"y",namespaces.gx),T=queryNumericValue(_,"w",namespaces.gx),S=queryNumericValue(_,"h",namespaces.gx);(defined(v)||defined(C)||defined(T)||defined(S))&&oneTimeWarning("kml-groundOverlay-xywh","KML - gx:x, gx:y, gx:w, gx:h aren't supported for GroundOverlays"),n.material=y,n.material.color=queryColorValue(t,"color",namespaces.kml),n.material.transparent=!0}else n.material=queryColorValue(t,"color",namespaces.kml);var A=queryStringValue(t,"altitudeMode",namespaces.kml);defined(A)?"absolute"===A?(n.height=queryNumericValue(t,"altitude",namespaces.kml),n.zIndex=void 0):"clampToGround"!==A&&oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown altitudeMode: "+A):"relativeToSeaFloor"===(A=queryStringValue(t,"altitudeMode",namespaces.gx))?(oneTimeWarning("kml-altitudeMode-relativeToSeaFloor","KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute."),n.height=queryNumericValue(t,"altitude",namespaces.kml),n.zIndex=void 0):"clampToSeaFloor"===A?oneTimeWarning("kml-altitudeMode-clampToSeaFloor","KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround."):defined(A)&&oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown altitudeMode: "+A)}function processUnsupportedFeature(e,t,i,r){e._unsupportedNode.raiseEvent(e,i.parentEntity,t,i.entityCollection,i.styleCollection,i.sourceResource,i.uriResolver),oneTimeWarning("kml-unsupportedFeature-"+t.nodeName,"KML - Unsupported feature: "+t.nodeName)}var RefreshMode={INTERVAL:0,EXPIRE:1,STOP:2};function cleanupString(e){if(!defined(e)||0===e.length)return"";var t=e[0];return"&"!==t&&"?"!==t||(e=e.substring(1)),e}var zeroRectangle=new Rectangle,scratchCartographic$7=new Cartographic,scratchCartesian2$2=new Cartesian2,scratchCartesian3$2=new Cartesian3;function processNetworkLinkQueryString(e,t,i,r,n,a){function o(e){return e<-CesiumMath.PI_OVER_TWO?-CesiumMath.PI_OVER_TWO:e>CesiumMath.PI_OVER_TWO?CesiumMath.PI_OVER_TWO:e}function s(e){return e>CesiumMath.PI?e-CesiumMath.TWO_PI:e<-CesiumMath.PI?e+CesiumMath.TWO_PI:e}var l=objectToQuery(e.queryParameters);if(l=l.replace(/%5B/g,"[").replace(/%5D/g,"]"),defined(t)&&t._mode!==SceneMode$1.MORPHING){var c,u;if(n=defaultValue(n,zeroRectangle),defined(i)&&(scratchCartesian2$2.x=.5*i.clientWidth,scratchCartesian2$2.y=.5*i.clientHeight,c=t.pickEllipsoid(scratchCartesian2$2,a,scratchCartesian3$2)),defined(c)?u=a.cartesianToCartographic(c,scratchCartographic$7):(u=Rectangle.center(n,scratchCartographic$7),c=a.cartographicToCartesian(u)),defined(r)&&!CesiumMath.equalsEpsilon(r,1,CesiumMath.EPSILON9)){var d=n.width*r*.5,h=n.height*r*.5;n=new Rectangle(s(u.longitude-d),o(u.latitude-h),s(u.longitude+d),o(u.latitude+h))}l=(l=(l=(l=l.replace("[bboxWest]",CesiumMath.toDegrees(n.west).toString())).replace("[bboxSouth]",CesiumMath.toDegrees(n.south).toString())).replace("[bboxEast]",CesiumMath.toDegrees(n.east).toString())).replace("[bboxNorth]",CesiumMath.toDegrees(n.north).toString());var p=CesiumMath.toDegrees(u.longitude).toString(),f=CesiumMath.toDegrees(u.latitude).toString();l=(l=(l=(l=(l=(l=(l=(l=l.replace("[lookatLon]",p)).replace("[lookatLat]",f)).replace("[lookatTilt]",CesiumMath.toDegrees(t.pitch).toString())).replace("[lookatHeading]",CesiumMath.toDegrees(t.heading).toString())).replace("[lookatRange]",Cartesian3.distance(t.positionWC,c))).replace("[lookatTerrainLon]",p)).replace("[lookatTerrainLat]",f)).replace("[lookatTerrainAlt]",u.height.toString()),a.cartesianToCartographic(t.positionWC,scratchCartographic$7),l=(l=(l=l.replace("[cameraLon]",CesiumMath.toDegrees(scratchCartographic$7.longitude).toString())).replace("[cameraLat]",CesiumMath.toDegrees(scratchCartographic$7.latitude).toString())).replace("[cameraAlt]",CesiumMath.toDegrees(scratchCartographic$7.height).toString());var m=t.frustum,g=m.aspectRatio,_="",y="";if(defined(g)){var v=CesiumMath.toDegrees(m.fov);g>1?(_=v,y=v/g):(y=v,_=v*g)}l=(l=l.replace("[horizFov]",_.toString())).replace("[vertFov]",y.toString())}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replace("[bboxWest]","-180")).replace("[bboxSouth]","-90")).replace("[bboxEast]","180")).replace("[bboxNorth]","90")).replace("[lookatLon]","")).replace("[lookatLat]","")).replace("[lookatRange]","")).replace("[lookatTilt]","")).replace("[lookatHeading]","")).replace("[lookatTerrainLon]","")).replace("[lookatTerrainLat]","")).replace("[lookatTerrainAlt]","")).replace("[cameraLon]","")).replace("[cameraLat]","")).replace("[cameraAlt]","")).replace("[horizFov]","")).replace("[vertFov]","");l=(l=(l=(l=(l=(l=defined(i)?(l=l.replace("[horizPixels]",i.clientWidth)).replace("[vertPixels]",i.clientHeight):(l=l.replace("[horizPixels]","")).replace("[vertPixels]","")).replace("[terrainEnabled]","1")).replace("[clientVersion]","1")).replace("[kmlVersion]","2.2")).replace("[clientName]","Cesium")).replace("[language]","English"),e.setQueryParameters(queryToObject(l))}function processNetworkLink(e,t,i,r){var n=processFeature(e,t,i).entity,a=i.sourceResource,o=i.uriResolver,s=queryFirstNode(t,"Link",namespaces.kml);if(defined(s)||(s=queryFirstNode(t,"Url",namespaces.kml)),defined(s)){var l,c,u=queryStringValue(s,"href",namespaces.kml);if(defined(u)){var d=u;if(u=resolveHref(u,a,i.uriResolver),/^data:/.test(u.getUrlComponent()))/\.kmz/i.test(a.getUrlComponent())||(d=a.getDerivedResource({url:d}));else{d=u.clone(),l=queryStringValue(s,"viewRefreshMode",namespaces.kml),c=defaultValue(queryStringValue(s,"viewBoundScale",namespaces.kml),1);var h="onStop"===l?"BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]":"",p=defaultValue(queryStringValue(s,"viewFormat",namespaces.kml),h),f=queryStringValue(s,"httpQuery",namespaces.kml);defined(p)&&u.setQueryParameters(queryToObject(cleanupString(p))),defined(f)&&u.setQueryParameters(queryToObject(cleanupString(f)));var m=e._ellipsoid;processNetworkLinkQueryString(u,e._camera,e._canvas,c,e._lastCameraView.bbox,m)}var g={sourceUri:d,uriResolver:o,context:n.id,screenOverlayContainer:i.screenOverlayContainer},_=new EntityCollection,y=load(e,_,u,g).then((function(t){var i=e._entityCollection,r=_.values;i.suspendEvents();for(var a=0;a<r.length;a++){var o=r[a];defined(o.parent)||(o.parent=n,mergeAvailabilityWithParent(o)),i.add(o)}i.resumeEvents();var d=queryStringValue(s,"refreshMode",namespaces.kml),h=defaultValue(queryNumericValue(s,"refreshInterval",namespaces.kml),0);if("onInterval"===d&&h>0||"onExpire"===d||"onStop"===l){var p=queryFirstNode(t,"NetworkLinkControl",namespaces.kml),f=defined(p),m=JulianDate.now(),g={id:createGuid(),href:u,cookie:{},lastUpdated:m,updating:!1,entity:n,viewBoundScale:c,needsUpdate:!1,cameraUpdateTime:m},y=0;if(f&&(g.cookie=queryToObject(defaultValue(queryStringValue(p,"cookie",namespaces.kml),"")),y=defaultValue(queryNumericValue(p,"minRefreshPeriod",namespaces.kml),0)),"onInterval"===d)f&&(h=Math.max(y,h)),g.refreshMode=RefreshMode.INTERVAL,g.time=h;else if("onExpire"===d){var v;if(f&&(v=queryStringValue(p,"expires",namespaces.kml)),defined(v))try{var C=JulianDate.fromIso8601(v),T=JulianDate.secondsDifference(C,m);T>0&&T<y&&JulianDate.addSeconds(m,y,C),g.refreshMode=RefreshMode.EXPIRE,g.time=C}catch(e){oneTimeWarning("kml-refreshMode-onInterval-onExpire","KML - NetworkLinkControl expires is not a valid date")}else oneTimeWarning("kml-refreshMode-onExpire","KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element")}else e._camera?(g.refreshMode=RefreshMode.STOP,g.time=defaultValue(queryNumericValue(s,"viewRefreshTime",namespaces.kml),0)):oneTimeWarning("kml-refrehMode-onStop-noCamera","A NetworkLink with viewRefreshMode=onStop requires a camera be passed in when creating the KmlDataSource");defined(g.refreshMode)&&e._networkLinks.set(g.id,g)}else"onRegion"===l&&oneTimeWarning("kml-refrehMode-onRegion","KML - Unsupported viewRefreshMode: onRegion")})).otherwise((function(t){oneTimeWarning("An error occured during loading "+u.url),e._error.raiseEvent(e,t)}));r.addPromise(y)}}}function processFeatureNode(e,t,i,r){var n=featureTypes[t.localName];return defined(n)?n(e,t,i,r):processUnsupportedFeature(e,t,i)}function loadKml(e,t,i,r,n,a,o){t.removeAll();var s=i.documentElement,l=queryStringValue("Document"===s.localName?s:queryFirstNode(s,"Document",namespaces.kml),"name",namespaces.kml);defined(l)||(l=getFilenameFromUri(r.getUrlComponent())),defined(e._name)||(e._name=l);var c=new KmlDataSource._DeferredLoading(e),u=new EntityCollection(e);return when.all(processStyles(e,i,u,r,!1,n)).then((function(){var s=i.documentElement;if("kml"===s.localName)for(var l=s.childNodes,d=0;d<l.length;d++){var h=l[d];if(defined(featureTypes[h.localName])){s=h;break}}var p={parentEntity:void 0,entityCollection:t,styleCollection:u,sourceResource:r,uriResolver:n,context:o,screenOverlayContainer:a};return t.suspendEvents(),processFeatureNode(e,s,p,c),t.resumeEvents(),c.wait().then((function(){return i.documentElement}))}))}function loadKmz(e,t,i,r,n){var a=buildModuleUrl("ThirdParty/Workers/z-worker-pako.js");zipNoWorker.configure({workerScripts:{deflate:[a,"./pako_deflate.min.js"],inflate:[a,"./pako_inflate.min.js"]}});var o=new zipNoWorker.ZipReader(new zipNoWorker.BlobReader(i));return when(o.getEntries()).then((function(i){for(var a,s=[],l={},c=0;c<i.length;c++){var u=i[c];u.directory||(/\.kml$/i.test(u.filename)?defined(a)&&/\//i.test(u.filename)?s.push(loadDataUriFromZip(u,l)):(defined(a)&&s.push(loadDataUriFromZip(a,l)),a=u):s.push(loadDataUriFromZip(u,l)))}return defined(a)&&s.push(loadXmlFromZip(a,l)),when.all(s).then((function(){if(o.close(),!defined(l.kml))throw new RuntimeError("KMZ file does not contain a KML document.");return l.keys=Object.keys(l),loadKml(e,t,l.kml,r,l,n)}))}))}function load(e,t,i,r){var n=(r=defaultValue(r,defaultValue.EMPTY_OBJECT)).sourceUri,a=r.uriResolver,o=r.context,s=r.screenOverlayContainer,l=i;if("string"==typeof i||i instanceof Resource){l=(i=Resource.createIfNeeded(i)).fetchBlob(),n=defaultValue(n,i.clone());var c=e._resourceCredits,u=i.credits;if(defined(u))for(var d=u.length,h=0;h<d;h++)c.push(u[h])}else n=defaultValue(n,Resource.DEFAULT.clone());return n=Resource.createIfNeeded(n),defined(s)&&(s=getElement(s)),when(l).then((function(i){return i instanceof Blob?isZipFile(i).then((function(r){return r?loadKmz(e,t,i,n,s):readBlobAsText(i).then((function(i){var r,l;i=removeDuplicateNamespaces(i=insertNamespaces(i));try{r=parser.parseFromString(i,"application/xml")}catch(e){l=e.toString()}if(defined(l)||r.body||"parsererror"===r.documentElement.tagName){var c=defined(l)?l:r.documentElement.firstChild.nodeValue;throw c||(c=r.body.innerText),new RuntimeError(c)}return loadKml(e,t,r,n,a,s,o)}))})):loadKml(e,t,i,n,a,s,o)})).otherwise((function(t){return e._error.raiseEvent(e,t),console.log(t),when.reject(t)}))}function KmlDataSource(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).camera,i=e.canvas;this._changed=new Event,this._error=new Event,this._loading=new Event,this._refresh=new Event,this._unsupportedNode=new Event,this._clock=void 0,this._entityCollection=new EntityCollection(this),this._name=void 0,this._isLoading=!1,this._pinBuilder=new PinBuilder,this._networkLinks=new AssociativeArray,this._entityCluster=new EntityCluster,this._canvas=i,this._camera=t,this._lastCameraView={position:defined(t)?Cartesian3.clone(t.positionWC):void 0,direction:defined(t)?Cartesian3.clone(t.directionWC):void 0,up:defined(t)?Cartesian3.clone(t.upWC):void 0,bbox:defined(t)?t.computeViewRectangle():Rectangle.clone(Rectangle.MAX_VALUE)},this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84);var r=e.credit;"string"==typeof r&&(r=new Credit(r)),this._credit=r,this._resourceCredits=[],this._kmlTours=[],this._screenOverlays=[]}function mergeAvailabilityWithParent(e){var t=e.parent;if(defined(t)){var i=t.availability;if(defined(i)){var r=e.availability;defined(r)?r.intersect(i):e.availability=i}}}function getNetworkLinkUpdateCallback(e,t,i,r,n){return function(a){if(r.contains(t.id)){var o=!1,s=queryFirstNode(a,"NetworkLinkControl",namespaces.kml),l=0;if(defined(s)){if(defined(queryFirstNode(s,"Update",namespaces.kml)))return oneTimeWarning("kml-networkLinkControl-update","KML - NetworkLinkControl updates aren't supported."),t.updating=!1,void r.remove(t.id);t.cookie=queryToObject(defaultValue(queryStringValue(s,"cookie",namespaces.kml),"")),l=defaultValue(queryNumericValue(s,"minRefreshPeriod",namespaces.kml),0)}var c=JulianDate.now(),u=t.refreshMode;if(u===RefreshMode.INTERVAL)defined(s)&&(t.time=Math.max(l,t.time));else if(u===RefreshMode.EXPIRE){var d;if(defined(s)&&(d=queryStringValue(s,"expires",namespaces.kml)),defined(d))try{var h=JulianDate.fromIso8601(d),p=JulianDate.secondsDifference(h,c);p>0&&p<l&&JulianDate.addSeconds(c,l,h),t.time=h}catch(e){oneTimeWarning("kml-networkLinkControl-expires","KML - NetworkLinkControl expires is not a valid date"),o=!0}else oneTimeWarning("kml-refreshMode-onExpire","KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element"),o=!0}var f=t.entity,m=e._entityCollection,g=i.values;m.suspendEvents();var _,y=m.values.slice();for(_=0;_<y.length;++_){var v=y[_];v.parent===f&&(v.parent=void 0,P(v))}for(m.resumeEvents(),m.suspendEvents(),_=0;_<g.length;_++){var C=g[_];defined(C.parent)||(C.parent=f,mergeAvailabilityWithParent(C)),m.add(C)}m.resumeEvents(),o?r.remove(t.id):t.lastUpdated=c;var T=m.computeAvailability(),S=T.start,A=T.stop,x=JulianDate.equals(S,Iso8601.MINIMUM_VALUE),E=JulianDate.equals(A,Iso8601.MAXIMUM_VALUE);if(!x||!E){var b=e._clock;b.startTime===S&&b.stopTime===A||(b.startTime=S,b.stopTime=A,e._changed.raiseEvent(e))}t.updating=!1,t.needsUpdate=!1,e._refresh.raiseEvent(e,n.getUrlComponent(!0))}function P(e){m.remove(e);for(var t=e._children,i=t.length,r=0;r<i;++r)P(t[r])}}}KmlDataSource.load=function(e,t){return new KmlDataSource(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).load(e,t)},Object.defineProperties(KmlDataSource.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},refreshEvent:{get:function(){return this._refresh}},unsupportedNodeEvent:{get:function(){return this._unsupportedNode}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}},credit:{get:function(){return this._credit}},kmlTours:{get:function(){return this._kmlTours}}}),KmlDataSource.prototype.load=function(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT),DataSource.setLoading(this,!0);var i=this._name;this._name=void 0,this._clampToGround=defaultValue(t.clampToGround,!1);var r=this;return load(this,this._entityCollection,e,t).then((function(){var e,t,n=r._entityCollection.computeAvailability(),a=n.start,o=n.stop,s=JulianDate.equals(a,Iso8601.MINIMUM_VALUE),l=JulianDate.equals(o,Iso8601.MAXIMUM_VALUE);s&&l||(s&&((t=new Date).setHours(0,0,0,0),a=JulianDate.fromDate(t)),l&&((t=new Date).setHours(24,0,0,0),o=JulianDate.fromDate(t)),(e=new DataSourceClock).startTime=a,e.stopTime=o,e.currentTime=JulianDate.clone(a),e.clockRange=ClockRange$1.LOOP_STOP,e.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,e.multiplier=Math.round(Math.min(Math.max(JulianDate.secondsDifference(o,a)/60,1),31556900)));var c=!1;return e!==r._clock&&(r._clock=e,c=!0),i!==r._name&&(c=!0),c&&r._changed.raiseEvent(r),DataSource.setLoading(r,!1),r})).otherwise((function(e){return DataSource.setLoading(r,!1),r._error.raiseEvent(r,e),console.log(e),when.reject(e)}))},KmlDataSource.prototype.destroy=function(){for(;this._screenOverlays.length>0;){this._screenOverlays.pop().remove()}};var entitiesToIgnore=new AssociativeArray;function KmlFeatureData(){this.author={name:void 0,uri:void 0,email:void 0},this.link={href:void 0,hreflang:void 0,rel:void 0,type:void 0,title:void 0,length:void 0},this.address=void 0,this.phoneNumber=void 0,this.snippet=void 0,this.extendedData=void 0}function Visualizer(){DeveloperError.throwInstantiationError()}KmlDataSource.prototype.update=function(e){var t=this._networkLinks;if(0===t.length)return!0;var i=JulianDate.now(),r=this;function n(e){for(var t=e._children,i=t.length,r=0;r<i;++r){var a=t[r];entitiesToIgnore.set(a.id,a),n(a)}}entitiesToIgnore.removeAll();var a=!1,o=this._lastCameraView,s=this._camera;!defined(s)||s.positionWC.equalsEpsilon(o.position,CesiumMath.EPSILON7)&&s.directionWC.equalsEpsilon(o.direction,CesiumMath.EPSILON7)&&s.upWC.equalsEpsilon(o.up,CesiumMath.EPSILON7)||(o.position=Cartesian3.clone(s.positionWC),o.direction=Cartesian3.clone(s.directionWC),o.up=Cartesian3.clone(s.upWC),o.bbox=s.computeViewRectangle(),a=!0);var l=new AssociativeArray,c=!1;return t.values.forEach((function(e){var t=e.entity;if(!entitiesToIgnore.contains(t.id)){if(!e.updating){var s=!1;if(e.refreshMode===RefreshMode.INTERVAL?JulianDate.secondsDifference(i,e.lastUpdated)>e.time&&(s=!0):e.refreshMode===RefreshMode.EXPIRE?JulianDate.greaterThan(i,e.time)&&(s=!0):e.refreshMode===RefreshMode.STOP&&(a&&(e.needsUpdate=!0,e.cameraUpdateTime=i),e.needsUpdate&&JulianDate.secondsDifference(i,e.cameraUpdateTime)>=e.time&&(s=!0)),s){n(t),e.updating=!0;var u=new EntityCollection,d=e.href.clone();d.setQueryParameters(e.cookie);var h=defaultValue(r._ellipsoid,Ellipsoid.WGS84);processNetworkLinkQueryString(d,r._camera,r._canvas,e.viewBoundScale,o.bbox,h),load(r,u,d,{context:t.id}).then(getNetworkLinkUpdateCallback(r,e,u,l,d)).otherwise((function(t){var i="NetworkLink "+e.href+" refresh failed: "+t;console.log(i),r._error.raiseEvent(r,i)})),c=!0}}l.set(e.id,e)}})),c&&(this._networkLinks=l,this._changed.raiseEvent(this)),!0},KmlDataSource._DeferredLoading=DeferredLoading,KmlDataSource._getTimestamp=getTimestamp$1,Visualizer.prototype.update=DeveloperError.throwInstantiationError,Visualizer.prototype.getBoundingSphere=DeveloperError.throwInstantiationError,Visualizer.prototype.isDestroyed=DeveloperError.throwInstantiationError,Visualizer.prototype.destroy=DeveloperError.throwInstantiationError;var ViewportQuadVS="attribute vec4 position;\nattribute vec2 textureCoordinates;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_Position = position;\nv_textureCoordinates = textureCoordinates;\n}\n",renderStateScratch;function ComputeEngine(e){this._context=e}var drawCommandScratch=new DrawCommand({primitiveType:PrimitiveType$1.TRIANGLES}),clearCommandScratch=new ClearCommand({color:new Color(0,0,0,0)});function createFramebuffer$2(e,t){return new Framebuffer({context:e,colorTextures:[t],destroyAttachments:!1})}function createViewportQuadShader(e,t){return ShaderProgram.fromCache({context:e,vertexShaderSource:ViewportQuadVS,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function createRenderState$1(e,t){return defined(renderStateScratch)&&renderStateScratch.viewport.width===e&&renderStateScratch.viewport.height===t||(renderStateScratch=RenderState.fromCache({viewport:new BoundingRectangle(0,0,e,t)})),renderStateScratch}function PassState(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}function ShaderCache(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}function destroyShader(e,t){for(var i=t.derivedKeywords,r=i.length,n=0;n<r;++n){var a=i[n]+t.keyword;destroyShader(e,e._shaders[a])}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}function TextureCache(){this._textures={},this._numberOfTextures=0,this._texturesToRelease={}}function SunLight(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.color=Color.clone(defaultValue(e.color,Color.WHITE)),this.intensity=defaultValue(e.intensity,2)}function UniformState(){this.globeDepthTexture=void 0,this.gamma=void 0,this._viewport=new BoundingRectangle,this._viewportCartesian4=new Cartesian4,this._viewportDirty=!1,this._viewportOrthographicMatrix=Matrix4.clone(Matrix4.IDENTITY),this._viewportTransformation=Matrix4.clone(Matrix4.IDENTITY),this._model=Matrix4.clone(Matrix4.IDENTITY),this._view=Matrix4.clone(Matrix4.IDENTITY),this._inverseView=Matrix4.clone(Matrix4.IDENTITY),this._projection=Matrix4.clone(Matrix4.IDENTITY),this._infiniteProjection=Matrix4.clone(Matrix4.IDENTITY),this._entireFrustum=new Cartesian2,this._currentFrustum=new Cartesian2,this._frustumPlanes=new Cartesian4,this._farDepthFromNearPlusOne=void 0,this._log2FarDepthFromNearPlusOne=void 0,this._oneOverLog2FarDepthFromNearPlusOne=void 0,this._frameState=void 0,this._temeToPseudoFixed=Matrix3.clone(Matrix4.IDENTITY),this._view3DDirty=!0,this._view3D=new Matrix4,this._inverseView3DDirty=!0,this._inverseView3D=new Matrix4,this._inverseModelDirty=!0,this._inverseModel=new Matrix4,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new Matrix3,this._viewRotation=new Matrix3,this._inverseViewRotation=new Matrix3,this._viewRotation3D=new Matrix3,this._inverseViewRotation3D=new Matrix3,this._inverseProjectionDirty=!0,this._inverseProjection=new Matrix4,this._modelViewDirty=!0,this._modelView=new Matrix4,this._modelView3DDirty=!0,this._modelView3D=new Matrix4,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new Matrix4,this._inverseModelViewDirty=!0,this._inverseModelView=new Matrix4,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new Matrix4,this._viewProjectionDirty=!0,this._viewProjection=new Matrix4,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new Matrix4,this._modelViewProjectionDirty=!0,this._modelViewProjection=new Matrix4,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new Matrix4,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new Matrix4,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new Matrix4,this._normalDirty=!0,this._normal=new Matrix3,this._normal3DDirty=!0,this._normal3D=new Matrix3,this._inverseNormalDirty=!0,this._inverseNormal=new Matrix3,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new Matrix3,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new EncodedCartesian3,this._cameraPosition=new Cartesian3,this._sunPositionWC=new Cartesian3,this._sunPositionColumbusView=new Cartesian3,this._sunDirectionWC=new Cartesian3,this._sunDirectionEC=new Cartesian3,this._moonDirectionEC=new Cartesian3,this._lightDirectionWC=new Cartesian3,this._lightDirectionEC=new Cartesian3,this._lightColor=new Cartesian3,this._lightColorHdr=new Cartesian3,this._pass=void 0,this._mode=void 0,this._mapProjection=void 0,this._ellipsoid=void 0,this._cameraDirection=new Cartesian3,this._cameraRight=new Cartesian3,this._cameraUp=new Cartesian3,this._frustum2DWidth=0,this._eyeHeight=0,this._eyeHeight2D=new Cartesian2,this._pixelRatio=1,this._orthographicIn3D=!1,this._backgroundColor=new Color,this._brdfLut=void 0,this._environmentMap=void 0,this._sphericalHarmonicCoefficients=void 0,this._specularEnvironmentMaps=void 0,this._specularEnvironmentMapsDimensions=new Cartesian2,this._specularEnvironmentMapsMaximumLOD=void 0,this._fogDensity=void 0,this._invertClassificationColor=void 0,this._imagerySplitPosition=0,this._pixelSizePerMeter=void 0,this._geometricToleranceOverMeter=void 0,this._minimumDisableDepthTestDistance=void 0}function setView(e,t){Matrix4.clone(t,e._view),Matrix4.getMatrix3(t,e._viewRotation),e._view3DDirty=!0,e._inverseView3DDirty=!0,e._modelViewDirty=!0,e._modelView3DDirty=!0,e._modelViewRelativeToEyeDirty=!0,e._inverseModelViewDirty=!0,e._inverseModelView3DDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0,e._modelViewInfiniteProjectionDirty=!0,e._normalDirty=!0,e._inverseNormalDirty=!0,e._normal3DDirty=!0,e._inverseNormal3DDirty=!0}function setInverseView(e,t){Matrix4.clone(t,e._inverseView),Matrix4.getMatrix3(t,e._inverseViewRotation)}function setProjection(e,t){Matrix4.clone(t,e._projection),e._inverseProjectionDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function setInfiniteProjection(e,t){Matrix4.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}function setCamera(e,t){Cartesian3.clone(t.positionWC,e._cameraPosition),Cartesian3.clone(t.directionWC,e._cameraDirection),Cartesian3.clone(t.rightWC,e._cameraRight),Cartesian3.clone(t.upWC,e._cameraUp);var i=t.positionCartographic;defined(i)?e._eyeHeight=i.height:e._eyeHeight=-e._ellipsoid.maximumRadius,e._encodedCameraPositionMCDirty=!0}ComputeEngine.prototype.execute=function(e){defined(e.preExecute)&&e.preExecute(e);var t=e.outputTexture,i=t.width,r=t.height,n=this._context,a=defined(e.vertexArray)?e.vertexArray:n.getViewportQuadVertexArray(),o=defined(e.shaderProgram)?e.shaderProgram:createViewportQuadShader(n,e.fragmentShaderSource),s=createFramebuffer$2(n,t),l=createRenderState$1(i,r),c=e.uniformMap,u=clearCommandScratch;u.framebuffer=s,u.renderState=l,u.execute(n);var d=drawCommandScratch;d.vertexArray=a,d.renderState=l,d.shaderProgram=o,d.uniformMap=c,d.framebuffer=s,d.execute(n),s.destroy(),e.persists||(o.destroy(),defined(e.vertexArray)&&a.destroy()),defined(e.postExecute)&&e.postExecute(t)},ComputeEngine.prototype.isDestroyed=function(){return!1},ComputeEngine.prototype.destroy=function(){return destroyObject(this)},Object.defineProperties(ShaderCache.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}}),ShaderCache.prototype.replaceShaderProgram=function(e){return defined(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)},ShaderCache.prototype.getShaderProgram=function(e){var t=e.vertexShaderSource,i=e.fragmentShaderSource,r=e.attributeLocations;"string"==typeof t&&(t=new ShaderSource({sources:[t]})),"string"==typeof i&&(i=new ShaderSource({sources:[i]}));var n,a=t.createCombinedVertexShader(this._context),o=i.createCombinedFragmentShader(this._context),s=a+o+JSON.stringify(r);if(defined(this._shaders[s]))n=this._shaders[s],delete this._shadersToRelease[s];else{var l=this._context,c=new ShaderProgram({gl:l._gl,logShaderCompilation:l.logShaderCompilation,debugShaders:l.debugShaders,vertexShaderSource:t,vertexShaderText:a,fragmentShaderSource:i,fragmentShaderText:o,attributeLocations:r});n={cache:this,shaderProgram:c,keyword:s,derivedKeywords:[],count:0},c._cachedShader=n,this._shaders[s]=n,++this._numberOfShaders}return++n.count,n.shaderProgram},ShaderCache.prototype.replaceDerivedShaderProgram=function(e,t,i){var r=e._cachedShader,n=t+r.keyword,a=this._shaders[n];if(defined(a)){destroyShader(this,a);var o=r.derivedKeywords.indexOf(t);o>-1&&r.derivedKeywords.splice(o,1)}return this.createDerivedShaderProgram(e,t,i)},ShaderCache.prototype.getDerivedShaderProgram=function(e,t){var i=t+e._cachedShader.keyword,r=this._shaders[i];if(defined(r))return r.shaderProgram},ShaderCache.prototype.createDerivedShaderProgram=function(e,t,i){var r=e._cachedShader,n=t+r.keyword,a=i.vertexShaderSource,o=i.fragmentShaderSource,s=i.attributeLocations;"string"==typeof a&&(a=new ShaderSource({sources:[a]})),"string"==typeof o&&(o=new ShaderSource({sources:[o]}));var l=this._context,c=a.createCombinedVertexShader(l),u=o.createCombinedFragmentShader(l),d=new ShaderProgram({gl:l._gl,logShaderCompilation:l.logShaderCompilation,debugShaders:l.debugShaders,vertexShaderSource:a,vertexShaderText:c,fragmentShaderSource:o,fragmentShaderText:u,attributeLocations:s}),h={cache:this,shaderProgram:d,keyword:n,derivedKeywords:[],count:0};return r.derivedKeywords.push(t),d._cachedShader=h,this._shaders[n]=h,d},ShaderCache.prototype.destroyReleasedShaderPrograms=function(){var e=this._shadersToRelease;for(var t in e){if(e.hasOwnProperty(t))destroyShader(this,e[t]),--this._numberOfShaders}this._shadersToRelease={}},ShaderCache.prototype.releaseShaderProgram=function(e){if(defined(e)){var t=e._cachedShader;t&&0==--t.count&&(this._shadersToRelease[t.keyword]=t)}},ShaderCache.prototype.isDestroyed=function(){return!1},ShaderCache.prototype.destroy=function(){var e=this._shaders;for(var t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return destroyObject(this)},Object.defineProperties(TextureCache.prototype,{numberOfTextures:{get:function(){return this._numberOfTextures}}}),TextureCache.prototype.getTexture=function(e){var t=this._textures[e];if(defined(t))return delete this._texturesToRelease[e],++t.count,t.texture},TextureCache.prototype.addTexture=function(e,t){var i={texture:t,count:1};t.finalDestroy=t.destroy;var r=this;t.destroy=function(){0==--i.count&&(r._texturesToRelease[e]=i)},this._textures[e]=i,++this._numberOfTextures},TextureCache.prototype.destroyReleasedTextures=function(){var e=this._texturesToRelease;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];delete this._textures[t],i.texture.finalDestroy(),--this._numberOfTextures}this._texturesToRelease={}},TextureCache.prototype.isDestroyed=function(){return!1},TextureCache.prototype.destroy=function(){var e=this._textures;for(var t in e)e.hasOwnProperty(t)&&e[t].texture.finalDestroy();return destroyObject(this)},Object.defineProperties(UniformState.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(e){if(!BoundingRectangle.equals(e,this._viewport)){BoundingRectangle.clone(e,this._viewport);var t=this._viewport,i=this._viewportCartesian4;i.x=t.x,i.y=t.y,i.z=t.width,i.w=t.height,this._viewportDirty=!0}}},viewportCartesian4:{get:function(){return this._viewportCartesian4}},viewportOrthographic:{get:function(){return cleanViewport(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return cleanViewport(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){Matrix4.clone(e,this._model),this._modelView3DDirty=!0,this._inverseModelView3DDirty=!0,this._inverseModelDirty=!0,this._inverseTransposeModelDirty=!0,this._modelViewDirty=!0,this._inverseModelViewDirty=!0,this._modelViewRelativeToEyeDirty=!0,this._inverseModelViewDirty=!0,this._modelViewProjectionDirty=!0,this._inverseModelViewProjectionDirty=!0,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewInfiniteProjectionDirty=!0,this._normalDirty=!0,this._inverseNormalDirty=!0,this._normal3DDirty=!0,this._inverseNormal3DDirty=!0,this._encodedCameraPositionMCDirty=!0}},inverseModel:{get:function(){return this._inverseModelDirty&&(this._inverseModelDirty=!1,Matrix4.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTransposeModel:{get:function(){var e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,Matrix4.getMatrix3(this.inverseModel,e),Matrix3.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return updateView3D(this),this._view3D}},viewRotation:{get:function(){return updateView3D(this),this._viewRotation}},viewRotation3D:{get:function(){return updateView3D(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return updateInverseView3D(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return updateInverseView3D(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return cleanInverseProjection(this),this._inverseProjection}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return cleanModelView(this),this._modelView}},modelView3D:{get:function(){return cleanModelView3D(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return cleanModelViewRelativeToEye(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return cleanInverseModelView(this),this._inverseModelView}},inverseModelView3D:{get:function(){return cleanInverseModelView3D(this),this._inverseModelView3D}},viewProjection:{get:function(){return cleanViewProjection(this),this._viewProjection}},inverseViewProjection:{get:function(){return cleanInverseViewProjection(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return cleanModelViewProjection(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return cleanInverseModelViewProjection(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return cleanModelViewProjectionRelativeToEye(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return cleanModelViewInfiniteProjection(this),this._modelViewInfiniteProjection}},normal:{get:function(){return cleanNormal(this),this._normal}},normal3D:{get:function(){return cleanNormal3D(this),this._normal3D}},inverseNormal:{get:function(){return cleanInverseNormal(this),this._inverseNormal}},inverseNormal3D:{get:function(){return cleanInverseNormal3D(this),this._inverseNormal3D}},entireFrustum:{get:function(){return this._entireFrustum}},currentFrustum:{get:function(){return this._currentFrustum}},frustumPlanes:{get:function(){return this._frustumPlanes}},farDepthFromNearPlusOne:{get:function(){return this._farDepthFromNearPlusOne}},log2FarDepthFromNearPlusOne:{get:function(){return this._log2FarDepthFromNearPlusOne}},oneOverLog2FarDepthFromNearPlusOne:{get:function(){return this._oneOverLog2FarDepthFromNearPlusOne}},eyeHeight:{get:function(){return this._eyeHeight}},eyeHeight2D:{get:function(){return this._eyeHeight2D}},sunPositionWC:{get:function(){return this._sunPositionWC}},sunPositionColumbusView:{get:function(){return this._sunPositionColumbusView}},sunDirectionWC:{get:function(){return this._sunDirectionWC}},sunDirectionEC:{get:function(){return this._sunDirectionEC}},moonDirectionEC:{get:function(){return this._moonDirectionEC}},lightDirectionWC:{get:function(){return this._lightDirectionWC}},lightDirectionEC:{get:function(){return this._lightDirectionEC}},lightColor:{get:function(){return this._lightColor}},lightColorHdr:{get:function(){return this._lightColorHdr}},encodedCameraPositionMCHigh:{get:function(){return cleanEncodedCameraPositionMC(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return cleanEncodedCameraPositionMC(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},pixelRatio:{get:function(){return this._pixelRatio}},fogDensity:{get:function(){return this._fogDensity}},geometricToleranceOverMeter:{get:function(){return this._geometricToleranceOverMeter}},pass:{get:function(){return this._pass}},backgroundColor:{get:function(){return this._backgroundColor}},brdfLut:{get:function(){return this._brdfLut}},environmentMap:{get:function(){return this._environmentMap}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps}},specularEnvironmentMapsDimensions:{get:function(){return this._specularEnvironmentMapsDimensions}},specularEnvironmentMapsMaximumLOD:{get:function(){return this._specularEnvironmentMapsMaximumLOD}},imagerySplitPosition:{get:function(){return this._imagerySplitPosition}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance}},invertClassificationColor:{get:function(){return this._invertClassificationColor}},orthographicIn3D:{get:function(){return this._orthographicIn3D}},ellipsoid:{get:function(){return defaultValue(this._ellipsoid,Ellipsoid.WGS84)}}});var transformMatrix=new Matrix3,sunCartographicScratch=new Cartographic;function setSunAndMoonDirections(e,t){defined(Transforms.computeIcrfToFixedMatrix(t.time,transformMatrix))||(transformMatrix=Transforms.computeTemeToPseudoFixedMatrix(t.time,transformMatrix));var i=Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);Matrix3.multiplyByVector(transformMatrix,i,i),Cartesian3.normalize(i,e._sunDirectionWC),i=Matrix3.multiplyByVector(e.viewRotation3D,i,e._sunDirectionEC),Cartesian3.normalize(i,i),i=Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),Matrix3.multiplyByVector(transformMatrix,i,i),Matrix3.multiplyByVector(e.viewRotation3D,i,i),Cartesian3.normalize(i,i);var r=t.mapProjection,n=r.ellipsoid.cartesianToCartographic(e._sunPositionWC,sunCartographicScratch);r.project(n,e._sunPositionColumbusView)}UniformState.prototype.updateCamera=function(e){setView(this,e.viewMatrix),setInverseView(this,e.inverseViewMatrix),setCamera(this,e),this._entireFrustum.x=e.frustum.near,this._entireFrustum.y=e.frustum.far,this.updateFrustum(e.frustum),this._orthographicIn3D=this._mode!==SceneMode$1.SCENE2D&&e.frustum instanceof OrthographicFrustum},UniformState.prototype.updateFrustum=function(e){setProjection(this,e.projectionMatrix),defined(e.infiniteProjectionMatrix)&&setInfiniteProjection(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,this._farDepthFromNearPlusOne=e.far-e.near+1,this._log2FarDepthFromNearPlusOne=CesiumMath.log2(this._farDepthFromNearPlusOne),this._oneOverLog2FarDepthFromNearPlusOne=1/this._log2FarDepthFromNearPlusOne,defined(e._offCenterFrustum)&&(e=e._offCenterFrustum),this._frustumPlanes.x=e.top,this._frustumPlanes.y=e.bottom,this._frustumPlanes.z=e.left,this._frustumPlanes.w=e.right},UniformState.prototype.updatePass=function(e){this._pass=e};var EMPTY_ARRAY=[],defaultLight=new SunLight;function cleanViewport(e){if(e._viewportDirty){var t=e._viewport;Matrix4.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),Matrix4.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function cleanInverseProjection(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,e._mode===SceneMode$1.SCENE2D||e._mode===SceneMode$1.MORPHING||e._orthographicIn3D?Matrix4.clone(Matrix4.ZERO,e._inverseProjection):Matrix4.inverse(e._projection,e._inverseProjection))}function cleanModelView(e){e._modelViewDirty&&(e._modelViewDirty=!1,Matrix4.multiplyTransformation(e._view,e._model,e._modelView))}function cleanModelView3D(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,Matrix4.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function cleanInverseModelView(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,Matrix4.inverse(e.modelView,e._inverseModelView))}function cleanInverseModelView3D(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,Matrix4.inverse(e.modelView3D,e._inverseModelView3D))}function cleanViewProjection(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,Matrix4.multiply(e._projection,e._view,e._viewProjection))}function cleanInverseViewProjection(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,Matrix4.inverse(e.viewProjection,e._inverseViewProjection))}function cleanModelViewProjection(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,Matrix4.multiply(e._projection,e.modelView,e._modelViewProjection))}function cleanModelViewRelativeToEye(e){if(e._modelViewRelativeToEyeDirty){e._modelViewRelativeToEyeDirty=!1;var t=e.modelView,i=e._modelViewRelativeToEye;i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=0,i[13]=0,i[14]=0,i[15]=t[15]}}function cleanInverseModelViewProjection(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,Matrix4.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function cleanModelViewProjectionRelativeToEye(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,Matrix4.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function cleanModelViewInfiniteProjection(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,Matrix4.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function cleanNormal(e){if(e._normalDirty){e._normalDirty=!1;var t=e._normal;Matrix4.getMatrix3(e.inverseModelView,t),Matrix3.getRotation(t,t),Matrix3.transpose(t,t)}}function cleanNormal3D(e){if(e._normal3DDirty){e._normal3DDirty=!1;var t=e._normal3D;Matrix4.getMatrix3(e.inverseModelView3D,t),Matrix3.getRotation(t,t),Matrix3.transpose(t,t)}}function cleanInverseNormal(e){e._inverseNormalDirty&&(e._inverseNormalDirty=!1,Matrix4.getMatrix3(e.inverseModelView,e._inverseNormal),Matrix3.getRotation(e._inverseNormal,e._inverseNormal))}function cleanInverseNormal3D(e){e._inverseNormal3DDirty&&(e._inverseNormal3DDirty=!1,Matrix4.getMatrix3(e.inverseModelView3D,e._inverseNormal3D),Matrix3.getRotation(e._inverseNormal3D,e._inverseNormal3D))}UniformState.prototype.update=function(e){this._mode=e.mode,this._mapProjection=e.mapProjection,this._ellipsoid=e.mapProjection.ellipsoid,this._pixelRatio=e.pixelRatio;var t=e.camera;this.updateCamera(t),e.mode===SceneMode$1.SCENE2D?(this._frustum2DWidth=t.frustum.right-t.frustum.left,this._eyeHeight2D.x=.5*this._frustum2DWidth,this._eyeHeight2D.y=this._eyeHeight2D.x*this._eyeHeight2D.x):(this._frustum2DWidth=0,this._eyeHeight2D.x=0,this._eyeHeight2D.y=0),setSunAndMoonDirections(this,e);var i=defaultValue(e.light,defaultLight);i instanceof SunLight?(this._lightDirectionWC=Cartesian3.clone(this._sunDirectionWC,this._lightDirectionWC),this._lightDirectionEC=Cartesian3.clone(this._sunDirectionEC,this._lightDirectionEC)):(this._lightDirectionWC=Cartesian3.normalize(Cartesian3.negate(i.direction,this._lightDirectionWC),this._lightDirectionWC),this._lightDirectionEC=Matrix3.multiplyByVector(this.viewRotation3D,this._lightDirectionWC,this._lightDirectionEC));var r=i.color,n=Cartesian3.fromElements(r.red,r.green,r.blue,this._lightColorHdr);n=Cartesian3.multiplyByScalar(n,i.intensity,n);var a=Cartesian3.maximumComponent(n);a>1?Cartesian3.divideByScalar(n,a,this._lightColor):Cartesian3.clone(n,this._lightColor);var o=e.brdfLutGenerator,s=defined(o)?o.colorTexture:void 0;this._brdfLut=s,this._environmentMap=defaultValue(e.environmentMap,e.context.defaultCubeMap),this._sphericalHarmonicCoefficients=defaultValue(e.sphericalHarmonicCoefficients,EMPTY_ARRAY),this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapsMaximumLOD=e.specularEnvironmentMapsMaximumLOD,defined(this._specularEnvironmentMaps)&&Cartesian2.clone(this._specularEnvironmentMaps.dimensions,this._specularEnvironmentMapsDimensions),this._fogDensity=e.fog.density,this._invertClassificationColor=e.invertClassificationColor,this._frameState=e,this._temeToPseudoFixed=Transforms.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed),this._imagerySplitPosition=e.imagerySplitPosition*e.context.drawingBufferWidth;var l,c=t.frustum.fov,u=this._viewport;l=defined(c)?u.height>u.width?2*Math.tan(.5*c)/u.height:2*Math.tan(.5*c)/u.width:1/Math.max(u.width,u.height),this._geometricToleranceOverMeter=l*e.maximumScreenSpaceError,Color.clone(e.backgroundColor,this._backgroundColor),this._minimumDisableDepthTestDistance=e.minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance*=this._minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance===Number.POSITIVE_INFINITY&&(this._minimumDisableDepthTestDistance=-1)};var cameraPositionMC=new Cartesian3;function cleanEncodedCameraPositionMC(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,Matrix4.multiplyByPoint(e.inverseModel,e._cameraPosition,cameraPositionMC),EncodedCartesian3.fromCartesian(cameraPositionMC,e._encodedCameraPositionMC))}var view2Dto3DPScratch=new Cartesian3,view2Dto3DRScratch=new Cartesian3,view2Dto3DUScratch=new Cartesian3,view2Dto3DDScratch=new Cartesian3,view2Dto3DCartographicScratch=new Cartographic,view2Dto3DCartesian3Scratch=new Cartesian3,view2Dto3DMatrix4Scratch=new Matrix4;function view2Dto3D(e,t,i,r,n,a,o,s){var l=view2Dto3DPScratch;l.x=e.y,l.y=e.z,l.z=e.x;var c=view2Dto3DRScratch;c.x=i.y,c.y=i.z,c.z=i.x;var u=view2Dto3DUScratch;u.x=r.y,u.y=r.z,u.z=r.x;var d=view2Dto3DDScratch;d.x=t.y,d.y=t.z,d.z=t.x,a===SceneMode$1.SCENE2D&&(l.z=.5*n);var h=o.unproject(l,view2Dto3DCartographicScratch);h.longitude=CesiumMath.clamp(h.longitude,-Math.PI,Math.PI),h.latitude=CesiumMath.clamp(h.latitude,-CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO);var p=o.ellipsoid,f=p.cartographicToCartesian(h,view2Dto3DCartesian3Scratch),m=Transforms.eastNorthUpToFixedFrame(f,p,view2Dto3DMatrix4Scratch);return Matrix4.multiplyByPointAsVector(m,c,c),Matrix4.multiplyByPointAsVector(m,u,u),Matrix4.multiplyByPointAsVector(m,d,d),defined(s)||(s=new Matrix4),s[0]=c.x,s[1]=u.x,s[2]=-d.x,s[3]=0,s[4]=c.y,s[5]=u.y,s[6]=-d.y,s[7]=0,s[8]=c.z,s[9]=u.z,s[10]=-d.z,s[11]=0,s[12]=-Cartesian3.dot(c,f),s[13]=-Cartesian3.dot(u,f),s[14]=Cartesian3.dot(d,f),s[15]=1,s}function updateView3D(e){e._view3DDirty&&(e._mode===SceneMode$1.SCENE3D?Matrix4.clone(e._view,e._view3D):view2Dto3D(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),Matrix4.getMatrix3(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function updateInverseView3D(e){e._inverseView3DDirty&&(Matrix4.inverseTransformation(e.view3D,e._inverseView3D),Matrix4.getMatrix3(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}function errorToString(e,t){var i="WebGL Error: ";switch(t){case e.INVALID_ENUM:i+="INVALID_ENUM";break;case e.INVALID_VALUE:i+="INVALID_VALUE";break;case e.INVALID_OPERATION:i+="INVALID_OPERATION";break;case e.OUT_OF_MEMORY:i+="OUT_OF_MEMORY";break;case e.CONTEXT_LOST_WEBGL:i+="CONTEXT_LOST_WEBGL lost";break;default:i+="Unknown ("+t+")"}return i}function createErrorMessage(e,t,i,r){for(var n=errorToString(e,r)+": "+t.name+"(",a=0;a<i.length;++a)0!==a&&(n+=", "),n+=i[a];return n+=");"}function throwOnError(e,t,i){var r=e.getError();if(r!==e.NO_ERROR)throw new RuntimeError(createErrorMessage(e,t,i,r))}function makeGetterSetter(e,t,i){return{get:function(){var r=e[t];return i(e,"get: "+t,r),e[t]},set:function(r){e[t]=r,i(e,"set: "+t,r)}}}function wrapGL(e,t){if(!defined(t))return e;function i(i){return function(){var r=i.apply(e,arguments);return t(e,i,arguments),r}}var r={};for(var n in e){var a=e[n];a instanceof Function?r[n]=i(a):Object.defineProperty(r,n,makeGetterSetter(e,n,t))}return r}function getExtension(e,t){for(var i=t.length,r=0;r<i;++r){var n=e.getExtension(t[r]);if(n)return n}}function Context(e,t){if("undefined"==typeof WebGLRenderingContext)throw new RuntimeError("The browser does not support WebGL. Visit http://get.webgl.org.");this._canvas=e,(t=defaultValue(t=clone$1(t,!0),{})).allowTextureFilterAnisotropic=defaultValue(t.allowTextureFilterAnisotropic,!0);var i=defaultValue(t.webgl,{});i.alpha=defaultValue(i.alpha,!1),i.stencil=defaultValue(i.stencil,!0);var r,n=defaultValue(t.requestWebgl2,!1)&&"undefined"!=typeof WebGL2RenderingContext,a=!1,o=t.getWebGLStub;if(defined(o))r=o(e,i);else if(n&&defined(r=e.getContext("webgl2",i)||e.getContext("experimental-webgl2",i)||void 0)&&(a=!0),defined(r)||(r=e.getContext("webgl",i)||e.getContext("experimental-webgl",i)||void 0),!defined(r))throw new RuntimeError("The browser supports WebGL, but initialization failed.");this._originalGLContext=r,this._gl=r,this._webgl2=a,this._id=createGuid(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new ShaderCache(this),this._textureCache=new TextureCache;var s=r;this._stencilBits=s.getParameter(s.STENCIL_BITS),ContextLimits._maximumCombinedTextureImageUnits=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS),ContextLimits._maximumCubeMapSize=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),ContextLimits._maximumFragmentUniformVectors=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),ContextLimits._maximumTextureImageUnits=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),ContextLimits._maximumRenderbufferSize=s.getParameter(s.MAX_RENDERBUFFER_SIZE),ContextLimits._maximumTextureSize=s.getParameter(s.MAX_TEXTURE_SIZE),ContextLimits._maximumVaryingVectors=s.getParameter(s.MAX_VARYING_VECTORS),ContextLimits._maximumVertexAttributes=s.getParameter(s.MAX_VERTEX_ATTRIBS),ContextLimits._maximumVertexTextureImageUnits=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),ContextLimits._maximumVertexUniformVectors=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS);var l=s.getParameter(s.ALIASED_LINE_WIDTH_RANGE);ContextLimits._minimumAliasedLineWidth=l[0],ContextLimits._maximumAliasedLineWidth=l[1];var c=s.getParameter(s.ALIASED_POINT_SIZE_RANGE);ContextLimits._minimumAliasedPointSize=c[0],ContextLimits._maximumAliasedPointSize=c[1];var u=s.getParameter(s.MAX_VIEWPORT_DIMS);ContextLimits._maximumViewportWidth=u[0],ContextLimits._maximumViewportHeight=u[1];var d=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT);ContextLimits._highpFloatSupported=0!==d.precision;var h=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_INT);ContextLimits._highpIntSupported=0!==h.rangeMax,this._antialias=s.getContextAttributes().antialias,this._standardDerivatives=!!getExtension(s,["OES_standard_derivatives"]),this._blendMinmax=!!getExtension(s,["EXT_blend_minmax"]),this._elementIndexUint=!!getExtension(s,["OES_element_index_uint"]),this._depthTexture=!!getExtension(s,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._fragDepth=!!getExtension(s,["EXT_frag_depth"]),this._debugShaders=getExtension(s,["WEBGL_debug_shaders"]),this._textureFloat=!!getExtension(s,["OES_texture_float"]),this._textureHalfFloat=!!getExtension(s,["OES_texture_half_float"]),this._textureFloatLinear=!!getExtension(s,["OES_texture_float_linear"]),this._textureHalfFloatLinear=!!getExtension(s,["OES_texture_half_float_linear"]),this._colorBufferFloat=!!getExtension(s,["EXT_color_buffer_float","WEBGL_color_buffer_float"]),this._floatBlend=!!getExtension(s,["EXT_float_blend"]),this._colorBufferHalfFloat=!!getExtension(s,["EXT_color_buffer_half_float"]),this._s3tc=!!getExtension(s,["WEBGL_compressed_texture_s3tc","MOZ_WEBGL_compressed_texture_s3tc","WEBKIT_WEBGL_compressed_texture_s3tc"]),this._pvrtc=!!getExtension(s,["WEBGL_compressed_texture_pvrtc","WEBKIT_WEBGL_compressed_texture_pvrtc"]),this._astc=!!getExtension(s,["WEBGL_compressed_texture_astc"]),this._etc=!!getExtension(s,["WEBG_compressed_texture_etc"]),this._etc1=!!getExtension(s,["WEBGL_compressed_texture_etc1"]),this._bc7=!!getExtension(s,["EXT_texture_compression_bptc"]),loadKTX2.setKTX2SupportedFormats(this._s3tc,this._pvrtc,this._astc,this._etc,this._etc1,this._bc7);var p,f,m,g,_,y,v,C,T,S,A=t.allowTextureFilterAnisotropic?getExtension(s,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;if(this._textureFilterAnisotropic=A,ContextLimits._maximumTextureFilterAnisotropy=defined(A)?s.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1,a){var x=this;p=function(){return x._gl.createVertexArray()},f=function(e){x._gl.bindVertexArray(e)},m=function(e){x._gl.deleteVertexArray(e)},g=function(e,t,i,r,n){s.drawElementsInstanced(e,t,i,r,n)},_=function(e,t,i,r){s.drawArraysInstanced(e,t,i,r)},y=function(e,t){s.vertexAttribDivisor(e,t)},v=function(e){s.drawBuffers(e)}}else defined(C=getExtension(s,["OES_vertex_array_object"]))&&(p=function(){return C.createVertexArrayOES()},f=function(e){C.bindVertexArrayOES(e)},m=function(e){C.deleteVertexArrayOES(e)}),defined(T=getExtension(s,["ANGLE_instanced_arrays"]))&&(g=function(e,t,i,r,n){T.drawElementsInstancedANGLE(e,t,i,r,n)},_=function(e,t,i,r){T.drawArraysInstancedANGLE(e,t,i,r)},y=function(e,t){T.vertexAttribDivisorANGLE(e,t)}),defined(S=getExtension(s,["WEBGL_draw_buffers"]))&&(v=function(e){S.drawBuffersWEBGL(e)});this.glCreateVertexArray=p,this.glBindVertexArray=f,this.glDeleteVertexArray=m,this.glDrawElementsInstanced=g,this.glDrawArraysInstanced=_,this.glVertexAttribDivisor=y,this.glDrawBuffers=v,this._vertexArrayObject=!!C,this._instancedArrays=!!T,this._drawBuffers=!!S,ContextLimits._maximumDrawBuffers=this.drawBuffers?s.getParameter(WebGLConstants$1.MAX_DRAW_BUFFERS):1,ContextLimits._maximumColorAttachments=this.drawBuffers?s.getParameter(WebGLConstants$1.MAX_COLOR_ATTACHMENTS):1,this._clearColor=new Color(0,0,0,0),this._clearDepth=1,this._clearStencil=0;var E=new UniformState,b=new PassState(this),P=RenderState.fromCache();this._defaultPassState=b,this._defaultRenderState=P,this._defaultTexture=void 0,this._defaultEmissiveTexture=void 0,this._defaultNormalTexture=void 0,this._defaultCubeMap=void 0,this._us=E,this._currentRenderState=P,this._currentPassState=b,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(var D=0;D<ContextLimits._maximumVertexAttributes;D++)this._vertexAttribDivisors.push(0);this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options=t,this.cache={},RenderState.apply(s,P,b)}var defaultFramebufferMarker={},scratchBackBufferArray;function applyRenderState(e,t,i,r){var n=e._currentRenderState,a=e._currentPassState;e._currentRenderState=t,e._currentPassState=i,RenderState.partialApply(e._gl,n,t,a,i,r)}function bindFramebuffer(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;var i=scratchBackBufferArray;if(defined(t))t._bind(),i=t._getActiveColorAttachments();else{var r=e._gl;r.bindFramebuffer(r.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(i)}}Object.defineProperties(Context.prototype,{id:{get:function(){return this._id}},webgl2:{get:function(){return this._webgl2}},canvas:{get:function(){return this._canvas}},shaderCache:{get:function(){return this._shaderCache}},textureCache:{get:function(){return this._textureCache}},uniformState:{get:function(){return this._us}},stencilBits:{get:function(){return this._stencilBits}},stencilBuffer:{get:function(){return this._stencilBits>=8}},antialias:{get:function(){return this._antialias}},standardDerivatives:{get:function(){return this._standardDerivatives||this._webgl2}},floatBlend:{get:function(){return this._floatBlend}},blendMinmax:{get:function(){return this._blendMinmax||this._webgl2}},elementIndexUint:{get:function(){return this._elementIndexUint||this._webgl2}},depthTexture:{get:function(){return this._depthTexture||this._webgl2}},floatingPointTexture:{get:function(){return this._webgl2||this._textureFloat}},halfFloatingPointTexture:{get:function(){return this._webgl2||this._textureHalfFloat}},textureFloatLinear:{get:function(){return this._textureFloatLinear}},textureHalfFloatLinear:{get:function(){return this._webgl2&&this._textureFloatLinear||!this._webgl2&&this._textureHalfFloatLinear}},textureFilterAnisotropic:{get:function(){return!!this._textureFilterAnisotropic}},s3tc:{get:function(){return this._s3tc}},pvrtc:{get:function(){return this._pvrtc}},astc:{get:function(){return this._astc}},etc:{get:function(){return this._etc}},etc1:{get:function(){return this._etc1}},bc7:{get:function(){return this._bc7}},supportsBasis:{get:function(){return this._s3tc||this._pvrtc||this._astc||this._etc||this._etc1||this._bc7}},vertexArrayObject:{get:function(){return this._vertexArrayObject||this._webgl2}},fragmentDepth:{get:function(){return this._fragDepth||this._webgl2}},instancedArrays:{get:function(){return this._instancedArrays||this._webgl2}},colorBufferFloat:{get:function(){return this._colorBufferFloat}},colorBufferHalfFloat:{get:function(){return this._webgl2&&this._colorBufferFloat||!this._webgl2&&this._colorBufferHalfFloat}},drawBuffers:{get:function(){return this._drawBuffers||this._webgl2}},debugShaders:{get:function(){return this._debugShaders}},throwOnWebGLError:{get:function(){return this._throwOnWebGLError},set:function(e){this._throwOnWebGLError=e,this._gl=wrapGL(this._originalGLContext,e?throwOnError:void 0)}},defaultTexture:{get:function(){return void 0===this._defaultTexture&&(this._defaultTexture=new Texture({context:this,source:{width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])},flipY:!1})),this._defaultTexture}},defaultEmissiveTexture:{get:function(){return void 0===this._defaultEmissiveTexture&&(this._defaultEmissiveTexture=new Texture({context:this,pixelFormat:PixelFormat$1.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([0,0,0])},flipY:!1})),this._defaultEmissiveTexture}},defaultNormalTexture:{get:function(){return void 0===this._defaultNormalTexture&&(this._defaultNormalTexture=new Texture({context:this,pixelFormat:PixelFormat$1.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([128,128,255])},flipY:!1})),this._defaultNormalTexture}},defaultCubeMap:{get:function(){if(void 0===this._defaultCubeMap){var e={width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])};this._defaultCubeMap=new CubeMap({context:this,source:{positiveX:e,negativeX:e,positiveY:e,negativeY:e,positiveZ:e,negativeZ:e},flipY:!1})}return this._defaultCubeMap}},drawingBufferHeight:{get:function(){return this._gl.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._gl.drawingBufferWidth}},defaultFramebuffer:{get:function(){return defaultFramebufferMarker}}}),"undefined"!=typeof WebGLRenderingContext&&(scratchBackBufferArray=[WebGLConstants$1.BACK]);var defaultClearCommand=new ClearCommand;function beginDraw(e,t,i,r,n){bindFramebuffer(e,t),applyRenderState(e,n,i,!1),r._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,r.maximumTextureUnitIndex)}function continueDraw(e,t,i,r){var n=t._primitiveType,a=t._vertexArray,o=t._offset,s=t._count,l=t.instanceCount;e._us.model=defaultValue(t._modelMatrix,Matrix4.IDENTITY),i._setUniforms(r,e._us,e.validateShaderProgram),a._bind();var c=a.indexBuffer;defined(c)?(o*=c.bytesPerIndex,s=defaultValue(s,c.numberOfIndices),0===l?e._gl.drawElements(n,s,c.indexDatatype,o):e.glDrawElementsInstanced(n,s,c.indexDatatype,o,l)):(s=defaultValue(s,a.numberOfVertices),0===l?e._gl.drawArrays(n,o,s):e.glDrawArraysInstanced(n,o,s,l)),a._unBind()}Context.prototype.clear=function(e,t){e=defaultValue(e,defaultClearCommand),t=defaultValue(t,this._defaultPassState);var i=this._gl,r=0,n=e.color,a=e.depth,o=e.stencil;defined(n)&&(Color.equals(this._clearColor,n)||(Color.clone(n,this._clearColor),i.clearColor(n.red,n.green,n.blue,n.alpha)),r|=i.COLOR_BUFFER_BIT),defined(a)&&(a!==this._clearDepth&&(this._clearDepth=a,i.clearDepth(a)),r|=i.DEPTH_BUFFER_BIT),defined(o)&&(o!==this._clearStencil&&(this._clearStencil=o,i.clearStencil(o)),r|=i.STENCIL_BUFFER_BIT),applyRenderState(this,defaultValue(e.renderState,this._defaultRenderState),t,!0),bindFramebuffer(this,defaultValue(e.framebuffer,t.framebuffer)),i.clear(r)},Context.prototype.draw=function(e,t,i,r){t=defaultValue(t,this._defaultPassState);var n=defaultValue(e._framebuffer,t.framebuffer),a=defaultValue(e._renderState,this._defaultRenderState);i=defaultValue(i,e._shaderProgram),r=defaultValue(r,e._uniformMap),beginDraw(this,n,t,i,a),continueDraw(this,e,i,r)},Context.prototype.endFrame=function(){var e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);var t=scratchBackBufferArray;this.drawBuffers&&this.glDrawBuffers(t);var i=this._maxFrameTextureUnitIndex;this._maxFrameTextureUnitIndex=0;for(var r=0;r<i;++r)e.activeTexture(e.TEXTURE0+r),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null)},Context.prototype.readPixels=function(e){var t=this._gl;e=defaultValue(e,defaultValue.EMPTY_OBJECT);var i=Math.max(defaultValue(e.x,0),0),r=Math.max(defaultValue(e.y,0),0),n=defaultValue(e.width,t.drawingBufferWidth),a=defaultValue(e.height,t.drawingBufferHeight),o=e.framebuffer,s=PixelDatatype$1.UNSIGNED_BYTE;defined(o)&&o.numberOfColorAttachments>0&&(s=o.getColorTexture(0).pixelDatatype);var l=PixelFormat$1.createTypedArray(PixelFormat$1.RGBA,s,n,a);return bindFramebuffer(this,o),t.readPixels(i,r,n,a,PixelFormat$1.RGBA,PixelDatatype$1.toWebGLConstant(s,this),l),l};var viewportQuadAttributeLocations={position:0,textureCoordinates:1};function PickId(e,t,i){this._pickObjects=e,this.key=t,this.color=i}function loadCubeMap(e,t,i){var r={flipY:!0,skipColorSpaceConversion:i,preferImageBitmap:!0},n=[Resource.createIfNeeded(t.positiveX).fetchImage(r),Resource.createIfNeeded(t.negativeX).fetchImage(r),Resource.createIfNeeded(t.positiveY).fetchImage(r),Resource.createIfNeeded(t.negativeY).fetchImage(r),Resource.createIfNeeded(t.positiveZ).fetchImage(r),Resource.createIfNeeded(t.negativeZ).fetchImage(r)];return when.all(n,(function(t){return new CubeMap({context:e,source:{positiveX:t[0],negativeX:t[1],positiveY:t[2],negativeY:t[3],positiveZ:t[4],negativeZ:t[5]}})}))}Context.prototype.getViewportQuadVertexArray=function(){var e=this.cache.viewportQuad_vertexArray;if(!defined(e)){var t=new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:PrimitiveType$1.TRIANGLES});e=VertexArray.fromGeometry({context:this,geometry:t,attributeLocations:viewportQuadAttributeLocations,bufferUsage:BufferUsage$1.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e},Context.prototype.createViewportQuadCommand=function(e,t){return t=defaultValue(t,defaultValue.EMPTY_OBJECT),new DrawCommand({vertexArray:this.getViewportQuadVertexArray(),primitiveType:PrimitiveType$1.TRIANGLES,renderState:t.renderState,shaderProgram:ShaderProgram.fromCache({context:this,vertexShaderSource:ViewportQuadVS,fragmentShaderSource:e,attributeLocations:viewportQuadAttributeLocations}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer,pass:t.pass})},Context.prototype.getObjectByPickColor=function(e){return this._pickObjects[e.toRgba()]},Object.defineProperties(PickId.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}}),PickId.prototype.destroy=function(){delete this._pickObjects[this.key]},Context.prototype.createPickId=function(e){++this._nextPickColor[0];var t=this._nextPickColor[0];if(0===t)throw new RuntimeError("Out of unique Pick IDs.");return this._pickObjects[t]=e,new PickId(this._pickObjects,t,Color.fromRgba(t))},Context.prototype.isDestroyed=function(){return!1},Context.prototype.destroy=function(){var e=this.cache;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];defined(i.destroy)&&i.destroy()}return this._shaderCache=this._shaderCache.destroy(),this._textureCache=this._textureCache.destroy(),this._defaultTexture=this._defaultTexture&&this._defaultTexture.destroy(),this._defaultEmissiveTexture=this._defaultEmissiveTexture&&this._defaultEmissiveTexture.destroy(),this._defaultNormalTexture=this._defaultNormalTexture&&this._defaultNormalTexture.destroy(),this._defaultCubeMap=this._defaultCubeMap&&this._defaultCubeMap.destroy(),destroyObject(this)};var RenderbufferFormat={RGBA4:WebGLConstants$1.RGBA4,RGB5_A1:WebGLConstants$1.RGB5_A1,RGB565:WebGLConstants$1.RGB565,DEPTH_COMPONENT16:WebGLConstants$1.DEPTH_COMPONENT16,STENCIL_INDEX8:WebGLConstants$1.STENCIL_INDEX8,DEPTH_STENCIL:WebGLConstants$1.DEPTH_STENCIL,validate:function(e){return e===RenderbufferFormat.RGBA4||e===RenderbufferFormat.RGB5_A1||e===RenderbufferFormat.RGB565||e===RenderbufferFormat.DEPTH_COMPONENT16||e===RenderbufferFormat.STENCIL_INDEX8||e===RenderbufferFormat.DEPTH_STENCIL}},RenderbufferFormat$1=Object.freeze(RenderbufferFormat);function Renderbuffer(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context._gl;ContextLimits.maximumRenderbufferSize;var i=defaultValue(e.format,RenderbufferFormat$1.RGBA4),r=defined(e.width)?e.width:t.drawingBufferWidth,n=defined(e.height)?e.height:t.drawingBufferHeight;this._gl=t,this._format=i,this._width=r,this._height=n,this._renderbuffer=this._gl.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,this._renderbuffer),t.renderbufferStorage(t.RENDERBUFFER,i,r,n),t.bindRenderbuffer(t.RENDERBUFFER,null)}function DiscardMissingTileImagePolicy(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._pixelsToCheck=e.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;var t=Resource.createIfNeeded(e.missingImageUrl),i=this;t.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}).then((function(t){defined(t.blob)&&(i._missingImageByteLength=t.blob.size);var r=getImagePixels(t);if(e.disableCheckIfAllPixelsAreTransparent){for(var n=!0,a=t.width,o=e.pixelsToCheck,s=0,l=o.length;n&&s<l;++s){var c=o[s];r[4*c.x+c.y*a+3]>0&&(n=!1)}n&&(r=void 0)}i._missingImagePixels=r,i._isReady=!0})).otherwise((function(){i._missingImagePixels=void 0,i._isReady=!0}))}function ImageryLayerFeatureInfo(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}function ImageryProvider(){this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,DeveloperError.throwInstantiationError()}Object.defineProperties(Renderbuffer.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}}),Renderbuffer.prototype._getRenderbuffer=function(){return this._renderbuffer},Renderbuffer.prototype.isDestroyed=function(){return!1},Renderbuffer.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),destroyObject(this)},DiscardMissingTileImagePolicy.prototype.isReady=function(){return this._isReady},DiscardMissingTileImagePolicy.prototype.shouldDiscardImage=function(e){var t=this._pixelsToCheck,i=this._missingImagePixels;if(!defined(i))return!1;if(defined(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;for(var r=getImagePixels(e),n=e.width,a=0,o=t.length;a<o;++a)for(var s=t[a],l=4*s.x+s.y*n,c=0;c<4;++c){var u=l+c;if(r[u]!==i[u])return!1}return!0},ImageryLayerFeatureInfo.prototype.configureNameFromProperties=function(e){var t,i=10;for(var r in e)if(e.hasOwnProperty(r)&&e[r]){var n=r.toLowerCase();i>1&&"name"===n?(i=1,t=r):i>2&&"title"===n?(i=2,t=r):i>3&&/name/i.test(r)?(i=3,t=r):i>4&&/title/i.test(r)&&(i=4,t=r)}defined(t)&&(this.name=e[t])},ImageryLayerFeatureInfo.prototype.configureDescriptionFromProperties=function(e){this.description=function e(t){var i='<table class="cesium-infoBox-defaultTable">';for(var r in t)if(t.hasOwnProperty(r)){var n=t[r];defined(n)&&(i+="object"==typeof n?"<tr><td>"+r+"</td><td>"+e(n)+"</td></tr>":"<tr><td>"+r+"</td><td>"+n+"</td></tr>")}return i+="</table>"}(e)},Object.defineProperties(ImageryProvider.prototype,{ready:{get:DeveloperError.throwInstantiationError},readyPromise:{get:DeveloperError.throwInstantiationError},rectangle:{get:DeveloperError.throwInstantiationError},tileWidth:{get:DeveloperError.throwInstantiationError},tileHeight:{get:DeveloperError.throwInstantiationError},maximumLevel:{get:DeveloperError.throwInstantiationError},minimumLevel:{get:DeveloperError.throwInstantiationError},tilingScheme:{get:DeveloperError.throwInstantiationError},tileDiscardPolicy:{get:DeveloperError.throwInstantiationError},errorEvent:{get:DeveloperError.throwInstantiationError},credit:{get:DeveloperError.throwInstantiationError},proxy:{get:DeveloperError.throwInstantiationError},hasAlphaChannel:{get:DeveloperError.throwInstantiationError}}),ImageryProvider.prototype.getTileCredits=function(e,t,i){DeveloperError.throwInstantiationError()},ImageryProvider.prototype.requestImage=function(e,t,i,r){DeveloperError.throwInstantiationError()},ImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){DeveloperError.throwInstantiationError()};var ktx2Regex=/\.ktx2$/i;function ArcGisMapServerImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;var t=Resource.createIfNeeded(e.url);t.appendForwardSlash(),defined(e.token)&&t.setQueryParameters({token:e.token}),this._resource=t,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._maximumLevel=e.maximumLevel,this._tilingScheme=defaultValue(e.tilingScheme,new GeographicTilingScheme({ellipsoid:e.ellipsoid})),this._useTiles=defaultValue(e.usePreCachedTilesIfAvailable,!0),this._rectangle=defaultValue(e.rectangle,this._tilingScheme.rectangle),this._layers=e.layers;var i=e.credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i,this.enablePickFeatures=defaultValue(e.enablePickFeatures,!0),this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer();var r,n=this;function a(t){var i=t.tileInfo;if(defined(i)){if(n._tileWidth=i.rows,n._tileHeight=i.cols,102100===i.spatialReference.wkid||102113===i.spatialReference.wkid)n._tilingScheme=new WebMercatorTilingScheme({ellipsoid:e.ellipsoid});else if(4326===t.tileInfo.spatialReference.wkid)n._tilingScheme=new GeographicTilingScheme({ellipsoid:e.ellipsoid});else{if(4490!==t.fullExtent.spatialReference.wkid){var a="Tile spatial reference WKID "+t.tileInfo.spatialReference.wkid+" is not supported.";return void(r=TileProviderError.handleError(r,n,n._errorEvent,a,void 0,void 0,void 0,s))}n._tilingScheme=new GeographicTilingScheme({ellipsoid:e.ellipsoid,tileInfo:t.tileInfo})}if(n._maximumLevel=t.tileInfo.lods.length-1,defined(t.fullExtent)){if(defined(t.fullExtent.spatialReference)&&defined(t.fullExtent.spatialReference.wkid))if(102100===t.fullExtent.spatialReference.wkid||102113===t.fullExtent.spatialReference.wkid){var o=new WebMercatorProjection,l=t.fullExtent,c=o.unproject(new Cartesian3(Math.max(l.xmin,-n._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(l.ymin,-n._tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),u=o.unproject(new Cartesian3(Math.min(l.xmax,n._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(l.ymax,n._tilingScheme.ellipsoid.maximumRadius*Math.PI),0));n._rectangle=new Rectangle(c.longitude,c.latitude,u.longitude,u.latitude)}else if(4326===t.fullExtent.spatialReference.wkid)n._rectangle=Rectangle.fromDegrees(t.fullExtent.xmin,t.fullExtent.ymin,t.fullExtent.xmax,t.fullExtent.ymax);else{if(4490!==t.fullExtent.spatialReference.wkid){var d="fullExtent.spatialReference WKID "+t.fullExtent.spatialReference.wkid+" is not supported.";return void(r=TileProviderError.handleError(r,n,n._errorEvent,d,void 0,void 0,void 0,s))}n._rectangle=Rectangle.fromDegrees(t.fullExtent.xmin,t.fullExtent.ymin,t.fullExtent.xmax,t.fullExtent.ymax)}}else n._rectangle=n._tilingScheme.rectangle;defined(n._tileDiscardPolicy)||(n._tileDiscardPolicy=new DiscardMissingTileImagePolicy({missingImageUrl:buildImageResource$4(n,0,0,n._maximumLevel).url,pixelsToCheck:[new Cartesian2(0,0),new Cartesian2(200,20),new Cartesian2(20,200),new Cartesian2(80,110),new Cartesian2(160,130)],disableCheckIfAllPixelsAreTransparent:!0})),n._useTiles=!0}else n._useTiles=!1;defined(t.copyrightText)&&t.copyrightText.length>0&&(n._credit=new Credit(t.copyrightText)),n._ready=!0,n._readyPromise.resolve(!0),TileProviderError.handleSuccess(r)}function o(e){var t="An error occurred while accessing "+n._resource.url+".";r=TileProviderError.handleError(r,n,n._errorEvent,t,void 0,void 0,void 0,s),n._readyPromise.reject(new RuntimeError(t))}function s(){var e=n._resource.getDerivedResource({queryParameters:{f:"json"}}).fetchJsonp();when(e,a,o)}this._useTiles?s():(this._ready=!0,this._readyPromise.resolve(!0))}function buildImageResource$4(e,t,i,r,n){var a;if(e._useTiles)a=e._resource.getDerivedResource({url:"tile/"+r+"/"+i+"/"+t,request:n});else{var o=e._tilingScheme.tileXYToNativeRectangle(t,i,r),s={bbox:o.west+","+o.south+","+o.east+","+o.north,size:e._tileWidth+","+e._tileHeight,format:"png32",transparent:!0,f:"image"};e._tilingScheme.projection instanceof GeographicProjection?(s.bboxSR=4326,s.imageSR=4326):(s.bboxSR=3857,s.imageSR=3857),e.layers&&(s.layers="show:"+e.layers),a=e._resource.getDerivedResource({url:"export",request:n,queryParameters:s})}return a}function AutoExposure(){this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._ready=!1,this._name="czm_autoexposure",this._logDepthChanged=void 0,this._useLogDepth=void 0,this._framebuffers=void 0,this._previousLuminance=void 0,this._commands=void 0,this._clearCommand=void 0,this._minMaxLuminance=new Cartesian2,this.enabled=!0,this._enabled=!0,this.minimumLuminance=.1,this.maximumLuminance=10}function destroyFramebuffers$4(e){var t=e._framebuffers;if(defined(t)){for(var i=t.length,r=0;r<i;++r)t[r].destroy();e._framebuffers=void 0,e._previousLuminance.destroy(),e._previousLuminance=void 0}}function createFramebuffers$3(e,t){destroyFramebuffers$4(e);for(var i=e._width,r=e._height,n=PixelFormat$1.RGBA,a=t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT,o=Math.ceil(Math.log(Math.max(i,r))/Math.log(3)),s=new Array(o),l=0;l<o;++l)i=Math.max(Math.ceil(i/3),1),r=Math.max(Math.ceil(r/3),1),s[l]=new Framebuffer({context:t,colorTextures:[new Texture({context:t,width:i,height:r,pixelFormat:n,pixelDatatype:a,sampler:Sampler.NEAREST})]});var c=s[o-1].getColorTexture(0);e._previousLuminance=new Framebuffer({context:t,colorTextures:[new Texture({context:t,width:c.width,height:c.height,pixelFormat:n,pixelDatatype:a,sampler:Sampler.NEAREST})]}),e._framebuffers=s}function destroyCommands(e){var t=e._commands;if(defined(t)){for(var i=t.length,r=0;r<i;++r)t[r].shaderProgram.destroy();e._commands=void 0}}function createUniformMap$1(e,t){var i;if(0===t)i={colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions}};else{var r=e._framebuffers[t-1].getColorTexture(0);i={colorTexture:function(){return r},colorTextureDimensions:function(){return r.dimensions}}}return i.minMaxLuminance=function(){return e._minMaxLuminance},i.previousLuminance=function(){return e._previousLuminance.getColorTexture(0)},i}function getShaderSource(e,t){var i="uniform sampler2D colorTexture; \nvarying vec2 v_textureCoordinates; \nfloat sampleTexture(vec2 offset) { \n";return i+=0===e?" vec4 color = texture2D(colorTexture, v_textureCoordinates + offset); \n return czm_luminance(color.rgb); \n":" return texture2D(colorTexture, v_textureCoordinates + offset).r; \n",i+="}\n\n",i+="uniform vec2 colorTextureDimensions; \nuniform vec2 minMaxLuminance; \nuniform sampler2D previousLuminance; \nvoid main() { \n float color = 0.0; \n float xStep = 1.0 / colorTextureDimensions.x; \n float yStep = 1.0 / colorTextureDimensions.y; \n int count = 0; \n for (int i = 0; i < 3; ++i) { \n for (int j = 0; j < 3; ++j) { \n vec2 offset; \n offset.x = -xStep + float(i) * xStep; \n offset.y = -yStep + float(j) * yStep; \n if (offset.x < 0.0 || offset.x > 1.0 || offset.y < 0.0 || offset.y > 1.0) { \n continue; \n } \n color += sampleTexture(offset); \n ++count; \n } \n } \n if (count > 0) { \n color /= float(count); \n } \n",e===t-1&&(i+=" float previous = texture2D(previousLuminance, vec2(0.5)).r; \n color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); \n color = previous + (color - previous) / (60.0 * 1.5); \n color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); \n"),i+=" gl_FragColor = vec4(color); \n} \n"}function createCommands(e,t){destroyCommands(e);for(var i=e._framebuffers,r=i.length,n=new Array(r),a=0;a<r;++a)n[a]=t.createViewportQuadCommand(getShaderSource(a,r),{framebuffer:i[a],uniformMap:createUniformMap$1(e,a)});e._commands=n}ImageryProvider.loadImage=function(e,t){var i=Resource.createIfNeeded(t);return ktx2Regex.test(i.url)?loadKTX2(i):defined(e)&&defined(e.tileDiscardPolicy)?i.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}):i.fetchImage({preferImageBitmap:!0,flipY:!0})},Object.defineProperties(ArcGisMapServerImageryProvider.prototype,{url:{get:function(){return this._resource._url}},token:{get:function(){return this._resource.queryParameters.token}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}}),ArcGisMapServerImageryProvider.prototype.getTileCredits=function(e,t,i){},ArcGisMapServerImageryProvider.prototype.requestImage=function(e,t,i,r){return ImageryProvider.loadImage(this,buildImageResource$4(this,e,t,i,r))},ArcGisMapServerImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){if(this.enablePickFeatures){var a,o,s,l=this._tilingScheme.tileXYToNativeRectangle(e,t,i);if(this._tilingScheme.projection instanceof GeographicProjection)a=CesiumMath.toDegrees(r),o=CesiumMath.toDegrees(n),s="4326";else{var c=this._tilingScheme.projection.project(new Cartographic(r,n,0));a=c.x,o=c.y,s="3857"}var u="visible";defined(this._layers)&&(u+=":"+this._layers);var d={f:"json",tolerance:2,geometryType:"esriGeometryPoint",geometry:a+","+o,mapExtent:l.west+","+l.south+","+l.east+","+l.north,imageDisplay:this._tileWidth+","+this._tileHeight+",96",sr:s,layers:u};return this._resource.getDerivedResource({url:"identify",queryParameters:d}).fetchJson().then((function(e){var t=[],i=e.results;if(!defined(i))return t;for(var r=0;r<i.length;++r){var n=i[r],a=new ImageryLayerFeatureInfo;if(a.data=n,a.name=n.value,a.properties=n.attributes,a.configureDescriptionFromProperties(n.attributes),"esriGeometryPoint"===n.geometryType&&n.geometry){var o=n.geometry.spatialReference&&n.geometry.spatialReference.wkid?n.geometry.spatialReference.wkid:4326;if(4326===o||4283===o)a.position=Cartographic.fromDegrees(n.geometry.x,n.geometry.y,n.geometry.z);else if(102100===o||900913===o||3857===o){var s=new WebMercatorProjection;a.position=s.unproject(new Cartesian3(n.geometry.x,n.geometry.y,n.geometry.z))}}t.push(a)}return t}))}},Object.defineProperties(AutoExposure.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},outputTexture:{get:function(){var e=this._framebuffers;if(defined(e))return e[e.length-1].getColorTexture(0)}}}),AutoExposure.prototype.clear=function(e){var t=this._framebuffers;if(defined(t)){var i=this._clearCommand;defined(i)||(i=this._clearCommand=new ClearCommand({color:new Color(0,0,0,0),framebuffer:void 0}));for(var r=t.length,n=0;n<r;++n)i.framebuffer=t[n],i.execute(e)}},AutoExposure.prototype.update=function(e){var t=e.drawingBufferWidth,i=e.drawingBufferHeight;t===this._width&&i===this._height||(this._width=t,this._height=i,createFramebuffers$3(this,e),createCommands(this,e),this._ready||(this._ready=!0)),this._minMaxLuminance.x=this.minimumLuminance,this._minMaxLuminance.y=this.maximumLuminance;var r=this._framebuffers,n=r[r.length-1];r[r.length-1]=this._previousLuminance,this._commands[this._commands.length-1].framebuffer=this._previousLuminance,this._previousLuminance=n},AutoExposure.prototype.execute=function(e,t){this._colorTexture=t;var i=this._commands;if(defined(i))for(var r=i.length,n=0;n<r;++n)i[n].execute(e)},AutoExposure.prototype.isDestroyed=function(){return!1},AutoExposure.prototype.destroy=function(){return destroyFramebuffers$4(this),destroyCommands(this),destroyObject(this)};var BingMapsStyle={AERIAL:"Aerial",AERIAL_WITH_LABELS:"AerialWithLabels",AERIAL_WITH_LABELS_ON_DEMAND:"AerialWithLabelsOnDemand",ROAD:"Road",ROAD_ON_DEMAND:"RoadOnDemand",CANVAS_DARK:"CanvasDark",CANVAS_LIGHT:"CanvasLight",CANVAS_GRAY:"CanvasGray",ORDNANCE_SURVEY:"OrdnanceSurvey",COLLINS_BART:"CollinsBart"},BingMapsStyle$1=Object.freeze(BingMapsStyle),emptyImage;function DiscardEmptyTileImagePolicy(e){}function BingMapsImageryProvider(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).key;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=1,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._key=t,this._resource=Resource.createIfNeeded(e.url),this._resource.appendForwardSlash(),this._tileProtocol=e.tileProtocol,this._mapStyle=defaultValue(e.mapStyle,BingMapsStyle$1.AERIAL),this._culture=defaultValue(e.culture,""),this._tileDiscardPolicy=e.tileDiscardPolicy,defined(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new DiscardEmptyTileImagePolicy),this._proxy=e.proxy,this._credit=new Credit('<a href="http://www.bing.com"><img src="'+BingMapsImageryProvider.logoUrl+'" title="Bing Imagery"/></a>'),this._tilingScheme=new WebMercatorTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid}),this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._imageUrlTemplate=void 0,this._imageUrlSubdomains=void 0,this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer();var i=this._tileProtocol;defined(i)?i.length>0&&":"===i[i.length-1]&&(i=i.substr(0,i.length-1)):i="http:"===document.location.protocol?"http":"https";var r,n=this._resource.getDerivedResource({url:"REST/v1/Imagery/Metadata/"+this._mapStyle,queryParameters:{incl:"ImageryProviders",key:this._key,uriScheme:i}}),a=this;function o(e){if(1===e.resourceSets.length){var t=e.resourceSets[0].resources[0];a._tileWidth=t.imageWidth,a._tileHeight=t.imageHeight,a._maximumLevel=t.zoomMax-1,a._imageUrlSubdomains=t.imageUrlSubdomains,a._imageUrlTemplate=t.imageUrl;var i=a._attributionList=t.imageryProviders;i||(i=a._attributionList=[]);for(var n=0,o=i.length;n<o;++n){var l=i[n];if(l.credit instanceof Credit)break;l.credit=new Credit(l.attribution);for(var c=l.coverageAreas,u=0,d=l.coverageAreas.length;u<d;++u){var h=c[u],p=h.bbox;h.bbox=new Rectangle(CesiumMath.toRadians(p[1]),CesiumMath.toRadians(p[0]),CesiumMath.toRadians(p[3]),CesiumMath.toRadians(p[2]))}}a._ready=!0,a._readyPromise.resolve(!0),TileProviderError.handleSuccess(r)}else s()}function s(e){var t="An error occurred while accessing "+n.url+".";r=TileProviderError.handleError(r,a,a._errorEvent,t,void 0,void 0,void 0,c),a._readyPromise.reject(new RuntimeError(t))}var l=n.url;function c(){var e=n.fetchJsonp("jsonp");BingMapsImageryProvider._metadataCache[l]=e,e.then(o).otherwise(s)}var u=BingMapsImageryProvider._metadataCache[l];defined(u)?u.then(o).otherwise(s):c()}DiscardEmptyTileImagePolicy.prototype.isReady=function(){return!0},DiscardEmptyTileImagePolicy.prototype.shouldDiscardImage=function(e){return DiscardEmptyTileImagePolicy.EMPTY_IMAGE===e},Object.defineProperties(DiscardEmptyTileImagePolicy,{EMPTY_IMAGE:{get:function(){return defined(emptyImage)||((emptyImage=new Image).src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),emptyImage}}}),Object.defineProperties(BingMapsImageryProvider.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},key:{get:function(){return this._key}},mapStyle:{get:function(){return this._mapStyle}},culture:{get:function(){return this._culture}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}});var rectangleScratch$2=new Rectangle;function buildImageResource$3(e,t,i,r,n){var a=e._imageUrlTemplate,o=e._imageUrlSubdomains,s=(t+i+r)%o.length;return e._resource.getDerivedResource({url:a,request:n,templateValues:{quadkey:BingMapsImageryProvider.tileXYToQuadKey(t,i,r),subdomain:o[s],culture:e._culture},queryParameters:{n:"z"}})}BingMapsImageryProvider.prototype.getTileCredits=function(e,t,i){var r=this._tilingScheme.tileXYToRectangle(e,t,i,rectangleScratch$2);return getRectangleAttribution(this._attributionList,i,r)},BingMapsImageryProvider.prototype.requestImage=function(e,t,i,r){var n=ImageryProvider.loadImage(this,buildImageResource$3(this,e,t,i,r));if(defined(n))return n.otherwise((function(e){return defined(e.blob)&&0===e.blob.size?DiscardEmptyTileImagePolicy.EMPTY_IMAGE:when.reject(e)}))},BingMapsImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){},BingMapsImageryProvider.tileXYToQuadKey=function(e,t,i){for(var r="",n=i;n>=0;--n){var a=1<<n,o=0;0!=(e&a)&&(o|=1),0!=(t&a)&&(o|=2),r+=o}return r},BingMapsImageryProvider.quadKeyToTileXY=function(e){for(var t=0,i=0,r=e.length-1,n=r;n>=0;--n){var a=1<<n,o=+e[r-n];0!=(1&o)&&(t|=a),0!=(2&o)&&(i|=a)}return{x:t,y:i,level:r}},BingMapsImageryProvider._logoUrl=void 0,Object.defineProperties(BingMapsImageryProvider,{logoUrl:{get:function(){return defined(BingMapsImageryProvider._logoUrl)||(BingMapsImageryProvider._logoUrl=buildModuleUrl("Assets/Images/bing_maps_credit.png")),BingMapsImageryProvider._logoUrl},set:function(e){BingMapsImageryProvider._logoUrl=e}}});var intersectionScratch=new Rectangle;function getRectangleAttribution(e,t,i){++t;for(var r=[],n=0,a=e.length;n<a;++n){for(var o=e[n],s=o.coverageAreas,l=!1,c=0,u=o.coverageAreas.length;!l&&c<u;++c){var d=s[c];if(t>=d.zoomMin&&t<=d.zoomMax)defined(Rectangle.intersection(i,d.bbox,intersectionScratch))&&(l=!0)}l&&r.push(o.credit)}return r}BingMapsImageryProvider._metadataCache={};var defaultDimensions=new Cartesian3(1,1,1);function BoxEmitter(e){e=defaultValue(e,defaultDimensions),this._dimensions=Cartesian3.clone(e)}Object.defineProperties(BoxEmitter.prototype,{dimensions:{get:function(){return this._dimensions},set:function(e){Cartesian3.clone(e,this._dimensions)}}});var scratchHalfDim=new Cartesian3;BoxEmitter.prototype.emit=function(e){var t=this._dimensions,i=Cartesian3.multiplyByScalar(t,.5,scratchHalfDim),r=CesiumMath.randomBetween(-i.x,i.x),n=CesiumMath.randomBetween(-i.y,i.y),a=CesiumMath.randomBetween(-i.z,i.z);e.position=Cartesian3.fromElements(r,n,a,e.position),e.velocity=Cartesian3.normalize(e.position,e.velocity)};var BrdfLutGeneratorFS="varying vec2 v_textureCoordinates;\nconst float M_PI = 3.141592653589793;\nfloat vdcRadicalInverse(int i)\n{\nfloat r;\nfloat base = 2.0;\nfloat value = 0.0;\nfloat invBase = 1.0 / base;\nfloat invBi = invBase;\nfor (int x = 0; x < 100; x++)\n{\nif (i <= 0)\n{\nbreak;\n}\nr = mod(float(i), base);\nvalue += r * invBi;\ninvBi *= invBase;\ni = int(float(i) * invBase);\n}\nreturn value;\n}\nvec2 hammersley2D(int i, int N)\n{\nreturn vec2(float(i) / float(N), vdcRadicalInverse(i));\n}\nvec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)\n{\nfloat a = roughness * roughness;\nfloat phi = 2.0 * M_PI * xi.x;\nfloat cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y));\nfloat sinTheta = sqrt(1.0 - cosTheta * cosTheta);\nvec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);\nvec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\nvec3 tangentX = normalize(cross(upVector, N));\nvec3 tangentY = cross(N, tangentX);\nreturn tangentX * H.x + tangentY * H.y + N * H.z;\n}\nfloat G1_Smith(float NdotV, float k)\n{\nreturn NdotV / (NdotV * (1.0 - k) + k);\n}\nfloat G_Smith(float roughness, float NdotV, float NdotL)\n{\nfloat k = roughness * roughness / 2.0;\nreturn G1_Smith(NdotV, k) * G1_Smith(NdotL, k);\n}\nvec2 integrateBrdf(float roughness, float NdotV)\n{\nvec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);\nfloat A = 0.0;\nfloat B = 0.0;\nconst int NumSamples = 1024;\nfor (int i = 0; i < NumSamples; i++)\n{\nvec2 xi = hammersley2D(i, NumSamples);\nvec3 H = importanceSampleGGX(xi, roughness, vec3(0.0, 0.0, 1.0));\nvec3 L = 2.0 * dot(V, H) * H - V;\nfloat NdotL = clamp(L.z, 0.0, 1.0);\nfloat NdotH = clamp(H.z, 0.0, 1.0);\nfloat VdotH = clamp(dot(V, H), 0.0, 1.0);\nif (NdotL > 0.0)\n{\nfloat G = G_Smith(roughness, NdotV, NdotL);\nfloat G_Vis = G * VdotH / (NdotH * NdotV);\nfloat Fc = pow(1.0 - VdotH, 5.0);\nA += (1.0 - Fc) * G_Vis;\nB += Fc * G_Vis;\n}\n}\nreturn vec2(A, B) / float(NumSamples);\n}\nvoid main()\n{\ngl_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);\n}\n";function BrdfLutGenerator(){this._framebuffer=void 0,this._colorTexture=void 0,this._drawCommand=void 0}function createCommand$1(e,t){var i=e._framebuffer,r=t.createViewportQuadCommand(BrdfLutGeneratorFS,{framebuffer:i,renderState:RenderState.fromCache({viewport:new BoundingRectangle(0,0,256,256)})});e._drawCommand=r}function createFramebuffer$1(e,t){var i=new Texture({context:t,width:256,height:256,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST});e._colorTexture=i;var r=new Framebuffer({context:t,colorTextures:[i],destroyAttachments:!1});e._framebuffer=r}Object.defineProperties(BrdfLutGenerator.prototype,{colorTexture:{get:function(){return this._colorTexture}}}),BrdfLutGenerator.prototype.update=function(e){if(!defined(this._colorTexture)){var t=e.context;createFramebuffer$1(this,t),createCommand$1(this,t),this._drawCommand.execute(t),this._framebuffer=this._framebuffer&&this._framebuffer.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}},BrdfLutGenerator.prototype.isDestroyed=function(){return!1},BrdfLutGenerator.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),destroyObject(this)};var CameraFlightPath={};function getAltitude(e,t,i){var r,n,a;if(e instanceof PerspectiveFrustum){var o=Math.tan(.5*e.fovy);return r=e.near,n=e.near*o,a=e.aspectRatio*n,Math.max(t*r/a,i*r/n)}return e instanceof PerspectiveOffCenterFrustum?(r=e.near,n=e.top,a=e.right,Math.max(t*r/a,i*r/n)):Math.max(t,i)}var scratchCart=new Cartesian3,scratchCart2=new Cartesian3;function createPitchFunction(e,t,i,r){if(defined(r)&&i(.5)>r){var n=i(0),a=i(1),o=i(.5),s=o-n,l=o-a;return function(r){var o=i(r);if(r<=.5){var c=(o-n)/s;return CesiumMath.lerp(e,-CesiumMath.PI_OVER_TWO,c)}var u=(o-a)/l;return CesiumMath.lerp(-CesiumMath.PI_OVER_TWO,t,1-u)}}return function(i){return CesiumMath.lerp(e,t,i)}}function createHeightFunction(e,t,i,r,n){var a=n,o=Math.max(i,r);if(!defined(a)){var s=e.position,l=t,c=e.up,u=e.right,d=e.frustum,h=Cartesian3.subtract(s,l,scratchCart),p=Cartesian3.magnitude(Cartesian3.multiplyByScalar(c,Cartesian3.dot(h,c),scratchCart2)),f=Cartesian3.magnitude(Cartesian3.multiplyByScalar(u,Cartesian3.dot(h,u),scratchCart2));a=Math.min(.2*getAltitude(d,p,f),1e9)}if(o<a){var m=1e6,g=-Math.pow((a-i)*m,1/8),_=Math.pow((a-r)*m,1/8);return function(e){var t=e*(_-g)+g;return-Math.pow(t,8)/m+a}}return function(e){return CesiumMath.lerp(i,r,e)}}function adjustAngleForLERP(e,t){return CesiumMath.equalsEpsilon(e,CesiumMath.TWO_PI,CesiumMath.EPSILON11)&&(e=0),t>e+Math.PI?e+=CesiumMath.TWO_PI:t<e-Math.PI&&(e-=CesiumMath.TWO_PI),e}var scratchStart=new Cartesian3;function createUpdateCV(e,t,i,r,n,a,o,s){var l=e.camera,c=Cartesian3.clone(l.position,scratchStart),u=l.pitch,d=adjustAngleForLERP(l.heading,r),h=adjustAngleForLERP(l.roll,a),p=createHeightFunction(l,i,c.z,i.z,o),f=createPitchFunction(u,n,p,s);return function(e){var n=e.time/t;l.setView({orientation:{heading:CesiumMath.lerp(d,r,n),pitch:f(n),roll:CesiumMath.lerp(h,a,n)}}),Cartesian2.lerp(c,i,n,l.position),l.position.z=p(n)}}function useLongestFlight(e,t){e.longitude<t.longitude?e.longitude+=CesiumMath.TWO_PI:t.longitude+=CesiumMath.TWO_PI}function useShortestFlight(e,t){var i=e.longitude-t.longitude;i<-CesiumMath.PI?e.longitude+=CesiumMath.TWO_PI:i>CesiumMath.PI&&(t.longitude+=CesiumMath.TWO_PI)}var scratchStartCart=new Cartographic,scratchEndCart=new Cartographic;function createUpdate3D(e,t,i,r,n,a,o,s,l,c){var u=e.camera,d=e.mapProjection.ellipsoid,h=Cartographic.clone(u.positionCartographic,scratchStartCart),p=u.pitch,f=adjustAngleForLERP(u.heading,r),m=adjustAngleForLERP(u.roll,a),g=d.cartesianToCartographic(i,scratchEndCart);h.longitude=CesiumMath.zeroToTwoPi(h.longitude),g.longitude=CesiumMath.zeroToTwoPi(g.longitude);var _=!1;if(defined(s)){var y=CesiumMath.zeroToTwoPi(s),v=Math.min(h.longitude,g.longitude),C=Math.max(h.longitude,g.longitude),T=y>=v&&y<=C;if(defined(l)){var S=Math.abs(h.longitude-g.longitude),A=CesiumMath.TWO_PI-S;(T?S:A)<(T?A:S)*l&&!T&&(_=!0)}else T||(_=!0)}_?useLongestFlight(h,g):useShortestFlight(h,g);var x,E,b,P,D=createHeightFunction(u,i,h.height,g.height,o),w=createPitchFunction(p,n,D,c);return x=h.longitude,E=g.longitude,b=h.latitude,P=g.latitude,function(e){var i=e.time/t,n=Cartesian3.fromRadians(CesiumMath.lerp(x,E,i),CesiumMath.lerp(b,P,i),D(i),d);u.setView({destination:n,orientation:{heading:CesiumMath.lerp(f,r,i),pitch:w(i),roll:CesiumMath.lerp(m,a,i)}})}}function createUpdate2D(e,t,i,r,n,a,o){var s=e.camera,l=Cartesian3.clone(s.position,scratchStart),c=adjustAngleForLERP(s.heading,r),u=s.frustum.right-s.frustum.left,d=createHeightFunction(s,i,u,i.z,o);return function(e){var n=e.time/t;s.setView({orientation:{heading:CesiumMath.lerp(c,r,n)}}),Cartesian2.lerp(l,i,n,s.position);var a=d(n),o=s.frustum,u=o.top/o.right,h=.5*(a-(o.right-o.left));o.right+=h,o.left-=h,o.top=u*o.right,o.bottom=-o.top}}var scratchCartographic$6=new Cartographic,scratchDestination=new Cartesian3;function emptyFlight(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function wrapCallback(e,t){return function(){"function"==typeof t&&t(),e.enableInputs=!0}}CameraFlightPath.createTween=function(e,t){var i=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).destination,r=e.mode;if(r===SceneMode$1.MORPHING)return emptyFlight();var n=defaultValue(t.convert,!0),a=e.mapProjection,o=a.ellipsoid,s=t.maximumHeight,l=t.flyOverLongitude,c=t.flyOverLongitudeWeight,u=t.pitchAdjustHeight,d=t.easingFunction;n&&r!==SceneMode$1.SCENE3D&&(o.cartesianToCartographic(i,scratchCartographic$6),i=a.project(scratchCartographic$6,scratchDestination));var h=e.camera,p=t.endTransform;defined(p)&&h._setTransform(p);var f=t.duration;defined(f)||(f=Math.ceil(Cartesian3.distance(h.position,i)/1e6)+2,f=Math.min(f,3));var m=defaultValue(t.heading,0),g=defaultValue(t.pitch,-CesiumMath.PI_OVER_TWO),_=defaultValue(t.roll,0),y=e.screenSpaceCameraController;y.enableInputs=!1;var v=wrapCallback(y,t.complete),C=wrapCallback(y,t.cancel),T=h.frustum,S=e.mode===SceneMode$1.SCENE2D;if(S=(S=(S=(S=S&&Cartesian2.equalsEpsilon(h.position,i,CesiumMath.EPSILON6))&&CesiumMath.equalsEpsilon(Math.max(T.right-T.left,T.top-T.bottom),i.z,CesiumMath.EPSILON6))||e.mode!==SceneMode$1.SCENE2D&&Cartesian3.equalsEpsilon(i,h.position,CesiumMath.EPSILON10))&&CesiumMath.equalsEpsilon(CesiumMath.negativePiToPi(m),CesiumMath.negativePiToPi(h.heading),CesiumMath.EPSILON10)&&CesiumMath.equalsEpsilon(CesiumMath.negativePiToPi(g),CesiumMath.negativePiToPi(h.pitch),CesiumMath.EPSILON10)&&CesiumMath.equalsEpsilon(CesiumMath.negativePiToPi(_),CesiumMath.negativePiToPi(h.roll),CesiumMath.EPSILON10))return emptyFlight(v,C);var A=new Array(4);if(A[SceneMode$1.SCENE2D]=createUpdate2D,A[SceneMode$1.SCENE3D]=createUpdate3D,A[SceneMode$1.COLUMBUS_VIEW]=createUpdateCV,f<=0){return emptyFlight((function(){A[r](e,1,i,m,g,_,s,l,c,u)({time:1}),"function"==typeof v&&v()}),C)}var x=A[r](e,f,i,m,g,_,s,l,c,u);if(!defined(d)){var E=h.positionCartographic.height;d=E>(r===SceneMode$1.SCENE3D?o.cartesianToCartographic(i).height:i.z)&&E>11500?EasingFunction$1.CUBIC_OUT:EasingFunction$1.QUINTIC_IN_OUT}return{duration:f,easingFunction:d,startObject:{time:0},stopObject:{time:f},update:x,complete:v,cancel:C}};var MapMode2D={ROTATE:0,INFINITE_SCROLL:1},MapMode2D$1=Object.freeze(MapMode2D);function Camera(e){this._scene=e,this._transform=Matrix4.clone(Matrix4.IDENTITY),this._invTransform=Matrix4.clone(Matrix4.IDENTITY),this._actualTransform=Matrix4.clone(Matrix4.IDENTITY),this._actualInvTransform=Matrix4.clone(Matrix4.IDENTITY),this._transformChanged=!1,this.position=new Cartesian3,this._position=new Cartesian3,this._positionWC=new Cartesian3,this._positionCartographic=new Cartographic,this._oldPositionWC=void 0,this.positionWCDeltaMagnitude=0,this.positionWCDeltaMagnitudeLastFrame=0,this.timeSinceMoved=0,this._lastMovedTimestamp=0,this.direction=new Cartesian3,this._direction=new Cartesian3,this._directionWC=new Cartesian3,this.up=new Cartesian3,this._up=new Cartesian3,this._upWC=new Cartesian3,this.right=new Cartesian3,this._right=new Cartesian3,this._rightWC=new Cartesian3,this.frustum=new PerspectiveFrustum,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=CesiumMath.toRadians(60),this.defaultMoveAmount=1e5,this.defaultLookAmount=Math.PI/60,this.defaultRotateAmount=Math.PI/3600,this.defaultZoomAmount=1e5,this.constrainedAxis=void 0,this.maximumZoomFactor=1.5,this._moveStart=new Event,this._moveEnd=new Event,this._changed=new Event,this._changedPosition=void 0,this._changedDirection=void 0,this._changedFrustum=void 0,this.percentageChanged=.5,this._viewMatrix=new Matrix4,this._invViewMatrix=new Matrix4,updateViewMatrix(this),this._mode=SceneMode$1.SCENE3D,this._modeChanged=!0;var t=e.mapProjection;this._projection=t,this._maxCoord=t.project(new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO)),this._max2Dfrustum=void 0,rectangleCameraPosition3D(this,Camera.DEFAULT_VIEW_RECTANGLE,this.position,!0);var i=Cartesian3.magnitude(this.position);i+=i*Camera.DEFAULT_VIEW_FACTOR,Cartesian3.normalize(this.position,this.position),Cartesian3.multiplyByScalar(this.position,i,this.position)}function updateViewMatrix(e){Matrix4.computeView(e._position,e._direction,e._up,e._right,e._viewMatrix),Matrix4.multiply(e._viewMatrix,e._actualInvTransform,e._viewMatrix),Matrix4.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function updateCameraDeltas(e){if(defined(e._oldPositionWC)){e.positionWCDeltaMagnitudeLastFrame=e.positionWCDeltaMagnitude;var t=Cartesian3.subtract(e.positionWC,e._oldPositionWC,e._oldPositionWC);e.positionWCDeltaMagnitude=Cartesian3.magnitude(t),e._oldPositionWC=Cartesian3.clone(e.positionWC,e._oldPositionWC),e.positionWCDeltaMagnitude>0?(e.timeSinceMoved=0,e._lastMovedTimestamp=getTimestamp$1()):e.timeSinceMoved=Math.max(getTimestamp$1()-e._lastMovedTimestamp,0)/1e3}else e._oldPositionWC=Cartesian3.clone(e.positionWC,e._oldPositionWC)}function convertTransformForColumbusView(e){Transforms.basisTo2D(e._projection,e._transform,e._actualTransform)}Camera.TRANSFORM_2D=new Matrix4(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),Camera.TRANSFORM_2D_INVERSE=Matrix4.inverseTransformation(Camera.TRANSFORM_2D,new Matrix4),Camera.DEFAULT_VIEW_RECTANGLE=Rectangle.fromDegrees(-95,-20,-70,90),Camera.DEFAULT_VIEW_FACTOR=.5,Camera.DEFAULT_OFFSET=new HeadingPitchRange(0,-CesiumMath.PI_OVER_FOUR,0),Camera.prototype.canPreloadFlight=function(){return defined(this._currentFlight)&&this._mode!==SceneMode$1.SCENE2D},Camera.prototype._updateCameraChanged=function(){var e=this;if(updateCameraDeltas(e),0!==e._changed.numberOfListeners){var t=e.percentageChanged;if(e._mode!==SceneMode$1.SCENE2D){if(!defined(e._changedDirection))return e._changedPosition=Cartesian3.clone(e.positionWC,e._changedPosition),void(e._changedDirection=Cartesian3.clone(e.directionWC,e._changedDirection));var i,r=CesiumMath.acosClamped(Cartesian3.dot(e.directionWC,e._changedDirection));i=defined(e.frustum.fovy)?r/(.5*e.frustum.fovy):r;var n=Cartesian3.distance(e.positionWC,e._changedPosition)/e.positionCartographic.height;(i>t||n>t)&&(e._changed.raiseEvent(Math.max(i,n)),e._changedPosition=Cartesian3.clone(e.positionWC,e._changedPosition),e._changedDirection=Cartesian3.clone(e.directionWC,e._changedDirection))}else{if(!defined(e._changedFrustum))return e._changedPosition=Cartesian3.clone(e.position,e._changedPosition),void(e._changedFrustum=e.frustum.clone());var a,o=e.position,s=e._changedPosition,l=e.frustum,c=e._changedFrustum,u=o.x+l.left,d=o.x+l.right,h=s.x+c.left,p=s.x+c.right,f=o.y+l.bottom,m=o.y+l.top,g=s.y+c.bottom,_=s.y+c.top,y=Math.max(u,h),v=Math.min(d,p),C=Math.max(f,g),T=Math.min(m,_);if(y>=v||C>=m)a=1;else{var S=c;u<h&&d>p&&f<g&&m>_&&(S=l),a=1-(v-y)*(T-C)/((S.right-S.left)*(S.top-S.bottom))}a>t&&(e._changed.raiseEvent(a),e._changedPosition=Cartesian3.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone(e._changedFrustum))}}};var scratchCartographic$5=new Cartographic,scratchCartesian3Projection=new Cartesian3,scratchCartesian3$1=new Cartesian3,scratchCartesian4Origin=new Cartesian4,scratchCartesian4NewOrigin=new Cartesian4,scratchCartesian4NewXAxis=new Cartesian4,scratchCartesian4NewYAxis=new Cartesian4,scratchCartesian4NewZAxis=new Cartesian4;function convertTransformFor2D(e){var t=e._projection,i=t.ellipsoid,r=Matrix4.getColumn(e._transform,3,scratchCartesian4Origin),n=i.cartesianToCartographic(r,scratchCartographic$5),a=t.project(n,scratchCartesian3Projection),o=scratchCartesian4NewOrigin;o.x=a.z,o.y=a.x,o.z=a.y,o.w=1;var s=Cartesian4.clone(Cartesian4.UNIT_X,scratchCartesian4NewZAxis),l=Cartesian4.add(Matrix4.getColumn(e._transform,0,scratchCartesian3$1),r,scratchCartesian3$1);i.cartesianToCartographic(l,n),t.project(n,a);var c=scratchCartesian4NewXAxis;c.x=a.z,c.y=a.x,c.z=a.y,c.w=0,Cartesian3.subtract(c,o,c),c.x=0;var u=scratchCartesian4NewYAxis;if(Cartesian3.magnitudeSquared(c)>CesiumMath.EPSILON10)Cartesian3.cross(s,c,u);else{var d=Cartesian4.add(Matrix4.getColumn(e._transform,1,scratchCartesian3$1),r,scratchCartesian3$1);i.cartesianToCartographic(d,n),t.project(n,a),u.x=a.z,u.y=a.x,u.z=a.y,u.w=0,Cartesian3.subtract(u,o,u),u.x=0,Cartesian3.magnitudeSquared(u)<CesiumMath.EPSILON10&&(Cartesian4.clone(Cartesian4.UNIT_Y,c),Cartesian4.clone(Cartesian4.UNIT_Z,u))}Cartesian3.cross(u,s,c),Cartesian3.normalize(c,c),Cartesian3.cross(s,c,u),Cartesian3.normalize(u,u),Matrix4.setColumn(e._actualTransform,0,c,e._actualTransform),Matrix4.setColumn(e._actualTransform,1,u,e._actualTransform),Matrix4.setColumn(e._actualTransform,2,s,e._actualTransform),Matrix4.setColumn(e._actualTransform,3,o,e._actualTransform)}var scratchCartesian$1=new Cartesian3;function updateMembers(e){var t=e._mode,i=!1,r=0;t===SceneMode$1.SCENE2D&&(i=(r=e.frustum.right-e.frustum.left)!==e._positionCartographic.height);var n=e._position,a=!Cartesian3.equals(n,e.position)||i;a&&(n=Cartesian3.clone(e.position,e._position));var o=e._direction,s=!Cartesian3.equals(o,e.direction);s&&(Cartesian3.normalize(e.direction,e.direction),o=Cartesian3.clone(e.direction,e._direction));var l=e._up,c=!Cartesian3.equals(l,e.up);c&&(Cartesian3.normalize(e.up,e.up),l=Cartesian3.clone(e.up,e._up));var u=e._right,d=!Cartesian3.equals(u,e.right);d&&(Cartesian3.normalize(e.right,e.right),u=Cartesian3.clone(e.right,e._right));var h=e._transformChanged||e._modeChanged;e._transformChanged=!1,h&&(Matrix4.inverseTransformation(e._transform,e._invTransform),e._mode===SceneMode$1.COLUMBUS_VIEW||e._mode===SceneMode$1.SCENE2D?Matrix4.equals(Matrix4.IDENTITY,e._transform)?Matrix4.clone(Camera.TRANSFORM_2D,e._actualTransform):e._mode===SceneMode$1.COLUMBUS_VIEW?convertTransformForColumbusView(e):convertTransformFor2D(e):Matrix4.clone(e._transform,e._actualTransform),Matrix4.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);var p=e._actualTransform;if(a||h)if(e._positionWC=Matrix4.multiplyByPoint(p,n,e._positionWC),t===SceneMode$1.SCENE3D||t===SceneMode$1.MORPHING)e._positionCartographic=e._projection.ellipsoid.cartesianToCartographic(e._positionWC,e._positionCartographic);else{var f=scratchCartesian$1;f.x=e._positionWC.y,f.y=e._positionWC.z,f.z=e._positionWC.x,t===SceneMode$1.SCENE2D&&(f.z=r),e._projection.unproject(f,e._positionCartographic)}if(s||c||d){var m=Cartesian3.dot(o,Cartesian3.cross(l,u,scratchCartesian$1));if(Math.abs(1-m)>CesiumMath.EPSILON2){var g=1/Cartesian3.magnitudeSquared(l),_=Cartesian3.dot(l,o)*g,y=Cartesian3.multiplyByScalar(o,_,scratchCartesian$1);l=Cartesian3.normalize(Cartesian3.subtract(l,y,e._up),e._up),Cartesian3.clone(l,e.up),u=Cartesian3.cross(o,l,e._right),Cartesian3.clone(u,e.right)}}(s||h)&&(e._directionWC=Matrix4.multiplyByPointAsVector(p,o,e._directionWC),Cartesian3.normalize(e._directionWC,e._directionWC)),(c||h)&&(e._upWC=Matrix4.multiplyByPointAsVector(p,l,e._upWC),Cartesian3.normalize(e._upWC,e._upWC)),(d||h)&&(e._rightWC=Matrix4.multiplyByPointAsVector(p,u,e._rightWC),Cartesian3.normalize(e._rightWC,e._rightWC)),(a||s||c||d||h)&&updateViewMatrix(e)}function getHeading(e,t){var i;return i=CesiumMath.equalsEpsilon(Math.abs(e.z),1,CesiumMath.EPSILON3)?Math.atan2(t.y,t.x)-CesiumMath.PI_OVER_TWO:Math.atan2(e.y,e.x)-CesiumMath.PI_OVER_TWO,CesiumMath.TWO_PI-CesiumMath.zeroToTwoPi(i)}function getPitch(e){return CesiumMath.PI_OVER_TWO-CesiumMath.acosClamped(e.z)}function getRoll(e,t,i){var r=0;return CesiumMath.equalsEpsilon(Math.abs(e.z),1,CesiumMath.EPSILON3)||(r=Math.atan2(-i.z,t.z),r=CesiumMath.zeroToTwoPi(r+CesiumMath.TWO_PI)),r}var scratchHPRMatrix1=new Matrix4,scratchHPRMatrix2=new Matrix4;Object.defineProperties(Camera.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return updateMembers(this),this._invTransform}},viewMatrix:{get:function(){return updateMembers(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return updateMembers(this),this._invViewMatrix}},positionCartographic:{get:function(){return updateMembers(this),this._positionCartographic}},positionWC:{get:function(){return updateMembers(this),this._positionWC}},directionWC:{get:function(){return updateMembers(this),this._directionWC}},upWC:{get:function(){return updateMembers(this),this._upWC}},rightWC:{get:function(){return updateMembers(this),this._rightWC}},heading:{get:function(){if(this._mode!==SceneMode$1.MORPHING){var e=this._projection.ellipsoid,t=Matrix4.clone(this._transform,scratchHPRMatrix1),i=Transforms.eastNorthUpToFixedFrame(this.positionWC,e,scratchHPRMatrix2);this._setTransform(i);var r=getHeading(this.direction,this.up);return this._setTransform(t),r}}},pitch:{get:function(){if(this._mode!==SceneMode$1.MORPHING){var e=this._projection.ellipsoid,t=Matrix4.clone(this._transform,scratchHPRMatrix1),i=Transforms.eastNorthUpToFixedFrame(this.positionWC,e,scratchHPRMatrix2);this._setTransform(i);var r=getPitch(this.direction);return this._setTransform(t),r}}},roll:{get:function(){if(this._mode!==SceneMode$1.MORPHING){var e=this._projection.ellipsoid,t=Matrix4.clone(this._transform,scratchHPRMatrix1),i=Transforms.eastNorthUpToFixedFrame(this.positionWC,e,scratchHPRMatrix2);this._setTransform(i);var r=getRoll(this.direction,this.up,this.right);return this._setTransform(t),r}}},moveStart:{get:function(){return this._moveStart}},moveEnd:{get:function(){return this._moveEnd}},changed:{get:function(){return this._changed}}}),Camera.prototype.update=function(e){var t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==SceneMode$1.MORPHING,t=this._mode===SceneMode$1.SCENE2D),t){var i=this._max2Dfrustum=this.frustum.clone(),r=i.top/i.right;i.right=2*this._maxCoord.x,i.left=-i.right,i.top=r*i.right,i.bottom=-i.top}this._mode===SceneMode$1.SCENE2D&&clampMove2D(this,this.position)};var setTransformPosition=new Cartesian3,setTransformUp=new Cartesian3,setTransformDirection=new Cartesian3;Camera.prototype._setTransform=function(e){var t=Cartesian3.clone(this.positionWC,setTransformPosition),i=Cartesian3.clone(this.upWC,setTransformUp),r=Cartesian3.clone(this.directionWC,setTransformDirection);Matrix4.clone(e,this._transform),this._transformChanged=!0,updateMembers(this);var n=this._actualInvTransform;Matrix4.multiplyByPoint(n,t,this.position),Matrix4.multiplyByPointAsVector(n,r,this.direction),Matrix4.multiplyByPointAsVector(n,i,this.up),Cartesian3.cross(this.direction,this.up,this.right),updateMembers(this)};var scratchAdjustOrthographicFrustumMousePosition=new Cartesian2,scratchPickRay$1=new Ray,scratchRayIntersection$1=new Cartesian3,scratchDepthIntersection$1=new Cartesian3;function calculateOrthographicFrustumWidth(e){if(!Matrix4.equals(Matrix4.IDENTITY,e.transform))return Cartesian3.magnitude(e.position);var t,i,r,n=e._scene,a=n.globe,o=scratchAdjustOrthographicFrustumMousePosition;if(o.x=n.drawingBufferWidth/2,o.y=n.drawingBufferHeight/2,defined(a)){var s=e.getPickRay(o,scratchPickRay$1);t=a.pickWorldCoordinates(s,n,!0,scratchRayIntersection$1)}if(n.pickPositionSupported&&(i=n.pickPositionWorldCoordinates(o,scratchDepthIntersection$1)),defined(t)||defined(i)){var l=defined(i)?Cartesian3.distance(i,e.positionWC):Number.POSITIVE_INFINITY,c=defined(t)?Cartesian3.distance(t,e.positionWC):Number.POSITIVE_INFINITY;r=Math.min(l,c)}else r=Math.max(e.positionCartographic.height,0);return r}Camera.prototype._adjustOrthographicFrustum=function(e){this.frustum instanceof OrthographicFrustum&&(!e&&this._positionCartographic.height<15e4||(this.frustum.width=calculateOrthographicFrustumWidth(this)))};var scratchSetViewCartesian=new Cartesian3,scratchSetViewTransform1=new Matrix4,scratchSetViewTransform2=new Matrix4,scratchSetViewQuaternion=new Quaternion,scratchSetViewMatrix3=new Matrix3,scratchSetViewCartographic=new Cartographic;function setView3D(e,t,i){var r=Matrix4.clone(e.transform,scratchSetViewTransform1),n=Transforms.eastNorthUpToFixedFrame(t,e._projection.ellipsoid,scratchSetViewTransform2);e._setTransform(n),Cartesian3.clone(Cartesian3.ZERO,e.position),i.heading=i.heading-CesiumMath.PI_OVER_TWO;var a=Quaternion.fromHeadingPitchRoll(i,scratchSetViewQuaternion),o=Matrix3.fromQuaternion(a,scratchSetViewMatrix3);Matrix3.getColumn(o,0,e.direction),Matrix3.getColumn(o,2,e.up),Cartesian3.cross(e.direction,e.up,e.right),e._setTransform(r),e._adjustOrthographicFrustum(!0)}function setViewCV(e,t,i,r){var n=Matrix4.clone(e.transform,scratchSetViewTransform1);if(e._setTransform(Matrix4.IDENTITY),!Cartesian3.equals(t,e.positionWC)){if(r){var a=e._projection,o=a.ellipsoid.cartesianToCartographic(t,scratchSetViewCartographic);t=a.project(o,scratchSetViewCartesian)}Cartesian3.clone(t,e.position)}i.heading=i.heading-CesiumMath.PI_OVER_TWO;var s=Quaternion.fromHeadingPitchRoll(i,scratchSetViewQuaternion),l=Matrix3.fromQuaternion(s,scratchSetViewMatrix3);Matrix3.getColumn(l,0,e.direction),Matrix3.getColumn(l,2,e.up),Cartesian3.cross(e.direction,e.up,e.right),e._setTransform(n),e._adjustOrthographicFrustum(!0)}function setView2D(e,t,i,r){var n=Matrix4.clone(e.transform,scratchSetViewTransform1);if(e._setTransform(Matrix4.IDENTITY),!Cartesian3.equals(t,e.positionWC)){if(r){var a=e._projection,o=a.ellipsoid.cartesianToCartographic(t,scratchSetViewCartographic);t=a.project(o,scratchSetViewCartesian)}Cartesian2.clone(t,e.position);var s=.5*-t.z,l=-s,c=e.frustum;if(l>s){var u=c.top/c.right;c.right=l,c.left=s,c.top=c.right*u,c.bottom=-c.top}}if(e._scene.mapMode2D===MapMode2D$1.ROTATE){i.heading=i.heading-CesiumMath.PI_OVER_TWO,i.pitch=-CesiumMath.PI_OVER_TWO,i.roll=0;var d=Quaternion.fromHeadingPitchRoll(i,scratchSetViewQuaternion),h=Matrix3.fromQuaternion(d,scratchSetViewMatrix3);Matrix3.getColumn(h,2,e.up),Cartesian3.cross(e.direction,e.up,e.right)}e._setTransform(n)}var scratchToHPRDirection=new Cartesian3,scratchToHPRUp=new Cartesian3,scratchToHPRRight=new Cartesian3;function directionUpToHeadingPitchRoll(e,t,i,r){var n=Cartesian3.clone(i.direction,scratchToHPRDirection),a=Cartesian3.clone(i.up,scratchToHPRUp);if(e._scene.mode===SceneMode$1.SCENE3D){var o=e._projection.ellipsoid,s=Transforms.eastNorthUpToFixedFrame(t,o,scratchHPRMatrix1),l=Matrix4.inverseTransformation(s,scratchHPRMatrix2);Matrix4.multiplyByPointAsVector(l,n,n),Matrix4.multiplyByPointAsVector(l,a,a)}var c=Cartesian3.cross(n,a,scratchToHPRRight);return r.heading=getHeading(n,a),r.pitch=getPitch(n),r.roll=getRoll(n,a,c),r}var scratchSetViewOptions={destination:void 0,orientation:{direction:void 0,up:void 0,heading:void 0,pitch:void 0,roll:void 0},convert:void 0,endTransform:void 0},scratchHpr=new HeadingPitchRoll;Camera.prototype.setView=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=defaultValue(e.orientation,defaultValue.EMPTY_OBJECT),i=this._mode;if(i!==SceneMode$1.MORPHING){defined(e.endTransform)&&this._setTransform(e.endTransform);var r=defaultValue(e.convert,!0),n=defaultValue(e.destination,Cartesian3.clone(this.positionWC,scratchSetViewCartesian));defined(n)&&defined(n.west)&&(n=this.getRectangleCameraCoordinates(n,scratchSetViewCartesian),r=!1),defined(t.direction)&&(t=directionUpToHeadingPitchRoll(this,n,t,scratchSetViewOptions.orientation)),scratchHpr.heading=defaultValue(t.heading,0),scratchHpr.pitch=defaultValue(t.pitch,-CesiumMath.PI_OVER_TWO),scratchHpr.roll=defaultValue(t.roll,0),i===SceneMode$1.SCENE3D?setView3D(this,n,scratchHpr):i===SceneMode$1.SCENE2D?setView2D(this,n,scratchHpr,r):setViewCV(this,n,scratchHpr,r)}};var pitchScratch=new Cartesian3;function clampMove2D(e,t){var i,r,n=e._scene.mapMode2D===MapMode2D$1.ROTATE,a=e._maxCoord.x,o=e._maxCoord.y;n?i=-(r=a):(r=t.x-2*a,i=t.x+2*a),t.x>a&&(t.x=r),t.x<-a&&(t.x=i),t.y>o&&(t.y=o),t.y<-o&&(t.y=-o)}Camera.prototype.flyHome=function(e){var t=this._mode;if(t===SceneMode$1.MORPHING&&this._scene.completeMorph(),t===SceneMode$1.SCENE2D)this.flyTo({destination:Camera.DEFAULT_VIEW_RECTANGLE,duration:e,endTransform:Matrix4.IDENTITY});else if(t===SceneMode$1.SCENE3D){var i=this.getRectangleCameraCoordinates(Camera.DEFAULT_VIEW_RECTANGLE),r=Cartesian3.magnitude(i);r+=r*Camera.DEFAULT_VIEW_FACTOR,Cartesian3.normalize(i,i),Cartesian3.multiplyByScalar(i,r,i),this.flyTo({destination:i,duration:e,endTransform:Matrix4.IDENTITY})}else if(t===SceneMode$1.COLUMBUS_VIEW){var n=this._projection.ellipsoid.maximumRadius,a=new Cartesian3(0,-1,1);a=Cartesian3.multiplyByScalar(Cartesian3.normalize(a,a),5*n,a),this.flyTo({destination:a,duration:e,orientation:{heading:0,pitch:-Math.acos(Cartesian3.normalize(a,pitchScratch).z),roll:0},endTransform:Matrix4.IDENTITY,convert:!1})}},Camera.prototype.worldToCameraCoordinates=function(e,t){return defined(t)||(t=new Cartesian4),updateMembers(this),Matrix4.multiplyByVector(this._actualInvTransform,e,t)},Camera.prototype.worldToCameraCoordinatesPoint=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPoint(this._actualInvTransform,e,t)},Camera.prototype.worldToCameraCoordinatesVector=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPointAsVector(this._actualInvTransform,e,t)},Camera.prototype.cameraToWorldCoordinates=function(e,t){return defined(t)||(t=new Cartesian4),updateMembers(this),Matrix4.multiplyByVector(this._actualTransform,e,t)},Camera.prototype.cameraToWorldCoordinatesPoint=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPoint(this._actualTransform,e,t)},Camera.prototype.cameraToWorldCoordinatesVector=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPointAsVector(this._actualTransform,e,t)};var moveScratch=new Cartesian3;Camera.prototype.move=function(e,t){var i=this.position;Cartesian3.multiplyByScalar(e,t,moveScratch),Cartesian3.add(i,moveScratch,i),this._mode===SceneMode$1.SCENE2D&&clampMove2D(this,i),this._adjustOrthographicFrustum(!0)},Camera.prototype.moveForward=function(e){e=defaultValue(e,this.defaultMoveAmount),this._mode===SceneMode$1.SCENE2D?zoom2D$1(this,e):this.move(this.direction,e)},Camera.prototype.moveBackward=function(e){e=defaultValue(e,this.defaultMoveAmount),this._mode===SceneMode$1.SCENE2D?zoom2D$1(this,-e):this.move(this.direction,-e)},Camera.prototype.moveUp=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.up,e)},Camera.prototype.moveDown=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.up,-e)},Camera.prototype.moveRight=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.right,e)},Camera.prototype.moveLeft=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.right,-e)},Camera.prototype.lookLeft=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.up,-e)},Camera.prototype.lookRight=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.up,e)},Camera.prototype.lookUp=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.right,-e)},Camera.prototype.lookDown=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.right,e)};var lookScratchQuaternion=new Quaternion,lookScratchMatrix=new Matrix3;Camera.prototype.look=function(e,t){var i=defaultValue(t,this.defaultLookAmount),r=Quaternion.fromAxisAngle(e,-i,lookScratchQuaternion),n=Matrix3.fromQuaternion(r,lookScratchMatrix),a=this.direction,o=this.up,s=this.right;Matrix3.multiplyByVector(n,a,a),Matrix3.multiplyByVector(n,o,o),Matrix3.multiplyByVector(n,s,s)},Camera.prototype.twistLeft=function(e){e=defaultValue(e,this.defaultLookAmount),this.look(this.direction,e)},Camera.prototype.twistRight=function(e){e=defaultValue(e,this.defaultLookAmount),this.look(this.direction,-e)};var rotateScratchQuaternion=new Quaternion,rotateScratchMatrix=new Matrix3;Camera.prototype.rotate=function(e,t){var i=defaultValue(t,this.defaultRotateAmount),r=Quaternion.fromAxisAngle(e,-i,rotateScratchQuaternion),n=Matrix3.fromQuaternion(r,rotateScratchMatrix);Matrix3.multiplyByVector(n,this.position,this.position),Matrix3.multiplyByVector(n,this.direction,this.direction),Matrix3.multiplyByVector(n,this.up,this.up),Cartesian3.cross(this.direction,this.up,this.right),Cartesian3.cross(this.right,this.direction,this.up),this._adjustOrthographicFrustum(!1)},Camera.prototype.rotateDown=function(e){rotateVertical(this,e=defaultValue(e,this.defaultRotateAmount))},Camera.prototype.rotateUp=function(e){rotateVertical(this,-(e=defaultValue(e,this.defaultRotateAmount)))};var rotateVertScratchP=new Cartesian3,rotateVertScratchA=new Cartesian3,rotateVertScratchTan=new Cartesian3,rotateVertScratchNegate=new Cartesian3;function rotateVertical(e,t){var i=e.position;if(defined(e.constrainedAxis)&&!Cartesian3.equalsEpsilon(e.position,Cartesian3.ZERO,CesiumMath.EPSILON2)){var r=Cartesian3.normalize(i,rotateVertScratchP),n=Cartesian3.equalsEpsilon(r,e.constrainedAxis,CesiumMath.EPSILON2),a=Cartesian3.equalsEpsilon(r,Cartesian3.negate(e.constrainedAxis,rotateVertScratchNegate),CesiumMath.EPSILON2);if(n||a)(n&&t<0||a&&t>0)&&e.rotate(e.right,t);else{var o=Cartesian3.normalize(e.constrainedAxis,rotateVertScratchA),s=Cartesian3.dot(r,o),l=CesiumMath.acosClamped(s);t>0&&t>l&&(t=l-CesiumMath.EPSILON4),s=Cartesian3.dot(r,Cartesian3.negate(o,rotateVertScratchNegate)),l=CesiumMath.acosClamped(s),t<0&&-t>l&&(t=-l+CesiumMath.EPSILON4);var c=Cartesian3.cross(o,r,rotateVertScratchTan);e.rotate(c,t)}}else e.rotate(e.right,t)}function rotateHorizontal(e,t){defined(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function zoom2D$1(e,t){var i,r=e.frustum;if(t*=.5,Math.abs(r.top)+Math.abs(r.bottom)>Math.abs(r.left)+Math.abs(r.right)){var n=r.top-t,a=r.bottom+t,o=e._maxCoord.y;e._scene.mapMode2D===MapMode2D$1.ROTATE&&(o*=e.maximumZoomFactor),a>o&&(a=o,n=-o),n<=a&&(n=1,a=-1),i=r.right/r.top,r.top=n,r.bottom=a,r.right=r.top*i,r.left=-r.right}else{var s=r.right-t,l=r.left+t,c=e._maxCoord.x;e._scene.mapMode2D===MapMode2D$1.ROTATE&&(c*=e.maximumZoomFactor),s>c&&(s=c,l=-c),s<=l&&(s=1,l=-1),i=r.top/r.right,r.right=s,r.left=l,r.top=r.right*i,r.bottom=-r.top}}function zoom3D$1(e,t){e.move(e.direction,t)}Camera.prototype.rotateRight=function(e){rotateHorizontal(this,-(e=defaultValue(e,this.defaultRotateAmount)))},Camera.prototype.rotateLeft=function(e){rotateHorizontal(this,e=defaultValue(e,this.defaultRotateAmount))},Camera.prototype.zoomIn=function(e){e=defaultValue(e,this.defaultZoomAmount),this._mode===SceneMode$1.SCENE2D?zoom2D$1(this,e):zoom3D$1(this,e)},Camera.prototype.zoomOut=function(e){e=defaultValue(e,this.defaultZoomAmount),this._mode===SceneMode$1.SCENE2D?zoom2D$1(this,-e):zoom3D$1(this,-e)},Camera.prototype.getMagnitude=function(){return this._mode===SceneMode$1.SCENE3D?Cartesian3.magnitude(this.position):this._mode===SceneMode$1.COLUMBUS_VIEW?Math.abs(this.position.z):this._mode===SceneMode$1.SCENE2D?Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom):void 0};var scratchLookAtMatrix4=new Matrix4;Camera.prototype.lookAt=function(e,t){var i=Transforms.eastNorthUpToFixedFrame(e,Ellipsoid.WGS84,scratchLookAtMatrix4);this.lookAtTransform(i,t)};var scratchLookAtHeadingPitchRangeOffset=new Cartesian3,scratchLookAtHeadingPitchRangeQuaternion1=new Quaternion,scratchLookAtHeadingPitchRangeQuaternion2=new Quaternion,scratchHeadingPitchRangeMatrix3=new Matrix3;function offsetFromHeadingPitchRange(e,t,i){t=CesiumMath.clamp(t,-CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO),e=CesiumMath.zeroToTwoPi(e)-CesiumMath.PI_OVER_TWO;var r=Quaternion.fromAxisAngle(Cartesian3.UNIT_Y,-t,scratchLookAtHeadingPitchRangeQuaternion1),n=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,-e,scratchLookAtHeadingPitchRangeQuaternion2),a=Quaternion.multiply(n,r,n),o=Matrix3.fromQuaternion(a,scratchHeadingPitchRangeMatrix3),s=Cartesian3.clone(Cartesian3.UNIT_X,scratchLookAtHeadingPitchRangeOffset);return Matrix3.multiplyByVector(o,s,s),Cartesian3.negate(s,s),Cartesian3.multiplyByScalar(s,i,s),s}Camera.prototype.lookAtTransform=function(e,t){if(this._setTransform(e),defined(t)){var i;if(i=defined(t.heading)?offsetFromHeadingPitchRange(t.heading,t.pitch,t.range):t,this._mode===SceneMode$1.SCENE2D){Cartesian2.clone(Cartesian2.ZERO,this.position),Cartesian3.negate(i,this.up),this.up.z=0,Cartesian3.magnitudeSquared(this.up)<CesiumMath.EPSILON10&&Cartesian3.clone(Cartesian3.UNIT_Y,this.up),Cartesian3.normalize(this.up,this.up),this._setTransform(Matrix4.IDENTITY),Cartesian3.negate(Cartesian3.UNIT_Z,this.direction),Cartesian3.cross(this.direction,this.up,this.right),Cartesian3.normalize(this.right,this.right);var r=this.frustum,n=r.top/r.right;return r.right=.5*Cartesian3.magnitude(i),r.left=-r.right,r.top=n*r.right,r.bottom=-r.top,void this._setTransform(e)}Cartesian3.clone(i,this.position),Cartesian3.negate(this.position,this.direction),Cartesian3.normalize(this.direction,this.direction),Cartesian3.cross(this.direction,Cartesian3.UNIT_Z,this.right),Cartesian3.magnitudeSquared(this.right)<CesiumMath.EPSILON10&&Cartesian3.clone(Cartesian3.UNIT_X,this.right),Cartesian3.normalize(this.right,this.right),Cartesian3.cross(this.right,this.direction,this.up),Cartesian3.normalize(this.up,this.up),this._adjustOrthographicFrustum(!0)}};var viewRectangle3DCartographic1=new Cartographic,viewRectangle3DCartographic2=new Cartographic,viewRectangle3DNorthEast=new Cartesian3,viewRectangle3DSouthWest=new Cartesian3,viewRectangle3DNorthWest=new Cartesian3,viewRectangle3DSouthEast=new Cartesian3,viewRectangle3DNorthCenter=new Cartesian3,viewRectangle3DSouthCenter=new Cartesian3,viewRectangle3DCenter=new Cartesian3,viewRectangle3DEquator=new Cartesian3,defaultRF={direction:new Cartesian3,right:new Cartesian3,up:new Cartesian3},viewRectangle3DEllipsoidGeodesic;function computeD(e,t,i,r){return Math.abs(Cartesian3.dot(t,i))/r-Cartesian3.dot(e,i)}function rectangleCameraPosition3D(e,t,i,r){var n=e._projection.ellipsoid,a=r?e:defaultRF,o=t.north,s=t.south,l=t.east,c=t.west;c>l&&(l+=CesiumMath.TWO_PI);var u,d=.5*(c+l);if(s<-CesiumMath.PI_OVER_TWO+CesiumMath.RADIANS_PER_DEGREE&&o>CesiumMath.PI_OVER_TWO-CesiumMath.RADIANS_PER_DEGREE)u=0;else{var h=viewRectangle3DCartographic1;h.longitude=d,h.latitude=o,h.height=0;var p=viewRectangle3DCartographic2;p.longitude=d,p.latitude=s,p.height=0;var f=viewRectangle3DEllipsoidGeodesic;defined(f)&&f.ellipsoid===n||(viewRectangle3DEllipsoidGeodesic=f=new EllipsoidGeodesic(void 0,void 0,n)),f.setEndPoints(h,p),u=f.interpolateUsingFraction(.5,viewRectangle3DCartographic1).latitude}var m=viewRectangle3DCartographic1;m.longitude=d,m.latitude=u,m.height=0;var g=n.cartographicToCartesian(m,viewRectangle3DCenter),_=viewRectangle3DCartographic1;_.longitude=l,_.latitude=o;var y=n.cartographicToCartesian(_,viewRectangle3DNorthEast);_.longitude=c;var v=n.cartographicToCartesian(_,viewRectangle3DNorthWest);_.longitude=d;var C=n.cartographicToCartesian(_,viewRectangle3DNorthCenter);_.latitude=s;var T=n.cartographicToCartesian(_,viewRectangle3DSouthCenter);_.longitude=l;var S=n.cartographicToCartesian(_,viewRectangle3DSouthEast);_.longitude=c;var A=n.cartographicToCartesian(_,viewRectangle3DSouthWest);Cartesian3.subtract(v,g,v),Cartesian3.subtract(S,g,S),Cartesian3.subtract(y,g,y),Cartesian3.subtract(A,g,A),Cartesian3.subtract(C,g,C),Cartesian3.subtract(T,g,T);var x=n.geodeticSurfaceNormal(g,a.direction);Cartesian3.negate(x,x);var E=Cartesian3.cross(x,Cartesian3.UNIT_Z,a.right);Cartesian3.normalize(E,E);var b,P=Cartesian3.cross(E,x,a.up);if(e.frustum instanceof OrthographicFrustum){var D,w,M=Math.max(Cartesian3.distance(y,v),Cartesian3.distance(S,A)),I=Math.max(Cartesian3.distance(y,S),Cartesian3.distance(v,A)),R=e.frustum._offCenterFrustum.right/e.frustum._offCenterFrustum.top,O=I*R;M>O?w=(D=M)/R:(w=I,D=O),b=Math.max(D,w)}else{var B=Math.tan(.5*e.frustum.fovy),L=e.frustum.aspectRatio*B;if(b=Math.max(computeD(x,P,v,B),computeD(x,P,S,B),computeD(x,P,y,B),computeD(x,P,A,B),computeD(x,P,C,B),computeD(x,P,T,B),computeD(x,E,v,L),computeD(x,E,S,L),computeD(x,E,y,L),computeD(x,E,A,L),computeD(x,E,C,L),computeD(x,E,T,L)),s<0&&o>0){var F=viewRectangle3DCartographic1;F.longitude=c,F.latitude=0,F.height=0;var N=n.cartographicToCartesian(F,viewRectangle3DEquator);Cartesian3.subtract(N,g,N),b=Math.max(b,computeD(x,P,N,B),computeD(x,E,N,L)),F.longitude=l,N=n.cartographicToCartesian(F,viewRectangle3DEquator),Cartesian3.subtract(N,g,N),b=Math.max(b,computeD(x,P,N,B),computeD(x,E,N,L))}}return Cartesian3.add(g,Cartesian3.multiplyByScalar(x,-b,viewRectangle3DEquator),i)}var viewRectangleCVCartographic=new Cartographic,viewRectangleCVNorthEast=new Cartesian3,viewRectangleCVSouthWest=new Cartesian3;function rectangleCameraPositionColumbusView(e,t,i){var r=e._projection;t.west>t.east&&(t=Rectangle.MAX_VALUE);var n=e._actualTransform,a=e._actualInvTransform,o=viewRectangleCVCartographic;o.longitude=t.east,o.latitude=t.north;var s=r.project(o,viewRectangleCVNorthEast);Matrix4.multiplyByPoint(n,s,s),Matrix4.multiplyByPoint(a,s,s),o.longitude=t.west,o.latitude=t.south;var l=r.project(o,viewRectangleCVSouthWest);if(Matrix4.multiplyByPoint(n,l,l),Matrix4.multiplyByPoint(a,l,l),i.x=.5*(s.x-l.x)+l.x,i.y=.5*(s.y-l.y)+l.y,defined(e.frustum.fovy)){var c=Math.tan(.5*e.frustum.fovy),u=e.frustum.aspectRatio*c;i.z=.5*Math.max((s.x-l.x)/u,(s.y-l.y)/c)}else{var d=s.x-l.x,h=s.y-l.y;i.z=Math.max(d,h)}return i}var viewRectangle2DCartographic=new Cartographic,viewRectangle2DNorthEast=new Cartesian3,viewRectangle2DSouthWest=new Cartesian3;function rectangleCameraPosition2D(e,t,i){var r=e._projection,n=t.east;t.west>t.east&&(e._scene.mapMode2D===MapMode2D$1.INFINITE_SCROLL?n+=CesiumMath.TWO_PI:n=(t=Rectangle.MAX_VALUE).east);var a=viewRectangle2DCartographic;a.longitude=n,a.latitude=t.north;var o=r.project(a,viewRectangle2DNorthEast);a.longitude=t.west,a.latitude=t.south;var s,l,c=r.project(a,viewRectangle2DSouthWest),u=.5*Math.abs(o.x-c.x),d=.5*Math.abs(o.y-c.y),h=e.frustum.right/e.frustum.top,p=d*h;return u>p?l=(s=u)/h:(l=d,s=p),d=Math.max(2*s,2*l),i.x=.5*(o.x-c.x)+c.x,i.y=.5*(o.y-c.y)+c.y,(a=r.unproject(i,a)).height=d,i=r.project(a,i)}Camera.prototype.getRectangleCameraCoordinates=function(e,t){var i=this._mode;return defined(t)||(t=new Cartesian3),i===SceneMode$1.SCENE3D?rectangleCameraPosition3D(this,e,t):i===SceneMode$1.COLUMBUS_VIEW?rectangleCameraPositionColumbusView(this,e,t):i===SceneMode$1.SCENE2D?rectangleCameraPosition2D(this,e,t):void 0};var pickEllipsoid3DRay=new Ray;function pickEllipsoid3D(e,t,i,r){i=defaultValue(i,Ellipsoid.WGS84);var n=e.getPickRay(t,pickEllipsoid3DRay),a=IntersectionTests.rayEllipsoid(n,i);if(a){var o=a.start>0?a.start:a.stop;return Ray.getPoint(n,o,r)}}var pickEllipsoid2DRay=new Ray;function pickMap2D(e,t,i,r){var n=e.getPickRay(t,pickEllipsoid2DRay).origin;n=Cartesian3.fromElements(n.y,n.z,0,n);var a=i.unproject(n);if(!(a.latitude<-CesiumMath.PI_OVER_TWO||a.latitude>CesiumMath.PI_OVER_TWO))return i.ellipsoid.cartographicToCartesian(a,r)}var pickEllipsoidCVRay=new Ray;function pickMapColumbusView(e,t,i,r){var n=e.getPickRay(t,pickEllipsoidCVRay),a=-n.origin.x/n.direction.x;Ray.getPoint(n,a,r);var o=i.unproject(new Cartesian3(r.y,r.z,0));if(!(o.latitude<-CesiumMath.PI_OVER_TWO||o.latitude>CesiumMath.PI_OVER_TWO||o.longitude<-Math.PI||o.longitude>Math.PI))return i.ellipsoid.cartographicToCartesian(o,r)}Camera.prototype.pickEllipsoid=function(e,t,i){var r=this._scene.canvas;if(0!==r.clientWidth&&0!==r.clientHeight){if(defined(i)||(i=new Cartesian3),t=defaultValue(t,Ellipsoid.WGS84),this._mode===SceneMode$1.SCENE3D)i=pickEllipsoid3D(this,e,t,i);else if(this._mode===SceneMode$1.SCENE2D)i=pickMap2D(this,e,this._projection,i);else{if(this._mode!==SceneMode$1.COLUMBUS_VIEW)return;i=pickMapColumbusView(this,e,this._projection,i)}return i}};var pickPerspCenter=new Cartesian3,pickPerspXDir=new Cartesian3,pickPerspYDir=new Cartesian3;function getPickRayPerspective(e,t,i){var r=e._scene.canvas,n=r.clientWidth,a=r.clientHeight,o=Math.tan(.5*e.frustum.fovy),s=e.frustum.aspectRatio*o,l=e.frustum.near,c=2/n*t.x-1,u=2/a*(a-t.y)-1,d=e.positionWC;Cartesian3.clone(d,i.origin);var h=Cartesian3.multiplyByScalar(e.directionWC,l,pickPerspCenter);Cartesian3.add(d,h,h);var p=Cartesian3.multiplyByScalar(e.rightWC,c*l*s,pickPerspXDir),f=Cartesian3.multiplyByScalar(e.upWC,u*l*o,pickPerspYDir),m=Cartesian3.add(h,p,i.direction);return Cartesian3.add(m,f,m),Cartesian3.subtract(m,d,m),Cartesian3.normalize(m,m),i}var scratchDirection=new Cartesian3;function getPickRayOrthographic(e,t,i){var r=e._scene.canvas,n=r.clientWidth,a=r.clientHeight,o=e.frustum;defined(o._offCenterFrustum)&&(o=o._offCenterFrustum);var s=2/n*t.x-1;s*=.5*(o.right-o.left);var l=2/a*(a-t.y)-1;l*=.5*(o.top-o.bottom);var c=i.origin;return Cartesian3.clone(e.position,c),Cartesian3.multiplyByScalar(e.right,s,scratchDirection),Cartesian3.add(scratchDirection,c,c),Cartesian3.multiplyByScalar(e.up,l,scratchDirection),Cartesian3.add(scratchDirection,c,c),Cartesian3.clone(e.directionWC,i.direction),e._mode!==SceneMode$1.COLUMBUS_VIEW&&e._mode!==SceneMode$1.SCENE2D||Cartesian3.fromElements(i.origin.z,i.origin.x,i.origin.y,i.origin),i}Camera.prototype.getPickRay=function(e,t){defined(t)||(t=new Ray);var i=this.frustum;return defined(i.aspectRatio)&&defined(i.fov)&&defined(i.near)?getPickRayPerspective(this,e,t):getPickRayOrthographic(this,e,t)};var scratchToCenter=new Cartesian3,scratchProj=new Cartesian3;Camera.prototype.distanceToBoundingSphere=function(e){var t=Cartesian3.subtract(this.positionWC,e.center,scratchToCenter),i=Cartesian3.multiplyByScalar(this.directionWC,Cartesian3.dot(t,this.directionWC),scratchProj);return Math.max(0,Cartesian3.magnitude(i)-e.radius)};var scratchPixelSize=new Cartesian2;function createAnimationTemplateCV(e,t,i,r,n,a){var o=Cartesian3.clone(t);return i.y>r?o.y-=i.y-r:i.y<-r&&(o.y+=-r-i.y),i.z>n?o.z-=i.z-n:i.z<-n&&(o.z+=-n-i.z),{easingFunction:EasingFunction$1.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:a,update:function(i){var r=Cartesian3.lerp(t,o,i.time,new Cartesian3);e.worldToCameraCoordinatesPoint(r,e.position)}}}Camera.prototype.getPixelSize=function(e,t,i){var r=this.distanceToBoundingSphere(e),n=this.frustum.getPixelDimensions(t,i,r,this._scene.pixelRatio,scratchPixelSize);return Math.max(n.x,n.y)};var normalScratch$1=new Cartesian3,centerScratch$2=new Cartesian3,posScratch=new Cartesian3,scratchCartesian3Subtract=new Cartesian3;function createAnimationCV(e,t){var i=e.position,r=e.direction,n=e.worldToCameraCoordinatesVector(Cartesian3.UNIT_X,normalScratch$1),a=-Cartesian3.dot(n,i)/Cartesian3.dot(n,r),o=Cartesian3.add(i,Cartesian3.multiplyByScalar(r,a,centerScratch$2),centerScratch$2);e.cameraToWorldCoordinatesPoint(o,o),i=e.cameraToWorldCoordinatesPoint(e.position,posScratch);var s=Math.tan(.5*e.frustum.fovy),l=e.frustum.aspectRatio*s,c=Cartesian3.magnitude(Cartesian3.subtract(i,o,scratchCartesian3Subtract)),u=l*c,d=s*c,h=e._maxCoord.x,p=e._maxCoord.y,f=Math.max(u-h,h),m=Math.max(d-p,p);if(i.z<-f||i.z>f||i.y<-m||i.y>m){var g=o.y<-f||o.y>f,_=o.z<-m||o.z>m;if(g||_)return createAnimationTemplateCV(e,i,o,f,m,t)}}Camera.prototype.createCorrectPositionTween=function(e){if(this._mode===SceneMode$1.COLUMBUS_VIEW)return createAnimationCV(this,e)};var scratchFlyToDestination=new Cartesian3,newOptions={destination:void 0,heading:void 0,pitch:void 0,roll:void 0,duration:void 0,complete:void 0,cancel:void 0,endTransform:void 0,maximumHeight:void 0,easingFunction:void 0};function distanceToBoundingSphere3D(e,t){var i=e.frustum,r=Math.tan(.5*i.fovy),n=i.aspectRatio*r;return Math.max(t/n,t/r)}function distanceToBoundingSphere2D(e,t){var i,r,n=e.frustum;defined(n._offCenterFrustum)&&(n=n._offCenterFrustum);var a=n.right/n.top,o=t*a;return t>o?r=(i=t)/a:(r=t,i=o),1.5*Math.max(i,r)}Camera.prototype.cancelFlight=function(){defined(this._currentFlight)&&(this._currentFlight.cancelTween(),this._currentFlight=void 0)},Camera.prototype.completeFlight=function(){if(defined(this._currentFlight)){this._currentFlight.cancelTween();var e={destination:void 0,orientation:{heading:void 0,pitch:void 0,roll:void 0}};e.destination=newOptions.destination,e.orientation.heading=newOptions.heading,e.orientation.pitch=newOptions.pitch,e.orientation.roll=newOptions.roll,this.setView(e),defined(this._currentFlight.complete)&&this._currentFlight.complete(),this._currentFlight=void 0}},Camera.prototype.flyTo=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).destination;if(this._mode!==SceneMode$1.MORPHING){this.cancelFlight();var i=defaultValue(e.orientation,defaultValue.EMPTY_OBJECT);if(defined(i.direction)&&(i=directionUpToHeadingPitchRoll(this,t,i,scratchSetViewOptions.orientation)),defined(e.duration)&&e.duration<=0){var r=scratchSetViewOptions;return r.destination=e.destination,r.orientation.heading=i.heading,r.orientation.pitch=i.pitch,r.orientation.roll=i.roll,r.convert=e.convert,r.endTransform=e.endTransform,this.setView(r),void("function"==typeof e.complete&&e.complete())}var n=defined(t.west);n&&(t=this.getRectangleCameraCoordinates(t,scratchFlyToDestination));var a,o=this;newOptions.destination=t,newOptions.heading=i.heading,newOptions.pitch=i.pitch,newOptions.roll=i.roll,newOptions.duration=e.duration,newOptions.complete=function(){a===o._currentFlight&&(o._currentFlight=void 0),defined(e.complete)&&e.complete()},newOptions.cancel=e.cancel,newOptions.endTransform=e.endTransform,newOptions.convert=!n&&e.convert,newOptions.maximumHeight=e.maximumHeight,newOptions.pitchAdjustHeight=e.pitchAdjustHeight,newOptions.flyOverLongitude=e.flyOverLongitude,newOptions.flyOverLongitudeWeight=e.flyOverLongitudeWeight,newOptions.easingFunction=e.easingFunction;var s=this._scene,l=CameraFlightPath.createTween(s,newOptions);if(0!==l.duration){a=s.tweens.add(l),this._currentFlight=a;var c=this._scene.preloadFlightCamera;this._mode!==SceneMode$1.SCENE2D&&(defined(c)||(c=Camera.clone(this)),c.setView({destination:t,orientation:i}),this._scene.preloadFlightCullingVolume=c.frustum.computeCullingVolume(c.positionWC,c.directionWC,c.upWC))}else"function"==typeof l.complete&&l.complete()}};var MINIMUM_ZOOM=100;function adjustBoundingSphereOffset(e,t,i){i=HeadingPitchRange.clone(defined(i)?i:Camera.DEFAULT_OFFSET);var r=e._scene.screenSpaceCameraController.minimumZoomDistance,n=e._scene.screenSpaceCameraController.maximumZoomDistance,a=i.range;if(!defined(a)||0===a){var o=t.radius;0===o?i.range=MINIMUM_ZOOM:e.frustum instanceof OrthographicFrustum||e._mode===SceneMode$1.SCENE2D?i.range=distanceToBoundingSphere2D(e,o):i.range=distanceToBoundingSphere3D(e,o),i.range=CesiumMath.clamp(i.range,r,n)}return i}Camera.prototype.viewBoundingSphere=function(e,t){t=adjustBoundingSphereOffset(this,e,t),this.lookAt(e.center,t)};var scratchflyToBoundingSphereTransform=new Matrix4,scratchflyToBoundingSphereDestination=new Cartesian3,scratchflyToBoundingSphereDirection=new Cartesian3,scratchflyToBoundingSphereUp=new Cartesian3,scratchflyToBoundingSphereRight=new Cartesian3,scratchFlyToBoundingSphereCart4=new Cartesian4,scratchFlyToBoundingSphereQuaternion=new Quaternion,scratchFlyToBoundingSphereMatrix3=new Matrix3;Camera.prototype.flyToBoundingSphere=function(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT);var i=this._mode===SceneMode$1.SCENE2D||this._mode===SceneMode$1.COLUMBUS_VIEW;this._setTransform(Matrix4.IDENTITY);var r,n=adjustBoundingSphereOffset(this,e,t.offset);r=i?Cartesian3.multiplyByScalar(Cartesian3.UNIT_Z,n.range,scratchflyToBoundingSphereDestination):offsetFromHeadingPitchRange(n.heading,n.pitch,n.range);var a,o,s=Transforms.eastNorthUpToFixedFrame(e.center,Ellipsoid.WGS84,scratchflyToBoundingSphereTransform);if(Matrix4.multiplyByPoint(s,r,r),!i){if(a=Cartesian3.subtract(e.center,r,scratchflyToBoundingSphereDirection),Cartesian3.normalize(a,a),o=Matrix4.multiplyByPointAsVector(s,Cartesian3.UNIT_Z,scratchflyToBoundingSphereUp),1-Math.abs(Cartesian3.dot(a,o))<CesiumMath.EPSILON6){var l=Quaternion.fromAxisAngle(a,n.heading,scratchFlyToBoundingSphereQuaternion),c=Matrix3.fromQuaternion(l,scratchFlyToBoundingSphereMatrix3);Cartesian3.fromCartesian4(Matrix4.getColumn(s,1,scratchFlyToBoundingSphereCart4),o),Matrix3.multiplyByVector(c,o,o)}var u=Cartesian3.cross(a,o,scratchflyToBoundingSphereRight);Cartesian3.cross(u,a,o),Cartesian3.normalize(o,o)}this.flyTo({destination:r,orientation:{direction:a,up:o},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})};var scratchCartesian3_1=new Cartesian3,scratchCartesian3_2=new Cartesian3,scratchCartesian3_3=new Cartesian3,scratchCartesian3_4=new Cartesian3,horizonPoints=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3];function computeHorizonQuad(e,t){var i,r,n=t.radii,a=e.positionWC,o=Cartesian3.multiplyComponents(t.oneOverRadii,a,scratchCartesian3_1),s=Cartesian3.magnitude(o),l=Cartesian3.normalize(o,scratchCartesian3_2);Cartesian3.equalsEpsilon(l,Cartesian3.UNIT_Z,CesiumMath.EPSILON10)?(i=new Cartesian3(0,1,0),r=new Cartesian3(0,0,1)):(i=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,l,scratchCartesian3_3),scratchCartesian3_3),r=Cartesian3.normalize(Cartesian3.cross(l,i,scratchCartesian3_4),scratchCartesian3_4));var c=Math.sqrt(Cartesian3.magnitudeSquared(o)-1),u=Cartesian3.multiplyByScalar(l,1/s,scratchCartesian3_1),d=c/s,h=Cartesian3.multiplyByScalar(i,d,scratchCartesian3_2),p=Cartesian3.multiplyByScalar(r,d,scratchCartesian3_3),f=Cartesian3.add(u,p,horizonPoints[0]);Cartesian3.subtract(f,h,f),Cartesian3.multiplyComponents(n,f,f);var m=Cartesian3.subtract(u,p,horizonPoints[1]);Cartesian3.subtract(m,h,m),Cartesian3.multiplyComponents(n,m,m);var g=Cartesian3.subtract(u,p,horizonPoints[2]);Cartesian3.add(g,h,g),Cartesian3.multiplyComponents(n,g,g);var _=Cartesian3.add(u,p,horizonPoints[3]);return Cartesian3.add(_,h,_),Cartesian3.multiplyComponents(n,_,_),horizonPoints}var scratchPickCartesian2=new Cartesian2,scratchRectCartesian=new Cartesian3,cartoArray=[new Cartographic,new Cartographic,new Cartographic,new Cartographic];function addToResult(e,t,i,r,n,a){scratchPickCartesian2.x=e,scratchPickCartesian2.y=t;var o=r.pickEllipsoid(scratchPickCartesian2,n,scratchRectCartesian);return defined(o)?(cartoArray[i]=n.cartesianToCartographic(o,cartoArray[i]),1):(cartoArray[i]=n.cartesianToCartographic(a[i],cartoArray[i]),0)}Camera.prototype.computeViewRectangle=function(e,t){e=defaultValue(e,Ellipsoid.WGS84);var i=this.frustum.computeCullingVolume(this.positionWC,this.directionWC,this.upWC),r=new BoundingSphere(Cartesian3.ZERO,e.maximumRadius);if(i.computeVisibility(r)!==Intersect$1.OUTSIDE){var n=this._scene.canvas,a=n.clientWidth,o=n.clientHeight,s=0,l=computeHorizonQuad(this,e);if(s+=addToResult(0,0,0,this,e,l),s+=addToResult(0,o,1,this,e,l),s+=addToResult(a,o,2,this,e,l),(s+=addToResult(a,0,3,this,e,l))<2)return Rectangle.MAX_VALUE;t=Rectangle.fromCartographicArray(cartoArray,t);for(var c=0,u=cartoArray[3].longitude,d=0;d<4;++d){var h=cartoArray[d].longitude,p=Math.abs(h-u);p>CesiumMath.PI?c+=CesiumMath.TWO_PI-p:c+=p,u=h}return CesiumMath.equalsEpsilon(Math.abs(c),CesiumMath.TWO_PI,CesiumMath.EPSILON9)&&(t.west=-CesiumMath.PI,t.east=CesiumMath.PI,cartoArray[0].latitude>=0?t.north=CesiumMath.PI_OVER_TWO:t.south=-CesiumMath.PI_OVER_TWO),t}},Camera.prototype.switchToPerspectiveFrustum=function(){if(!(this._mode===SceneMode$1.SCENE2D||this.frustum instanceof PerspectiveFrustum)){var e=this._scene;this.frustum=new PerspectiveFrustum,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=CesiumMath.toRadians(60)}},Camera.prototype.switchToOrthographicFrustum=function(){if(!(this._mode===SceneMode$1.SCENE2D||this.frustum instanceof OrthographicFrustum)){var e=calculateOrthographicFrustumWidth(this),t=this._scene;this.frustum=new OrthographicFrustum,this.frustum.aspectRatio=t.drawingBufferWidth/t.drawingBufferHeight,this.frustum.width=e}},Camera.clone=function(e,t){return defined(t)||(t=new Camera(e._scene)),Cartesian3.clone(e.position,t.position),Cartesian3.clone(e.direction,t.direction),Cartesian3.clone(e.up,t.up),Cartesian3.clone(e.right,t.right),Matrix4.clone(e._transform,t.transform),t._transformChanged=!0,t.frustum=e.frustum.clone(),t};var CameraEventType={LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4},CameraEventType$1=Object.freeze(CameraEventType);function getKey$1(e,t){var i=e;return defined(t)&&(i+="+"+t),i}function clonePinchMovement(e,t){Cartesian2.clone(e.distance.startPosition,t.distance.startPosition),Cartesian2.clone(e.distance.endPosition,t.distance.endPosition),Cartesian2.clone(e.angleAndHeight.startPosition,t.angleAndHeight.startPosition),Cartesian2.clone(e.angleAndHeight.endPosition,t.angleAndHeight.endPosition)}function listenToPinch(e,t,i){var r=getKey$1(CameraEventType$1.PINCH,t),n=e._update,a=e._isDown,o=e._eventStartPosition,s=e._pressTime,l=e._releaseTime;n[r]=!0,a[r]=!1,o[r]=new Cartesian2;var c=e._movement[r];defined(c)||(c=e._movement[r]={}),c.distance={startPosition:new Cartesian2,endPosition:new Cartesian2},c.angleAndHeight={startPosition:new Cartesian2,endPosition:new Cartesian2},c.prevAngle=0,e._eventHandler.setInputAction((function(t){e._buttonsDown++,a[r]=!0,s[r]=new Date,Cartesian2.lerp(t.position1,t.position2,.5,o[r])}),ScreenSpaceEventType$1.PINCH_START,t),e._eventHandler.setInputAction((function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),a[r]=!1,l[r]=new Date}),ScreenSpaceEventType$1.PINCH_END,t),e._eventHandler.setInputAction((function(e){if(a[r]){n[r]?(clonePinchMovement(e,c),n[r]=!1,c.prevAngle=c.angleAndHeight.startPosition.x):(Cartesian2.clone(e.distance.endPosition,c.distance.endPosition),Cartesian2.clone(e.angleAndHeight.endPosition,c.angleAndHeight.endPosition));for(var t=c.angleAndHeight.endPosition.x,o=c.prevAngle,s=2*Math.PI;t>=o+Math.PI;)t-=s;for(;t<o-Math.PI;)t+=s;c.angleAndHeight.endPosition.x=-t*i.clientWidth/12,c.angleAndHeight.startPosition.x=-o*i.clientWidth/12}}),ScreenSpaceEventType$1.PINCH_MOVE,t)}function listenToWheel(e,t){var i=getKey$1(CameraEventType$1.WHEEL,t),r=e._update;r[i]=!0;var n=e._movement[i];defined(n)||(n=e._movement[i]={}),n.startPosition=new Cartesian2,n.endPosition=new Cartesian2,e._eventHandler.setInputAction((function(e){var t=15*CesiumMath.toRadians(e);r[i]?(Cartesian2.clone(Cartesian2.ZERO,n.startPosition),n.endPosition.x=0,n.endPosition.y=t,r[i]=!1):n.endPosition.y=n.endPosition.y+t}),ScreenSpaceEventType$1.WHEEL,t)}function listenMouseButtonDownUp(e,t,i){var r=getKey$1(i,t),n=e._isDown,a=e._eventStartPosition,o=e._pressTime,s=e._releaseTime;n[r]=!1,a[r]=new Cartesian2;var l,c,u=e._lastMovement[r];defined(u)||(u=e._lastMovement[r]={startPosition:new Cartesian2,endPosition:new Cartesian2,valid:!1}),i===CameraEventType$1.LEFT_DRAG?(l=ScreenSpaceEventType$1.LEFT_DOWN,c=ScreenSpaceEventType$1.LEFT_UP):i===CameraEventType$1.RIGHT_DRAG?(l=ScreenSpaceEventType$1.RIGHT_DOWN,c=ScreenSpaceEventType$1.RIGHT_UP):i===CameraEventType$1.MIDDLE_DRAG&&(l=ScreenSpaceEventType$1.MIDDLE_DOWN,c=ScreenSpaceEventType$1.MIDDLE_UP),e._eventHandler.setInputAction((function(t){e._buttonsDown++,u.valid=!1,n[r]=!0,o[r]=new Date,Cartesian2.clone(t.position,a[r])}),l,t),e._eventHandler.setInputAction((function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),n[r]=!1,s[r]=new Date}),c,t)}function cloneMouseMovement(e,t){Cartesian2.clone(e.startPosition,t.startPosition),Cartesian2.clone(e.endPosition,t.endPosition)}function listenMouseMove(e,t){var i=e._update,r=e._movement,n=e._lastMovement,a=e._isDown;for(var o in CameraEventType$1)if(CameraEventType$1.hasOwnProperty(o)){var s=CameraEventType$1[o];if(defined(s)){var l=getKey$1(s,t);i[l]=!0,defined(e._lastMovement[l])||(e._lastMovement[l]={startPosition:new Cartesian2,endPosition:new Cartesian2,valid:!1}),defined(e._movement[l])||(e._movement[l]={startPosition:new Cartesian2,endPosition:new Cartesian2})}}e._eventHandler.setInputAction((function(o){for(var s in CameraEventType$1)if(CameraEventType$1.hasOwnProperty(s)){var l=CameraEventType$1[s];if(defined(l)){var c=getKey$1(l,t);a[c]&&(i[c]?(cloneMouseMovement(r[c],n[c]),n[c].valid=!0,cloneMouseMovement(o,r[c]),i[c]=!1):Cartesian2.clone(o.endPosition,r[c].endPosition))}}Cartesian2.clone(o.endPosition,e._currentMousePosition)}),ScreenSpaceEventType$1.MOUSE_MOVE,t)}function CameraEventAggregator(e){for(var t in this._eventHandler=new ScreenSpaceEventHandler(e),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new Cartesian2,listenToWheel(this,void 0),listenToPinch(this,void 0,e),listenMouseButtonDownUp(this,void 0,CameraEventType$1.LEFT_DRAG),listenMouseButtonDownUp(this,void 0,CameraEventType$1.RIGHT_DRAG),listenMouseButtonDownUp(this,void 0,CameraEventType$1.MIDDLE_DRAG),listenMouseMove(this,void 0),KeyboardEventModifier$1)if(KeyboardEventModifier$1.hasOwnProperty(t)){var i=KeyboardEventModifier$1[t];defined(i)&&(listenToWheel(this,i),listenToPinch(this,i,e),listenMouseButtonDownUp(this,i,CameraEventType$1.LEFT_DRAG),listenMouseButtonDownUp(this,i,CameraEventType$1.RIGHT_DRAG),listenMouseButtonDownUp(this,i,CameraEventType$1.MIDDLE_DRAG),listenMouseMove(this,i))}}function Cesium3DTileContent(){this.featurePropertiesDirty=!1}function Cesium3DTilePassState(e){this.pass=e.pass,this.commandList=e.commandList,this.camera=e.camera,this.cullingVolume=e.cullingVolume,this.ready=!1}function ConditionsExpression(e,t){this._conditionsExpression=clone$1(e,!0),this._conditions=e.conditions,this._runtimeConditions=void 0,setRuntime(this,t)}function Statement(e,t){this.condition=e,this.expression=t}function setRuntime(e,t){var i=[],r=e._conditions;if(defined(r)){for(var n=r.length,a=0;a<n;++a){var o=r[a],s=String(o[0]),l=String(o[1]);i.push(new Statement(new Expression(s,t),new Expression(l,t)))}e._runtimeConditions=i}}function Cesium3DTileStyle(e){var t;(this._style={},this._ready=!1,this._show=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._labelColor=void 0,this._labelOutlineColor=void 0,this._labelOutlineWidth=void 0,this._font=void 0,this._labelStyle=void 0,this._labelText=void 0,this._backgroundColor=void 0,this._backgroundPadding=void 0,this._backgroundEnabled=void 0,this._scaleByDistance=void 0,this._translucencyByDistance=void 0,this._distanceDisplayCondition=void 0,this._heightOffset=void 0,this._anchorLineEnabled=void 0,this._anchorLineColor=void 0,this._image=void 0,this._disableDepthTestDistance=void 0,this._horizontalOrigin=void 0,this._verticalOrigin=void 0,this._labelHorizontalOrigin=void 0,this._labelVerticalOrigin=void 0,this._meta=void 0,this._colorShaderFunction=void 0,this._showShaderFunction=void 0,this._pointSizeShaderFunction=void 0,this._colorShaderFunctionReady=!1,this._showShaderFunctionReady=!1,this._pointSizeShaderFunctionReady=!1,this._colorShaderTranslucent=!1,"string"==typeof e||e instanceof Resource)?t=Resource.createIfNeeded(e).fetchJson(e):t=when.resolve(e);var i=this;this._readyPromise=t.then((function(e){return setup(i,e),i}))}function setup(e,t){t=defaultValue(clone$1(t,!0),e._style),e._style=t,e.show=t.show,e.color=t.color,e.pointSize=t.pointSize,e.pointOutlineColor=t.pointOutlineColor,e.pointOutlineWidth=t.pointOutlineWidth,e.labelColor=t.labelColor,e.labelOutlineColor=t.labelOutlineColor,e.labelOutlineWidth=t.labelOutlineWidth,e.labelStyle=t.labelStyle,e.font=t.font,e.labelText=t.labelText,e.backgroundColor=t.backgroundColor,e.backgroundPadding=t.backgroundPadding,e.backgroundEnabled=t.backgroundEnabled,e.scaleByDistance=t.scaleByDistance,e.translucencyByDistance=t.translucencyByDistance,e.distanceDisplayCondition=t.distanceDisplayCondition,e.heightOffset=t.heightOffset,e.anchorLineEnabled=t.anchorLineEnabled,e.anchorLineColor=t.anchorLineColor,e.image=t.image,e.disableDepthTestDistance=t.disableDepthTestDistance,e.horizontalOrigin=t.horizontalOrigin,e.verticalOrigin=t.verticalOrigin,e.labelHorizontalOrigin=t.labelHorizontalOrigin,e.labelVerticalOrigin=t.labelVerticalOrigin;var i={};if(defined(t.meta)){var r=t.defines,n=defaultValue(t.meta,defaultValue.EMPTY_OBJECT);for(var a in n)n.hasOwnProperty(a)&&(i[a]=new Expression(n[a],r))}e._meta=i,e._ready=!0}function getExpression(e,t){var i=defaultValue(e._style,defaultValue.EMPTY_OBJECT).defines;if(defined(t))return"boolean"==typeof t||"number"==typeof t?new Expression(String(t)):"string"==typeof t?new Expression(t,i):defined(t.conditions)?new ConditionsExpression(t,i):t}function getJsonFromExpression(e){if(defined(e))return defined(e.expression)?e.expression:defined(e.conditionsExpression)?clone$1(e.conditionsExpression,!0):e}function CircleEmitter(e){e=defaultValue(e,1),this._radius=defaultValue(e,1)}Object.defineProperties(CameraEventAggregator.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){var e=!(this._update[getKey$1(CameraEventType$1.WHEEL)]&&this._update[getKey$1(CameraEventType$1.WHEEL,KeyboardEventModifier$1.SHIFT)]&&this._update[getKey$1(CameraEventType$1.WHEEL,KeyboardEventModifier$1.CTRL)]&&this._update[getKey$1(CameraEventType$1.WHEEL,KeyboardEventModifier$1.ALT)]);return this._buttonsDown>0||e}}}),CameraEventAggregator.prototype.isMoving=function(e,t){var i=getKey$1(e,t);return!this._update[i]},CameraEventAggregator.prototype.getMovement=function(e,t){var i=getKey$1(e,t);return this._movement[i]},CameraEventAggregator.prototype.getLastMovement=function(e,t){var i=getKey$1(e,t),r=this._lastMovement[i];if(r.valid)return r},CameraEventAggregator.prototype.isButtonDown=function(e,t){var i=getKey$1(e,t);return this._isDown[i]},CameraEventAggregator.prototype.getStartMousePosition=function(e,t){if(e===CameraEventType$1.WHEEL)return this._currentMousePosition;var i=getKey$1(e,t);return this._eventStartPosition[i]},CameraEventAggregator.prototype.getButtonPressTime=function(e,t){var i=getKey$1(e,t);return this._pressTime[i]},CameraEventAggregator.prototype.getButtonReleaseTime=function(e,t){var i=getKey$1(e,t);return this._releaseTime[i]},CameraEventAggregator.prototype.reset=function(){for(var e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)},CameraEventAggregator.prototype.isDestroyed=function(){return!1},CameraEventAggregator.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),destroyObject(this)},Object.defineProperties(Cesium3DTileContent.prototype,{featuresLength:{get:function(){DeveloperError.throwInstantiationError()}},pointsLength:{get:function(){DeveloperError.throwInstantiationError()}},trianglesLength:{get:function(){DeveloperError.throwInstantiationError()}},geometryByteLength:{get:function(){DeveloperError.throwInstantiationError()}},texturesByteLength:{get:function(){DeveloperError.throwInstantiationError()}},batchTableByteLength:{get:function(){DeveloperError.throwInstantiationError()}},innerContents:{get:function(){DeveloperError.throwInstantiationError()}},readyPromise:{get:function(){DeveloperError.throwInstantiationError()}},tileset:{get:function(){DeveloperError.throwInstantiationError()}},tile:{get:function(){DeveloperError.throwInstantiationError()}},url:{get:function(){DeveloperError.throwInstantiationError()}},batchTable:{get:function(){DeveloperError.throwInstantiationError()}},groupMetadata:{get:function(){DeveloperError.throwInstantiationError()},set:function(e){DeveloperError.throwInstantiationError()}}}),Cesium3DTileContent.prototype.hasProperty=function(e,t){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.getFeature=function(e){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.applyDebugSettings=function(e,t){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.applyStyle=function(e){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.update=function(e,t){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.isDestroyed=function(){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.destroy=function(){DeveloperError.throwInstantiationError()},Object.defineProperties(ConditionsExpression.prototype,{conditionsExpression:{get:function(){return this._conditionsExpression}}}),ConditionsExpression.prototype.evaluate=function(e,t){var i=this._runtimeConditions;if(defined(i))for(var r=i.length,n=0;n<r;++n){var a=i[n];if(a.condition.evaluate(e))return a.expression.evaluate(e,t)}},ConditionsExpression.prototype.evaluateColor=function(e,t){var i=this._runtimeConditions;if(defined(i))for(var r=i.length,n=0;n<r;++n){var a=i[n];if(a.condition.evaluate(e))return a.expression.evaluateColor(e,t)}},ConditionsExpression.prototype.getShaderFunction=function(e,t,i,r){var n=this._runtimeConditions;if(defined(n)&&0!==n.length){for(var a="",o=n.length,s=0;s<o;++s){var l=n[s];a+=" "+(0===s?"if":"else if")+" ("+l.condition.getShaderExpression(t,i)+")\n {\n return "+l.expression.getShaderExpression(t,i)+";\n }\n"}return a=r+" "+e+"\n{\n"+a+" return "+r+"(1.0);\n}\n"}},ConditionsExpression.prototype.getVariables=function(){var e=[],t=this._runtimeConditions;if(!defined(t)||0===t.length)return e;for(var i=t.length,r=0;r<i;++r){var n=t[r];e.push.apply(e,n.condition.getVariables()),e.push.apply(e,n.expression.getVariables())}return e=e.filter((function(e,t,i){return i.indexOf(e)===t})),e},Object.defineProperties(Cesium3DTileStyle.prototype,{style:{get:function(){return this._style}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},show:{get:function(){return this._show},set:function(e){this._show=getExpression(this,e),this._style.show=getJsonFromExpression(this._show),this._showShaderFunctionReady=!1}},color:{get:function(){return this._color},set:function(e){this._color=getExpression(this,e),this._style.color=getJsonFromExpression(this._color),this._colorShaderFunctionReady=!1}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=getExpression(this,e),this._style.pointSize=getJsonFromExpression(this._pointSize),this._pointSizeShaderFunctionReady=!1}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=getExpression(this,e),this._style.pointOutlineColor=getJsonFromExpression(this._pointOutlineColor)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=getExpression(this,e),this._style.pointOutlineWidth=getJsonFromExpression(this._pointOutlineWidth)}},labelColor:{get:function(){return this._labelColor},set:function(e){this._labelColor=getExpression(this,e),this._style.labelColor=getJsonFromExpression(this._labelColor)}},labelOutlineColor:{get:function(){return this._labelOutlineColor},set:function(e){this._labelOutlineColor=getExpression(this,e),this._style.labelOutlineColor=getJsonFromExpression(this._labelOutlineColor)}},labelOutlineWidth:{get:function(){return this._labelOutlineWidth},set:function(e){this._labelOutlineWidth=getExpression(this,e),this._style.labelOutlineWidth=getJsonFromExpression(this._labelOutlineWidth)}},font:{get:function(){return this._font},set:function(e){this._font=getExpression(this,e),this._style.font=getJsonFromExpression(this._font)}},labelStyle:{get:function(){return this._labelStyle},set:function(e){this._labelStyle=getExpression(this,e),this._style.labelStyle=getJsonFromExpression(this._labelStyle)}},labelText:{get:function(){return this._labelText},set:function(e){this._labelText=getExpression(this,e),this._style.labelText=getJsonFromExpression(this._labelText)}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=getExpression(this,e),this._style.backgroundColor=getJsonFromExpression(this._backgroundColor)}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){this._backgroundPadding=getExpression(this,e),this._style.backgroundPadding=getJsonFromExpression(this._backgroundPadding)}},backgroundEnabled:{get:function(){return this._backgroundEnabled},set:function(e){this._backgroundEnabled=getExpression(this,e),this._style.backgroundEnabled=getJsonFromExpression(this._backgroundEnabled)}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){this._scaleByDistance=getExpression(this,e),this._style.scaleByDistance=getJsonFromExpression(this._scaleByDistance)}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){this._translucencyByDistance=getExpression(this,e),this._style.translucencyByDistance=getJsonFromExpression(this._translucencyByDistance)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){this._distanceDisplayCondition=getExpression(this,e),this._style.distanceDisplayCondition=getJsonFromExpression(this._distanceDisplayCondition)}},heightOffset:{get:function(){return this._heightOffset},set:function(e){this._heightOffset=getExpression(this,e),this._style.heightOffset=getJsonFromExpression(this._heightOffset)}},anchorLineEnabled:{get:function(){return this._anchorLineEnabled},set:function(e){this._anchorLineEnabled=getExpression(this,e),this._style.anchorLineEnabled=getJsonFromExpression(this._anchorLineEnabled)}},anchorLineColor:{get:function(){return this._anchorLineColor},set:function(e){this._anchorLineColor=getExpression(this,e),this._style.anchorLineColor=getJsonFromExpression(this._anchorLineColor)}},image:{get:function(){return this._image},set:function(e){this._image=getExpression(this,e),this._style.image=getJsonFromExpression(this._image)}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance=getExpression(this,e),this._style.disableDepthTestDistance=getJsonFromExpression(this._disableDepthTestDistance)}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin=getExpression(this,e),this._style.horizontalOrigin=getJsonFromExpression(this._horizontalOrigin)}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){this._verticalOrigin=getExpression(this,e),this._style.verticalOrigin=getJsonFromExpression(this._verticalOrigin)}},labelHorizontalOrigin:{get:function(){return this._labelHorizontalOrigin},set:function(e){this._labelHorizontalOrigin=getExpression(this,e),this._style.labelHorizontalOrigin=getJsonFromExpression(this._labelHorizontalOrigin)}},labelVerticalOrigin:{get:function(){return this._labelVerticalOrigin},set:function(e){this._labelVerticalOrigin=getExpression(this,e),this._style.labelVerticalOrigin=getJsonFromExpression(this._labelVerticalOrigin)}},meta:{get:function(){return this._meta},set:function(e){this._meta=e}}}),Cesium3DTileStyle.prototype.getColorShaderFunction=function(e,t,i){return this._colorShaderFunctionReady?(i.translucent=this._colorShaderTranslucent,this._colorShaderFunction):(this._colorShaderFunctionReady=!0,defined(this.color)&&defined(this.color.getShaderFunction)?this._colorShaderFunction=this.color.getShaderFunction(e,t,i,"vec4"):this._colorShaderFunction=void 0,this._colorShaderTranslucent=i.translucent,this._colorShaderFunction)},Cesium3DTileStyle.prototype.getShowShaderFunction=function(e,t,i){return this._showShaderFunctionReady||(this._showShaderFunctionReady=!0,defined(this.show)&&defined(this.show.getShaderFunction)?this._showShaderFunction=this.show.getShaderFunction(e,t,i,"bool"):this._showShaderFunction=void 0),this._showShaderFunction},Cesium3DTileStyle.prototype.getPointSizeShaderFunction=function(e,t,i){return this._pointSizeShaderFunctionReady||(this._pointSizeShaderFunctionReady=!0,defined(this.pointSize)&&defined(this.pointSize.getShaderFunction)?this._pointSizeShaderFunction=this.pointSize.getShaderFunction(e,t,i,"float"):this._pointSizeShaderFunction=void 0),this._pointSizeShaderFunction},Cesium3DTileStyle.prototype.getVariables=function(){var e=[];return defined(this.color)&&defined(this.color.getVariables)&&e.push.apply(e,this.color.getVariables()),defined(this.show)&&defined(this.show.getVariables)&&e.push.apply(e,this.show.getVariables()),defined(this.pointSize)&&defined(this.pointSize.getVariables)&&e.push.apply(e,this.pointSize.getVariables()),e=e.filter((function(e,t,i){return i.indexOf(e)===t})),e},Object.defineProperties(CircleEmitter.prototype,{radius:{get:function(){return this._radius},set:function(e){this._radius=e}}}),CircleEmitter.prototype.emit=function(e){var t=CesiumMath.randomBetween(0,CesiumMath.TWO_PI),i=CesiumMath.randomBetween(0,this._radius),r=i*Math.cos(t),n=i*Math.sin(t);e.position=Cartesian3.fromElements(r,n,0,e.position),e.velocity=Cartesian3.clone(Cartesian3.UNIT_Z,e.velocity)};var CloudType={CUMULUS:0,validate:function(e){return e===CloudType.CUMULUS}},CloudType$1=Object.freeze(CloudType),CloudCollectionFS="uniform sampler2D u_noiseTexture;\nuniform vec3 u_noiseTextureDimensions;\nuniform float u_noiseDetail;\nvarying vec2 v_offset;\nvarying vec3 v_maximumSize;\nvarying vec4 v_color;\nvarying float v_slice;\nvarying float v_brightness;\nfloat wrap(float value, float rangeLength) {\nif(value < 0.0) {\nfloat absValue = abs(value);\nfloat modValue = mod(absValue, rangeLength);\nreturn mod(rangeLength - modValue, rangeLength);\n}\nreturn mod(value, rangeLength);\n}\nvec3 wrapVec(vec3 value, float rangeLength) {\nreturn vec3(wrap(value.x, rangeLength),\nwrap(value.y, rangeLength),\nwrap(value.z, rangeLength));\n}\nfloat textureSliceWidth = u_noiseTextureDimensions.x;\nfloat noiseTextureRows = u_noiseTextureDimensions.y;\nfloat inverseNoiseTextureRows = u_noiseTextureDimensions.z;\nfloat textureSliceWidthSquared = textureSliceWidth * textureSliceWidth;\nvec2 inverseNoiseTextureDimensions = vec2(noiseTextureRows / textureSliceWidthSquared,\ninverseNoiseTextureRows / textureSliceWidth);\nvec2 voxelToUV(vec3 voxelIndex) {\nvec3 wrappedIndex = wrapVec(voxelIndex, textureSliceWidth);\nfloat column = mod(wrappedIndex.z, textureSliceWidth * inverseNoiseTextureRows);\nfloat row = floor(wrappedIndex.z / textureSliceWidth * noiseTextureRows);\nfloat xPixelCoord = wrappedIndex.x + column * textureSliceWidth;\nfloat yPixelCoord = wrappedIndex.y + row * textureSliceWidth;\nreturn vec2(xPixelCoord, yPixelCoord) * inverseNoiseTextureDimensions;\n}\nvec4 lerpSamplesX(vec3 voxelIndex, float x) {\nvec2 uv0 = voxelToUV(voxelIndex);\nvec2 uv1 = voxelToUV(voxelIndex + vec3(1.0, 0.0, 0.0));\nvec4 sample0 = texture2D(u_noiseTexture, uv0);\nvec4 sample1 = texture2D(u_noiseTexture, uv1);\nreturn mix(sample0, sample1, x);\n}\nvec4 sampleNoiseTexture(vec3 position) {\nvec3 recenteredPos = position + vec3(textureSliceWidth / 2.0);\nvec3 lerpValue = fract(recenteredPos);\nvec3 voxelIndex = floor(recenteredPos);\nvec4 xLerp00 = lerpSamplesX(voxelIndex, lerpValue.x);\nvec4 xLerp01 = lerpSamplesX(voxelIndex + vec3(0.0, 0.0, 1.0), lerpValue.x);\nvec4 xLerp10 = lerpSamplesX(voxelIndex + vec3(0.0, 1.0, 0.0), lerpValue.x);\nvec4 xLerp11 = lerpSamplesX(voxelIndex + vec3(0.0, 1.0, 1.0), lerpValue.x);\nvec4 yLerp0 = mix(xLerp00, xLerp10, lerpValue.y);\nvec4 yLerp1 = mix(xLerp01, xLerp11, lerpValue.y);\nreturn mix(yLerp0, yLerp1, lerpValue.z);\n}\nbool intersectSphere(vec3 origin, vec3 dir, float slice,\nout vec3 point, out vec3 normal) {\nfloat A = dot(dir, dir);\nfloat B = dot(origin, dir);\nfloat C = dot(origin, origin) - 0.25;\nfloat discriminant = (B * B) - (A * C);\nif(discriminant < 0.0) {\nreturn false;\n}\nfloat root = sqrt(discriminant);\nfloat t = (-B - root) / A;\nif(t < 0.0) {\nt = (-B + root) / A;\n}\npoint = origin + t * dir;\nif(slice >= 0.0) {\npoint.z = (slice / 2.0) - 0.5;\nif(length(point) > 0.5) {\nreturn false;\n}\n}\nnormal = normalize(point);\npoint -= czm_epsilon2 * normal;\nreturn true;\n}\nbool intersectEllipsoid(vec3 origin, vec3 dir, vec3 center, vec3 scale, float slice,\nout vec3 point, out vec3 normal) {\nif(scale.x <= 0.01 || scale.y < 0.01 || scale.z < 0.01) {\nreturn false;\n}\nvec3 o = (origin - center) / scale;\nvec3 d = dir / scale;\nvec3 p, n;\nbool intersected = intersectSphere(o, d, slice, p, n);\nif(intersected) {\npoint = (p * scale) + center;\nnormal = n;\n}\nreturn intersected;\n}\nvec2 phaseShift2D(vec2 p, vec2 freq) {\nreturn (czm_pi / 2.0) * sin(freq.yx * p.yx);\n}\nvec2 phaseShift3D(vec3 p, vec2 freq) {\nreturn phaseShift2D(p.xy, freq) + czm_pi * vec2(sin(freq.x * p.z));\n}\nconst float T0 = 0.6;\nconst float k = 0.1;\nconst float C0 = 0.8;\nconst float FX0 = 0.6;\nconst float FY0 = 0.6;\nconst int octaves = 5;\nfloat T(vec3 point) {\nvec2 sum = vec2(0.0);\nfloat Ci = C0;\nvec2 FXY = vec2(FX0, FY0);\nvec2 PXY = vec2(0.0);\nfor(int i = 1; i <= octaves; i++) {\nPXY = phaseShift3D(point, FXY);\nCi *= 0.707;\nFXY *= 2.0;\nvec2 sinTerm = sin(FXY * point.xy + PXY);\nsum += Ci * sinTerm + vec2(T0);\n}\nreturn k * sum.x * sum.y;\n}\nconst float a = 0.5;\nconst float t = 0.4;\nconst float s = 0.25;\nfloat I(float Id, float Is, float It) {\nreturn (1.0 - a) * ((1.0 - t) * ((1.0 - s) * Id + s * Is) + t * It) + a;\n}\nconst vec3 lightDir = normalize(vec3(0.2, -1.0, 0.7));\nvec4 drawCloud(vec3 rayOrigin, vec3 rayDir, vec3 cloudCenter, vec3 cloudScale, float cloudSlice,\nfloat brightness) {\nvec3 cloudPoint, cloudNormal;\nif(!intersectEllipsoid(rayOrigin, rayDir, cloudCenter, cloudScale, cloudSlice,\ncloudPoint, cloudNormal)) {\nreturn vec4(0.0);\n}\nfloat Id = clamp(dot(cloudNormal, -lightDir), 0.0, 1.0);\nfloat Is = max(pow(dot(-lightDir, -rayDir), 2.0), 0.0);\nfloat It = T(cloudPoint);\nfloat intensity = I(Id, Is, It);\nvec3 color = vec3(intensity * clamp(brightness, 0.1, 1.0));\nvec4 noise = sampleNoiseTexture(u_noiseDetail * cloudPoint);\nfloat W = noise.x;\nfloat W2 = noise.y;\nfloat W3 = noise.z;\nfloat ndDot = clamp(dot(cloudNormal, -rayDir), 0.0, 1.0);\nfloat TR = pow(ndDot, 3.0) - W;\nTR *= 1.3;\nfloat minusDot = 0.5 - ndDot;\nTR -= min(minusDot * W2, 0.0);\nTR -= 0.8 * (minusDot + 0.25) * W3;\nfloat shading = mix(1.0 - 0.8 * W * W, 1.0, Id * TR);\nshading = clamp(shading + 0.2, 0.3, 1.0);\nvec3 finalColor = mix(vec3(0.5), shading * color, 1.15);\nreturn vec4(finalColor, clamp(TR, 0.0, 1.0)) * v_color;\n}\nvoid main() {\n#ifdef DEBUG_BILLBOARDS\ngl_FragColor = vec4(0.0, 0.5, 0.5, 1.0);\n#endif\nvec2 coordinate = v_maximumSize.xy * v_offset;\nvec3 ellipsoidScale = 0.82 * v_maximumSize;\nvec3 ellipsoidCenter = vec3(0.0);\nfloat zOffset = max(ellipsoidScale.z - 10.0, 0.0);\nvec3 eye = vec3(0, 0, -10.0 - zOffset);\nvec3 rayDir = normalize(vec3(coordinate, 1.0) - eye);\nvec3 rayOrigin = eye;\n#ifdef DEBUG_ELLIPSOIDS\nvec3 point, normal;\nif(intersectEllipsoid(rayOrigin, rayDir, ellipsoidCenter, ellipsoidScale, v_slice,\npoint, normal)) {\ngl_FragColor = v_brightness * v_color;\n}\n#else\n#ifndef DEBUG_BILLBOARDS\nvec4 cloud = drawCloud(rayOrigin, rayDir,\nellipsoidCenter, ellipsoidScale, v_slice, v_brightness);\nif(cloud.w < 0.01) {\ndiscard;\n}\ngl_FragColor = cloud;\n#endif\n#endif\n}\n",CloudCollectionVS="#ifdef INSTANCED\nattribute vec2 direction;\n#endif\nattribute vec4 positionHighAndScaleX;\nattribute vec4 positionLowAndScaleY;\nattribute vec4 packedAttribute0;\nattribute vec4 packedAttribute1;\nattribute vec4 color;\nvarying vec2 v_offset;\nvarying vec3 v_maximumSize;\nvarying vec4 v_color;\nvarying float v_slice;\nvarying float v_brightness;\nvoid main() {\nvec3 positionHigh = positionHighAndScaleX.xyz;\nvec3 positionLow = positionLowAndScaleY.xyz;\nvec2 scale = vec2(positionHighAndScaleX.w, positionLowAndScaleY.w);\nfloat show = packedAttribute0.x;\nfloat brightness = packedAttribute0.y;\nvec2 coordinates = packedAttribute0.wz;\nvec3 maximumSize = packedAttribute1.xyz;\nfloat slice = packedAttribute1.w;\n#ifdef INSTANCED\nvec2 dir = direction;\n#else\nvec2 dir = coordinates;\n#endif\nvec2 offset = dir - vec2(0.5, 0.5);\nvec2 scaledOffset = scale * offset;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\npositionEC.xy += scaledOffset;\npositionEC.xyz *= show;\ngl_Position = czm_projection * positionEC;\nv_offset = offset;\nv_maximumSize = maximumSize;\nv_color = color;\nv_slice = slice;\nv_brightness = brightness;\n}\n",CloudNoiseFS="uniform vec3 u_noiseTextureDimensions;\nuniform float u_noiseDetail;\nuniform vec3 u_noiseOffset;\nvarying vec2 v_position;\nfloat textureSliceWidth = u_noiseTextureDimensions.x;\nfloat inverseNoiseTextureRows = u_noiseTextureDimensions.z;\nfloat wrap(float value, float rangeLength) {\nif(value < 0.0) {\nfloat absValue = abs(value);\nfloat modValue = mod(absValue, rangeLength);\nreturn mod(rangeLength - modValue, rangeLength);\n}\nreturn mod(value, rangeLength);\n}\nvec3 wrapVec(vec3 value, float rangeLength) {\nreturn vec3(wrap(value.x, rangeLength),\nwrap(value.y, rangeLength),\nwrap(value.z, rangeLength));\n}\nvec3 random3(vec3 p) {\nfloat dot1 = dot(p, vec3(127.1, 311.7, 932.8));\nfloat dot2 = dot(p, vec3(269.5, 183.3, 421.4));\nreturn fract(vec3(sin(dot1 - dot2), cos(dot1 * dot2), dot1 * dot2));\n}\nvec3 getWorleyCellPoint(vec3 centerCell, vec3 offset, float freq) {\nvec3 cell = centerCell + offset;\ncell = wrapVec(cell, textureSliceWidth / u_noiseDetail);\ncell += floor(u_noiseOffset / u_noiseDetail);\nvec3 p = offset + random3(cell);\nreturn p;\n}\nfloat worleyNoise(vec3 p, float freq) {\nvec3 centerCell = floor(p * freq);\nvec3 pointInCell = fract(p * freq);\nfloat shortestDistance = 1000.0;\nfor(float z = -1.0; z <= 1.0; z++) {\nfor(float y = -1.0; y <= 1.0; y++) {\nfor(float x = -1.0; x <= 1.0; x++) {\nvec3 offset = vec3(x, y, z);\nvec3 point = getWorleyCellPoint(centerCell, offset, freq);\nfloat distance = length(pointInCell - point);\nif(distance < shortestDistance) {\nshortestDistance = distance;\n}\n}\n}\n}\nreturn shortestDistance;\n}\nconst float MAX_FBM_ITERATIONS = 10.0;\nfloat worleyFBMNoise(vec3 p, float octaves, float scale) {\nfloat noise = 0.0;\nfloat freq = 1.0;\nfloat persistence = 0.625;\nfor(float i = 0.0; i < MAX_FBM_ITERATIONS; i++) {\nif(i >= octaves) {\nbreak;\n}\nnoise += worleyNoise(p * scale, freq * scale) * persistence;\npersistence *= 0.5;\nfreq *= 2.0;\n}\nreturn noise;\n}\nvoid main() {\nfloat x = mod(v_position.x, textureSliceWidth);\nfloat y = mod(v_position.y, textureSliceWidth);\nfloat sliceRow = floor(v_position.y / textureSliceWidth);\nfloat z = floor(v_position.x / textureSliceWidth) + sliceRow * inverseNoiseTextureRows * textureSliceWidth;\nvec3 position = vec3(x, y, z);\nposition /= u_noiseDetail;\nfloat worley0 = clamp(worleyFBMNoise(position, 3.0, 1.0), 0.0, 1.0);\nfloat worley1 = clamp(worleyFBMNoise(position, 3.0, 2.0), 0.0, 1.0);\nfloat worley2 = clamp(worleyFBMNoise(position, 3.0, 3.0), 0.0, 1.0);\ngl_FragColor = vec4(worley0, worley1, worley2, 1.0);\n}\n",CloudNoiseVS="uniform vec3 u_noiseTextureDimensions;\nattribute vec2 position;\nvarying vec2 v_position;\nvoid main()\n{\ngl_Position = vec4(position, 0.1, 1.0);\nfloat textureSliceWidth = u_noiseTextureDimensions.x;\nfloat noiseTextureRows = u_noiseTextureDimensions.y;\nfloat inverseNoiseTextureRows = u_noiseTextureDimensions.z;\nvec2 transformedPos = (position * 0.5) + vec2(0.5);\ntransformedPos *= textureSliceWidth;\ntransformedPos.x *= textureSliceWidth * inverseNoiseTextureRows;\ntransformedPos.y *= noiseTextureRows;\nv_position = transformedPos;\n}\n";function CumulusCloud(e,t){if(e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._show=defaultValue(e.show,!0),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),!defined(e.scale)&&defined(e.maximumSize))this._maximumSize=Cartesian3.clone(e.maximumSize),this._scale=new Cartesian2(this._maximumSize.x,this._maximumSize.y);else{this._scale=Cartesian2.clone(defaultValue(e.scale,new Cartesian2(20,12)));var i=new Cartesian3(this._scale.x,this._scale.y,Math.min(this._scale.x,this._scale.y)/1.5);this._maximumSize=Cartesian3.clone(defaultValue(e.maximumSize,i))}this._slice=defaultValue(e.slice,-1),this._color=Color.clone(defaultValue(e.color,Color.WHITE)),this._brightness=defaultValue(e.brightness,1),this._cloudCollection=t,this._index=-1}var SHOW_INDEX$1=CumulusCloud.SHOW_INDEX=0,POSITION_INDEX$1=CumulusCloud.POSITION_INDEX=1,SCALE_INDEX$1=CumulusCloud.SCALE_INDEX=2,MAXIMUM_SIZE_INDEX$1=CumulusCloud.MAXIMUM_SIZE_INDEX=3,SLICE_INDEX$1=CumulusCloud.SLICE_INDEX=4,BRIGHTNESS_INDEX$1=CumulusCloud.BRIGHTNESS_INDEX=5,COLOR_INDEX$1=CumulusCloud.COLOR_INDEX=6,attributeLocations$1;function makeDirty(e,t){var i=e._cloudCollection;defined(i)&&(i._updateCloud(e,t),e._dirty=!0)}CumulusCloud.NUMBER_OF_PROPERTIES=7,Object.defineProperties(CumulusCloud.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,makeDirty(this,SHOW_INDEX$1))}},position:{get:function(){return this._position},set:function(e){var t=this._position;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty(this,POSITION_INDEX$1))}},scale:{get:function(){return this._scale},set:function(e){var t=this._scale;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),makeDirty(this,SCALE_INDEX$1))}},maximumSize:{get:function(){return this._maximumSize},set:function(e){var t=this._maximumSize;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty(this,MAXIMUM_SIZE_INDEX$1))}},color:{get:function(){return this._color},set:function(e){var t=this._color;Color.equals(t,e)||(Color.clone(e,t),makeDirty(this,COLOR_INDEX$1))}},slice:{get:function(){return this._slice},set:function(e){this._slice!==e&&(this._slice=e,makeDirty(this,SLICE_INDEX$1))}},brightness:{get:function(){return this._brightness},set:function(e){this._brightness!==e&&(this._brightness=e,makeDirty(this,BRIGHTNESS_INDEX$1))}}}),CumulusCloud.prototype._destroy=function(){this._cloudCollection=void 0};var scratchTextureDimensions=new Cartesian3,attributeLocationsBatched={positionHighAndScaleX:0,positionLowAndScaleY:1,packedAttribute0:2,packedAttribute1:3,color:4},attributeLocationsInstanced={direction:0,positionHighAndScaleX:1,positionLowAndScaleY:2,packedAttribute0:3,packedAttribute1:4,color:5},SHOW_INDEX=CumulusCloud.SHOW_INDEX,POSITION_INDEX=CumulusCloud.POSITION_INDEX,SCALE_INDEX=CumulusCloud.SCALE_INDEX,MAXIMUM_SIZE_INDEX=CumulusCloud.MAXIMUM_SIZE_INDEX,SLICE_INDEX=CumulusCloud.SLICE_INDEX,BRIGHTNESS_INDEX=CumulusCloud.BRIGHTNESS_INDEX,NUMBER_OF_PROPERTIES=CumulusCloud.NUMBER_OF_PROPERTIES,COLOR_INDEX=CumulusCloud.COLOR_INDEX;function CloudCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES),this._noiseTexture=void 0,this._textureSliceWidth=128,this._noiseTextureRows=4,this.noiseDetail=defaultValue(e.noiseDetail,16),this.noiseOffset=Cartesian3.clone(defaultValue(e.noiseOffset,Cartesian3.ZERO)),this._loading=!1,this._ready=!1;var t=this;this._uniforms={u_noiseTexture:function(){return t._noiseTexture},u_noiseTextureDimensions:getNoiseTextureDimensions(t),u_noiseDetail:function(){return t.noiseDetail}},this._vaNoise=void 0,this._spNoise=void 0,this._spCreated=!1,this._sp=void 0,this._rs=void 0,this.show=defaultValue(e.show,!0),this._colorCommands=[],this.debugBillboards=defaultValue(e.debugBillboards,!1),this._compiledDebugBillboards=!1,this.debugEllipsoids=defaultValue(e.debugEllipsoids,!1),this._compiledDebugEllipsoids=!1}function getNoiseTextureDimensions(e){return function(){return scratchTextureDimensions.x=e._textureSliceWidth,scratchTextureDimensions.y=e._noiseTextureRows,scratchTextureDimensions.z=1/e._noiseTextureRows,scratchTextureDimensions}}function destroyClouds(e){for(var t=e.length,i=0;i<t;++i)e[i]&&e[i]._destroy()}function removeClouds(e){if(e._cloudsRemoved){e._cloudsRemoved=!1;for(var t=[],i=e._clouds,r=i.length,n=0,a=0;n<r;++n){var o=i[n];defined(o)&&(i._index=a++,t.push(o))}e._clouds=t}}Object.defineProperties(CloudCollection.prototype,{length:{get:function(){return removeClouds(this),this._clouds.length}}}),CloudCollection.prototype.add=function(e){var t;return e=defaultValue(e,defaultValue.EMPTY_OBJECT),defaultValue(e.cloudType,CloudType$1.CUMULUS)===CloudType$1.CUMULUS&&((t=new CumulusCloud(e,this))._index=this._clouds.length,this._clouds.push(t),this._createVertexArray=!0),t},CloudCollection.prototype.remove=function(e){return!!this.contains(e)&&(this._clouds[e._index]=void 0,this._cloudsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},CloudCollection.prototype.removeAll=function(){destroyClouds(this._clouds),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!0},CloudCollection.prototype._updateCloud=function(e,t){e._dirty||(this._cloudsToUpdate[this._cloudsToUpdateIndex++]=e),++this._propertiesChanged[t]},CloudCollection.prototype.contains=function(e){return defined(e)&&e._cloudCollection===this},CloudCollection.prototype.get=function(e){return removeClouds(this),this._clouds[e]};var texturePositions=new Float32Array([-1,-1,1,-1,1,1,-1,1]),textureIndices=new Uint16Array([0,1,2,0,2,3]),getIndexBuffer;function createTextureVA(e){var t=Buffer$1.createVertexBuffer({context:e,typedArray:texturePositions,usage:BufferUsage$1.STATIC_DRAW}),i=Buffer$1.createIndexBuffer({context:e,typedArray:textureIndices,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});return new VertexArray({context:e,attributes:[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT}],indexBuffer:i})}function getIndexBufferBatched(e){var t=e.cache.cloudCollection_indexBufferBatched;if(defined(t))return t;for(var i=new Uint16Array(98298),r=0,n=0;r<98298;r+=6,n+=4)i[r]=n,i[r+1]=n+1,i[r+2]=n+2,i[r+3]=n,i[r+4]=n+2,i[r+5]=n+3;return(t=Buffer$1.createIndexBuffer({context:e,typedArray:i,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT})).vertexArrayDestroyable=!1,e.cache.cloudCollection_indexBufferBatched=t,t}function getIndexBufferInstanced(e){var t=e.cache.cloudCollection_indexBufferInstanced;return defined(t)||((t=Buffer$1.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT})).vertexArrayDestroyable=!1,e.cache.cloudCollection_indexBufferInstanced=t),t}function getVertexBufferInstanced(e){var t=e.cache.cloudCollection_vertexBufferInstanced;return defined(t)||((t=Buffer$1.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:BufferUsage$1.STATIC_DRAW})).vertexArrayDestroyable=!1,e.cache.cloudCollection_vertexBufferInstanced=t),t}function createVAF(e,t,i){var r=[{index:attributeLocations$1.positionHighAndScaleX,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:BufferUsage$1.STATIC_DRAW},{index:attributeLocations$1.positionLowAndScaleY,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:BufferUsage$1.STATIC_DRAW},{index:attributeLocations$1.packedAttribute0,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:BufferUsage$1.STATIC_DRAW},{index:attributeLocations$1.packedAttribute1,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:BufferUsage$1.STATIC_DRAW},{index:attributeLocations$1.color,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,usage:BufferUsage$1.STATIC_DRAW}];return i&&r.push({index:attributeLocations$1.direction,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT,vertexBuffer:getVertexBufferInstanced(e)}),new VertexArrayFacade(e,r,i?t:4*t,i)}var writePositionScratch=new EncodedCartesian3;function writePositionAndScale(e,t,i,r){var n,a=i[attributeLocations$1.positionHighAndScaleX],o=i[attributeLocations$1.positionLowAndScaleY],s=r.position;EncodedCartesian3.fromCartesian(s,writePositionScratch);var l=r.scale,c=writePositionScratch.high,u=writePositionScratch.low;e._instanced?(a(n=r._index,c.x,c.y,c.z,l.x),o(n,u.x,u.y,u.z,l.y)):(a((n=4*r._index)+0,c.x,c.y,c.z,l.x),a(n+1,c.x,c.y,c.z,l.x),a(n+2,c.x,c.y,c.z,l.x),a(n+3,c.x,c.y,c.z,l.x),o(n+0,u.x,u.y,u.z,l.y),o(n+1,u.x,u.y,u.z,l.y),o(n+2,u.x,u.y,u.z,l.y),o(n+3,u.x,u.y,u.z,l.y))}function writePackedAttribute0(e,t,i,r){var n,a=i[attributeLocations$1.packedAttribute0],o=r.show,s=r.brightness;e._instanced?a(n=r._index,o,s,0,0):(a((n=4*r._index)+0,o,s,0,0),a(n+1,o,s,1,0),a(n+2,o,s,1,1),a(n+3,o,s,0,1))}function writePackedAttribute1(e,t,i,r){var n,a=i[attributeLocations$1.packedAttribute1],o=r.maximumSize,s=r.slice;e._instanced?a(n=r._index,o.x,o.y,o.z,s):(a((n=4*r._index)+0,o.x,o.y,o.z,s),a(n+1,o.x,o.y,o.z,s),a(n+2,o.x,o.y,o.z,s),a(n+3,o.x,o.y,o.z,s))}function writeColor(e,t,i,r){var n,a=i[attributeLocations$1.color],o=r.color,s=Color.floatToByte(o.red),l=Color.floatToByte(o.green),c=Color.floatToByte(o.blue),u=Color.floatToByte(o.alpha);e._instanced?a(n=r._index,s,l,c,u):(a((n=4*r._index)+0,s,l,c,u),a(n+1,s,l,c,u),a(n+2,s,l,c,u),a(n+3,s,l,c,u))}function writeCloud(e,t,i,r){writePositionAndScale(e,t,i,r),writePackedAttribute0(e,t,i,r),writePackedAttribute1(e,t,i,r),writeColor(e,t,i,r)}function createNoiseTexture(e,t,i,r){var n=e,a=n._textureSliceWidth,o=n._noiseTextureRows,s=t.context;n._vaNoise=createTextureVA(s),n._spNoise=ShaderProgram.fromCache({context:s,vertexShaderSource:i,fragmentShaderSource:r,attributeLocations:{position:0}});var l=n.noiseDetail,c=n.noiseOffset;n._noiseTexture=new Texture({context:s,width:a*a/o,height:a*o,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,pixelFormat:PixelFormat$1.RGBA,sampler:new Sampler({wrapS:TextureWrap$1.REPEAT,wrapT:TextureWrap$1.REPEAT,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})});var u=new ComputeCommand({vertexArray:n._vaNoise,shaderProgram:n._spNoise,outputTexture:n._noiseTexture,uniformMap:{u_noiseTextureDimensions:getNoiseTextureDimensions(n),u_noiseDetail:function(){return l},u_noiseOffset:function(){return c}},persists:!1,owner:e,postExecute:function(e){n._ready=!0,n._loading=!1}});t.commandList.push(u),n._loading=!0}function createVertexArray(e,t){var i=e,r=t.context;i._createVertexArray=!1,i._vaf=i._vaf&&i._vaf.destroy();var n=e._clouds,a=n.length;if(a>0){i._vaf=createVAF(r,a,i._instanced);var o,s=i._vaf.writers;for(o=0;o<a;++o){writeCloud(e,t,s,n[o])}i._vaf.commit(getIndexBuffer(r))}}var scratchWriterArray=[];function updateClouds(e,t){var i=t.context,r=e,n=r._clouds.length,a=r._cloudsToUpdate,o=r._cloudsToUpdateIndex,s=r._propertiesChanged,l=scratchWriterArray;l.length=0,(s[POSITION_INDEX]||s[SCALE_INDEX])&&l.push(writePositionAndScale),(s[SHOW_INDEX]||s[BRIGHTNESS_INDEX])&&l.push(writePackedAttribute0),(s[MAXIMUM_SIZE_INDEX]||s[SLICE_INDEX])&&l.push(writePackedAttribute1),s[COLOR_INDEX]&&l.push(writeColor);var c,u,d,h=l.length,p=r._vaf.writers;if(o/n>.1){for(c=0;c<o;++c)for((u=a[c])._dirty=!1,d=0;d<h;++d)l[d](e,t,p,u);r._vaf.commit(getIndexBuffer(i))}else{for(c=0;c<o;++c){for((u=a[c])._dirty=!1,d=0;d<h;++d)l[d](e,t,p,u);r._instanced?r._vaf.subCommit(u._index,1):r._vaf.subCommit(4*u._index,4)}r._vaf.endSubCommits()}r._cloudsToUpdateIndex=0}function createShaderProgram(e,t,i,r){var n=t.context,a=e,o=new ShaderSource({defines:[],sources:[i]});a._instanced&&o.defines.push("INSTANCED");var s=new ShaderSource({defines:[],sources:[r]});a.debugBillboards&&s.defines.push("DEBUG_BILLBOARDS"),a.debugEllipsoids&&s.defines.push("DEBUG_ELLIPSOIDS"),a._sp=ShaderProgram.replaceCache({context:n,shaderProgram:a._sp,vertexShaderSource:o,fragmentShaderSource:s,attributeLocations:attributeLocations$1}),a._rs=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LESS},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND}),a._spCreated=!0,a._compiledDebugBillboards=a.debugBillboards,a._compiledDebugEllipsoids=a.debugEllipsoids}function createDrawCommands(e,t){var i=e,r=t.passes,n=i._uniforms,a=t.commandList;if(r.render){var o=i._colorCommands,s=i._vaf.va,l=s.length;o.length=l;for(var c=0;c<l;c++){var u=o[c];defined(u)||(u=o[c]=new DrawCommand),u.pass=Pass$1.TRANSLUCENT,u.owner=e,u.uniformMap=n,u.count=s[c].indicesCount,u.vertexArray=s[c].va,u.shaderProgram=i._sp,u.renderState=i._rs,i._instanced&&(u.count=6,u.instanceCount=i._clouds.length),a.push(u)}}}function computeFlyToLocationForRectangle(e,t){var i,r=t.terrainProvider,n=t.mapProjection,a=n.ellipsoid,o=t.camera.getRectangleCameraCoordinates(e);return i=t.mode===SceneMode$1.SCENE3D?a.cartesianToCartographic(o):n.unproject(o),defined(r)?r.readyPromise.then((function(){if(!defined(r.availability)||t.mode===SceneMode$1.SCENE2D)return i;var n=[Rectangle.center(e),Rectangle.southeast(e),Rectangle.southwest(e),Rectangle.northeast(e),Rectangle.northwest(e)];return computeFlyToLocationForRectangle._sampleTerrainMostDetailed(r,n).then((function(e){var t=e.reduce((function(e,t){return Math.max(t.height,e)}),-Number.MAX_VALUE),r=i;return r.height+=t,r}))})):when.resolve(i)}CloudCollection.prototype.update=function(e){if(removeClouds(this),this.show){var t=this.debugBillboards||this.debugEllipsoids;this._ready=!!t||defined(this._noiseTexture),this._ready||this._loading||t||createNoiseTexture(this,e,CloudNoiseVS,CloudNoiseFS),this._instanced=e.context.instancedArrays,attributeLocations$1=this._instanced?attributeLocationsInstanced:attributeLocationsBatched,getIndexBuffer=this._instanced?getIndexBufferInstanced:getIndexBufferBatched;var i=this._clouds.length,r=this._cloudsToUpdate,n=this._cloudsToUpdateIndex;this._createVertexArray?createVertexArray(this,e):n>0&&updateClouds(this,e),n>1.5*i&&(r.length=i),!defined(this._vaf)||!defined(this._vaf.va)||!this._ready&!t||(this._spCreated&&this.debugBillboards===this._compiledDebugBillboards&&this.debugEllipsoids===this._compiledDebugEllipsoids||createShaderProgram(this,e,CloudCollectionVS,CloudCollectionFS),createDrawCommands(this,e))}},CloudCollection.prototype.isDestroyed=function(){return!1},CloudCollection.prototype.destroy=function(){return this._noiseTexture=this._noiseTexture&&this._noiseTexture.destroy(),this._sp=this._sp&&this._sp.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),destroyClouds(this._clouds),destroyObject(this)},computeFlyToLocationForRectangle._sampleTerrainMostDetailed=sampleTerrainMostDetailed;var defaultAngle=CesiumMath.toRadians(30);function ConeEmitter(e){this._angle=defaultValue(e,defaultAngle)}Object.defineProperties(ConeEmitter.prototype,{angle:{get:function(){return this._angle},set:function(e){this._angle=e}}}),ConeEmitter.prototype.emit=function(e){var t=Math.tan(this._angle),i=CesiumMath.randomBetween(0,CesiumMath.TWO_PI),r=CesiumMath.randomBetween(0,t),n=r*Math.cos(i),a=r*Math.sin(i);e.velocity=Cartesian3.fromElements(n,a,1,e.velocity),Cartesian3.normalize(e.velocity,e.velocity),e.position=Cartesian3.clone(Cartesian3.ZERO,e.position)};var scratchColor$2=new Color,scratchColorAbove=new Color,scratchColorBelow=new Color,scratchColorBlend=new Color,scratchPackedFloat=new Cartesian4,scratchColorBytes=new Uint8Array(4);function lerpEntryColor(e,t,i,r){var n=t.height===i.height?0:(e-t.height)/(i.height-t.height);return Color.lerp(t.color,i.color,n,r)}function createNewEntry(e,t){return{height:e,color:Color.clone(t)}}function removeDuplicates(e){return e=e.filter((function(e,t,i){var r=t>0,n=t<i.length-1,a=!r||e.height===i[t-1].height,o=!n||e.height===i[t+1].height;return!a||!o})),e=e.filter((function(e,t,i){var r=t>0,n=t<i.length-1,a=!!r&&Color.equals(e.color,i[t-1].color),o=!!n&&Color.equals(e.color,i[t+1].color);return!a||!o})),e=e.filter((function(e,t,i){var r=t>0,n=!!r&&Color.equals(e.color,i[t-1].color),a=!r||e.height===i[t-1].height;return!n||!a})),e}function preprocess(e){var t,i,r=[],n=e.length;for(t=0;t<n;t++){var a=e[t],o=a.entries,s=o.length,l=[];for(i=0;i<s;i++){var c=o[i],u=CesiumMath.clamp(c.height,createElevationBandMaterial._minimumHeight,createElevationBandMaterial._maximumHeight),d=Color.clone(c.color,scratchColor$2);d.red*=d.alpha,d.green*=d.alpha,d.blue*=d.alpha,l.push(createNewEntry(u,d))}var h=!0,p=!0;for(i=0;i<s-1;i++){var f=l[i+0],m=l[i+1];h=h&&f.height<=m.height,p=p&&f.height>=m.height}p?l=l.reverse():h||mergeSort(l,(function(e,t){return CesiumMath.sign(e.height-t.height)}));var g=defaultValue(a.extendDownwards,!1),_=defaultValue(a.extendUpwards,!1);1!==l.length||g||_||(g=!0,_=!0),g&&l.splice(0,0,createNewEntry(createElevationBandMaterial._minimumHeight,l[0].color)),_&&l.splice(l.length,0,createNewEntry(createElevationBandMaterial._maximumHeight,l[l.length-1].color)),l=removeDuplicates(l),r.push(l)}return r}function createLayeredEntries(e){var t,i=preprocess(e),r=[],n=[];function a(e,t){r.push(createNewEntry(e,t))}function o(e,t,i){var r=Color.multiplyByScalar(i,1-t.alpha,scratchColorBlend);a(e,r=Color.add(r,t,r))}var s=i.length;for(t=0;t<s;t++){var l=i[t],c=0,u=0;n=r,r=[];for(var d=l.length,h=n.length;c<d||u<h;){var p=c<d?l[c]:void 0,f=c>0?l[c-1]:void 0,m=c<d-1?l[c+1]:void 0,g=u<h?n[u]:void 0,_=u>0?n[u-1]:void 0,y=u<h-1?n[u+1]:void 0;if(defined(p)&&defined(g)&&p.height===g.height){var v=defined(y)&&g.height===y.height,C=!defined(_),T=!defined(y),S=defined(m)&&p.height===m.height,A=!defined(f),x=!defined(m);v?S?(o(p.height,p.color,g.color),o(p.height,m.color,y.color)):A?(a(p.height,g.color),o(p.height,p.color,y.color)):x?(o(p.height,p.color,g.color),a(p.height,y.color)):(o(p.height,p.color,g.color),o(p.height,p.color,y.color)):C?S?(a(p.height,p.color),o(p.height,m.color,g.color)):x?(a(p.height,p.color),a(p.height,g.color)):(A||a(p.height,p.color),o(p.height,p.color,g.color)):T?S?(o(p.height,p.color,g.color),a(p.height,m.color)):A?(a(p.height,g.color),a(p.height,p.color)):x?o(p.height,p.color,g.color):(o(p.height,p.color,g.color),a(p.height,p.color)):S?(o(p.height,p.color,g.color),o(p.height,m.color,g.color)):A?(a(p.height,g.color),o(p.height,p.color,g.color)):x?(o(p.height,p.color,g.color),a(p.height,g.color)):o(p.height,p.color,g.color),c+=S?2:1,u+=v?2:1}else if(defined(p)&&defined(g)&&defined(_)&&p.height<g.height){var E=lerpEntryColor(p.height,_,g,scratchColorBelow);defined(f)?defined(m)?o(p.height,p.color,E):(o(p.height,p.color,E),a(p.height,E)):(a(p.height,E),o(p.height,p.color,E)),c++}else if(defined(g)&&defined(p)&&defined(f)&&g.height<p.height){var b=lerpEntryColor(g.height,f,p,scratchColorAbove);defined(_)?defined(y)?o(g.height,b,g.color):(o(g.height,b,g.color),a(g.height,b)):(a(g.height,b),o(g.height,b,g.color)),u++}else defined(p)&&(!defined(g)||p.height<g.height)?(!defined(g)||defined(_)||defined(m)?(defined(g)||!defined(_)||defined(f)||(a(_.height,createElevationBandMaterial._emptyColor),a(p.height,createElevationBandMaterial._emptyColor)),a(p.height,p.color)):(a(p.height,p.color),a(p.height,createElevationBandMaterial._emptyColor),a(g.height,createElevationBandMaterial._emptyColor)),c++):defined(g)&&(!defined(p)||g.height<p.height)&&(a(g.height,g.color),u++)}}return removeDuplicates(r)}function createElevationBandMaterial(e){var t,i,r,n,a=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).scene,o=createLayeredEntries(e.layers),s=o.length;if(!createElevationBandMaterial._useFloatTexture(a.context))for(r=PixelDatatype$1.UNSIGNED_BYTE,n=PixelFormat$1.RGBA,i=new Uint8Array(4*s),t=0;t<s;t++)Cartesian4.packFloat(o[t].height,scratchPackedFloat),Cartesian4.pack(scratchPackedFloat,i,4*t);else for(r=PixelDatatype$1.FLOAT,n=PixelFormat$1.LUMINANCE,i=new Float32Array(s),t=0;t<s;t++)i[t]=o[t].height;var l=Texture.create({context:a.context,pixelFormat:n,pixelDatatype:r,source:{arrayBufferView:i,width:s,height:1},sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}),c=new Uint8Array(4*s);for(t=0;t<s;t++){o[t].color.toBytes(scratchColorBytes),c[4*t+0]=scratchColorBytes[0],c[4*t+1]=scratchColorBytes[1],c[4*t+2]=scratchColorBytes[2],c[4*t+3]=scratchColorBytes[3]}var u=Texture.create({context:a.context,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:c,width:s,height:1},sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})});return Material$3.fromType("ElevationBand",{heights:l,colors:u})}function createOsmBuildings(e){var t=new Cesium3DTileset(e=combine$2(e,{url:IonResource.fromAssetId(96188)})),i=e.style;defined(i)||(i=new Cesium3DTileStyle({color:"Boolean(${feature['cesium#color']}) ? color(${feature['cesium#color']}) : "+defaultValue(e.defaultColor,Color.WHITE).toCssColorString()}));return t.style=i,t}function createTangentSpaceDebugPrimitive(e){var t=[],i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).geometry;defined(i.attributes)&&defined(i.primitiveType)||(i=i.constructor.createGeometry(i));var r=i.attributes,n=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),a=defaultValue(e.length,1e4);if(defined(r.normal)&&t.push(new GeometryInstance({geometry:GeometryPipeline.createLineSegmentsForVectors(i,"normal",a),attributes:{color:new ColorGeometryInstanceAttribute(1,0,0,1)},modelMatrix:n})),defined(r.tangent)&&t.push(new GeometryInstance({geometry:GeometryPipeline.createLineSegmentsForVectors(i,"tangent",a),attributes:{color:new ColorGeometryInstanceAttribute(0,1,0,1)},modelMatrix:n})),defined(r.bitangent)&&t.push(new GeometryInstance({geometry:GeometryPipeline.createLineSegmentsForVectors(i,"bitangent",a),attributes:{color:new ColorGeometryInstanceAttribute(0,0,1,1)},modelMatrix:n})),t.length>0)return new Primitive$2({asynchronous:!1,geometryInstances:t,appearance:new PerInstanceColorAppearance({flat:!0,translucent:!1})})}createElevationBandMaterial._useFloatTexture=function(e){return e.floatingPointTexture},createElevationBandMaterial._maximumHeight=5906376425472,createElevationBandMaterial._minimumHeight=-5906376425472,createElevationBandMaterial._emptyColor=new Color(0,0,0,0);var templateRegex$1=/{[^}]+}/g,tags$1={x:xTag$1,y:yTag$1,z:zTag$1,s:sTag$1,reverseX:reverseXTag$1,reverseY:reverseYTag$1,reverseZ:reverseZTag$1,westDegrees:westDegreesTag$1,southDegrees:southDegreesTag$1,eastDegrees:eastDegreesTag$1,northDegrees:northDegreesTag$1,westProjected:westProjectedTag$1,southProjected:southProjectedTag$1,eastProjected:eastProjectedTag$1,northProjected:northProjectedTag$1,width:widthTag$1,height:heightTag$1},pickFeaturesTags$1=combine$2(tags$1,{i:iTag$1,j:jTag$1,reverseI:reverseITag$1,reverseJ:reverseJTag$1,longitudeDegrees:longitudeDegreesTag$1,latitudeDegrees:latitudeDegreesTag$1,longitudeProjected:longitudeProjectedTag$1,latitudeProjected:latitudeProjectedTag$1,format:formatTag$1});function UrlTemplateImageryProvider(e){this._errorEvent=new Event,this._resource=void 0,this._urlSchemeZeroPadding=void 0,this._pickFeaturesResource=void 0,this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._minimumLevel=void 0,this._tilingScheme=void 0,this._rectangle=void 0,this._tileDiscardPolicy=void 0,this._credit=void 0,this._hasAlphaChannel=void 0,this._readyPromise=void 0,this._tags=void 0,this._pickFeaturesTags=void 0,this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this.enablePickFeatures=!0,this.reinitialize(e)}Object.defineProperties(UrlTemplateImageryProvider.prototype,{url:{get:function(){return this._resource.url}},urlSchemeZeroPadding:{get:function(){return this._urlSchemeZeroPadding}},pickFeaturesUrl:{get:function(){return this._pickFeaturesResource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return defined(this._resource)}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return this._hasAlphaChannel}}}),UrlTemplateImageryProvider.prototype.reinitialize=function(e){var t=this;t._readyPromise=when(e).then((function(e){var i=e.customTags,r=combine$2(tags$1,i),n=combine$2(pickFeaturesTags$1,i),a=Resource.createIfNeeded(e.url),o=Resource.createIfNeeded(e.pickFeaturesUrl);t.enablePickFeatures=defaultValue(e.enablePickFeatures,t.enablePickFeatures),t._urlSchemeZeroPadding=defaultValue(e.urlSchemeZeroPadding,t.urlSchemeZeroPadding),t._tileDiscardPolicy=e.tileDiscardPolicy,t._getFeatureInfoFormats=e.getFeatureInfoFormats,t._subdomains=e.subdomains,Array.isArray(t._subdomains)?t._subdomains=t._subdomains.slice():defined(t._subdomains)&&t._subdomains.length>0?t._subdomains=t._subdomains.split(""):t._subdomains=["a","b","c"],t._tileWidth=defaultValue(e.tileWidth,256),t._tileHeight=defaultValue(e.tileHeight,256),t._minimumLevel=defaultValue(e.minimumLevel,0),t._maximumLevel=e.maximumLevel,t._tilingScheme=defaultValue(e.tilingScheme,new WebMercatorTilingScheme({ellipsoid:e.ellipsoid})),t._rectangle=defaultValue(e.rectangle,t._tilingScheme.rectangle),t._rectangle=Rectangle.intersection(t._rectangle,t._tilingScheme.rectangle),t._hasAlphaChannel=defaultValue(e.hasAlphaChannel,!0);var s=e.credit;return"string"==typeof s&&(s=new Credit(s)),t._credit=s,t._resource=a,t._tags=r,t._pickFeaturesResource=o,t._pickFeaturesTags=n,!0}))},UrlTemplateImageryProvider.prototype.getTileCredits=function(e,t,i){},UrlTemplateImageryProvider.prototype.requestImage=function(e,t,i,r){return ImageryProvider.loadImage(this,buildImageResource$2(this,e,t,i,r))},UrlTemplateImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){if(this.enablePickFeatures&&defined(this._pickFeaturesResource)&&0!==this._getFeatureInfoFormats.length){var a=0,o=this;return function l(){if(a>=o._getFeatureInfoFormats.length)return when([]);var c=o._getFeatureInfoFormats[a],u=buildPickFeaturesResource$1(o,e,t,i,r,n,c.format);return++a,"json"===c.type?u.fetchJson().then(c.callback).otherwise(l):"xml"===c.type?u.fetchXML().then(c.callback).otherwise(l):"text"===c.type||"html"===c.type?u.fetchText().then(c.callback).otherwise(l):u.fetch({responseType:c.format}).then(s.bind(void 0,c)).otherwise(l)}()}function s(e,t){return e.callback(t)}};var degreesScratchComputed$1=!1,degreesScratch$1=new Rectangle,projectedScratchComputed$1=!1,projectedScratch$1=new Rectangle;function buildImageResource$2(e,t,i,r,n){degreesScratchComputed$1=!1,projectedScratchComputed$1=!1;var a=e._resource,o=a.getUrlComponent(!0),s=e._tags,l={},c=o.match(templateRegex$1);return defined(c)&&c.forEach((function(n){var a=n.substring(1,n.length-1);defined(s[a])&&(l[a]=s[a](e,t,i,r))})),a.getDerivedResource({request:n,templateValues:l})}var ijScratchComputed$1=!1,ijScratch$1=new Cartesian2,longitudeLatitudeProjectedScratchComputed$1=!1;function buildPickFeaturesResource$1(e,t,i,r,n,a,o){degreesScratchComputed$1=!1,projectedScratchComputed$1=!1,ijScratchComputed$1=!1,longitudeLatitudeProjectedScratchComputed$1=!1;var s=e._pickFeaturesResource,l=s.getUrlComponent(!0),c=e._pickFeaturesTags,u={},d=l.match(templateRegex$1);return defined(d)&&d.forEach((function(s){var l=s.substring(1,s.length-1);defined(c[l])&&(u[l]=c[l](e,t,i,r,n,a,o))})),s.getDerivedResource({templateValues:u})}function padWithZerosIfNecessary$1(e,t,i){if(e&&e.urlSchemeZeroPadding&&e.urlSchemeZeroPadding.hasOwnProperty(t)){var r=e.urlSchemeZeroPadding[t];if("string"==typeof r){var n=r.length;n>1&&(i=i.length>=n?i:new Array(n-i.toString().length+1).join("0")+i)}}return i}function xTag$1(e,t,i,r){return padWithZerosIfNecessary$1(e,"{x}",t)}function reverseXTag$1(e,t,i,r){var n=e.tilingScheme.getNumberOfXTilesAtLevel(r)-t-1;return padWithZerosIfNecessary$1(e,"{reverseX}",n)}function yTag$1(e,t,i,r){return padWithZerosIfNecessary$1(e,"{y}",i)}function reverseYTag$1(e,t,i,r){var n=e.tilingScheme.getNumberOfYTilesAtLevel(r)-i-1;return padWithZerosIfNecessary$1(e,"{reverseY}",n)}function reverseZTag$1(e,t,i,r){var n=e.maximumLevel;return padWithZerosIfNecessary$1(e,"{reverseZ}",defined(n)&&r<n?n-r-1:r)}function zTag$1(e,t,i,r){return padWithZerosIfNecessary$1(e,"{z}",r)}function sTag$1(e,t,i,r){var n=(t+i+r)%e._subdomains.length;return e._subdomains[n]}function computeDegrees$1(e,t,i,r){degreesScratchComputed$1||(e.tilingScheme.tileXYToRectangle(t,i,r,degreesScratch$1),degreesScratch$1.west=CesiumMath.toDegrees(degreesScratch$1.west),degreesScratch$1.south=CesiumMath.toDegrees(degreesScratch$1.south),degreesScratch$1.east=CesiumMath.toDegrees(degreesScratch$1.east),degreesScratch$1.north=CesiumMath.toDegrees(degreesScratch$1.north),degreesScratchComputed$1=!0)}function westDegreesTag$1(e,t,i,r){return computeDegrees$1(e,t,i,r),degreesScratch$1.west}function southDegreesTag$1(e,t,i,r){return computeDegrees$1(e,t,i,r),degreesScratch$1.south}function eastDegreesTag$1(e,t,i,r){return computeDegrees$1(e,t,i,r),degreesScratch$1.east}function northDegreesTag$1(e,t,i,r){return computeDegrees$1(e,t,i,r),degreesScratch$1.north}function computeProjected$1(e,t,i,r){projectedScratchComputed$1||(e.tilingScheme.tileXYToNativeRectangle(t,i,r,projectedScratch$1),projectedScratchComputed$1=!0)}function westProjectedTag$1(e,t,i,r){return computeProjected$1(e,t,i,r),projectedScratch$1.west}function southProjectedTag$1(e,t,i,r){return computeProjected$1(e,t,i,r),projectedScratch$1.south}function eastProjectedTag$1(e,t,i,r){return computeProjected$1(e,t,i,r),projectedScratch$1.east}function northProjectedTag$1(e,t,i,r){return computeProjected$1(e,t,i,r),projectedScratch$1.north}function widthTag$1(e,t,i,r){return e.tileWidth}function heightTag$1(e,t,i,r){return e.tileHeight}function iTag$1(e,t,i,r,n,a,o){return computeIJ$1(e,t,i,r,n,a),ijScratch$1.x}function jTag$1(e,t,i,r,n,a,o){return computeIJ$1(e,t,i,r,n,a),ijScratch$1.y}function reverseITag$1(e,t,i,r,n,a,o){return computeIJ$1(e,t,i,r,n,a),e.tileWidth-ijScratch$1.x-1}function reverseJTag$1(e,t,i,r,n,a,o){return computeIJ$1(e,t,i,r,n,a),e.tileHeight-ijScratch$1.y-1}var rectangleScratch$1=new Rectangle,longitudeLatitudeProjectedScratch$1=new Cartesian3;function computeIJ$1(e,t,i,r,n,a,o){if(!ijScratchComputed$1){computeLongitudeLatitudeProjected$1(e,t,i,r,n,a);var s=longitudeLatitudeProjectedScratch$1,l=e.tilingScheme.tileXYToNativeRectangle(t,i,r,rectangleScratch$1);ijScratch$1.x=e.tileWidth*(s.x-l.west)/l.width|0,ijScratch$1.y=e.tileHeight*(l.north-s.y)/l.height|0,ijScratchComputed$1=!0}}function longitudeDegreesTag$1(e,t,i,r,n,a,o){return CesiumMath.toDegrees(n)}function latitudeDegreesTag$1(e,t,i,r,n,a,o){return CesiumMath.toDegrees(a)}function longitudeProjectedTag$1(e,t,i,r,n,a,o){return computeLongitudeLatitudeProjected$1(e,t,i,r,n,a),longitudeLatitudeProjectedScratch$1.x}function latitudeProjectedTag$1(e,t,i,r,n,a,o){return computeLongitudeLatitudeProjected$1(e,t,i,r,n,a),longitudeLatitudeProjectedScratch$1.y}var cartographicScratch$2=new Cartographic;function computeLongitudeLatitudeProjected$1(e,t,i,r,n,a,o){if(!longitudeLatitudeProjectedScratchComputed$1){if(e.tilingScheme.projection instanceof GeographicProjection)longitudeLatitudeProjectedScratch$1.x=CesiumMath.toDegrees(n),longitudeLatitudeProjectedScratch$1.y=CesiumMath.toDegrees(a);else{var s=cartographicScratch$2;s.longitude=n,s.latitude=a,e.tilingScheme.projection.project(s,longitudeLatitudeProjectedScratch$1)}longitudeLatitudeProjectedScratchComputed$1=!0}}function formatTag$1(e,t,i,r,n,a,o){return o}function TileMapServiceImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t,i=when.defer();UrlTemplateImageryProvider.call(this,i.promise),this._tmsResource=void 0,this._xmlResource=void 0,this._options=e,this._deferred=i,this._metadataError=void 0,this._metadataSuccess=this._metadataSuccess.bind(this),this._metadataFailure=this._metadataFailure.bind(this),this._requestMetadata=this._requestMetadata.bind(this);var r=this;when(e.url).then((function(e){(t=Resource.createIfNeeded(e)).appendForwardSlash(),r._tmsResource=t,r._xmlResource=t.getDerivedResource({url:"tilemapresource.xml"}),r._requestMetadata()})).otherwise((function(e){i.reject(e)}))}function confineRectangleToTilingScheme(e,t){return e.west<t.rectangle.west&&(e.west=t.rectangle.west),e.east>t.rectangle.east&&(e.east=t.rectangle.east),e.south<t.rectangle.south&&(e.south=t.rectangle.south),e.north>t.rectangle.north&&(e.north=t.rectangle.north),e}function calculateSafeMinimumDetailLevel(e,t,i){var r=e.positionToTileXY(Rectangle.southwest(t),i),n=e.positionToTileXY(Rectangle.northeast(t),i);return(Math.abs(n.x-r.x)+1)*(Math.abs(n.y-r.y)+1)>4?0:i}function GoogleEarthEnterpriseMapsProvider(e){e=defaultValue(e,{}),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=1.9,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;var t=e.url,i=defaultValue(e.path,"/default_map"),r=Resource.createIfNeeded(t).getDerivedResource({url:"/"===i[0]?i.substring(1):i});r.appendForwardSlash(),this._resource=r,this._url=t,this._path=i,this._tileDiscardPolicy=e.tileDiscardPolicy,this._channel=e.channel,this._requestType="ImageryMaps",this._credit=new Credit('<a href="http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"><img src="'+GoogleEarthEnterpriseMapsProvider.logoUrl+'" title="Google Imagery"/></a>'),this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=e.maximumLevel,this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer();var n,a=r.getDerivedResource({url:"query",queryParameters:{request:"Json",vars:"geeServerDefs",is2d:"t"}}),o=this;function s(t){var i,r,a;try{i=JSON.parse(t)}catch(e){i=JSON.parse(t.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}for(var s=0;s<i.layers.length;s++)if(i.layers[s].id===o._channel){r=i.layers[s];break}if(!defined(r))throw a="Could not find layer with channel (id) of "+o._channel+".",n=TileProviderError.handleError(n,o,o._errorEvent,a,void 0,void 0,void 0,c),new RuntimeError(a);if(!defined(r.version))throw a="Could not find a version in channel (id) "+o._channel+".",n=TileProviderError.handleError(n,o,o._errorEvent,a,void 0,void 0,void 0,c),new RuntimeError(a);if(o._version=r.version,defined(i.projection)&&"flat"===i.projection)o._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Rectangle(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:e.ellipsoid});else{if(defined(i.projection)&&"mercator"!==i.projection)throw a="Unsupported projection "+i.projection+".",n=TileProviderError.handleError(n,o,o._errorEvent,a,void 0,void 0,void 0,c),new RuntimeError(a);o._tilingScheme=new WebMercatorTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid})}o._ready=!0,o._readyPromise.resolve(!0),TileProviderError.handleSuccess(n)}function l(e){var t="An error occurred while accessing "+a.url+".";n=TileProviderError.handleError(n,o,o._errorEvent,t,void 0,void 0,void 0,c),o._readyPromise.reject(new RuntimeError(t))}function c(){var e=a.fetchText();when(e,s,l)}c()}defined(Object.create)&&(TileMapServiceImageryProvider.prototype=Object.create(UrlTemplateImageryProvider.prototype),TileMapServiceImageryProvider.prototype.constructor=TileMapServiceImageryProvider),TileMapServiceImageryProvider.prototype._requestMetadata=function(){this._xmlResource.fetchXML().then(this._metadataSuccess).otherwise(this._metadataFailure)},TileMapServiceImageryProvider.prototype._metadataSuccess=function(e){for(var t,i,r,n,a=/tileformat/i,o=/tileset/i,s=/tilesets/i,l=/boundingbox/i,c=[],u=this._xmlResource,d=this._metadataError,h=this._deferred,p=this._requestMetadata,f=e.childNodes[0].childNodes,m=0;m<f.length;m++)if(a.test(f.item(m).nodeName))t=f.item(m);else if(s.test(f.item(m).nodeName)){r=f.item(m);for(var g=f.item(m).childNodes,_=0;_<g.length;_++)o.test(g.item(_).nodeName)&&c.push(g.item(_))}else l.test(f.item(m).nodeName)&&(i=f.item(m));if(!defined(r)||!defined(i))return n="Unable to find expected tilesets or bbox attributes in "+u.url+".",(d=TileProviderError.handleError(d,this,this.errorEvent,n,void 0,void 0,void 0,p)).retry||h.reject(new RuntimeError(n)),void(this._metadataError=d);var y=this._options,v=defaultValue(y.fileExtension,t.getAttribute("extension")),C=defaultValue(y.tileWidth,parseInt(t.getAttribute("width"),10)),T=defaultValue(y.tileHeight,parseInt(t.getAttribute("height"),10)),S=defaultValue(y.minimumLevel,parseInt(c[0].getAttribute("order"),10)),A=defaultValue(y.maximumLevel,parseInt(c[c.length-1].getAttribute("order"),10)),x=r.getAttribute("profile"),E=y.tilingScheme;if(!defined(E))if("geodetic"===x||"global-geodetic"===x)E=new GeographicTilingScheme({ellipsoid:y.ellipsoid});else{if("mercator"!==x&&"global-mercator"!==x)return n=u.url+"specifies an unsupported profile attribute, "+x+".",(d=TileProviderError.handleError(d,this,this.errorEvent,n,void 0,void 0,void 0,p)).retry||h.reject(new RuntimeError(n)),void(this._metadataError=d);E=new WebMercatorTilingScheme({ellipsoid:y.ellipsoid})}var b=Rectangle.clone(y.rectangle);if(!defined(b)){var P,D,w,M;defaultValue(y.flipXY,!1)?(w=new Cartesian2(parseFloat(i.getAttribute("miny")),parseFloat(i.getAttribute("minx"))),M=new Cartesian2(parseFloat(i.getAttribute("maxy")),parseFloat(i.getAttribute("maxx")))):(w=new Cartesian2(parseFloat(i.getAttribute("minx")),parseFloat(i.getAttribute("miny"))),M=new Cartesian2(parseFloat(i.getAttribute("maxx")),parseFloat(i.getAttribute("maxy"))));var I="geodetic"===x||"mercator"===x;if(E.projection instanceof GeographicProjection||I)P=Cartographic.fromDegrees(w.x,w.y),D=Cartographic.fromDegrees(M.x,M.y);else{var R=E.projection;P=R.unproject(w),D=R.unproject(M)}b=new Rectangle(P.longitude,P.latitude,D.longitude,D.latitude)}S=calculateSafeMinimumDetailLevel(E,b=confineRectangleToTilingScheme(b,E),S);var O=this._tmsResource.getDerivedResource({url:"{z}/{x}/{reverseY}."+v});h.resolve({url:O,tilingScheme:E,rectangle:b,tileWidth:C,tileHeight:T,minimumLevel:S,maximumLevel:A,tileDiscardPolicy:y.tileDiscardPolicy,credit:y.credit})},TileMapServiceImageryProvider.prototype._metadataFailure=function(e){var t=this._options,i=defaultValue(t.fileExtension,"png"),r=defaultValue(t.tileWidth,256),n=defaultValue(t.tileHeight,256),a=t.maximumLevel,o=defined(t.tilingScheme)?t.tilingScheme:new WebMercatorTilingScheme({ellipsoid:t.ellipsoid}),s=defaultValue(t.rectangle,o.rectangle),l=calculateSafeMinimumDetailLevel(o,s=confineRectangleToTilingScheme(s,o),t.maximumLevel),c=this._tmsResource.getDerivedResource({url:"{z}/{x}/{reverseY}."+i});this._deferred.resolve({url:c,tilingScheme:o,rectangle:s,tileWidth:r,tileHeight:n,minimumLevel:l,maximumLevel:a,tileDiscardPolicy:t.tileDiscardPolicy,credit:t.credit})},Object.defineProperties(GoogleEarthEnterpriseMapsProvider.prototype,{url:{get:function(){return this._url}},path:{get:function(){return this._path}},proxy:{get:function(){return this._resource.proxy}},channel:{get:function(){return this._channel}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},version:{get:function(){return this._version}},requestType:{get:function(){return this._requestType}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),GoogleEarthEnterpriseMapsProvider.prototype.getTileCredits=function(e,t,i){},GoogleEarthEnterpriseMapsProvider.prototype.requestImage=function(e,t,i,r){var n=this._resource.getDerivedResource({url:"query",request:r,queryParameters:{request:this._requestType,channel:this._channel,version:this._version,x:e,y:t,z:i+1}});return ImageryProvider.loadImage(this,n)},GoogleEarthEnterpriseMapsProvider.prototype.pickFeatures=function(e,t,i,r,n){},GoogleEarthEnterpriseMapsProvider._logoUrl=void 0,Object.defineProperties(GoogleEarthEnterpriseMapsProvider,{logoUrl:{get:function(){return defined(GoogleEarthEnterpriseMapsProvider._logoUrl)||(GoogleEarthEnterpriseMapsProvider._logoUrl=buildModuleUrl("Assets/Images/google_earth_credit.png")),GoogleEarthEnterpriseMapsProvider._logoUrl},set:function(e){GoogleEarthEnterpriseMapsProvider._logoUrl=e}}});var trailingSlashRegex$1=/\/$/,defaultCredit$3=new Credit('© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function MapboxImageryProvider(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).mapId,i=e.accessToken;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;var r=Resource.createIfNeeded(defaultValue(e.url,"https://{s}.tiles.mapbox.com/v4/"));this._mapId=t,this._accessToken=i;var n=defaultValue(e.format,"png");/\./.test(n)||(n="."+n),this._format=n;var a,o=r.getUrlComponent();trailingSlashRegex$1.test(o)||(o+="/"),o+=t+"/{z}/{x}/{y}"+this._format,r.url=o,r.setQueryParameters({access_token:i}),defined(e.credit)?"string"==typeof(a=e.credit)&&(a=new Credit(a)):a=defaultCredit$3,this._resource=r,this._imageryProvider=new UrlTemplateImageryProvider({url:r,credit:a,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}function SingleTileImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;var t=Resource.createIfNeeded(e.url),i=new GeographicTilingScheme({rectangle:defaultValue(e.rectangle,Rectangle.MAX_VALUE),numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});this._tilingScheme=i,this._resource=t,this._image=void 0,this._texture=void 0,this._tileWidth=0,this._tileHeight=0,this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer();var r=e.credit;"string"==typeof r&&(r=new Credit(r)),this._credit=r;var n,a=this;function o(e){a._image=e,a._tileWidth=e.width,a._tileHeight=e.height,a._ready=!0,a._readyPromise.resolve(!0),TileProviderError.handleSuccess(a._errorEvent)}function s(e){var i="Failed to load image "+t.url+".";n=TileProviderError.handleError(n,a,a._errorEvent,i,0,0,0,l,e),a._readyPromise.reject(new RuntimeError(i))}function l(){ImageryProvider.loadImage(null,t).then(o).otherwise(s)}l()}function GetFeatureInfoFormat(e,t,i){this.type=e,defined(t)||("json"===e?t="application/json":"xml"===e?t="text/xml":"html"===e?t="text/html":"text"===e&&(t="text/plain")),this.format=t,defined(i)||("json"===e?i=geoJsonToFeatureInfo:"xml"===e?i=xmlToFeatureInfo:("html"===e||"text"===e)&&(i=textToFeatureInfo)),this.callback=i}function geoJsonToFeatureInfo(e){for(var t=[],i=e.features,r=0;r<i.length;++r){var n=i[r],a=new ImageryLayerFeatureInfo;if(a.data=n,a.properties=n.properties,a.configureNameFromProperties(n.properties),a.configureDescriptionFromProperties(n.properties),defined(n.geometry)&&"Point"===n.geometry.type){var o=n.geometry.coordinates[0],s=n.geometry.coordinates[1];a.position=Cartographic.fromDegrees(o,s)}t.push(a)}return t}Object.defineProperties(MapboxImageryProvider.prototype,{url:{get:function(){return this._imageryProvider.url}},ready:{get:function(){return this._imageryProvider.ready}},readyPromise:{get:function(){return this._imageryProvider.readyPromise}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._imageryProvider.errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},proxy:{get:function(){return this._imageryProvider.proxy}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}}}),MapboxImageryProvider.prototype.getTileCredits=function(e,t,i){},MapboxImageryProvider.prototype.requestImage=function(e,t,i,r){return this._imageryProvider.requestImage(e,t,i,r)},MapboxImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){return this._imageryProvider.pickFeatures(e,t,i,r,n)},MapboxImageryProvider._defaultCredit=defaultCredit$3,Object.defineProperties(SingleTileImageryProvider.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return 0}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),SingleTileImageryProvider.prototype.getTileCredits=function(e,t,i){},SingleTileImageryProvider.prototype.requestImage=function(e,t,i,r){return this._image},SingleTileImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){};var mapInfoMxpNamespace="http://www.mapinfo.com/mxp",esriWmsNamespace="http://www.esri.com/wms",wfsNamespace="http://www.opengis.net/wfs",gmlNamespace="http://www.opengis.net/gml";function xmlToFeatureInfo(e){var t=e.documentElement;if("MultiFeatureCollection"===t.localName&&t.namespaceURI===mapInfoMxpNamespace)return mapInfoXmlToFeatureInfo(e);if("FeatureInfoResponse"===t.localName&&t.namespaceURI===esriWmsNamespace)return esriXmlToFeatureInfo(e);if("FeatureCollection"===t.localName&&t.namespaceURI===wfsNamespace)return gmlToFeatureInfo(e);if("ServiceExceptionReport"===t.localName)throw new RuntimeError((new XMLSerializer).serializeToString(t));return"msGMLOutput"===t.localName?msGmlToFeatureInfo(e):unknownXmlToFeatureInfo(e)}function mapInfoXmlToFeatureInfo(e){for(var t=[],i=e.documentElement.getElementsByTagNameNS(mapInfoMxpNamespace,"Feature"),r=0;r<i.length;++r){for(var n=i[r],a={},o=n.getElementsByTagNameNS(mapInfoMxpNamespace,"Val"),s=0;s<o.length;++s){var l=o[s];if(l.hasAttribute("ref")){var c=l.getAttribute("ref"),u=l.textContent.trim();a[c]=u}}var d=new ImageryLayerFeatureInfo;d.data=n,d.properties=a,d.configureNameFromProperties(a),d.configureDescriptionFromProperties(a),t.push(d)}return t}function esriXmlToFeatureInfo(e){var t,i=e.documentElement,r=[],n=i.getElementsByTagNameNS("*","FIELDS");if(n.length>0)for(var a=0;a<n.length;++a){var o=n[a];t={};for(var s=o.attributes,l=0;l<s.length;++l){var c=s[l];t[c.name]=c.value}r.push(imageryLayerFeatureInfoFromDataAndProperties(o,t))}else for(var u=i.getElementsByTagNameNS("*","FeatureInfo"),d=0;d<u.length;++d){var h=u[d];t={};for(var p=h.childNodes,f=0;f<p.length;++f){var m=p[f];m.nodeType===Node.ELEMENT_NODE&&(t[m.localName]=m.textContent)}r.push(imageryLayerFeatureInfoFromDataAndProperties(h,t))}return r}function gmlToFeatureInfo(e){for(var t=[],i=e.documentElement.getElementsByTagNameNS(gmlNamespace,"featureMember"),r=0;r<i.length;++r){var n=i[r],a={};getGmlPropertiesRecursively(n,a),t.push(imageryLayerFeatureInfoFromDataAndProperties(n,a))}return t}function msGmlToFeatureInfo(e){for(var t,i=[],r=e.documentElement.childNodes,n=0;n<r.length;n++)if(r[n].nodeType===Node.ELEMENT_NODE){t=r[n];break}if(!defined(t))throw new RuntimeError("Unable to find first child of the feature info xml document");for(var a=t.childNodes,o=0;o<a.length;++o){var s=a[o];if(s.nodeType===Node.ELEMENT_NODE){var l={};getGmlPropertiesRecursively(s,l),i.push(imageryLayerFeatureInfoFromDataAndProperties(s,l))}}return i}function getGmlPropertiesRecursively(e,t){for(var i=!0,r=0;r<e.childNodes.length;++r){var n=e.childNodes[r];n.nodeType===Node.ELEMENT_NODE&&(i=!1),"Point"!==n.localName&&"LineString"!==n.localName&&"Polygon"!==n.localName&&"boundedBy"!==n.localName&&(n.hasChildNodes()&&getGmlPropertiesRecursively(n,t)&&(t[n.localName]=n.textContent))}return i}function imageryLayerFeatureInfoFromDataAndProperties(e,t){var i=new ImageryLayerFeatureInfo;return i.data=e,i.properties=t,i.configureNameFromProperties(t),i.configureDescriptionFromProperties(t),i}function unknownXmlToFeatureInfo(e){var t=(new XMLSerializer).serializeToString(e),i=document.createElement("div"),r=document.createElement("pre");r.textContent=t,i.appendChild(r);var n=new ImageryLayerFeatureInfo;return n.data=e,n.description=i.innerHTML,[n]}var emptyBodyRegex=/<body>\s*<\/body>/im,wmsServiceExceptionReportRegex=/<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im,titleRegex=/<title>([\s\S]*)<\/title>/im;function textToFeatureInfo(e){if(!emptyBodyRegex.test(e)&&!wmsServiceExceptionReportRegex.test(e)){var t,i=titleRegex.exec(e);i&&i.length>1&&(t=i[1]);var r=new ImageryLayerFeatureInfo;return r.name=t,r.description=e,r.data=e,[r]}}function TimeDynamicImagery(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._tileCache={},this._tilesRequestedForInterval=[];var t=this._clock=e.clock;this._times=e.times,this._requestImageFunction=e.requestImageFunction,this._reloadFunction=e.reloadFunction,this._currentIntervalIndex=-1,t.onTick.addEventListener(this._clockOnTick,this),this._clockOnTick(t)}function getKey(e,t,i){return e+"-"+t+"-"+i}function getKeyElements(e){var t=e.split("-");if(3===t.length)return{x:Number(t[0]),y:Number(t[1]),level:Number(t[2])}}function getApproachingInterval(e){var t=e._times;if(defined(t)){var i=e._clock,r=i.currentTime,n=i.canAnimate&&i.shouldAnimate,a=i.multiplier;if(n||0===a){var o,s=t.indexOf(r);if(!(s<0)){var l=t.get(s);return a>0?(o=JulianDate.secondsDifference(l.stop,r),++s):(o=JulianDate.secondsDifference(l.start,r),--s),o/=a,s>=0&&o<=5?t.get(s):void 0}}}}function addToCache(e,t,i){var r=e._times.indexOf(i.start),n=e._tileCache,a=n[r];defined(a)||(a=n[r]={});var o=t.key;if(defined(a[o]))return!0;var s=getKeyElements(o),l=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.IMAGERY,priorityFunction:t.priorityFunction}),c=e._requestImageFunction(s.x,s.y,s.level,l,i);return!!defined(c)&&(a[o]={promise:c,request:l},!0)}Object.defineProperties(TimeDynamicImagery.prototype,{clock:{get:function(){return this._clock},set:function(e){this._clock!==e&&(this._clock=e,this._clockOnTick(e),this._reloadFunction())}},times:{get:function(){return this._times},set:function(e){this._times!==e&&(this._times=e,this._clockOnTick(this._clock),this._reloadFunction())}},currentInterval:{get:function(){return this._times.get(this._currentIntervalIndex)}}}),TimeDynamicImagery.prototype.getFromCache=function(e,t,i,r){var n,a=getKey(e,t,i),o=this._tileCache[this._currentIntervalIndex];if(defined(o)&&defined(o[a])){var s=o[a];n=s.promise.otherwise((function(e){throw r.state=s.request.state,e})),delete o[a]}return n},TimeDynamicImagery.prototype.checkApproachingInterval=function(e,t,i,r){var n=getKey(e,t,i),a=this._tilesRequestedForInterval,o=getApproachingInterval(this),s={key:n,priorityFunction:r.priorityFunction};defined(o)&&addToCache(this,s,o)||a.push(s),a.length>=512&&a.splice(0,256)},TimeDynamicImagery.prototype._clockOnTick=function(e){var t=e.currentTime,i=this._times.indexOf(t),r=this._currentIntervalIndex;if(i!==r){var n=this._tileCache[r];for(var a in n)n.hasOwnProperty(a)&&n[a].request.cancel();return delete this._tileCache[r],this._tilesRequestedForInterval=[],this._currentIntervalIndex=i,void this._reloadFunction()}var o=getApproachingInterval(this);if(defined(o))for(var s=this._tilesRequestedForInterval,l=!0;l&&0!==s.length;){var c=s.pop();(l=addToCache(this,c,o))||s.push(c)}};var includesReverseAxis=[3034,3035,3042,3043,3044],excludesReverseAxis=[4471,4559];function WebMapServiceImageryProvider(e){if(defined((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times)&&!defined(e.clock))throw new DeveloperError("options.times was specified, so options.clock is required.");this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;var t=Resource.createIfNeeded(e.url),i=t.clone();t.setQueryParameters(WebMapServiceImageryProvider.DefaultParameters,!0),i.setQueryParameters(WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters,!0),defined(e.parameters)&&t.setQueryParameters(objectToLowercase(e.parameters)),defined(e.getFeatureInfoParameters)&&i.setQueryParameters(objectToLowercase(e.getFeatureInfoParameters));var r=this;this._reload=void 0,defined(e.times)&&(this._timeDynamicImagery=new TimeDynamicImagery({clock:e.clock,times:e.times,requestImageFunction:function(e,t,i,n,a){return requestImage$1(r,e,t,i,n,a)},reloadFunction:function(){defined(r._reload)&&r._reload()}}));var n={};if(n.layers=e.layers,n.bbox="{westProjected},{southProjected},{eastProjected},{northProjected}",n.width="{width}",n.height="{height}",parseFloat(t.queryParameters.version)>=1.3){n.crs=defaultValue(e.crs,e.tilingScheme&&e.tilingScheme.projection instanceof WebMercatorProjection?"EPSG:3857":"CRS:84");var a=n.crs.split(":");if("EPSG"===a[0]&&2===a.length){var o=Number(a[1]);(o>=4e3&&o<5e3&&!excludesReverseAxis.includes(o)||includesReverseAxis.includes(o))&&(n.bbox="{southProjected},{westProjected},{northProjected},{eastProjected}")}}else n.srs=defaultValue(e.srs,e.tilingScheme&&e.tilingScheme.projection instanceof WebMercatorProjection?"EPSG:3857":"EPSG:4326");t.setQueryParameters(n,!0),i.setQueryParameters(n,!0);var s={query_layers:e.layers,info_format:"{format}"};parseFloat(i.queryParameters.version)>=1.3?(s.i="{i}",s.j="{j}"):(s.x="{i}",s.y="{j}"),i.setQueryParameters(s,!0),this._resource=t,this._pickFeaturesResource=i,this._layers=e.layers,this._tileProvider=new UrlTemplateImageryProvider({url:t,pickFeaturesUrl:i,tilingScheme:defaultValue(e.tilingScheme,new GeographicTilingScheme({ellipsoid:e.ellipsoid})),rectangle:e.rectangle,tileWidth:e.tileWidth,tileHeight:e.tileHeight,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,subdomains:e.subdomains,tileDiscardPolicy:e.tileDiscardPolicy,credit:e.credit,getFeatureInfoFormats:defaultValue(e.getFeatureInfoFormats,WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats),enablePickFeatures:e.enablePickFeatures})}function requestImage$1(e,t,i,r,n,a){var o=defined(a)?a.data:void 0,s=e._tileProvider;return defined(o)&&s._resource.setQueryParameters(o),s.requestImage(t,i,r,n)}function pickFeatures(e,t,i,r,n,a,o){var s=defined(o)?o.data:void 0,l=e._tileProvider;return defined(s)&&l._pickFeaturesResource.setQueryParameters(s),l.pickFeatures(t,i,r,n,a)}function objectToLowercase(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[i.toLowerCase()]=e[i]);return t}Object.defineProperties(WebMapServiceImageryProvider.prototype,{url:{get:function(){return this._resource._url}},proxy:{get:function(){return this._resource.proxy}},layers:{get:function(){return this._layers}},tileWidth:{get:function(){return this._tileProvider.tileWidth}},tileHeight:{get:function(){return this._tileProvider.tileHeight}},maximumLevel:{get:function(){return this._tileProvider.maximumLevel}},minimumLevel:{get:function(){return this._tileProvider.minimumLevel}},tilingScheme:{get:function(){return this._tileProvider.tilingScheme}},rectangle:{get:function(){return this._tileProvider.rectangle}},tileDiscardPolicy:{get:function(){return this._tileProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._tileProvider.errorEvent}},ready:{get:function(){return this._tileProvider.ready}},readyPromise:{get:function(){return this._tileProvider.readyPromise}},credit:{get:function(){return this._tileProvider.credit}},hasAlphaChannel:{get:function(){return this._tileProvider.hasAlphaChannel}},enablePickFeatures:{get:function(){return this._tileProvider.enablePickFeatures},set:function(e){this._tileProvider.enablePickFeatures=e}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}}}),WebMapServiceImageryProvider.prototype.getTileCredits=function(e,t,i){return this._tileProvider.getTileCredits(e,t,i)},WebMapServiceImageryProvider.prototype.requestImage=function(e,t,i,r){var n,a,o=this._timeDynamicImagery;return defined(o)&&(a=o.currentInterval,n=o.getFromCache(e,t,i,r)),defined(n)||(n=requestImage$1(this,e,t,i,r,a)),defined(n)&&defined(o)&&o.checkApproachingInterval(e,t,i,r),n},WebMapServiceImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){var a=this._timeDynamicImagery;return pickFeatures(this,e,t,i,r,n,defined(a)?a.currentInterval:void 0)},WebMapServiceImageryProvider.DefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"}),WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"}),WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats=Object.freeze([Object.freeze(new GetFeatureInfoFormat("json","application/json")),Object.freeze(new GetFeatureInfoFormat("xml","text/xml")),Object.freeze(new GetFeatureInfoFormat("text","text/html"))]);var defaultParameters=Object.freeze({service:"WMTS",version:"1.0.0",request:"GetTile"});function WebMapTileServiceImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;var t=Resource.createIfNeeded(e.url),i=e.style,r=e.tileMatrixSetID,n=t.url,a=n.match(/{/g);if(!defined(a)||1===a.length&&/{s}/.test(n))t.setQueryParameters(defaultParameters),this._useKvp=!0;else{var o={style:i,Style:i,TileMatrixSet:r};t.setTemplateValues(o),this._useKvp=!1}this._resource=t,this._layer=e.layer,this._style=i,this._tileMatrixSetID=r,this._tileMatrixLabels=e.tileMatrixLabels,this._format=defaultValue(e.format,"image/jpeg"),this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=defined(e.tilingScheme)?e.tilingScheme:new WebMercatorTilingScheme({ellipsoid:e.ellipsoid}),this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._minimumLevel=defaultValue(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._rectangle=defaultValue(e.rectangle,this._tilingScheme.rectangle),this._dimensions=e.dimensions;var s=this;this._reload=void 0,defined(e.times)&&(this._timeDynamicImagery=new TimeDynamicImagery({clock:e.clock,times:e.times,requestImageFunction:function(e,t,i,r,n){return requestImage(s,e,t,i,r,n)},reloadFunction:function(){defined(s._reload)&&s._reload()}})),this._readyPromise=when.resolve(!0);var l=this._tilingScheme.positionToTileXY(Rectangle.southwest(this._rectangle),this._minimumLevel),c=this._tilingScheme.positionToTileXY(Rectangle.northeast(this._rectangle),this._minimumLevel);Math.abs(c.x-l.x),Math.abs(c.y-l.y),this._errorEvent=new Event;var u=e.credit;this._credit="string"==typeof u?new Credit(u):u,this._subdomains=e.subdomains,Array.isArray(this._subdomains)?this._subdomains=this._subdomains.slice():defined(this._subdomains)&&this._subdomains.length>0?this._subdomains=this._subdomains.split(""):this._subdomains=["a","b","c"]}function requestImage(e,t,i,r,n,a){var o,s,l=e._tileMatrixLabels,c=defined(l)?l[r]:r.toString(),u=e._subdomains,d=e._dimensions,h=defined(a)?a.data:void 0;if(e._useKvp){var p={};p.tilematrix=c,p.layer=e._layer,p.style=e._style,p.tilerow=i,p.tilecol=t,p.tilematrixset=e._tileMatrixSetID,p.format=e._format,defined(d)&&(p=combine$2(p,d)),defined(h)&&(p=combine$2(p,h)),s={s:u[(t+i+r)%u.length]},(o=e._resource.getDerivedResource({queryParameters:p,request:n})).setTemplateValues(s)}else s={TileMatrix:c,TileRow:i.toString(),TileCol:t.toString(),s:u[(t+i+r)%u.length]},(o=e._resource.getDerivedResource({request:n})).setTemplateValues(s),defined(d)&&o.setTemplateValues(d),defined(h)&&o.setTemplateValues(h);return ImageryProvider.loadImage(e,o)}function createFactory(e){return function(t){return new e(t)}}Object.defineProperties(WebMapTileServiceImageryProvider.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},format:{get:function(){return this._format}},ready:{value:!0},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},dimensions:{get:function(){return this._dimensions},set:function(e){this._dimensions!==e&&(this._dimensions=e,defined(this._reload)&&this._reload())}}}),WebMapTileServiceImageryProvider.prototype.getTileCredits=function(e,t,i){},WebMapTileServiceImageryProvider.prototype.requestImage=function(e,t,i,r){var n,a,o=this._timeDynamicImagery;return defined(o)&&(a=o.currentInterval,n=o.getFromCache(e,t,i,r)),defined(n)||(n=requestImage(this,e,t,i,r,a)),defined(n)&&defined(o)&&o.checkApproachingInterval(e,t,i,r),n},WebMapTileServiceImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){};var ImageryProviderMapping={ARCGIS_MAPSERVER:createFactory(ArcGisMapServerImageryProvider),BING:createFactory(BingMapsImageryProvider),GOOGLE_EARTH:createFactory(GoogleEarthEnterpriseMapsProvider),MAPBOX:createFactory(MapboxImageryProvider),SINGLE_TILE:createFactory(SingleTileImageryProvider),TMS:createFactory(TileMapServiceImageryProvider),URL_TEMPLATE:createFactory(UrlTemplateImageryProvider),WMS:createFactory(WebMapServiceImageryProvider),WMTS:createFactory(WebMapTileServiceImageryProvider)};function IonImageryProvider(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).assetId;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._ready=!1,this._tileCredits=void 0,this._errorEvent=new Event;var i=this,r=IonResource._createEndpointResource(t,e),n=e.assetId.toString()+e.accessToken+e.server,a=IonImageryProvider._endpointCache[n];defined(a)||(a=r.fetchJson(),IonImageryProvider._endpointCache[n]=a),this._readyPromise=a.then((function(e){if("IMAGERY"!==e.type)return when.reject(new RuntimeError("Cesium ion asset "+t+" is not an imagery asset."));var n,a=e.externalType;if(defined(a)){var o=ImageryProviderMapping[a];if(!defined(o))return when.reject(new RuntimeError("Unrecognized Cesium ion imagery type: "+a));n=o(e.options)}else n=new TileMapServiceImageryProvider({url:new IonResource(e,r)});return i._tileCredits=IonResource.getCreditsFromEndpoint(e,r),n.errorEvent.addEventListener((function(e){e.provider=i,i._errorEvent.raiseEvent(e)})),i._imageryProvider=n,n.readyPromise.then((function(){return i._ready=!0,!0}))}))}Object.defineProperties(IonImageryProvider.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel},proxy:{get:function(){}}}}),IonImageryProvider.prototype.getTileCredits=function(e,t,i){var r=this._imageryProvider.getTileCredits(e,t,i);return defined(r)?this._tileCredits.concat(r):this._tileCredits},IonImageryProvider.prototype.requestImage=function(e,t,i,r){return this._imageryProvider.requestImage(e,t,i,r)},IonImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){return this._imageryProvider.pickFeatures(e,t,i,r,n)},IonImageryProvider._endpointCache={};var IonWorldImageryStyle={AERIAL:2,AERIAL_WITH_LABELS:3,ROAD:4},IonWorldImageryStyle$1=Object.freeze(IonWorldImageryStyle);function createWorldImagery(e){return e=defaultValue(e,defaultValue.EMPTY_OBJECT),new IonImageryProvider({assetId:defaultValue(e.style,IonWorldImageryStyle$1.AERIAL)})}var mobileWidth=576,lightboxHeight=100,textColor="#ffffff",highlightColor$1="#48b";function contains(e,t){for(var i=e.length,r=0;r<i;r++){var n=e[r];if(Credit.equals(n,t))return!0}return!1}function swapCesiumCredit(e){var t=e._previousCesiumCredit,i=e._currentCesiumCredit;Credit.equals(i,t)||(defined(t)&&e._cesiumCreditContainer.removeChild(t.element),defined(i)&&e._cesiumCreditContainer.appendChild(i.element),e._previousCesiumCredit=i)}var delimiterClassName="cesium-credit-delimiter",defaultCredit$2;function createDelimiterElement(e){var t=document.createElement("span");return t.textContent=e,t.className=delimiterClassName,t}function createCreditElement(e,t){if(defined(t)){var i=document.createElement(t);i._creditId=e._creditId,i.appendChild(e),e=i}return e}function displayCredits(e,t,i,r){for(var n=e.childNodes,a=-1,o=0;o<t.length;++o){var s=t[o];if(defined(s)){if(a=o,defined(i)&&(a*=2,o>0)){var l=a-1;if(n.length<=l)e.appendChild(createDelimiterElement(i));else{var c=n[l];c.className!==delimiterClassName&&e.replaceChild(createDelimiterElement(i),c)}}var u=s.element;if(n.length<=a)e.appendChild(createCreditElement(u,r));else{var d=n[a];d._creditId!==s._id&&e.replaceChild(createCreditElement(u,r),d)}}}for(++a;a<n.length;)e.removeChild(n[a])}function styleLightboxContainer(e){var t=e._lightboxCredits,i=e.viewport.clientWidth,r=e.viewport.clientHeight;i!==e._lastViewportWidth&&(i<mobileWidth?(t.className="cesium-credit-lightbox cesium-credit-lightbox-mobile",t.style.marginTop="0"):(t.className="cesium-credit-lightbox cesium-credit-lightbox-expanded",t.style.marginTop=Math.floor(.5*(r-t.clientHeight))+"px"),e._lastViewportWidth=i),i>=mobileWidth&&r!==e._lastViewportHeight&&(t.style.marginTop=Math.floor(.5*(r-t.clientHeight))+"px",e._lastViewportHeight=r)}function addStyle(e,t){var i=e+" {";for(var r in t)t.hasOwnProperty(r)&&(i+=r+": "+t[r]+"; ");return i+=" }\n"}function appendCss(){var e="";e+=addStyle(".cesium-credit-lightbox-overlay",{display:"none","z-index":"1",position:"absolute",top:"0",left:"0",width:"100%",height:"100%","background-color":"rgba(80, 80, 80, 0.8)"}),e+=addStyle(".cesium-credit-lightbox",{"background-color":"#303336",color:textColor,position:"relative","min-height":lightboxHeight+"px",margin:"auto"}),e+=addStyle(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:textColor}),e+=addStyle(".cesium-credit-lightbox > ul > li a:hover",{color:highlightColor$1}),e+=addStyle(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),e+=addStyle(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),e+=addStyle(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),e+=addStyle(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:textColor}),e+=addStyle(".cesium-credit-lightbox-close:hover",{color:highlightColor$1}),e+=addStyle(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),e+=addStyle(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),e+=addStyle(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),e+=addStyle(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:textColor}),e+=addStyle(".cesium-credit-expand-link:hover",{color:highlightColor$1}),e+=addStyle(".cesium-credit-text",{color:textColor}),e+=addStyle(".cesium-credit-textContainer *, .cesium-credit-logoContainer *",{display:"inline"});var t=document.head,i=document.createElement("style");i.innerHTML=e,t.insertBefore(i,t.firstChild)}function CreditDisplay(e,t,i){var r=this;i=defaultValue(i,document.body);var n=document.createElement("div");n.className="cesium-credit-lightbox-overlay",i.appendChild(n);var a=document.createElement("div");function o(e){a.contains(e.target)||r.hideLightbox()}a.className="cesium-credit-lightbox",n.appendChild(a),n.addEventListener("click",o,!1);var s=document.createElement("div");s.className="cesium-credit-lightbox-title",s.textContent="Data provided by:",a.appendChild(s);var l=document.createElement("a");l.onclick=this.hideLightbox.bind(this),l.innerHTML="×",l.className="cesium-credit-lightbox-close",a.appendChild(l);var c=document.createElement("ul");a.appendChild(c);var u=document.createElement("div");u.className="cesium-credit-logoContainer",u.style.display="inline",e.appendChild(u);var d=document.createElement("div");d.className="cesium-credit-textContainer",d.style.display="inline",e.appendChild(d);var h=document.createElement("a");h.className="cesium-credit-expand-link",h.onclick=this.showLightbox.bind(this),h.textContent="Data attribution",e.appendChild(h),appendCss();var p=Credit.clone(CreditDisplay.cesiumCredit);this._delimiter=defaultValue(t," • "),this._screenContainer=d,this._cesiumCreditContainer=u,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=a,this._creditList=c,this._lightbox=n,this._hideLightbox=o,this._expandLink=h,this._expanded=!1,this._defaultCredits=[],this._cesiumCredit=p,this._previousCesiumCredit=void 0,this._currentCesiumCredit=p,this._currentFrameCredits={screenCredits:new AssociativeArray,lightboxCredits:new AssociativeArray},this._defaultCredit=void 0,this.viewport=i,this.container=e}function getDefaultCredit(){if(!defined(defaultCredit$2)){var e=buildModuleUrl("Assets/Images/ion-credit.png");if(0!==e.indexOf("http://")&&0!==e.indexOf("https://")&&0!==e.indexOf("data:"))e=new URI(e).path();defaultCredit$2=new Credit('<a href="https://cesium.com/" target="_blank"><img src="'+e+'" title="Cesium ion"/></a>',!0)}return CreditDisplay._cesiumCreditInitialized||(CreditDisplay._cesiumCredit=defaultCredit$2,CreditDisplay._cesiumCreditInitialized=!0),defaultCredit$2}function DebugAppearance(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).attributeName,i=e.perInstanceAttribute;defined(i)||(i=!1);var r,n=defaultValue(e.glslDatatype,"vec3"),a="v_"+t;if("normal"===t||"tangent"===t||"bitangent"===t)r="vec4 getColor() { return vec4(("+a+" + vec3(1.0)) * 0.5, 1.0); }\n";else switch("st"===t&&(n="vec2"),n){case"float":r="vec4 getColor() { return vec4(vec3("+a+"), 1.0); }\n";break;case"vec2":r="vec4 getColor() { return vec4("+a+", 0.0, 1.0); }\n";break;case"vec3":r="vec4 getColor() { return vec4("+a+", 1.0); }\n";break;case"vec4":r="vec4 getColor() { return "+a+"; }\n"}var o="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute float batchId;\n"+(i?"":"attribute "+n+" "+t+";\n")+"varying "+n+" "+a+";\nvoid main()\n{\nvec4 p = czm_translateRelativeToEye(position3DHigh, position3DLow);\n"+(i?a+" = czm_batchTable_"+t+"(batchId);\n":a+" = "+t+";\n")+"gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}",s="varying "+n+" "+a+";\n"+r+"\nvoid main()\n{\ngl_FragColor = getColor();\n}";this.material=void 0,this.translucent=defaultValue(e.translucent,!1),this._vertexShaderSource=defaultValue(e.vertexShaderSource,o),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,s),this._renderState=Appearance.getDefaultRenderState(!1,!1,e.renderState),this._closed=defaultValue(e.closed,!1),this._attributeName=t,this._glslDatatype=n}function DebugCameraPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._camera=e.camera,this._frustumSplits=e.frustumSplits,this._color=defaultValue(e.color,Color.CYAN),this._updateOnChange=defaultValue(e.updateOnChange,!0),this.show=defaultValue(e.show,!0),this.id=e.id,this._id=void 0,this._outlinePrimitives=[],this._planesPrimitives=[]}CreditDisplay.prototype.addCredit=function(e){if(e._isIon)return defined(this._defaultCredit)||(this._defaultCredit=Credit.clone(getDefaultCredit())),void(this._currentCesiumCredit=this._defaultCredit);e.showOnScreen?this._currentFrameCredits.screenCredits.set(e.id,e):this._currentFrameCredits.lightboxCredits.set(e.id,e)},CreditDisplay.prototype.addDefaultCredit=function(e){var t=this._defaultCredits;contains(t,e)||t.push(e)},CreditDisplay.prototype.removeDefaultCredit=function(e){var t=this._defaultCredits,i=t.indexOf(e);-1!==i&&t.splice(i,1)},CreditDisplay.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0},CreditDisplay.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1},CreditDisplay.prototype.update=function(){this._expanded&&styleLightboxContainer(this)},CreditDisplay.prototype.beginFrame=function(){var e=this._currentFrameCredits,t=e.screenCredits;t.removeAll();for(var i=this._defaultCredits,r=0;r<i.length;++r){var n=i[r];t.set(n.id,n)}e.lightboxCredits.removeAll(),Credit.equals(CreditDisplay.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=Credit.clone(CreditDisplay.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit},CreditDisplay.prototype.endFrame=function(){var e=this._currentFrameCredits.screenCredits.values;displayCredits(this._screenContainer,e,this._delimiter,void 0);var t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=t.length>0?"inline":"none",displayCredits(this._creditList,t,void 0,"li"),swapCesiumCredit(this)},CreditDisplay.prototype.destroy=function(){return this._lightbox.removeEventListener("click",this._hideLightbox,!1),this.container.removeChild(this._cesiumCreditContainer),this.container.removeChild(this._screenContainer),this.container.removeChild(this._expandLink),this.viewport.removeChild(this._lightbox),destroyObject(this)},CreditDisplay.prototype.isDestroyed=function(){return!1},CreditDisplay._cesiumCredit=void 0,CreditDisplay._cesiumCreditInitialized=!1,Object.defineProperties(CreditDisplay,{cesiumCredit:{get:function(){return getDefaultCredit(),CreditDisplay._cesiumCredit},set:function(e){CreditDisplay._cesiumCredit=e,CreditDisplay._cesiumCreditInitialized=!0}}}),Object.defineProperties(DebugAppearance.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},attributeName:{get:function(){return this._attributeName}},glslDatatype:{get:function(){return this._glslDatatype}}}),DebugAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,DebugAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,DebugAppearance.prototype.getRenderState=Appearance.prototype.getRenderState;var scratchRight$2=new Cartesian3,scratchRotation=new Matrix3,scratchOrientation=new Quaternion,scratchPerspective=new PerspectiveFrustum,scratchPerspectiveOffCenter=new PerspectiveOffCenterFrustum,scratchOrthographic=new OrthographicFrustum,scratchOrthographicOffCenter=new OrthographicOffCenterFrustum,scratchColor$1=new Color,scratchSplits$1=[1,1e5];function DebugInspector(){this._cachedShowFrustumsShaders={}}function getAttributeLocations(e){var t={},i=e.vertexAttributes;for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r].index);return t}function createDebugShowFrustumsShaderProgram(e,t){var i=e.context,r=t,n=r.fragmentShaderSource.clone(),a=[];n.sources=n.sources.map((function(e){e=ShaderSource.replaceMain(e,"czm_Debug_main");for(var t,i=/gl_FragData\[(\d+)\]/g;null!==(t=i.exec(e));)-1===a.indexOf(t[1])&&a.push(t[1]);return e}));var o,s=a.length,l="";if(l+="uniform vec3 debugShowCommandsColor;\n",l+="uniform vec3 debugShowFrustumsColor;\n",l+="void main() \n{ \n czm_Debug_main(); \n",s>0)for(o=0;o<s;++o)l+=" gl_FragData["+a[o]+"].rgb *= debugShowCommandsColor;\n",l+=" gl_FragData["+a[o]+"].rgb *= debugShowFrustumsColor;\n";else l+=" gl_FragColor.rgb *= debugShowCommandsColor;\n",l+=" gl_FragColor.rgb *= debugShowFrustumsColor;\n";l+="}",n.sources.push(l);var c=getAttributeLocations(r);return ShaderProgram.fromCache({context:i,vertexShaderSource:r.vertexShaderSource,fragmentShaderSource:n,attributeLocations:c})}DebugCameraPrimitive.prototype.update=function(e){if(this.show){var t,i,r=this._planesPrimitives,n=this._outlinePrimitives;if(this._updateOnChange){for(i=r.length,t=0;t<i;++t)n[t]=n[t]&&n[t].destroy(),r[t]=r[t]&&r[t].destroy();r.length=0,n.length=0}if(0===r.length){var a,o,s=this._camera,l=s.frustum;a=l instanceof PerspectiveFrustum?scratchPerspective:l instanceof PerspectiveOffCenterFrustum?scratchPerspectiveOffCenter:l instanceof OrthographicFrustum?scratchOrthographic:scratchOrthographicOffCenter,a=l.clone(a);var c=this._frustumSplits;!defined(c)||c.length<=1?((c=scratchSplits$1)[0]=this._camera.frustum.near,c[1]=this._camera.frustum.far,o=1):o=c.length-1;var u=s.positionWC,d=s.directionWC,h=s.upWC,p=s.rightWC;p=Cartesian3.negate(p,scratchRight$2);var f=scratchRotation;Matrix3.setColumn(f,0,p,f),Matrix3.setColumn(f,1,h,f),Matrix3.setColumn(f,2,d,f);var m=Quaternion.fromRotationMatrix(f,scratchOrientation);for(r.length=n.length=o,t=0;t<o;++t)a.near=c[t],a.far=c[t+1],r[t]=new Primitive$2({geometryInstances:new GeometryInstance({geometry:new FrustumGeometry({origin:u,orientation:m,frustum:a,_drawNearPlane:0===t}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(Color.fromAlpha(this._color,.1,scratchColor$1))},id:this.id,pickPrimitive:this}),appearance:new PerInstanceColorAppearance({translucent:!0,flat:!0}),asynchronous:!1}),n[t]=new Primitive$2({geometryInstances:new GeometryInstance({geometry:new FrustumOutlineGeometry({origin:u,orientation:m,frustum:a,_drawNearPlane:0===t}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})}for(i=r.length,t=0;t<i;++t)n[t].update(e),r[t].update(e)}},DebugCameraPrimitive.prototype.isDestroyed=function(){return!1},DebugCameraPrimitive.prototype.destroy=function(){for(var e=this._planesPrimitives.length,t=0;t<e;++t)this._outlinePrimitives[t]=this._outlinePrimitives[t]&&this._outlinePrimitives[t].destroy(),this._planesPrimitives[t]=this._planesPrimitives[t]&&this._planesPrimitives[t].destroy();return destroyObject(this)};var scratchFrustumColor=new Color;function createDebugShowFrustumsUniformMap(e,t){var i;return i=defined(t.uniformMap)?t.uniformMap:{},defined(i.debugShowCommandsColor)||defined(i.debugShowFrustumsColor)||(i.debugShowCommandsColor=function(){return e.debugShowCommands?(defined(t._debugColor)||(t._debugColor=Color.fromRandom()),t._debugColor):Color.WHITE},i.debugShowFrustumsColor=function(){return e.debugShowFrustums?(scratchFrustumColor.red=1&t.debugOverlappingFrustums?1:0,scratchFrustumColor.green=2&t.debugOverlappingFrustums?1:0,scratchFrustumColor.blue=4&t.debugOverlappingFrustums?1:0,scratchFrustumColor.alpha=1,scratchFrustumColor):Color.WHITE}),i}var scratchShowFrustumCommand=new DrawCommand;function DebugModelMatrixPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.length=defaultValue(e.length,1e7),this._length=void 0,this.width=defaultValue(e.width,2),this._width=void 0,this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=new Matrix4,this.id=e.id,this._id=void 0,this._primitive=void 0}DebugInspector.prototype.executeDebugShowFrustumsCommand=function(e,t,i){var r=t.shaderProgram.id,n=this._cachedShowFrustumsShaders[r];defined(n)||(n=createDebugShowFrustumsShaderProgram(e,t.shaderProgram),this._cachedShowFrustumsShaders[r]=n);var a=DrawCommand.shallowClone(t,scratchShowFrustumCommand);a.shaderProgram=n,a.uniformMap=createDebugShowFrustumsUniformMap(e,t),a.execute(e.context,i)},DebugModelMatrixPrimitive.prototype.update=function(e){if(this.show){if(!defined(this._primitive)||!Matrix4.equals(this._modelMatrix,this.modelMatrix)||this._length!==this.length||this._width!==this.width||this._id!==this.id){this._modelMatrix=Matrix4.clone(this.modelMatrix,this._modelMatrix),this._length=this.length,this._width=this.width,this._id=this.id,defined(this._primitive)&&this._primitive.destroy(),0===this.modelMatrix[12]&&0===this.modelMatrix[13]&&0===this.modelMatrix[14]&&(this.modelMatrix[14]=.01);var t=new GeometryInstance({geometry:new PolylineGeometry({positions:[Cartesian3.ZERO,Cartesian3.UNIT_X],width:this.width,vertexFormat:PolylineColorAppearance.VERTEX_FORMAT,colors:[Color.RED,Color.RED],arcType:ArcType$1.NONE}),modelMatrix:Matrix4.multiplyByUniformScale(this.modelMatrix,this.length,new Matrix4),id:this.id,pickPrimitive:this}),i=new GeometryInstance({geometry:new PolylineGeometry({positions:[Cartesian3.ZERO,Cartesian3.UNIT_Y],width:this.width,vertexFormat:PolylineColorAppearance.VERTEX_FORMAT,colors:[Color.GREEN,Color.GREEN],arcType:ArcType$1.NONE}),modelMatrix:Matrix4.multiplyByUniformScale(this.modelMatrix,this.length,new Matrix4),id:this.id,pickPrimitive:this}),r=new GeometryInstance({geometry:new PolylineGeometry({positions:[Cartesian3.ZERO,Cartesian3.UNIT_Z],width:this.width,vertexFormat:PolylineColorAppearance.VERTEX_FORMAT,colors:[Color.BLUE,Color.BLUE],arcType:ArcType$1.NONE}),modelMatrix:Matrix4.multiplyByUniformScale(this.modelMatrix,this.length,new Matrix4),id:this.id,pickPrimitive:this});this._primitive=new Primitive$2({geometryInstances:[t,i,r],appearance:new PolylineColorAppearance,asynchronous:!1})}this._primitive.update(e)}},DebugModelMatrixPrimitive.prototype.isDestroyed=function(){return!1},DebugModelMatrixPrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)};var DepthPlaneFS="varying vec4 positionEC;\nvoid main()\n{\nvec3 position;\nvec3 direction;\nif (czm_orthographicIn3D == 1.0)\n{\nvec2 uv = (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw;\nvec2 minPlane = vec2(czm_frustumPlanes.z, czm_frustumPlanes.y);\nvec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x);\nposition = vec3(mix(minPlane, maxPlane, uv), 0.0);\ndirection = vec3(0.0, 0.0, -1.0);\n}\nelse\n{\nposition = vec3(0.0);\ndirection = normalize(positionEC.xyz);\n}\nczm_ray ray = czm_ray(position, direction);\nvec3 ellipsoid_center = czm_view[3].xyz;\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);\nif (!czm_isEmpty(intersection))\n{\ngl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}\nelse\n{\ndiscard;\n}\nczm_writeLogDepth();\n}\n",DepthPlaneVS="attribute vec4 position;\nvarying vec4 positionEC;\nvoid main()\n{\npositionEC = czm_modelView * position;\ngl_Position = czm_projection * positionEC;\nczm_vertexLogDepth();\n}\n";function DepthPlane(){this._rs=void 0,this._sp=void 0,this._va=void 0,this._command=void 0,this._mode=void 0,this._useLogDepth=!1}var depthQuadScratch=FeatureDetection.supportsTypedArrays()?new Float32Array(12):[],scratchCartesian1$1=new Cartesian3,scratchCartesian2$1=new Cartesian3,scratchCartesian3=new Cartesian3,scratchCartesian4$1=new Cartesian3,scratchCartesian5=new Cartesian3;function computeDepthQuad(e,t){var i,r,n,a=e.radii,o=t.camera;if(o.frustum instanceof OrthographicFrustum)i=Cartesian3.ZERO,r=o.rightWC,n=o.upWC;else{var s=o.positionWC,l=Cartesian3.multiplyComponents(e.oneOverRadii,s,scratchCartesian1$1),c=Cartesian3.normalize(l,scratchCartesian2$1),u=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,l,scratchCartesian3),scratchCartesian3),d=Cartesian3.normalize(Cartesian3.cross(c,u,scratchCartesian4$1),scratchCartesian4$1),h=Cartesian3.magnitude(l),p=Math.sqrt(h*h-1);i=Cartesian3.multiplyByScalar(c,1/h,scratchCartesian1$1);var f=p/h;r=Cartesian3.multiplyByScalar(u,f,scratchCartesian2$1),n=Cartesian3.multiplyByScalar(d,f,scratchCartesian3)}var m=Cartesian3.add(i,n,scratchCartesian5);Cartesian3.subtract(m,r,m),Cartesian3.multiplyComponents(a,m,m),Cartesian3.pack(m,depthQuadScratch,0);var g=Cartesian3.subtract(i,n,scratchCartesian5);Cartesian3.subtract(g,r,g),Cartesian3.multiplyComponents(a,g,g),Cartesian3.pack(g,depthQuadScratch,3);var _=Cartesian3.add(i,n,scratchCartesian5);Cartesian3.add(_,r,_),Cartesian3.multiplyComponents(a,_,_),Cartesian3.pack(_,depthQuadScratch,6);var y=Cartesian3.subtract(i,n,scratchCartesian5);return Cartesian3.add(y,r,y),Cartesian3.multiplyComponents(a,y,y),Cartesian3.pack(y,depthQuadScratch,9),depthQuadScratch}function DerivedCommand(){}DepthPlane.prototype.update=function(e){if(this._mode=e.mode,e.mode===SceneMode$1.SCENE3D){var t=e.context,i=e.mapProjection.ellipsoid,r=e.useLogDepth;if(defined(this._command)||(this._rs=RenderState.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new DrawCommand({renderState:this._rs,boundingVolume:new BoundingSphere(Cartesian3.ZERO,i.maximumRadius),pass:Pass$1.OPAQUE,owner:this})),!defined(this._sp)||this._useLogDepth!==r){this._useLogDepth=r;var n=new ShaderSource({sources:[DepthPlaneVS]}),a=new ShaderSource({sources:[DepthPlaneFS]});if(r){a.sources.push("#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n"),a.defines.push("LOG_DEPTH"),n.defines.push("LOG_DEPTH")}this._sp=ShaderProgram.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:n,fragmentShaderSource:a,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}var o=computeDepthQuad(i,e);if(defined(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(o);else{var s=new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:o})},indices:[0,1,2,2,1,3],primitiveType:PrimitiveType$1.TRIANGLES});this._va=VertexArray.fromGeometry({context:t,geometry:s,attributeLocations:{position:0},bufferUsage:BufferUsage$1.DYNAMIC_DRAW}),this._command.vertexArray=this._va}}},DepthPlane.prototype.execute=function(e,t){this._mode===SceneMode$1.SCENE3D&&this._command.execute(e,t)},DepthPlane.prototype.isDestroyed=function(){return!1},DepthPlane.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};var fragDepthRegex=/\bgl_FragDepthEXT\b/,discardRegex=/\bdiscard\b/;function getDepthOnlyShaderProgram$1(e,t){var i=e.shaderCache.getDerivedShaderProgram(t,"depthOnly");if(!defined(i)){var r,n=t._attributeLocations,a=t.fragmentShaderSource,o=!1,s=a.sources,l=s.length;for(r=0;r<l;++r)if(fragDepthRegex.test(s[r])||discardRegex.test(s[r])){o=!0;break}var c=!1,u=a.defines;for(l=u.length,r=0;r<l;++r)if("LOG_DEPTH"===u[r]){c=!0;break}o||c?!o&&c&&(a=new ShaderSource({defines:["LOG_DEPTH"],sources:["#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\nvoid main() \n{ \n gl_FragColor = vec4(1.0); \n czm_writeLogDepth(); \n} \n"]})):a=new ShaderSource({sources:["void main() \n{ \n gl_FragColor = vec4(1.0); \n} \n"]}),i=e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:a,attributeLocations:n})}return i}function getDepthOnlyRenderState(e,t){var i=e._depthOnlyRenderStateCache,r=i[t.id];if(!defined(r)){var n=RenderState.getState(t);n.depthMask=!0,n.colorMask={red:!1,green:!1,blue:!1,alpha:!1},r=RenderState.fromCache(n),i[t.id]=r}return r}DerivedCommand.createDepthOnlyDerivedCommand=function(e,t,i,r){var n,a;return defined(r)||(r={}),defined(r.depthOnlyCommand)&&(n=r.depthOnlyCommand.shaderProgram,a=r.depthOnlyCommand.renderState),r.depthOnlyCommand=DrawCommand.shallowClone(t,r.depthOnlyCommand),defined(n)&&r.shaderProgramId===t.shaderProgram.id?(r.depthOnlyCommand.shaderProgram=n,r.depthOnlyCommand.renderState=a):(r.depthOnlyCommand.shaderProgram=getDepthOnlyShaderProgram$1(i,t.shaderProgram),r.depthOnlyCommand.renderState=getDepthOnlyRenderState(e,t.renderState),r.shaderProgramId=t.shaderProgram.id),r};var writeLogDepthRegex=/\s+czm_writeLogDepth\(/,vertexlogDepthRegex=/\s+czm_vertexLogDepth\(/,extensionRegex=/\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/;function getLogDepthShaderProgram(e,t){var i=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(!defined(i)){var r,n=t._attributeLocations,a=t.vertexShaderSource.clone(),o=t.fragmentShaderSource.clone();a.defines=defined(a.defines)?a.defines.slice(0):[],a.defines.push("LOG_DEPTH"),o.defines=defined(o.defines)?o.defines.slice(0):[],o.defines.push("LOG_DEPTH");var s=!1,l=a.sources,c=l.length;for(r=0;r<c;++r)if(vertexlogDepthRegex.test(l[r])){s=!0;break}if(!s){for(r=0;r<c;++r)l[r]=ShaderSource.replaceMain(l[r],"czm_log_depth_main");"\n\nvoid main() \n{ \n czm_log_depth_main(); \n czm_vertexLogDepth(); \n} \n",l.push("\n\nvoid main() \n{ \n czm_log_depth_main(); \n czm_vertexLogDepth(); \n} \n")}for(c=(l=o.sources).length,s=!1,r=0;r<c;++r)writeLogDepthRegex.test(l[r])&&(s=!0);-1!==o.defines.indexOf("LOG_DEPTH_WRITE")&&(s=!0);var u=!0;for(r=0;r<c;++r)extensionRegex.test(l[r])&&(u=!1);var d="";if(u&&(d+="#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n"),!s){for(r=0;r<c;r++)l[r]=ShaderSource.replaceMain(l[r],"czm_log_depth_main");d+="\nvoid main() \n{ \n czm_log_depth_main(); \n czm_writeLogDepth(); \n} \n"}l.push(d),i=e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:n})}return i}function getPickShaderProgram$1(e,t,i){var r=e.shaderCache.getDerivedShaderProgram(t,"pick");if(!defined(r)){for(var n=t._attributeLocations,a=t.fragmentShaderSource,o=a.sources,s=o.length,l="void main() \n{ \n czm_non_pick_main(); \n if (gl_FragColor.a == 0.0) { \n discard; \n } \n gl_FragColor = "+i+"; \n} \n",c=new Array(s+1),u=0;u<s;++u)c[u]=ShaderSource.replaceMain(o[u],"czm_non_pick_main");c[s]=l,a=new ShaderSource({sources:c,defines:a.defines}),r=e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:a,attributeLocations:n})}return r}function getPickRenderState(e,t){var i=e.picking.pickRenderStateCache,r=i[t.id];if(!defined(r)){var n=RenderState.getState(t);n.blending.enabled=!1,n.depthMask=!0,r=RenderState.fromCache(n),i[t.id]=r}return r}function getHdrShaderProgram(e,t){var i=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(!defined(i)){var r=t._attributeLocations,n=t.vertexShaderSource.clone(),a=t.fragmentShaderSource.clone();n.defines=defined(n.defines)?n.defines.slice(0):[],n.defines.push("HDR"),a.defines=defined(a.defines)?a.defines.slice(0):[],a.defines.push("HDR"),i=e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:n,fragmentShaderSource:a,attributeLocations:r})}return i}function DeviceOrientationCameraController(e){this._scene=e,this._lastAlpha=void 0,this._lastBeta=void 0,this._lastGamma=void 0,this._alpha=void 0,this._beta=void 0,this._gamma=void 0;var t=this;function i(e){var i=e.alpha;if(!defined(i))return t._alpha=void 0,t._beta=void 0,void(t._gamma=void 0);t._alpha=CesiumMath.toRadians(i),t._beta=CesiumMath.toRadians(e.beta),t._gamma=CesiumMath.toRadians(e.gamma)}window.addEventListener("deviceorientation",i,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",i,!1)}}DerivedCommand.createLogDepthCommand=function(e,t,i){var r;return defined(i)||(i={}),defined(i.command)&&(r=i.command.shaderProgram),i.command=DrawCommand.shallowClone(e,i.command),defined(r)&&i.shaderProgramId===e.shaderProgram.id?i.command.shaderProgram=r:(i.command.shaderProgram=getLogDepthShaderProgram(t,e.shaderProgram),i.shaderProgramId=e.shaderProgram.id),i},DerivedCommand.createPickDerivedCommand=function(e,t,i,r){var n,a;return defined(r)||(r={}),defined(r.pickCommand)&&(n=r.pickCommand.shaderProgram,a=r.pickCommand.renderState),r.pickCommand=DrawCommand.shallowClone(t,r.pickCommand),defined(n)&&r.shaderProgramId===t.shaderProgram.id?(r.pickCommand.shaderProgram=n,r.pickCommand.renderState=a):(r.pickCommand.shaderProgram=getPickShaderProgram$1(i,t.shaderProgram,t.pickId),r.pickCommand.renderState=getPickRenderState(e,t.renderState),r.shaderProgramId=t.shaderProgram.id),r},DerivedCommand.createHdrCommand=function(e,t,i){var r;return defined(i)||(i={}),defined(i.command)&&(r=i.command.shaderProgram),i.command=DrawCommand.shallowClone(e,i.command),defined(r)&&i.shaderProgramId===e.shaderProgram.id?i.command.shaderProgram=r:(i.command.shaderProgram=getHdrShaderProgram(t,e.shaderProgram),i.shaderProgramId=e.shaderProgram.id),i};var scratchQuaternion1=new Quaternion,scratchQuaternion2=new Quaternion,scratchMatrix3=new Matrix3;function rotate(e,t,i,r){var n=e.direction,a=e.right,o=e.up,s=Quaternion.fromAxisAngle(n,i,scratchQuaternion2),l=Quaternion.fromAxisAngle(a,r,scratchQuaternion1),c=Quaternion.multiply(l,s,l),u=Quaternion.fromAxisAngle(o,t,scratchQuaternion2);Quaternion.multiply(u,c,c);var d=Matrix3.fromQuaternion(c,scratchMatrix3);Matrix3.multiplyByVector(d,a,a),Matrix3.multiplyByVector(d,o,o),Matrix3.multiplyByVector(d,n,n)}function DirectionalLight(e){this.direction=Cartesian3.clone(e.direction),this.color=Color.clone(defaultValue(e.color,Color.WHITE)),this.intensity=defaultValue(e.intensity,1)}DeviceOrientationCameraController.prototype.update=function(){if(defined(this._alpha)){defined(this._lastAlpha)||(this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma);var e=this._lastAlpha-this._alpha,t=this._lastBeta-this._beta,i=this._lastGamma-this._gamma;rotate(this._scene.camera,-e,t,i),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma}},DeviceOrientationCameraController.prototype.isDestroyed=function(){return!1},DeviceOrientationCameraController.prototype.destroy=function(){return this._removeListener(),destroyObject(this)};var EllipsoidFS="#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#endif\nuniform vec3 u_radii;\nuniform vec3 u_oneOverEllipsoidRadiiSquared;\nvarying vec3 v_positionEC;\nvec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)\n{\nvec3 positionEC = czm_pointAlongRay(ray, intersection);\nvec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;\nvec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));\nvec3 sphericalNormal = normalize(positionMC / u_radii);\nvec3 normalMC = geodeticNormal * side;\nvec3 normalEC = normalize(czm_normal * normalMC);\nvec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);\nvec3 positionToEyeEC = -positionEC;\nczm_materialInput materialInput;\nmaterialInput.s = st.s;\nmaterialInput.st = st;\nmaterialInput.str = (positionMC + u_radii) / u_radii;\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef ONLY_SUN_LIGHTING\nreturn czm_private_phong(normalize(positionToEyeEC), material, czm_sunDirectionEC);\n#else\nreturn czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\nvoid main()\n{\nfloat maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;\nvec3 direction = normalize(v_positionEC);\nvec3 ellipsoidCenter = czm_modelView[3].xyz;\nfloat t1 = -1.0;\nfloat t2 = -1.0;\nfloat b = -2.0 * dot(direction, ellipsoidCenter);\nfloat c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;\nfloat discriminant = b * b - 4.0 * c;\nif (discriminant >= 0.0) {\nt1 = (-b - sqrt(discriminant)) * 0.5;\nt2 = (-b + sqrt(discriminant)) * 0.5;\n}\nif (t1 < 0.0 && t2 < 0.0) {\ndiscard;\n}\nfloat t = min(t1, t2);\nif (t < 0.0) {\nt = 0.0;\n}\nczm_ray ray = czm_ray(t * direction, direction);\nvec3 ellipsoid_inverseRadii = vec3(1.0 / u_radii.x, 1.0 / u_radii.y, 1.0 / u_radii.z);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);\nif (czm_isEmpty(intersection))\n{\ndiscard;\n}\nvec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);\nvec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);\ngl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);\ngl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);\n#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\nt = (intersection.start != 0.0) ? intersection.start : intersection.stop;\nvec3 positionEC = czm_pointAlongRay(ray, t);\nvec4 positionCC = czm_projection * vec4(positionEC, 1.0);\n#ifdef LOG_DEPTH\nczm_writeLogDepth(1.0 + positionCC.w);\n#else\nfloat z = positionCC.z / positionCC.w;\nfloat n = czm_depthRange.near;\nfloat f = czm_depthRange.far;\ngl_FragDepthEXT = (z * (f - n) + f + n) * 0.5;\n#endif\n#endif\n#endif\n}\n",EllipsoidVS="attribute vec3 position;\nuniform vec3 u_radii;\nvarying vec3 v_positionEC;\nvoid main()\n{\nvec4 p = vec4(u_radii * position, 1.0);\nv_positionEC = (czm_modelView * p).xyz;\ngl_Position = czm_modelViewProjection * p;\ngl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);\nczm_vertexLogDepth();\n}\n",attributeLocations={position:0};function EllipsoidPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.center=Cartesian3.clone(defaultValue(e.center,Cartesian3.ZERO)),this._center=new Cartesian3,this.radii=Cartesian3.clone(e.radii),this._radii=new Cartesian3,this._oneOverEllipsoidRadiiSquared=new Cartesian3,this._boundingSphere=new BoundingSphere,this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=new Matrix4,this._computedModelMatrix=new Matrix4,this.show=defaultValue(e.show,!0),this.material=defaultValue(e.material,Material$3.fromType(Material$3.ColorType)),this._material=void 0,this._translucent=void 0,this.id=e.id,this._id=void 0,this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.onlySunLighting=defaultValue(e.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=defaultValue(e.depthTestEnabled,!0),this._useLogDepth=!1,this._sp=void 0,this._rs=void 0,this._va=void 0,this._pickSP=void 0,this._pickId=void 0,this._colorCommand=new DrawCommand({owner:defaultValue(e._owner,this)}),this._pickCommand=new DrawCommand({owner:defaultValue(e._owner,this),pickOnly:!0});var t=this;this._uniforms={u_radii:function(){return t.radii},u_oneOverEllipsoidRadiiSquared:function(){return t._oneOverEllipsoidRadiiSquared}},this._pickUniforms={czm_pickColor:function(){return t._pickId.color}}}function getVertexArray(e){var t=e.cache.ellipsoidPrimitive_vertexArray;if(defined(t))return t;var i=BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2),vertexFormat:VertexFormat.POSITION_ONLY}));return t=VertexArray.fromGeometry({context:e,geometry:i,attributeLocations:attributeLocations,bufferUsage:BufferUsage$1.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}var logDepthExtension="#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n";EllipsoidPrimitive.prototype.update=function(e){if(this.show&&e.mode===SceneMode$1.SCENE3D&&defined(this.center)&&defined(this.radii)){var t=e.context,i=this.material.isTranslucent(),r=this._translucent!==i;defined(this._rs)&&!r||(this._translucent=i,this._rs=RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!i&&t.fragmentDepth,blending:i?BlendingState$1.ALPHA_BLEND:void 0})),defined(this._va)||(this._va=getVertexArray(t));var n=!1,a=this.radii;if(!Cartesian3.equals(this._radii,a)){Cartesian3.clone(a,this._radii);var o=this._oneOverEllipsoidRadiiSquared;o.x=1/(a.x*a.x),o.y=1/(a.y*a.y),o.z=1/(a.z*a.z),n=!0}Matrix4.equals(this.modelMatrix,this._modelMatrix)&&Cartesian3.equals(this.center,this._center)||(Matrix4.clone(this.modelMatrix,this._modelMatrix),Cartesian3.clone(this.center,this._center),Matrix4.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),n=!0),n&&(Cartesian3.clone(Cartesian3.ZERO,this._boundingSphere.center),this._boundingSphere.radius=Cartesian3.maximumComponent(a),BoundingSphere.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));var s=this._material!==this.material;this._material=this.material,this._material.update(t);var l=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;var c=e.useLogDepth,u=this._useLogDepth!==c;this._useLogDepth=c;var d,h,p=this._colorCommand;(s||l||r||u)&&(d=new ShaderSource({sources:[EllipsoidVS]}),h=new ShaderSource({sources:[this.material.shaderSource,EllipsoidFS]}),this.onlySunLighting&&h.defines.push("ONLY_SUN_LIGHTING"),!i&&t.fragmentDepth&&h.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),h.defines.push("LOG_DEPTH"),h.sources.push(logDepthExtension)),this._sp=ShaderProgram.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:attributeLocations}),p.vertexArray=this._va,p.renderState=this._rs,p.shaderProgram=this._sp,p.uniformMap=combine$2(this._uniforms,this.material._uniforms),p.executeInClosestFrustum=i);var f=e.commandList,m=e.passes;if(m.render&&(p.boundingVolume=this._boundingSphere,p.debugShowBoundingVolume=this.debugShowBoundingVolume,p.modelMatrix=this._computedModelMatrix,p.pass=i?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,f.push(p)),m.pick){var g=this._pickCommand;defined(this._pickId)&&this._id===this.id||(this._id=this.id,this._pickId=this._pickId&&this._pickId.destroy(),this._pickId=t.createPickId({primitive:this,id:this.id})),(s||l||!defined(this._pickSP)||u)&&(d=new ShaderSource({sources:[EllipsoidVS]}),h=new ShaderSource({sources:[this.material.shaderSource,EllipsoidFS],pickColorQualifier:"uniform"}),this.onlySunLighting&&h.defines.push("ONLY_SUN_LIGHTING"),!i&&t.fragmentDepth&&h.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),h.defines.push("LOG_DEPTH"),h.sources.push(logDepthExtension)),this._pickSP=ShaderProgram.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:attributeLocations}),g.vertexArray=this._va,g.renderState=this._rs,g.shaderProgram=this._pickSP,g.uniformMap=combine$2(combine$2(this._uniforms,this._pickUniforms),this.material._uniforms),g.executeInClosestFrustum=i),g.boundingVolume=this._boundingSphere,g.modelMatrix=this._computedModelMatrix,g.pass=i?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,f.push(g)}}},EllipsoidPrimitive.prototype.isDestroyed=function(){return!1},EllipsoidPrimitive.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._pickSP=this._pickSP&&this._pickSP.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),destroyObject(this)};var EllipsoidSurfaceAppearanceFS="varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n",EllipsoidSurfaceAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec2 st;\nattribute float batchId;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionMC = position3DHigh + position3DLow;\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";function EllipsoidSurfaceAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=defaultValue(e.translucent,!0),i=defaultValue(e.aboveGround,!1);this.material=defined(e.material)?e.material:Material$3.fromType(Material$3.ColorType),this.translucent=defaultValue(e.translucent,!0),this._vertexShaderSource=defaultValue(e.vertexShaderSource,EllipsoidSurfaceAppearanceVS),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,EllipsoidSurfaceAppearanceFS),this._renderState=Appearance.getDefaultRenderState(t,!i,e.renderState),this._closed=!1,this._flat=defaultValue(e.flat,!1),this._faceForward=defaultValue(e.faceForward,i),this._aboveGround=i}function Fog(){this.enabled=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}Object.defineProperties(EllipsoidSurfaceAppearance.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return EllipsoidSurfaceAppearance.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}}),EllipsoidSurfaceAppearance.VERTEX_FORMAT=VertexFormat.POSITION_AND_ST,EllipsoidSurfaceAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,EllipsoidSurfaceAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,EllipsoidSurfaceAppearance.prototype.getRenderState=Appearance.prototype.getRenderState;for(var heightsTable=[359.393,800.749,1275.6501,2151.1192,3141.7763,4777.5198,6281.2493,12364.307,15900.765,49889.0549,78026.8259,99260.7344,120036.3873,151011.0158,156091.1953,203849.3112,274866.9803,319916.3149,493552.0528,628733.5874],densityTable=[2e-5,2e-4,1e-4,7e-5,5e-5,4e-5,3e-5,19e-6,1e-5,85e-7,62e-7,58e-7,53e-7,52e-7,51e-7,42e-7,4e-6,34e-7,26e-7,22e-7],i$4=0;i$4<densityTable.length;++i$4)densityTable[i$4]*=1e6;for(var tableStartDensity=densityTable[1],tableEndDensity=densityTable[densityTable.length-1],j=0;j<densityTable.length;++j)densityTable[j]=(densityTable[j]-tableEndDensity)/(tableStartDensity-tableEndDensity);var tableLastIndex=0;function findInterval(e){var t,i=heightsTable,r=i.length;if(e<i[0])return tableLastIndex=0;if(e>i[r-1])return tableLastIndex=r-2;if(e>=i[tableLastIndex]){if(tableLastIndex+1<r&&e<i[tableLastIndex+1])return tableLastIndex;if(tableLastIndex+2<r&&e<i[tableLastIndex+2])return++tableLastIndex}else if(tableLastIndex-1>=0&&e>=i[tableLastIndex-1])return--tableLastIndex;for(t=0;t<r-2&&!(e>=i[t]&&e<i[t+1]);++t);return tableLastIndex=t}var scratchPositionNormal$1=new Cartesian3;function FrameRateMonitor(e){this._scene=e.scene,this.samplingWindow=defaultValue(e.samplingWindow,FrameRateMonitor.defaultSettings.samplingWindow),this.quietPeriod=defaultValue(e.quietPeriod,FrameRateMonitor.defaultSettings.quietPeriod),this.warmupPeriod=defaultValue(e.warmupPeriod,FrameRateMonitor.defaultSettings.warmupPeriod),this.minimumFrameRateDuringWarmup=defaultValue(e.minimumFrameRateDuringWarmup,FrameRateMonitor.defaultSettings.minimumFrameRateDuringWarmup),this.minimumFrameRateAfterWarmup=defaultValue(e.minimumFrameRateAfterWarmup,FrameRateMonitor.defaultSettings.minimumFrameRateAfterWarmup),this._lowFrameRate=new Event,this._nominalFrameRate=new Event,this._frameTimes=[],this._needsQuietPeriod=!0,this._quietPeriodEndTime=0,this._warmupPeriodEndTime=0,this._frameRateIsLow=!1,this._lastFramesPerSecond=void 0,this._pauseCount=0;var t=this;this._preUpdateRemoveListener=this._scene.preUpdate.addEventListener((function(e,i){update(t)})),this._hiddenPropertyName=void 0!==document.hidden?"hidden":void 0!==document.mozHidden?"mozHidden":void 0!==document.msHidden?"msHidden":void 0!==document.webkitHidden?"webkitHidden":void 0;var i=void 0!==document.hidden?"visibilitychange":void 0!==document.mozHidden?"mozvisibilitychange":void 0!==document.msHidden?"msvisibilitychange":void 0!==document.webkitHidden?"webkitvisibilitychange":void 0;function r(){visibilityChanged(t)}this._visibilityChangeRemoveListener=void 0,defined(i)&&(document.addEventListener(i,r,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(i,r,!1)})}function update(e,t){if(!(e._pauseCount>0)){var i=getTimestamp$1();if(e._needsQuietPeriod)e._needsQuietPeriod=!1,e._frameTimes.length=0,e._quietPeriodEndTime=i+e.quietPeriod/TimeConstants$1.SECONDS_PER_MILLISECOND,e._warmupPeriodEndTime=e._quietPeriodEndTime+(e.warmupPeriod+e.samplingWindow)/TimeConstants$1.SECONDS_PER_MILLISECOND;else if(i>=e._quietPeriodEndTime){e._frameTimes.push(i);var r=i-e.samplingWindow/TimeConstants$1.SECONDS_PER_MILLISECOND;if(e._frameTimes.length>=2&&e._frameTimes[0]<=r){for(;e._frameTimes.length>=2&&e._frameTimes[1]<r;)e._frameTimes.shift();var n=(i-e._frameTimes[0])/(e._frameTimes.length-1);e._lastFramesPerSecond=1e3/n,n>1e3/(i>e._warmupPeriodEndTime?e.minimumFrameRateAfterWarmup:e.minimumFrameRateDuringWarmup)?e._frameRateIsLow||(e._frameRateIsLow=!0,e._needsQuietPeriod=!0,e.lowFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond)):e._frameRateIsLow&&(e._frameRateIsLow=!1,e._needsQuietPeriod=!0,e.nominalFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond))}}}}function visibilityChanged(e){document[e._hiddenPropertyName]?e.pause():e.unpause()}function FrameState(e,t,i){this.context=e,this.commandList=[],this.shadowMaps=[],this.brdfLutGenerator=void 0,this.environmentMap=void 0,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this.specularEnvironmentMapsMaximumLOD=void 0,this.mode=SceneMode$1.SCENE3D,this.morphTime=SceneMode$1.getMorphTime(SceneMode$1.SCENE3D),this.frameNumber=0,this.newFrame=!1,this.time=void 0,this.jobScheduler=i,this.mapProjection=void 0,this.camera=void 0,this.cameraUnderground=!1,this.globeTranslucencyState=void 0,this.cullingVolume=void 0,this.occluder=void 0,this.maximumScreenSpaceError=void 0,this.pixelRatio=1,this.passes={render:!1,pick:!1,depth:!1,postProcess:!1,offscreen:!1},this.creditDisplay=t,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,density:void 0,sse:void 0,minimumBrightness:void 0},this.terrainExaggeration=1,this.terrainExaggerationRelativeHeight=0,this.shadowState={shadowsEnabled:!0,shadowMaps:[],lightShadowMaps:[],nearPlane:1,farPlane:5e3,closestObjectSize:1e3,lastDirtyTime:0,outOfView:!0},this.imagerySplitPosition=0,this.frustumSplits=[],this.backgroundColor=void 0,this.light=void 0,this.minimumDisableDepthTestDistance=void 0,this.invertClassification=!1,this.invertClassificationColor=void 0,this.useLogDepth=!1,this.tilesetPassState=void 0,this.minimumTerrainHeight=0}function FrustumCommands(e,t){this.near=defaultValue(e,0),this.far=defaultValue(t,0);for(var i=Pass$1.NUMBER_OF_PASSES,r=new Array(i),n=new Array(i),a=0;a<i;++a)r[a]=[],n[a]=0;this.commands=r,this.indices=n}function getMultiClippingFunction(e,t){var i=e.dataTexture,r=i.width,n=i.height,a=e.maxCollectionLength,o=ClippingPlaneCollection.useFloatTexture(t)?getClippingPlaneFloat(r,n):getClippingPlaneUint8(r,n);return o+="\n",o+=clippingFunctionIntersect(e.length,a)}function clippingFunctionIntersect(e,t){return"float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix, sampler2D multiClippingPlanesLength)\n{\n vec4 position = czm_windowToEyeCoordinates(fragCoord);\n vec3 clipNormal = vec3(0.0);\n vec3 clipPosition = vec3(0.0);\n float clipAmount = 0.0;\n float pixelWidth = czm_metersPerPixel(position);\n int count = 0;\n for (int i = 0; i < "+e+"; ++i)\n {\n bool thisOneClipped = true;\n float thisCollectionClipAmount = 0.;\n int thisCollectionLength = int(texture2D(multiClippingPlanesLength, vec2((float(i) + 0.5)/float("+e+"), 0.5)).w);\n for (int j = 0; j < "+t+" ; ++j)\n {\n thisCollectionLength--;\n vec4 clippingPlane = getClippingPlane(clippingPlanes, count, clippingPlanesMatrix);\n clipNormal = clippingPlane.xyz;\n clipPosition = -clippingPlane.w * clipNormal;\n float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;\n thisCollectionClipAmount = max(amount, thisCollectionClipAmount);\n thisOneClipped = thisOneClipped && (amount <= 0.0);\n count++;\n if(thisCollectionLength == 0) break;\n }\n if (thisOneClipped)\n {\n discard;\n }\n if(clipAmount == 0.0) clipAmount = thisCollectionClipAmount;\n else if(thisCollectionClipAmount != 0.0) clipAmount = min(clipAmount, thisCollectionClipAmount);\n }\n return clipAmount;\n}\n"}function getClippingPlaneFloat(e,t){var i=1/t,r=1/e+"";-1===r.indexOf(".")&&(r+=".0");var n=i+"";return-1===n.indexOf(".")&&(n+=".0"),"vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n int pixY = clippingPlaneNumber / "+e+";\n int pixX = clippingPlaneNumber - (pixY * "+e+");\n float u = (float(pixX) + 0.5) * "+r+";\n float v = (float(pixY) + 0.5) * "+n+";\n vec4 plane = texture2D(packedClippingPlanes, vec2(u, v));\n return czm_transformPlane(plane, transform);\n}\n"}function getClippingPlaneUint8(e,t){var i=1/t,r=1/e+"";-1===r.indexOf(".")&&(r+=".0");var n=i+"";return-1===n.indexOf(".")&&(n+=".0"),"vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n int clippingPlaneStartIndex = clippingPlaneNumber * 2;\n int pixY = clippingPlaneStartIndex / "+e+";\n int pixX = clippingPlaneStartIndex - (pixY * "+e+");\n float u = (float(pixX) + 0.5) * "+r+";\n float v = (float(pixY) + 0.5) * "+n+";\n vec4 oct32 = texture2D(packedClippingPlanes, vec2(u, v)) * 255.0;\n vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);\n vec4 plane;\n plane.xyz = czm_octDecode(oct, 65535.0);\n plane.w = czm_unpackFloat(texture2D(packedClippingPlanes, vec2(u + "+r+", v)));\n return czm_transformPlane(plane, transform);\n}\n"}Fog.prototype.update=function(e){if(e.fog.enabled=this.enabled){var t=e.camera,i=t.positionCartographic;if(!defined(i)||i.height>8e5||e.mode!==SceneMode$1.SCENE3D)e.fog.enabled=!1;else{var r=i.height,n=findInterval(r),a=CesiumMath.clamp((r-heightsTable[n])/(heightsTable[n+1]-heightsTable[n]),0,1),o=CesiumMath.lerp(densityTable[n],densityTable[n+1],a),s=1e6*this.density;o=o*(s-s/tableStartDensity*tableEndDensity)*1e-6;var l=Cartesian3.normalize(t.positionWC,scratchPositionNormal$1);o*=1-Math.abs(Cartesian3.dot(t.directionWC,l)),e.fog.density=o,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness}}},FrameRateMonitor.defaultSettings={samplingWindow:5,quietPeriod:2,warmupPeriod:5,minimumFrameRateDuringWarmup:4,minimumFrameRateAfterWarmup:8},FrameRateMonitor.fromScene=function(e){return defined(e._frameRateMonitor)&&!e._frameRateMonitor.isDestroyed()||(e._frameRateMonitor=new FrameRateMonitor({scene:e})),e._frameRateMonitor},Object.defineProperties(FrameRateMonitor.prototype,{scene:{get:function(){return this._scene}},lowFrameRate:{get:function(){return this._lowFrameRate}},nominalFrameRate:{get:function(){return this._nominalFrameRate}},lastFramesPerSecond:{get:function(){return this._lastFramesPerSecond}}}),FrameRateMonitor.prototype.pause=function(){++this._pauseCount,1===this._pauseCount&&(this._frameTimes.length=0,this._lastFramesPerSecond=void 0)},FrameRateMonitor.prototype.unpause=function(){--this._pauseCount,this._pauseCount<=0&&(this._pauseCount=0,this._needsQuietPeriod=!0)},FrameRateMonitor.prototype.isDestroyed=function(){return!1},FrameRateMonitor.prototype.destroy=function(){return this._preUpdateRemoveListener(),defined(this._visibilityChangeRemoveListener)&&this._visibilityChangeRemoveListener(),destroyObject(this)};var GlobeFS="uniform vec4 u_initialColor;\n#if TEXTURE_UNITS > 0\nuniform sampler2D u_dayTextures[TEXTURE_UNITS];\nuniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\nuniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS];\n#ifdef APPLY_ALPHA\nuniform float u_dayTextureAlpha[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_DAY_NIGHT_ALPHA\nuniform float u_dayTextureNightAlpha[TEXTURE_UNITS];\nuniform float u_dayTextureDayAlpha[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_SPLIT\nuniform float u_dayTextureSplit[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_BRIGHTNESS\nuniform float u_dayTextureBrightness[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_CONTRAST\nuniform float u_dayTextureContrast[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_HUE\nuniform float u_dayTextureHue[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_SATURATION\nuniform float u_dayTextureSaturation[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_GAMMA\nuniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_IMAGERY_CUTOUT\nuniform vec4 u_dayTextureCutoutRectangles[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_COLOR_TO_ALPHA\nuniform vec4 u_colorsToAlpha[TEXTURE_UNITS];\n#endif\nuniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nuniform sampler2D u_waterMask;\nuniform vec4 u_waterMaskTranslationAndScale;\nuniform float u_zoomedOutOceanSpecularIntensity;\n#endif\n#ifdef SHOW_OCEAN_WAVES\nuniform sampler2D u_oceanNormalMap;\n#endif\n#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)\nuniform vec2 u_lightingFadeDistance;\n#endif\n#ifdef TILE_LIMIT_RECTANGLE\nuniform vec4 u_cartographicLimitRectangle;\n#endif\n#ifdef GROUND_ATMOSPHERE\nuniform vec2 u_nightFadeDistance;\n#endif\n#if defined(ENABLE_SLOPE_MAP)\nuniform sampler2D u_slopeColorsTexture;\n#endif\n#ifdef ENABLE_MULTI_CLIPPING_PLANES\nuniform mediump sampler2D u_multiClippingPlanesLength;\n#endif\n#if defined(ENABLE_CLIPPING_PLANES) || defined(ENABLE_MULTI_CLIPPING_PLANES) // SmartEarth\nuniform highp sampler2D u_clippingPlanes;\nuniform mat4 u_clippingPlanesMatrix;\nuniform vec4 u_clippingPlanesEdgeStyle;\n#endif\n#if defined(FOG) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))\nuniform float u_minimumBrightness;\n#endif\n#ifdef COLOR_CORRECT\nuniform vec3 u_hsbShift;\n#endif\n#ifdef HIGHLIGHT_FILL_TILE\nuniform vec4 u_fillHighlightColor;\n#endif\n#ifdef TRANSLUCENT\nuniform vec4 u_frontFaceAlphaByDistance;\nuniform vec4 u_backFaceAlphaByDistance;\nuniform vec4 u_translucencyRectangle;\n#endif\n#ifdef UNDERGROUND_COLOR\nuniform vec4 u_undergroundColor;\nuniform vec4 u_undergroundColorAlphaByDistance;\n#endif\n#ifdef ENABLE_VERTEX_LIGHTING\nuniform float u_lambertDiffuseMultiplier;\n#endif\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec3 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef APPLY_MATERIAL\nvarying float v_height;\nvarying float v_slope;\nvarying float v_aspect;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nvarying float v_distance;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvarying vec3 v_fogRayleighColor;\nvarying vec3 v_fogMieColor;\n#endif\n#ifdef GROUND_ATMOSPHERE\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\n#endif\n#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nfloat interpolateByDistance(vec4 nearFarScalar, float distance)\n{\nfloat startDistance = nearFarScalar.x;\nfloat startValue = nearFarScalar.y;\nfloat endDistance = nearFarScalar.z;\nfloat endValue = nearFarScalar.w;\nfloat t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);\nreturn mix(startValue, endValue, t);\n}\n#endif\n#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) || defined(APPLY_MATERIAL)\nvec4 alphaBlend(vec4 sourceColor, vec4 destinationColor)\n{\nreturn sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);\n}\n#endif\n#ifdef TRANSLUCENT\nbool inTranslucencyRectangle()\n{\nreturn\nv_textureCoordinates.x > u_translucencyRectangle.x &&\nv_textureCoordinates.x < u_translucencyRectangle.z &&\nv_textureCoordinates.y > u_translucencyRectangle.y &&\nv_textureCoordinates.y < u_translucencyRectangle.w;\n}\n#endif\nvec4 sampleAndBlend(\nvec4 previousColor,\nsampler2D textureToSample,\nvec2 tileTextureCoordinates,\nvec4 textureCoordinateRectangle,\nvec4 textureCoordinateTranslationAndScale,\nfloat textureAlpha,\nfloat textureNightAlpha,\nfloat textureDayAlpha,\nfloat textureBrightness,\nfloat textureContrast,\nfloat textureHue,\nfloat textureSaturation,\nfloat textureOneOverGamma,\nfloat split,\nvec4 colorToAlpha,\nfloat nightBlend)\n{\nvec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nalphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\n#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)\ntextureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightBlend);\n#endif\nvec2 translation = textureCoordinateTranslationAndScale.xy;\nvec2 scale = textureCoordinateTranslationAndScale.zw;\nvec2 textureCoordinates = tileTextureCoordinates * scale + translation;\nvec4 value = texture2D(textureToSample, textureCoordinates);\nvec3 color = value.rgb;\nfloat alpha = value.a;\n#ifdef APPLY_COLOR_TO_ALPHA\nvec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);\ncolorDiff.r = max(max(colorDiff.r, colorDiff.g), colorDiff.b);\nalpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);\n#endif\n#if !defined(APPLY_GAMMA)\nvec4 tempColor = czm_gammaCorrect(vec4(color, alpha));\ncolor = tempColor.rgb;\nalpha = tempColor.a;\n#else\ncolor = pow(color, vec3(textureOneOverGamma));\n#endif\n#ifdef APPLY_SPLIT\nfloat splitPosition = czm_imagerySplitPosition;\nif (split < 0.0 && gl_FragCoord.x > splitPosition) {\nalpha = 0.0;\n}\nelse if (split > 0.0 && gl_FragCoord.x < splitPosition) {\nalpha = 0.0;\n}\n#endif\n#ifdef APPLY_BRIGHTNESS\ncolor = mix(vec3(0.0), color, textureBrightness);\n#endif\n#ifdef APPLY_CONTRAST\ncolor = mix(vec3(0.5), color, textureContrast);\n#endif\n#ifdef APPLY_HUE\ncolor = czm_hue(color, textureHue);\n#endif\n#ifdef APPLY_SATURATION\ncolor = czm_saturation(color, textureSaturation);\n#endif\nfloat sourceAlpha = alpha * textureAlpha;\nfloat outAlpha = mix(previousColor.a, 1.0, sourceAlpha);\noutAlpha += sign(outAlpha) - 1.0;\nvec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;\nreturn vec4(outColor, max(outAlpha, 0.0));\n}\nvec3 colorCorrect(vec3 rgb) {\n#ifdef COLOR_CORRECT\nvec3 hsb = czm_RGBToHSB(rgb);\nhsb.x += u_hsbShift.x;\nhsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0);\nhsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0;\nrgb = czm_HSBToRGB(hsb);\n#endif\nreturn rgb;\n}\nvec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend);\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade);\n#ifdef GROUND_ATMOSPHERE\nvec3 computeGroundAtmosphereColor(vec3 fogColor, vec4 finalColor, vec3 atmosphereLightDirection, float cameraDist);\n#endif\nconst float fExposure = 2.0;\nvoid main()\n{\n#ifdef TILE_LIMIT_RECTANGLE\nif (v_textureCoordinates.x < u_cartographicLimitRectangle.x || u_cartographicLimitRectangle.z < v_textureCoordinates.x ||\nv_textureCoordinates.y < u_cartographicLimitRectangle.y || u_cartographicLimitRectangle.w < v_textureCoordinates.y)\n{\ndiscard;\n}\n#endif\n#ifdef ENABLE_CLIPPING_PLANES\nfloat clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix);\n#endif\n#ifdef ENABLE_MULTI_CLIPPING_PLANES\nfloat clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix, u_multiClippingPlanesLength);\n#endif\n#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR)\nvec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0));\nvec3 normalEC = czm_normal3D * normalMC;\n#endif\n#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)\nfloat nightBlend = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0);\n#else\nfloat nightBlend = 0.0;\n#endif\nvec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightBlend);\n#ifdef SHOW_TILE_BOUNDARIES\nif (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||\nv_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))\n{\ncolor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n#endif\n#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)\nfloat cameraDist;\nif (czm_sceneMode == czm_sceneMode2D)\n{\ncameraDist = max(czm_frustumPlanes.x - czm_frustumPlanes.y, czm_frustumPlanes.w - czm_frustumPlanes.z) * 0.5;\n}\nelse if (czm_sceneMode == czm_sceneModeColumbusView)\n{\ncameraDist = -czm_view[3].z;\n}\nelse\n{\ncameraDist = length(czm_view[3]);\n}\nfloat fadeOutDist = u_lightingFadeDistance.x;\nfloat fadeInDist = u_lightingFadeDistance.y;\nif (czm_sceneMode != czm_sceneMode3D) {\nvec3 radii = czm_ellipsoidRadii;\nfloat maxRadii = max(radii.x, max(radii.y, radii.z));\nfadeOutDist -= maxRadii;\nfadeInDist -= maxRadii;\n}\nfloat fade = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\n#else\nfloat fade = 0.0;\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nvec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\nvec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\nvec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation;\nwaterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y;\nfloat mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;\nif (mask > 0.0)\n{\nmat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\nvec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\nvec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\nvec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\ncolor = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask, fade);\n}\n#endif\n#ifdef APPLY_MATERIAL\nczm_materialInput materialInput;\nmaterialInput.st = v_textureCoordinates.st;\nmaterialInput.normalEC = normalize(v_normalEC);\nmaterialInput.positionToEyeEC = -v_positionEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalize(v_normalEC));\nmaterialInput.slope = v_slope;\nmaterialInput.height = v_height;\nmaterialInput.aspect = v_aspect;\nczm_material material = czm_getMaterial(materialInput);\nvec4 materialColor = vec4(material.diffuse, material.alpha);\ncolor = alphaBlend(materialColor, color);\n#endif\n#ifdef ENABLE_VERTEX_LIGHTING\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + 0.3, 0.0, 1.0);\nvec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);\n#elif defined(ENABLE_DAYNIGHT_SHADING)\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\ndiffuseIntensity = mix(1.0, diffuseIntensity, fade);\nvec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);\n#else\nvec4 finalColor = color;\n#endif\n#if defined(ENABLE_SLOPE_MAP)\n#if defined(SMOOTH_SLOPE_AT_HIGHER_ALT)\nfinalColor = vec4(texture2D(u_slopeColorsTexture, vec2(0., 1.)).rgb * 0.5 + color.rgb * 0.5, 1.);\n#else\nvec3 ellipsoidNormal = normalize(v_positionMC.xyz);\nfloat n;\nif (v_normalMC.r >= 123.456 - 1.0 && v_normalMC.r <= 123.456 + 1.0){\ngl_FragColor = vec4(vec3(0.66) * 0.5 + finalColor.rgb * 0.5, 1.0);\nreturn;\n}\nelse{\nn = abs(dot(v_normalMC, ellipsoidNormal));\n}\nvec3 texColor = texture2D(u_slopeColorsTexture, vec2(0., n)).rgb;\nfinalColor = vec4(texColor * 0.5 + color.rgb * 0.5, 1.);\n#endif\n#endif\n#ifdef ENABLE_CLIPPING_PLANES\nvec4 clippingPlanesEdgeColor = vec4(1.0);\nclippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb;\nfloat clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a;\nif (clipDistance < clippingPlanesEdgeWidth)\n{\nfinalColor = clippingPlanesEdgeColor;\n}\n#endif\n#ifdef HIGHLIGHT_FILL_TILE\nfinalColor = vec4(mix(finalColor.rgb, u_fillHighlightColor.rgb, u_fillHighlightColor.a), finalColor.a);\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvec3 fogColor = colorCorrect(v_fogMieColor) + finalColor.rgb * colorCorrect(v_fogRayleighColor);\n#ifndef HDR\nfogColor = vec3(1.0) - exp(-fExposure * fogColor);\n#endif\n#endif\n#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)\nvec3 atmosphereLightDirection = czm_sunDirectionWC;\n#else\nvec3 atmosphereLightDirection = czm_lightDirectionWC;\n#endif\n#ifdef FOG\n#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))\nfloat darken = clamp(dot(normalize(czm_viewerPositionWC), atmosphereLightDirection), u_minimumBrightness, 1.0);\nfogColor *= darken;\n#endif\n#ifdef HDR\nconst float modifier = 0.15;\nfinalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor, modifier), finalColor.a);\n#else\nfinalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor), finalColor.a);\n#endif\n#endif\n#ifdef GROUND_ATMOSPHERE\nif (!czm_backFacing())\n{\nvec3 groundAtmosphereColor = computeGroundAtmosphereColor(fogColor, finalColor, atmosphereLightDirection, cameraDist);\nfinalColor = vec4(mix(finalColor.rgb, groundAtmosphereColor, fade), finalColor.a);\n}\n#endif\n#ifdef UNDERGROUND_COLOR\nif (czm_backFacing())\n{\nfloat distanceFromEllipsoid = max(czm_eyeHeight, 0.0);\nfloat distance = max(v_distance - distanceFromEllipsoid, 0.0);\nfloat blendAmount = interpolateByDistance(u_undergroundColorAlphaByDistance, distance);\nvec4 undergroundColor = vec4(u_undergroundColor.rgb, u_undergroundColor.a * blendAmount);\nfinalColor = alphaBlend(undergroundColor, finalColor);\n}\n#endif\n#ifdef TRANSLUCENT\nif (inTranslucencyRectangle())\n{\nvec4 alphaByDistance = gl_FrontFacing ? u_frontFaceAlphaByDistance : u_backFaceAlphaByDistance;\nfinalColor.a *= interpolateByDistance(alphaByDistance, v_distance);\n}\n#endif\ngl_FragColor = finalColor;\n}\n#ifdef GROUND_ATMOSPHERE\nvec3 computeGroundAtmosphereColor(vec3 fogColor, vec4 finalColor, vec3 atmosphereLightDirection, float cameraDist)\n{\n#if defined(PER_FRAGMENT_GROUND_ATMOSPHERE) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))\nfloat mpp = czm_metersPerPixel(vec4(0.0, 0.0, -czm_currentFrustum.x, 1.0), 1.0);\nvec2 xy = gl_FragCoord.xy / czm_viewport.zw * 2.0 - vec2(1.0);\nxy *= czm_viewport.zw * mpp * 0.5;\nvec3 direction = normalize(vec3(xy, -czm_currentFrustum.x));\nczm_ray ray = czm_ray(vec3(0.0), direction);\nvec3 ellipsoid_center = czm_view[3].xyz;\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);\nvec3 ellipsoidPosition = czm_pointAlongRay(ray, intersection.start);\nellipsoidPosition = (czm_inverseView * vec4(ellipsoidPosition, 1.0)).xyz;\nAtmosphereColor atmosColor = computeGroundAtmosphereFromSpace(ellipsoidPosition, true, atmosphereLightDirection);\nvec3 groundAtmosphereColor = colorCorrect(atmosColor.mie) + finalColor.rgb * colorCorrect(atmosColor.rayleigh);\n#ifndef HDR\ngroundAtmosphereColor = vec3(1.0) - exp(-fExposure * groundAtmosphereColor);\n#endif\nfloat fadeInDist = u_nightFadeDistance.x;\nfloat fadeOutDist = u_nightFadeDistance.y;\nfloat sunlitAtmosphereIntensity = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\n#ifdef HDR\nsunlitAtmosphereIntensity = max(sunlitAtmosphereIntensity * sunlitAtmosphereIntensity, 0.03);\n#endif\ngroundAtmosphereColor = mix(groundAtmosphereColor, fogColor, sunlitAtmosphereIntensity);\n#else\nvec3 groundAtmosphereColor = fogColor;\n#endif\n#ifdef HDR\ngroundAtmosphereColor = czm_saturation(groundAtmosphereColor, 1.6);\n#endif\nreturn groundAtmosphereColor;\n}\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nfloat waveFade(float edge0, float edge1, float x)\n{\nfloat y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\nreturn pow(1.0 - y, 5.0);\n}\nfloat linearFade(float edge0, float edge1, float x)\n{\nreturn clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\nconst float oceanFrequencyLowAltitude = 825000.0;\nconst float oceanAnimationSpeedLowAltitude = 0.004;\nconst float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;\nconst float oceanSpecularIntensity = 0.5;\nconst float oceanFrequencyHighAltitude = 125000.0;\nconst float oceanAnimationSpeedHighAltitude = 0.008;\nconst float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue, float fade)\n{\nvec3 positionToEyeEC = -positionEyeCoordinates;\nfloat positionToEyeECLength = length(positionToEyeEC);\nvec3 normalizedPositionToEyeEC = normalize(normalize(positionToEyeEC));\nfloat waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);\n#ifdef SHOW_OCEAN_WAVES\nfloat time = czm_frameNumber * oceanAnimationSpeedHighAltitude;\nvec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);\nvec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);\ntime = czm_frameNumber * oceanAnimationSpeedLowAltitude;\nnoise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);\nvec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);\nfloat highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);\nfloat lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);\nvec3 normalTangentSpace =\n(highAltitudeFade * normalTangentSpaceHighAltitude) +\n(lowAltitudeFade * normalTangentSpaceLowAltitude);\nnormalTangentSpace = normalize(normalTangentSpace);\nnormalTangentSpace.xy *= waveIntensity;\nnormalTangentSpace = normalize(normalTangentSpace);\n#else\nvec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);\n#endif\nvec3 normalEC = enuToEye * normalTangentSpace;\nconst vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);\nfloat diffuseIntensity = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * maskValue;\nvec3 diffuseHighlight = waveHighlightColor * diffuseIntensity * (1.0 - fade);\n#ifdef SHOW_OCEAN_WAVES\nfloat tsPerturbationRatio = normalTangentSpace.z;\nvec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);\n#else\nvec3 nonDiffuseHighlight = vec3(0.0);\n#endif\nfloat specularIntensity = czm_getSpecular(czm_lightDirectionEC, normalizedPositionToEyeEC, normalEC, 10.0);\nfloat surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);\nfloat specular = specularIntensity * surfaceReflectance;\n#ifdef HDR\nspecular *= 1.4;\nfloat e = 0.2;\nfloat d = 3.3;\nfloat c = 1.7;\nvec3 color = imageryColor.rgb + (c * (vec3(e) + imageryColor.rgb * d) * (diffuseHighlight + nonDiffuseHighlight + specular));\n#else\nvec3 color = imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular;\n#endif\nreturn vec4(color, imageryColor.a);\n}\n#endif // #ifdef SHOW_REFLECTIVE_OCEAN\n",GlobeVS="#ifdef QUANTIZATION_BITS12\nattribute vec4 compressed0;\nattribute float compressed1;\n#else\nattribute vec4 position3DAndHeight;\nattribute vec4 textureCoordAndEncodedNormals;\n#endif\n#ifdef GEODETIC_SURFACE_NORMALS\nattribute vec3 geodeticSurfaceNormal;\n#endif\n#ifdef EXAGGERATION\nuniform vec2 u_terrainExaggerationAndRelativeHeight;\n#endif\nuniform vec3 u_center3D;\nuniform mat4 u_modifiedModelView;\nuniform mat4 u_modifiedModelViewProjection;\nuniform vec4 u_tileRectangle;\nuniform vec2 u_southAndNorthLatitude;\nuniform vec2 u_southMercatorYAndOneOverHeight;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec3 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef APPLY_MATERIAL\nvarying float v_slope;\nvarying float v_aspect;\nvarying float v_height;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nvarying float v_distance;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvarying vec3 v_fogMieColor;\nvarying vec3 v_fogRayleighColor;\n#endif\nvec4 getPosition(vec3 position, float height, vec2 textureCoordinates);\nfloat get2DYPositionFraction(vec2 textureCoordinates);\nvec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn u_modifiedModelViewProjection * vec4(position, 1.0);\n}\nfloat get2DMercatorYPositionFraction(vec2 textureCoordinates)\n{\nconst float maxTileWidth = 0.003068;\nfloat positionFraction = textureCoordinates.y;\nfloat southLatitude = u_southAndNorthLatitude.x;\nfloat northLatitude = u_southAndNorthLatitude.y;\nif (northLatitude - southLatitude > maxTileWidth)\n{\nfloat southMercatorY = u_southMercatorYAndOneOverHeight.x;\nfloat oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;\nfloat currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);\ncurrentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\npositionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);\n}\nreturn positionFraction;\n}\nfloat get2DGeographicYPositionFraction(vec2 textureCoordinates)\n{\nreturn textureCoordinates.y;\n}\nvec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)\n{\nfloat yPositionFraction = get2DYPositionFraction(textureCoordinates);\nvec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nreturn u_modifiedModelViewProjection * rtcPosition2D;\n}\nvec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn getPositionPlanarEarth(position, 0.0, textureCoordinates);\n}\nvec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn getPositionPlanarEarth(position, height, textureCoordinates);\n}\nvec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)\n{\nvec3 position3DWC = position + u_center3D;\nfloat yPositionFraction = get2DYPositionFraction(textureCoordinates);\nvec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nvec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\nreturn czm_modelViewProjection * morphPosition;\n}\n#ifdef QUANTIZATION_BITS12\nuniform vec2 u_minMaxHeight;\nuniform mat4 u_scaleAndBias;\n#endif\nvoid main()\n{\n#ifdef QUANTIZATION_BITS12\nvec2 xy = czm_decompressTextureCoordinates(compressed0.x);\nvec2 zh = czm_decompressTextureCoordinates(compressed0.y);\nvec3 position = vec3(xy, zh.x);\nfloat height = zh.y;\nvec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);\nheight = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;\nposition = (u_scaleAndBias * vec4(position, 1.0)).xyz;\n#if defined(ENABLE_SLOPE_MAP) || ((defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y))\nfloat webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\nfloat encodedNormal = compressed1;\n#elif defined(INCLUDE_WEB_MERCATOR_Y)\nfloat webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\nfloat encodedNormal = 0.0;\n#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = compressed0.w;\n#else\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = 0.0;\n#endif\n#else\nvec3 position = position3DAndHeight.xyz;\nfloat height = position3DAndHeight.w;\nvec2 textureCoordinates = textureCoordAndEncodedNormals.xy;\n#if defined(ENABLE_SLOPE_MAP) || ((defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y))\nfloat webMercatorT = textureCoordAndEncodedNormals.z;\nfloat encodedNormal = textureCoordAndEncodedNormals.w;\n#elif defined(ENABLE_SLOPE_MAP) || defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = textureCoordAndEncodedNormals.z;\n#elif defined(INCLUDE_WEB_MERCATOR_Y)\nfloat webMercatorT = textureCoordAndEncodedNormals.z;\nfloat encodedNormal = 0.0;\n#else\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = 0.0;\n#endif\n#endif\nvec3 position3DWC = position + u_center3D;\n#ifdef GEODETIC_SURFACE_NORMALS\nvec3 ellipsoidNormal = geodeticSurfaceNormal;\n#else\nvec3 ellipsoidNormal = normalize(position3DWC);\n#endif\n#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)\nfloat exaggeration = u_terrainExaggerationAndRelativeHeight.x;\nfloat relativeHeight = u_terrainExaggerationAndRelativeHeight.y;\nfloat newHeight = (height - relativeHeight) * exaggeration + relativeHeight;\nfloat minRadius = min(min(czm_ellipsoidRadii.x, czm_ellipsoidRadii.y), czm_ellipsoidRadii.z);\nnewHeight = max(newHeight, -minRadius);\nvec3 offset = ellipsoidNormal * (newHeight - height);\nposition += offset;\nposition3DWC += offset;\nheight = newHeight;\n#endif\ngl_Position = getPosition(position, height, textureCoordinates);\nv_textureCoordinates = vec3(textureCoordinates, webMercatorT);\n#if defined(ENABLE_SLOPE_MAP) || defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\nv_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\nv_positionMC = position3DWC;\nvec3 normalMC = czm_octDecode(encodedNormal);\n#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)\nvec3 projection = dot(normalMC, ellipsoidNormal) * ellipsoidNormal;\nvec3 rejection = normalMC - projection;\nnormalMC = normalize(projection + rejection * exaggeration);\n#endif\nv_normalMC = normalMC;\nif (encodedNormal == 31728.192) {\nv_normalMC = vec3(123.456,123.456,123.456);\n}\nv_normalEC = czm_normal3D * v_normalMC;\n#elif defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(GENERATE_POSITION) || defined(HDR)\nv_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\nv_positionMC = position3DWC;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nAtmosphereColor atmosFogColor = computeGroundAtmosphereFromSpace(position3DWC, false, vec3(0.0));\nv_fogMieColor = atmosFogColor.mie;\nv_fogRayleighColor = atmosFogColor.rayleigh;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nv_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);\n#endif\n#ifdef APPLY_MATERIAL\nfloat northPoleZ = czm_ellipsoidRadii.z;\nvec3 northPolePositionMC = vec3(0.0, 0.0, northPoleZ);\nvec3 vectorEastMC = normalize(cross(northPolePositionMC - v_positionMC, ellipsoidNormal));\nfloat dotProd = abs(dot(ellipsoidNormal, v_normalMC));\nv_slope = acos(dotProd);\nvec3 normalRejected = ellipsoidNormal * dotProd;\nvec3 normalProjected = v_normalMC - normalRejected;\nvec3 aspectVector = normalize(normalProjected);\nv_aspect = acos(dot(aspectVector, vectorEastMC));\nfloat determ = dot(cross(vectorEastMC, aspectVector), ellipsoidNormal);\nv_aspect = czm_branchFreeTernary(determ < 0.0, 2.0 * czm_pi - v_aspect, v_aspect);\nv_height = height;\n#endif\n}\n",GroundAtmosphere="const float Kr = 0.0025;\nconst float Km = 0.0015;\nconst float ESun = 15.0;\nconst float fKrESun = Kr * ESun;\nconst float fKmESun = Km * ESun;\nconst float fKr4PI = Kr * 4.0 * czm_pi;\nconst float fKm4PI = Km * 4.0 * czm_pi;\nconst vec3 v3InvWavelength = vec3(5.60204474633241, 9.473284437923038, 19.64380261047721);\nconst float fScaleDepth = 0.25;\nstruct AtmosphereColor\n{\nvec3 mie;\nvec3 rayleigh;\n};\nconst int nSamples = 2;\nconst float fSamples = 2.0;\nfloat scale(float fCos)\n{\nfloat x = 1.0 - fCos;\nreturn fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nAtmosphereColor computeGroundAtmosphereFromSpace(vec3 v3Pos, bool dynamicLighting, vec3 lightDirectionWC)\n{\nfloat fInnerRadius = czm_ellipsoidRadii.x;\nfloat fOuterRadius = czm_ellipsoidRadii.x * 1.025;\nfloat fOuterRadius2 = fOuterRadius * fOuterRadius;\nfloat fScale = 1.0 / (fOuterRadius - fInnerRadius);\nfloat fScaleOverScaleDepth = fScale / fScaleDepth;\nvec3 v3Ray = v3Pos - czm_viewerPositionWC;\nfloat fFar = length(v3Ray);\nv3Ray /= fFar;\nfloat fCameraHeight = length(czm_viewerPositionWC);\nfloat fCameraHeight2 = fCameraHeight * fCameraHeight;\nfloat B = 2.0 * length(czm_viewerPositionWC) * dot(normalize(czm_viewerPositionWC), v3Ray);\nfloat C = fCameraHeight2 - fOuterRadius2;\nfloat fDet = max(0.0, B*B - 4.0 * C);\nfloat fNear = 0.5 * (-B - sqrt(fDet));\nvec3 v3Start = czm_viewerPositionWC + v3Ray * fNear;\nfFar -= fNear;\nfloat fDepth = exp((fInnerRadius - fOuterRadius) / fScaleDepth);\nfloat fLightAngle = czm_branchFreeTernary(dynamicLighting, dot(lightDirectionWC, v3Pos) / length(v3Pos), 1.0);\nfloat fCameraAngle = dot(-v3Ray, v3Pos) / length(v3Pos);\nfloat fCameraScale = scale(fCameraAngle);\nfloat fLightScale = scale(fLightAngle);\nfloat fCameraOffset = fDepth*fCameraScale;\nfloat fTemp = (fLightScale + fCameraScale);\nfloat fSampleLength = fFar / fSamples;\nfloat fScaledLength = fSampleLength * fScale;\nvec3 v3SampleRay = v3Ray * fSampleLength;\nvec3 v3SamplePoint = v3Start + v3SampleRay * 0.5;\nvec3 v3FrontColor = vec3(0.0);\nvec3 v3Attenuate = vec3(0.0);\nfor(int i=0; i<nSamples; i++)\n{\nfloat fHeight = length(v3SamplePoint);\nfloat fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fHeight));\nfloat fScatter = fDepth*fTemp - fCameraOffset;\nv3Attenuate = exp(-fScatter * (v3InvWavelength * fKr4PI + fKm4PI));\nv3FrontColor += v3Attenuate * (fDepth * fScaledLength);\nv3SamplePoint += v3SampleRay;\n}\nAtmosphereColor color;\ncolor.mie = v3FrontColor * (v3InvWavelength * fKrESun + fKmESun);\ncolor.rayleigh = v3Attenuate;\nreturn color;\n}\n";function GlobeSurfaceShader(e,t,i,r,n,a){this.numberOfDayTextures=e,this.flags=t,this.material=i,this.shaderProgram=r,this.clippingShaderState=n,this.multiClippingShaderState=a}function GlobeSurfaceShaderSet(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function getPositionMode(e){var t;switch(e){case SceneMode$1.SCENE3D:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }";break;case SceneMode$1.SCENE2D:case SceneMode$1.COLUMBUS_VIEW:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }";break;case SceneMode$1.MORPHING:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }"}return t}function get2DYPositionFraction(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}GlobeSurfaceShaderSet.prototype.getShaderProgram=function(e){var t=e.frameState,i=e.surfaceTile,r=e.numberOfDayTextures,n=e.applyBrightness,a=e.applyContrast,o=e.applyHue,s=e.applySaturation,l=e.applyGamma,c=e.applyAlpha,u=e.applyDayNightAlpha,d=e.applySplit,h=e.showReflectiveOcean,p=e.showOceanWaves,f=e.enableLighting,m=e.dynamicAtmosphereLighting,g=e.dynamicAtmosphereLightingFromSun,_=e.showGroundAtmosphere,y=e.perFragmentGroundAtmosphere,v=e.hasVertexNormals,C=e.useWebMercatorProjection,T=e.enableFog,S=e.enableClippingPlanes,A=e.multiClippingPlanes,x=defined(A)&&A.length>0,E=e.clippingPlanes,b=e.clippedByBoundaries,P=e.hasImageryLayerCutout,D=e.colorCorrect,w=e.highlightFillTile,M=e.colorToAlpha,I=e.hasGeodeticSurfaceNormals,R=e.hasExaggeration,O=e.showUndergroundColor,B=e.translucent,L=e.showSlopeMap,F=e.smoothSlopeAtHigherAlt,N=0,V="",k=i.renderedMesh.encoding;k.quantization===TerrainQuantization$1.BITS12&&(N=1,V="QUANTIZATION_BITS12");var U=0,G="";b&&(U=1,G="TILE_LIMIT_RECTANGLE");var $=0,z="";P&&($=1,z="APPLY_IMAGERY_CUTOUT");var H=t.mode,W=H|n<<2|a<<3|o<<4|s<<5|l<<6|c<<7|h<<8|p<<9|f<<10|m<<11|g<<12|_<<13|y<<14|v<<15|C<<16|T<<17|N<<18|d<<19|S<<20|U<<21|$<<22|D<<23|w<<24|M<<25|I<<26|R<<27|O<<28|B<<29|u<<30|L<<31|F<<32|x<<33,j=0;defined(E)&&E.length>0&&(j=S?E.clippingPlanesState:0);var q=0;x&&(q=A.collectionsState);var X=i.surfaceShader;if(defined(X)&&X.numberOfDayTextures===r&&X.flags===W&&X.material===this.material&&X.clippingShaderState===j&&X.multiClippingShaderState===q)return X.shaderProgram;var Y=this._shadersByTexturesFlags[r];if(defined(Y)||(Y=this._shadersByTexturesFlags[r]=[]),!defined(X=Y[W])||X.material!==this.material||X.clippingShaderState!==j||X.multiClippingShaderState!==q){var K=this.baseVertexShaderSource.clone(),J=this.baseFragmentShaderSource.clone();0===j||defined(A)||J.sources.unshift(getClippingFunction(E,t.context)),0!==q&&J.sources.unshift(getMultiClippingFunction(A,t.context)),K.defines.push(V),J.defines.push("TEXTURE_UNITS "+r,G,z),n&&J.defines.push("APPLY_BRIGHTNESS"),a&&J.defines.push("APPLY_CONTRAST"),o&&J.defines.push("APPLY_HUE"),s&&J.defines.push("APPLY_SATURATION"),l&&J.defines.push("APPLY_GAMMA"),c&&J.defines.push("APPLY_ALPHA"),u&&J.defines.push("APPLY_DAY_NIGHT_ALPHA"),h&&(J.defines.push("SHOW_REFLECTIVE_OCEAN"),K.defines.push("SHOW_REFLECTIVE_OCEAN")),p&&J.defines.push("SHOW_OCEAN_WAVES"),L&&(K.defines.push("ENABLE_SLOPE_MAP"),J.defines.push("ENABLE_SLOPE_MAP")),F&&J.defines.push("SMOOTH_SLOPE_AT_HIGHER_ALT"),M&&J.defines.push("APPLY_COLOR_TO_ALPHA"),O&&(K.defines.push("UNDERGROUND_COLOR"),J.defines.push("UNDERGROUND_COLOR")),B&&(K.defines.push("TRANSLUCENT"),J.defines.push("TRANSLUCENT")),f&&(v?(K.defines.push("ENABLE_VERTEX_LIGHTING"),J.defines.push("ENABLE_VERTEX_LIGHTING")):(K.defines.push("ENABLE_DAYNIGHT_SHADING"),J.defines.push("ENABLE_DAYNIGHT_SHADING"))),m&&(J.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),g&&J.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN")),_&&(K.defines.push("GROUND_ATMOSPHERE"),J.defines.push("GROUND_ATMOSPHERE"),y&&J.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE")),K.defines.push("INCLUDE_WEB_MERCATOR_Y"),J.defines.push("INCLUDE_WEB_MERCATOR_Y"),T&&(K.defines.push("FOG"),J.defines.push("FOG")),d&&J.defines.push("APPLY_SPLIT"),S&&J.defines.push("ENABLE_CLIPPING_PLANES"),x&&J.defines.push("ENABLE_MULTI_CLIPPING_PLANES"),D&&J.defines.push("COLOR_CORRECT"),w&&J.defines.push("HIGHLIGHT_FILL_TILE"),I&&K.defines.push("GEODETIC_SURFACE_NORMALS"),R&&K.defines.push("EXAGGERATION");var Q=" vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend)\n {\n vec4 color = initialColor;\n";P&&(Q+=" vec4 cutoutAndColorResult;\n bool texelUnclipped;\n");for(var Z=0;Z<r;++Z)Q+=P?" cutoutAndColorResult = u_dayTextureCutoutRectangles["+Z+"];\n texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;\n cutoutAndColorResult = sampleAndBlend(\n":" color = sampleAndBlend(\n",Q+=" color,\n u_dayTextures["+Z+"],\n u_dayTextureUseWebMercatorT["+Z+"] ? textureCoordinates.xz : textureCoordinates.xy,\n u_dayTextureTexCoordsRectangle["+Z+"],\n u_dayTextureTranslationAndScale["+Z+"],\n "+(c?"u_dayTextureAlpha["+Z+"]":"1.0")+",\n "+(u?"u_dayTextureNightAlpha["+Z+"]":"1.0")+",\n"+(u?"u_dayTextureDayAlpha["+Z+"]":"1.0")+",\n"+(n?"u_dayTextureBrightness["+Z+"]":"0.0")+",\n "+(a?"u_dayTextureContrast["+Z+"]":"0.0")+",\n "+(o?"u_dayTextureHue["+Z+"]":"0.0")+",\n "+(s?"u_dayTextureSaturation["+Z+"]":"0.0")+",\n "+(l?"u_dayTextureOneOverGamma["+Z+"]":"0.0")+",\n "+(d?"u_dayTextureSplit["+Z+"]":"0.0")+",\n "+(M?"u_colorsToAlpha["+Z+"]":"vec4(0.0)")+",\n nightBlend );\n",P&&(Q+=" color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);\n");Q+=" return color;\n }",J.sources.push(Q),K.sources.push(getPositionMode(H)),K.sources.push(get2DYPositionFraction(C));var ee=ShaderProgram.fromCache({context:t.context,vertexShaderSource:K,fragmentShaderSource:J,attributeLocations:k.getAttributeLocations()});X=Y[W]=new GlobeSurfaceShader(r,W,this.material,ee,j,q)}return i.surfaceShader=X,X.shaderProgram},GlobeSurfaceShaderSet.prototype.destroy=function(){var e,t,i=this._shadersByTexturesFlags;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];if(!defined(n))continue;for(e in n)n.hasOwnProperty(e)&&defined(t=n[e])&&t.shaderProgram.destroy()}return destroyObject(this)};var ImageryState={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7},ImageryState$1=Object.freeze(ImageryState),QuadtreeTileLoadState={START:0,LOADING:1,DONE:2,FAILED:3},QuadtreeTileLoadState$1=Object.freeze(QuadtreeTileLoadState),TerrainState={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6},TerrainState$1=Object.freeze(TerrainState);function GlobeSurfaceTile(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new Cartesian4(0,0,1,1),this.terrainData=void 0,this.vertexArray=void 0,this.tileBoundingRegion=void 0,this.occludeePointInScaledSpace=new Cartesian3,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=TerrainState$1.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new BoundingSphere,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}Object.defineProperties(GlobeSurfaceTile.prototype,{eligibleForUnloading:{get:function(){for(var e=this.terrainState,t=!(e===TerrainState$1.RECEIVING||e===TerrainState$1.TRANSFORMING),i=this.imagery,r=0,n=i.length;t&&r<n;++r){var a=i[r];t=!defined(a.loadingImagery)||a.loadingImagery.state!==ImageryState$1.TRANSITIONING}return t}},renderedMesh:{get:function(){return defined(this.vertexArray)?this.mesh:defined(this.fill)?this.fill.mesh:void 0}}});var scratchCartographic$4=new Cartographic;function getPosition(e,t,i,r,n,a){var o=e.getExaggeratedPosition(r,n,a);if(defined(t)&&t!==SceneMode$1.SCENE3D){var s=i.ellipsoid.cartesianToCartographic(o,scratchCartographic$4);o=i.project(s,a),o=Cartesian3.fromElements(o.z,o.x,o.y,a)}return o}var scratchV0=new Cartesian3,scratchV1=new Cartesian3,scratchV2=new Cartesian3;function toggleGeodeticSurfaceNormals(e,t,i,r){var n=e.renderedMesh,a=n.vertices,o=n.encoding,s=a.length/o.stride,l=TerrainEncoding.clone(o);l.hasGeodeticSurfaceNormals=t;var c=(l=TerrainEncoding.clone(l)).stride,u=new Float32Array(s*c);t?o.addGeodeticSurfaceNormals(a,u,i):o.removeGeodeticSurfaceNormals(a,u),n.vertices=u,n.stride=c,n!==e.mesh?(GlobeSurfaceTile._freeVertexArray(e.fill.vertexArray),e.fill.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(r.context,n)):(GlobeSurfaceTile._freeVertexArray(e.vertexArray),e.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(r.context,n)),GlobeSurfaceTile._freeVertexArray(e.wireframeVertexArray),e.wireframeVertexArray=void 0}function prepareNewTile(e,t,i){var r=t.getTileDataAvailable(e.x,e.y,e.level);if(!defined(r)&&defined(e.parent)){var n=e.parent,a=n.data;defined(a)&&defined(a.terrainData)&&(r=a.terrainData.isChildAvailable(n.x,n.y,e.x,e.y))}!1===r&&(e.data.terrainState=TerrainState$1.FAILED);for(var o=0,s=i.length;o<s;++o){var l=i.get(o);l.show&&l._createTileImagerySkeletons(e,t)}}function processTerrainStateMachine(e,t,i,r,n,a){var o=e.data,s=e.parent;o.terrainState===TerrainState$1.FAILED&&void 0!==s&&(void 0!==s.data&&void 0!==s.data.terrainData&&!1!==s.data.terrainData.canUpsample||GlobeSurfaceTile.processStateMachine(s,t,i,r,n,a,!0));if(o.terrainState===TerrainState$1.FAILED&&upsample(o,e,t,i,e.x,e.y,e.level),o.terrainState===TerrainState$1.UNLOADED&&requestTileGeometry(o,i,e.x,e.y,e.level),o.terrainState===TerrainState$1.RECEIVED&&transform(o,t,i,e.x,e.y,e.level),o.terrainState===TerrainState$1.TRANSFORMED&&(createResources$2(o,t.context,i,e.x,e.y,e.level,a),o.updateExaggeration(e,t,n)),o.terrainState>=TerrainState$1.RECEIVED&&void 0===o.waterMaskTexture&&i.hasWaterMask)if(void 0!==o.terrainData.waterMask)createWaterMaskTextureIfNeeded(t.context,o);else{var l=o._findAncestorTileWithTerrainData(e);defined(l)&&defined(l.data.waterMaskTexture)&&(o.waterMaskTexture=l.data.waterMaskTexture,++o.waterMaskTexture.referenceCount,o._computeWaterMaskTranslationAndScale(e,l,o.waterMaskTranslationAndScale))}}function upsample(e,t,i,r,n,a,o){var s=t.parent;if(s){var l=s.data.terrainData,c=s.x,u=s.y,d=s.level;if(defined(l)){var h=l.upsample(r.tilingScheme,c,u,d,n,a,o);defined(h)&&(e.terrainState=TerrainState$1.RECEIVING,when(h,(function(t){e.terrainData=t,e.terrainState=TerrainState$1.RECEIVED}),(function(){e.terrainState=TerrainState$1.FAILED})))}}else t.state=QuadtreeTileLoadState$1.FAILED}function requestTileGeometry(e,t,i,r,n){function a(t){e.terrainData=t,e.terrainState=TerrainState$1.RECEIVED,e.request=void 0}function o(a){if(e.request.state===RequestState$1.CANCELLED)return e.terrainData=void 0,e.terrainState=TerrainState$1.UNLOADED,void(e.request=void 0);e.terrainState=TerrainState$1.FAILED,e.request=void 0;var o="Failed to obtain terrain tile X: "+i+" Y: "+r+" Level: "+n+'. Error message: "'+a+'"';t._requestError=TileProviderError.handleError(t._requestError,t,t.errorEvent,o,i,r,n,s)}function s(){var s=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.TERRAIN});e.request=s;var l=t.requestTileGeometry(i,r,n,s);defined(l)?(e.terrainState=TerrainState$1.RECEIVING,when(l,a,o)):(e.terrainState=TerrainState$1.UNLOADED,e.request=void 0)}s()}GlobeSurfaceTile.prototype.pick=function(e,t,i,r,n){var a=this.renderedMesh;if(defined(a)){for(var o=a.vertices,s=a.indices,l=a.encoding,c=s.length,u=Number.MAX_VALUE,d=0;d<c;d+=3){var h=s[d],p=s[d+1],f=s[d+2],m=getPosition(l,t,i,o,h,scratchV0),g=getPosition(l,t,i,o,p,scratchV1),_=getPosition(l,t,i,o,f,scratchV2),y=IntersectionTests.rayTriangleParametric(e,m,g,_,r);defined(y)&&y<u&&y>=0&&(u=y)}return u!==Number.MAX_VALUE?Ray.getPoint(e,u,n):void 0}},GlobeSurfaceTile.prototype.freeResources=function(){defined(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,this.terrainState=TerrainState$1.UNLOADED,this.mesh=void 0,this.fill=this.fill&&this.fill.destroy();for(var e=this.imagery,t=0,i=e.length;t<i;++t)e[t].freeResources();this.imagery.length=0,this.freeVertexArray()},GlobeSurfaceTile.prototype.freeVertexArray=function(){GlobeSurfaceTile._freeVertexArray(this.vertexArray),this.vertexArray=void 0,GlobeSurfaceTile._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0},GlobeSurfaceTile.initialize=function(e,t,i){var r=e.data;defined(r)||(r=e.data=new GlobeSurfaceTile),e.state===QuadtreeTileLoadState$1.START&&(prepareNewTile(e,t,i),e.state=QuadtreeTileLoadState$1.LOADING)},GlobeSurfaceTile.processStateMachine=function(e,t,i,r,n,a,o){GlobeSurfaceTile.initialize(e,i,r);var s=e.data;if(e.state===QuadtreeTileLoadState$1.LOADING&&processTerrainStateMachine(e,t,i,r,n,a),!o){var l=e.renderable;e.renderable=defined(s.vertexArray);var c=s.terrainState===TerrainState$1.READY;e.upsampledFromParent=defined(s.terrainData)&&s.terrainData.wasCreatedByUpsampling();var u=s.processImagery(e,i,t);if(c&&u){var d=e._loadedCallbacks,h={};for(var p in d)d.hasOwnProperty(p)&&(d[p](e)||(h[p]=d[p]));e._loadedCallbacks=h,e.state=QuadtreeTileLoadState$1.DONE}l&&(e.renderable=!0)}},GlobeSurfaceTile.prototype.processImagery=function(e,t,i,r){var n,a,o=e.data,s=e.upsampledFromParent,l=!1,c=!0,u=o.imagery;for(n=0,a=u.length;n<a;++n){var d=u[n];if(defined(d.loadingImagery)){if(d.loadingImagery.state===ImageryState$1.PLACEHOLDER){var h=d.loadingImagery.imageryLayer;if(h.imageryProvider.ready){d.freeResources(),u.splice(n,1),h._createTileImagerySkeletons(e,t,n),--n,a=u.length;continue}s=!1}var p=d.processStateMachine(e,i,r);c=c&&p,l=l||p||defined(d.readyImagery),s=s&&defined(d.loadingImagery)&&(d.loadingImagery.state===ImageryState$1.FAILED||d.loadingImagery.state===ImageryState$1.INVALID)}else s=!1}return e.upsampledFromParent=s,e.renderable=e.renderable&&(l||c),c},GlobeSurfaceTile.prototype.addGeodeticSurfaceNormals=function(e,t){toggleGeodeticSurfaceNormals(this,!0,e,t)},GlobeSurfaceTile.prototype.removeGeodeticSurfaceNormals=function(e){toggleGeodeticSurfaceNormals(this,!1,void 0,e)},GlobeSurfaceTile.prototype.updateExaggeration=function(e,t,i){var r=this,n=r.renderedMesh;if(void 0!==n){var a=t.terrainExaggeration,o=t.terrainExaggerationRelativeHeight,s=1!==a,l=n.encoding,c=l.exaggeration!==a,u=l.exaggerationRelativeHeight!==o;if(c||u){if(c)if(s&&!l.hasGeodeticSurfaceNormals){var d=e.tilingScheme.ellipsoid;r.addGeodeticSurfaceNormals(d,t)}else!s&&l.hasGeodeticSurfaceNormals&&r.removeGeodeticSurfaceNormals(t);if(l.exaggeration=a,l.exaggerationRelativeHeight=o,void 0!==i){i._tileToUpdateHeights.push(e);for(var h=e.customData,p=h.length,f=0;f<p;f++){h[f].level=-1}}}}};var scratchCreateMeshOptions={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0,throttle:!0};function transform(e,t,i,r,n,a){var o=i.tilingScheme,s=scratchCreateMeshOptions;s.tilingScheme=o,s.x=r,s.y=n,s.level=a,s.exaggeration=t.terrainExaggeration,s.exaggerationRelativeHeight=t.terrainExaggerationRelativeHeight,s.throttle=!0;var l=e.terrainData.createMesh(s);defined(l)&&(e.terrainState=TerrainState$1.TRANSFORMING,when(l,(function(t){e.mesh=t,e.terrainState=TerrainState$1.TRANSFORMED}),(function(){e.terrainState=TerrainState$1.FAILED})))}function createResources$2(e,t,i,r,n,a,o){e.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(t,e.mesh),e.terrainState=TerrainState$1.READY,e.fill=e.fill&&e.fill.destroy(o)}function getContextWaterMaskData(e){var t=e.cache.tile_waterMaskData;if(!defined(t)){var i=Texture.create({context:e,pixelFormat:PixelFormat$1.LUMINANCE,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});i.referenceCount=1,t={allWaterTexture:i,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR}),destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function createWaterMaskTextureIfNeeded(e,t){var i,r=t.terrainData.waterMask,n=getContextWaterMaskData(e),a=r.length;if(1===a){if(0===r[0])return;i=n.allWaterTexture}else{var o=Math.sqrt(a);(i=Texture.create({context:e,pixelFormat:PixelFormat$1.LUMINANCE,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{width:o,height:o,arrayBufferView:r},sampler:n.sampler,flipY:!1})).referenceCount=0}++i.referenceCount,t.waterMaskTexture=i,Cartesian4.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}GlobeSurfaceTile._createVertexArrayForMesh=function(e,t){var i=t.vertices,r=Buffer$1.createVertexBuffer({context:e,typedArray:i,usage:BufferUsage$1.STATIC_DRAW}),n=t.encoding.getAttributes(r),a=t.indices.indexBuffers||{},o=a[e.id];if(!defined(o)||o.isDestroyed()){var s=t.indices;(o=Buffer$1.createIndexBuffer({context:e,typedArray:s,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.fromSizeInBytes(s.BYTES_PER_ELEMENT)})).vertexArrayDestroyable=!1,o.referenceCount=1,a[e.id]=o,t.indices.indexBuffers=a}else++o.referenceCount;return new VertexArray({context:e,attributes:n,indexBuffer:o})},GlobeSurfaceTile._freeVertexArray=function(e){if(defined(e)){var t=e.indexBuffer;e.isDestroyed()||e.destroy(),defined(t)&&!t.isDestroyed()&&defined(t.referenceCount)&&(--t.referenceCount,0===t.referenceCount&&t.destroy())}},GlobeSurfaceTile.prototype._findAncestorTileWithTerrainData=function(e){for(var t=e.parent;defined(t)&&(!defined(t.data)||!defined(t.data.terrainData)||t.data.terrainData.wasCreatedByUpsampling());)t=t.parent;return t},GlobeSurfaceTile.prototype._computeWaterMaskTranslationAndScale=function(e,t,i){var r=t.rectangle,n=e.rectangle,a=n.width,o=n.height,s=a/r.width,l=o/r.height;return i.x=s*(n.west-r.west)/a,i.y=l*(n.south-r.south)/o,i.z=s,i.w=l,i};var ReprojectWebMercatorFS="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n",ReprojectWebMercatorVS="attribute vec4 position;\nattribute float webMercatorT;\nuniform vec2 u_textureDimensions;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nv_textureCoordinates = vec2(position.x, webMercatorT);\ngl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));\n}\n";function Imagery(e,t,i,r,n){if(this.imageryLayer=e,this.x=t,this.y=i,this.level=r,this.request=void 0,0!==r){var a=t/2|0,o=i/2|0,s=r-1;this.parent=e.getImageryFromCache(a,o,s)}(this.state=ImageryState$1.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.textureWebMercator=void 0,this.credits=void 0,this.referenceCount=0,!defined(n)&&e.imageryProvider.ready)&&(n=e.imageryProvider.tilingScheme.tileXYToRectangle(t,i,r));this.rectangle=n}Imagery.createPlaceholder=function(e){var t=new Imagery(e,0,0,0);return t.addReference(),t.state=ImageryState$1.PLACEHOLDER,t},Imagery.prototype.addReference=function(){++this.referenceCount},Imagery.prototype.releaseReference=function(){return--this.referenceCount,0===this.referenceCount?(this.imageryLayer.removeImageryFromCache(this),defined(this.parent)&&this.parent.releaseReference(),defined(this.image)&&defined(this.image.destroy)&&this.image.destroy(),defined(this.texture)&&this.texture.destroy(),defined(this.textureWebMercator)&&this.texture!==this.textureWebMercator&&this.textureWebMercator.destroy(),destroyObject(this),0):this.referenceCount},Imagery.prototype.processStateMachine=function(e,t,i){this.state!==ImageryState$1.UNLOADED||i||(this.state=ImageryState$1.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===ImageryState$1.RECEIVED&&(this.state=ImageryState$1.TRANSITIONING,this.imageryLayer._createTexture(e.context,this));var r=this.state===ImageryState$1.READY&&t&&!this.texture;(this.state===ImageryState$1.TEXTURE_LOADED||r)&&(this.state=ImageryState$1.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this,t))};var ImagerySplitDirection={LEFT:-1,NONE:0,RIGHT:1},ImagerySplitDirection$1=Object.freeze(ImagerySplitDirection);function TileImagery(e,t,i){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=i}function ImageryLayer(e,t){this._imageryProvider=e,t=defaultValue(t,defaultValue.EMPTY_OBJECT),this._availability=void 0,this._definitionChanged=new Event,this.availability=defaultValue(this.availability,t.availability),this.alpha=defaultValue(t.alpha,defaultValue(e.defaultAlpha,1)),this.nightAlpha=defaultValue(t.nightAlpha,defaultValue(e.defaultNightAlpha,1)),this.dayAlpha=defaultValue(t.dayAlpha,defaultValue(e.defaultDayAlpha,1)),this.brightness=defaultValue(t.brightness,defaultValue(e.defaultBrightness,ImageryLayer.DEFAULT_BRIGHTNESS)),this.contrast=defaultValue(t.contrast,defaultValue(e.defaultContrast,ImageryLayer.DEFAULT_CONTRAST)),this.hue=defaultValue(t.hue,defaultValue(e.defaultHue,ImageryLayer.DEFAULT_HUE)),this.saturation=defaultValue(t.saturation,defaultValue(e.defaultSaturation,ImageryLayer.DEFAULT_SATURATION)),this.gamma=defaultValue(t.gamma,defaultValue(e.defaultGamma,ImageryLayer.DEFAULT_GAMMA)),this.splitDirection=defaultValue(t.splitDirection,defaultValue(e.defaultSplit,ImageryLayer.DEFAULT_SPLIT)),this.minificationFilter=defaultValue(t.minificationFilter,defaultValue(e.defaultMinificationFilter,ImageryLayer.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=defaultValue(t.magnificationFilter,defaultValue(e.defaultMagnificationFilter,ImageryLayer.DEFAULT_MAGNIFICATION_FILTER)),this.show=defaultValue(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=defaultValue(t.rectangle,Rectangle.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._imageryCacheAdd={},this._skeletonPlaceholder=new TileImagery(Imagery.createPlaceholder(this)),this._show=!0,this._layerIndex=-1,this._isBaseLayer=!1,this._requestImageError=void 0,this._reprojectComputeCommands=[],this.cutoutRectangle=t.cutoutRectangle,this.colorToAlpha=t.colorToAlpha,this.colorToAlphaThreshold=defaultValue(t.colorToAlphaThreshold,ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}TileImagery.prototype.freeResources=function(){defined(this.readyImagery)&&this.readyImagery.releaseReference(),defined(this.loadingImagery)&&this.loadingImagery.releaseReference()},TileImagery.prototype.processStateMachine=function(e,t,i){var r=this.loadingImagery,n=r.imageryLayer;if(r.processStateMachine(t,!this.useWebMercatorT,i),r.state===ImageryState$1.READY)return defined(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=n._calculateTextureTranslationAndScale(e,this),!0;for(var a,o=r.parent;defined(o)&&(o.state!==ImageryState$1.READY||!this.useWebMercatorT&&!defined(o.texture));)o.state!==ImageryState$1.FAILED&&o.state!==ImageryState$1.INVALID&&(a=a||o),o=o.parent;return this.readyImagery!==o&&(defined(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=o,defined(o)&&(o.addReference(),this.textureTranslationAndScale=n._calculateTextureTranslationAndScale(e,this))),(r.state===ImageryState$1.FAILED||r.state===ImageryState$1.INVALID)&&(!defined(a)||(a.processStateMachine(t,!this.useWebMercatorT,i),!1))},Object.defineProperties(ImageryLayer.prototype,{availability:createRawPropertyDescriptor("availability"),definitionChanged:{get:function(){return this._definitionChanged}},imageryProvider:{get:function(){return this._imageryProvider}},rectangle:{get:function(){return this._rectangle}}}),ImageryLayer.DEFAULT_BRIGHTNESS=1,ImageryLayer.DEFAULT_CONTRAST=1,ImageryLayer.DEFAULT_HUE=0,ImageryLayer.DEFAULT_SATURATION=1,ImageryLayer.DEFAULT_GAMMA=1,ImageryLayer.DEFAULT_SPLIT=ImagerySplitDirection$1.NONE,ImageryLayer.DEFAULT_MINIFICATION_FILTER=TextureMinificationFilter$1.LINEAR,ImageryLayer.DEFAULT_MAGNIFICATION_FILTER=TextureMagnificationFilter$1.LINEAR,ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD=.004,ImageryLayer.prototype.isBaseLayer=function(){return this._isBaseLayer},ImageryLayer.prototype.isDestroyed=function(){return!1},ImageryLayer.prototype.destroy=function(){return destroyObject(this)};var imageryBoundsScratch=new Rectangle,tileImageryBoundsScratch=new Rectangle,clippedRectangleScratch=new Rectangle,terrainRectangleScratch=new Rectangle;function getSamplerKey(e,t,i){return e+":"+t+":"+i}function getImageryCacheKey(e,t,i){return JSON.stringify([e,t,i])}ImageryLayer.prototype.getViewableRectangle=function(){var e=this._imageryProvider,t=this._rectangle;return e.readyPromise.then((function(){return Rectangle.intersection(e.rectangle,t)}))},ImageryLayer.prototype._createTileImagerySkeletons=function(e,t,i){var r=e.data;if(defined(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel)return!1;if(defined(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;var n=this._imageryProvider;if(defined(i)||(i=r.imagery.length),!n.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),r.imagery.splice(i,0,this._skeletonPlaceholder),!0;var a=n.tilingScheme.projection instanceof WebMercatorProjection&&e.rectangle.north<WebMercatorProjection.MaximumLatitude&&e.rectangle.south>-WebMercatorProjection.MaximumLatitude,o=Rectangle.intersection(n.rectangle,this._rectangle,imageryBoundsScratch),s=Rectangle.intersection(e.rectangle,o,tileImageryBoundsScratch);if(!defined(s)){if(!this.isBaseLayer())return!1;var l=o,c=e.rectangle;s=tileImageryBoundsScratch,c.south>=l.north?s.north=s.south=l.north:c.north<=l.south?s.north=s.south=l.south:(s.south=Math.max(c.south,l.south),s.north=Math.min(c.north,l.north)),c.west>=l.east?s.west=s.east=l.east:c.east<=l.west?s.west=s.east=l.west:(s.west=Math.max(c.west,l.west),s.east=Math.min(c.east,l.east))}var u=0;s.south>0?u=s.south:s.north<0&&(u=s.north);var d=getLevelWithMaximumTexelSpacing(this,1*t.getLevelMaximumGeometricError(e.level),u);d=Math.max(0,d);var h=n.maximumLevel;if(d>h&&(d=h),defined(n.minimumLevel)){var p=n.minimumLevel;d<p&&(d=p)}var f=n.tilingScheme,m=f.positionToTileXY(Rectangle.northwest(s),d),g=f.positionToTileXY(Rectangle.southeast(s),d),_=e.rectangle.width/512,y=e.rectangle.height/512,v=f.tileXYToRectangle(m.x,m.y,d);Math.abs(v.south-e.rectangle.north)<y&&m.y<g.y&&++m.y,Math.abs(v.east-e.rectangle.west)<_&&m.x<g.x&&++m.x;var C=f.tileXYToRectangle(g.x,g.y,d);Math.abs(C.north-e.rectangle.south)<y&&g.y>m.y&&--g.y,Math.abs(C.west-e.rectangle.east)<_&&g.x>m.x&&--g.x;var T,S,A=Rectangle.clone(e.rectangle,terrainRectangleScratch),x=f.tileXYToRectangle(m.x,m.y,d),E=Rectangle.intersection(x,o,clippedRectangleScratch);a?(f.rectangleToNativeRectangle(A,A),f.rectangleToNativeRectangle(x,x),f.rectangleToNativeRectangle(E,E),f.rectangleToNativeRectangle(o,o),T=f.tileXYToNativeRectangle.bind(f),_=A.width/512,y=A.height/512):T=f.tileXYToRectangle.bind(f);var b,P=0,D=1;!this.isBaseLayer()&&Math.abs(E.west-A.west)>=_&&(P=Math.min(1,(E.west-A.west)/A.width)),!this.isBaseLayer()&&Math.abs(E.north-A.north)>=y&&(D=Math.max(0,(E.north-A.south)/A.height));for(var w=D,M=m.x;M<=g.x;M++)if(S=P,x=T(M,m.y,d),defined(E=Rectangle.simpleIntersection(x,o,clippedRectangleScratch))){P=Math.min(1,(E.east-A.west)/A.width),M===g.x&&(this.isBaseLayer()||Math.abs(E.east-A.east)<_)&&(P=1),D=w;for(var I=m.y;I<=g.y;I++)if(b=D,x=T(M,I,d),defined(E=Rectangle.simpleIntersection(x,o,clippedRectangleScratch))){D=Math.max(0,(E.south-A.south)/A.height),I===g.y&&(this.isBaseLayer()||Math.abs(E.south-A.south)<y)&&(D=0);var R=new Cartesian4(S,D,P,b),O=this.getImageryFromCache(M,I,d);r.imagery.splice(i,0,new TileImagery(O,R,a)),++i}}return!0},ImageryLayer.prototype._calculateTextureTranslationAndScale=function(e,t){var i=t.readyImagery.rectangle,r=e.rectangle;if(t.useWebMercatorT){var n=t.readyImagery.imageryLayer.imageryProvider.tilingScheme;i=n.rectangleToNativeRectangle(i,imageryBoundsScratch),r=n.rectangleToNativeRectangle(r,terrainRectangleScratch)}var a=r.width,o=r.height,s=a/i.width,l=o/i.height;return new Cartesian4(s*(r.west-i.west)/a,l*(r.south-i.south)/o,s,l)},ImageryLayer.prototype._requestImagery=function(e){var t=this._imageryProvider,i=this,r=getImageryCacheKey(e.x,e.y,e.level);function n(t){if(!defined(t))return a();e.image=t,e.state=ImageryState$1.RECEIVED,e.request=void 0,TileProviderError.handleSuccess(i._requestImageError)}function a(r){if(e.request.state===RequestState$1.CANCELLED)return e.state=ImageryState$1.UNLOADED,void(e.request=void 0);e.state=ImageryState$1.FAILED,e.request=void 0;var n="Failed to obtain image tile X: "+e.x+" Y: "+e.y+" Level: "+e.level+".";i._requestImageError=TileProviderError.handleError(i._requestImageError,t,t.errorEvent,n,e.x,e.y,e.level,o,r)}function o(){var i=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.IMAGERY});e.request=i,e.state=ImageryState$1.TRANSITIONING;var r=t.requestImage(e.x,e.y,e.level,i);if(!defined(r))return e.state=ImageryState$1.UNLOADED,void(e.request=void 0);defined(t.getTileCredits)&&(e.credits=t.getTileCredits(e.x,e.y,e.level)),when(r,n,a)}t.addLevel&&this._imageryCache[r]&&(delete this._imageryCache[r],e.level+=t.addLevel,r=getImageryCacheKey(e.x,e.y,e.level),this._imageryCacheAdd[r]=e),o()},ImageryLayer.prototype._createTextureWebGL=function(e,t){var i=new Sampler({minificationFilter:this.minificationFilter,magnificationFilter:this.magnificationFilter}),r=t.image;return defined(r.internalFormat)?new Texture({context:e,pixelFormat:r.internalFormat,width:r.width,height:r.height,source:{arrayBufferView:r.bufferView},sampler:i}):new Texture({context:e,source:r,pixelFormat:this._imageryProvider.hasAlphaChannel?PixelFormat$1.RGBA:PixelFormat$1.RGB,sampler:i})},ImageryLayer.prototype._createTexture=function(e,t){var i=this._imageryProvider,r=t.image;if(defined(i.tileDiscardPolicy)){var n=i.tileDiscardPolicy;if(defined(n)){if(!n.isReady())return void(t.state=ImageryState$1.RECEIVED);if(n.shouldDiscardImage(r))return void(t.state=ImageryState$1.INVALID)}}var a=this._createTextureWebGL(e,t);i.tilingScheme.projection instanceof WebMercatorProjection?t.textureWebMercator=a:t.texture=a,t.image=void 0,t.state=ImageryState$1.TEXTURE_LOADED},ImageryLayer.prototype._finalizeReprojectTexture=function(e,t){var i=this.minificationFilter,r=this.magnificationFilter;if(i===TextureMinificationFilter$1.LINEAR&&r===TextureMagnificationFilter$1.LINEAR&&!PixelFormat$1.isCompressedFormat(t.pixelFormat)&&CesiumMath.isPowerOfTwo(t.width)&&CesiumMath.isPowerOfTwo(t.height)){i=TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR;var n=ContextLimits.maximumTextureFilterAnisotropy,a=Math.min(n,defaultValue(this._maximumAnisotropy,n)),o=getSamplerKey(i,r,a),s=e.cache.imageryLayerMipmapSamplers;defined(s)||(s={},e.cache.imageryLayerMipmapSamplers=s);var l=s[o];defined(l)||(l=s[o]=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:i,magnificationFilter:r,maximumAnisotropy:a})),t.generateMipmap(MipmapHint$1.NICEST),t.sampler=l}else{var c=getSamplerKey(i,r,0),u=e.cache.imageryLayerNonMipmapSamplers;defined(u)||(u={},e.cache.imageryLayerNonMipmapSamplers=u);var d=u[c];defined(d)||(d=u[c]=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:i,magnificationFilter:r})),t.sampler=d}},ImageryLayer.prototype._reprojectTexture=function(e,t,i){var r=t.textureWebMercator||t.texture,n=t.rectangle,a=e.context;if((i=defaultValue(i,!0))&&!(this._imageryProvider.tilingScheme.projection instanceof GeographicProjection)&&n.width/r.width>1e-5){var o=this;t.addReference();var s=new ComputeCommand({persists:!0,owner:this,preExecute:function(e){reprojectToGeographic(e,a,r,t.rectangle)},postExecute:function(e){t.texture=e,o._finalizeReprojectTexture(a,e),t.state=ImageryState$1.READY,t.releaseReference()},canceled:function(){t.state=ImageryState$1.TEXTURE_LOADED,t.releaseReference()}});this._reprojectComputeCommands.push(s)}else i&&(t.texture=r),this._finalizeReprojectTexture(a,r),t.state=ImageryState$1.READY},ImageryLayer.prototype.queueReprojectionCommands=function(e){for(var t=this._reprojectComputeCommands,i=t.length,r=0;r<i;++r)e.commandList.push(t[r]);t.length=0},ImageryLayer.prototype.cancelReprojections=function(){this._reprojectComputeCommands.forEach((function(e){defined(e.canceled)&&e.canceled()})),this._reprojectComputeCommands.length=0},ImageryLayer.prototype.getImageryFromCache=function(e,t,i,r){var n=getImageryCacheKey(e,t,i),a=this._imageryCache[n];if(this._imageryProvider.addLevel){var o=getImageryCacheKey(e,t,i+this._imageryProvider.addLevel);a||(a=this._imageryCacheAdd[o])}return defined(a)||(a=new Imagery(this,e,t,i,r),this._imageryCache[n]=a),a.addReference(),a},ImageryLayer.prototype.removeImageryFromCache=function(e){var t=getImageryCacheKey(e.x,e.y,e.level);if(this._imageryProvider.addLevel){this._imageryCacheAdd[t]&&delete this._imageryCacheAdd[t],this._imageryCache[t]&&delete this._imageryCache[t];var i=getImageryCacheKey(e.x,e.y,e.level+this._imageryProvider.addLevel);this._imageryCacheAdd[i]&&delete this._imageryCacheAdd[i]}else delete this._imageryCache[t]},ImageryLayer.prototype.isAvailable=function(e){var t=this._availability;return!defined(t)||t.contains(e)};var uniformMap={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new Cartesian2,texture:void 0},float32ArrayScratch=FeatureDetection.supportsTypedArrays()?new Float32Array(128):void 0;function reprojectToGeographic(e,t,i,r){var n=t.cache.imageryLayer_reproject;if(!defined(n)){n=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){defined(this.framebuffer)&&this.framebuffer.destroy(),defined(this.vertexArray)&&this.vertexArray.destroy(),defined(this.shaderProgram)&&this.shaderProgram.destroy()}};for(var a=new Float32Array(256),o=0,s=0;s<64;++s){var l=s/63;a[o++]=0,a[o++]=l,a[o++]=1,a[o++]=l}var c={position:0,webMercatorT:1},u=TerrainProvider.getRegularGridIndices(2,64),d=Buffer$1.createIndexBuffer({context:t,typedArray:u,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});n.vertexArray=new VertexArray({context:t,attributes:[{index:c.position,vertexBuffer:Buffer$1.createVertexBuffer({context:t,typedArray:a,usage:BufferUsage$1.STATIC_DRAW}),componentsPerAttribute:2},{index:c.webMercatorT,vertexBuffer:Buffer$1.createVertexBuffer({context:t,sizeInBytes:512,usage:BufferUsage$1.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:d});var h=new ShaderSource({sources:[ReprojectWebMercatorVS]});n.shaderProgram=ShaderProgram.fromCache({context:t,vertexShaderSource:h,fragmentShaderSource:ReprojectWebMercatorFS,attributeLocations:c}),n.sampler=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})}i.sampler=n.sampler;var p=i.width,f=i.height;uniformMap.textureDimensions.x=p,uniformMap.textureDimensions.y=f,uniformMap.texture=i;var m=Math.sin(r.south),g=.5*Math.log((1+m)/(1-m));m=Math.sin(r.north);var _=1/(.5*Math.log((1+m)/(1-m))-g),y=new Texture({context:t,width:p,height:f,pixelFormat:i.pixelFormat,pixelDatatype:i.pixelDatatype,preMultiplyAlpha:i.preMultiplyAlpha});CesiumMath.isPowerOfTwo(p)&&CesiumMath.isPowerOfTwo(f)&&y.generateMipmap(MipmapHint$1.NICEST);for(var v=r.south,C=r.north,T=float32ArrayScratch,S=0,A=0;A<64;++A){var x=A/63,E=CesiumMath.lerp(v,C,x);m=Math.sin(E);var b=(.5*Math.log((1+m)/(1-m))-g)*_;T[S++]=b,T[S++]=b}n.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(T),e.shaderProgram=n.shaderProgram,e.outputTexture=y,e.uniformMap=uniformMap,e.vertexArray=n.vertexArray}function getLevelWithMaximumTexelSpacing(e,t,i){var r=e._imageryProvider,n=r.tilingScheme,a=n.ellipsoid,o=e._imageryProvider.tilingScheme.projection instanceof GeographicProjection?1:Math.cos(i),s=n.rectangle,l=a.maximumRadius*s.width*o/(r.tileWidth*n.getNumberOfXTilesAtLevel(0))/t,c=Math.log(l)/Math.log(2);return 0|Math.round(c)}var TileSelectionResult={NONE:0,CULLED:1,RENDERED:2,REFINED:3,RENDERED_AND_KICKED:6,REFINED_AND_KICKED:7,CULLED_BUT_NEEDED:9,wasKicked:function(e){return e>=TileSelectionResult.RENDERED_AND_KICKED},originalResult:function(e){return 3&e},kick:function(e){return 4|e}};function TerrainFillMesh(e){this.tile=e,this.frameLastUpdated=void 0,this.westMeshes=[],this.westTiles=[],this.southMeshes=[],this.southTiles=[],this.eastMeshes=[],this.eastTiles=[],this.northMeshes=[],this.northTiles=[],this.southwestMesh=void 0,this.southwestTile=void 0,this.southeastMesh=void 0,this.southeastTile=void 0,this.northwestMesh=void 0,this.northwestTile=void 0,this.northeastMesh=void 0,this.northeastTile=void 0,this.changedThisFrame=!0,this.visitedFrame=void 0,this.enqueuedFrame=void 0,this.mesh=void 0,this.vertexArray=void 0,this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new Cartesian4}TerrainFillMesh.prototype.update=function(e,t,i){this.changedThisFrame&&(createFillMesh(e,t,this.tile,i),this.changedThisFrame=!1)},TerrainFillMesh.prototype.destroy=function(e){this._destroyVertexArray(e),defined(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0)},TerrainFillMesh.prototype._destroyVertexArray=function(e){defined(this.vertexArray)&&(defined(e)?e.push(this.vertexArray):GlobeSurfaceTile._freeVertexArray(this.vertexArray),this.vertexArray=void 0)};var traversalQueueScratch=new Queue;function visitRenderedTiles(e,t,i,r,n,a,o,s,l){if(void 0!==r){for(var c=r;c&&(c._lastSelectionResultFrame!==n||TileSelectionResult.wasKicked(c._lastSelectionResult)||TileSelectionResult.originalResult(c._lastSelectionResult)===TileSelectionResult.CULLED);){if(o)return;var u=c.parent;if(a>=TileEdge.NORTHWEST&&void 0!==u)switch(a){case TileEdge.NORTHWEST:c=c===u.northwestChild?u:void 0;break;case TileEdge.NORTHEAST:c=c===u.northeastChild?u:void 0;break;case TileEdge.SOUTHWEST:c=c===u.southwestChild?u:void 0;break;case TileEdge.SOUTHEAST:c=c===u.southeastChild?u:void 0}else c=u}if(void 0!==c)if(c._lastSelectionResult!==TileSelectionResult.RENDERED){if(TileSelectionResult.originalResult(r._lastSelectionResult)!==TileSelectionResult.CULLED)switch(a){case TileEdge.WEST:visitRenderedTiles(e,t,i,r.northwestChild,n,a,!0,s,l),visitRenderedTiles(e,t,i,r.southwestChild,n,a,!0,s,l);break;case TileEdge.EAST:visitRenderedTiles(e,t,i,r.southeastChild,n,a,!0,s,l),visitRenderedTiles(e,t,i,r.northeastChild,n,a,!0,s,l);break;case TileEdge.SOUTH:visitRenderedTiles(e,t,i,r.southwestChild,n,a,!0,s,l),visitRenderedTiles(e,t,i,r.southeastChild,n,a,!0,s,l);break;case TileEdge.NORTH:visitRenderedTiles(e,t,i,r.northeastChild,n,a,!0,s,l),visitRenderedTiles(e,t,i,r.northwestChild,n,a,!0,s,l);break;case TileEdge.NORTHWEST:visitRenderedTiles(e,t,i,r.northwestChild,n,a,!0,s,l);break;case TileEdge.NORTHEAST:visitRenderedTiles(e,t,i,r.northeastChild,n,a,!0,s,l);break;case TileEdge.SOUTHWEST:visitRenderedTiles(e,t,i,r.southwestChild,n,a,!0,s,l);break;case TileEdge.SOUTHEAST:visitRenderedTiles(e,t,i,r.southeastChild,n,a,!0,s,l);break;default:throw new DeveloperError("Invalid edge")}}else{if(defined(c.data.vertexArray))return;visitTile$2(e,t,i,c,a,n,s,l)}}}function visitTile$2(e,t,i,r,n,a,o,s){var l=r.data;if(void 0===l.fill)l.fill=new TerrainFillMesh(r);else if(l.fill.visitedFrame===a)return;l.fill.enqueuedFrame!==a&&(l.fill.enqueuedFrame=a,l.fill.changedThisFrame=!1,o.enqueue(r)),propagateEdge(e,t,i,r,n,s)}function propagateEdge(e,t,i,r,n,a){var o,s,l,c,u,d,h=r.data.fill,p=i.data.fill;switch(defined(p)?(p.visitedFrame=t.frameNumber,p.changedThisFrame&&(createFillMesh(e,t,i,a),p.changedThisFrame=!1),o=i.data.fill.mesh):o=i.data.mesh,n){case TileEdge.WEST:s=h.westMeshes,l=h.westTiles;break;case TileEdge.SOUTH:s=h.southMeshes,l=h.southTiles;break;case TileEdge.EAST:s=h.eastMeshes,l=h.eastTiles;break;case TileEdge.NORTH:s=h.northMeshes,l=h.northTiles;break;case TileEdge.NORTHWEST:return h.changedThisFrame=h.changedThisFrame||h.northwestMesh!==o,h.northwestMesh=o,void(h.northwestTile=i);case TileEdge.NORTHEAST:return h.changedThisFrame=h.changedThisFrame||h.northeastMesh!==o,h.northeastMesh=o,void(h.northeastTile=i);case TileEdge.SOUTHWEST:return h.changedThisFrame=h.changedThisFrame||h.southwestMesh!==o,h.southwestMesh=o,void(h.southwestTile=i);case TileEdge.SOUTHEAST:return h.changedThisFrame=h.changedThisFrame||h.southeastMesh!==o,h.southeastMesh=o,void(h.southeastTile=i)}if(i.level<=r.level)return h.changedThisFrame=h.changedThisFrame||s[0]!==o||1!==s.length,s[0]=o,l[0]=i,s.length=1,void(l.length=1);var f,m=i.rectangle,g=r.rectangle;switch(n){case TileEdge.WEST:for(f=(g.north-g.south)*CesiumMath.EPSILON5,c=0;c<l.length&&(d=l[c].rectangle,!CesiumMath.greaterThan(m.north,d.south,f));++c);for(u=c;u<l.length&&(d=l[u].rectangle,!CesiumMath.greaterThanOrEquals(m.south,d.north,f));++u);break;case TileEdge.SOUTH:for(f=(g.east-g.west)*CesiumMath.EPSILON5,c=0;c<l.length&&(d=l[c].rectangle,!CesiumMath.lessThan(m.west,d.east,f));++c);for(u=c;u<l.length&&(d=l[u].rectangle,!CesiumMath.lessThanOrEquals(m.east,d.west,f));++u);break;case TileEdge.EAST:for(f=(g.north-g.south)*CesiumMath.EPSILON5,c=0;c<l.length&&(d=l[c].rectangle,!CesiumMath.lessThan(m.south,d.north,f));++c);for(u=c;u<l.length&&(d=l[u].rectangle,!CesiumMath.lessThanOrEquals(m.north,d.south,f));++u);break;case TileEdge.NORTH:for(f=(g.east-g.west)*CesiumMath.EPSILON5,c=0;c<l.length&&(d=l[c].rectangle,!CesiumMath.greaterThan(m.east,d.west,f));++c);for(u=c;u<l.length&&(d=l[u].rectangle,!CesiumMath.greaterThanOrEquals(m.west,d.east,f));++u);}u-c==1?(h.changedThisFrame=h.changedThisFrame||s[c]!==o,s[c]=o,l[c]=i):(h.changedThisFrame=!0,s.splice(c,u-c,o),l.splice(c,u-c,i))}TerrainFillMesh.updateFillTiles=function(e,t,i,r){var n=e._quadtree,a=n._levelZeroTiles,o=n._lastSelectionFrameNumber,s=traversalQueueScratch;s.clear();for(var l=0;l<t.length;++l){defined(t[l].data.vertexArray)&&s.enqueue(t[l])}for(var c=s.dequeue();void 0!==c;){var u=c.findTileToWest(a),d=c.findTileToSouth(a),h=c.findTileToEast(a),p=c.findTileToNorth(a);visitRenderedTiles(e,i,c,u,o,TileEdge.EAST,!1,s,r),visitRenderedTiles(e,i,c,d,o,TileEdge.NORTH,!1,s,r),visitRenderedTiles(e,i,c,h,o,TileEdge.WEST,!1,s,r),visitRenderedTiles(e,i,c,p,o,TileEdge.SOUTH,!1,s,r);var f=u.findTileToNorth(a),m=u.findTileToSouth(a),g=h.findTileToNorth(a),_=h.findTileToSouth(a);visitRenderedTiles(e,i,c,f,o,TileEdge.SOUTHEAST,!1,s,r),visitRenderedTiles(e,i,c,g,o,TileEdge.SOUTHWEST,!1,s,r),visitRenderedTiles(e,i,c,m,o,TileEdge.NORTHEAST,!1,s,r),visitRenderedTiles(e,i,c,_,o,TileEdge.NORTHWEST,!1,s,r),c=s.dequeue()}};var cartographicScratch$1=new Cartographic,centerCartographicScratch=new Cartographic,cartesianScratch=new Cartesian3,normalScratch=new Cartesian3,octEncodedNormalScratch=new Cartesian2,uvScratch2=new Cartesian2,uvScratch=new Cartesian2;function HeightAndNormal(){this.height=0,this.encodedNormal=new Cartesian2}function fillMissingCorner(e,t,i,r,n,a,o,s,l){if(defined(n))return n;var c;if(defined(a)&&defined(o))c=.5*(a.height+o.height);else if(defined(a))c=a.height;else if(defined(o))c=o.height;else if(defined(s))c=s.height;else{var u=e.tile.data.tileBoundingRegion,d=0,h=0;defined(u)&&(d=u.minimumHeight,h=u.maximumHeight),c=.5*(d+h)}return getVertexWithHeightAtCorner(e,t,i,r,c,l),l}var heightRangeScratch={minimumHeight:0,maximumHeight:0},scratchCenter$2=new Cartesian3,swVertexScratch=new HeightAndNormal,seVertexScratch=new HeightAndNormal,nwVertexScratch=new HeightAndNormal,neVertexScratch=new HeightAndNormal,heightmapBuffer="undefined"!=typeof Uint8Array?new Uint8Array(81):void 0,scratchCreateMeshSyncOptions={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0};function createFillMesh(e,t,i,r){GlobeSurfaceTile.initialize(i,e.terrainProvider,e._imageryLayers);var n=i.data,a=n.fill,o=i.rectangle,s=t.terrainExaggeration,l=t.terrainExaggerationRelativeHeight,c=1!==s,u=i.tilingScheme.ellipsoid,d=getCorner(a,u,0,1,a.northwestTile,a.northwestMesh,a.northTiles,a.northMeshes,a.westTiles,a.westMeshes,nwVertexScratch),h=getCorner(a,u,0,0,a.southwestTile,a.southwestMesh,a.westTiles,a.westMeshes,a.southTiles,a.southMeshes,swVertexScratch),p=getCorner(a,u,1,0,a.southeastTile,a.southeastMesh,a.southTiles,a.southMeshes,a.eastTiles,a.eastMeshes,seVertexScratch),f=getCorner(a,u,1,1,a.northeastTile,a.northeastMesh,a.eastTiles,a.eastMeshes,a.northTiles,a.northMeshes,neVertexScratch);d=fillMissingCorner(a,u,0,1,d,h,f,p,nwVertexScratch),h=fillMissingCorner(a,u,0,0,h,d,p,f,swVertexScratch),p=fillMissingCorner(a,u,1,1,p,h,f,d,seVertexScratch),f=fillMissingCorner(a,u,1,1,f,p,d,h,neVertexScratch);var m,g,_=h.height,y=p.height,v=d.height,C=f.height,T=Math.min(_,y,v,C),S=Math.max(_,y,v,C),A=.5*(T+S),x=e.getLevelMaximumGeometricError(i.level),E=u.maximumRadius-x,b=4*Math.acos(E/u.maximumRadius);if(b*=1.5,o.width>b&&S-T<=x){var P=new HeightmapTerrainData({width:9,height:9,buffer:heightmapBuffer,structure:{heightOffset:S}}),D=scratchCreateMeshSyncOptions;D.tilingScheme=i.tilingScheme,D.x=i.x,D.y=i.y,D.level=i.level,D.exaggeration=s,D.exaggerationRelativeHeight=l,a.mesh=P._createMeshSync(D)}else{var w=c,M=Rectangle.center(o,centerCartographicScratch);M.height=A;var I,R=new TerrainEncoding(u.cartographicToCartesian(M,scratchCenter$2),void 0,void 0,void 0,void 0,!0,!0,w,s,l),O=5;for(m=0,g=(I=a.westMeshes).length;m<g;++m)O+=I[m].eastIndicesNorthToSouth.length;for(m=0,g=(I=a.southMeshes).length;m<g;++m)O+=I[m].northIndicesWestToEast.length;for(m=0,g=(I=a.eastMeshes).length;m<g;++m)O+=I[m].westIndicesSouthToNorth.length;for(m=0,g=(I=a.northMeshes).length;m<g;++m)O+=I[m].southIndicesEastToWest.length;var B=heightRangeScratch;B.minimumHeight=T,B.maximumHeight=S;var L=R.stride,F=new Float32Array(O*L),N=0,V=N,k=N=addEdge(a,u,R,F,N=addVertexWithComputedPosition(u,o,R,F,N,0,1,d.height,d.encodedNormal,1,B),a.westTiles,a.westMeshes,TileEdge.EAST,B),U=N=addEdge(a,u,R,F,N=addVertexWithComputedPosition(u,o,R,F,N,0,0,h.height,h.encodedNormal,0,B),a.southTiles,a.southMeshes,TileEdge.NORTH,B),G=N=addEdge(a,u,R,F,N=addVertexWithComputedPosition(u,o,R,F,N,1,0,p.height,p.encodedNormal,0,B),a.eastTiles,a.eastMeshes,TileEdge.WEST,B);N=addEdge(a,u,R,F,N=addVertexWithComputedPosition(u,o,R,F,N,1,1,f.height,f.encodedNormal,1,B),a.northTiles,a.northMeshes,TileEdge.SOUTH,B),T=B.minimumHeight,S=B.maximumHeight;var $=OrientedBoundingBox.fromRectangle(o,T,S,i.tilingScheme.ellipsoid),z=WebMercatorProjection.geodeticLatitudeToMercatorAngle(o.south),H=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(o.north)-z),W=(WebMercatorProjection.geodeticLatitudeToMercatorAngle(M.latitude)-z)*H,j=u.geodeticSurfaceNormalCartographic(cartographicScratch$1,normalScratch),q=AttributeCompression.octEncode(j,octEncodedNormalScratch),X=N;R.encode(F,N*L,$.center,Cartesian2.fromElements(.5,.5,uvScratch),A,q,W,j);var Y,K=++N,J=3*(K-1),Q=J*(K<256?1:2);if((F.length-K*L)*Float32Array.BYTES_PER_ELEMENT>=Q){var Z=K*L*Float32Array.BYTES_PER_ELEMENT;Y=K<256?new Uint8Array(F.buffer,Z,J):new Uint16Array(F.buffer,Z,J)}else Y=K<256?new Uint8Array(J):new Uint16Array(J);F=new Float32Array(F.buffer,0,K*L);var ee=0;for(m=0;m<K-2;++m)Y[ee++]=X,Y[ee++]=m,Y[ee++]=m+1;Y[ee++]=X,Y[ee++]=m,Y[ee++]=0;var te=[];for(m=k;m>=V;--m)te.push(m);var ie=[];for(m=U;m>=k;--m)ie.push(m);var re=[];for(m=G;m>=U;--m)re.push(m);var ne=[];for(ne.push(0),m=X-1;m>=G;--m)ne.push(m);a.mesh=new TerrainMesh(R.center,F,Y,J,K,T,S,BoundingSphere.fromOrientedBoundingBox($),computeOccludeePoint$1(e,$.center,o,T,S),R.stride,$,R,te,ie,re,ne)}var ae=t.context;a._destroyVertexArray(r),a.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(ae,a.mesh),n.processImagery(i,e.terrainProvider,t,!0);var oe=a.waterMaskTexture;if(a.waterMaskTexture=void 0,e.terrainProvider.hasWaterMask){var se=n._findAncestorTileWithTerrainData(i);defined(se)&&defined(se.data.waterMaskTexture)&&(a.waterMaskTexture=se.data.waterMaskTexture,++a.waterMaskTexture.referenceCount,n._computeWaterMaskTranslationAndScale(i,se,a.waterMaskTranslationAndScale))}defined(oe)&&(--oe.referenceCount,0===oe.referenceCount&&oe.destroy())}function addVertexWithComputedPosition(e,t,i,r,n,a,o,s,l,c,u){var d=cartographicScratch$1;d.longitude=CesiumMath.lerp(t.west,t.east,a),d.latitude=CesiumMath.lerp(t.south,t.north,o),d.height=s;var h,p=e.cartographicToCartesian(d,cartesianScratch);i.hasGeodeticSurfaceNormals&&(h=e.geodeticSurfaceNormal(p,normalScratch));var f=uvScratch2;return f.x=a,f.y=o,i.encode(r,n*i.stride,p,f,s,l,c,h),u.minimumHeight=Math.min(u.minimumHeight,s),u.maximumHeight=Math.max(u.maximumHeight,s),n+1}var sourceRectangleScratch=new Rectangle;function transformTextureCoordinates(e,t,i,r){var n=e.rectangle,a=t.rectangle;0===t.x&&1===i.x&&e.x===e.tilingScheme.getNumberOfXTilesAtLevel(e.level)-1?((n=Rectangle.clone(e.rectangle,sourceRectangleScratch)).west-=CesiumMath.TWO_PI,n.east-=CesiumMath.TWO_PI):0===e.x&&0===i.x&&t.x===t.tilingScheme.getNumberOfXTilesAtLevel(t.level)-1&&((n=Rectangle.clone(e.rectangle,sourceRectangleScratch)).west+=CesiumMath.TWO_PI,n.east+=CesiumMath.TWO_PI);var o=n.east-n.west,s=(a.west-n.west)/o,l=(a.east-n.west)/o,c=n.north-n.south,u=(a.south-n.south)/c,d=(a.north-n.south)/c,h=(i.x-s)/(l-s),p=(i.y-u)/(d-u);return Math.abs(h)<Math.EPSILON5?h=0:Math.abs(h-1)<Math.EPSILON5&&(h=1),Math.abs(p)<Math.EPSILON5?p=0:Math.abs(p-1)<Math.EPSILON5&&(p=1),r.x=h,r.y=p,r}var encodedNormalScratch=new Cartesian2;function getVertexFromTileAtCorner(e,t,i,r,n){var a=e.encoding,o=e.vertices;if(n.height=a.decodeHeight(o,t),a.hasVertexNormals)a.getOctEncodedNormal(o,t,n.encodedNormal);else{var s=n.encodedNormal;s.x=0,s.y=0}}var encodedNormalScratch2=new Cartesian2,cartesianScratch2=new Cartesian3;function getInterpolatedVertexAtCorner(e,t,i,r,n,a,o,s,l,c){var u,d=r.encoding,h=r.vertices,p=transformTextureCoordinates(t,i,d.decodeTextureCoordinates(h,n,uvScratch),uvScratch),f=transformTextureCoordinates(t,i,d.decodeTextureCoordinates(h,a,uvScratch2),uvScratch2);u=l?(o-p.x)/(f.x-p.x):(s-p.y)/(f.y-p.y);var m,g=d.decodeHeight(h,n),_=d.decodeHeight(h,a),y=i.rectangle;if(cartographicScratch$1.longitude=CesiumMath.lerp(y.west,y.east,o),cartographicScratch$1.latitude=CesiumMath.lerp(y.south,y.north,s),c.height=cartographicScratch$1.height=CesiumMath.lerp(g,_,u),d.hasVertexNormals){var v=d.getOctEncodedNormal(h,n,encodedNormalScratch),C=d.getOctEncodedNormal(h,a,encodedNormalScratch2),T=AttributeCompression.octDecode(v.x,v.y,cartesianScratch),S=AttributeCompression.octDecode(C.x,C.y,cartesianScratch2);m=Cartesian3.lerp(T,S,u,cartesianScratch),Cartesian3.normalize(m,m),AttributeCompression.octEncode(m,c.encodedNormal)}else m=e.geodeticSurfaceNormalCartographic(cartographicScratch$1,cartesianScratch),AttributeCompression.octEncode(m,c.encodedNormal)}function getVertexWithHeightAtCorner(e,t,i,r,n,a){a.height=n;var o=t.geodeticSurfaceNormalCartographic(cartographicScratch$1,cartesianScratch);AttributeCompression.octEncode(o,a.encodedNormal)}function getCorner(e,t,i,r,n,a,o,s,l,c,u){var d;return getCornerFromEdge(e,t,s,o,!1,i,r,u)||getCornerFromEdge(e,t,c,l,!0,i,r,u)?u:meshIsUsable(n,a)?(getVertexFromTileAtCorner(a,0===i?0===r?a.eastIndicesNorthToSouth[0]:a.southIndicesEastToWest[0]:0===r?a.northIndicesWestToEast[0]:a.westIndicesSouthToNorth[0],i,r,u),u):defined(d=0===i?0===r?getClosestHeightToCorner(e.westMeshes,e.westTiles,TileEdge.EAST,e.southMeshes,e.southTiles,TileEdge.NORTH):getClosestHeightToCorner(e.northMeshes,e.northTiles,TileEdge.SOUTH,e.westMeshes,e.westTiles,TileEdge.EAST):0===r?getClosestHeightToCorner(e.southMeshes,e.southTiles,TileEdge.NORTH,e.eastMeshes,e.eastTiles,TileEdge.WEST):getClosestHeightToCorner(e.eastMeshes,e.eastTiles,TileEdge.WEST,e.northMeshes,e.northTiles,TileEdge.SOUTH))?(getVertexWithHeightAtCorner(e,t,i,r,d,u),u):void 0}function getClosestHeightToCorner(e,t,i,r,n,a,o,s){var l=getNearestHeightOnEdge(e,t,!1,i),c=getNearestHeightOnEdge(r,n,!0,a);return defined(l)&&defined(c)?.5*(l+c):defined(l)?l:c}function addEdge(e,t,i,r,n,a,o,s,l){for(var c=0;c<a.length;++c)n=addEdgeMesh(e,t,i,r,n,a[c],o[c],s,l);return n}function addEdgeMesh(e,t,i,r,n,a,o,s,l){var c=a.rectangle;s===TileEdge.EAST&&0===e.tile.x?((c=Rectangle.clone(a.rectangle,sourceRectangleScratch)).west-=CesiumMath.TWO_PI,c.east-=CesiumMath.TWO_PI):s===TileEdge.WEST&&0===a.x&&((c=Rectangle.clone(a.rectangle,sourceRectangleScratch)).west+=CesiumMath.TWO_PI,c.east+=CesiumMath.TWO_PI);var u,d,h,p,f=e.tile.rectangle;switch(n>0&&(i.decodeTextureCoordinates(r,n-1,uvScratch),u=uvScratch.x,d=uvScratch.y),s){case TileEdge.WEST:h=o.westIndicesSouthToNorth,p=!1;break;case TileEdge.NORTH:h=o.northIndicesWestToEast,p=!0;break;case TileEdge.EAST:h=o.eastIndicesNorthToSouth,p=!1;break;case TileEdge.SOUTH:h=o.southIndicesEastToWest,p=!0}var m,g,_=a,y=e.tile,v=o.encoding,C=o.vertices,T=i.stride;v.hasWebMercatorT&&(m=WebMercatorProjection.geodeticLatitudeToMercatorAngle(f.south),g=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(f.north)-m));for(var S=0;S<h.length;++S){var A=h[S],x=v.decodeTextureCoordinates(C,A,uvScratch);transformTextureCoordinates(_,y,x,x);var E=x.x,b=x.y,P=p?E:b;if(!(P<0||P>1)&&!(Math.abs(E-u)<CesiumMath.EPSILON5&&Math.abs(b-d)<CesiumMath.EPSILON5)){var D=Math.abs(E)<CesiumMath.EPSILON5||Math.abs(E-1)<CesiumMath.EPSILON5,w=Math.abs(b)<CesiumMath.EPSILON5||Math.abs(b-1)<CesiumMath.EPSILON5;if(!D||!w){var M,I=v.decodePosition(C,A,cartesianScratch),R=v.decodeHeight(C,A);v.hasVertexNormals?M=v.getOctEncodedNormal(C,A,octEncodedNormalScratch):((M=octEncodedNormalScratch).x=0,M.y=0);var O,B=b;if(v.hasWebMercatorT){var L=CesiumMath.lerp(f.south,f.north,b);B=(WebMercatorProjection.geodeticLatitudeToMercatorAngle(L)-m)*g}i.hasGeodeticSurfaceNormals&&(O=t.geodeticSurfaceNormal(I,normalScratch)),i.encode(r,n*T,I,x,R,M,B,O),l.minimumHeight=Math.min(l.minimumHeight,R),l.maximumHeight=Math.max(l.maximumHeight,R),++n}}}return n}function getNearestHeightOnEdge(e,t,i,r,n,a){var o,s,l;i?(o=0,s=e.length,l=1):(o=e.length-1,s=-1,l=-1);for(var c=o;c!==s;c+=l){var u=e[c];if(meshIsUsable(t[c],u)){var d;switch(r){case TileEdge.WEST:d=u.westIndicesSouthToNorth;break;case TileEdge.SOUTH:d=u.southIndicesEastToWest;break;case TileEdge.EAST:d=u.eastIndicesNorthToSouth;break;case TileEdge.NORTH:d=u.northIndicesWestToEast}var h=d[i?0:d.length-1];if(defined(h))return u.encoding.decodeHeight(u.vertices,h)}}}function meshIsUsable(e,t){return defined(t)&&(!defined(e.data.fill)||!e.data.fill.changedThisFrame)}function getCornerFromEdge(e,t,i,r,n,a,o,s){var l,c,u,d,h,p=r[n?0:i.length-1],f=i[n?0:i.length-1];if(meshIsUsable(p,f)&&(0===a?0===o?(l=n?f.northIndicesWestToEast:f.eastIndicesNorthToSouth,c=n,u=n):(l=n?f.eastIndicesNorthToSouth:f.southIndicesEastToWest,c=!n,u=!1):0===o?(l=n?f.westIndicesSouthToNorth:f.northIndicesWestToEast,c=!n,u=!0):(l=n?f.southIndicesEastToWest:f.westIndicesSouthToNorth,c=n,u=!n),l.length>0)){h=l[d=n?0:l.length-1],f.encoding.decodeTextureCoordinates(f.vertices,h,uvScratch);var m=transformTextureCoordinates(p,e.tile,uvScratch,uvScratch);if(m.x===a&&m.y===o)return getVertexFromTileAtCorner(f,h,a,o,s),!0;if(d=binarySearch(l,c?a:o,(function(t,i){f.encoding.decodeTextureCoordinates(f.vertices,t,uvScratch);var r=transformTextureCoordinates(p,e.tile,uvScratch,uvScratch);return u?c?r.x-a:r.y-o:c?a-r.x:o-r.y})),!(d<0))return getVertexFromTileAtCorner(f,l[d],a,o,s),!0;if((d=~d)>0&&d<l.length)return getInterpolatedVertexAtCorner(t,p,e.tile,f,l[d-1],l[d],a,o,c,s),!0}return!1}var cornerPositionsScratch$1=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3];function computeOccludeePoint$1(e,t,i,r,n,a){var o=e.quadtree._occluders.ellipsoid,s=o.ellipsoid,l=cornerPositionsScratch$1;return Cartesian3.fromRadians(i.west,i.south,n,s,l[0]),Cartesian3.fromRadians(i.east,i.south,n,s,l[1]),Cartesian3.fromRadians(i.west,i.north,n,s,l[2]),Cartesian3.fromRadians(i.east,i.north,n,s,l[3]),o.computeHorizonCullingPointPossiblyUnderEllipsoid(t,l,r,a)}function GlobeSurfaceTileProvider(e){this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this.dynamicAtmosphereLighting=!1,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!1,this.shadows=ShadowMode$1.RECEIVE_ONLY,this.fillHighlightColor=void 0,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this.showSkirts=!0,this.backFaceCulling=!0,this.undergroundColor=void 0,this.undergroundColorAlphaByDistance=void 0,this.lambertDiffuseMultiplier=0,this.materialUniformMap=void 0,this._materialUniformMap=void 0,this._quadtree=void 0,this._terrainProvider=e.terrainProvider,this._imageryLayers=e.imageryLayers,this._surfaceShaderSet=e.surfaceShaderSet,this._renderState=void 0,this._blendRenderState=void 0,this._disableCullingRenderState=void 0,this._disableCullingBlendRenderState=void 0,this._errorEvent=new Event,this._imageryLayers.layerAdded.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerAdded,this),this._imageryLayers.layerRemoved.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerRemoved,this),this._imageryLayers.layerMoved.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerMoved,this),this._imageryLayers.layerShownOrHidden.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden,this),this._imageryLayersUpdatedEvent=new Event,this._layerOrderChanged=!1,this._tilesToRenderByTextureCount=[],this._drawCommands=[],this._uniformMaps=[],this._usedDrawCommands=0,this._vertexArraysToDestroy=[],this._debug={wireframe:!1,boundingSphereTile:void 0},this._baseColor=void 0,this._firstPassInitialColor=void 0,this.baseColor=new Color(0,0,.5,1),this._clippingPlanes=void 0,this._multiClippingPlanes=void 0,this.cartographicLimitRectangle=Rectangle.clone(Rectangle.MAX_VALUE),this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1,this._oldTerrainExaggeration=void 0,this._oldTerrainExaggerationRelativeHeight=void 0}function sortTileImageryByLayerIndex(e,t){var i=e.loadingImagery;defined(i)||(i=e.readyImagery);var r=t.loadingImagery;return defined(r)||(r=t.readyImagery),i.imageryLayer._layerIndex-r.imageryLayer._layerIndex}function updateCredits(e,t){var i=t.creditDisplay;e._terrainProvider.ready&&defined(e._terrainProvider.credit)&&i.addCredit(e._terrainProvider.credit);for(var r=e._imageryLayers,n=0,a=r.length;n<a;++n){var o=r.get(n).imageryProvider;o.ready&&defined(o.credit)&&i.addCredit(o.credit)}}function pushCommand(e,t){var i=t.globeTranslucencyState;if(i.translucent){var r=e.renderState.blending.enabled;i.pushDerivedCommands(e,r,t)}else t.commandList.push(e)}Object.defineProperties(GlobeSurfaceTileProvider.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){this._baseColor=e,this._firstPassInitialColor=Cartesian4.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){this._quadtree=e}},ready:{get:function(){return this._terrainProvider.ready&&(0===this._imageryLayers.length||this._imageryLayers.get(0).imageryProvider.ready)}},tilingScheme:{get:function(){return this._terrainProvider.tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},imageryLayersUpdatedEvent:{get:function(){return this._imageryLayersUpdatedEvent}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){this._terrainProvider!==e&&(this._terrainProvider=e,defined(this._quadtree)&&this._quadtree.invalidateAllTiles())}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}},multiClippingPlanes:{get:function(){return this._multiClippingPlanes},set:function(e){defined(e)?this._multiClippingPlanes=e:this._multiClippingPlanes=void 0}}}),GlobeSurfaceTileProvider.prototype.update=function(e){this._imageryLayers._update()},GlobeSurfaceTileProvider.prototype.initialize=function(e){this._imageryLayers.queueReprojectionCommands(e),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile((function(e){e.data.imagery.sort(sortTileImageryByLayerIndex)}))),updateCredits(this,e);for(var t=this._vertexArraysToDestroy,i=t.length,r=0;r<i;++r)GlobeSurfaceTile._freeVertexArray(t[r]);t.length=0},GlobeSurfaceTileProvider.prototype.beginUpdate=function(e){for(var t=this._tilesToRenderByTextureCount,i=0,r=t.length;i<r;++i){var n=t[i];defined(n)&&(n.length=0)}var a=this._clippingPlanes;defined(a)&&a.enabled&&a.update(e);var o=this._multiClippingPlanes;defined(o)&&o.update(e),this._usedDrawCommands=0,this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1},GlobeSurfaceTileProvider.prototype.endUpdate=function(e){if(!defined(this._renderState)){this._renderState=RenderState.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:DepthFunction$1.LESS}}),this._blendRenderState=RenderState.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},blending:BlendingState$1.ALPHA_BLEND});var t=clone$1(this._renderState,!0);t.cull.enabled=!1,this._disableCullingRenderState=RenderState.fromCache(t),(t=clone$1(this._blendRenderState,!0)).cull.enabled=!1,this._disableCullingBlendRenderState=RenderState.fromCache(t)}this._hasFillTilesThisFrame&&this._hasLoadedTilesThisFrame&&TerrainFillMesh.updateFillTiles(this,this._quadtree._tilesToRender,e,this._vertexArraysToDestroy);var i=this.quadtree,r=e.terrainExaggeration,n=e.terrainExaggerationRelativeHeight,a=this._oldTerrainExaggeration!==r||this._oldTerrainExaggerationRelativeHeight!==n;this._oldTerrainExaggeration=r,this._oldTerrainExaggerationRelativeHeight=n,a&&i.forEachLoadedTile((function(t){t.data.updateExaggeration(t,e,i)}));for(var o=this._tilesToRenderByTextureCount,s=0,l=o.length;s<l;++s){var c=o[s];if(defined(c))for(var u=0,d=c.length;u<d;++u){var h=c[u],p=h.data.tileBoundingRegion;addDrawCommandsForTile(this,h,e),e.minimumTerrainHeight=Math.min(e.minimumTerrainHeight,p.minimumHeight)}}},GlobeSurfaceTileProvider.prototype.updateForPick=function(e){for(var t=this._drawCommands,i=0,r=this._usedDrawCommands;i<r;++i)pushCommand(t[i],e)},GlobeSurfaceTileProvider.prototype.cancelReprojections=function(){this._imageryLayers.cancelReprojections()},GlobeSurfaceTileProvider.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)},GlobeSurfaceTileProvider.prototype.loadTile=function(e,t){var i,r=t.data,n=!0;defined(r)&&(n=r.boundingVolumeSourceTile!==t||t._lastSelectionResult===TileSelectionResult.CULLED_BUT_NEEDED,i=r.terrainState),GlobeSurfaceTile.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,n),r=t.data,n&&i!==t.data.terrainState&&this.computeTileVisibility(t,e,this.quadtree.occluders)!==Visibility$1.NONE&&r.boundingVolumeSourceTile===t&&(n=!1,GlobeSurfaceTile.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,n))};var boundingSphereScratch$1=new BoundingSphere,rectangleIntersectionScratch=new Rectangle,splitCartographicLimitRectangleScratch=new Rectangle,rectangleCenterScratch=new Cartographic;function clipRectangleAntimeridian(e,t){if(t.west<t.east)return t;var i=Rectangle.clone(t,splitCartographicLimitRectangleScratch);return Rectangle.center(e,rectangleCenterScratch).longitude>0?i.east=CesiumMath.PI:i.west=-CesiumMath.PI,i}function isUndergroundVisible(e,t){if(t.cameraUnderground)return!0;if(t.globeTranslucencyState.translucent)return!0;if(e.backFaceCulling)return!1;var i=e._clippingPlanes;return!(!defined(i)||!i.enabled)||(!!defined(e._multiClippingPlanes)||!Rectangle.equals(e.cartographicLimitRectangle,Rectangle.MAX_VALUE))}GlobeSurfaceTileProvider.prototype.computeTileVisibility=function(e,t,i){var r=this.computeDistanceToTile(e,t);e._distance=r;var n=isUndergroundVisible(this,t);if(t.fog.enabled&&!n&&CesiumMath.fog(r,t.fog.density)>=1)return Visibility$1.NONE;var a=e.data,o=a.tileBoundingRegion;if(void 0===a.boundingVolumeSourceTile)return Visibility$1.PARTIAL;var s=t.cullingVolume,l=o.boundingVolume;defined(l)||(l=o.boundingSphere),a.clippedByBoundaries=!1;var c=clipRectangleAntimeridian(e.rectangle,this.cartographicLimitRectangle),u=Rectangle.simpleIntersection(c,e.rectangle,rectangleIntersectionScratch);if(!defined(u))return Visibility$1.NONE;if(Rectangle.equals(u,e.rectangle)||(a.clippedByBoundaries=!0),t.mode!==SceneMode$1.SCENE3D&&(l=boundingSphereScratch$1,BoundingSphere.fromRectangleWithHeights2D(e.rectangle,t.mapProjection,o.minimumHeight,o.maximumHeight,l),Cartesian3.fromElements(l.center.z,l.center.x,l.center.y,l.center),t.mode===SceneMode$1.MORPHING&&defined(a.renderedMesh)&&(l=BoundingSphere.union(o.boundingSphere,l,l))),!defined(l))return Visibility$1.PARTIAL;var d=this._clippingPlanes;if(defined(d)&&d.enabled){var h=d.computeIntersectionWithBoundingVolume(l);if(e.isClipped=h!==Intersect$1.INSIDE,h===Intersect$1.OUTSIDE)return Visibility$1.NONE}var p,f=this._multiClippingPlanes;if(defined(f)&&f.enabled)for(var m=0;f.length;m++){h=f[m].computeIntersectionWithBoundingVolume(l);if(e.isClipped=h!==Intersect$1.INSIDE,h===Intersect$1.OUTSIDE)return Visibility$1.NONE}var g=s.computeVisibility(l);if(g===Intersect$1.OUTSIDE?p=Visibility$1.NONE:g===Intersect$1.INTERSECTING?p=Visibility$1.PARTIAL:g===Intersect$1.INSIDE&&(p=Visibility$1.FULL),p===Visibility$1.NONE)return p;var _=t.mode===SceneMode$1.SCENE3D&&t.camera.frustum instanceof OrthographicFrustum;if(t.mode===SceneMode$1.SCENE3D&&!_&&defined(i)&&!n){var y=a.occludeePointInScaledSpace;return defined(y)?i.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(y,o.minimumHeight)?p:Visibility$1.NONE:p}return p},GlobeSurfaceTileProvider.prototype.canRefine=function(e){return!!defined(e.data.terrainData)||void 0!==this.terrainProvider.getTileDataAvailable(2*e.x,2*e.y,e.level+1)};var readyImageryScratch=[],canRenderTraversalStack=[];GlobeSurfaceTileProvider.prototype.canRenderWithoutLosingDetail=function(e,t){var i=e.data,r=readyImageryScratch;r.length=this._imageryLayers.length;var n,a,o,s=!1,l=!1;for(defined(i)&&(s=i.terrainState===TerrainState$1.READY,l=!0,n=i.imagery),a=0,o=r.length;a<o;++a)r[a]=l;if(defined(n))for(a=0,o=n.length;a<o;++a){var c=n[a],u=c.loadingImagery,d=!defined(u)||u.state===ImageryState$1.FAILED||u.state===ImageryState$1.INVALID,h=(c.loadingImagery||c.readyImagery).imageryLayer._layerIndex;r[h]=d&&r[h]}var p=this.quadtree._lastSelectionFrameNumber,f=canRenderTraversalStack;for(f.length=0,f.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild);f.length>0;){var m=f.pop(),g=m._lastSelectionResultFrame===p?m._lastSelectionResult:TileSelectionResult.NONE;if(g===TileSelectionResult.RENDERED){if(!defined(m.data))continue;if(!s&&m.data.terrainState===TerrainState$1.READY)return!1;var _=m.data.imagery;for(a=0,o=_.length;a<o;++a){var y=_[a],v=y.loadingImagery,C=!defined(v)||v.state===ImageryState$1.FAILED||v.state===ImageryState$1.INVALID,T=(y.loadingImagery||y.readyImagery).imageryLayer._layerIndex;if(C&&!r[T])return!1}}else g===TileSelectionResult.REFINED&&f.push(m.southwestChild,m.southeastChild,m.northwestChild,m.northeastChild)}return!0};var tileDirectionScratch=new Cartesian3;GlobeSurfaceTileProvider.prototype.computeTileLoadPriority=function(e,t){var i=e.data;if(void 0===i)return 0;var r=i.tileBoundingRegion.boundingVolume;if(void 0===r)return 0;var n=t.camera.positionWC,a=t.camera.directionWC,o=Cartesian3.subtract(r.center,n,tileDirectionScratch),s=Cartesian3.magnitude(o);return s<CesiumMath.EPSILON5?0:(Cartesian3.divideByScalar(o,s,o),(1-Cartesian3.dot(o,a))*e._distance)};var modifiedModelViewScratch=new Matrix4,modifiedModelViewProjectionScratch=new Matrix4,tileRectangleScratch=new Cartesian4,localizedCartographicLimitRectangleScratch=new Cartesian4,localizedTranslucencyRectangleScratch=new Cartesian4,rtcScratch=new Cartesian3,centerEyeScratch=new Cartesian3,southwestScratch=new Cartesian3,northeastScratch=new Cartesian3;GlobeSurfaceTileProvider.prototype.showTileThisFrame=function(e,t){for(var i=0,r=e.data.imagery,n=0,a=r.length;n<a;++n){var o=r[n];defined(o.readyImagery)&&0!==o.readyImagery.imageryLayer.alpha&&++i}var s=this._tilesToRenderByTextureCount[i];defined(s)||(s=[],this._tilesToRenderByTextureCount[i]=s),s.push(e),defined(e.data.vertexArray)?this._hasLoadedTilesThisFrame=!0:this._hasFillTilesThisFrame=!0;var l=this._debug;++l.tilesRendered,l.texturesRendered+=i};var cornerPositionsScratch=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3];function computeOccludeePoint(e,t,i,r,n,a){var o=e.quadtree._occluders.ellipsoid,s=o.ellipsoid,l=cornerPositionsScratch;return Cartesian3.fromRadians(i.west,i.south,n,s,l[0]),Cartesian3.fromRadians(i.east,i.south,n,s,l[1]),Cartesian3.fromRadians(i.west,i.north,n,s,l[2]),Cartesian3.fromRadians(i.east,i.north,n,s,l[3]),o.computeHorizonCullingPointPossiblyUnderEllipsoid(t,l,r,a)}function updateTileBoundingRegion(e,t,i){var r=e.data;void 0===r&&(r=e.data=new GlobeSurfaceTile);var n=e.tilingScheme.ellipsoid;void 0===r.tileBoundingRegion&&(r.tileBoundingRegion=new TileBoundingRegion({computeBoundingVolumes:!1,rectangle:e.rectangle,ellipsoid:n,minimumHeight:0,maximumHeight:0}));var a=r.tileBoundingRegion,o=a.minimumHeight,s=a.maximumHeight,l=!1,c=e,u=r.mesh,d=r.terrainData;if(void 0!==u&&void 0!==u.minimumHeight&&void 0!==u.maximumHeight)a.minimumHeight=u.minimumHeight,a.maximumHeight=u.maximumHeight,l=!0;else if(void 0!==d&&void 0!==d._minimumHeight&&void 0!==d._maximumHeight)a.minimumHeight=d._minimumHeight,a.maximumHeight=d._maximumHeight;else{a.minimumHeight=Number.NaN,a.maximumHeight=Number.NaN;for(var h=e.parent;void 0!==h;){var p=h.data;if(void 0!==p){var f=p.mesh,m=p.terrainData;if(void 0!==f&&void 0!==f.minimumHeight&&void 0!==f.maximumHeight){a.minimumHeight=f.minimumHeight,a.maximumHeight=f.maximumHeight;break}if(void 0!==m&&void 0!==m._minimumHeight&&void 0!==m._maximumHeight){a.minimumHeight=m._minimumHeight,a.maximumHeight=m._maximumHeight;break}}h=h.parent}c=h}if(void 0!==c){var g=i.terrainExaggeration,_=i.terrainExaggerationRelativeHeight;if(1!==g&&(l=!1,a.minimumHeight=TerrainExaggeration.getHeight(a.minimumHeight,g,_),a.maximumHeight=TerrainExaggeration.getHeight(a.maximumHeight,g,_)),l)r.boundingVolumeIsFromMesh||(a._orientedBoundingBox=OrientedBoundingBox.clone(u.orientedBoundingBox,a._orientedBoundingBox),a._boundingSphere=BoundingSphere.clone(u.boundingSphere3D,a._boundingSphere),r.occludeePointInScaledSpace=Cartesian3.clone(u.occludeePointInScaledSpace,r.occludeePointInScaledSpace),defined(r.occludeePointInScaledSpace)||(r.occludeePointInScaledSpace=computeOccludeePoint(t,a._orientedBoundingBox.center,e.rectangle,a.minimumHeight,a.maximumHeight,r.occludeePointInScaledSpace)));else{var y=void 0===a._orientedBoundingBox||void 0===a._boundingSphere;(a.minimumHeight!==o||a.maximumHeight!==s||y)&&(a.computeBoundingVolumes(n),r.occludeePointInScaledSpace=computeOccludeePoint(t,a._orientedBoundingBox.center,e.rectangle,a.minimumHeight,a.maximumHeight,r.occludeePointInScaledSpace))}r.boundingVolumeSourceTile=c,r.boundingVolumeIsFromMesh=l}else r.boundingVolumeSourceTile=void 0,r.boundingVolumeIsFromMesh=!1}function getTileReadyCallback(e,t,i){return function(r){var n,a,o,s=-1,l=r.data.imagery,c=l.length;for(o=0;o<c;++o)if((a=defaultValue((n=l[o]).readyImagery,n.loadingImagery)).imageryLayer===t){s=o;break}if(-1!==s){var u=s+e;if(a=defined(n=l[u])?defaultValue(n.readyImagery,n.loadingImagery):void 0,!defined(a)||a.imageryLayer!==t)return!t._createTileImagerySkeletons(r,i,u);for(o=s;o<u;++o)l[o].freeResources();l.splice(s,e)}return!0}}GlobeSurfaceTileProvider.prototype.computeDistanceToTile=function(e,t){updateTileBoundingRegion(e,this,t);var i=e.data;if(void 0===i.boundingVolumeSourceTile)return 9999999999;var r=i.tileBoundingRegion,n=r.minimumHeight,a=r.maximumHeight;if(i.boundingVolumeSourceTile!==e){var o=t.camera.positionCartographic.height;Math.abs(o-n)>Math.abs(o-a)?(r.minimumHeight=n,r.maximumHeight=n):(r.minimumHeight=a,r.maximumHeight=a)}var s=r.distanceToCamera(t);return r.minimumHeight=n,r.maximumHeight=a,s},GlobeSurfaceTileProvider.prototype.isDestroyed=function(){return!1},GlobeSurfaceTileProvider.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),defined(this._multiClippingPlanes)&&(this._multiClippingPlanes.destroy(),this._multiClippingPlanes=void 0),destroyObject(this)},GlobeSurfaceTileProvider.prototype._onLayerAdded=function(e,t){if(e.show){var i=this._terrainProvider,r=this,n=e.imageryProvider,a=this._imageryLayersUpdatedEvent;n._reload=function(){e._imageryCache={},r._quadtree.forEachLoadedTile((function(t){if(!defined(t._loadedCallbacks[e._layerIndex])){var r,n=t.data.imagery,a=n.length,o=-1,s=0;for(r=0;r<a;++r){var l=n[r];if(defaultValue(l.readyImagery,l.loadingImagery).imageryLayer===e)-1===o&&(o=r),++s;else if(-1!==o)break}if(-1!==o){var c=o+s;e._createTileImagerySkeletons(t,i,c)&&(t._loadedCallbacks[e._layerIndex]=getTileReadyCallback(s,e,i),t.state=QuadtreeTileLoadState$1.LOADING)}}}))},this._quadtree.forEachLoadedTile((function(t){e._createTileImagerySkeletons(t,i)&&(t.state=QuadtreeTileLoadState$1.LOADING,0===t.level||t._lastSelectionResultFrame===r.quadtree._lastSelectionFrameNumber&&t._lastSelectionResult===TileSelectionResult.RENDERED||(t.renderable=!1))})),this._layerOrderChanged=!0,a.raiseEvent()}},GlobeSurfaceTileProvider.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile((function(t){for(var i=t.data.imagery,r=-1,n=0,a=0,o=i.length;a<o;++a){var s=i[a],l=s.loadingImagery;if(defined(l)||(l=s.readyImagery),l.imageryLayer===e)-1===r&&(r=a),s.freeResources(),++n;else if(-1!==r)break}-1!==r&&i.splice(r,n)})),defined(e.imageryProvider)&&(e.imageryProvider._reload=void 0),this._imageryLayersUpdatedEvent.raiseEvent()},GlobeSurfaceTileProvider.prototype._onLayerMoved=function(e,t,i){this._layerOrderChanged=!0,this._imageryLayersUpdatedEvent.raiseEvent()},GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden=function(e,t,i){i?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};var scratchClippingPlanesMatrix=new Matrix4,scratchInverseTransposeClippingPlanesMatrix=new Matrix4,getDebugOrientedBoundingBox,getDebugBoundingSphere,debugDestroyPrimitive;function createTileUniformMap(e,t){var i={u_initialColor:function(){return this.properties.initialColor},u_fillHighlightColor:function(){return this.properties.fillHighlightColor},u_zoomedOutOceanSpecularIntensity:function(){return this.properties.zoomedOutOceanSpecularIntensity},u_oceanNormalMap:function(){return this.properties.oceanNormalMap},u_lightingFadeDistance:function(){return this.properties.lightingFadeDistance},u_nightFadeDistance:function(){return this.properties.nightFadeDistance},u_center3D:function(){return this.properties.center3D},u_terrainExaggerationAndRelativeHeight:function(){return this.properties.terrainExaggerationAndRelativeHeight},u_tileRectangle:function(){return this.properties.tileRectangle},u_modifiedModelView:function(){var t=e.context.uniformState.view,i=Matrix4.multiplyByPoint(t,this.properties.rtc,centerEyeScratch);return Matrix4.setTranslation(t,i,modifiedModelViewScratch),modifiedModelViewScratch},u_modifiedModelViewProjection:function(){var t=e.context.uniformState.view,i=e.context.uniformState.projection,r=Matrix4.multiplyByPoint(t,this.properties.rtc,centerEyeScratch);return Matrix4.setTranslation(t,r,modifiedModelViewProjectionScratch),Matrix4.multiply(i,modifiedModelViewProjectionScratch,modifiedModelViewProjectionScratch),modifiedModelViewProjectionScratch},u_dayTextures:function(){return this.properties.dayTextures},u_dayTextureTranslationAndScale:function(){return this.properties.dayTextureTranslationAndScale},u_dayTextureTexCoordsRectangle:function(){return this.properties.dayTextureTexCoordsRectangle},u_dayTextureUseWebMercatorT:function(){return this.properties.dayTextureUseWebMercatorT},u_dayTextureAlpha:function(){return this.properties.dayTextureAlpha},u_dayTextureNightAlpha:function(){return this.properties.dayTextureNightAlpha},u_dayTextureDayAlpha:function(){return this.properties.dayTextureDayAlpha},u_dayTextureBrightness:function(){return this.properties.dayTextureBrightness},u_dayTextureContrast:function(){return this.properties.dayTextureContrast},u_dayTextureHue:function(){return this.properties.dayTextureHue},u_dayTextureSaturation:function(){return this.properties.dayTextureSaturation},u_dayTextureOneOverGamma:function(){return this.properties.dayTextureOneOverGamma},u_dayIntensity:function(){return this.properties.dayIntensity},u_southAndNorthLatitude:function(){return this.properties.southAndNorthLatitude},u_southMercatorYAndOneOverHeight:function(){return this.properties.southMercatorYAndOneOverHeight},u_waterMask:function(){return this.properties.waterMask},u_waterMaskTranslationAndScale:function(){return this.properties.waterMaskTranslationAndScale},u_minMaxHeight:function(){return this.properties.minMaxHeight},u_scaleAndBias:function(){return this.properties.scaleAndBias},u_dayTextureSplit:function(){return this.properties.dayTextureSplit},u_dayTextureCutoutRectangles:function(){return this.properties.dayTextureCutoutRectangles},u_slopeColorsTexture:function(){return ExpandBySmartEarth.isSlopeDirty&&(ExpandBySmartEarth._slopeTex=ExpandBySmartEarth.createElevationTextureFromPallete(ExpandBySmartEarth.SlopeMapPallete,e),this.properties.slopeColorsTexture2=ExpandBySmartEarth._slopeTex,ExpandBySmartEarth.isSlopeDirty=!1),ExpandBySmartEarth._slopeTex},u_clippingPlanes:function(){var i=t._multiClippingPlanes;if(defined(i)){var r=i.dataTexture;if(defined(r))return r}var n=t._clippingPlanes;return defined(n)&&defined(n.texture)?n.texture:e.context.defaultTexture},u_cartographicLimitRectangle:function(){return this.properties.localizedCartographicLimitRectangle},u_clippingPlanesMatrix:function(){var i=t._multiClippingPlanes;if(defined(i)){var r=Matrix4.multiply(e.context.uniformState.view,i.modelMatrix,scratchClippingPlanesMatrix);return Matrix4.inverseTranspose(r,scratchInverseTransposeClippingPlanesMatrix)}var n=t._clippingPlanes;r=defined(n)?Matrix4.multiply(e.context.uniformState.view,n.modelMatrix,scratchClippingPlanesMatrix):Matrix4.IDENTITY;return Matrix4.inverseTranspose(r,scratchInverseTransposeClippingPlanesMatrix)},u_clippingPlanesEdgeStyle:function(){var e,i=t._multiClippingPlanes;return defined(i)?((e=i.edgeColor.clone()).alpha=i.edgeWidth,e):((e=this.properties.clippingPlanesEdgeColor.clone()).alpha=this.properties.clippingPlanesEdgeWidth,e)},u_multiClippingPlanesLength:function(){var i=t._multiClippingPlanes;if(defined(i)){var r=i.lengthTexture;if(defined(r))return r}return defined(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},properties:{initialColor:new Cartesian4(0,0,.5,1),fillHighlightColor:new Color(0,0,0,0),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new Cartesian2(65e5,9e6),nightFadeDistance:new Cartesian2(1e7,4e7),hsbShift:new Cartesian3,center3D:void 0,rtc:new Cartesian3,modifiedModelView:new Matrix4,tileRectangle:new Cartesian4,terrainExaggerationAndRelativeHeight:new Cartesian2(1,0),dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureUseWebMercatorT:[],dayTextureAlpha:[],dayTextureNightAlpha:[],dayTextureDayAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayTextureSplit:[],dayTextureCutoutRectangles:[],dayIntensity:0,colorsToAlpha:[],southAndNorthLatitude:new Cartesian2,southMercatorYAndOneOverHeight:new Cartesian2,waterMask:void 0,waterMaskTranslationAndScale:new Cartesian4,minMaxHeight:new Cartesian2,scaleAndBias:new Matrix4,clippingPlanesEdgeColor:Color.clone(Color.WHITE),clippingPlanesEdgeWidth:0,localizedCartographicLimitRectangle:new Cartesian4,frontFaceAlphaByDistance:new Cartesian4,backFaceAlphaByDistance:new Cartesian4,localizedTranslucencyRectangle:new Cartesian4,undergroundColor:Color.clone(Color.TRANSPARENT),undergroundColorAlphaByDistance:new Cartesian4,lambertDiffuseMultiplier:0,slopeColorsTexture2:defined(ExpandBySmartEarth._slopeTex)?ExpandBySmartEarth._slopeTex:ExpandBySmartEarth.createElevationTextureFromPallete(ExpandBySmartEarth.SlopeMapPallete,e)}};return defined(t.cutPolygonUniformMap)?combine$2(i,t.cutPolygonUniformMap):defined(t.materialUniformMap)?combine$2(i,t.materialUniformMap):i}function createWireframeVertexArrayIfNecessary(e,t,i){var r,n,a=i.data;if(defined(a.vertexArray)?(r=a.mesh,n=a.vertexArray):defined(a.fill)&&defined(a.fill.vertexArray)&&(r=a.fill.mesh,n=a.fill.vertexArray),defined(r)&&defined(n)){if(defined(a.wireframeVertexArray)){if(a.wireframeVertexArray.mesh===r)return;a.wireframeVertexArray.destroy(),a.wireframeVertexArray=void 0}a.wireframeVertexArray=createWireframeVertexArray(e,n,r),a.wireframeVertexArray.mesh=r}}function createWireframeVertexArray(e,t,i){var r={indices:i.indices,primitiveType:PrimitiveType$1.TRIANGLES};GeometryPipeline.toWireframe(r);var n=r.indices,a=Buffer$1.createIndexBuffer({context:e,typedArray:n,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.fromSizeInBytes(n.BYTES_PER_ELEMENT)});return new VertexArray({context:e,attributes:t._attributes,indexBuffer:a})}!function(){var e,t,i=new GeometryInstance({geometry:BoxOutlineGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2)})}),r=new GeometryInstance({geometry:new SphereOutlineGeometry({radius:1})}),n=new Matrix4;function a(e){return new Primitive$2({geometryInstances:e,appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})}getDebugOrientedBoundingBox=function(r,o){return r===e?t:(debugDestroyPrimitive(),e=r,n=Matrix4.fromRotationTranslation(r.halfAxes,r.center,n),i.modelMatrix=n,i.attributes.color=ColorGeometryInstanceAttribute.fromColor(o),t=a(i))},getDebugBoundingSphere=function(i,o){return i===e?t:(debugDestroyPrimitive(),e=i,n=Matrix4.fromTranslation(i.center,n),n=Matrix4.multiplyByUniformScale(n,i.radius,n),r.modelMatrix=n,r.attributes.color=ColorGeometryInstanceAttribute.fromColor(o),t=a(r))},debugDestroyPrimitive=function(){defined(t)&&(t.destroy(),t=void 0,e=void 0)}}();var otherPassesInitialColor=new Cartesian4(0,0,0,0),surfaceShaderSetOptionsScratch={frameState:void 0,surfaceTile:void 0,numberOfDayTextures:void 0,applyBrightness:void 0,applyContrast:void 0,applyHue:void 0,applySaturation:void 0,applyGamma:void 0,applyAlpha:void 0,applyDayNightAlpha:void 0,applySplit:void 0,showReflectiveOcean:void 0,showOceanWaves:void 0,enableLighting:void 0,dynamicAtmosphereLighting:void 0,dynamicAtmosphereLightingFromSun:void 0,showGroundAtmosphere:void 0,perFragmentGroundAtmosphere:void 0,hasVertexNormals:void 0,useWebMercatorProjection:void 0,enableFog:void 0,enableClippingPlanes:void 0,clippingPlanes:void 0,clippedByBoundaries:void 0,hasImageryLayerCutout:void 0,colorCorrect:void 0,colorToAlpha:void 0,hasGeodeticSurfaceNormals:void 0,hasExaggeration:void 0},defaultUndergroundColor=Color.TRANSPARENT,defaultUndergroundColorAlphaByDistance=new NearFarScalar;function addDrawCommandsForTile(e,t,i){var r=t.data;defined(r.vertexArray)||(void 0===r.fill&&(r.fill=new TerrainFillMesh(t)),r.fill.update(e,i));var n=i.creditDisplay,a=r.terrainData;if(defined(a)&&defined(a.credits))for(var o=a.credits,s=0,l=o.length;s<l;++s)n.addCredit(o[s]);var c=ContextLimits.maximumTextureImageUnits,u=r.waterMaskTexture,d=r.waterMaskTranslationAndScale;!defined(u)&&defined(r.fill)&&(u=r.fill.waterMaskTexture,d=r.fill.waterMaskTranslationAndScale);var h=i.cameraUnderground,p=i.globeTranslucencyState,f=p.translucent,m=p.frontFaceAlphaByDistance,g=p.backFaceAlphaByDistance,_=p.rectangle,y=defaultValue(e.undergroundColor,defaultUndergroundColor),v=defaultValue(e.undergroundColorAlphaByDistance,defaultUndergroundColorAlphaByDistance),C=isUndergroundVisible(e,i)&&i.mode===SceneMode$1.SCENE3D&&y.alpha>0&&(v.nearValue>0||v.farValue>0),T=e.lambertDiffuseMultiplier,S=e.hasWaterMask&&defined(u),A=e.oceanNormalMap,x=S&&defined(A),E=e.terrainProvider.ready&&e.terrainProvider.hasVertexNormals,b=i.fog.enabled&&!h,P=e.showGroundAtmosphere&&i.mode===SceneMode$1.SCENE3D,D=ShadowMode$1.castShadows(e.shadows)&&!f,w=ShadowMode$1.receiveShadows(e.shadows)&&!f,M=e.hueShift,I=e.saturationShift,R=e.brightnessShift,O=!(CesiumMath.equalsEpsilon(M,0,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(I,0,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(R,0,CesiumMath.EPSILON7)),B=!1;P&&(B=Cartesian3.magnitude(i.camera.positionWC)>e.nightFadeOutDistance);S&&--c,x&&--c,defined(i.shadowState)&&i.shadowState.shadowsEnabled&&--c,defined(e.clippingPlanes)&&e.clippingPlanes.enabled&&--c,c-=p.numberOfTextureUniforms;var L=r.renderedMesh,F=L.center,N=L.encoding,V=r.tileBoundingRegion,k=i.terrainExaggeration,U=i.terrainExaggerationRelativeHeight,G=1!==k,$=N.hasGeodeticSurfaceNormals,z=tileRectangleScratch,H=0,W=0,j=0,q=0,X=!1;if(i.mode!==SceneMode$1.SCENE3D){var Y=i.mapProjection,K=Y.project(Rectangle.southwest(t.rectangle),southwestScratch),J=Y.project(Rectangle.northeast(t.rectangle),northeastScratch);if(z.x=K.x,z.y=K.y,z.z=J.x,z.w=J.y,i.mode!==SceneMode$1.MORPHING&&((F=rtcScratch).x=0,F.y=.5*(z.z+z.x),F.z=.5*(z.w+z.y),z.x-=F.y,z.y-=F.z,z.z-=F.y,z.w-=F.z),i.mode===SceneMode$1.SCENE2D&&N.quantization===TerrainQuantization$1.BITS12){var Q=1/(Math.pow(2,12)-1)*.5,Z=(z.z-z.x)*Q,ee=(z.w-z.y)*Q;z.x-=Z,z.y-=ee,z.z+=Z,z.w+=ee}Y instanceof WebMercatorProjection&&(H=t.rectangle.south,W=t.rectangle.north,j=WebMercatorProjection.geodeticLatitudeToMercatorAngle(H),q=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(W)-j),X=!0)}var te=surfaceShaderSetOptionsScratch;te.frameState=i,te.surfaceTile=r,te.showReflectiveOcean=S,te.showOceanWaves=x,te.enableLighting=e.enableLighting,te.dynamicAtmosphereLighting=e.dynamicAtmosphereLighting,te.dynamicAtmosphereLightingFromSun=e.dynamicAtmosphereLightingFromSun,te.showGroundAtmosphere=P,te.perFragmentGroundAtmosphere=B,te.hasVertexNormals=E,te.useWebMercatorProjection=X,te.clippedByBoundaries=r.clippedByBoundaries,te.hasGeodeticSurfaceNormals=$,te.hasExaggeration=G;var ie=r.imagery,re=0,ne=ie.length,ae=e.showSkirts&&!h&&!f,oe=e.backFaceCulling&&!h&&!f,se=oe?e._renderState:e._disableCullingRenderState,le=oe?e._blendRenderState:e._disableCullingBlendRenderState,ce=se,ue=e._firstPassInitialColor,de=i.context;if(defined(e._debug.boundingSphereTile)||debugDestroyPrimitive(),e._materialUniformMap!==e.materialUniformMap){e._materialUniformMap=e.materialUniformMap;for(var he=e._drawCommands.length,pe=0;pe<he;++pe)e._uniformMaps[pe]=createTileUniformMap(i,e)}do{var fe,me,ge=0;if(e._drawCommands.length<=e._usedDrawCommands?((fe=new DrawCommand).owner=t,fe.cull=!1,fe.boundingVolume=new BoundingSphere,fe.orientedBoundingBox=void 0,me=createTileUniformMap(i,e),e._drawCommands.push(fe),e._uniformMaps.push(me)):(fe=e._drawCommands[e._usedDrawCommands],me=e._uniformMaps[e._usedDrawCommands]),fe.owner=t,++e._usedDrawCommands,t===e._debug.boundingSphereTile){var _e=V.boundingVolume,ye=V.boundingSphere;defined(_e)?getDebugOrientedBoundingBox(_e,Color.RED).update(i):defined(ye)&&getDebugBoundingSphere(ye,Color.RED).update(i)}var ve=me.properties;Cartesian4.clone(ue,ve.initialColor),ve.oceanNormalMap=A,ve.lightingFadeDistance.x=e.lightingFadeOutDistance,ve.lightingFadeDistance.y=e.lightingFadeInDistance,ve.nightFadeDistance.x=e.nightFadeOutDistance,ve.nightFadeDistance.y=e.nightFadeInDistance,ve.zoomedOutOceanSpecularIntensity=e.zoomedOutOceanSpecularIntensity;var Ce=h?g:m,Te=h?m:g;defined(Ce)&&(Cartesian4.fromElements(Ce.near,Ce.nearValue,Ce.far,Ce.farValue,ve.frontFaceAlphaByDistance),Cartesian4.fromElements(Te.near,Te.nearValue,Te.far,Te.farValue,ve.backFaceAlphaByDistance)),Cartesian4.fromElements(v.near,v.nearValue,v.far,v.farValue,ve.undergroundColorAlphaByDistance),Color.clone(y,ve.undergroundColor),ve.lambertDiffuseMultiplier=T;var Se=!defined(r.vertexArray)&&defined(e.fillHighlightColor)&&e.fillHighlightColor.alpha>0;Se&&Color.clone(e.fillHighlightColor,ve.fillHighlightColor),ve.terrainExaggerationAndRelativeHeight.x=k,ve.terrainExaggerationAndRelativeHeight.y=U,ve.center3D=L.center,Cartesian3.clone(F,ve.rtc),Cartesian4.clone(z,ve.tileRectangle),ve.southAndNorthLatitude.x=H,ve.southAndNorthLatitude.y=W,ve.southMercatorYAndOneOverHeight.x=j,ve.southMercatorYAndOneOverHeight.y=q;var Ae=localizedCartographicLimitRectangleScratch,xe=clipRectangleAntimeridian(t.rectangle,e.cartographicLimitRectangle),Ee=localizedTranslucencyRectangleScratch,be=clipRectangleAntimeridian(t.rectangle,_);Cartesian3.fromElements(M,I,R,ve.hsbShift);var Pe=t.rectangle,De=1/Pe.width,we=1/Pe.height;Ae.x=(xe.west-Pe.west)*De,Ae.y=(xe.south-Pe.south)*we,Ae.z=(xe.east-Pe.west)*De,Ae.w=(xe.north-Pe.south)*we,Cartesian4.clone(Ae,ve.localizedCartographicLimitRectangle),Ee.x=(be.west-Pe.west)*De,Ee.y=(be.south-Pe.south)*we,Ee.z=(be.east-Pe.west)*De,Ee.w=(be.north-Pe.south)*we,Cartesian4.clone(Ee,ve.localizedTranslucencyRectangle);var Me=b&&CesiumMath.fog(t._distance,i.fog.density)>CesiumMath.EPSILON3;O=O&&(Me||P);for(var Ie=!1,Re=!1,Oe=!1,Be=!1,Le=!1,Fe=!1,Ne=!1,Ve=!1,ke=!1,Ue=!1;ge<c&&re<ne;){var Ge=ie[re],$e=Ge.readyImagery;if(++re,defined($e)&&0!==$e.imageryLayer.alpha){var ze=Ge.useWebMercatorT?$e.textureWebMercator:$e.texture,He=$e.imageryLayer;defined(Ge.textureTranslationAndScale)||(Ge.textureTranslationAndScale=He._calculateTextureTranslationAndScale(t,Ge)),ve.dayTextures[ge]=ze,ve.dayTextureTranslationAndScale[ge]=Ge.textureTranslationAndScale,ve.dayTextureTexCoordsRectangle[ge]=Ge.textureCoordinateRectangle,ve.dayTextureUseWebMercatorT[ge]=Ge.useWebMercatorT,ve.dayTextureAlpha[ge]=He.alpha,Fe=Fe||1!==ve.dayTextureAlpha[ge],ve.dayTextureNightAlpha[ge]=He.nightAlpha,Ne=Ne||1!==ve.dayTextureNightAlpha[ge],ve.dayTextureDayAlpha[ge]=He.dayAlpha,Ne=Ne||1!==ve.dayTextureDayAlpha[ge],ve.dayTextureBrightness[ge]=He.brightness,Ie=Ie||ve.dayTextureBrightness[ge]!==ImageryLayer.DEFAULT_BRIGHTNESS,ve.dayTextureContrast[ge]=He.contrast,Re=Re||ve.dayTextureContrast[ge]!==ImageryLayer.DEFAULT_CONTRAST,ve.dayTextureHue[ge]=He.hue,Oe=Oe||ve.dayTextureHue[ge]!==ImageryLayer.DEFAULT_HUE,ve.dayTextureSaturation[ge]=He.saturation,Be=Be||ve.dayTextureSaturation[ge]!==ImageryLayer.DEFAULT_SATURATION,ve.dayTextureOneOverGamma[ge]=1/He.gamma,Le=Le||ve.dayTextureOneOverGamma[ge]!==1/ImageryLayer.DEFAULT_GAMMA,ve.dayTextureSplit[ge]=He.splitDirection,Ve=Ve||0!==ve.dayTextureSplit[ge];var We=ve.dayTextureCutoutRectangles[ge];if(defined(We)||(We=ve.dayTextureCutoutRectangles[ge]=new Cartesian4),Cartesian4.clone(Cartesian4.ZERO,We),defined(He.cutoutRectangle)){var je=clipRectangleAntimeridian(Pe,He.cutoutRectangle);ke=defined(Rectangle.simpleIntersection(je,Pe,rectangleIntersectionScratch))||ke,We.x=(je.west-Pe.west)*De,We.y=(je.south-Pe.south)*we,We.z=(je.east-Pe.west)*De,We.w=(je.north-Pe.south)*we}var qe=ve.colorsToAlpha[ge];defined(qe)||(qe=ve.colorsToAlpha[ge]=new Cartesian4);var Xe=defined(He.colorToAlpha)&&He.colorToAlphaThreshold>0;if(Ue=Ue||Xe,Xe){var Ye=He.colorToAlpha;qe.x=Ye.red,qe.y=Ye.green,qe.z=Ye.blue,qe.w=He.colorToAlphaThreshold}else qe.w=-1;if(defined($e.credits))for(var Ke=$e.credits,Je=0,Qe=Ke.length;Je<Qe;++Je)n.addCredit(Ke[Je]);++ge}}ve.dayTextures.length=ge,ve.waterMask=u,Cartesian4.clone(d,ve.waterMaskTranslationAndScale),ve.minMaxHeight.x=N.minimumHeight,ve.minMaxHeight.y=N.maximumHeight,Matrix4.clone(N.matrix,ve.scaleAndBias);var Ze=e._clippingPlanes,et=defined(Ze)&&Ze.enabled&&t.isClipped;et&&(ve.clippingPlanesEdgeColor=Color.clone(Ze.edgeColor,ve.clippingPlanesEdgeColor),ve.clippingPlanesEdgeWidth=Ze.edgeWidth),te.numberOfDayTextures=ge,te.applyBrightness=Ie,te.applyContrast=Re,te.applyHue=Oe,te.applySaturation=Be,te.applyGamma=Le,te.applyAlpha=Fe,te.applyDayNightAlpha=Ne,te.applySplit=Ve,te.enableFog=Me,te.enableClippingPlanes=et,te.clippingPlanes=Ze,te.hasImageryLayerCutout=ke,te.colorCorrect=O,te.highlightFillTile=Se,te.colorToAlpha=Ue,te.showUndergroundColor=C,te.translucent=f,te.showSlopeMap=ExpandBySmartEarth.displaySlopeMap,te.smoothSlopeAtHigherAlt=!1,te.multiClippingPlanes=e._multiClippingPlanes;var tt=r.renderedMesh.indices.length;ae||(tt=r.renderedMesh.indexCountWithoutSkirts),fe.shaderProgram=e._surfaceShaderSet.getShaderProgram(te),fe.castShadows=D,fe.receiveShadows=w,fe.renderState=ce,fe.primitiveType=PrimitiveType$1.TRIANGLES,fe.vertexArray=r.vertexArray||r.fill.vertexArray,fe.count=tt,fe.uniformMap=me,fe.pass=Pass$1.GLOBE,e._debug.wireframe&&(createWireframeVertexArrayIfNecessary(de,e,t),defined(r.wireframeVertexArray)&&(fe.vertexArray=r.wireframeVertexArray,fe.primitiveType=PrimitiveType$1.LINES,fe.count=2*tt));var it=fe.boundingVolume,rt=fe.orientedBoundingBox;i.mode!==SceneMode$1.SCENE3D?(BoundingSphere.fromRectangleWithHeights2D(t.rectangle,i.mapProjection,V.minimumHeight,V.maximumHeight,it),Cartesian3.fromElements(it.center.z,it.center.x,it.center.y,it.center),i.mode===SceneMode$1.MORPHING&&(it=BoundingSphere.union(V.boundingSphere,it,it))):(fe.boundingVolume=BoundingSphere.clone(V.boundingSphere,it),fe.orientedBoundingBox=OrientedBoundingBox.clone(V.boundingVolume,rt)),fe.dirty=!0,f&&p.updateDerivedCommands(fe,i),pushCommand(fe,i),ce=le,ue=otherPassesInitialColor}while(re<ne)}function GlobeTranslucency(){this._enabled=!1,this._frontFaceAlpha=1,this._frontFaceAlphaByDistance=void 0,this._backFaceAlpha=1,this._backFaceAlphaByDistance=void 0,this._rectangle=Rectangle.clone(Rectangle.MAX_VALUE)}function ImageryLayerCollection(){this._layers=[],this.layerAdded=new Event,this.layerRemoved=new Event,this.layerMoved=new Event,this.layerShownOrHidden=new Event}function getLayerIndex(e,t){return e.indexOf(t)}function swapLayers(e,t,i){var r=e._layers;if((t=CesiumMath.clamp(t,0,r.length-1))!==(i=CesiumMath.clamp(i,0,r.length-1))){var n=r[t];r[t]=r[i],r[i]=n,e._update(),e.layerMoved.raiseEvent(n,i,t)}}Object.defineProperties(GlobeTranslucency.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this._enabled=e}},frontFaceAlpha:{get:function(){return this._frontFaceAlpha},set:function(e){this._frontFaceAlpha=e}},frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance},set:function(e){this._frontFaceAlphaByDistance=NearFarScalar.clone(e,this._frontFaceAlphaByDistance)}},backFaceAlpha:{get:function(){return this._backFaceAlpha},set:function(e){this._backFaceAlpha=e}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance},set:function(e){this._backFaceAlphaByDistance=NearFarScalar.clone(e,this._backFaceAlphaByDistance)}},rectangle:{get:function(){return this._rectangle},set:function(e){defined(e)||(e=Rectangle.clone(Rectangle.MAX_VALUE)),Rectangle.clone(e,this._rectangle)}}}),Object.defineProperties(ImageryLayerCollection.prototype,{length:{get:function(){return this._layers.length}}}),ImageryLayerCollection.prototype.add=function(e,t){defined(t)?this._layers.splice(t,0,e):(t=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,t)},ImageryLayerCollection.prototype.addImageryProvider=function(e,t){var i=new ImageryLayer(e);return this.add(i,t),i},ImageryLayerCollection.prototype.remove=function(e,t){t=defaultValue(t,!0);var i=this._layers.indexOf(e);return-1!==i&&(this._layers.splice(i,1),this._update(),this.layerRemoved.raiseEvent(e,i),t&&e.destroy(),!0)},ImageryLayerCollection.prototype.removeAll=function(e){e=defaultValue(e,!0);for(var t=this._layers,i=0,r=t.length;i<r;i++){var n=t[i];this.layerRemoved.raiseEvent(n,i),e&&n.destroy()}this._layers=[]},ImageryLayerCollection.prototype.contains=function(e){return-1!==this.indexOf(e)},ImageryLayerCollection.prototype.indexOf=function(e){return this._layers.indexOf(e)},ImageryLayerCollection.prototype.get=function(e){return this._layers[e]},ImageryLayerCollection.prototype.raise=function(e){var t=getLayerIndex(this._layers,e);swapLayers(this,t,t+1)},ImageryLayerCollection.prototype.lower=function(e){var t=getLayerIndex(this._layers,e);swapLayers(this,t,t-1)},ImageryLayerCollection.prototype.raiseToTop=function(e){var t=getLayerIndex(this._layers,e);t!==this._layers.length-1&&(this._layers.splice(t,1),this._layers.push(e),this._update(),this.layerMoved.raiseEvent(e,this._layers.length-1,t))},ImageryLayerCollection.prototype.lowerToBottom=function(e){var t=getLayerIndex(this._layers,e);0!==t&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};var applicableRectangleScratch=new Rectangle,comparisonPoint$1;function pickImageryHelper(e,t,i,r){for(var n,a=e.globe._surface._tilesToRender,o=0;!defined(n)&&o<a.length;++o){var s=a[o];Rectangle.contains(s.rectangle,t)&&(n=s)}if(defined(n))for(var l=n.data.imagery,c=l.length-1;c>=0;--c){var u=l[c],d=u.readyImagery;if(defined(d)){var h=d.imageryLayer.imageryProvider;if((!i||defined(h.pickFeatures))&&Rectangle.contains(d.rectangle,t)){var p=applicableRectangleScratch,f=1/1024;p.west=CesiumMath.lerp(n.rectangle.west,n.rectangle.east,u.textureCoordinateRectangle.x-f),p.east=CesiumMath.lerp(n.rectangle.west,n.rectangle.east,u.textureCoordinateRectangle.z+f),p.south=CesiumMath.lerp(n.rectangle.south,n.rectangle.north,u.textureCoordinateRectangle.y-f),p.north=CesiumMath.lerp(n.rectangle.south,n.rectangle.north,u.textureCoordinateRectangle.w+f),Rectangle.contains(p,t)&&r(d)}}}}function QuadtreeOccluders(e){this._ellipsoid=new EllipsoidalOccluder(e.ellipsoid,Cartesian3.ZERO)}function QuadtreeTile(e){this._tilingScheme=e.tilingScheme,this._x=e.x,this._y=e.y,this._level=e.level,this._parent=e.parent,this._rectangle=this._tilingScheme.tileXYToRectangle(this._x,this._y,this._level),this._southwestChild=void 0,this._southeastChild=void 0,this._northwestChild=void 0,this._northeastChild=void 0,this.replacementPrevious=void 0,this.replacementNext=void 0,this._distance=0,this._loadPriority=0,this._customData=[],this._frameUpdated=void 0,this._lastSelectionResult=TileSelectionResult.NONE,this._lastSelectionResultFrame=void 0,this._loadedCallbacks={},this.state=QuadtreeTileLoadState$1.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0,this.datazh=void 0}function freeTile(e){defined(e)&&e.freeResources()}function TileReplacementQueue(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}function remove(e,t){var i=t.replacementPrevious,r=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=r),t===e.head?e.head=r:i.replacementNext=r,t===e.tail?e.tail=i:r.replacementPrevious=i,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}function QuadtreePrimitive(e){this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,maxDepthVisited:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastMaxDepthVisited:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};var t=this._tileProvider.tilingScheme.ellipsoid;this._tilesToRender=[],this._tileLoadQueueHigh=[],this._tileLoadQueueMedium=[],this._tileLoadQueueLow=[],this._tileReplacementQueue=new TileReplacementQueue,this._levelZeroTiles=void 0,this._loadQueueTimeSlice=5,this._tilesInvalidated=!1,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this._cameraPositionCartographic=void 0,this._cameraReferenceFrameOriginCartographic=void 0,this.maximumScreenSpaceError=defaultValue(e.maximumScreenSpaceError,2),this.tileCacheSize=defaultValue(e.tileCacheSize,100),this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new QuadtreeOccluders({ellipsoid:t}),this._tileLoadProgressEvent=new Event,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}function invalidateAllTiles$1(e){var t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,clearTileLoadQueue$1(e);var i=e._levelZeroTiles;if(defined(i))for(var r=0;r<i.length;++r){for(var n=i[r].customData,a=n.length,o=0;o<a;++o){var s=n[o];s.level=0,e._addHeightCallbacks.push(s)}i[r].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}function clearTileLoadQueue$1(e){var t=e._debug;t.maxDepth=0,t.maxDepthVisited=0,t.tilesVisited=0,t.tilesCulled=0,t.tilesRendered=0,t.tilesWaitingForChildren=0,e._tileLoadQueueHigh.length=0,e._tileLoadQueueMedium.length=0,e._tileLoadQueueLow.length=0}function updateTileLoadProgress$1(e,t){var i=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;(i!==e._lastTileLoadQueueLength||e._tilesInvalidated)&&(t.afterRender.push(Event.prototype.raiseEvent.bind(e._tileLoadProgressEvent,i)),e._lastTileLoadQueueLength=i);var r=e._debug;r.enableDebugOutput&&!r.suspendLodUpdate&&(r.maxDepth=e._tilesToRender.reduce((function(e,t){return Math.max(e,t.level)}),-1),r.tilesRendered=e._tilesToRender.length,r.tilesVisited===r.lastTilesVisited&&r.tilesRendered===r.lastTilesRendered&&r.tilesCulled===r.lastTilesCulled&&r.maxDepth===r.lastMaxDepth&&r.tilesWaitingForChildren===r.lastTilesWaitingForChildren&&r.maxDepthVisited===r.lastMaxDepthVisited||(console.log("Visited "+r.tilesVisited+", Rendered: "+r.tilesRendered+", Culled: "+r.tilesCulled+", Max Depth Rendered: "+r.maxDepth+", Max Depth Visited: "+r.maxDepthVisited+", Waiting for children: "+r.tilesWaitingForChildren),r.lastTilesVisited=r.tilesVisited,r.lastTilesRendered=r.tilesRendered,r.lastTilesCulled=r.tilesCulled,r.lastMaxDepth=r.maxDepth,r.lastTilesWaitingForChildren=r.tilesWaitingForChildren,r.lastMaxDepthVisited=r.maxDepthVisited))}ImageryLayerCollection.prototype.pickImageryLayers=function(e,t){var i=t.globe.pick(e,t);if(defined(i)){var r=t.globe.ellipsoid.cartesianToCartographic(i),n=[];if(pickImageryHelper(t,r,!1,(function(e){n.push(e.imageryLayer)})),0!==n.length)return n}},ImageryLayerCollection.prototype.pickImageryLayerFeatures=function(e,t){var i=t.globe.pick(e,t);if(defined(i)){var r=t.globe.ellipsoid.cartesianToCartographic(i),n=[],a=[];if(pickImageryHelper(t,r,!0,(function(e){var t=e.imageryLayer.imageryProvider.pickFeatures(e.x,e.y,e.level,r.longitude,r.latitude);defined(t)&&(n.push(t),a.push(e.imageryLayer))})),0!==n.length)return when.all(n,(function(e){for(var t=[],i=0;i<e.length;++i){var n=e[i],o=a[i];if(defined(n)&&n.length>0)for(var s=0;s<n.length;++s){var l=n[s];l.imageryLayer=o,defined(l.position)||(l.position=r),t.push(l)}}return t}))}},ImageryLayerCollection.prototype.queueReprojectionCommands=function(e){for(var t=this._layers,i=0,r=t.length;i<r;++i)t[i].queueReprojectionCommands(e)},ImageryLayerCollection.prototype.cancelReprojections=function(){for(var e=this._layers,t=0,i=e.length;t<i;++t)e[t].cancelReprojections()},ImageryLayerCollection.prototype.isDestroyed=function(){return!1},ImageryLayerCollection.prototype.destroy=function(){return this.removeAll(!0),destroyObject(this)},ImageryLayerCollection.prototype._update=function(){var e,t,i,r,n=!0,a=this._layers;for(i=0,r=a.length;i<r;++i)(t=a[i])._layerIndex=i,t.show?(t._isBaseLayer=n,n=!1):t._isBaseLayer=!1,t.show!==t._show&&(defined(t._show)&&(defined(e)||(e=[]),e.push(t)),t._show=t.show);if(defined(e))for(i=0,r=e.length;i<r;++i)t=e[i],this.layerShownOrHidden.raiseEvent(t,t._layerIndex,t.show)},Object.defineProperties(QuadtreeOccluders.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),QuadtreeTile.createLevelZeroTiles=function(e){for(var t=e.getNumberOfXTilesAtLevel(0),i=e.getNumberOfYTilesAtLevel(0),r=new Array(t*i),n=0,a=0;a<i;++a)for(var o=0;o<t;++o)r[n++]=new QuadtreeTile({tilingScheme:e,x:o,y:a,level:0});return r},QuadtreeTile.prototype._updateCustomData=function(e,t,i){var r,n,a,o=this.customData;if(defined(t)&&defined(i)){for(o=o.filter((function(e){return-1===i.indexOf(e)})),this._customData=o,a=this._rectangle,r=0;r<t.length;++r)n=t[r],Rectangle.contains(a,n.positionCartographic)&&o.push(n);this._frameUpdated=e}else{var s=this._parent;if(defined(s)&&this._frameUpdated!==s._frameUpdated){o.length=0,a=this._rectangle;var l=s.customData;for(r=0;r<l.length;++r)n=l[r],Rectangle.contains(a,n.positionCartographic)&&o.push(n);this._frameUpdated=s._frameUpdated}}},Object.defineProperties(QuadtreeTile.prototype,{tilingScheme:{get:function(){return this._tilingScheme}},x:{get:function(){return this._x}},y:{get:function(){return this._y}},level:{get:function(){return this._level}},parent:{get:function(){return this._parent}},rectangle:{get:function(){return this._rectangle}},children:{get:function(){return[this.northwestChild,this.northeastChild,this.southwestChild,this.southeastChild]}},southwestChild:{get:function(){return defined(this._southwestChild)||(this._southwestChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x,y:2*this.y+1,level:this.level+1,parent:this})),this._southwestChild}},southeastChild:{get:function(){return defined(this._southeastChild)||(this._southeastChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x+1,y:2*this.y+1,level:this.level+1,parent:this})),this._southeastChild}},northwestChild:{get:function(){return defined(this._northwestChild)||(this._northwestChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x,y:2*this.y,level:this.level+1,parent:this})),this._northwestChild}},northeastChild:{get:function(){return defined(this._northeastChild)||(this._northeastChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x+1,y:2*this.y,level:this.level+1,parent:this})),this._northeastChild}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<QuadtreeTileLoadState$1.DONE}},eligibleForUnloading:{get:function(){var e=!0;return defined(this.data)&&(defined(e=this.data.eligibleForUnloading)||(e=!0)),e}}}),QuadtreeTile.prototype.findLevelZeroTile=function(e,t,i){var r=this.tilingScheme.getNumberOfXTilesAtLevel(0);if(t<0?t+=r:t>=r&&(t-=r),!(i<0||i>=this.tilingScheme.getNumberOfYTilesAtLevel(0)))return e.filter((function(e){return e.x===t&&e.y===i}))[0]},QuadtreeTile.prototype.findTileToWest=function(e){var t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x-1,this.y);if(t.southeastChild===this)return t.southwestChild;if(t.northeastChild===this)return t.northwestChild;var i=t.findTileToWest(e);return void 0!==i?t.southwestChild===this?i.southeastChild:i.northeastChild:void 0},QuadtreeTile.prototype.findTileToEast=function(e){var t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x+1,this.y);if(t.southwestChild===this)return t.southeastChild;if(t.northwestChild===this)return t.northeastChild;var i=t.findTileToEast(e);return void 0!==i?t.southeastChild===this?i.southwestChild:i.northwestChild:void 0},QuadtreeTile.prototype.findTileToSouth=function(e){var t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x,this.y+1);if(t.northwestChild===this)return t.southwestChild;if(t.northeastChild===this)return t.southeastChild;var i=t.findTileToSouth(e);return void 0!==i?t.southwestChild===this?i.northwestChild:i.northeastChild:void 0},QuadtreeTile.prototype.findTileToNorth=function(e){var t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x,this.y-1);if(t.southwestChild===this)return t.northwestChild;if(t.southeastChild===this)return t.northeastChild;var i=t.findTileToNorth(e);return void 0!==i?t.northwestChild===this?i.southwestChild:i.southeastChild:void 0},QuadtreeTile.prototype.freeResources=function(){this.state=QuadtreeTileLoadState$1.START,this.renderable=!1,this.upsampledFromParent=!1,defined(this.data)&&defined(this.data.freeResources)&&this.data.freeResources(),defined(this.data)&&defined(this.data.geometryPrimitive)&&(this.data.geometryPrimitive.destroy(),this.data.geometryPrimitive=void 0),freeTile(this._southwestChild),this._southwestChild=void 0,freeTile(this._southeastChild),this._southeastChild=void 0,freeTile(this._northwestChild),this._northwestChild=void 0,freeTile(this._northeastChild),this._northeastChild=void 0},TileReplacementQueue.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head},TileReplacementQueue.prototype.trimTiles=function(e){for(var t=this.tail,i=!0;i&&defined(this._lastBeforeStartOfFrame)&&this.count>e&&defined(t);){i=t!==this._lastBeforeStartOfFrame;var r=t.replacementPrevious;t.eligibleForUnloading&&(t.freeResources(),remove(this,t)),t=r}},TileReplacementQueue.prototype.markTileRendered=function(e){var t=this.head;if(t!==e){if(++this.count,!defined(t))return e.replacementPrevious=void 0,e.replacementNext=void 0,this.head=e,void(this.tail=e);(defined(e.replacementPrevious)||defined(e.replacementNext))&&remove(this,e),e.replacementPrevious=void 0,e.replacementNext=t,t.replacementPrevious=e,this.head=e}else e===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=e.replacementNext)},Object.defineProperties(QuadtreePrimitive.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}}),QuadtreePrimitive.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0},QuadtreePrimitive.prototype.forEachLoadedTile=function(e){for(var t=this._tileReplacementQueue.head;defined(t);)t.state!==QuadtreeTileLoadState$1.START&&e(t),t=t.replacementNext},QuadtreePrimitive.prototype.forEachRenderedTile=function(e){for(var t=this._tilesToRender,i=0,r=t.length;i<r;++i)e(t[i])},QuadtreePrimitive.prototype.updateHeight=function(e,t){var i=this,r={positionOnEllipsoidSurface:void 0,positionCartographic:e,level:-1,callback:t,removeFunc:function(){for(var e=i._addHeightCallbacks,t=e.length,n=0;n<t;++n)if(e[n]===r){e.splice(n,1);break}i._removeHeightCallbacks.push(r)}};return i._addHeightCallbacks.push(r),r.removeFunc},QuadtreePrimitive.prototype.update=function(e){defined(this._tileProvider.update)&&this._tileProvider.update(e)},QuadtreePrimitive.prototype.beginFrame=function(e){e.passes.render&&(this._tilesInvalidated&&(invalidateAllTiles$1(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),clearTileLoadQueue$1(this),this._debug.suspendLodUpdate||this._tileReplacementQueue.markStartOfRenderFrame())},QuadtreePrimitive.prototype.render=function(e){var t=e.passes,i=this._tileProvider;t.render&&(i.beginUpdate(e),selectTilesForRendering$1(this,e),createRenderCommandsForSelectedTiles$1(this,e),i.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&i.updateForPick(e)},QuadtreePrimitive.prototype.endFrame=function(e){e.passes.render&&e.mode!==SceneMode$1.MORPHING&&(processTileLoadQueue$1(this,e),updateHeights$1(this,e),updateTileLoadProgress$1(this,e))},QuadtreePrimitive.prototype.isDestroyed=function(){return!1},QuadtreePrimitive.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};var centerScratch$1=new Cartographic;function compareDistanceToPoint$1(e,t){var i=Rectangle.center(e.rectangle,centerScratch$1),r=i.longitude-comparisonPoint$1.longitude,n=i.latitude-comparisonPoint$1.latitude,a=(i=Rectangle.center(t.rectangle,centerScratch$1)).longitude-comparisonPoint$1.longitude,o=i.latitude-comparisonPoint$1.latitude;return r*r+n*n-(a*a+o*o)}var cameraOriginScratch$1=new Cartesian3,rootTraversalDetails$1=[];function selectTilesForRendering$1(e,t){var i=e._debug;if(!i.suspendLodUpdate){var r;e._tilesToRender.length=0;var n,a=e._tileProvider;if(!defined(e._levelZeroTiles)){if(!a.ready)return;var o=a.tilingScheme;e._levelZeroTiles=QuadtreeTile.createLevelZeroTiles(o);var s=e._levelZeroTiles.length;if(rootTraversalDetails$1.length<s)for(rootTraversalDetails$1=new Array(s),r=0;r<s;++r)void 0===rootTraversalDetails$1[r]&&(rootTraversalDetails$1[r]=new TraversalDetails$1)}e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;var l=e._levelZeroTiles,c=l.length>1?e._occluders:void 0;comparisonPoint$1=t.camera.positionCartographic,l.sort(compareDistanceToPoint$1);var u,d=e._addHeightCallbacks,h=e._removeHeightCallbacks,p=t.frameNumber;if(d.length>0||h.length>0){for(r=0,u=l.length;r<u;++r)(n=l[r])._updateCustomData(p,d,h);d.length=0,h.length=0}var f=t.camera;e._cameraPositionCartographic=f.positionCartographic;var m=Matrix4.getTranslation(f.transform,cameraOriginScratch$1);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(m,e._cameraReferenceFrameOriginCartographic),r=0,u=l.length;r<u;++r)n=l[r],e._tileReplacementQueue.markTileRendered(n),n.renderable?visitIfVisible$1(e,n,a,t,c,!1,rootTraversalDetails$1[r]):(queueTileLoad$1(e,e._tileLoadQueueHigh,n,t),++i.tilesWaitingForChildren);e._lastSelectionFrameNumber=p}}function queueTileLoad$1(e,t,i,r){i.needsLoading&&(void 0!==e.tileProvider.computeTileLoadPriority&&(i._loadPriority=e.tileProvider.computeTileLoadPriority(i,r)),t.push(i))}function TraversalDetails$1(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function TraversalQuadDetails$1(){this.southwest=new TraversalDetails$1,this.southeast=new TraversalDetails$1,this.northwest=new TraversalDetails$1,this.northeast=new TraversalDetails$1}TraversalQuadDetails$1.prototype.combine=function(e){var t=this.southwest,i=this.southeast,r=this.northwest,n=this.northeast;e.allAreRenderable=t.allAreRenderable&&i.allAreRenderable&&r.allAreRenderable&&n.allAreRenderable,e.anyWereRenderedLastFrame=t.anyWereRenderedLastFrame||i.anyWereRenderedLastFrame||r.anyWereRenderedLastFrame||n.anyWereRenderedLastFrame,e.notYetRenderableCount=t.notYetRenderableCount+i.notYetRenderableCount+r.notYetRenderableCount+n.notYetRenderableCount};for(var traversalQuadsByLevel$1=new Array(31),i$3=0;i$3<traversalQuadsByLevel$1.length;++i$3)traversalQuadsByLevel$1[i$3]=new TraversalQuadDetails$1;function visitTile$1(e,t,i,r,n){var a=e._debug;++a.tilesVisited,e._tileReplacementQueue.markTileRendered(i),i._updateCustomData(t.frameNumber),i.level>a.maxDepthVisited&&(a.maxDepthVisited=i.level);var o=screenSpaceError$1(e,t,i)<e.maximumScreenSpaceError,s=i.southwestChild,l=i.southeastChild,c=i.northwestChild,u=i.northeastChild,d=e._lastSelectionFrameNumber,h=i._lastSelectionResultFrame===d?i._lastSelectionResult:TileSelectionResult.NONE,p=e.tileProvider;if(o||r){var f=TileSelectionResult.originalResult(h)===TileSelectionResult.RENDERED,m=TileSelectionResult.originalResult(h)===TileSelectionResult.CULLED||h===TileSelectionResult.NONE,g=i.state===QuadtreeTileLoadState$1.DONE,_=f||m||g;if(_||defined(p.canRenderWithoutLosingDetail)&&(_=p.canRenderWithoutLosingDetail(i)),_)return o&&queueTileLoad$1(e,e._tileLoadQueueMedium,i,t),addTileToRenderList$1(e,i),n.allAreRenderable=i.renderable,n.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,n.notYetRenderableCount=i.renderable?0:1,i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,void(n.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(i));r=!0,o&&queueTileLoad$1(e,e._tileLoadQueueHigh,i,t)}if(p.canRefine(i)){if(s.upsampledFromParent&&l.upsampledFromParent&&c.upsampledFromParent&&u.upsampledFromParent)return addTileToRenderList$1(e,i),queueTileLoad$1(e,e._tileLoadQueueMedium,i,t),e._tileReplacementQueue.markTileRendered(s),e._tileReplacementQueue.markTileRendered(l),e._tileReplacementQueue.markTileRendered(c),e._tileReplacementQueue.markTileRendered(u),n.allAreRenderable=i.renderable,n.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,n.notYetRenderableCount=i.renderable?0:1,i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,void(n.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(i));i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.REFINED;var y=e._tilesToRender.length,v=e._tileLoadQueueLow.length,C=e._tileLoadQueueMedium.length,T=e._tileLoadQueueHigh.length,S=e._tileToUpdateHeights.length;if(visitVisibleChildrenNearToFar$1(e,s,l,c,u,t,r,n),y!==e._tilesToRender.length){var A=n.allAreRenderable,x=n.anyWereRenderedLastFrame,E=n.notYetRenderableCount,b=!1;if(!A&&!x){for(var P=e._tilesToRender,D=y;D<P.length;++D)for(var w=P[D];void 0!==w&&w._lastSelectionResult!==TileSelectionResult.KICKED&&w!==i;)w._lastSelectionResult=TileSelectionResult.kick(w._lastSelectionResult),w=w.parent;e._tilesToRender.length=y,e._tileToUpdateHeights.length=S,addTileToRenderList$1(e,i),i._lastSelectionResult=TileSelectionResult.RENDERED;var M=h===TileSelectionResult.RENDERED;!M&&E>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=v,e._tileLoadQueueMedium.length=C,e._tileLoadQueueHigh.length=T,queueTileLoad$1(e,e._tileLoadQueueMedium,i,t),n.notYetRenderableCount=i.renderable?0:1,b=!0),n.allAreRenderable=i.renderable,n.anyWereRenderedLastFrame=M,M||e._tileToUpdateHeights.push(i),++a.tilesWaitingForChildren}e.preloadAncestors&&!b&&queueTileLoad$1(e,e._tileLoadQueueLow,i,t)}}else i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,addTileToRenderList$1(e,i),queueTileLoad$1(e,e._tileLoadQueueHigh,i,t),n.allAreRenderable=i.renderable,n.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,n.notYetRenderableCount=i.renderable?0:1}function visitVisibleChildrenNearToFar$1(e,t,i,r,n,a,o,s){var l=a.camera.positionCartographic,c=e._tileProvider,u=e._occluders,d=traversalQuadsByLevel$1[t.level],h=d.southwest,p=d.southeast,f=d.northwest,m=d.northeast;l.longitude<t.rectangle.east?l.latitude<t.rectangle.north?(visitIfVisible$1(e,t,c,a,u,o,h),visitIfVisible$1(e,i,c,a,u,o,p),visitIfVisible$1(e,r,c,a,u,o,f),visitIfVisible$1(e,n,c,a,u,o,m)):(visitIfVisible$1(e,r,c,a,u,o,f),visitIfVisible$1(e,t,c,a,u,o,h),visitIfVisible$1(e,n,c,a,u,o,m),visitIfVisible$1(e,i,c,a,u,o,p)):l.latitude<t.rectangle.north?(visitIfVisible$1(e,i,c,a,u,o,p),visitIfVisible$1(e,t,c,a,u,o,h),visitIfVisible$1(e,n,c,a,u,o,m),visitIfVisible$1(e,r,c,a,u,o,f)):(visitIfVisible$1(e,n,c,a,u,o,m),visitIfVisible$1(e,r,c,a,u,o,f),visitIfVisible$1(e,i,c,a,u,o,p),visitIfVisible$1(e,t,c,a,u,o,h)),d.combine(s)}function containsNeededPosition$1(e,t){var i=t.rectangle;return defined(e._cameraPositionCartographic)&&Rectangle.contains(i,e._cameraPositionCartographic)||defined(e._cameraReferenceFrameOriginCartographic)&&Rectangle.contains(i,e._cameraReferenceFrameOriginCartographic)}function visitIfVisible$1(e,t,i,r,n,a,o){if(i.computeTileVisibility(t,r,n)!==Visibility$1.NONE)return visitTile$1(e,r,t,a,o);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),o.allAreRenderable=!0,o.anyWereRenderedLastFrame=!1,o.notYetRenderableCount=0,containsNeededPosition$1(e,t)){defined(t.data)&&defined(t.data.vertexArray)||queueTileLoad$1(e,e._tileLoadQueueMedium,t,r);var s=e._lastSelectionFrameNumber,l=t._lastSelectionResultFrame===s?t._lastSelectionResult:TileSelectionResult.NONE;l!==TileSelectionResult.CULLED_BUT_NEEDED&&l!==TileSelectionResult.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=TileSelectionResult.CULLED_BUT_NEEDED}else e.preloadSiblings||0===t.level?(queueTileLoad$1(e,e._tileLoadQueueLow,t,r),t._lastSelectionResult=TileSelectionResult.CULLED):t._lastSelectionResult=TileSelectionResult.CULLED;t._lastSelectionResultFrame=r.frameNumber}function screenSpaceError$1(e,t,i){if(t.mode===SceneMode$1.SCENE2D||t.camera.frustum instanceof OrthographicFrustum||t.camera.frustum instanceof OrthographicOffCenterFrustum)return screenSpaceError2D$1(e,t,i);var r=e._tileProvider.getLevelMaximumGeometricError(i.level),n=i._distance,a=r*t.context.drawingBufferHeight/(n*t.camera.frustum.sseDenominator);return t.fog.enabled&&(a-=CesiumMath.fog(n,t.fog.density)*t.fog.sse),a/=t.pixelRatio}function screenSpaceError2D$1(e,t,i){var r=t.camera.frustum;defined(r._offCenterFrustum)&&(r=r._offCenterFrustum);var n=t.context,a=n.drawingBufferWidth,o=n.drawingBufferHeight,s=e._tileProvider.getLevelMaximumGeometricError(i.level)/(Math.max(r.top-r.bottom,r.right-r.left)/Math.max(a,o));return t.fog.enabled&&t.mode!==SceneMode$1.SCENE2D&&(s-=CesiumMath.fog(i._distance,t.fog.density)*t.fog.sse),s/=t.pixelRatio}function addTileToRenderList$1(e,t){e._tilesToRender.push(t)}function processTileLoadQueue$1(e,t){var i=e._tileLoadQueueHigh,r=e._tileLoadQueueMedium,n=e._tileLoadQueueLow;if(0!==i.length||0!==r.length||0!==n.length){e._tileReplacementQueue.trimTiles(e.tileCacheSize);var a=getTimestamp$1()+e._loadQueueTimeSlice,o=e._tileProvider,s=processSinglePriorityLoadQueue$1(e,t,o,a,i,!1);s=processSinglePriorityLoadQueue$1(e,t,o,a,r,s),processSinglePriorityLoadQueue$1(e,t,o,a,n,s)}}function sortByLoadPriority$1(e,t){return e._loadPriority-t._loadPriority}function processSinglePriorityLoadQueue$1(e,t,i,r,n,a){void 0!==i.computeTileLoadPriority&&n.sort(sortByLoadPriority$1);for(var o=0,s=n.length;o<s&&(getTimestamp$1()<r||!a);++o){var l=n[o];e._tileReplacementQueue.markTileRendered(l),i.loadTile(t,l),a=!0}return a}var scratchRay$1=new Ray,scratchCartographic$3=new Cartographic,scratchPosition$2=new Cartesian3,scratchArray$2=[];function updateHeights$1(e,t){if(e.tileProvider.ready){var i=scratchArray$2;i.length=0;for(var r,n=e._tileToUpdateHeights,a=getTimestamp$1()+e._updateHeightsTimeSlice,o=t.mode,s=t.mapProjection,l=e.tileProvider.tilingScheme.ellipsoid;n.length>0;){var c=n[0];if(defined(c.data)&&defined(c.data.mesh)){var u=c.customData,d=u.length,h=!1;for(r=e._lastTileIndex;r<d;++r){var p=u[r],f=c.data.terrainData,m=defined(f)&&f.wasCreatedByUpsampling();if(c.level>p.level&&!m){if(defined(p.positionOnEllipsoidSurface)||(p.positionOnEllipsoidSurface=Cartesian3.fromRadians(p.positionCartographic.longitude,p.positionCartographic.latitude,0,l)),o===SceneMode$1.SCENE3D){var g=l.geodeticSurfaceNormal(p.positionOnEllipsoidSurface,scratchRay$1.direction);if(!defined(l.getSurfaceNormalIntersectionWithZAxis(p.positionOnEllipsoidSurface,11500,scratchRay$1.origin))){var _;defined(c.data.tileBoundingRegion)&&(_=c.data.tileBoundingRegion.minimumHeight);var y=Math.min(defaultValue(_,0),-11500),v=Cartesian3.multiplyByScalar(g,Math.abs(y)+1,scratchPosition$2);Cartesian3.subtract(p.positionOnEllipsoidSurface,v,scratchRay$1.origin)}}else Cartographic.clone(p.positionCartographic,scratchCartographic$3),scratchCartographic$3.height=-11500,s.project(scratchCartographic$3,scratchPosition$2),Cartesian3.fromElements(scratchPosition$2.z,scratchPosition$2.x,scratchPosition$2.y,scratchPosition$2),Cartesian3.clone(scratchPosition$2,scratchRay$1.origin),Cartesian3.clone(Cartesian3.UNIT_X,scratchRay$1.direction);var C=c.data.pick(scratchRay$1,o,s,!1,scratchPosition$2);defined(C)&&(p.callback(C),p.level=c.level)}if(getTimestamp$1()>=a){h=!0;break}}if(h){e._lastTileIndex=r;break}e._lastTileIndex=0,n.shift()}else{var T=c._lastSelectionResultFrame===e._lastSelectionFrameNumber?c._lastSelectionResult:TileSelectionResult.NONE;T!==TileSelectionResult.RENDERED&&T!==TileSelectionResult.CULLED_BUT_NEEDED||i.push(c),n.shift(),e._lastTileIndex=0}}for(r=0;r<i.length;r++)n.push(i[r])}}function createRenderCommandsForSelectedTiles$1(e,t){for(var i=e._tileProvider,r=e._tilesToRender,n=0,a=r.length;n<a;++n){var o=r[n];i.showTileThisFrame(o,t)}}function Globe(e){var t=new EllipsoidTerrainProvider({ellipsoid:e=defaultValue(e,Ellipsoid.WGS84)}),i=new ImageryLayerCollection;this._ellipsoid=e,this._imageryLayerCollection=i,this._surfaceShaderSet=new GlobeSurfaceShaderSet,this._material=void 0,this._surface=new QuadtreePrimitive({tileProvider:new GlobeSurfaceTileProvider({terrainProvider:t,imageryLayers:i,surfaceShaderSet:this._surfaceShaderSet})}),this._terrainProvider=t,this._terrainProviderChanged=new Event,this._undergroundColor=Color.clone(Color.BLACK),this._undergroundColorAlphaByDistance=new NearFarScalar(e.maximumRadius/1e3,0,e.maximumRadius/5,1),this._translucency=new GlobeTranslucency,makeShadersDirty(this),this.show=!0,this._oceanNormalMapResourceDirty=!0,this._oceanNormalMapResource=new Resource({url:buildModuleUrl("Assets/Textures/waterNormalsSmall.jpg")}),this.maximumScreenSpaceError=2,this.tileCacheSize=100,this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this.fillHighlightColor=void 0,this.enableLighting=!1,this.lambertDiffuseMultiplier=.9,this.dynamicAtmosphereLighting=!0,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!0,this.lightingFadeOutDistance=1e7,this.lightingFadeInDistance=2e7,this.nightFadeOutDistance=1e7,this.nightFadeInDistance=5e7,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this.shadows=ShadowMode$1.RECEIVE_ONLY,this.atmosphereHueShift=0,this.atmosphereSaturationShift=0,this.atmosphereBrightnessShift=0,this.terrainExaggeration=1,this.terrainExaggerationRelativeHeight=0,this.showSkirts=!0,this.backFaceCulling=!0,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=void 0}function makeShadersDirty(e){var t=[],i=defined(e._material)&&(e._material.shaderSource.match(/slope/)||e._material.shaderSource.match("normalEC")),r=[GroundAtmosphere];!defined(e._material)||i&&!e._terrainProvider.requestVertexNormals?e._surface._tileProvider.materialUniformMap=void 0:(r.push(e._material.shaderSource),t.push("APPLY_MATERIAL"),e._surface._tileProvider.materialUniformMap=e._material._uniforms),r.push(GlobeFS),e._surfaceShaderSet.baseVertexShaderSource=new ShaderSource({sources:[GroundAtmosphere,GlobeVS],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new ShaderSource({sources:r,defines:t}),e._surfaceShaderSet.material=e._material}function createComparePickTileFunction(e){return function(t,i){return BoundingSphere.distanceSquaredTo(t.pickBoundingSphere,e)-BoundingSphere.distanceSquaredTo(i.pickBoundingSphere,e)}}Object.defineProperties(Globe.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},imageryLayers:{get:function(){return this._imageryLayerCollection}},imageryLayersUpdatedEvent:{get:function(){return this._surface.tileProvider.imageryLayersUpdatedEvent}},tilesLoaded:{get:function(){return!defined(this._surface)||this._surface.tileProvider.ready&&0===this._surface._tileLoadQueueHigh.length&&0===this._surface._tileLoadQueueMedium.length&&0===this._surface._tileLoadQueueLow.length}},baseColor:{get:function(){return this._surface.tileProvider.baseColor},set:function(e){this._surface.tileProvider.baseColor=e}},clippingPlanes:{get:function(){return this._surface.tileProvider.clippingPlanes},set:function(e){this._surface.tileProvider.clippingPlanes=e}},multiClippingPlanes:{get:function(){return this._surface.tileProvider._multiClippingPlanes},set:function(e){this._surface.tileProvider._multiClippingPlanes=e}},cartographicLimitRectangle:{get:function(){return this._surface.tileProvider.cartographicLimitRectangle},set:function(e){defined(e)||(e=Rectangle.clone(Rectangle.MAX_VALUE)),this._surface.tileProvider.cartographicLimitRectangle=e}},oceanNormalMapUrl:{get:function(){return this._oceanNormalMapResource.url},set:function(e){this._oceanNormalMapResource.url=e,this._oceanNormalMapResourceDirty=!0}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){e!==this._terrainProvider&&(this._terrainProvider=e,this._terrainProviderChanged.raiseEvent(e),defined(this._material)&&makeShadersDirty(this))}},terrainProviderChanged:{get:function(){return this._terrainProviderChanged}},tileLoadProgressEvent:{get:function(){return this._surface.tileLoadProgressEvent}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,makeShadersDirty(this))}},undergroundColor:{get:function(){return this._undergroundColor},set:function(e){this._undergroundColor=Color.clone(e,this._undergroundColor)}},undergroundColorAlphaByDistance:{get:function(){return this._undergroundColorAlphaByDistance},set:function(e){this._undergroundColorAlphaByDistance=NearFarScalar.clone(e,this._undergroundColorAlphaByDistance)}},translucency:{get:function(){return this._translucency}}});var scratchArray$1=[],scratchSphereIntersectionResult={start:0,stop:0};Globe.prototype.pickWorldCoordinates=function(e,t,i,r){i=defaultValue(i,!0);var n=t.mode,a=t.mapProjection,o=scratchArray$1;o.length=0;var s,l,c,u=this._surface._tilesToRender,d=u.length;for(l=0;l<d;++l){var h=(s=u[l]).data;if(defined(h)){var p=h.pickBoundingSphere;if(n!==SceneMode$1.SCENE3D)h.pickBoundingSphere=p=BoundingSphere.fromRectangleWithHeights2D(s.rectangle,a,h.tileBoundingRegion.minimumHeight,h.tileBoundingRegion.maximumHeight,p),Cartesian3.fromElements(p.center.z,p.center.x,p.center.y,p.center);else{if(!defined(h.renderedMesh))continue;BoundingSphere.clone(h.tileBoundingRegion.boundingSphere,p)}defined(IntersectionTests.raySphere(e,p,scratchSphereIntersectionResult))&&o.push(h)}}for(o.sort(createComparePickTileFunction(e.origin)),d=o.length,l=0;l<d&&!defined(c=o[l].pick(e,t.mode,t.mapProjection,i,r));++l);return c};var cartoScratch=new Cartographic;Globe.prototype.pick=function(e,t,i){if(defined(i=this.pickWorldCoordinates(e,t,!0,i))&&t.mode!==SceneMode$1.SCENE3D){i=Cartesian3.fromElements(i.y,i.z,i.x,i);var r=t.mapProjection.unproject(i,cartoScratch);i=t.globe.ellipsoid.cartographicToCartesian(r,i)}return i};var scratchGetHeightCartesian=new Cartesian3,scratchGetHeightIntersection=new Cartesian3,scratchGetHeightCartographic=new Cartographic,scratchGetHeightRay=new Ray;function tileIfContainsCartographic(e,t){return defined(e)&&Rectangle.contains(e.rectangle,t)?e:void 0}Globe.prototype.getHeight=function(e){var t=this._surface._levelZeroTiles;if(defined(t)){var i,r,n=t.length;for(r=0;r<n&&(i=t[r],!Rectangle.contains(i.rectangle,e));++r);if(!(r>=n)){for(var a=i;defined(i);)defined(i=tileIfContainsCartographic(i._southwestChild,e)||tileIfContainsCartographic(i._southeastChild,e)||tileIfContainsCartographic(i._northwestChild,e)||i._northeastChild)&&defined(i.data)&&defined(i.data.renderedMesh)&&(a=i);if(defined(i=a)&&defined(i.data)&&defined(i.data.renderedMesh)){var o=this._surface._tileProvider.tilingScheme.projection,s=this._surface._tileProvider.tilingScheme.ellipsoid,l=Cartesian3.fromRadians(e.longitude,e.latitude,0,s,scratchGetHeightCartesian),c=scratchGetHeightRay,u=s.geodeticSurfaceNormal(l,c.direction);if(!defined(s.getSurfaceNormalIntersectionWithZAxis(l,11500,c.origin))){var d;defined(i.data.tileBoundingRegion)&&(d=i.data.tileBoundingRegion.minimumHeight);var h=Math.min(defaultValue(d,0),-11500),p=Cartesian3.multiplyByScalar(u,Math.abs(h)+1,scratchGetHeightIntersection);Cartesian3.subtract(l,p,c.origin)}var f=i.data.pick(c,void 0,o,!1,scratchGetHeightIntersection);if(defined(f))return s.cartesianToCartographic(f,scratchGetHeightCartographic).height}}}},Globe.prototype.update=function(e){this.show&&e.passes.render&&this._surface.update(e)},Globe.prototype.beginFrame=function(e){var t=this._surface,i=t.tileProvider,r=this.terrainProvider,n=this.showWaterEffect&&r.ready&&r.hasWaterMask;if(n&&this._oceanNormalMapResourceDirty){this._oceanNormalMapResourceDirty=!1;var a=this._oceanNormalMapResource,o=a.url;if(defined(o)){var s=this;when(a.fetchImage(),(function(t){o===s._oceanNormalMapResource.url&&(s._oceanNormalMap=s._oceanNormalMap&&s._oceanNormalMap.destroy(),s._oceanNormalMap=new Texture({context:e.context,source:t}))}))}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}var l=e.passes,c=e.mode;l.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,i.terrainProvider=this.terrainProvider,i.lightingFadeOutDistance=this.lightingFadeOutDistance,i.lightingFadeInDistance=this.lightingFadeInDistance,i.nightFadeOutDistance=this.nightFadeOutDistance,i.nightFadeInDistance=this.nightFadeInDistance,i.zoomedOutOceanSpecularIntensity=c===SceneMode$1.SCENE3D?this._zoomedOutOceanSpecularIntensity:0,i.hasWaterMask=n,i.oceanNormalMap=this._oceanNormalMap,i.enableLighting=this.enableLighting,i.dynamicAtmosphereLighting=this.dynamicAtmosphereLighting,i.dynamicAtmosphereLightingFromSun=this.dynamicAtmosphereLightingFromSun,i.showGroundAtmosphere=this.showGroundAtmosphere,i.shadows=this.shadows,i.hueShift=this.atmosphereHueShift,i.saturationShift=this.atmosphereSaturationShift,i.brightnessShift=this.atmosphereBrightnessShift,i.fillHighlightColor=this.fillHighlightColor,i.showSkirts=this.showSkirts,i.backFaceCulling=this.backFaceCulling,i.undergroundColor=this._undergroundColor,i.undergroundColorAlphaByDistance=this._undergroundColorAlphaByDistance,i.lambertDiffuseMultiplier=this.lambertDiffuseMultiplier,t.beginFrame(e))},Globe.prototype.render=function(e){this.show&&(defined(this._material)&&this._material.update(e.context),this._surface.render(e))},Globe.prototype.endFrame=function(e){this.show&&e.passes.render&&this._surface.endFrame(e)},Globe.prototype.isDestroyed=function(){return!1},Globe.prototype.destroy=function(){return this._surfaceShaderSet=this._surfaceShaderSet&&this._surfaceShaderSet.destroy(),this._surface=this._surface&&this._surface.destroy(),this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy(),destroyObject(this)};var PassThrough="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(colorTexture, v_textureCoordinates);\n}\n",PassThroughDepth="uniform highp sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = czm_packDepth(texture2D(u_depthTexture, v_textureCoordinates).r);\n}\n";function GlobeDepth(){this._globeColorTexture=void 0,this._primitiveColorTexture=void 0,this._depthStencilTexture=void 0,this._globeDepthTexture=void 0,this._tempGlobeDepthTexture=void 0,this._tempCopyDepthTexture=void 0,this._globeColorFramebuffer=void 0,this._primitiveColorFramebuffer=void 0,this._copyDepthFramebuffer=void 0,this._tempCopyDepthFramebuffer=void 0,this._updateDepthFramebuffer=void 0,this._clearGlobeColorCommand=void 0,this._clearPrimitiveColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._tempCopyDepthCommand=void 0,this._updateDepthCommand=void 0,this._mergeColorCommand=void 0,this._viewport=new BoundingRectangle,this._rs=void 0,this._rsBlend=void 0,this._rsUpdate=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0,this._clearGlobeDepth=void 0}function destroyTextures$3(e){e._globeColorTexture=e._globeColorTexture&&!e._globeColorTexture.isDestroyed()&&e._globeColorTexture.destroy(),e._depthStencilTexture=e._depthStencilTexture&&!e._depthStencilTexture.isDestroyed()&&e._depthStencilTexture.destroy(),e._globeDepthTexture=e._globeDepthTexture&&!e._globeDepthTexture.isDestroyed()&&e._globeDepthTexture.destroy()}function destroyFramebuffers$3(e){e._globeColorFramebuffer=e._globeColorFramebuffer&&!e._globeColorFramebuffer.isDestroyed()&&e._globeColorFramebuffer.destroy(),e._copyDepthFramebuffer=e._copyDepthFramebuffer&&!e._copyDepthFramebuffer.isDestroyed()&&e._copyDepthFramebuffer.destroy()}function destroyUpdateDepthResources(e){e._tempCopyDepthFramebuffer=e._tempCopyDepthFramebuffer&&!e._tempCopyDepthFramebuffer.isDestroyed()&&e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer=e._updateDepthFramebuffer&&!e._updateDepthFramebuffer.isDestroyed()&&e._updateDepthFramebuffer.destroy(),e._tempGlobeDepthTexture=e._tempGlobeDepthTexture&&!e._tempGlobeDepthTexture.isDestroyed()&&e._tempGlobeDepthTexture.destroy()}function createUpdateDepthResources(e,t,i,r,n){e._tempGlobeDepthTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST}),e._tempCopyDepthFramebuffer=new Framebuffer({context:t,colorTextures:[e._tempGlobeDepthTexture],destroyAttachments:!1}),e._updateDepthFramebuffer=new Framebuffer({context:t,colorTextures:[e._globeDepthTexture],depthStencilTexture:n.framebuffer.depthStencilTexture,destroyAttachments:!1})}function createTextures$1(e,t,i,r,n){var a=n?t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;e._globeColorTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:a,sampler:Sampler.NEAREST}),e._depthStencilTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8}),e._globeDepthTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST})}function createFramebuffers$2(e,t){e._globeColorFramebuffer=new Framebuffer({context:t,colorTextures:[e._globeColorTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._copyDepthFramebuffer=new Framebuffer({context:t,colorTextures:[e._globeDepthTexture],destroyAttachments:!1})}function createPrimitiveFramebuffer(e,t,i,r,n){var a=n?t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;e._primitiveColorTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:a,sampler:Sampler.NEAREST}),e._primitiveColorFramebuffer=new Framebuffer({context:t,colorTextures:[e._primitiveColorTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1})}function destroyPrimitiveFramebuffer(e){e._primitiveColorTexture=e._primitiveColorTexture&&!e._primitiveColorTexture.isDestroyed()&&e._primitiveColorTexture.destroy(),e._primitiveColorFramebuffer=e._primitiveColorFramebuffer&&!e._primitiveColorFramebuffer.isDestroyed()&&e._primitiveColorFramebuffer.destroy()}function updateFramebuffers$4(e,t,i,r,n,a){var o=e._globeColorTexture,s=!defined(o)||o.width!==i||o.height!==r||n!==e._useHdr;s&&(destroyTextures$3(e),destroyFramebuffers$3(e),createTextures$1(e,t,i,r,n),createFramebuffers$2(e,t)),(s||a!==e._clearGlobeDepth)&&(destroyPrimitiveFramebuffer(e),a&&createPrimitiveFramebuffer(e,t,i,r,n))}function updateCopyCommands$1(e,t,i,r,n){e._viewport.width=i,e._viewport.height=r;var a=!BoundingRectangle.equals(e._viewport,n.viewport),o=a!==e._useScissorTest;e._useScissorTest=a,BoundingRectangle.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=BoundingRectangle.clone(n.viewport,e._scissorRectangle),o=!0),defined(e._rs)&&BoundingRectangle.equals(e._viewport,e._rs.viewport)&&!o||(e._rs=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:BlendingState$1.ALPHA_BLEND}),e._rsUpdate=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.NEVER,reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK}})),defined(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(PassThroughDepth,{uniformMap:{u_depthTexture:function(){return e._depthStencilTexture}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer,e._copyDepthCommand.renderState=e._rs,defined(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return e._globeColorTexture}},owner:e})),e._copyColorCommand.renderState=e._rs,defined(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(PassThroughDepth,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer,e._tempCopyDepthCommand.renderState=e._rs,defined(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return e._tempGlobeDepthTexture}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer,e._updateDepthCommand.renderState=e._rsUpdate,defined(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new ClearCommand({color:new Color(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e._globeColorFramebuffer,defined(e._clearPrimitiveColorCommand)||(e._clearPrimitiveColorCommand=new ClearCommand({color:new Color(0,0,0,0),stencil:0,owner:e})),e._clearPrimitiveColorCommand.framebuffer=e._primitiveColorFramebuffer,defined(e._mergeColorCommand)||(e._mergeColorCommand=t.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return e._primitiveColorTexture}},owner:e})),e._mergeColorCommand.framebuffer=e._globeColorFramebuffer,e._mergeColorCommand.renderState=e._rsBlend}function GlobeTranslucencyFramebuffer(){this._colorTexture=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._framebuffer=void 0,this._packedDepthTexture=void 0,this._packedDepthFramebuffer=void 0,this._renderState=void 0,this._packedDepthCommand=void 0,this._clearCommand=void 0,this._viewport=new BoundingRectangle,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0}function destroyResources$3(e){e._colorTexture=e._colorTexture&&!e._colorTexture.isDestroyed()&&e._colorTexture.destroy(),e._depthStencilTexture=e._depthStencilTexture&&!e._depthStencilTexture.isDestroyed()&&e._depthStencilTexture.destroy(),e._depthStencilRenderbuffer=e._depthStencilRenderbuffer&&!e._depthStencilRenderbuffer.isDestroyed()&&e._depthStencilRenderbuffer.destroy(),e._framebuffer=e._framebuffer&&!e._framebuffer.isDestroyed()&&e._framebuffer.destroy(),e._packedDepthTexture=e._packedDepthTexture&&!e._packedDepthTexture.isDestroyed()&&e._packedDepthTexture.destroy(),e._packedDepthFramebuffer=e._packedDepthFramebuffer&&!e._packedDepthFramebuffer.isDestroyed()&&e._packedDepthFramebuffer.destroy()}function createResources$1(e,t,i,r,n){var a=n?t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;e._colorTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:a,sampler:Sampler.NEAREST}),t.depthTexture?e._depthStencilTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8}):e._depthStencilRenderbuffer=new Renderbuffer({context:t,width:i,height:r,format:RenderbufferFormat$1.DEPTH_STENCIL}),e._framebuffer=new Framebuffer({context:t,colorTextures:[e._colorTexture],depthStencilTexture:e._depthStencilTexture,depthStencilRenderbuffer:e._depthStencilRenderbuffer,destroyAttachments:!1}),e._packedDepthTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST}),e._packedDepthFramebuffer=new Framebuffer({context:t,colorTextures:[e._packedDepthTexture],destroyAttachments:!1})}function updateResources$1(e,t,i,r,n){var a=e._colorTexture;(!defined(a)||a.width!==i||a.height!==r||n!==e._useHdr)&&(destroyResources$3(e),createResources$1(e,t,i,r,n))}function updateCommands(e,t,i,r,n){e._viewport.width=i,e._viewport.height=r;var a=!BoundingRectangle.equals(e._viewport,n.viewport),o=a!==e._useScissorTest;e._useScissorTest=a,BoundingRectangle.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=BoundingRectangle.clone(n.viewport,e._scissorRectangle),o=!0),defined(e._renderState)&&BoundingRectangle.equals(e._viewport,e._renderState.viewport)&&!o||(e._renderState=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),defined(e._packedDepthCommand)||(e._packedDepthCommand=t.createViewportQuadCommand(PassThroughDepth,{uniformMap:{u_depthTexture:function(){return e._depthStencilTexture}},owner:e})),defined(e._clearCommand)||(e._clearCommand=new ClearCommand({color:new Color(0,0,0,0),depth:1,stencil:0,owner:e})),e._packedDepthCommand.framebuffer=e._packedDepthFramebuffer,e._packedDepthCommand.renderState=e._renderState,e._clearCommand.framebuffer=e._framebuffer,e._clearCommand.renderState=e._renderState}Object.defineProperties(GlobeDepth.prototype,{framebuffer:{get:function(){return this._globeColorFramebuffer}},primitiveFramebuffer:{get:function(){return this._primitiveColorFramebuffer}}}),GlobeDepth.prototype.update=function(e,t,i,r,n){var a=i.width,o=i.height;updateFramebuffers$4(this,e,a,o,r,n),updateCopyCommands$1(this,e,a,o,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=r,this._clearGlobeDepth=n},GlobeDepth.prototype.executeCopyDepth=function(e,t){defined(this._copyDepthCommand)&&(this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._globeDepthTexture)},GlobeDepth.prototype.executeUpdateDepth=function(e,t,i){var r=t.framebuffer.depthStencilTexture;if(i||r!==this._depthStencilTexture){if(defined(this._updateDepthCommand)){if(!defined(this._updateDepthFramebuffer)||this._updateDepthFramebuffer.depthStencilTexture!==r||this._updateDepthFramebuffer.getColorTexture(0)!==this._globeDepthTexture){var n=this._globeDepthTexture.width,a=this._globeDepthTexture.height;destroyUpdateDepthResources(this),createUpdateDepthResources(this,e,n,a,t),updateCopyCommands$1(this,e,n,a,t)}this._tempCopyDepthTexture=r,this._tempCopyDepthCommand.execute(e,t),this._updateDepthCommand.execute(e,t)}}else defined(this._copyDepthCommand)&&this._copyDepthCommand.execute(e,t)},GlobeDepth.prototype.executeCopyColor=function(e,t){defined(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)},GlobeDepth.prototype.executeMergeColor=function(e,t){defined(this._mergeColorCommand)&&this._mergeColorCommand.execute(e,t)},GlobeDepth.prototype.clear=function(e,t,i){var r=this._clearGlobeColorCommand;defined(r)&&(Color.clone(i,r.color),r.execute(e,t)),defined(r=this._clearPrimitiveColorCommand)&&defined(this._primitiveColorFramebuffer)&&r.execute(e,t)},GlobeDepth.prototype.isDestroyed=function(){return!1},GlobeDepth.prototype.destroy=function(){return destroyTextures$3(this),destroyFramebuffers$3(this),destroyPrimitiveFramebuffer(this),destroyUpdateDepthResources(this),defined(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),defined(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy()),defined(this._tempCopyDepthCommand)&&(this._tempCopyDepthCommand.shaderProgram=this._tempCopyDepthCommand.shaderProgram.destroy()),defined(this._updateDepthCommand)&&(this._updateDepthCommand.shaderProgram=this._updateDepthCommand.shaderProgram.destroy()),defined(this._mergeColorCommand)&&(this._mergeColorCommand.shaderProgram=this._mergeColorCommand.shaderProgram.destroy()),destroyObject(this)},Object.defineProperties(GlobeTranslucencyFramebuffer.prototype,{classificationTexture:{get:function(){return this._colorTexture}},classificationFramebuffer:{get:function(){return this._framebuffer}}}),GlobeTranslucencyFramebuffer.prototype.updateAndClear=function(e,t,i,r){var n=t.width,a=t.height;updateResources$1(this,i,n,a,e),updateCommands(this,i,n,a,r),this._useHdr=e},GlobeTranslucencyFramebuffer.prototype.clearClassification=function(e,t){this._clearCommand.execute(e,t)},GlobeTranslucencyFramebuffer.prototype.packDepth=function(e,t){return this._packedDepthCommand.execute(e,t),this._packedDepthTexture},GlobeTranslucencyFramebuffer.prototype.isDestroyed=function(){return!1},GlobeTranslucencyFramebuffer.prototype.destroy=function(){return destroyResources$3(this),destroyObject(this)};var DerivedCommandType={OPAQUE_FRONT_FACE:0,OPAQUE_BACK_FACE:1,DEPTH_ONLY_FRONT_FACE:2,DEPTH_ONLY_BACK_FACE:3,DEPTH_ONLY_FRONT_AND_BACK_FACE:4,TRANSLUCENT_FRONT_FACE:5,TRANSLUCENT_BACK_FACE:6,TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:7,TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:8,PICK_FRONT_FACE:9,PICK_BACK_FACE:10,DERIVED_COMMANDS_MAXIMUM_LENGTH:11},derivedCommandsMaximumLength=DerivedCommandType.DERIVED_COMMANDS_MAXIMUM_LENGTH,DerivedCommandNames=["opaqueFrontFaceCommand","opaqueBackFaceCommand","depthOnlyFrontFaceCommand","depthOnlyBackFaceCommand","depthOnlyFrontAndBackFaceCommand","translucentFrontFaceCommand","translucentBackFaceCommand","translucentFrontFaceManualDepthTestCommand","translucentBackFaceManualDepthTestCommand","pickFrontFaceCommand","pickBackFaceCommand"];function GlobeTranslucencyState(){this._frontFaceAlphaByDistance=new NearFarScalar(0,1,0,1),this._backFaceAlphaByDistance=new NearFarScalar(0,1,0,1),this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._requiresManualDepthTest=!1,this._sunVisibleThroughGlobe=!1,this._environmentVisible=!1,this._useDepthPlane=!1,this._numberOfTextureUniforms=0,this._globeTranslucencyFramebuffer=void 0,this._rectangle=Rectangle.clone(Rectangle.MAX_VALUE),this._derivedCommandKey=0,this._derivedCommandsDirty=!1,this._derivedCommandPacks=void 0,this._derivedCommandTypes=new Array(derivedCommandsMaximumLength),this._derivedBlendCommandTypes=new Array(derivedCommandsMaximumLength),this._derivedPickCommandTypes=new Array(derivedCommandsMaximumLength),this._derivedCommandTypesToUpdate=new Array(derivedCommandsMaximumLength),this._derivedCommandsLength=0,this._derivedBlendCommandsLength=0,this._derivedPickCommandsLength=0,this._derivedCommandsToUpdateLength=0}function updateAlphaByDistance(e,t,i,r){return e?defined(i)?(NearFarScalar.clone(i,r),r.nearValue*=t,r.farValue*=t,r):(r.nearValue=t,r.farValue=t,r):(r.nearValue=1,r.farValue=1,r)}function isFaceTranslucent(e,t,i){return e&&(i.baseColor.alpha<1||t.nearValue<1||t.farValue<1)}function isSunVisibleThroughGlobe(e,t){var i=e._frontFaceTranslucent,r=e._backFaceTranslucent;return i&&(t.cameraUnderground||r)}function isEnvironmentVisible(e,t){return!t.cameraUnderground||e._frontFaceTranslucent}function useDepthPlane(e,t){return!t.cameraUnderground&&!e._frontFaceTranslucent}function requiresManualDepthTest(e,t,i){return e._frontFaceTranslucent&&!e._backFaceTranslucent&&!i.depthTestAgainstTerrain&&t.mode!==SceneMode$1.SCENE2D&&t.context.depthTexture}function getNumberOfTextureUniforms(e){var t=0;return e._frontFaceTranslucent&&++t,e._requiresManualDepthTest&&++t,t}function gatherDerivedCommandRequirements(e,t){var i;e._derivedCommandsLength=getDerivedCommandTypes(e,t,!1,!1,e._derivedCommandTypes),e._derivedBlendCommandsLength=getDerivedCommandTypes(e,t,!0,!1,e._derivedBlendCommandTypes),e._derivedPickCommandsLength=getDerivedCommandTypes(e,t,!1,!0,e._derivedPickCommandTypes);var r=0;for(i=0;i<e._derivedCommandsLength;++i)r|=1<<e._derivedCommandTypes[i];for(i=0;i<e._derivedBlendCommandsLength;++i)r|=1<<e._derivedBlendCommandTypes[i];for(i=0;i<e._derivedPickCommandsLength;++i)r|=1<<e._derivedPickCommandTypes[i];var n=0;for(i=0;i<derivedCommandsMaximumLength;++i)(r&1<<i)>0&&(e._derivedCommandTypesToUpdate[n++]=i);e._derivedCommandsToUpdateLength=n;var a=r!==e._derivedCommandKey;e._derivedCommandKey=r,e._derivedCommandsDirty=a,!defined(e._derivedCommandPacks)&&e._frontFaceTranslucent&&(e._derivedCommandPacks=createDerivedCommandPacks())}function getDerivedCommandTypes(e,t,i,r,n){var a=0,o=e._frontFaceTranslucent,s=e._backFaceTranslucent;if(!o)return a;var l=t.cameraUnderground,c=e._requiresManualDepthTest,u=r?DerivedCommandType.PICK_FRONT_FACE:c?DerivedCommandType.TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:DerivedCommandType.TRANSLUCENT_FRONT_FACE,d=r?DerivedCommandType.PICK_BACK_FACE:c?DerivedCommandType.TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:DerivedCommandType.TRANSLUCENT_BACK_FACE;return t.mode===SceneMode$1.SCENE2D?(n[a++]=DerivedCommandType.DEPTH_ONLY_FRONT_FACE,n[a++]=u,a):(s?(i||(n[a++]=DerivedCommandType.DEPTH_ONLY_FRONT_AND_BACK_FACE),l?(n[a++]=u,n[a++]=d):(n[a++]=d,n[a++]=u)):l?(i||(n[a++]=DerivedCommandType.DEPTH_ONLY_BACK_FACE),n[a++]=DerivedCommandType.OPAQUE_FRONT_FACE,n[a++]=d):(i||(n[a++]=DerivedCommandType.DEPTH_ONLY_FRONT_FACE),n[a++]=DerivedCommandType.OPAQUE_BACK_FACE,n[a++]=u),a)}function removeDefine(e,t){var i=e.indexOf(t);i>-1&&e.splice(i,1)}function hasDefine(e,t){return e.indexOf(t)>-1}function getOpaqueFrontFaceShaderProgram(e,t){removeDefine(e.defines,"TRANSLUCENT"),removeDefine(t.defines,"TRANSLUCENT")}function getOpaqueBackFaceShaderProgram(e,t){removeDefine(e.defines,"GROUND_ATMOSPHERE"),removeDefine(t.defines,"GROUND_ATMOSPHERE"),removeDefine(e.defines,"FOG"),removeDefine(t.defines,"FOG"),removeDefine(e.defines,"TRANSLUCENT"),removeDefine(t.defines,"TRANSLUCENT")}function getDepthOnlyShaderProgram(e,t){if(!hasDefine(t.defines,"TILE_LIMIT_RECTANGLE")&&!hasDefine(t.defines,"ENABLE_CLIPPING_PLANES")){t.sources=["void main() \n{ \n gl_FragColor = vec4(1.0); \n} \n"]}}function getTranslucentShaderProgram$1(e,t){for(var i=t.sources,r=i.length,n=0;n<r;++n)i[n]=ShaderSource.replaceMain(i[n],"czm_globe_translucency_main");i.push("\n\nuniform sampler2D u_classificationTexture; \nvoid main() \n{ \n vec2 st = gl_FragCoord.xy / czm_viewport.zw; \n#ifdef MANUAL_DEPTH_TEST \n float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st)); \n if (logDepthOrDepth != 0.0) \n { \n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth); \n float depthEC = eyeCoordinate.z / eyeCoordinate.w; \n if (v_positionEC.z < depthEC) \n { \n discard; \n } \n } \n#endif \n czm_globe_translucency_main(); \n vec4 classificationColor = texture2D(u_classificationTexture, st); \n if (classificationColor.a > 0.0) \n { \n // Reverse premultiplication process to get the correct composited result of the classification primitives \n classificationColor.rgb /= classificationColor.a; \n } \n gl_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + gl_FragColor * (1.0 - classificationColor.a); \n} \n")}function getTranslucentBackFaceShaderProgram(e,t){getTranslucentShaderProgram$1(e,t),removeDefine(e.defines,"GROUND_ATMOSPHERE"),removeDefine(t.defines,"GROUND_ATMOSPHERE"),removeDefine(e.defines,"FOG"),removeDefine(t.defines,"FOG")}function getTranslucentFrontFaceManualDepthTestShaderProgram(e,t){getTranslucentShaderProgram$1(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function getTranslucentBackFaceManualDepthTestShaderProgram(e,t){getTranslucentBackFaceShaderProgram(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function getPickShaderProgram(e,t){t.sources=["uniform sampler2D u_classificationTexture; \nvoid main() \n{ \n vec2 st = gl_FragCoord.xy / czm_viewport.zw; \n vec4 pickColor = texture2D(u_classificationTexture, st); \n if (pickColor == vec4(0.0)) \n { \n discard; \n } \n gl_FragColor = pickColor; \n} \n"]}function getDerivedShaderProgram(e,t,i,r,n,a){if(!defined(n))return t;if(!r&&defined(i))return i;var o=e.shaderCache.getDerivedShaderProgram(t,a);if(!defined(o)){var s=t._attributeLocations,l=t.vertexShaderSource.clone(),c=t.fragmentShaderSource.clone();l.defines=defined(l.defines)?l.defines.slice(0):[],c.defines=defined(c.defines)?c.defines.slice(0):[],n(l,c),o=e.shaderCache.createDerivedShaderProgram(t,a,{vertexShaderSource:l,fragmentShaderSource:c,attributeLocations:s})}return o}function getOpaqueFrontFaceRenderState(e){e.cull.face=CullFace$1.BACK,e.cull.enabled=!0}function getOpaqueBackFaceRenderState(e){e.cull.face=CullFace$1.FRONT,e.cull.enabled=!0}function getDepthOnlyFrontFaceRenderState(e){e.cull.face=CullFace$1.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function getDepthOnlyBackFaceRenderState(e){e.cull.face=CullFace$1.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function getDepthOnlyFrontAndBackFaceRenderState(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function getTranslucentFrontFaceRenderState(e){e.cull.face=CullFace$1.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=BlendingState$1.ALPHA_BLEND}function getTranslucentBackFaceRenderState(e){e.cull.face=CullFace$1.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=BlendingState$1.ALPHA_BLEND}function getPickFrontFaceRenderState(e){e.cull.face=CullFace$1.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function getPickBackFaceRenderState(e){e.cull.face=CullFace$1.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function getDerivedRenderState(e,t,i,r,n){if(!defined(r))return e;if(!i&&defined(t))return t;var a=n[e.id];if(!defined(a)){var o=RenderState.getState(e);r(o),a=RenderState.fromCache(o),n[e.id]=a}return a}function getTranslucencyUniformMap(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function getDerivedUniformMap(e,t,i,r,n){return defined(n)?!r&&defined(i)?i:combine$2(t,n(e),!1):t}function DerivedCommandPack(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function createDerivedCommandPacks(){return[new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getOpaqueFrontFaceShaderProgram,getRenderStateFunction:getOpaqueFrontFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getOpaqueBackFaceShaderProgram,getRenderStateFunction:getOpaqueBackFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getDepthOnlyShaderProgram,getRenderStateFunction:getDepthOnlyFrontFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getDepthOnlyShaderProgram,getRenderStateFunction:getDepthOnlyBackFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getDepthOnlyShaderProgram,getRenderStateFunction:getDepthOnlyFrontAndBackFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:getTranslucentShaderProgram$1,getRenderStateFunction:getTranslucentFrontFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:getTranslucentBackFaceShaderProgram,getRenderStateFunction:getTranslucentBackFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:getTranslucentFrontFaceManualDepthTestShaderProgram,getRenderStateFunction:getTranslucentFrontFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:getTranslucentBackFaceManualDepthTestShaderProgram,getRenderStateFunction:getTranslucentBackFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:getPickShaderProgram,getRenderStateFunction:getPickFrontFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:getPickShaderProgram,getRenderStateFunction:getPickBackFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap})]}Object.defineProperties(GlobeTranslucencyState.prototype,{frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance}},translucent:{get:function(){return this._frontFaceTranslucent}},sunVisibleThroughGlobe:{get:function(){return this._sunVisibleThroughGlobe}},environmentVisible:{get:function(){return this._environmentVisible}},useDepthPlane:{get:function(){return this._useDepthPlane}},numberOfTextureUniforms:{get:function(){return this._numberOfTextureUniforms}},rectangle:{get:function(){return this._rectangle}}}),GlobeTranslucencyState.prototype.update=function(e){var t=e.globe;if(!defined(t)||!t.show)return this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._sunVisibleThroughGlobe=!0,this._environmentVisible=!0,void(this._useDepthPlane=!1);this._frontFaceAlphaByDistance=updateAlphaByDistance(t.translucency.enabled,t.translucency.frontFaceAlpha,t.translucency.frontFaceAlphaByDistance,this._frontFaceAlphaByDistance),this._backFaceAlphaByDistance=updateAlphaByDistance(t.translucency.enabled,t.translucency.backFaceAlpha,t.translucency.backFaceAlphaByDistance,this._backFaceAlphaByDistance),this._frontFaceTranslucent=isFaceTranslucent(t.translucency.enabled,this._frontFaceAlphaByDistance,t),this._backFaceTranslucent=isFaceTranslucent(t.translucency.enabled,this._backFaceAlphaByDistance,t),this._requiresManualDepthTest=requiresManualDepthTest(this,e,t),this._sunVisibleThroughGlobe=isSunVisibleThroughGlobe(this,e),this._environmentVisible=isEnvironmentVisible(this,e),this._useDepthPlane=useDepthPlane(this,e),this._numberOfTextureUniforms=getNumberOfTextureUniforms(this),this._rectangle=Rectangle.clone(t.translucency.rectangle,this._rectangle),gatherDerivedCommandRequirements(this,e)};var derivedCommandNames=new Array(derivedCommandsMaximumLength),derivedCommandPacks=new Array(derivedCommandsMaximumLength);function updateDerivedCommands$1(e,t,i,r,n,a,o){var s=t.derivedCommands.globeTranslucency,l=e._derivedCommandsDirty;if(t.dirty||!defined(s)||l){t.dirty=!1,defined(s)||(s={},t.derivedCommands.globeTranslucency=s);var c=o.frameNumber,u=defaultValue(s.uniformMapDirtyFrame,0),d=defaultValue(s.shaderProgramDirtyFrame,0),h=defaultValue(s.renderStateDirtyFrame,0),p=s.uniformMap!==t.uniformMap,f=s.shaderProgramId!==t.shaderProgram.id,m=s.renderStateId!==t.renderState.id;p&&(s.uniformMapDirtyFrame=c),f&&(s.shaderProgramDirtyFrame=c),m&&(s.renderStateDirtyFrame=c),s.uniformMap=t.uniformMap,s.shaderProgramId=t.shaderProgram.id,s.renderStateId=t.renderState.id;for(var g=0;g<i;++g){var _,y,v,C=a[g],T=r[g],S=n[g],A=s[S];defined(A)?(_=A.uniformMap,y=A.shaderProgram,v=A.renderState):(_=void 0,y=void 0,v=void 0),A=DrawCommand.shallowClone(t,A),s[S]=A;var x=defaultValue(A.derivedCommands.uniformMapDirtyFrame,0),E=defaultValue(A.derivedCommands.shaderProgramDirtyFrame,0),b=defaultValue(A.derivedCommands.renderStateDirtyFrame,0),P=p||x<u,D=f||E<d,w=m||b<h;P&&(A.derivedCommands.uniformMapDirtyFrame=c),D&&(A.derivedCommands.shaderProgramDirtyFrame=c),w&&(A.derivedCommands.renderStateDirtyFrame=c),A.derivedCommands.type=T,A.pass=C.pass,A.pickOnly=C.pickOnly,A.uniformMap=getDerivedUniformMap(e,t.uniformMap,_,P,C.getUniformMapFunction),A.shaderProgram=getDerivedShaderProgram(o.context,t.shaderProgram,y,D,C.getShaderProgramFunction,S),A.renderState=getDerivedRenderState(t.renderState,v,w,C.getRenderStateFunction,C.renderStateCache)}}}function executeCommandsMatchingType(e,t,i,r,n,a,o){for(var s=0;s<t;++s){var l=e[s],c=l.derivedCommands.type;(!defined(o)||o.indexOf(c)>-1)&&i(l,r,n,a)}}function executeCommands$1(e,t,i,r,n,a){for(var o=0;o<t;++o)i(e[o],r,n,a)}GlobeTranslucencyState.prototype.updateDerivedCommands=function(e,t){var i=this._derivedCommandTypesToUpdate,r=this._derivedCommandsToUpdateLength;if(0!==r){for(var n=0;n<r;++n)derivedCommandPacks[n]=this._derivedCommandPacks[i[n]],derivedCommandNames[n]=DerivedCommandNames[i[n]];updateDerivedCommands$1(this,e,r,i,derivedCommandNames,derivedCommandPacks,t)}},GlobeTranslucencyState.prototype.pushDerivedCommands=function(e,t,i){var r=i.passes.pick;if(!r||!t){var n=this._derivedCommandTypes,a=this._derivedCommandsLength;if(r?(n=this._derivedPickCommandTypes,a=this._derivedPickCommandsLength):t&&(n=this._derivedBlendCommandTypes,a=this._derivedBlendCommandsLength),0!==a)for(var o=e.derivedCommands.globeTranslucency,s=0;s<a;++s){var l=DerivedCommandNames[n[s]];i.commandList.push(o[l])}else i.commandList.push(e)}};var opaqueTypes=[DerivedCommandType.OPAQUE_FRONT_FACE,DerivedCommandType.OPAQUE_BACK_FACE],depthOnlyTypes=[DerivedCommandType.DEPTH_ONLY_FRONT_FACE,DerivedCommandType.DEPTH_ONLY_BACK_FACE,DerivedCommandType.DEPTH_ONLY_FRONT_AND_BACK_FACE];function GoogleEarthEnterpriseDiscardPolicy(){this._image=new Image}function GoogleEarthEnterpriseImageryProvider(e){var t;if(e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,defined(e.metadata))t=e.metadata;else{var i=Resource.createIfNeeded(e.url);t=new GoogleEarthEnterpriseMetadata(i)}this._metadata=t,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Rectangle(-CesiumMath.PI,-CesiumMath.PI,CesiumMath.PI,CesiumMath.PI),ellipsoid:e.ellipsoid});var r=e.credit;"string"==typeof r&&(r=new Credit(r)),this._credit=r,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=23,defined(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new GoogleEarthEnterpriseDiscardPolicy),this._errorEvent=new Event,this._ready=!1;var n,a=this;this._readyPromise=t.readyPromise.then((function(e){if(!t.imageryPresent){var i=new RuntimeError("The server "+t.url+" doesn't have imagery");return n=TileProviderError.handleError(n,a,a._errorEvent,i.message,void 0,void 0,void 0,i),when.reject(i)}return TileProviderError.handleSuccess(n),a._ready=e,e})).otherwise((function(e){return n=TileProviderError.handleError(n,a,a._errorEvent,e.message,void 0,void 0,void 0,e),when.reject(e)}))}function buildImageResource$1(e,t,i,r,n,a){var o=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(i,r,n),s=t.imageryVersion;return s=defined(s)&&s>0?s:1,e._metadata.resource.getDerivedResource({url:"flatfile?f1-0"+o+"-i."+s.toString(),request:a})}function getImageType(e){var t="JFIF";if(e[6]===t.charCodeAt(0)&&e[7]===t.charCodeAt(1)&&e[8]===t.charCodeAt(2)&&e[9]===t.charCodeAt(3))return"image/jpeg";var i="PNG";return e[1]===i.charCodeAt(0)&&e[2]===i.charCodeAt(1)&&e[3]===i.charCodeAt(2)?"image/png":void 0}function decodeEarthImageryPacket(e){for(var t=protobuf$1.Reader.create(e),i=t.len,r={};t.pos<i;){var n=t.uint32();switch(n>>>3){case 1:r.imageType=t.uint32();break;case 2:r.imageData=t.bytes();break;case 3:r.alphaType=t.uint32();break;case 4:r.imageAlpha=t.bytes();break;case 5:var a=r.copyrightIds;if(defined(a)||(a=r.copyrightIds=[]),2==(7&n))for(var o=t.uint32()+t.pos;t.pos<o;)a.push(t.uint32());else a.push(t.uint32());break;default:t.skipType(7&n)}}var s=r.imageType;if(defined(s))switch(s){case 0:r.imageType="image/jpeg";break;case 4:r.imageType="image/png";break;default:throw new RuntimeError("GoogleEarthEnterpriseImageryProvider: Unsupported image type.")}var l=r.alphaType;return defined(l)&&0!==l&&(console.log("GoogleEarthEnterpriseImageryProvider: External alpha not supported."),delete r.alphaType,delete r.imageAlpha),r}GlobeTranslucencyState.prototype.executeGlobeCommands=function(e,t,i,r,n){var a=r.context,o=e.commands[Pass$1.GLOBE],s=e.indices[Pass$1.GLOBE];0!==s&&(this._globeTranslucencyFramebuffer=i,i.clearClassification(a,n),executeCommandsMatchingType(o,s,t,r,a,n,opaqueTypes))},GlobeTranslucencyState.prototype.executeGlobeClassificationCommands=function(e,t,i,r,n){var a=r.context,o=e.commands[Pass$1.GLOBE],s=e.indices[Pass$1.GLOBE],l=e.commands[Pass$1.TERRAIN_CLASSIFICATION],c=e.indices[Pass$1.TERRAIN_CLASSIFICATION];if(0!==s&&0!==c){var u=this._frontFaceTranslucent,d=this._backFaceTranslucent;if(u&&d||executeCommands$1(l,c,t,r,a,n),u||d){this._globeTranslucencyFramebuffer=i;var h=a.uniformState.globeDepthTexture,p=n.framebuffer;if(n.framebuffer=i.classificationFramebuffer,executeCommandsMatchingType(o,s,t,r,a,n,depthOnlyTypes),a.depthTexture){var f=i.packDepth(a,n);a.uniformState.globeDepthTexture=f}executeCommands$1(l,c,t,r,a,n),a.uniformState.globeDepthTexture=h,n.framebuffer=p}}},GoogleEarthEnterpriseDiscardPolicy.prototype.isReady=function(){return!0},GoogleEarthEnterpriseDiscardPolicy.prototype.shouldDiscardImage=function(e){return e===this._image},Object.defineProperties(GoogleEarthEnterpriseImageryProvider.prototype,{url:{get:function(){return this._metadata.url}},proxy:{get:function(){return this._metadata.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}}),GoogleEarthEnterpriseImageryProvider.prototype.getTileCredits=function(e,t,i){var r=this._metadata,n=r.getTileInformation(e,t,i);if(defined(n)){var a=r.providers[n.imageryProvider];if(defined(a))return[a]}},GoogleEarthEnterpriseImageryProvider.prototype.requestImage=function(e,t,i,r){var n=this._tileDiscardPolicy._image,a=this._metadata,o=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i),s=a.getTileInformation(e,t,i);if(!defined(s)){if(a.isValid(o)){var l=new Request({throttle:r.throttle,throttleByServer:r.throttleByServer,type:r.type,priorityFunction:r.priorityFunction});return void a.populateSubtree(e,t,i,l)}return n}if(!s.hasImagery())return n;var c=buildImageResource$1(this,s,e,t,i,r).fetchArrayBuffer();return defined(c)?c.then((function(e){decodeGoogleEarthEnterpriseData(a.key,e);var t,i=new Uint8Array(e),r=a.protoImagery;if(defined(r)&&r||(t=getImageType(i)),!defined(t)&&(!defined(r)||r)){var o=decodeEarthImageryPacket(i);t=o.imageType,i=o.imageData}return defined(t)&&defined(i)?loadImageFromTypedArray({uint8Array:i,format:t,flipY:!0}):n})):void 0},GoogleEarthEnterpriseImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){};var defaultColor=new Color(1,1,1,.4),defaultGlowColor=new Color(0,1,0,.05),defaultBackgroundColor=new Color(0,.5,0,.2);function GridImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._tilingScheme=defined(e.tilingScheme)?e.tilingScheme:new GeographicTilingScheme({ellipsoid:e.ellipsoid}),this._cells=defaultValue(e.cells,8),this._color=defaultValue(e.color,defaultColor),this._glowColor=defaultValue(e.glowColor,defaultGlowColor),this._glowWidth=defaultValue(e.glowWidth,6),this._backgroundColor=defaultValue(e.backgroundColor,defaultBackgroundColor),this._errorEvent=new Event,this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._canvasSize=defaultValue(e.canvasSize,256),this._canvas=this._createGridCanvas(),this._readyPromise=when.resolve(!0)}function InvertClassification(){this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._texture=void 0,this._classifiedTexture=void 0,this._depthStencilTexture=void 0,this._fbo=void 0,this._fboClassified=void 0,this._rsUnclassified=void 0,this._rsClassified=void 0,this._unclassifiedCommand=void 0,this._classifiedCommand=void 0,this._translucentCommand=void 0,this._clearColorCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._clearCommand=new ClearCommand({color:new Color(0,0,0,0),depth:1,stencil:0});var e=this;this._uniformMap={colorTexture:function(){return e._texture},depthTexture:function(){return e._depthStencilTexture},classifiedTexture:function(){return e._classifiedTexture}}}Object.defineProperties(GridImageryProvider.prototype,{proxy:{get:function(){}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){}},minimumLevel:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){}},hasAlphaChannel:{get:function(){return!0}}}),GridImageryProvider.prototype._drawGrid=function(e){for(var t=this._canvasSize,i=0;i<=this._cells;++i){var r=1+i/this._cells*(t-1);e.moveTo(r,0),e.lineTo(r,t),e.moveTo(0,r),e.lineTo(t,r)}e.stroke()},GridImageryProvider.prototype._createGridCanvas=function(){var e=document.createElement("canvas");e.width=this._canvasSize,e.height=this._canvasSize;var t=this._canvasSize,i=e.getContext("2d"),r=this._backgroundColor.toCssColorString();i.fillStyle=r,i.fillRect(0,0,t,t);var n=this._glowColor.toCssColorString();i.strokeStyle=n,i.lineWidth=this._glowWidth,i.strokeRect(0,0,t,t),this._drawGrid(i),i.lineWidth=.5*this._glowWidth,i.strokeRect(0,0,t,t),this._drawGrid(i);var a=this._color.toCssColorString();return i.strokeStyle=a,i.lineWidth=2,i.strokeRect(0,0,t,t),i.lineWidth=1,this._drawGrid(i),e},GridImageryProvider.prototype.getTileCredits=function(e,t,i){},GridImageryProvider.prototype.requestImage=function(e,t,i,r){return this._canvas},GridImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){},Object.defineProperties(InvertClassification.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}}),InvertClassification.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};var rsUnclassified={depthMask:!1,stencilTest:{enabled:!0,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.NEVER,reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},blending:BlendingState$1.ALPHA_BLEND},rsClassified={depthMask:!1,stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.NEVER,reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},blending:BlendingState$1.ALPHA_BLEND},rsDefault={depthMask:!0,depthTest:{enabled:!0},stencilTest:StencilConstants$1.setCesium3DTileBit(),stencilMask:StencilConstants$1.CESIUM_3D_TILE_MASK,blending:BlendingState$1.ALPHA_BLEND},translucentFS="#extension GL_EXT_frag_depth : enable\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform sampler2D classifiedTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n if (color.a == 0.0)\n {\n discard;\n }\n bool isClassified = all(equal(texture2D(classifiedTexture, v_textureCoordinates), vec4(0.0)));\n#ifdef UNCLASSIFIED\n vec4 highlightColor = czm_invertClassificationColor;\n if (isClassified)\n {\n discard;\n }\n#else\n vec4 highlightColor = vec4(1.0);\n if (!isClassified)\n {\n discard;\n }\n#endif\n gl_FragColor = color * highlightColor;\n gl_FragDepthEXT = texture2D(depthTexture, v_textureCoordinates).r;\n}\n",opaqueFS="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n if (color.a == 0.0)\n {\n discard;\n }\n#ifdef UNCLASSIFIED\n gl_FragColor = color * czm_invertClassificationColor;\n#else\n gl_FragColor = color;\n#endif\n}\n";function JobTypeBudget(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}function JobScheduler(e){var t=new Array(JobType$1.NUMBER_OF_JOB_TYPES);t[JobType$1.TEXTURE]=new JobTypeBudget(defined(e)?e[JobType$1.TEXTURE]:10),t[JobType$1.PROGRAM]=new JobTypeBudget(defined(e)?e[JobType$1.PROGRAM]:10),t[JobType$1.BUFFER]=new JobTypeBudget(defined(e)?e[JobType$1.BUFFER]:30);var i,r=t.length,n=0;for(i=0;i<r;++i)n+=t[i].total;var a=new Array(r);for(i=0;i<r;++i)a[i]=!1;this._totalBudget=n,this._totalUsedThisFrame=0,this._budgets=t,this._executedThisFrame=a}function Light(){}InvertClassification.prototype.update=function(e){var t=this._texture,i=!defined(t)||this.previousFramebuffer!==this._previousFramebuffer;this._previousFramebuffer=this.previousFramebuffer;var r,n,a=e.drawingBufferWidth,o=e.drawingBufferHeight,s=!defined(t)||t.width!==a||t.height!==o;((s||i)&&(this._texture=this._texture&&this._texture.destroy(),this._classifiedTexture=this._classifiedTexture&&this._classifiedTexture.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._texture=new Texture({context:e,width:a,height:o,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})}),defined(this._previousFramebuffer)||(this._classifiedTexture=new Texture({context:e,width:a,height:o,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})}),this._depthStencilTexture=new Texture({context:e,width:a,height:o,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8}))),!defined(this._fbo)||s||i)&&(this._fbo=this._fbo&&this._fbo.destroy(),this._fboClassified=this._fboClassified&&this._fboClassified.destroy(),defined(this._previousFramebuffer)?(r=this._previousFramebuffer.depthStencilTexture,n=this._previousFramebuffer.depthStencilRenderbuffer):r=this._depthStencilTexture,this._fbo=new Framebuffer({context:e,colorTextures:[this._texture],depthStencilTexture:r,depthStencilRenderbuffer:n,destroyAttachments:!1}),defined(this._previousFramebuffer)||(this._fboClassified=new Framebuffer({context:e,colorTextures:[this._classifiedTexture],depthStencilTexture:r,destroyAttachments:!1})));if(defined(this._rsUnclassified)||(this._rsUnclassified=RenderState.fromCache(rsUnclassified),this._rsClassified=RenderState.fromCache(rsClassified),this._rsDefault=RenderState.fromCache(rsDefault)),!defined(this._unclassifiedCommand)||i){defined(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());var l=defined(this._previousFramebuffer)?opaqueFS:translucentFS,c=new ShaderSource({defines:["UNCLASSIFIED"],sources:[l]}),u=new ShaderSource({sources:[l]});this._unclassifiedCommand=e.createViewportQuadCommand(c,{renderState:defined(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(u,{renderState:defined(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),defined(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),defined(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(PassThrough,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}},InvertClassification.prototype.clear=function(e,t){var i=t.framebuffer;defined(this._previousFramebuffer)?(t.framebuffer=this._fbo,this._clearColorCommand.execute(e,t)):(t.framebuffer=this._fbo,this._clearCommand.execute(e,t),t.framebuffer=this._fboClassified,this._clearCommand.execute(e,t)),t.framebuffer=i},InvertClassification.prototype.executeClassified=function(e,t){if(!defined(this._previousFramebuffer)){var i=t.framebuffer;t.framebuffer=this._fboClassified,this._translucentCommand.execute(e,t),t.framebuffer=i}this._classifiedCommand.execute(e,t)},InvertClassification.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)},InvertClassification.prototype.isDestroyed=function(){return!1},InvertClassification.prototype.destroy=function(){return this._fbo=this._fbo&&this._fbo.destroy(),this._texture=this._texture&&this._texture.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),defined(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),destroyObject(this)},Object.defineProperties(JobTypeBudget.prototype,{total:{get:function(){return this._total}}}),JobScheduler.getTimestamp=getTimestamp$1,Object.defineProperties(JobScheduler.prototype,{totalBudget:{get:function(){return this._totalBudget}}}),JobScheduler.prototype.disableThisFrame=function(){this._totalUsedThisFrame=this._totalBudget},JobScheduler.prototype.resetBudgets=function(){for(var e=this._budgets,t=e.length,i=0;i<t;++i){var r=e[i];r.starvedLastFrame=r.starvedThisFrame,r.starvedThisFrame=!1,r.usedThisFrame=0,r.stolenFromMeThisFrame=0}this._totalUsedThisFrame=0},JobScheduler.prototype.execute=function(e,t){var i,r=this._budgets,n=r[t],a=this._executedThisFrame[t];if(this._totalUsedThisFrame>=this._totalBudget&&a)return n.starvedThisFrame=!0,!1;if(n.usedThisFrame+n.stolenFromMeThisFrame>=n.total){var o,s=r.length;for(o=0;o<s&&(!((i=r[o]).usedThisFrame+i.stolenFromMeThisFrame<i.total)||i.starvedLastFrame);++o);if(o===s&&a)return!1;a&&(n.starvedThisFrame=!0)}var l=JobScheduler.getTimestamp();e.execute();var c=JobScheduler.getTimestamp()-l;return this._totalUsedThisFrame+=c,i?i.stolenFromMeThisFrame+=c:n.usedThisFrame+=c,this._executedThisFrame[t]=!0,!0},Object.defineProperties(Light.prototype,{color:{get:DeveloperError.throwInstantiationError},intensity:{get:DeveloperError.throwInstantiationError}});var trailingSlashRegex=/\/$/,defaultCredit$1=new Credit('© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function MapboxStyleImageryProvider(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).styleId,i=e.accessToken;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;var r=Resource.createIfNeeded(defaultValue(e.url,"https://api.mapbox.com/styles/v1/"));this._styleId=t,this._accessToken=i;var n=defaultValue(e.tilesize,512);this._tilesize=n;var a=defaultValue(e.username,"mapbox");this._username=a;var o,s=defined(e.scaleFactor)?"@2x":"",l=r.getUrlComponent();trailingSlashRegex.test(l)||(l+="/"),l+=this._username+"/"+t+"/tiles/"+this._tilesize+"/{z}/{x}/{y}"+s,r.url=l,r.setQueryParameters({access_token:i}),defined(e.credit)?"string"==typeof(o=e.credit)&&(o=new Credit(o)):o=defaultCredit$1,this._resource=r,this._imageryProvider=new UrlTemplateImageryProvider({url:r,credit:o,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}function Moon(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).textureUrl;defined(t)||(t=buildModuleUrl("Assets/Textures/moonSmall.jpg")),this.show=defaultValue(e.show,!0),this.textureUrl=t,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.MOON),this.onlySunLighting=defaultValue(e.onlySunLighting,!0),this._ellipsoidPrimitive=new EllipsoidPrimitive({radii:this.ellipsoid.radii,material:Material$3.fromType(Material$3.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new IauOrientationAxes}Object.defineProperties(MapboxStyleImageryProvider.prototype,{url:{get:function(){return this._imageryProvider.url}},ready:{get:function(){return this._imageryProvider.ready}},readyPromise:{get:function(){return this._imageryProvider.readyPromise}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._imageryProvider.errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},proxy:{get:function(){return this._imageryProvider.proxy}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}}}),MapboxStyleImageryProvider.prototype.getTileCredits=function(e,t,i){},MapboxStyleImageryProvider.prototype.requestImage=function(e,t,i,r){return this._imageryProvider.requestImage(e,t,i,r)},MapboxStyleImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){return this._imageryProvider.pickFeatures(e,t,i,r,n)},MapboxStyleImageryProvider._defaultCredit=defaultCredit$1,Object.defineProperties(Moon.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});var icrfToFixed=new Matrix3,rotationScratch=new Matrix3,translationScratch=new Cartesian3,scratchCommandList=[];function MultiClippingPlaneCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._multiCollections=[],this._dataArrayBuffer=null,this._lengthArrayBuffer=null,this._dataTexture=null,this._lengthTexture=null,this._dirty=!1,this._maxCollectionLength=0,this._totalPlanesCount=0,this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.edgeColor=Color.clone(defaultValue(e.edgeColor,Color.WHITE)),this.edgeWidth=defaultValue(e.edgeWidth,0);var t=e.collections,i=this;defined(t)&&t.forEach((function(e){i.add(e)}))}function NeverTileDiscardPolicy(e){}Moon.prototype.update=function(e){if(this.show){var t=this._ellipsoidPrimitive;t.material.uniforms.image=this.textureUrl,t.onlySunLighting=this.onlySunLighting;var i=e.time;defined(Transforms.computeIcrfToFixedMatrix(i,icrfToFixed))||Transforms.computeTemeToPseudoFixedMatrix(i,icrfToFixed);var r=this._axes.evaluate(i,rotationScratch);Matrix3.transpose(r,r),Matrix3.multiply(icrfToFixed,r,r);var n=Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame(i,translationScratch);Matrix3.multiplyByVector(icrfToFixed,n,n),Matrix4.fromRotationTranslation(r,n,t.modelMatrix);var a=e.commandList;return e.commandList=scratchCommandList,scratchCommandList.length=0,t.update(e),e.commandList=a,1===scratchCommandList.length?scratchCommandList[0]:void 0}},Moon.prototype.isDestroyed=function(){return!1},Moon.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),destroyObject(this)},Object.defineProperties(MultiClippingPlaneCollection.prototype,{length:{get:function(){return this._multiCollections.length}},dataTexture:{get:function(){return this._dataTexture}},lengthTexture:{get:function(){return this._lengthTexture}},collectionsState:{get:function(){var e=0;return this._multiCollections.forEach((function(t,i){e+=t.clippingPlanesState})),e}},maxCollectionLength:{get:function(){return this._maxCollectionLength}},totalPlanesCount:{get:function(){return this._totalPlanesCount}}}),MultiClippingPlaneCollection.prototype.add=function(e){this._multiCollections.push(e),this._dirty=!0},MultiClippingPlaneCollection.prototype.get=function(e){return this._multiCollections[e]},MultiClippingPlaneCollection.prototype.contains=function(e){return-1!==this._multiCollections.findIndex((function(t){return t===e}))},MultiClippingPlaneCollection.prototype.remove=function(e){var t=this._multiCollections,i=t.findIndex((function(t){return t===e}));return-1!==i&&(t.splice(i,1),e instanceof ClippingPlaneCollection&&e.destroy(),this._dirty=!0,!0)},MultiClippingPlaneCollection.prototype.removeAll=function(){this._multiCollections.forEach((function(e){e instanceof ClippingPlaneCollection&&e.destroy()})),this._multiCollections=[],this._dirty=!0},MultiClippingPlaneCollection.prototype.update=function(e){var t=this._multiCollections;if(t.forEach((function(t){t.enabled&&t.update(e)})),this._dirty){for(var i,r=e.context,n=ClippingPlaneCollection.useFloatTexture(r),a=0,o=!0,s=0,l=0,c=0;c<t.length;c++){var u=t[c];s+=t.length,l=Math.max(l,u.length),i=u.texture.height,a+=u.texture.width,defined(u.texture)||(o=!1)}if(this._totalPlanesCount=s,this._maxCollectionLength=l,o&&t.length>0){this._dataArrayBuffer=n?new Float32Array(a*i*4):new Uint8Array(a*i*4),this._lengthArrayBuffer=new Float32Array(4*t.length);var d=this._dataArrayBuffer,h=this._lengthArrayBuffer,p=0;t.forEach((function(e,t){for(var i=n?e._float32View:e._uint8View,r=0,a=0;a<e.length;++a)d[p]=i[r],d[p+1]=i[r+1],d[p+2]=i[r+2],d[p+3]=i[r+3],r+=4,p+=4;h[4*t+3]=e.length})),this._dataTexture=new Texture(n?{context:r,width:a,height:i,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT,sampler:Sampler.NEAREST,flipY:!1}:{context:r,width:a,height:i,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST,flipY:!1,source:{width:a,height:i,arrayBufferView:d}}),this._dataTexture.copyFrom({source:{width:a,height:i,arrayBufferView:d}}),this._lengthTexture=new Texture({context:r,width:t.length,height:1,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT,sampler:Sampler.NEAREST,flipY:!1}),this._lengthTexture.copyFrom({source:{width:t.length,height:1,arrayBufferView:h}})}this._dirty=!1}},MultiClippingPlaneCollection.prototype.destroy=function(){return this._multiCollections.forEach((function(e){e instanceof ClippingPlaneCollection&&e.destroy()})),this._multiCollections=void 0,this._dataTexture=this._dataTexture&&this._dataTexture.destroy(),this._lengthTexture=this._lengthTexture&&this._lengthTexture.destroy(),destroyObject(this)},NeverTileDiscardPolicy.prototype.isReady=function(){return!0},NeverTileDiscardPolicy.prototype.shouldDiscardImage=function(e){return!1};var AdjustTranslucentFS="#ifdef MRT\n#extension GL_EXT_draw_buffers : enable\n#endif\nuniform vec4 u_bgColor;\nuniform sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nif (texture2D(u_depthTexture, v_textureCoordinates).r < 1.0)\n{\n#ifdef MRT\ngl_FragData[0] = u_bgColor;\ngl_FragData[1] = vec4(u_bgColor.a);\n#else\ngl_FragColor = u_bgColor;\n#endif\nreturn;\n}\ndiscard;\n}\n",CompositeOITFS="uniform sampler2D u_opaque;\nuniform sampler2D u_accumulation;\nuniform sampler2D u_revealage;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 opaque = texture2D(u_opaque, v_textureCoordinates);\nvec4 accum = texture2D(u_accumulation, v_textureCoordinates);\nfloat r = texture2D(u_revealage, v_textureCoordinates).r;\n#ifdef MRT\nvec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);\n#else\nvec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);\n#endif\ngl_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;\nif (opaque != czm_backgroundColor)\n{\ngl_FragColor.a = 1.0;\n}\n}\n";function OIT(e){this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;var t=e.colorBufferFloat&&e.depthTexture;this._translucentMRTSupport=e.drawBuffers&&t,this._translucentMultipassSupport=!this._translucentMRTSupport&&t,this._opaqueFBO=void 0,this._opaqueTexture=void 0,this._depthStencilTexture=void 0,this._accumulationTexture=void 0,this._translucentFBO=void 0,this._alphaFBO=void 0,this._adjustTranslucentFBO=void 0,this._adjustAlphaFBO=void 0,this._opaqueClearCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new ClearCommand({color:new Color(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._alphaClearCommand=new ClearCommand({color:new Color(1,1,1,1),owner:this}),this._translucentRenderStateCache={},this._alphaRenderStateCache={},this._compositeCommand=void 0,this._adjustTranslucentCommand=void 0,this._adjustAlphaCommand=void 0,this._viewport=new BoundingRectangle,this._rs=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHDR=!1}function destroyTextures$2(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function destroyFramebuffers$2(e){e._translucentFBO=e._translucentFBO&&!e._translucentFBO.isDestroyed()&&e._translucentFBO.destroy(),e._alphaFBO=e._alphaFBO&&!e._alphaFBO.isDestroyed()&&e._alphaFBO.destroy(),e._adjustTranslucentFBO=e._adjustTranslucentFBO&&!e._adjustTranslucentFBO.isDestroyed()&&e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO=e._adjustAlphaFBO&&!e._adjustAlphaFBO.isDestroyed()&&e._adjustAlphaFBO.destroy()}function destroyResources$2(e){destroyTextures$2(e),destroyFramebuffers$2(e)}function updateTextures$1(e,t,i,r){destroyTextures$2(e),e._accumulationTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT});var n=new Float32Array(i*r*4);e._revealageTexture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT,source:{arrayBufferView:n,width:i,height:r},flipY:!1})}function updateFramebuffers$3(e,t){destroyFramebuffers$2(e);var i=WebGLConstants$1.FRAMEBUFFER_COMPLETE,r=!0;if(e._translucentMRTSupport&&(e._translucentFBO=new Framebuffer({context:t,colorTextures:[e._accumulationTexture,e._revealageTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._adjustTranslucentFBO=new Framebuffer({context:t,colorTextures:[e._accumulationTexture,e._revealageTexture],destroyAttachments:!1}),e._translucentFBO.status===i&&e._adjustTranslucentFBO.status===i||(destroyFramebuffers$2(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO=new Framebuffer({context:t,colorTextures:[e._accumulationTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._alphaFBO=new Framebuffer({context:t,colorTextures:[e._revealageTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._adjustTranslucentFBO=new Framebuffer({context:t,colorTextures:[e._accumulationTexture],destroyAttachments:!1}),e._adjustAlphaFBO=new Framebuffer({context:t,colorTextures:[e._revealageTexture],destroyAttachments:!1});var n=e._translucentFBO.status===i,a=e._alphaFBO.status===i,o=e._adjustTranslucentFBO.status===i,s=e._adjustAlphaFBO.status===i;n&&a&&o&&s||(destroyResources$2(e),e._translucentMultipassSupport=!1,r=!1)}return r}OIT.prototype.update=function(e,t,i,r){if(this.isSupported()){this._opaqueFBO=i,this._opaqueTexture=i.getColorTexture(0),this._depthStencilTexture=i.depthStencilTexture;var n=this._opaqueTexture.width,a=this._opaqueTexture.height,o=this._accumulationTexture,s=!defined(o)||o.width!==n||o.height!==a||r!==this._useHDR;if(s&&updateTextures$1(this,e,n,a),defined(this._translucentFBO)&&!s||updateFramebuffers$3(this,e)){this._useHDR=r;var l,c,u=this;defined(this._compositeCommand)||(l=new ShaderSource({sources:[CompositeOITFS]}),this._translucentMRTSupport&&l.defines.push("MRT"),c={u_opaque:function(){return u._opaqueTexture},u_accumulation:function(){return u._accumulationTexture},u_revealage:function(){return u._revealageTexture}},this._compositeCommand=e.createViewportQuadCommand(l,{uniformMap:c,owner:this})),defined(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(l=new ShaderSource({defines:["MRT"],sources:[AdjustTranslucentFS]}),c={u_bgColor:function(){return u._translucentMRTClearCommand.color},u_depthTexture:function(){return u._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(l,{uniformMap:c,owner:this})):this._translucentMultipassSupport&&(l=new ShaderSource({sources:[AdjustTranslucentFS]}),c={u_bgColor:function(){return u._translucentMultipassClearCommand.color},u_depthTexture:function(){return u._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(l,{uniformMap:c,owner:this}),c={u_bgColor:function(){return u._alphaClearCommand.color},u_depthTexture:function(){return u._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(l,{uniformMap:c,owner:this}))),this._viewport.width=n,this._viewport.height=a;var d=!BoundingRectangle.equals(this._viewport,t.viewport),h=d!==this._useScissorTest;this._useScissorTest=d,BoundingRectangle.equals(this._scissorRectangle,t.viewport)||(this._scissorRectangle=BoundingRectangle.clone(t.viewport,this._scissorRectangle),h=!0),defined(this._rs)&&BoundingRectangle.equals(this._viewport,this._rs.viewport)&&!h||(this._rs=RenderState.fromCache({viewport:this._viewport,scissorTest:{enabled:this._useScissorTest,rectangle:this._scissorRectangle}})),defined(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderState=this._rs),defined(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)}}};var translucentMRTBlend={enabled:!0,color:new Color(0,0,0,0),equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE,functionSourceAlpha:BlendFunction$1.ZERO,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA},translucentColorBlend={enabled:!0,color:new Color(0,0,0,0),equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationAlpha:BlendFunction$1.ONE},translucentAlphaBlend={enabled:!0,color:new Color(0,0,0,0),equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ZERO,functionDestinationRgb:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:BlendFunction$1.ZERO,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA};function getTranslucentRenderState(e,t,i,r){var n=i[r.id];if(!defined(n)){var a=RenderState.getState(r);a.depthMask=!1,a.blending=t,n=RenderState.fromCache(a),i[r.id]=n}return n}function getTranslucentMRTRenderState(e,t,i){return getTranslucentRenderState(t,translucentMRTBlend,e._translucentRenderStateCache,i)}function getTranslucentColorRenderState(e,t,i){return getTranslucentRenderState(t,translucentColorBlend,e._translucentRenderStateCache,i)}function getTranslucentAlphaRenderState(e,t,i){return getTranslucentRenderState(t,translucentAlphaBlend,e._alphaRenderStateCache,i)}var mrtShaderSource=" vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;\n float ai = czm_gl_FragColor.a;\n float wzi = czm_alphaWeight(ai);\n gl_FragData[0] = vec4(Ci * wzi, ai);\n gl_FragData[1] = vec4(ai * wzi);\n",colorShaderSource=" vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;\n float ai = czm_gl_FragColor.a;\n float wzi = czm_alphaWeight(ai);\n gl_FragColor = vec4(Ci, ai) * wzi;\n",alphaShaderSource=" float ai = czm_gl_FragColor.a;\n gl_FragColor = vec4(ai);\n";function getTranslucentShaderProgram(e,t,i,r){var n=e.shaderCache.getDerivedShaderProgram(t,i);if(!defined(n)){var a=t._attributeLocations,o=t.fragmentShaderSource.clone();o.sources=o.sources.map((function(e){return e=(e=(e=(e=ShaderSource.replaceMain(e,"czm_translucent_main")).replace(/gl_FragColor/g,"czm_gl_FragColor")).replace(/\bdiscard\b/g,"czm_discard = true")).replace(/czm_phong/g,"czm_translucentPhong")})),o.sources.splice(0,0,(-1!==r.indexOf("gl_FragData")?"#extension GL_EXT_draw_buffers : enable \n":"")+"vec4 czm_gl_FragColor;\nbool czm_discard = false;\n"),o.sources.push("void main()\n{\n czm_translucent_main();\n if (czm_discard)\n {\n discard;\n }\n"+r+"}\n"),n=e.shaderCache.createDerivedShaderProgram(t,i,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:a})}return n}function getTranslucentMRTShaderProgram(e,t){return getTranslucentShaderProgram(e,t,"translucentMRT",mrtShaderSource)}function getTranslucentColorShaderProgram(e,t){return getTranslucentShaderProgram(e,t,"translucentMultipass",colorShaderSource)}function getTranslucentAlphaShaderProgram(e,t){return getTranslucentShaderProgram(e,t,"alphaMultipass",alphaShaderSource)}function executeTranslucentCommandsSortedMultipass(e,t,i,r,n,a){var o,s,l=t.context,c=t.frameState.useLogDepth,u=t._hdr,d=r.framebuffer,h=n.length,p=t.frameState.shadowState.lightShadowsEnabled;r.framebuffer=e._adjustTranslucentFBO,e._adjustTranslucentCommand.execute(l,r),r.framebuffer=e._adjustAlphaFBO,e._adjustAlphaCommand.execute(l,r);var f=e._opaqueFBO;for(r.framebuffer=e._translucentFBO,s=0;s<h;++s)o=n[s],o=c?o.derivedCommands.logDepth.command:o,o=u?o.derivedCommands.hdr.command:o,i(p&&o.receiveShadows?o.derivedCommands.oit.shadows.translucentCommand:o.derivedCommands.oit.translucentCommand,t,l,r,f);for(defined(a)&&(o=a.unclassifiedCommand,i(p&&o.receiveShadows?o.derivedCommands.oit.shadows.translucentCommand:o.derivedCommands.oit.translucentCommand,t,l,r,f)),r.framebuffer=e._alphaFBO,s=0;s<h;++s)o=n[s],o=c?o.derivedCommands.logDepth.command:o,o=u?o.derivedCommands.hdr.command:o,i(p&&o.receiveShadows?o.derivedCommands.oit.shadows.alphaCommand:o.derivedCommands.oit.alphaCommand,t,l,r,f);defined(a)&&(o=a.unclassifiedCommand,i(p&&o.receiveShadows?o.derivedCommands.oit.shadows.alphaCommand:o.derivedCommands.oit.alphaCommand,t,l,r,f)),r.framebuffer=d}function executeTranslucentCommandsSortedMRT(e,t,i,r,n,a){var o=t.context,s=t.frameState.useLogDepth,l=t._hdr,c=r.framebuffer,u=n.length,d=t.frameState.shadowState.lightShadowsEnabled;r.framebuffer=e._adjustTranslucentFBO,e._adjustTranslucentCommand.execute(o,r);var h,p=e._opaqueFBO;r.framebuffer=e._translucentFBO;for(var f=0;f<u;++f)h=n[f],h=s?h.derivedCommands.logDepth.command:h,h=l?h.derivedCommands.hdr.command:h,i(d&&h.receiveShadows?h.derivedCommands.oit.shadows.translucentCommand:h.derivedCommands.oit.translucentCommand,t,o,r,p);defined(a)&&(h=a.unclassifiedCommand,i(d&&h.receiveShadows?h.derivedCommands.oit.shadows.translucentCommand:h.derivedCommands.oit.translucentCommand,t,o,r,p)),r.framebuffer=c}OIT.prototype.createDerivedCommands=function(e,t,i){var r,n,a,o,s,l;(defined(i)||(i={}),this._translucentMRTSupport)?(defined(i.translucentCommand)&&(r=i.translucentCommand.shaderProgram,n=i.translucentCommand.renderState),i.translucentCommand=DrawCommand.shallowClone(e,i.translucentCommand),defined(r)&&i.shaderProgramId===e.shaderProgram.id?(i.translucentCommand.shaderProgram=r,i.translucentCommand.renderState=n):(i.translucentCommand.shaderProgram=getTranslucentMRTShaderProgram(t,e.shaderProgram),i.translucentCommand.renderState=getTranslucentMRTRenderState(this,t,e.renderState),i.shaderProgramId=e.shaderProgram.id)):(defined(i.translucentCommand)&&(a=i.translucentCommand.shaderProgram,o=i.translucentCommand.renderState,s=i.alphaCommand.shaderProgram,l=i.alphaCommand.renderState),i.translucentCommand=DrawCommand.shallowClone(e,i.translucentCommand),i.alphaCommand=DrawCommand.shallowClone(e,i.alphaCommand),defined(a)&&i.shaderProgramId===e.shaderProgram.id?(i.translucentCommand.shaderProgram=a,i.translucentCommand.renderState=o,i.alphaCommand.shaderProgram=s,i.alphaCommand.renderState=l):(i.translucentCommand.shaderProgram=getTranslucentColorShaderProgram(t,e.shaderProgram),i.translucentCommand.renderState=getTranslucentColorRenderState(this,t,e.renderState),i.alphaCommand.shaderProgram=getTranslucentAlphaShaderProgram(t,e.shaderProgram),i.alphaCommand.renderState=getTranslucentAlphaRenderState(this,t,e.renderState),i.shaderProgramId=e.shaderProgram.id));return i},OIT.prototype.executeCommands=function(e,t,i,r,n){this._translucentMRTSupport?executeTranslucentCommandsSortedMRT(this,e,t,i,r,n):executeTranslucentCommandsSortedMultipass(this,e,t,i,r,n)},OIT.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)},OIT.prototype.clear=function(e,t,i){var r=t.framebuffer;t.framebuffer=this._opaqueFBO,Color.clone(i,this._opaqueClearCommand.color),this._opaqueClearCommand.execute(e,t),t.framebuffer=this._translucentFBO,(this._translucentMRTSupport?this._translucentMRTClearCommand:this._translucentMultipassClearCommand).execute(e,t),this._translucentMultipassSupport&&(t.framebuffer=this._alphaFBO,this._alphaClearCommand.execute(e,t)),t.framebuffer=r},OIT.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport},OIT.prototype.isDestroyed=function(){return!1},OIT.prototype.destroy=function(){return destroyResources$2(this),defined(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),defined(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),defined(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy()),destroyObject(this)};var defaultCredit=new Credit("MapQuest, Open Street Map and contributors, CC-BY-SA");function OpenStreetMapImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=Resource.createIfNeeded(defaultValue(e.url,"https://a.tile.openstreetmap.org/"));t.appendForwardSlash(),t.url+="{z}/{x}/{y}."+defaultValue(e.fileExtension,"png");var i=new WebMercatorTilingScheme({ellipsoid:e.ellipsoid}),r=defaultValue(e.minimumLevel,0),n=e.maximumLevel,a=defaultValue(e.rectangle,i.rectangle),o=i.positionToTileXY(Rectangle.southwest(a),r),s=i.positionToTileXY(Rectangle.northeast(a),r);Math.abs(s.x-o.x),Math.abs(s.y-o.y);var l=defaultValue(e.credit,defaultCredit);"string"==typeof l&&(l=new Credit(l)),UrlTemplateImageryProvider.call(this,{url:t,credit:l,tilingScheme:i,tileWidth:256,tileHeight:256,minimumLevel:r,maximumLevel:n,rectangle:a})}defined(Object.create)&&(OpenStreetMapImageryProvider.prototype=Object.create(UrlTemplateImageryProvider.prototype),OpenStreetMapImageryProvider.prototype.constructor=OpenStreetMapImageryProvider);var defaultSize=new Cartesian2(1,1);function Particle(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.mass=defaultValue(e.mass,1),this.position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this.velocity=Cartesian3.clone(defaultValue(e.velocity,Cartesian3.ZERO)),this.life=defaultValue(e.life,Number.MAX_VALUE),this.image=e.image,this.startColor=Color.clone(defaultValue(e.startColor,Color.WHITE)),this.endColor=Color.clone(defaultValue(e.endColor,Color.WHITE)),this.startScale=defaultValue(e.startScale,1),this.endScale=defaultValue(e.endScale,1),this.imageSize=Cartesian2.clone(defaultValue(e.imageSize,defaultSize)),this._age=0,this._normalizedAge=0,this._billboard=void 0}Object.defineProperties(Particle.prototype,{age:{get:function(){return this._age}},normalizedAge:{get:function(){return this._normalizedAge}}});var deltaScratch=new Cartesian3;function ParticleBurst(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.time=defaultValue(e.time,0),this.minimum=defaultValue(e.minimum,0),this.maximum=defaultValue(e.maximum,50),this._complete=!1}function ParticleEmitter(e){}Particle.prototype.update=function(e,t){return Cartesian3.multiplyByScalar(this.velocity,e,deltaScratch),Cartesian3.add(this.position,deltaScratch,this.position),defined(t)&&t(this,e),this._age+=e,this.life===Number.MAX_VALUE?this._normalizedAge=0:this._normalizedAge=this._age/this.life,this._age<=this.life},Object.defineProperties(ParticleBurst.prototype,{complete:{get:function(){return this._complete}}}),ParticleEmitter.prototype.emit=function(e){DeveloperError.throwInstantiationError()};var defaultImageSize=new Cartesian2(1,1);function ParticleSystem(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this.updateCallback=e.updateCallback,this.loop=defaultValue(e.loop,!0),this.image=defaultValue(e.image,void 0);var t=e.emitter;defined(t)||(t=new CircleEmitter(.5)),this._emitter=t,this._bursts=e.bursts,this._modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._emitterModelMatrix=Matrix4.clone(defaultValue(e.emitterModelMatrix,Matrix4.IDENTITY)),this._matrixDirty=!0,this._combinedMatrix=new Matrix4,this._startColor=Color.clone(defaultValue(e.color,defaultValue(e.startColor,Color.WHITE))),this._endColor=Color.clone(defaultValue(e.color,defaultValue(e.endColor,Color.WHITE))),this._startScale=defaultValue(e.scale,defaultValue(e.startScale,1)),this._endScale=defaultValue(e.scale,defaultValue(e.endScale,1)),this._emissionRate=defaultValue(e.emissionRate,5),this._minimumSpeed=defaultValue(e.speed,defaultValue(e.minimumSpeed,1)),this._maximumSpeed=defaultValue(e.speed,defaultValue(e.maximumSpeed,1)),this._minimumParticleLife=defaultValue(e.particleLife,defaultValue(e.minimumParticleLife,5)),this._maximumParticleLife=defaultValue(e.particleLife,defaultValue(e.maximumParticleLife,5)),this._minimumMass=defaultValue(e.mass,defaultValue(e.minimumMass,1)),this._maximumMass=defaultValue(e.mass,defaultValue(e.maximumMass,1)),this._minimumImageSize=Cartesian2.clone(defaultValue(e.imageSize,defaultValue(e.minimumImageSize,defaultImageSize))),this._maximumImageSize=Cartesian2.clone(defaultValue(e.imageSize,defaultValue(e.maximumImageSize,defaultImageSize))),this._sizeInMeters=defaultValue(e.sizeInMeters,!1),this._lifetime=defaultValue(e.lifetime,Number.MAX_VALUE),this._billboardCollection=void 0,this._particles=[],this._particlePool=[],this._previousTime=void 0,this._currentTime=0,this._carryOver=0,this._complete=new Event,this._isComplete=!1,this._updateParticlePool=!0,this._particleEstimate=0}function updateParticlePool(e){var t=e._emissionRate,i=e._maximumParticleLife,r=0,n=e._bursts;if(defined(n))for(var a=n.length,o=0;o<a;++o)r+=n[o].maximum;for(var s=e._billboardCollection,l=e.image,c=Math.ceil(t*i+r),u=e._particles,d=e._particlePool,h=Math.max(c-u.length-d.length,0),p=0;p<h;++p){var f=new Particle;f._billboard=s.add({image:l}),d.push(f)}e._particleEstimate=c}function getOrCreateParticle(e){var t=e._particlePool.pop();return defined(t)||(t=new Particle),t}function addParticleToPool(e,t){e._particlePool.push(t)}function freeParticlePool(e){for(var t=e._particles,i=e._particlePool,r=e._billboardCollection,n=t.length,a=i.length,o=e._particleEstimate,s=a-Math.max(o-n-a,0),l=s;l<a;++l){var c=i[l];r.remove(c._billboard)}i.length=s}function removeBillboard(e){defined(e._billboard)&&(e._billboard.show=!1)}function updateBillboard(e,t){var i=t._billboard;defined(i)||(i=t._billboard=e._billboardCollection.add({image:t.image})),i.width=t.imageSize.x,i.height=t.imageSize.y,i.position=t.position,i.sizeInMeters=e.sizeInMeters,i.show=!0;var r=CesiumMath.lerp(t.startColor.red,t.endColor.red,t.normalizedAge),n=CesiumMath.lerp(t.startColor.green,t.endColor.green,t.normalizedAge),a=CesiumMath.lerp(t.startColor.blue,t.endColor.blue,t.normalizedAge),o=CesiumMath.lerp(t.startColor.alpha,t.endColor.alpha,t.normalizedAge);i.color=new Color(r,n,a,o),i.scale=CesiumMath.lerp(t.startScale,t.endScale,t.normalizedAge)}function addParticle(e,t){t.startColor=Color.clone(e._startColor,t.startColor),t.endColor=Color.clone(e._endColor,t.endColor),t.startScale=e._startScale,t.endScale=e._endScale,t.image=e.image,t.life=CesiumMath.randomBetween(e._minimumParticleLife,e._maximumParticleLife),t.mass=CesiumMath.randomBetween(e._minimumMass,e._maximumMass),t.imageSize.x=CesiumMath.randomBetween(e._minimumImageSize.x,e._maximumImageSize.x),t.imageSize.y=CesiumMath.randomBetween(e._minimumImageSize.y,e._maximumImageSize.y),t._normalizedAge=0,t._age=0;var i=CesiumMath.randomBetween(e._minimumSpeed,e._maximumSpeed);Cartesian3.multiplyByScalar(t.velocity,i,t.velocity),e._particles.push(t)}function calculateNumberToEmit(e,t){if(e._isComplete)return 0;var i=(t=CesiumMath.mod(t,e._lifetime))*e._emissionRate,r=Math.floor(i);if(e._carryOver+=i-r,e._carryOver>1&&(r++,e._carryOver-=1),defined(e.bursts))for(var n=e.bursts.length,a=0;a<n;a++){var o=e.bursts[a],s=e._currentTime;defined(o)&&!o._complete&&s>o.time&&(r+=CesiumMath.randomBetween(o.minimum,o.maximum),o._complete=!0)}return r}Object.defineProperties(ParticleSystem.prototype,{emitter:{get:function(){return this._emitter},set:function(e){this._emitter=e}},bursts:{get:function(){return this._bursts},set:function(e){this._bursts=e,this._updateParticlePool=!0}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._matrixDirty=this._matrixDirty||!Matrix4.equals(this._modelMatrix,e),Matrix4.clone(e,this._modelMatrix)}},emitterModelMatrix:{get:function(){return this._emitterModelMatrix},set:function(e){this._matrixDirty=this._matrixDirty||!Matrix4.equals(this._emitterModelMatrix,e),Matrix4.clone(e,this._emitterModelMatrix)}},startColor:{get:function(){return this._startColor},set:function(e){Color.clone(e,this._startColor)}},endColor:{get:function(){return this._endColor},set:function(e){Color.clone(e,this._endColor)}},startScale:{get:function(){return this._startScale},set:function(e){this._startScale=e}},endScale:{get:function(){return this._endScale},set:function(e){this._endScale=e}},emissionRate:{get:function(){return this._emissionRate},set:function(e){this._emissionRate=e,this._updateParticlePool=!0}},minimumSpeed:{get:function(){return this._minimumSpeed},set:function(e){this._minimumSpeed=e}},maximumSpeed:{get:function(){return this._maximumSpeed},set:function(e){this._maximumSpeed=e}},minimumParticleLife:{get:function(){return this._minimumParticleLife},set:function(e){this._minimumParticleLife=e}},maximumParticleLife:{get:function(){return this._maximumParticleLife},set:function(e){this._maximumParticleLife=e,this._updateParticlePool=!0}},minimumMass:{get:function(){return this._minimumMass},set:function(e){this._minimumMass=e}},maximumMass:{get:function(){return this._maximumMass},set:function(e){this._maximumMass=e}},minimumImageSize:{get:function(){return this._minimumImageSize},set:function(e){this._minimumImageSize=e}},maximumImageSize:{get:function(){return this._maximumImageSize},set:function(e){this._maximumImageSize=e}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){this._sizeInMeters=e}},lifetime:{get:function(){return this._lifetime},set:function(e){this._lifetime=e}},complete:{get:function(){return this._complete}},isComplete:{get:function(){return this._isComplete}}});var rotatedVelocityScratch=new Cartesian3;function PerformanceDisplay(e){var t=getElement((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).container);this._container=t;var i=document.createElement("div");i.className="cesium-performanceDisplay";var r=document.createElement("div");r.className="cesium-performanceDisplay-fps",this._fpsText=document.createTextNode(""),r.appendChild(this._fpsText);var n=document.createElement("div");n.className="cesium-performanceDisplay-ms",this._msText=document.createTextNode(""),n.appendChild(this._msText),i.appendChild(n),i.appendChild(r),this._container.appendChild(i),this._lastFpsSampleTime=getTimestamp$1(),this._lastMsSampleTime=getTimestamp$1(),this._fpsFrameCount=0,this._msFrameCount=0,this._throttled=!1;var a=document.createElement("div");a.className="cesium-performanceDisplay-throttled",this._throttledText=document.createTextNode(""),a.appendChild(this._throttledText),i.appendChild(a)}function PickDepth(){this._framebuffer=void 0,this._depthTexture=void 0,this._textureToCopy=void 0,this._copyDepthCommand=void 0}function destroyTextures$1(e){e._depthTexture=e._depthTexture&&!e._depthTexture.isDestroyed()&&e._depthTexture.destroy()}function destroyFramebuffers$1(e){e._framebuffer=e._framebuffer&&!e._framebuffer.isDestroyed()&&e._framebuffer.destroy()}function createTextures(e,t,i,r){e._depthTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE})}function createFramebuffers$1(e,t,i,r){destroyTextures$1(e),destroyFramebuffers$1(e),createTextures(e,t,i,r),e._framebuffer=new Framebuffer({context:t,colorTextures:[e._depthTexture],destroyAttachments:!1})}function updateFramebuffers$2(e,t,i){var r=i.width,n=i.height,a=e._depthTexture,o=!defined(a)||a.width!==r||a.height!==n;defined(e._framebuffer)&&!o||createFramebuffers$1(e,t,r,n)}function updateCopyCommands(e,t,i){if(!defined(e._copyDepthCommand)){e._copyDepthCommand=t.createViewportQuadCommand("uniform highp sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);\n}\n",{renderState:RenderState.fromCache(),uniformMap:{u_texture:function(){return e._textureToCopy}},owner:e})}e._textureToCopy=i,e._copyDepthCommand.framebuffer=e._framebuffer}ParticleSystem.prototype.update=function(e){if(this.show){defined(this._billboardCollection)||(this._billboardCollection=new BillboardCollection),this._updateParticlePool&&(updateParticlePool(this),this._updateParticlePool=!1);var t=0;this._previousTime&&(t=JulianDate.secondsDifference(e.time,this._previousTime)),t<0&&(t=0);var i,r,n=this._particles,a=this._emitter,o=this.updateCallback,s=n.length;for(i=0;i<s;++i)(r=n[i]).update(t,o)?updateBillboard(this,r):(removeBillboard(r),addParticleToPool(this,r),n[i]=n[s-1],--i,--s);n.length=s;var l=calculateNumberToEmit(this,t);if(l>0&&defined(a)){this._matrixDirty&&(this._combinedMatrix=Matrix4.multiply(this.modelMatrix,this.emitterModelMatrix,this._combinedMatrix),this._matrixDirty=!1);var c=this._combinedMatrix;for(i=0;i<l;i++)r=getOrCreateParticle(this),this._emitter.emit(r),Cartesian3.add(r.position,r.velocity,rotatedVelocityScratch),Matrix4.multiplyByPoint(c,rotatedVelocityScratch,rotatedVelocityScratch),r.position=Matrix4.multiplyByPoint(c,r.position,r.position),Cartesian3.subtract(rotatedVelocityScratch,r.position,r.velocity),Cartesian3.normalize(r.velocity,r.velocity),addParticle(this,r),updateBillboard(this,r)}if(this._billboardCollection.update(e),this._previousTime=JulianDate.clone(e.time,this._previousTime),this._currentTime+=t,this._lifetime!==Number.MAX_VALUE&&this._currentTime>this._lifetime)if(this.loop){if(this._currentTime=CesiumMath.mod(this._currentTime,this._lifetime),this.bursts){var u=this.bursts.length;for(i=0;i<u;i++)this.bursts[i]._complete=!1}}else this._isComplete=!0,this._complete.raiseEvent(this);e.frameNumber%120==0&&freeParticlePool(this)}},ParticleSystem.prototype.isDestroyed=function(){return!1},ParticleSystem.prototype.destroy=function(){return this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),destroyObject(this)},Object.defineProperties(PerformanceDisplay.prototype,{throttled:{get:function(){return this._throttled},set:function(e){this._throttled!==e&&(this._throttledText.nodeValue=e?"(throttled)":"",this._throttled=e)}}}),PerformanceDisplay.prototype.update=function(e){var t=getTimestamp$1(),i=defaultValue(e,!0);this._fpsFrameCount++;var r=t-this._lastFpsSampleTime;if(r>1e3){var n="N/A";i&&(n=1e3*this._fpsFrameCount/r|0),this._fpsText.nodeValue=n+" FPS",this._lastFpsSampleTime=t,this._fpsFrameCount=0}this._msFrameCount++;var a=t-this._lastMsSampleTime;if(a>200){var o="N/A";i&&(o=(a/this._msFrameCount).toFixed(2)),this._msText.nodeValue=o+" MS",this._lastMsSampleTime=t,this._msFrameCount=0}},PerformanceDisplay.prototype.destroy=function(){return destroyObject(this)},PickDepth.prototype.update=function(e,t){updateFramebuffers$2(this,e,t),updateCopyCommands(this,e,t)};var scratchPackedDepth=new Cartesian4,packedDepthScale=new Cartesian4(1,1/255,1/65025,1/16581375);function PickDepthFramebuffer(){this._depthStencilTexture=void 0,this._framebuffer=void 0,this._passState=void 0}function destroyResources$1(e){e._framebuffer=e._framebuffer&&e._framebuffer.destroy(),e._depthStencilTexture=e._depthStencilTexture&&e._depthStencilTexture.destroy()}function createResources(e,t){var i=t.drawingBufferWidth,r=t.drawingBufferHeight;e._depthStencilTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8}),e._framebuffer=new Framebuffer({context:t,depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1});var n=new PassState(t);n.blendingEnabled=!1,n.scissorTest={enabled:!0,rectangle:new BoundingRectangle},n.viewport=new BoundingRectangle,e._passState=n}function PickFramebuffer(e){var t=new PassState(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new BoundingRectangle},t.viewport=new BoundingRectangle,this._context=e,this._fb=void 0,this._passState=t,this._width=0,this._height=0}PickDepth.prototype.getDepth=function(e,t,i){if(defined(this._framebuffer)){var r=e.readPixels({x:t,y:i,width:1,height:1,framebuffer:this._framebuffer}),n=Cartesian4.unpack(r,0,scratchPackedDepth);return Cartesian4.divideByScalar(n,255,n),Cartesian4.dot(n,packedDepthScale)}},PickDepth.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)},PickDepth.prototype.isDestroyed=function(){return!1},PickDepth.prototype.destroy=function(){return destroyTextures$1(this),destroyFramebuffers$1(this),defined(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=defined(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),destroyObject(this)},PickDepthFramebuffer.prototype.update=function(e,t,i){var r=i.width,n=i.height;defined(this._framebuffer)&&r===this._depthStencilTexture.width&&n===this._depthStencilTexture.height||(destroyResources$1(this),createResources(this,e));var a=this._framebuffer,o=this._passState;return o.framebuffer=a,o.viewport.width=r,o.viewport.height=n,o.scissorTest.rectangle.x=t.x,o.scissorTest.rectangle.y=n-t.y,o.scissorTest.rectangle.width=1,o.scissorTest.rectangle.height=1,o},PickDepthFramebuffer.prototype.isDestroyed=function(){return!1},PickDepthFramebuffer.prototype.destroy=function(){return destroyResources$1(this),destroyObject(this)},PickFramebuffer.prototype.begin=function(e,t){var i=this._context,r=t.width,n=t.height;return BoundingRectangle.clone(e,this._passState.scissorTest.rectangle),defined(this._fb)&&this._width===r&&this._height===n||(this._width=r,this._height=n,this._fb=this._fb&&this._fb.destroy(),this._fb=new Framebuffer({context:i,colorTextures:[new Texture({context:i,width:r,height:n})],depthStencilRenderbuffer:new Renderbuffer({context:i,width:r,height:n,format:RenderbufferFormat$1.DEPTH_STENCIL})}),this._passState.framebuffer=this._fb),this._passState.viewport.width=r,this._passState.viewport.height=n,this._passState};var colorScratch=new Color;function SceneFramebuffer(){this._colorTexture=void 0,this._idTexture=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._framebuffer=void 0,this._idFramebuffer=void 0,this._idClearColor=new Color(0,0,0,0),this._useHdr=void 0,this._clearCommand=new ClearCommand({color:new Color(0,0,0,0),depth:1,owner:this})}function destroyResources(e){e._framebuffer=e._framebuffer&&e._framebuffer.destroy(),e._idFramebuffer=e._idFramebuffer&&e._idFramebuffer.destroy(),e._colorTexture=e._colorTexture&&e._colorTexture.destroy(),e._idTexture=e._idTexture&&e._idTexture.destroy(),e._depthStencilTexture=e._depthStencilTexture&&e._depthStencilTexture.destroy(),e._depthStencilRenderbuffer=e._depthStencilRenderbuffer&&e._depthStencilRenderbuffer.destroy(),e._depthStencilIdTexture=e._depthStencilIdTexture&&e._depthStencilIdTexture.destroy(),e._depthStencilIdRenderbuffer=e._depthStencilIdRenderbuffer&&e._depthStencilIdRenderbuffer.destroy(),e._framebuffer=void 0,e._idFramebuffer=void 0,e._colorTexture=void 0,e._idTexture=void 0,e._depthStencilTexture=void 0,e._depthStencilRenderbuffer=void 0,e._depthStencilIdTexture=void 0,e._depthStencilIdRenderbuffer=void 0}function ShadowMapShader(){}function ShadowMap(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context;this._enabled=defaultValue(e.enabled,!0),this._softShadows=defaultValue(e.softShadows,!1),this._normalOffset=defaultValue(e.normalOffset,!0),this.dirty=!0,this.fromLightSource=defaultValue(e.fromLightSource,!0),this.darkness=defaultValue(e.darkness,.3),this._darkness=this.darkness,this.fadingEnabled=defaultValue(e.fadingEnabled,!0),this.maximumDistance=defaultValue(e.maximumDistance,5e3),this._outOfView=!1,this._outOfViewPrevious=!1,this._needsUpdate=!0;var i,r=!0;(FeatureDetection.isInternetExplorer()||FeatureDetection.isEdge()||(FeatureDetection.isChrome()||FeatureDetection.isFirefox())&&FeatureDetection.isWindows()&&!t.depthTexture)&&(r=!1),this._polygonOffsetSupported=r,this._terrainBias={polygonOffset:r,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},this._primitiveBias={polygonOffset:r,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.1,normalShading:!0,normalShadingSmooth:.05,depthBias:2e-5},this._pointBias={polygonOffset:!1,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:0,normalShading:!0,normalShadingSmooth:.1,depthBias:5e-4},this._depthAttachment=void 0,this._colorAttachment=void 0,this._shadowMapMatrix=new Matrix4,this._shadowMapTexture=void 0,this._lightDirectionEC=new Cartesian3,this._lightPositionEC=new Cartesian4,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new ShadowMapCamera,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new BoundingSphere,this._isPointLight=defaultValue(e.isPointLight,!1),this._pointLightRadius=defaultValue(e.pointLightRadius,100),this._cascadesEnabled=!this._isPointLight&&defaultValue(e.cascadesEnabled,!0),this._numberOfCascades=this._cascadesEnabled?defaultValue(e.numberOfCascades,4):0,this._fitNearFar=!0,this._maximumCascadeDistances=[25,150,700,Number.MAX_VALUE],this._textureSize=new Cartesian2,this._isSpotLight=!1,this._cascadesEnabled?this._shadowMapCamera.frustum=new OrthographicOffCenterFrustum:defined(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new Cartesian4,new Cartesian4],this._cascadeMatrices=[new Matrix4,new Matrix4,new Matrix4,new Matrix4],this._cascadeDistances=new Cartesian4,i=this._isPointLight?6:this._cascadesEnabled?this._numberOfCascades:1,this._passes=new Array(i);for(var n=0;n<i;++n)this._passes[n]=new ShadowPass(t);this.debugShow=!1,this.debugFreezeFrame=!1,this._debugFreezeFrame=!1,this._debugCascadeColors=!1,this._debugLightFrustum=void 0,this._debugCameraFrustum=void 0,this._debugCascadeFrustums=new Array(this._numberOfCascades),this._debugShadowViewCommand=void 0,this._usesDepthTexture=t.depthTexture,this._isPointLight&&(this._usesDepthTexture=!1),this._primitiveRenderState=void 0,this._terrainRenderState=void 0,this._pointRenderState=void 0,createRenderStates(this),this._clearCommand=new ClearCommand({depth:1,color:new Color}),this._clearPassState=new PassState(t),this._size=defaultValue(e.size,2048),this.size=this._size}function ShadowPass(e){this.camera=new ShadowMapCamera,this.passState=new PassState(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function createRenderState(e,t){return RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.BACK},depthTest:{enabled:!0},colorMask:{red:e,green:e,blue:e,alpha:e},depthMask:!0,polygonOffset:{enabled:t.polygonOffset,factor:t.polygonOffsetFactor,units:t.polygonOffsetUnits}})}function createRenderStates(e){var t=!e._usesDepthTexture;e._primitiveRenderState=createRenderState(t,e._primitiveBias),e._terrainRenderState=createRenderState(t,e._terrainBias),e._pointRenderState=createRenderState(t,e._pointBias)}function destroyFramebuffer(e){for(var t=e._passes.length,i=0;i<t;++i){var r=e._passes[i],n=r.framebuffer;defined(n)&&!n.isDestroyed()&&n.destroy(),r.framebuffer=void 0}e._depthAttachment=e._depthAttachment&&e._depthAttachment.destroy(),e._colorAttachment=e._colorAttachment&&e._colorAttachment.destroy()}function createSampler$1(){return new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}function createFramebufferColor(e,t){for(var i=new Renderbuffer({context:t,width:e._textureSize.x,height:e._textureSize.y,format:RenderbufferFormat$1.DEPTH_COMPONENT16}),r=new Texture({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:createSampler$1()}),n=new Framebuffer({context:t,depthRenderbuffer:i,colorTextures:[r],destroyAttachments:!1}),a=e._passes.length,o=0;o<a;++o){var s=e._passes[o];s.framebuffer=n,s.passState.framebuffer=n}e._shadowMapTexture=r,e._depthAttachment=i,e._colorAttachment=r}function createFramebufferDepth(e,t){for(var i=new Texture({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:createSampler$1()}),r=new Framebuffer({context:t,depthStencilTexture:i,destroyAttachments:!1}),n=e._passes.length,a=0;a<n;++a){var o=e._passes[a];o.framebuffer=r,o.passState.framebuffer=r}e._shadowMapTexture=i,e._depthAttachment=i}function createFramebufferCube(e,t){for(var i=new Renderbuffer({context:t,width:e._textureSize.x,height:e._textureSize.y,format:RenderbufferFormat$1.DEPTH_COMPONENT16}),r=new CubeMap({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST}),n=[r.negativeX,r.negativeY,r.negativeZ,r.positiveX,r.positiveY,r.positiveZ],a=0;a<6;++a){var o=new Framebuffer({context:t,depthRenderbuffer:i,colorTextures:[n[a]],destroyAttachments:!1}),s=e._passes[a];s.framebuffer=o,s.passState.framebuffer=o}e._shadowMapTexture=r,e._depthAttachment=i,e._colorAttachment=r}function createFramebuffer(e,t){e._isPointLight?createFramebufferCube(e,t):e._usesDepthTexture?createFramebufferDepth(e,t):createFramebufferColor(e,t)}function checkFramebuffer(e,t){e._usesDepthTexture&&e._passes[0].framebuffer.status!==WebGLConstants$1.FRAMEBUFFER_COMPLETE&&(e._usesDepthTexture=!1,createRenderStates(e),destroyFramebuffer(e),createFramebuffer(e,t))}function updateFramebuffer(e,t){defined(e._passes[0].framebuffer)&&e._shadowMapTexture.width===e._textureSize.x||(destroyFramebuffer(e),createFramebuffer(e,t),checkFramebuffer(e,t),clearFramebuffer(e,t))}function clearFramebuffer(e,t,i){i=defaultValue(i,0),(e._isPointLight||0===i)&&(e._clearCommand.framebuffer=e._passes[i].framebuffer,e._clearCommand.execute(t,e._clearPassState))}function resize(e,t){e._size=t;var i=e._passes,r=i.length,n=e._textureSize;if(e._isPointLight){t=ContextLimits.maximumCubeMapSize>=t?t:ContextLimits.maximumCubeMapSize,n.x=t,n.y=t;var a=new BoundingRectangle(0,0,t,t);i[0].passState.viewport=a,i[1].passState.viewport=a,i[2].passState.viewport=a,i[3].passState.viewport=a,i[4].passState.viewport=a,i[5].passState.viewport=a}else 1===r?(t=ContextLimits.maximumTextureSize>=t?t:ContextLimits.maximumTextureSize,n.x=t,n.y=t,i[0].passState.viewport=new BoundingRectangle(0,0,t,t)):4===r&&(t=ContextLimits.maximumTextureSize>=2*t?t:ContextLimits.maximumTextureSize/2,n.x=2*t,n.y=2*t,i[0].passState.viewport=new BoundingRectangle(0,0,t,t),i[1].passState.viewport=new BoundingRectangle(t,0,t,t),i[2].passState.viewport=new BoundingRectangle(0,t,t,t),i[3].passState.viewport=new BoundingRectangle(t,t,t,t));e._clearPassState.viewport=new BoundingRectangle(0,0,n.x,n.y);for(var o=0;o<r;++o){var s=i[o],l=s.passState.viewport,c=l.x/n.x,u=l.y/n.y,d=l.width/n.x,h=l.height/n.y;s.textureOffsets=new Matrix4(d,0,0,c,0,h,0,u,0,0,1,0,0,0,0,1)}}PickFramebuffer.prototype.end=function(e){for(var t=defaultValue(e.width,1),i=defaultValue(e.height,1),r=this._context,n=r.readPixels({x:e.x,y:e.y,width:t,height:i,framebuffer:this._fb}),a=Math.max(t,i),o=a*a,s=Math.floor(.5*t),l=Math.floor(.5*i),c=0,u=0,d=0,h=-1,p=0;p<o;++p){if(-s<=c&&c<=s&&-l<=u&&u<=l){var f=4*((l-u)*t+c+s);colorScratch.red=Color.byteToFloat(n[f]),colorScratch.green=Color.byteToFloat(n[f+1]),colorScratch.blue=Color.byteToFloat(n[f+2]),colorScratch.alpha=Color.byteToFloat(n[f+3]);var m=r.getObjectByPickColor(colorScratch);if(defined(m))return m}if(c===u||c<0&&-c===u||c>0&&c===1-u){var g=d;d=-h,h=g}c+=d,u+=h}},PickFramebuffer.prototype.isDestroyed=function(){return!1},PickFramebuffer.prototype.destroy=function(){return this._fb=this._fb&&this._fb.destroy(),destroyObject(this)},SceneFramebuffer.prototype.update=function(e,t,i){var r=t.width,n=t.height,a=this._colorTexture;if(!defined(a)||a.width!==r||a.height!==n||i!==this._useHdr){destroyResources(this),this._useHdr=i;var o=i?e.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;this._colorTexture=new Texture({context:e,width:r,height:n,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:o,sampler:Sampler.NEAREST}),this._idTexture=new Texture({context:e,width:r,height:n,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST}),e.depthTexture?(this._depthStencilTexture=new Texture({context:e,width:r,height:n,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:Sampler.NEAREST}),this._depthStencilIdTexture=new Texture({context:e,width:r,height:n,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:Sampler.NEAREST})):(this._depthStencilRenderbuffer=new Renderbuffer({context:e,width:r,height:n,format:RenderbufferFormat$1.DEPTH_STENCIL}),this._depthStencilIdRenderbuffer=new Renderbuffer({context:e,width:r,height:n,format:RenderbufferFormat$1.DEPTH_STENCIL})),this._framebuffer=new Framebuffer({context:e,colorTextures:[this._colorTexture],depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1}),this._idFramebuffer=new Framebuffer({context:e,colorTextures:[this._idTexture],depthStencilTexture:this._depthStencilIdTexture,depthStencilRenderbuffer:this._depthStencilIdRenderbuffer,destroyAttachments:!1})}},SceneFramebuffer.prototype.clear=function(e,t,i){var r=t.framebuffer;t.framebuffer=this._framebuffer,Color.clone(i,this._clearCommand.color),this._clearCommand.execute(e,t),t.framebuffer=this._idFramebuffer,Color.clone(this._idClearColor,this._clearCommand.color),this._clearCommand.execute(e,t),t.framebuffer=r},SceneFramebuffer.prototype.getFramebuffer=function(){return this._framebuffer},SceneFramebuffer.prototype.getIdFramebuffer=function(){return this._idFramebuffer},SceneFramebuffer.prototype.isDestroyed=function(){return!1},SceneFramebuffer.prototype.destroy=function(){return destroyResources(this),destroyObject(this)},ShadowMapShader.getShadowCastShaderKeyword=function(e,t,i,r){return"castShadow "+e+" "+t+" "+i+" "+r},ShadowMapShader.createShadowCastVertexShader=function(e,t,i){var r=e.defines.slice(0),n=e.sources.slice(0);r.push("SHADOW_MAP"),i&&r.push("GENERATE_POSITION");var a=defined(ShaderSource.findPositionVarying(e));if(t&&!a){for(var o=n.length,s=0;s<o;++s)n[s]=ShaderSource.replaceMain(n[s],"czm_shadow_cast_main");n.push("varying vec3 v_positionEC; \nvoid main() \n{ \n czm_shadow_cast_main(); \n v_positionEC = (czm_inverseProjection * gl_Position).xyz; \n}")}return new ShaderSource({defines:r,sources:n})},ShadowMapShader.createShadowCastFragmentShader=function(e,t,i,r){var n=e.defines.slice(0),a=e.sources.slice(0),o=ShaderSource.findPositionVarying(e),s=defined(o);s||(o="v_positionEC");for(var l=a.length,c=0;c<l;++c)a[c]=ShaderSource.replaceMain(a[c],"czm_shadow_cast_main");var u="";return t&&(s||(u+="varying vec3 v_positionEC; \n"),u+="uniform vec4 shadowMap_lightPositionEC; \n"),u+=r?"void main() \n{ \n":"void main() \n{ \n czm_shadow_cast_main(); \n if (gl_FragColor.a == 0.0) \n { \n discard; \n } \n",u+=t?" float distance = length("+o+"); \n if (distance >= shadowMap_lightPositionEC.w) \n { \n discard; \n } \n distance /= shadowMap_lightPositionEC.w; // radius \n gl_FragColor = czm_packDepth(gl_FragCoord.z); \n":i?" gl_FragColor = vec4(1.0); \n":" gl_FragColor = czm_packDepth(gl_FragCoord.z); \n",u+="} \n",a.push(u),new ShaderSource({defines:n,sources:a})},ShadowMapShader.getShadowReceiveShaderKeyword=function(e,t,i,r){return"receiveShadow "+e._usesDepthTexture+e._polygonOffsetSupported+e._isPointLight+e._isSpotLight+(e._numberOfCascades>1)+e.debugCascadeColors+e.softShadows+t+i+r},ShadowMapShader.createShadowReceiveVertexShader=function(e,t,i){var r=e.defines.slice(0),n=e.sources.slice(0);return r.push("SHADOW_MAP"),t&&(i?r.push("GENERATE_POSITION_AND_NORMAL"):r.push("GENERATE_POSITION")),new ShaderSource({defines:r,sources:n})},ShadowMapShader.createShadowReceiveFragmentShader=function(e,t,i,r,n){for(var a=ShaderSource.findNormalVarying(e),o=!r&&defined(a)||r&&n,s=ShaderSource.findPositionVarying(e),l=defined(s),c=t._usesDepthTexture,u=t._polygonOffsetSupported,d=t._isPointLight,h=t._isSpotLight,p=t._numberOfCascades>1,f=t.debugCascadeColors,m=t.softShadows,g=d?t._pointBias:r?t._terrainBias:t._primitiveBias,_=e.defines.slice(0),y=e.sources.slice(0),v=y.length,C=0;C<v;++C)y[C]=ShaderSource.replaceMain(y[C],"czm_shadow_receive_main");d?_.push("USE_CUBE_MAP_SHADOW"):c&&_.push("USE_SHADOW_DEPTH_TEXTURE"),m&&!d&&_.push("USE_SOFT_SHADOWS"),p&&i&&r&&(o?_.push("ENABLE_VERTEX_LIGHTING"):_.push("ENABLE_DAYNIGHT_SHADING")),i&&g.normalShading&&o&&(_.push("USE_NORMAL_SHADING"),g.normalShadingSmooth>0&&_.push("USE_NORMAL_SHADING_SMOOTH"));var T="";return T+="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n",T+=d?"uniform samplerCube shadowMap_textureCube; \n":"uniform sampler2D shadowMap_texture; \n",T+="uniform bool u_isSun;\nuniform bool u_isVisible;\nuniform bool u_isB3dm;\nuniform bool u_isPreviewMode;\nuniform bool u_viewshedCalculateNormals;\nuniform float shadowMap_horizonCullingDistance;\nuniform bool u_isBelowGround;\nuniform mat4 shadowMap_matrix; \nuniform vec3 shadowMap_lightDirectionEC; \nuniform vec3 shadowMap_viewshed_Back; \nuniform vec3 shadowMap_viewshed_Fore; \nuniform vec3 shadowMap_color;\nuniform vec4 shadowMap_lightPositionEC; \nuniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; \nuniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; \nbool isTerrain = false;\n#ifdef LOG_DEPTH \nvarying vec3 v_logPositionEC; \n#endif \nvec4 getPositionEC() \n{ \n"+(l?" return vec4("+s+", 1.0); \n":"#ifndef LOG_DEPTH \n return czm_windowToEyeCoordinates(gl_FragCoord); \n#else \n return vec4(v_logPositionEC, 1.0); \n#endif \n")+"} \nvec3 getNormalEC() \n{ \n"+(o?" return normalize("+a+"); \n":" return vec3(1.0); \n")+"} \nvoid applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL) \n{ \n"+(g.normalOffset&&o?" float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x; \n float normalOffsetScale = 1.0 - nDotL; \n vec3 offset = normalOffset * normalOffsetScale * normalEC; \n positionEC.xyz += offset; \n":"")+"} \n",T+="void main() \n{ \n czm_shadow_receive_main(); \n vec4 positionEC = getPositionEC(); \n vec3 normalEC = getNormalEC(); \n float distanceFromLight = 0.; \n float maxDistanceForColoring = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.y;\n float depth = -positionEC.z; \n",T+=" czm_shadowParameters shadowParameters; \n shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy; \n shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z; \n shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w; \n shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w; \n",r?T+=h?" vec3 ffy = dFdy(positionEC.xyz);\n vec3 ffx = dFdx(positionEC.xyz);\n normalEC = normalize(cross(ffx,ffy));\n distanceFromLight = length(positionEC.xyz - shadowMap_lightPositionEC.xyz);\n shadowParameters.depthBias *= max(distanceFromLight * 0.01, 1.0);\n":" shadowParameters.depthBias *= max(depth * 0.01, 1.0); \n":u||(T+=" shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015); \n"),T+=d?" vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz; \n float distance = length(directionEC); \n directionEC = normalize(directionEC); \n float radius = shadowMap_lightPositionEC.w; \n // Stop early if the fragment is beyond the point light radius \n if (distance > radius) \n { \n return; \n } \n vec3 directionWC = czm_inverseViewRotation * directionEC; \n shadowParameters.depth = distance / radius; \n shadowParameters.nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); \n shadowParameters.texCoords = directionWC; \n float visibility = czm_shadowVisibility(shadowMap_textureCube, shadowParameters); \n":h?" if (u_isB3dm && u_viewshedCalculateNormals){\n vec3 nffy = dFdy(positionEC.xyz);\n vec3 nffx = dFdx(positionEC.xyz);\n normalEC = normalize(cross(nffx,nffy));\n }\n vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz); \n float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); \n applyNormalOffset(positionEC, normalEC, nDotL); \n vec4 shadowPosition = shadowMap_matrix * positionEC; \n // Spot light uses a perspective projection, so perform the perspective divide \n shadowPosition /= shadowPosition.w; \n // Stop early if the fragment is not in the shadow bounds \n if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \n { \n return; \n } \n shadowParameters.texCoords = shadowPosition.xy; \n shadowParameters.depth = shadowPosition.z; \n shadowParameters.nDotL = nDotL; \n float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n":p?" float maxDepth = shadowMap_cascadeSplits[1].w; \n // Stop early if the eye depth exceeds the last cascade \n if (depth > maxDepth) \n { \n return; \n } \n // Get the cascade based on the eye-space depth \n vec4 weights = czm_cascadeWeights(depth); \n // Apply normal offset \n float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); \n applyNormalOffset(positionEC, normalEC, nDotL); \n // Transform position into the cascade \n vec4 shadowPosition = czm_cascadeMatrix(weights) * positionEC; \n // Get visibility \n shadowParameters.texCoords = shadowPosition.xy; \n shadowParameters.depth = shadowPosition.z; \n shadowParameters.nDotL = nDotL; \n float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n // Fade out shadows that are far away \n float shadowMapMaximumDistance = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.z; \n float fade = max((depth - shadowMapMaximumDistance * 0.8) / (shadowMapMaximumDistance * 0.2), 0.0); \n visibility = mix(visibility, 1.0, fade); \n"+(f?" // Draw cascade colors for debugging \n gl_FragColor *= czm_cascadeColor(weights); \n":""):" float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); \n applyNormalOffset(positionEC, normalEC, nDotL); \n vec4 shadowPosition = shadowMap_matrix * positionEC; \n // Stop early if the fragment is not in the shadow bounds \n if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \n { \n return; \n } \n shadowParameters.texCoords = shadowPosition.xy; \n shadowParameters.depth = shadowPosition.z; \n shadowParameters.nDotL = nDotL; \n float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n",T+=" if (u_isSun){ ;\n gl_FragColor.rgb = mix(shadowMap_color,gl_FragColor.rgb,visibility);\n } else if (!u_isVisible) { gl_FragColor.rgba = vec4(gl_FragColor.rgb,0.); } else if (u_isPreviewMode) {\n gl_FragColor.rgba = vec4(gl_FragColor.rgb * 0.85 + 0.15 * mix(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), 1.-step(visibility,0.5)),1.); \n } else { gl_FragColor.rgba = vec4(gl_FragColor.rgb * 0.6 + 0.4 * mix(shadowMap_viewshed_Back, shadowMap_viewshed_Fore, 1.-step(visibility,0.5)),1.); }\n} \n",y.push(T),new ShaderSource({defines:_,sources:y})},ShadowMap.MAXIMUM_DISTANCE=2e4,ShadowMap.prototype.debugCreateRenderStates=function(){createRenderStates(this)},Object.defineProperties(ShadowMap.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this.dirty=this._enabled!==e,this._enabled=e}},normalOffset:{get:function(){return this._normalOffset},set:function(e){this.dirty=this._normalOffset!==e,this._normalOffset=e,this._terrainBias.normalOffset=e,this._primitiveBias.normalOffset=e,this._pointBias.normalOffset=e}},softShadows:{get:function(){return this._softShadows},set:function(e){this.dirty=this._softShadows!==e,this._softShadows=e}},size:{get:function(){return this._size},set:function(e){resize(this,e)}},outOfView:{get:function(){return this._outOfView}},shadowMapCullingVolume:{get:function(){return this._shadowMapCullingVolume}},passes:{get:function(){return this._passes}},isPointLight:{get:function(){return this._isPointLight}},debugCascadeColors:{get:function(){return this._debugCascadeColors},set:function(e){this.dirty=this._debugCascadeColors!==e,this._debugCascadeColors=e}}});var scratchViewport=new BoundingRectangle;function createDebugShadowViewCommand(e,t){var i;i=e._isPointLight?"uniform samplerCube shadowMap_textureCube; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n vec2 uv = v_textureCoordinates; \n vec3 dir; \n \n if (uv.y < 0.5) \n { \n if (uv.x < 0.333) \n { \n dir.x = -1.0; \n dir.y = uv.x * 6.0 - 1.0; \n dir.z = uv.y * 4.0 - 1.0; \n } \n else if (uv.x < 0.666) \n { \n dir.y = -1.0; \n dir.x = uv.x * 6.0 - 3.0; \n dir.z = uv.y * 4.0 - 1.0; \n } \n else \n { \n dir.z = -1.0; \n dir.x = uv.x * 6.0 - 5.0; \n dir.y = uv.y * 4.0 - 1.0; \n } \n } \n else \n { \n if (uv.x < 0.333) \n { \n dir.x = 1.0; \n dir.y = uv.x * 6.0 - 1.0; \n dir.z = uv.y * 4.0 - 3.0; \n } \n else if (uv.x < 0.666) \n { \n dir.y = 1.0; \n dir.x = uv.x * 6.0 - 3.0; \n dir.z = uv.y * 4.0 - 3.0; \n } \n else \n { \n dir.z = 1.0; \n dir.x = uv.x * 6.0 - 5.0; \n dir.y = uv.y * 4.0 - 3.0; \n } \n } \n \n float shadow = czm_unpackDepth(textureCube(shadowMap_textureCube, dir)); \n gl_FragColor = vec4(vec3(shadow), 1.0); \n} \n":"uniform sampler2D shadowMap_texture; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n"+(e._usesDepthTexture?" float shadow = texture2D(shadowMap_texture, v_textureCoordinates).r; \n":" float shadow = czm_unpackDepth(texture2D(shadowMap_texture, v_textureCoordinates)); \n")+" gl_FragColor = vec4(vec3(shadow), 1.0); \n} \n";var r=t.createViewportQuadCommand(i,{uniformMap:{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture}}});return r.pass=Pass$1.OVERLAY,r}function updateDebugShadowViewCommand(e,t){var i=t.context,r=t.context.drawingBufferWidth,n=t.context.drawingBufferHeight,a=.3*Math.min(r,n),o=scratchViewport;o.x=r-a,o.y=0,o.width=a,o.height=a;var s=e._debugShadowViewCommand;defined(s)||(s=createDebugShadowViewCommand(e,i),e._debugShadowViewCommand=s),defined(s.renderState)&&BoundingRectangle.equals(s.renderState.viewport,o)||(s.renderState=RenderState.fromCache({viewport:BoundingRectangle.clone(o)})),t.commandList.push(e._debugShadowViewCommand)}var frustumCornersNDC=new Array(8);frustumCornersNDC[0]=new Cartesian4(-1,-1,-1,1),frustumCornersNDC[1]=new Cartesian4(1,-1,-1,1),frustumCornersNDC[2]=new Cartesian4(1,1,-1,1),frustumCornersNDC[3]=new Cartesian4(-1,1,-1,1),frustumCornersNDC[4]=new Cartesian4(-1,-1,1,1),frustumCornersNDC[5]=new Cartesian4(1,-1,1,1),frustumCornersNDC[6]=new Cartesian4(1,1,1,1),frustumCornersNDC[7]=new Cartesian4(-1,1,1,1);for(var scratchMatrix=new Matrix4,scratchFrustumCorners=new Array(8),i$2=0;i$2<8;++i$2)scratchFrustumCorners[i$2]=new Cartesian4;function createDebugPointLight(e,t){return new Primitive$2({geometryInstances:[new GeometryInstance({geometry:new BoxOutlineGeometry({minimum:new Cartesian3(-.5,-.5,-.5),maximum:new Cartesian3(.5,.5,.5)}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(t)}}),new GeometryInstance({geometry:new SphereOutlineGeometry({radius:.5}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(t)}})],appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}var debugOutlineColors=[Color.RED,Color.GREEN,Color.BLUE,Color.MAGENTA],scratchScale=new Cartesian3;function applyDebugSettings(e,t){updateDebugShadowViewCommand(e,t);var i=e.debugFreezeFrame&&!e._debugFreezeFrame;if(e._debugFreezeFrame=e.debugFreezeFrame,e.debugFreezeFrame&&(i&&(e._debugCameraFrustum=e._debugCameraFrustum&&e._debugCameraFrustum.destroy(),e._debugCameraFrustum=new DebugCameraPrimitive({camera:e._sceneCamera,color:Color.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){i&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new DebugCameraPrimitive({camera:e._shadowMapCamera,color:Color.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t);for(var r=0;r<e._numberOfCascades;++r)i&&(e._debugCascadeFrustums[r]=e._debugCascadeFrustums[r]&&e._debugCascadeFrustums[r].destroy(),e._debugCascadeFrustums[r]=new DebugCameraPrimitive({camera:e._passes[r].camera,color:debugOutlineColors[r],updateOnChange:!1})),e._debugCascadeFrustums[r].update(t)}}else if(e._isPointLight){if(!defined(e._debugLightFrustum)||e._needsUpdate){var n=e._shadowMapCamera.positionWC,a=Quaternion.IDENTITY,o=2*e._pointLightRadius,s=Cartesian3.fromElements(o,o,o,scratchScale),l=Matrix4.fromTranslationQuaternionRotationScale(n,a,s,scratchMatrix);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=createDebugPointLight(l,Color.YELLOW)}e._debugLightFrustum.update(t)}else defined(e._debugLightFrustum)&&!e._needsUpdate||(e._debugLightFrustum=new DebugCameraPrimitive({camera:e._shadowMapCamera,color:Color.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function ShadowMapCamera(){this.viewMatrix=new Matrix4,this.inverseViewMatrix=new Matrix4,this.frustum=void 0,this.positionCartographic=new Cartographic,this.positionWC=new Cartesian3,this.directionWC=Cartesian3.clone(Cartesian3.UNIT_Z),this.upWC=Cartesian3.clone(Cartesian3.UNIT_Y),this.rightWC=Cartesian3.clone(Cartesian3.UNIT_X),this.viewProjectionMatrix=new Matrix4}ShadowMapCamera.prototype.clone=function(e){Matrix4.clone(e.viewMatrix,this.viewMatrix),Matrix4.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),Cartographic.clone(e.positionCartographic,this.positionCartographic),Cartesian3.clone(e.positionWC,this.positionWC),Cartesian3.clone(e.directionWC,this.directionWC),Cartesian3.clone(e.upWC,this.upWC),Cartesian3.clone(e.rightWC,this.rightWC)};var scaleBiasMatrix=new Matrix4(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);ShadowMapCamera.prototype.getViewProjection=function(){var e=this.viewMatrix,t=this.frustum.projectionMatrix;return Matrix4.multiply(t,e,this.viewProjectionMatrix),Matrix4.multiply(scaleBiasMatrix,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};var scratchSplits=new Array(5),scratchFrustum=new PerspectiveFrustum,scratchCascadeDistances=new Array(4),scratchMin=new Cartesian3,scratchMax=new Cartesian3;function computeCascades(e,t){var i,r=e._shadowMapCamera,n=e._sceneCamera,a=n.frustum.near,o=n.frustum.far,s=e._numberOfCascades,l=o-a,c=o/a,u=.9,d=!1;t.shadowState.closestObjectSize<200&&(d=!0,u=.9);var h=scratchCascadeDistances,p=scratchSplits;for(p[0]=a,p[s]=o,i=0;i<s;++i){var f=(i+1)/s,m=a*Math.pow(c,f),g=a+l*f,_=CesiumMath.lerp(g,m,u);p[i+1]=_,h[i]=_-p[i]}if(d){for(i=0;i<s;++i)h[i]=Math.min(h[i],e._maximumCascadeDistances[i]);var y=p[0];for(i=0;i<s-1;++i)y+=h[i],p[i+1]=y}Cartesian4.unpack(p,0,e._cascadeSplits[0]),Cartesian4.unpack(p,1,e._cascadeSplits[1]),Cartesian4.unpack(h,0,e._cascadeDistances);var v=r.frustum,C=v.left,T=v.right,S=v.bottom,A=v.top,x=v.near,E=v.far,b=r.positionWC,P=r.directionWC,D=r.upWC,w=n.frustum.clone(scratchFrustum),M=r.getViewProjection();for(i=0;i<s;++i){w.near=p[i],w.far=p[i+1];for(var I=Matrix4.multiply(w.projectionMatrix,n.viewMatrix,scratchMatrix),R=Matrix4.inverse(I,scratchMatrix),O=Matrix4.multiply(M,R,scratchMatrix),B=Cartesian3.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,scratchMin),L=Cartesian3.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,scratchMax),F=0;F<8;++F){var N=Cartesian4.clone(frustumCornersNDC[F],scratchFrustumCorners[F]);Matrix4.multiplyByVector(O,N,N),Cartesian3.divideByScalar(N,N.w,N),Cartesian3.minimumByComponent(N,B,B),Cartesian3.maximumByComponent(N,L,L)}B.x=Math.max(B.x,0),B.y=Math.max(B.y,0),B.z=0,L.x=Math.min(L.x,1),L.y=Math.min(L.y,1),L.z=Math.min(L.z,1);var V=e._passes[i],k=V.camera;k.clone(r);var U=k.frustum;U.left=C+B.x*(T-C),U.right=C+L.x*(T-C),U.bottom=S+B.y*(A-S),U.top=S+L.y*(A-S),U.near=x+B.z*(E-x),U.far=x+L.z*(E-x),V.cullingVolume=k.frustum.computeCullingVolume(b,P,D);var G=e._cascadeMatrices[i];Matrix4.multiply(k.getViewProjection(),n.inverseViewMatrix,G),Matrix4.multiply(V.textureOffsets,G,G)}}var scratchLightView=new Matrix4,scratchRight$1=new Cartesian3,scratchUp$1=new Cartesian3,scratchTranslation=new Cartesian3;function fitShadowMapToScene(e,t){var i=e._shadowMapCamera,r=e._sceneCamera,n=Matrix4.multiply(r.frustum.projectionMatrix,r.viewMatrix,scratchMatrix),a=Matrix4.inverse(n,scratchMatrix),o=i.directionWC,s=r.directionWC;Cartesian3.equalsEpsilon(o,s,CesiumMath.EPSILON10)&&(s=r.upWC);var l=Cartesian3.cross(o,s,scratchRight$1);s=Cartesian3.cross(l,o,scratchUp$1),Cartesian3.normalize(s,s),Cartesian3.normalize(l,l);for(var c=Cartesian3.fromElements(0,0,0,scratchTranslation),u=Matrix4.computeView(c,o,s,l,scratchLightView),d=Matrix4.multiply(u,a,scratchMatrix),h=Cartesian3.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,scratchMin),p=Cartesian3.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,scratchMax),f=0;f<8;++f){var m=Cartesian4.clone(frustumCornersNDC[f],scratchFrustumCorners[f]);Matrix4.multiplyByVector(d,m,m),Cartesian3.divideByScalar(m,m.w,m),Cartesian3.minimumByComponent(m,h,h),Cartesian3.maximumByComponent(m,p,p)}p.z+=1e3,h.z-=10;var g=scratchTranslation;g.x=-.5*(h.x+p.x),g.y=-.5*(h.y+p.y),g.z=-p.z;var _=Matrix4.fromTranslation(g,scratchMatrix);u=Matrix4.multiply(_,u,u);var y=.5*(p.x-h.x),v=.5*(p.y-h.y),C=p.z-h.z,T=i.frustum;T.left=-y,T.right=y,T.bottom=-v,T.top=v,T.near=.01,T.far=C,Matrix4.clone(u,i.viewMatrix),Matrix4.inverse(u,i.inverseViewMatrix),Matrix4.getTranslation(i.inverseViewMatrix,i.positionWC),t.mapProjection.ellipsoid.cartesianToCartographic(i.positionWC,i.positionCartographic),Cartesian3.clone(o,i.directionWC),Cartesian3.clone(s,i.upWC),Cartesian3.clone(l,i.rightWC)}var directions=[new Cartesian3(-1,0,0),new Cartesian3(0,-1,0),new Cartesian3(0,0,-1),new Cartesian3(1,0,0),new Cartesian3(0,1,0),new Cartesian3(0,0,1)],ups=[new Cartesian3(0,-1,0),new Cartesian3(0,0,-1),new Cartesian3(0,-1,0),new Cartesian3(0,-1,0),new Cartesian3(0,0,1),new Cartesian3(0,-1,0)],rights=[new Cartesian3(0,0,1),new Cartesian3(1,0,0),new Cartesian3(-1,0,0),new Cartesian3(0,0,-1),new Cartesian3(1,0,0),new Cartesian3(1,0,0)];function computeOmnidirectional(e,t){var i=new PerspectiveFrustum;i.fov=CesiumMath.PI_OVER_TWO,i.near=1,i.far=e._pointLightRadius,i.aspectRatio=1;for(var r=0;r<6;++r){var n=e._passes[r].camera;n.positionWC=e._shadowMapCamera.positionWC,n.positionCartographic=t.mapProjection.ellipsoid.cartesianToCartographic(n.positionWC,n.positionCartographic),n.directionWC=directions[r],n.upWC=ups[r],n.rightWC=rights[r],Matrix4.computeView(n.positionWC,n.directionWC,n.upWC,n.rightWC,n.viewMatrix),Matrix4.inverse(n.viewMatrix,n.inverseViewMatrix),n.frustum=i}}var scratchCartesian1=new Cartesian3,scratchCartesian2=new Cartesian3,scratchBoundingSphere=new BoundingSphere,scratchCenter$1=scratchBoundingSphere.center;function checkVisibility(e,t){var i=e._sceneCamera,r=e._shadowMapCamera,n=scratchBoundingSphere;if(e._cascadesEnabled){if(i.frustum.near>=e.maximumDistance)return e._outOfView=!0,void(e._needsUpdate=!1);var a=t.mapProjection.ellipsoid.geodeticSurfaceNormal(i.positionWC,scratchCartesian1),o=Cartesian3.negate(r.directionWC,scratchCartesian2),s=Cartesian3.dot(a,o);if(e.fadingEnabled){var l=CesiumMath.clamp(s/.1,0,1);e._darkness=CesiumMath.lerp(1,e.darkness,l)}else e._darkness=e.darkness;if(s<0)return e._outOfView=!0,void(e._needsUpdate=!1);e._needsUpdate=!0,e._outOfView=!1}else if(e._isPointLight)n.center=r.positionWC,n.radius=e._pointLightRadius,e._outOfView=t.cullingVolume.computeVisibility(n)===Intersect$1.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(n),BoundingSphere.clone(n,e._boundingSphere);else{var c=r.frustum.far/2,u=Cartesian3.add(r.positionWC,Cartesian3.multiplyByScalar(r.directionWC,c,scratchCenter$1),scratchCenter$1);n.center=u,n.radius=c,e._outOfView=t.cullingVolume.computeVisibility(n)===Intersect$1.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(n),BoundingSphere.clone(n,e._boundingSphere)}}function updateCameras(e,t){var i=t.camera,r=e._lightCamera,n=e._sceneCamera,a=e._shadowMapCamera;e._cascadesEnabled?r&&a&&Cartesian3.clone(r.directionWC,a.directionWC):e._isPointLight?r&&a&&Cartesian3.clone(r.positionWC,a.positionWC):a&&r&&a.clone(r);var o,s,l=e._lightDirectionEC;Matrix4.multiplyByPointAsVector(i.viewMatrix,a.directionWC,l),Cartesian3.normalize(l,l),Cartesian3.negate(l,l),Matrix4.multiplyByPoint(i.viewMatrix,a.positionWC,e._lightPositionEC),e._lightPositionEC.w=e._pointLightRadius,e._fitNearFar?(o=Math.min(t.shadowState.nearPlane,e.maximumDistance),s=Math.min(t.shadowState.farPlane,e.maximumDistance),s=Math.max(s,o+1)):(o=i.frustum.near,s=e.maximumDistance),e._sceneCamera=Camera.clone(i,n),i.frustum.clone(e._sceneCamera.frustum),e._sceneCamera.frustum.near=o,e._sceneCamera.frustum.far=s,e._distance=s-o,checkVisibility(e,t),!e._outOfViewPrevious&&e._outOfView&&(e._needsUpdate=!0),e._outOfViewPrevious=e._outOfView}ShadowMap.prototype.update=function(e){if(updateCameras(this,e),this._needsUpdate)if(updateFramebuffer(this,e.context),this._isPointLight&&computeOmnidirectional(this,e),this._cascadesEnabled&&(fitShadowMapToScene(this,e),this._numberOfCascades>1&&computeCascades(this,e)),this._isPointLight)this._shadowMapCullingVolume=CullingVolume.fromBoundingSphere(this._boundingSphere);else{var t=this._shadowMapCamera,i=t.positionWC,r=t.directionWC,n=t.upWC;this._shadowMapCullingVolume=t.frustum.computeCullingVolume(i,r,n),1===this._passes.length&&this._passes[0].camera.clone(t)}if(1===this._passes.length){var a=this._sceneCamera.inverseViewMatrix;Matrix4.multiply(this._shadowMapCamera.getViewProjection(),a,this._shadowMapMatrix)}this.debugShow&&applyDebugSettings(this,e)},ShadowMap.prototype.updatePass=function(e,t){clearFramebuffer(this,e,t)};var scratchTexelStepSize=new Cartesian2;function combineUniforms(e,t,i){var r=e._isPointLight?e._pointBias:i?e._terrainBias:e._primitiveBias;return combine$2(t,{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture},shadowMap_matrix:function(){return e._shadowMapMatrix},shadowMap_cascadeSplits:function(){return e._cascadeSplits},shadowMap_cascadeMatrices:function(){return e._cascadeMatrices},shadowMap_lightDirectionEC:function(){return e._lightDirectionEC},shadowMap_lightPositionEC:function(){return e._lightPositionEC},shadowMap_cascadeDistances:function(){return e._cascadeDistances},shadowMap_texelSizeDepthBiasAndNormalShadingSmooth:function(){var t=scratchTexelStepSize;return t.x=1/e._textureSize.x,t.y=1/e._textureSize.y,Cartesian4.fromElements(t.x,t.y,r.depthBias,r.normalShadingSmooth,this.combinedUniforms1)},shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness:function(){return Cartesian4.fromElements(r.normalOffsetScale,e._distance,e.maximumDistance,e._darkness,this.combinedUniforms2)},shadowMap_horizonCullingDistance:function(){return void 0===e.horizonCullingDistanceFromViewshed?6371010:e.horizonCullingDistanceFromViewshed},u_isSun:function(){return void 0===e.guid},u_isVisible:function(){return!!e.show},u_isPreviewMode:function(){return!!e.isPreviewMode},u_isBelowGround:function(){return!!e.isBelowGround},u_viewshedCalculateNormals:function(){return!1},shadowMap_viewshed_Back:function(){return e._viewshed_Back?e._viewshed_Back:new Cartesian3(1,0,0)},shadowMap_viewshed_Fore:function(){return e._viewshed_Fore?e._viewshed_Fore:new Cartesian3(0,1,0)},shadowMap_color:function(){return e._color?e._color:new Cartesian3(0,0,0)},combinedUniforms1:new Cartesian4,combinedUniforms2:new Cartesian4},!1)}function createCastDerivedCommand(e,t,i,r,n,a){var o,s,l;if(defined(a)&&(o=a.shaderProgram,s=a.renderState,l=a.uniformMap),(a=DrawCommand.shallowClone(i,a)).castShadows=!0,a.receiveShadows=!1,!defined(o)||n!==i.shaderProgram.id||t){var c=i.shaderProgram,u=i.pass===Pass$1.GLOBE,d=i.pass!==Pass$1.TRANSLUCENT,h=e._isPointLight||e._isSpotLight,p=e._usesDepthTexture,f=ShadowMapShader.getShadowCastShaderKeyword(h,u,p,d);if(!defined(o=r.shaderCache.getDerivedShaderProgram(c,f))){var m=c.vertexShaderSource,g=c.fragmentShaderSource,_=ShadowMapShader.createShadowCastVertexShader(m,h,u),y=ShadowMapShader.createShadowCastFragmentShader(g,h,p,d);o=r.shaderCache.createDerivedShaderProgram(c,f,{vertexShaderSource:_,fragmentShaderSource:y,attributeLocations:c._attributeLocations})}s=e._primitiveRenderState,h?s=e._pointRenderState:u&&(s=e._terrainRenderState),i.renderState.cull.enabled||((s=clone$1(s,!1)).cull=clone$1(s.cull,!1),s.cull.enabled=!1,s=RenderState.fromCache(s)),l=combineUniforms(e,i.uniformMap,u)}return a.shaderProgram=o,a.renderState=s,a.uniformMap=l,a.uniformMap.u_isB3dm=function(){return i.pass===Pass$1.CESIUM_3D_TILE},a}ShadowMap.createReceiveDerivedCommand=function(e,t,i,r,n){defined(n)||(n={});var a=e.length>0,o=t.shaderProgram,s=o.vertexShaderSource,l=o.fragmentShaderSource,c=t.pass===Pass$1.GLOBE,u=!1;if(c&&(u=t.owner.data.renderedMesh.encoding.hasVertexNormals),t.receiveShadows&&a){var d,h;defined(n.receiveCommand)&&(d=n.receiveCommand.shaderProgram,h=n.receiveCommand.uniformMap),n.receiveCommand=DrawCommand.shallowClone(t,n.receiveCommand),n.castShadows=!1,n.receiveShadows=!0;var p=n.receiveShaderCastShadows!==t.castShadows,f=n.receiveShaderProgramId!==t.shaderProgram.id;if(!defined(d)||f||i||p){var m=ShadowMapShader.getShadowReceiveShaderKeyword(e[0],t.castShadows,c,u);if(!defined(d=r.shaderCache.getDerivedShaderProgram(o,m))){var g=ShadowMapShader.createShadowReceiveVertexShader(s,c,u),_=ShadowMapShader.createShadowReceiveFragmentShader(l,e[0],t.castShadows,c,u);d=r.shaderCache.createDerivedShaderProgram(o,m,{vertexShaderSource:g,fragmentShaderSource:_,attributeLocations:o._attributeLocations})}h=combineUniforms(e[0],t.uniformMap,c)}n.receiveCommand.shaderProgram=d,n.receiveCommand.uniformMap=h,n.receiveCommand.uniformMap.u_isB3dm=function(){return t.pass===Pass$1.CESIUM_3D_TILE},n.receiveShaderProgramId=t.shaderProgram.id,n.receiveShaderCastShadows=t.castShadows}return n},ShadowMap.createCastDerivedCommand=function(e,t,i,r,n){if(defined(n)||(n={}),t.castShadows){var a=n.castCommands;defined(a)||(a=n.castCommands=[]);var o=n.castShaderProgramId,s=e.length;a.length=s;for(var l=0;l<s;++l)a[l]=createCastDerivedCommand(e[l],i,t,r,o,a[l]);n.castShaderProgramId=t.shaderProgram.id}return n},ShadowMap.prototype.isDestroyed=function(){return!1},ShadowMap.prototype.destroy=function(){destroyFramebuffer(this),this._debugLightFrustum=this._debugLightFrustum&&this._debugLightFrustum.destroy(),this._debugCameraFrustum=this._debugCameraFrustum&&this._debugCameraFrustum.destroy(),this._debugShadowViewCommand=this._debugShadowViewCommand&&this._debugShadowViewCommand.shaderProgram&&this._debugShadowViewCommand.shaderProgram.destroy();for(var e=0;e<this._numberOfCascades;++e)this._debugCascadeFrustums[e]=this._debugCascadeFrustums[e]&&this._debugCascadeFrustums[e].destroy();return destroyObject(this)};var CompareAndPackTranslucentDepth="uniform sampler2D u_opaqueDepthTexture;\nuniform sampler2D u_translucentDepthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nfloat opaqueDepth = texture2D(u_opaqueDepthTexture, v_textureCoordinates).r;\nfloat translucentDepth = texture2D(u_translucentDepthTexture, v_textureCoordinates).r;\ntranslucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth);\ngl_FragColor = czm_packDepth(translucentDepth);\n}\n",CompositeTranslucentClassification="uniform sampler2D colorTexture;\n#ifdef DEBUG_SHOW_DEPTH\nuniform sampler2D u_packedTranslucentDepth;\n#endif\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n#ifdef DEBUG_SHOW_DEPTH\nif (v_textureCoordinates.x < 0.5)\n{\ngl_FragColor.rgb = vec3(czm_unpackDepth(texture2D(u_packedTranslucentDepth, v_textureCoordinates)));\ngl_FragColor.a = 1.0;\n}\n#else\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\n#ifdef PICK\nif (color == vec4(0.0))\n{\ndiscard;\n}\n#else\ncolor.rgb /= color.a;\n#endif\ngl_FragColor = color;\n#endif\n}\n";function TranslucentTileClassification(e){this._drawClassificationFBO=void 0,this._accumulationFBO=void 0,this._packFBO=void 0,this._opaqueDepthStencilTexture=void 0,this._colorTexture=void 0,this._accumulationTexture=void 0,this._textureToComposite=void 0,this._translucentDepthStencilTexture=void 0,this._packedTranslucentDepth=void 0,this._packDepthCommand=void 0,this._accumulateCommand=void 0,this._compositeCommand=void 0,this._copyCommand=void 0,this._clearColorCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new ClearCommand({depth:1,stencil:0,owner:this}),this._supported=e.depthTexture,this._viewport=new BoundingRectangle,this._rsDepth=void 0,this._rsAccumulate=void 0,this._rsComp=void 0,this._useScissorTest=void 0,this._scissorRectangle=void 0,this._hasTranslucentDepth=!1,this._frustumsDrawn=0}function destroyTextures(e){e._colorTexture=e._colorTexture&&!e._colorTexture.isDestroyed()&&e._colorTexture.destroy(),e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy(),e._packedTranslucentDepth=e._packedTranslucentDepth&&!e._packedTranslucentDepth.isDestroyed()&&e._packedTranslucentDepth.destroy()}function destroyFramebuffers(e){e._drawClassificationFBO=e._drawClassificationFBO&&!e._drawClassificationFBO.isDestroyed()&&e._drawClassificationFBO.destroy(),e._accumulationFBO=e._accumulationFBO&&!e._accumulationFBO.isDestroyed()&&e._accumulationFBO.destroy(),e._packFBO=e._packFBO&&!e._packFBO.isDestroyed()&&e._packFBO.destroy()}function rgbaTexture(e,t,i){return new Texture({context:e,width:t,height:i,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST})}function updateTextures(e,t,i,r){destroyTextures(e),e._colorTexture=rgbaTexture(t,i,r),e._accumulationTexture=rgbaTexture(t,i,r),e._translucentDepthStencilTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:Sampler.NEAREST}),e._packedTranslucentDepth=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST})}function updateFramebuffers$1(e,t){destroyFramebuffers(e),e._drawClassificationFBO=new Framebuffer({context:t,colorTextures:[e._colorTexture],depthStencilTexture:e._translucentDepthStencilTexture,destroyAttachments:!1}),e._accumulationFBO=new Framebuffer({context:t,colorTextures:[e._accumulationTexture],depthStencilTexture:e._translucentDepthStencilTexture,destroyAttachments:!1}),e._packFBO=new Framebuffer({context:t,colorTextures:[e._packedTranslucentDepth],destroyAttachments:!1})}function updateResources(e,t,i,r){if(e.isSupported()){e._opaqueDepthStencilTexture=r.depthStencilTexture;var n,a,o=e._opaqueDepthStencilTexture.width,s=e._opaqueDepthStencilTexture.height,l=e._colorTexture,c=!defined(l)||l.width!==o||l.height!==s;if(c&&updateTextures(e,t,o,s),defined(e._drawClassificationFBO)&&!c||updateFramebuffers$1(e,t),defined(e._packDepthCommand)||(n=new ShaderSource({sources:[CompareAndPackTranslucentDepth]}),a={u_opaqueDepthTexture:function(){return e._opaqueDepthStencilTexture},u_translucentDepthTexture:function(){return e._translucentDepthStencilTexture}},e._packDepthCommand=t.createViewportQuadCommand(n,{uniformMap:a,owner:e})),!defined(e._compositeCommand)){n=new ShaderSource({sources:[CompositeTranslucentClassification]}),a={colorTexture:function(){return e._textureToComposite}},e._compositeCommand=t.createViewportQuadCommand(n,{uniformMap:a,owner:e});var u=e._compositeCommand,d=u.shaderProgram,h=t.shaderCache.createDerivedShaderProgram(d,"pick",{vertexShaderSource:d.vertexShaderSource,fragmentShaderSource:new ShaderSource({sources:n.sources,defines:["PICK"]}),attributeLocations:d._attributeLocations}),p=DrawCommand.shallowClone(u);p.shaderProgram=h,u.derivedCommands.pick=p}defined(e._copyCommand)||(n=new ShaderSource({sources:[CompositeTranslucentClassification]}),a={colorTexture:function(){return e._colorTexture}},e._copyCommand=t.createViewportQuadCommand(n,{uniformMap:a,owner:e})),defined(e._accumulateCommand)||(n=new ShaderSource({sources:[CompositeTranslucentClassification]}),a={colorTexture:function(){return e._colorTexture}},e._accumulateCommand=t.createViewportQuadCommand(n,{uniformMap:a,owner:e})),e._viewport.width=o,e._viewport.height=s;var f=!BoundingRectangle.equals(e._viewport,i.viewport),m=f!==e._useScissorTest;e._useScissorTest=f,BoundingRectangle.equals(e._scissorRectangle,i.viewport)||(e._scissorRectangle=BoundingRectangle.clone(i.viewport,e._scissorRectangle),m=!0),defined(e._rsDepth)&&BoundingRectangle.equals(e._viewport,e._rsDepth.viewport)&&!m||(e._rsDepth=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),defined(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),defined(e._rsAccumulate)&&BoundingRectangle.equals(e._viewport,e._rsAccumulate.viewport)&&!m||(e._rsAccumulate=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:StencilFunction$1.EQUAL,reference:StencilConstants$1.CESIUM_3D_TILE_MASK}})),defined(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),defined(e._rsComp)&&BoundingRectangle.equals(e._viewport,e._rsComp.viewport)&&!m||(e._rsComp=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:BlendingState$1.ALPHA_BLEND})),defined(e._compositeCommand)&&(e._compositeCommand.renderState=e._rsComp,e._compositeCommand.derivedCommands.pick.renderState=e._rsComp)}}function clear(e,t,i){if(e._hasTranslucentDepth){var r=i.framebuffer;i.framebuffer=e._drawClassificationFBO,e._clearColorCommand.execute(t._context,i),i.framebuffer=r,e._frustumsDrawn>1&&(i.framebuffer=e._accumulationFBO,e._clearColorCommand.execute(t._context,i)),e._hasTranslucentDepth=!1,e._frustumsDrawn=0}}function CommandExtent(){this.command=void 0,this.near=void 0,this.far=void 0}function View(e,t,i){var r,n,a=e.context;a.depthTexture&&(r=new GlobeDepth),e._useOIT&&a.depthTexture&&(n=new OIT(a));var o=new PassState(a);o.viewport=BoundingRectangle.clone(i),this.camera=t,this._cameraClone=Camera.clone(t),this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.viewport=i,this.passState=o,this.pickFramebuffer=new PickFramebuffer(a),this.pickDepthFramebuffer=new PickDepthFramebuffer,this.sceneFramebuffer=new SceneFramebuffer,this.globeDepth=r,this.globeTranslucencyFramebuffer=new GlobeTranslucencyFramebuffer,this.oit=n,this.translucentTileClassification=new TranslucentTileClassification(a),this.pickDepths=[],this.frustumCommandsList=[],this.debugFrustumStatistics=void 0,this._commandExtents=[]}Object.defineProperties(TranslucentTileClassification.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}}),TranslucentTileClassification.prototype.executeTranslucentCommands=function(e,t,i,r,n){var a,o,s=r.length,l=e.frameState.useLogDepth,c=e.context,u=i.framebuffer;for(o=0;o<s;++o)if(a=r[o],(a=l?a.derivedCommands.logDepth.command:a).depthForTranslucentClassification){this._hasTranslucentDepth=!0;break}if(this._hasTranslucentDepth){for(updateResources(this,c,i,n),i.framebuffer=this._drawClassificationFBO,this._clearDepthStencilCommand.execute(c,i),o=0;o<s;++o){if(a=r[o],(a=l?a.derivedCommands.logDepth.command:a).depthForTranslucentClassification)t(a.derivedCommands.depth.depthOnlyCommand,e,c,i)}this._frustumsDrawn+=this._hasTranslucentDepth?1:0,this._hasTranslucentDepth&&(i.framebuffer=this._packFBO,this._packDepthCommand.execute(c,i)),i.framebuffer=u}},TranslucentTileClassification.prototype.executeClassificationCommands=function(e,t,i,r){if(this._hasTranslucentDepth){var n=e.context,a=n.uniformState,o=i.framebuffer;2===this._frustumsDrawn&&(i.framebuffer=this._accumulationFBO,this._copyCommand.execute(n,i)),i.framebuffer=this._drawClassificationFBO,this._frustumsDrawn>1&&this._clearColorCommand.execute(n,i),a.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION);var s=a.globeDepthTexture;a.globeDepthTexture=this._packedTranslucentDepth;for(var l=r.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],c=r.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],u=0;u<c;++u)t(l[u],e,n,i);a.globeDepthTexture=s,i.framebuffer=o,1!==this._frustumsDrawn&&(i.framebuffer=this._accumulationFBO,this._accumulateCommand.execute(n,i),i.framebuffer=o)}},TranslucentTileClassification.prototype.execute=function(e,t){this._hasTranslucentDepth&&(1===this._frustumsDrawn?this._textureToComposite=this._colorTexture:this._textureToComposite=this._accumulationTexture,(e.frameState.passes.pick?this._compositeCommand.derivedCommands.pick:this._compositeCommand).execute(e.context,t),clear(this,e,t))},TranslucentTileClassification.prototype.isSupported=function(){return this._supported},TranslucentTileClassification.prototype.isDestroyed=function(){return!1},TranslucentTileClassification.prototype.destroy=function(){return destroyTextures(this),destroyFramebuffers(this),defined(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),defined(this._packDepthCommand)&&(this._packDepthCommand.shaderProgram=this._packDepthCommand.shaderProgram&&this._packDepthCommand.shaderProgram.destroy()),destroyObject(this)};var scratchPosition0=new Cartesian3,scratchPosition1=new Cartesian3;function maxComponent(e,t){var i=Math.max(Math.abs(e.x),Math.abs(t.x)),r=Math.max(Math.abs(e.y),Math.abs(t.y)),n=Math.max(Math.abs(e.z),Math.abs(t.z));return Math.max(Math.max(i,r),n)}function cameraEqual(e,t,i){var r=1/Math.max(1,maxComponent(e.position,t.position));return Cartesian3.multiplyByScalar(e.position,r,scratchPosition0),Cartesian3.multiplyByScalar(t.position,r,scratchPosition1),Cartesian3.equalsEpsilon(scratchPosition0,scratchPosition1,i)&&Cartesian3.equalsEpsilon(e.direction,t.direction,i)&&Cartesian3.equalsEpsilon(e.up,t.up,i)&&Cartesian3.equalsEpsilon(e.right,t.right,i)&&Matrix4.equalsEpsilon(e.transform,t.transform,i)&&e.frustum.equalsEpsilon(t.frustum,i)}function updateFrustums(e,t,i,r){var n,a=t.frameState,o=a.camera,s=a.useLogDepth?t.logarithmicDepthFarToNearRatio:t.farToNearRatio,l=t.mode===SceneMode$1.SCENE2D,c=t.nearToFarDistance2D;r*=1+CesiumMath.EPSILON2,i=Math.min(Math.max(i,o.frustum.near),o.frustum.far),r=Math.max(Math.min(r,o.frustum.far),i),l?(r=Math.min(r,o.position.z+t.nearToFarDistance2D),i=Math.min(i,r),n=Math.ceil(Math.max(1,r-i)/t.nearToFarDistance2D)):n=Math.ceil(Math.log(r/i)/Math.log(s));var u=e.frustumCommandsList;u.length=n;for(var d=0;d<n;++d){var h,p;l?(h=Math.min(r-c,i+d*c),p=Math.min(r,h+c)):(h=Math.max(i,Math.pow(s,d)*i),p=Math.min(r,s*h));var f=u[d];defined(f)?(f.near=h,f.far=p):f=u[d]=new FrustumCommands(h,p)}}function insertIntoBin(e,t,i,r,n){t.debugShowFrustums&&(i.debugOverlappingFrustums=0);for(var a=e.frustumCommandsList,o=a.length,s=0;s<o;++s){var l=a[s],c=l.near;if(!(r>l.far)){if(n<c)break;var u=i.pass,d=l.indices[u]++;if(l.commands[u][d]=i,t.debugShowFrustums&&(i.debugOverlappingFrustums|=1<<s),i.executeInClosestFrustum)break}}if(t.debugShowFrustums){var h=e.debugFrustumStatistics.commandsInFrustums;h[i.debugOverlappingFrustums]=defined(h[i.debugOverlappingFrustums])?h[i.debugOverlappingFrustums]+1:1,++e.debugFrustumStatistics.totalCommands}t.updateDerivedCommands(i)}View.prototype.checkForCameraUpdates=function(e){var t=this.camera,i=this._cameraClone;return cameraEqual(t,i,CesiumMath.EPSILON15)?(this._cameraStartFired&&getTimestamp$1()-this._cameraMovedTime>e.cameraEventWaitTime&&(t.moveEnd.raiseEvent(),this._cameraStartFired=!1),!1):(this._cameraStartFired||(t.moveStart.raiseEvent(),this._cameraStartFired=!0),this._cameraMovedTime=getTimestamp$1(),Camera.clone(t,i),!0)};var scratchCullingVolume$1=new CullingVolume,scratchNearFarInterval=new Interval;View.prototype.createPotentiallyVisibleSet=function(e){var t=e.frameState,i=t.camera,r=i.directionWC,n=i.positionWC,a=e._computeCommandList,o=e._overlayCommandList,s=t.commandList;e.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});for(var l=this.frustumCommandsList,c=l.length,u=Pass$1.NUMBER_OF_PASSES,d=0;d<c;++d)for(var h=0;h<u;++h)l[d].indices[h]=0;a.length=0,o.length=0;for(var p=this._commandExtents,f=p.length,m=0,g=+Number.MAX_VALUE,_=-Number.MAX_VALUE,y=t.shadowState.shadowsEnabled,v=+Number.MAX_VALUE,C=-Number.MAX_VALUE,T=Number.MAX_VALUE,S=t.mode===SceneMode$1.SCENE3D?t.occluder:void 0,A=t.cullingVolume,x=scratchCullingVolume$1.planes,E=0;E<5;++E)x[E]=A.planes[E];A=scratchCullingVolume$1;for(var b,P,D=s.length,w=0;w<D;++w){var M=s[w],I=M.pass;if(I===Pass$1.COMPUTE)a.push(M);else if(I===Pass$1.OVERLAY)o.push(M);else{var R,O,B=M.boundingVolume;if(defined(B)){if(!e.isVisible(M,A,S))continue;var L=B.computePlaneDistances(n,r,scratchNearFarInterval);if(R=L.start,O=L.stop,g=Math.min(g,R),_=Math.max(_,O),y&&M.receiveShadows&&R<ShadowMap.MAXIMUM_DISTANCE&&!(I===Pass$1.GLOBE&&R<-100&&O>100)){var F=O-R;I!==Pass$1.GLOBE&&R<100&&(T=Math.min(T,F)),v=Math.min(v,R),C=Math.max(C,O)}}else M instanceof ClearCommand?(R=i.frustum.near,O=i.frustum.far):(R=i.frustum.near,O=i.frustum.far,g=Math.min(g,R),_=Math.max(_,O));var N=p[m];defined(N)||(N=p[m]=new CommandExtent),N.command=M,N.near=R,N.far=O,m++}}for(y&&(v=Math.min(Math.max(v,i.frustum.near),i.frustum.far),C=Math.max(Math.min(C,i.frustum.far),v)),y&&(t.shadowState.nearPlane=v,t.shadowState.farPlane=C,t.shadowState.closestObjectSize=T),updateFrustums(this,e,g,_),b=0;b<m;b++)insertIntoBin(this,e,(P=p[b]).command,P.near,P.far);if(m<f)for(b=m;b<f&&defined((P=p[b]).command);b++)P.command=void 0;var V=l.length,k=t.frustumSplits;k.length=V+1;for(var U=0;U<V;++U)k[U]=l[U].near,U===V-1&&(k[U+1]=l[U].far)},View.prototype.destroy=function(){var e,t;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();var i=this.pickDepths;for(t=i.length,e=0;e<t;++e)i[e].destroy()};var offscreenDefaultWidth=.1,mostDetailedPreloadTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.MOST_DETAILED_PRELOAD}),mostDetailedPickTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.MOST_DETAILED_PICK}),pickTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.PICK});function Picking(e){this._mostDetailedRayPicks=[],this.pickRenderStateCache={},this._pickPositionCache={},this._pickPositionCacheDirty=!1;var t=new BoundingRectangle(0,0,1,1),i=new Camera(e);i.frustum=new OrthographicFrustum({width:offscreenDefaultWidth,aspectRatio:1,near:.1}),this._pickOffscreenView=new View(e,i,t)}Picking.prototype.update=function(){this._pickPositionCacheDirty=!0},Picking.prototype.getPickDepth=function(e,t){var i=e.view.pickDepths,r=i[t];return defined(r)||(r=new PickDepth,i[t]=r),r};var scratchOrthoPickingFrustum=new OrthographicOffCenterFrustum,scratchOrthoOrigin=new Cartesian3,scratchOrthoDirection=new Cartesian3,scratchOrthoPixelSize=new Cartesian2,scratchOrthoPickVolumeMatrix4=new Matrix4;function getPickOrthographicCullingVolume(e,t,i,r,n){var a=e.camera,o=a.frustum;defined(o._offCenterFrustum)&&(o=o._offCenterFrustum);var s=2*(t.x-n.x)/n.width-1;s*=.5*(o.right-o.left);var l=2*(n.height-t.y-n.y)/n.height-1;l*=.5*(o.top-o.bottom);var c=Matrix4.clone(a.transform,scratchOrthoPickVolumeMatrix4);a._setTransform(Matrix4.IDENTITY);var u=Cartesian3.clone(a.position,scratchOrthoOrigin);Cartesian3.multiplyByScalar(a.right,s,scratchOrthoDirection),Cartesian3.add(scratchOrthoDirection,u,u),Cartesian3.multiplyByScalar(a.up,l,scratchOrthoDirection),Cartesian3.add(scratchOrthoDirection,u,u),a._setTransform(c),e.mode===SceneMode$1.SCENE2D&&Cartesian3.fromElements(u.z,u.x,u.y,u);var d=o.getPixelDimensions(n.width,n.height,1,1,scratchOrthoPixelSize),h=scratchOrthoPickingFrustum;return h.right=.5*d.x,h.left=-h.right,h.top=.5*d.y,h.bottom=-h.top,h.near=o.near,h.far=o.far,h.computeCullingVolume(u,a.directionWC,a.upWC)}var scratchPerspPickingFrustum=new PerspectiveOffCenterFrustum,scratchPerspPixelSize=new Cartesian2;function getPickPerspectiveCullingVolume(e,t,i,r,n){var a=e.camera,o=a.frustum,s=o.near,l=Math.tan(.5*o.fovy),c=o.aspectRatio*l,u=(2*(t.x-n.x)/n.width-1)*s*c,d=(2*(n.height-t.y-n.y)/n.height-1)*s*l,h=o.getPixelDimensions(n.width,n.height,1,1,scratchPerspPixelSize),p=h.x*i*.5,f=h.y*r*.5,m=scratchPerspPickingFrustum;return m.top=d+f,m.bottom=d-f,m.right=u+p,m.left=u-p,m.near=s,m.far=o.far,m.computeCullingVolume(a.positionWC,a.directionWC,a.upWC)}function getPickCullingVolume(e,t,i,r,n){var a=e.camera.frustum;return a instanceof OrthographicFrustum||a instanceof OrthographicOffCenterFrustum?getPickOrthographicCullingVolume(e,t,i,r,n):getPickPerspectiveCullingVolume(e,t,i,r,n)}var scratchRectangleWidth=3,scratchRectangleHeight=3,scratchRectangle=new BoundingRectangle(0,0,scratchRectangleWidth,scratchRectangleHeight),scratchPosition$1=new Cartesian2,scratchColorZero=new Color(0,0,0,0);function renderTranslucentDepthForPick(e,t){var i=e.context,r=e.frameState,n=e.environmentState,a=e.defaultView;e.view=a;var o=a.viewport;o.x=0,o.y=0,o.width=i.drawingBufferWidth,o.height=i.drawingBufferHeight;var s=a.passState;s.viewport=BoundingRectangle.clone(o,s.viewport),e.clearPasses(r.passes),r.passes.pick=!0,r.passes.depth=!0,r.cullingVolume=getPickCullingVolume(e,t,1,1,o),r.tilesetPassState=pickTilesetPassState,e.updateEnvironment(),n.renderTranslucentDepthForPick=!0,s=a.pickDepthFramebuffer.update(i,t,o),e.updateAndExecuteCommands(s,scratchColorZero),e.resolveFramebuffers(s),i.endFrame()}Picking.prototype.pick=function(e,t,i,r){scratchRectangleWidth=defaultValue(i,3),scratchRectangleHeight=defaultValue(r,scratchRectangleWidth);var n=e.context,a=n.uniformState,o=e.frameState,s=e.defaultView;e.view=s;var l=s.viewport;l.x=0,l.y=0,l.width=n.drawingBufferWidth,l.height=n.drawingBufferHeight;var c=s.passState;c.viewport=BoundingRectangle.clone(l,c.viewport);var u=SceneTransforms.transformWindowToDrawingBuffer(e,t,scratchPosition$1);e.jobScheduler.disableThisFrame(),e.updateFrameState(),o.cullingVolume=getPickCullingVolume(e,u,scratchRectangleWidth,scratchRectangleHeight,l),o.invertClassification=!1,o.passes.pick=!0,o.tilesetPassState=pickTilesetPassState,a.update(o),e.updateEnvironment(),scratchRectangle.x=u.x-.5*(scratchRectangleWidth-1),scratchRectangle.y=e.drawingBufferHeight-u.y-.5*(scratchRectangleHeight-1),scratchRectangle.width=scratchRectangleWidth,scratchRectangle.height=scratchRectangleHeight,c=s.pickFramebuffer.begin(scratchRectangle,s.viewport),e.updateAndExecuteCommandszh(c,scratchColorZero),e.resolveFramebuffers(c);var d=s.pickFramebuffer.end(scratchRectangle);return n.endFrame(),d};var scratchPerspectiveFrustum$1=new PerspectiveFrustum,scratchPerspectiveOffCenterFrustum$1=new PerspectiveOffCenterFrustum,scratchOrthographicFrustum$1=new OrthographicFrustum,scratchOrthographicOffCenterFrustum$1=new OrthographicOffCenterFrustum;Picking.prototype.pickPositionWorldCoordinates=function(e,t,i){if(e.useDepthPicking){var r=t.toString();if(this._pickPositionCacheDirty)this._pickPositionCache={},this._pickPositionCacheDirty=!1;else if(this._pickPositionCache.hasOwnProperty(r))return Cartesian3.clone(this._pickPositionCache[r],i);var n=e.frameState,a=e.context,o=a.uniformState,s=e.defaultView;e.view=s;var l=SceneTransforms.transformWindowToDrawingBuffer(e,t,scratchPosition$1);e.pickTranslucentDepth?renderTranslucentDepthForPick(e,l):(e.updateFrameState(),o.update(n),e.updateEnvironment()),l.y=e.drawingBufferHeight-l.y;var c,u=e.camera;c=defined(u.frustum.fov)?u.frustum.clone(scratchPerspectiveFrustum$1):defined(u.frustum.infiniteProjectionMatrix)?u.frustum.clone(scratchPerspectiveOffCenterFrustum$1):defined(u.frustum.width)?u.frustum.clone(scratchOrthographicFrustum$1):u.frustum.clone(scratchOrthographicOffCenterFrustum$1);for(var d=s.frustumCommandsList,h=d.length,p=0;p<h;++p){var f=this.getPickDepth(e,p).getDepth(a,l.x,l.y);if(defined(f)&&(f>0&&f<1)){var m,g=d[p];return e.mode===SceneMode$1.SCENE2D?(m=u.position.z,u.position.z=m-g.near+1,c.far=Math.max(1,g.far-g.near),c.near=1,o.update(n),o.updateFrustum(c)):(c.near=g.near*(0!==p?e.opaqueFrustumNearOffset:1),c.far=g.far,o.updateFrustum(c)),i=SceneTransforms.drawingBufferToWgs84Coordinates(e,l,f,i),e.mode===SceneMode$1.SCENE2D&&(u.position.z=m,o.update(n)),this._pickPositionCache[r]=Cartesian3.clone(i),i}}this._pickPositionCache[r]=void 0}};var scratchPickPositionCartographic=new Cartographic;function drillPick(e,t){var i,r,n=[],a=[],o=[],s=[];defined(e)||(e=Number.MAX_VALUE);for(var l=t();defined(l);){var c=l.object,u=l.position,d=l.exclude;if(defined(u)&&!defined(c)){n.push(l);break}if(!defined(c)||!defined(c.primitive))break;if(!d&&(n.push(l),0>=--e))break;var h=c.primitive,p=!1;"function"==typeof h.getGeometryInstanceAttributes&&defined(c.id)&&defined(r=h.getGeometryInstanceAttributes(c.id))&&defined(r.show)&&(p=!0,r.show=ShowGeometryInstanceAttribute.toValue(!1,r.show),o.push(r)),c instanceof Cesium3DTileFeature&&(p=!0,c.show=!1,s.push(c)),p||(h.show=!1,a.push(h)),l=t()}for(i=0;i<a.length;++i)a[i].show=!0;for(i=0;i<o.length;++i)(r=o[i]).show=ShowGeometryInstanceAttribute.toValue(!0,r.show);for(i=0;i<s.length;++i)s[i].show=!0;return n}Picking.prototype.pickPosition=function(e,t,i){if(defined(i=this.pickPositionWorldCoordinates(e,t,i))&&e.mode!==SceneMode$1.SCENE3D){Cartesian3.fromElements(i.y,i.z,i.x,i);var r=e.mapProjection,n=r.ellipsoid,a=r.unproject(i,scratchPickPositionCartographic);n.cartographicToCartesian(a,i)}return i},Picking.prototype.drillPick=function(e,t,i,r,n){var a=this,o=drillPick(i,(function(){var i=a.pick(e,t,r,n);if(defined(i))return{object:i,position:void 0,exclude:!1}}));return o.map((function(e){return e.object}))};var scratchRight=new Cartesian3,scratchUp=new Cartesian3;function MostDetailedRayPick(e,t,i){this.ray=e,this.width=t,this.tilesets=i,this.ready=!1,this.deferred=when.defer(),this.promise=this.deferred.promise}function updateOffscreenCameraFromRay(e,t,i,r){var n=t.direction,a=Cartesian3.mostOrthogonalAxis(n,scratchRight),o=Cartesian3.cross(n,a,scratchRight),s=Cartesian3.cross(n,o,scratchUp);return r.position=t.origin,r.direction=n,r.up=s,r.right=o,r.frustum.width=defaultValue(i,offscreenDefaultWidth),r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC)}function updateMostDetailedRayPick(e,t,i){var r=t.frameState,n=i.ray,a=i.width,o=i.tilesets,s=e._pickOffscreenView.camera,l=updateOffscreenCameraFromRay(e,n,a,s),c=mostDetailedPreloadTilesetPassState;c.camera=s,c.cullingVolume=l;for(var u=!0,d=o.length,h=0;h<d;++h){var p=o[h];p.show&&t.primitives.contains(p)&&(p.updateForPass(r,c),u=u&&c.ready)}return u&&i.deferred.resolve(),u}function getTilesets(e,t,i){for(var r=e.length,n=0;n<r;++n){var a=e.get(n);a.show&&(defined(a.isCesium3DTileset)?defined(t)&&-1!==t.indexOf(a)||i.push(a):a instanceof PrimitiveCollection&&getTilesets(a,t,i))}}function launchMostDetailedRayPick(e,t,i,r,n,a){var o=[];if(getTilesets(t.primitives,r,o),0===o.length)return when.resolve(a());var s=new MostDetailedRayPick(i,n,o);return e._mostDetailedRayPicks.push(s),s.promise.then((function(){return a()}))}function isExcluded(e,t){return!(!defined(e)||!defined(t)||0===t.length)&&(t.indexOf(e)>-1||t.indexOf(e.primitive)>-1||t.indexOf(e.id)>-1)}function getRayIntersection(e,t,i,r,n,a,o){var s=t.context,l=s.uniformState,c=t.frameState,u=e._pickOffscreenView;t.view=u,updateOffscreenCameraFromRay(e,i,n,u.camera),scratchRectangle=BoundingRectangle.clone(u.viewport,scratchRectangle);var d,h=u.pickFramebuffer.begin(scratchRectangle,u.viewport);t.jobScheduler.disableThisFrame(),t.updateFrameState(),c.invertClassification=!1,c.passes.pick=!0,c.passes.offscreen=!0,c.tilesetPassState=o?mostDetailedPickTilesetPassState:pickTilesetPassState,l.update(c),t.updateEnvironment(),t.updateAndExecuteCommands(h,scratchColorZero),t.resolveFramebuffers(h);var p=u.pickFramebuffer.end(scratchRectangle);if(t.context.depthTexture)for(var f=u.frustumCommandsList.length,m=0;m<f;++m){var g=e.getPickDepth(t,m).getDepth(s,0,0);if(defined(g)&&(g>0&&g<1)){var _=u.frustumCommandsList[m],y=_.near*(0!==m?t.opaqueFrustumNearOffset:1),v=y+g*(_.far-y);d=Ray.getPoint(i,v);break}}if(t.view=t.defaultView,s.endFrame(),defined(p)||defined(d))return{object:p,position:d,exclude:!defined(d)&&a||isExcluded(p,r)}}function getRayIntersections(e,t,i,r,n,a,o,s){return drillPick(r,(function(){return getRayIntersection(e,t,i,n,a,o,s)}))}function pickFromRay(e,t,i,r,n,a,o){var s=getRayIntersections(e,t,i,1,r,n,a,o);if(s.length>0)return s[0]}function drillPickFromRay(e,t,i,r,n,a,o,s){return getRayIntersections(e,t,i,r,n,a,o,s)}function deferPromiseUntilPostRender(e,t){var i=when.defer();return t.then((function(t){var r=e.postRender.addEventListener((function(){i.resolve(t),r()}));e.requestRender()})).otherwise((function(e){i.reject(e)})),i.promise}Picking.prototype.updateMostDetailedRayPicks=function(e){for(var t=this._mostDetailedRayPicks,i=0;i<t.length;++i)updateMostDetailedRayPick(this,e,t[i])&&t.splice(i--,1)},Picking.prototype.pickFromRay=function(e,t,i,r){return pickFromRay(this,e,t,i,r,!1,!1)},Picking.prototype.drillPickFromRay=function(e,t,i,r,n){return drillPickFromRay(this,e,t,i,r,n,!1,!1)},Picking.prototype.pickFromRayMostDetailed=function(e,t,i,r){var n=this;return t=Ray.clone(t),i=defined(i)?i.slice():i,deferPromiseUntilPostRender(e,launchMostDetailedRayPick(n,e,t,i,r,(function(){return pickFromRay(n,e,t,i,r,!1,!0)})))},Picking.prototype.drillPickFromRayMostDetailed=function(e,t,i,r,n){var a=this;return t=Ray.clone(t),r=defined(r)?r.slice():r,deferPromiseUntilPostRender(e,launchMostDetailedRayPick(a,e,t,r,n,(function(){return drillPickFromRay(a,e,t,i,r,n,!1,!0)})))};var scratchSurfacePosition=new Cartesian3,scratchSurfaceNormal$1=new Cartesian3,scratchSurfaceRay=new Ray,scratchCartographic$2=new Cartographic;function getRayForSampleHeight(e,t){var i=e.globe,r=defined(i)?i.ellipsoid:e.mapProjection.ellipsoid,n=ApproximateTerrainHeights._defaultMaxTerrainHeight,a=r.geodeticSurfaceNormalCartographic(t,scratchSurfaceNormal$1),o=Cartographic.toCartesian(t,r,scratchSurfacePosition),s=scratchSurfaceRay;s.origin=o,s.direction=a;var l=new Ray;return Ray.getPoint(s,n,l.origin),Cartesian3.negate(a,l.direction),l}function getRayForClampToHeight(e,t){var i=e.globe,r=defined(i)?i.ellipsoid:e.mapProjection.ellipsoid;return getRayForSampleHeight(e,Cartographic.fromCartesian(t,r,scratchCartographic$2))}function getHeightFromCartesian(e,t){var i=e.globe,r=defined(i)?i.ellipsoid:e.mapProjection.ellipsoid;return Cartographic.fromCartesian(t,r,scratchCartographic$2).height}function sampleHeightMostDetailed(e,t,i,r,n){var a=getRayForSampleHeight(t,i);return launchMostDetailedRayPick(e,t,a,r,n,(function(){var i=pickFromRay(e,t,a,r,n,!0,!0);if(defined(i))return getHeightFromCartesian(t,i.position)}))}function clampToHeightMostDetailed(e,t,i,r,n,a){var o=getRayForClampToHeight(t,i);return launchMostDetailedRayPick(e,t,o,r,n,(function(){var i=pickFromRay(e,t,o,r,n,!0,!0);if(defined(i))return Cartesian3.clone(i.position,a)}))}Picking.prototype.sampleHeight=function(e,t,i,r){var n=pickFromRay(this,e,getRayForSampleHeight(e,t),i,r,!0,!1);if(defined(n))return getHeightFromCartesian(e,n.position)},Picking.prototype.clampToHeight=function(e,t,i,r,n){var a=pickFromRay(this,e,getRayForClampToHeight(e,t),i,r,!0,!1);if(defined(a))return Cartesian3.clone(a.position,n)},Picking.prototype.sampleHeightMostDetailed=function(e,t,i,r){i=defined(i)?i.slice():i;for(var n=t.length,a=new Array(n),o=0;o<n;++o)a[o]=sampleHeightMostDetailed(this,e,t[o],i,r);return deferPromiseUntilPostRender(e,when.all(a).then((function(e){for(var i=e.length,r=0;r<i;++r)t[r].height=e[r];return t})))},Picking.prototype.clampToHeightMostDetailed=function(e,t,i,r){i=defined(i)?i.slice():i;for(var n=t.length,a=new Array(n),o=0;o<n;++o)a[o]=clampToHeightMostDetailed(this,e,t[o],i,r,t[o]);return deferPromiseUntilPostRender(e,when.all(a).then((function(e){for(var i=e.length,r=0;r<i;++r)t[r]=e[r];return t})))},Picking.prototype.destroy=function(){this._pickOffscreenView=this._pickOffscreenView&&this._pickOffscreenView.destroy()};var PostProcessStageSampleMode={NEAREST:0,LINEAR:1};function PostProcessStage(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).fragmentShader,i=defaultValue(e.textureScale,1),r=defaultValue(e.pixelFormat,PixelFormat$1.RGBA);this._fragmentShader=t,this._uniforms=e.uniforms,this._textureScale=i,this._forcePowerOfTwo=defaultValue(e.forcePowerOfTwo,!1),this._sampleMode=defaultValue(e.sampleMode,PostProcessStageSampleMode.NEAREST),this._pixelFormat=r,this._pixelDatatype=defaultValue(e.pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE),this._clearColor=defaultValue(e.clearColor,Color.BLACK),this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._idTexture=void 0,this._actualUniforms={},this._dirtyUniforms=[],this._texturesToRelease=[],this._texturesToCreate=[],this._texturePromise=void 0;var n=new PassState;n.scissorTest={enabled:!0,rectangle:defined(e.scissorRectangle)?BoundingRectangle.clone(e.scissorRectangle):new BoundingRectangle},this._passState=n,this._ready=!1;var a=e.name;defined(a)||(a=createGuid()),this._name=a,this._logDepthChanged=void 0,this._useLogDepth=void 0,this._selectedIdTexture=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0,this._textureCache=void 0,this._index=void 0,this.enabled=!0,this._enabled=!0}Object.defineProperties(PostProcessStage.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},fragmentShader:{get:function(){return this._fragmentShader}},uniforms:{get:function(){return this._uniforms}},textureScale:{get:function(){return this._textureScale}},forcePowerOfTwo:{get:function(){return this._forcePowerOfTwo}},sampleMode:{get:function(){return this._sampleMode}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},clearColor:{get:function(){return this._clearColor}},scissorRectangle:{get:function(){return this._passState.scissorTest.rectangle}},outputTexture:{get:function(){if(defined(this._textureCache)){var e=this._textureCache.getFramebuffer(this._name);if(defined(e))return e.getColorTexture(0)}}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}});var depthTextureRegex=/uniform\s+sampler2D\s+depthTexture/g;function getUniformValueGetterAndSetter(e,t,i){var r=t[i];return("string"==typeof r||r instanceof HTMLCanvasElement||r instanceof HTMLImageElement||r instanceof HTMLVideoElement||r instanceof ImageData)&&e._dirtyUniforms.push(i),{get:function(){return t[i]},set:function(r){var n=t[i];t[i]=r;var a=e._actualUniforms,o=a[i];defined(o)&&o!==n&&o instanceof Texture&&!defined(e._textureCache.getStageByName(i))&&(e._texturesToRelease.push(o),delete a[i],delete a[i+"Dimensions"]),n instanceof Texture&&e._texturesToRelease.push(n),"string"==typeof r||r instanceof HTMLCanvasElement||r instanceof HTMLImageElement||r instanceof HTMLVideoElement||r instanceof ImageData?e._dirtyUniforms.push(i):a[i]=r}}}function getUniformMapFunction(e,t){return function(){var i=e._actualUniforms[t];return"function"==typeof i?i():i}}function getUniformMapDimensionsFunction(e,t){return function(){var i=e[t]();if(defined(i))return i.dimensions}}function createUniformMap(e){if(!defined(e._uniformMap)){var t={},i={},r=e._uniforms,n=e._actualUniforms;for(var a in r)if(r.hasOwnProperty(a)){"function"!=typeof r[a]?(t[a]=getUniformMapFunction(e,a),i[a]=getUniformValueGetterAndSetter(e,r,a)):(t[a]=r[a],i[a]=r[a]),n[a]=r[a];var o=t[a]();("string"==typeof o||o instanceof Texture||o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement)&&(t[a+"Dimensions"]=getUniformMapDimensionsFunction(t,a))}e._uniforms={},Object.defineProperties(e._uniforms,i),e._uniformMap=combine$2(t,{colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions},depthTexture:function(){return e._depthTexture},depthTextureDimensions:function(){return e._depthTexture.dimensions},czm_idTexture:function(){return e._idTexture},czm_selectedIdTexture:function(){return e._selectedIdTexture},czm_selectedIdTextureStep:function(){return 1/e._selectedIdTexture.width}})}}function createDrawCommand(e,t){if(!defined(e._command)||e._logDepthChanged||e._selectedDirty){var i=e._fragmentShader;if(defined(e._selectedIdTexture))i="#define CZM_SELECTED_FEATURE \nuniform sampler2D czm_idTexture; \nuniform sampler2D czm_selectedIdTexture; \nuniform float czm_selectedIdTextureStep; \nvarying vec2 v_textureCoordinates; \nbool czm_selected(vec2 offset) \n{ \n bool selected = false;\n vec4 id = texture2D(czm_idTexture, v_textureCoordinates + offset); \n for (int i = 0; i < "+e._selectedIdTexture.width+"; ++i) \n { \n vec4 selectedId = texture2D(czm_selectedIdTexture, vec2((float(i) + 0.5) * czm_selectedIdTextureStep, 0.5)); \n if (all(equal(id, selectedId))) \n { \n return true; \n } \n } \n return false; \n} \n\nbool czm_selected() \n{ \n return czm_selected(vec2(0.0)); \n} \n\n"+(i=i.replace(/varying\s+vec2\s+v_textureCoordinates;/g,""));var r=new ShaderSource({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[i]});e._command=t.createViewportQuadCommand(r,{uniformMap:e._uniformMap,owner:e})}}function createSampler(e){var t,i;e._sampleMode===PostProcessStageSampleMode.LINEAR?(t=TextureMinificationFilter$1.LINEAR,i=TextureMagnificationFilter$1.LINEAR):(t=TextureMinificationFilter$1.NEAREST,i=TextureMagnificationFilter$1.NEAREST);var r=e._sampler;defined(r)&&r.minificationFilter===t&&r.magnificationFilter===i||(e._sampler=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:t,magnificationFilter:i}))}function createLoadImageFunction(e,t){return function(i){e._texturesToCreate.push({name:t,source:i})}}function createStageOutputTextureFunction(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function updateUniformTextures(e,t){var i,r,n,a=e._texturesToRelease,o=a.length;for(i=0;i<o;++i)r=(r=a[i])&&r.destroy();a.length=0;var s=e._texturesToCreate;for(o=s.length,i=0;i<o;++i){var l=s[i];n=l.name;var c=l.source;e._actualUniforms[n]=new Texture({context:t,source:c})}s.length=0;var u=e._dirtyUniforms;if(0!==u.length||defined(e._texturePromise)){if(0!==u.length&&!defined(e._texturePromise)){o=u.length;var d=e._uniforms,h=[];for(i=0;i<o;++i){var p=d[n=u[i]];if(defined(e._textureCache.getStageByName(p)))e._actualUniforms[n]=createStageOutputTextureFunction(e,p);else if("string"==typeof p){var f=new Resource({url:p});h.push(f.fetchImage().then(createLoadImageFunction(e,n)))}else e._texturesToCreate.push({name:n,source:p})}u.length=0,h.length>0?(e._ready=!1,e._texturePromise=when.all(h).then((function(){e._ready=!0,e._texturePromise=void 0}))):e._ready=!0}}else e._ready=!0}function releaseResources$1(e){defined(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0),e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy();var t=e._textureCache;if(defined(t)){var i=e._uniforms,r=e._actualUniforms;for(var n in r)r.hasOwnProperty(n)&&r[n]instanceof Texture&&(defined(t.getStageByName(i[n]))||r[n].destroy(),e._dirtyUniforms.push(n))}}function isSelectedTextureDirty$1(e){var t=defined(e._selected)?e._selected.length:0,i=defined(e._parentSelected)?e._parentSelected:0,r=e._selected!==e._selectedShadow||t!==e._selectedLength;if(r=r||e._parentSelected!==e._parentSelectedShadow||i!==e._parentSelectedLength,defined(e._selected)&&defined(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):defined(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!r&&defined(e._combinedSelected)){if(!defined(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(var n=0;n<t;++n)if(e._combinedSelected[n]!==e._combinedSelectedShadow[n])return!0}return r}function createSelectedTexture(e,t){if(e._selectedDirty){e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;var i=e._combinedSelected;if(defined(i)){var r,n,a,o=0,s=i.length;for(r=0;r<s;++r)defined((n=i[r]).pickIds)?o+=n.pickIds.length:defined(n.pickId)&&++o;if(0===s||0===o){var l=new Uint8Array(4);return l[0]=255,l[1]=255,l[2]=255,l[3]=255,void(e._selectedIdTexture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:l,width:1,height:1},sampler:Sampler.NEAREST}))}var c=0,u=new Uint8Array(4*o);for(r=0;r<s;++r)if(defined((n=i[r]).pickIds))for(var d=n.pickIds,h=d.length,p=0;p<h;++p)a=d[p].color,u[c]=Color.floatToByte(a.red),u[c+1]=Color.floatToByte(a.green),u[c+2]=Color.floatToByte(a.blue),u[c+3]=Color.floatToByte(a.alpha),c+=4;else defined(n.pickId)&&(a=n.pickId.color,u[c]=Color.floatToByte(a.red),u[c+1]=Color.floatToByte(a.green),u[c+2]=Color.floatToByte(a.blue),u[c+3]=Color.floatToByte(a.alpha),c+=4);e._selectedIdTexture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:u,width:o,height:1},sampler:Sampler.NEAREST})}}}PostProcessStage.prototype._isSupported=function(e){return!depthTextureRegex.test(this._fragmentShader)||e.depthTexture},PostProcessStage.prototype.update=function(e,t){if(this.enabled===this._enabled||this.enabled||releaseResources$1(this),this._enabled=this.enabled,this._enabled&&(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=isSelectedTextureDirty$1(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=defined(this._selected)?this._selected.length:0,this._parentSelectedLength=defined(this._parentSelected)?this._parentSelected.length:0,createSelectedTexture(this,e),createUniformMap(this),updateUniformTextures(this,e),createDrawCommand(this,e),createSampler(this),this._selectedDirty=!1,this._ready)){var i=this._textureCache.getFramebuffer(this._name);if(this._command.framebuffer=i,defined(i)){var r,n=i.getColorTexture(0);n.width===e.drawingBufferWidth&&n.height===e.drawingBufferHeight||defined(r=this._renderState)&&n.width===r.viewport.width&&n.height===r.viewport.height||(this._renderState=RenderState.fromCache({viewport:new BoundingRectangle(0,0,n.width,n.height)})),this._command.renderState=r}}},PostProcessStage.prototype.execute=function(e,t,i,r){if(defined(this._command)&&defined(this._command.framebuffer)&&this._ready&&this._enabled){this._colorTexture=t,this._depthTexture=i,this._idTexture=r,Sampler.equals(this._colorTexture.sampler,this._sampler)||(this._colorTexture.sampler=this._sampler);var n=this.scissorRectangle.width>0&&this.scissorRectangle.height>0?this._passState:void 0;defined(n)&&(n.context=e),this._command.execute(e,n)}},PostProcessStage.prototype.isDestroyed=function(){return!1},PostProcessStage.prototype.destroy=function(){return releaseResources$1(this),destroyObject(this)};var AcesTonemapping="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\ncolor /= texture2D(autoExposure, vec2(0.5)).r;\n#endif\ncolor = czm_acesTonemapping(color);\ncolor = czm_inverseGamma(color);\ngl_FragColor = vec4(color, fragmentColor.a);\n}\n",AmbientOcclusionGenerate="uniform sampler2D randomTexture;\nuniform sampler2D depthTexture;\nuniform float intensity;\nuniform float bias;\nuniform float lengthCap;\nuniform float stepSize;\nuniform float frustumLength;\nvarying vec2 v_textureCoordinates;\nvec4 clipToEye(vec2 uv, float depth)\n{\nvec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));\nvec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0);\nposEC = posEC / posEC.w;\nreturn posEC;\n}\nvec3 getNormalXEdge(vec3 posInCamera, float depthU, float depthD, float depthL, float depthR, vec2 pixelSize)\n{\nvec4 posInCameraUp = clipToEye(v_textureCoordinates - vec2(0.0, pixelSize.y), depthU);\nvec4 posInCameraDown = clipToEye(v_textureCoordinates + vec2(0.0, pixelSize.y), depthD);\nvec4 posInCameraLeft = clipToEye(v_textureCoordinates - vec2(pixelSize.x, 0.0), depthL);\nvec4 posInCameraRight = clipToEye(v_textureCoordinates + vec2(pixelSize.x, 0.0), depthR);\nvec3 up = posInCamera.xyz - posInCameraUp.xyz;\nvec3 down = posInCameraDown.xyz - posInCamera.xyz;\nvec3 left = posInCamera.xyz - posInCameraLeft.xyz;\nvec3 right = posInCameraRight.xyz - posInCamera.xyz;\nvec3 DX = length(left) < length(right) ? left : right;\nvec3 DY = length(up) < length(down) ? up : down;\nreturn normalize(cross(DY, DX));\n}\nvoid main(void)\n{\nfloat depth = czm_readDepth(depthTexture, v_textureCoordinates);\nvec4 posInCamera = clipToEye(v_textureCoordinates, depth);\nif (posInCamera.z > frustumLength)\n{\ngl_FragColor = vec4(1.0);\nreturn;\n}\nvec2 pixelSize = czm_pixelRatio / czm_viewport.zw;\nfloat depthU = czm_readDepth(depthTexture, v_textureCoordinates - vec2(0.0, pixelSize.y));\nfloat depthD = czm_readDepth(depthTexture, v_textureCoordinates + vec2(0.0, pixelSize.y));\nfloat depthL = czm_readDepth(depthTexture, v_textureCoordinates - vec2(pixelSize.x, 0.0));\nfloat depthR = czm_readDepth(depthTexture, v_textureCoordinates + vec2(pixelSize.x, 0.0));\nvec3 normalInCamera = getNormalXEdge(posInCamera.xyz, depthU, depthD, depthL, depthR, pixelSize);\nfloat ao = 0.0;\nvec2 sampleDirection = vec2(1.0, 0.0);\nfloat gapAngle = 90.0 * czm_radiansPerDegree;\nfloat randomVal = texture2D(randomTexture, v_textureCoordinates).x;\nfor (int i = 0; i < 4; i++)\n{\nfloat newGapAngle = gapAngle * (float(i) + randomVal);\nfloat cosVal = cos(newGapAngle);\nfloat sinVal = sin(newGapAngle);\nvec2 rotatedSampleDirection = vec2(cosVal * sampleDirection.x - sinVal * sampleDirection.y, sinVal * sampleDirection.x + cosVal * sampleDirection.y);\nfloat localAO = 0.0;\nfloat localStepSize = stepSize;\nfor (int j = 0; j < 6; j++)\n{\nvec2 newCoords = v_textureCoordinates + rotatedSampleDirection * localStepSize * pixelSize;\nif(newCoords.x > 1.0 || newCoords.y > 1.0 || newCoords.x < 0.0 || newCoords.y < 0.0)\n{\nbreak;\n}\nfloat stepDepthInfo = czm_readDepth(depthTexture, newCoords);\nvec4 stepPosInCamera = clipToEye(newCoords, stepDepthInfo);\nvec3 diffVec = stepPosInCamera.xyz - posInCamera.xyz;\nfloat len = length(diffVec);\nif (len > lengthCap)\n{\nbreak;\n}\nfloat dotVal = clamp(dot(normalInCamera, normalize(diffVec)), 0.0, 1.0 );\nfloat weight = len / lengthCap;\nweight = 1.0 - weight * weight;\nif (dotVal < bias)\n{\ndotVal = 0.0;\n}\nlocalAO = max(localAO, dotVal * weight);\nlocalStepSize += stepSize;\n}\nao += localAO;\n}\nao /= 4.0;\nao = 1.0 - clamp(ao, 0.0, 1.0);\nao = pow(ao, intensity);\ngl_FragColor = vec4(vec3(ao), 1.0);\n}\n",AmbientOcclusionModulate="uniform sampler2D colorTexture;\nuniform sampler2D ambientOcclusionTexture;\nuniform bool ambientOcclusionOnly;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;\nvec3 ao = texture2D(ambientOcclusionTexture, v_textureCoordinates).rgb;\ngl_FragColor.rgb = ambientOcclusionOnly ? ao : ao * color;\n}\n",BlackAndWhite="uniform sampler2D colorTexture;\nuniform float gradations;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\n#ifdef CZM_SELECTED_FEATURE\nif (czm_selected()) {\ngl_FragColor = vec4(rgb, 1.0);\nreturn;\n}\n#endif\nfloat luminance = czm_luminance(rgb);\nfloat darkness = luminance * gradations;\ndarkness = (darkness - fract(darkness)) / gradations;\ngl_FragColor = vec4(vec3(darkness), 1.0);\n}\n",BloomComposite="uniform sampler2D colorTexture;\nuniform sampler2D bloomTexture;\nuniform bool glowOnly;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\n#ifdef CZM_SELECTED_FEATURE\nif (czm_selected()) {\ngl_FragColor = color;\nreturn;\n}\n#endif\nvec4 bloom = texture2D(bloomTexture, v_textureCoordinates);\ngl_FragColor = glowOnly ? bloom : bloom + color;\n}\n",Brightness="uniform sampler2D colorTexture;\nuniform float brightness;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\nvec3 target = vec3(0.0);\ngl_FragColor = vec4(mix(target, rgb, brightness), 1.0);\n}\n",ContrastBias="uniform sampler2D colorTexture;\nuniform float contrast;\nuniform float brightness;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 sceneColor = texture2D(colorTexture, v_textureCoordinates).xyz;\nsceneColor = czm_RGBToHSB(sceneColor);\nsceneColor.z += brightness;\nsceneColor = czm_HSBToRGB(sceneColor);\nfloat factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));\nsceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);\ngl_FragColor = vec4(sceneColor, 1.0);\n}\n",DepthOfField="uniform sampler2D colorTexture;\nuniform sampler2D blurTexture;\nuniform sampler2D depthTexture;\nuniform float focalDistance;\nvarying vec2 v_textureCoordinates;\nvec4 toEye(vec2 uv, float depth)\n{\nvec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));\nvec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);\nposInCamera = posInCamera / posInCamera.w;\nreturn posInCamera;\n}\nfloat computeDepthBlur(float depth)\n{\nfloat f;\nif (depth < focalDistance)\n{\nf = (focalDistance - depth) / (focalDistance - czm_currentFrustum.x);\n}\nelse\n{\nf = (depth - focalDistance) / (czm_currentFrustum.y - focalDistance);\nf = pow(f, 0.1);\n}\nf *= f;\nf = clamp(f, 0.0, 1.0);\nreturn pow(f, 0.5);\n}\nvoid main(void)\n{\nfloat depth = czm_readDepth(depthTexture, v_textureCoordinates);\nvec4 posInCamera = toEye(v_textureCoordinates, depth);\nfloat d = computeDepthBlur(-posInCamera.z);\ngl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), texture2D(blurTexture, v_textureCoordinates), d);\n}\n",DepthView="uniform sampler2D depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nfloat depth = czm_readDepth(depthTexture, v_textureCoordinates);\ngl_FragColor = vec4(vec3(depth), 1.0);\n}\n",EdgeDetection="uniform sampler2D depthTexture;\nuniform float length;\nuniform vec4 color;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nfloat directions[3];\ndirections[0] = -1.0;\ndirections[1] = 0.0;\ndirections[2] = 1.0;\nfloat scalars[3];\nscalars[0] = 3.0;\nscalars[1] = 10.0;\nscalars[2] = 3.0;\nfloat padx = czm_pixelRatio / czm_viewport.z;\nfloat pady = czm_pixelRatio / czm_viewport.w;\n#ifdef CZM_SELECTED_FEATURE\nbool selected = false;\nfor (int i = 0; i < 3; ++i)\n{\nfloat dir = directions[i];\nselected = selected || czm_selected(vec2(-padx, dir * pady));\nselected = selected || czm_selected(vec2(padx, dir * pady));\nselected = selected || czm_selected(vec2(dir * padx, -pady));\nselected = selected || czm_selected(vec2(dir * padx, pady));\nif (selected)\n{\nbreak;\n}\n}\nif (!selected)\n{\ngl_FragColor = vec4(color.rgb, 0.0);\nreturn;\n}\n#endif\nfloat horizEdge = 0.0;\nfloat vertEdge = 0.0;\nfor (int i = 0; i < 3; ++i)\n{\nfloat dir = directions[i];\nfloat scale = scalars[i];\nhorizEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale;\nhorizEdge += texture2D(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale;\nvertEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale;\nvertEdge += texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale;\n}\nfloat len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\ngl_FragColor = vec4(color.rgb, len > length ? color.a : 0.0);\n}\n",FilmicTonemapping="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\nfloat exposure = texture2D(autoExposure, vec2(0.5)).r;\ncolor /= exposure;\n#endif\nconst float A = 0.22;\nconst float B = 0.30;\nconst float C = 0.10;\nconst float D = 0.20;\nconst float E = 0.01;\nconst float F = 0.30;\nconst float white = 11.2;\nvec3 c = ((color * (A * color + C * B) + D * E) / (color * ( A * color + B) + D * F)) - E / F;\nfloat w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F;\nc = czm_inverseGamma(c / w);\ngl_FragColor = vec4(c, fragmentColor.a);\n}\n",FXAA="varying vec2 v_textureCoordinates;\nuniform sampler2D colorTexture;\nconst float fxaaQualitySubpix = 0.5;\nconst float fxaaQualityEdgeThreshold = 0.125;\nconst float fxaaQualityEdgeThresholdMin = 0.0833;\nvoid main()\n{\nvec2 fxaaQualityRcpFrame = vec2(1.0) / czm_viewport.zw;\nvec4 color = FxaaPixelShader(\nv_textureCoordinates,\ncolorTexture,\nfxaaQualityRcpFrame,\nfxaaQualitySubpix,\nfxaaQualityEdgeThreshold,\nfxaaQualityEdgeThresholdMin);\nfloat alpha = texture2D(colorTexture, v_textureCoordinates).a;\ngl_FragColor = vec4(color.rgb, alpha);\n}\n",GaussianBlur1D="#define SAMPLES 8\nuniform float delta;\nuniform float sigma;\nuniform float direction;\nuniform sampler2D colorTexture;\n#ifdef USE_STEP_SIZE\nuniform float stepSize;\n#else\nuniform vec2 step;\n#endif\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec2 st = v_textureCoordinates;\nvec2 dir = vec2(1.0 - direction, direction);\n#ifdef USE_STEP_SIZE\nvec2 step = vec2(stepSize * (czm_pixelRatio / czm_viewport.zw));\n#else\nvec2 step = step;\n#endif\nvec3 g;\ng.x = 1.0 / (sqrt(czm_twoPi) * sigma);\ng.y = exp((-0.5 * delta * delta) / (sigma * sigma));\ng.z = g.y * g.y;\nvec4 result = texture2D(colorTexture, st) * g.x;\nfor (int i = 1; i < SAMPLES; ++i)\n{\ng.xy *= g.yz;\nvec2 offset = float(i) * dir * step;\nresult += texture2D(colorTexture, st - offset) * g.x;\nresult += texture2D(colorTexture, st + offset) * g.x;\n}\ngl_FragColor = result;\n}\n",LensFlare="uniform sampler2D colorTexture;\nuniform sampler2D dirtTexture;\nuniform sampler2D starTexture;\nuniform vec2 dirtTextureDimensions;\nuniform float distortion;\nuniform float ghostDispersal;\nuniform float haloWidth;\nuniform float dirtAmount;\nuniform float earthRadius;\nuniform float intensity;\nvarying vec2 v_textureCoordinates;\n#define DISTANCE_TO_SPACE 6500000.0\nvec4 getNDCFromWC(vec3 WC, float earthRadius)\n{\nvec4 positionEC = czm_view * vec4(WC, 1.0);\npositionEC = vec4(positionEC.x + earthRadius, positionEC.y, positionEC.z, 1.0);\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\nreturn czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\n}\nfloat isInEarth(vec2 texcoord, vec2 sceneSize)\n{\nvec2 NDC = texcoord * 2.0 - 1.0;\nvec4 earthPosSC = getNDCFromWC(vec3(0.0), 0.0);\nvec4 earthPosSCEdge = getNDCFromWC(vec3(0.0), earthRadius * 1.5);\nNDC.xy -= earthPosSC.xy;\nfloat X = abs(NDC.x) * sceneSize.x;\nfloat Y = abs(NDC.y) * sceneSize.y;\nreturn clamp(0.0, 1.0, max(sqrt(X * X + Y * Y) / max(abs(earthPosSCEdge.x * sceneSize.x), 1.0) - 0.8 , 0.0));\n}\nvec4 textureDistorted(sampler2D tex, vec2 texcoord, vec2 direction, vec3 distortion, bool isSpace)\n{\nvec2 sceneSize = czm_viewport.zw;\nvec3 color;\nif(isSpace)\n{\ncolor.r = isInEarth(texcoord + direction * distortion.r, sceneSize) * texture2D(tex, texcoord + direction * distortion.r).r;\ncolor.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture2D(tex, texcoord + direction * distortion.g).g;\ncolor.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture2D(tex, texcoord + direction * distortion.b).b;\n}\nelse\n{\ncolor.r = texture2D(tex, texcoord + direction * distortion.r).r;\ncolor.g = texture2D(tex, texcoord + direction * distortion.g).g;\ncolor.b = texture2D(tex, texcoord + direction * distortion.b).b;\n}\nreturn vec4(clamp(color, 0.0, 1.0), 0.0);\n}\nvoid main(void)\n{\nvec4 originalColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 rgb = originalColor.rgb;\nbool isSpace = length(czm_viewerPositionWC.xyz) > DISTANCE_TO_SPACE;\nvec4 sunPos = czm_morphTime == 1.0 ? vec4(czm_sunPositionWC, 1.0) : vec4(czm_sunPositionColumbusView.zxy, 1.0);\nvec4 sunPositionEC = czm_view * sunPos;\nvec4 sunPositionWC = czm_eyeToWindowCoordinates(sunPositionEC);\nsunPos = czm_viewportOrthographic * vec4(sunPositionWC.xy, -sunPositionWC.z, 1.0);\nif(!isSpace || !((sunPos.x >= -1.1 && sunPos.x <= 1.1) && (sunPos.y >= -1.1 && sunPos.y <= 1.1)))\n{\ngl_FragColor = originalColor;\nreturn;\n}\nvec2 texcoord = vec2(1.0) - v_textureCoordinates;\nvec2 pixelSize = czm_pixelRatio / czm_viewport.zw;\nvec2 invPixelSize = 1.0 / pixelSize;\nvec3 distortionVec = pixelSize.x * vec3(-distortion, 0.0, distortion);\nvec2 ghostVec = (vec2(0.5) - texcoord) * ghostDispersal;\nvec3 direction = normalize(vec3(ghostVec, 0.0));\nvec4 result = vec4(0.0);\nvec4 ghost = vec4(0.0);\nfor (int i = 0; i < 4; ++i)\n{\nvec2 offset = fract(texcoord + ghostVec * float(i));\nghost += textureDistorted(colorTexture, offset, direction.xy, distortionVec, isSpace);\n}\nresult += ghost;\nvec2 haloVec = normalize(ghostVec) * haloWidth;\nfloat weightForHalo = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\nweightForHalo = pow(1.0 - weightForHalo, 5.0);\nresult += textureDistorted(colorTexture, texcoord + haloVec, direction.xy, distortionVec, isSpace) * weightForHalo * 1.5;\nvec2 dirtTexCoords = (v_textureCoordinates * invPixelSize) / dirtTextureDimensions;\nif (dirtTexCoords.x > 1.0)\n{\ndirtTexCoords.x = mod(floor(dirtTexCoords.x), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.x) : fract(dirtTexCoords.x);\n}\nif (dirtTexCoords.y > 1.0)\n{\ndirtTexCoords.y = mod(floor(dirtTexCoords.y), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.y) : fract(dirtTexCoords.y);\n}\nresult += dirtAmount * texture2D(dirtTexture, dirtTexCoords);\nfloat camrot = czm_view[0].z + czm_view[1].y;\nfloat cosValue = cos(camrot);\nfloat sinValue = sin(camrot);\nmat3 rotation = mat3(\ncosValue, -sinValue, 0.0,\nsinValue, cosValue, 0.0,\n0.0, 0.0, 1.0\n);\nvec3 st1 = vec3(v_textureCoordinates * 2.0 - vec2(1.0), 1.0);\nvec3 st2 = vec3((rotation * st1).xy, 1.0);\nvec3 st3 = st2 * 0.5 + vec3(0.5);\nvec2 lensStarTexcoord = st3.xy;\nfloat weightForLensFlare = length(vec3(sunPos.xy, 0.0));\nfloat oneMinusWeightForLensFlare = max(1.0 - weightForLensFlare, 0.0);\nif (!isSpace)\n{\nresult *= oneMinusWeightForLensFlare * intensity * 0.2;\n}\nelse\n{\nresult *= oneMinusWeightForLensFlare * intensity;\nresult *= texture2D(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0;\n}\nresult += texture2D(colorTexture, v_textureCoordinates);\ngl_FragColor = result;\n}\n",ModifiedReinhardTonemapping="uniform sampler2D colorTexture;\nuniform vec3 white;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\nfloat exposure = texture2D(autoExposure, vec2(0.5)).r;\ncolor /= exposure;\n#endif\ncolor = (color * (1.0 + color / white)) / (1.0 + color);\ncolor = czm_inverseGamma(color);\ngl_FragColor = vec4(color, fragmentColor.a);\n}\n",NightVision="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nfloat rand(vec2 co)\n{\nreturn fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453);\n}\nvoid main(void)\n{\nfloat noiseValue = rand(v_textureCoordinates + sin(czm_frameNumber)) * 0.1;\nvec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\nvec3 green = vec3(0.0, 1.0, 0.0);\ngl_FragColor = vec4((noiseValue + rgb) * green, 1.0);\n}\n",ReinhardTonemapping="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\nfloat exposure = texture2D(autoExposure, vec2(0.5)).r;\ncolor /= exposure;\n#endif\ncolor = color / (1.0 + color);\ncolor = czm_inverseGamma(color);\ngl_FragColor = vec4(color, fragmentColor.a);\n}\n",Silhouette="uniform sampler2D colorTexture;\nuniform sampler2D silhouetteTexture;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec4 silhouetteColor = texture2D(silhouetteTexture, v_textureCoordinates);\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\ngl_FragColor = mix(color, silhouetteColor, silhouetteColor.a);\n}\n",FXAA3_11="#if (FXAA_QUALITY_PRESET == 10)\n#define FXAA_QUALITY_PS 3\n#define FXAA_QUALITY_P0 1.5\n#define FXAA_QUALITY_P1 3.0\n#define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n#define FXAA_QUALITY_PS 4\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 3.0\n#define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n#define FXAA_QUALITY_PS 5\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 4.0\n#define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n#define FXAA_QUALITY_PS 6\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 4.0\n#define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n#define FXAA_QUALITY_PS 7\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 4.0\n#define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n#define FXAA_QUALITY_PS 8\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 4.0\n#define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n#define FXAA_QUALITY_PS 3\n#define FXAA_QUALITY_P0 1.5\n#define FXAA_QUALITY_P1 2.0\n#define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n#define FXAA_QUALITY_PS 4\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n#define FXAA_QUALITY_PS 5\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n#define FXAA_QUALITY_PS 6\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n#define FXAA_QUALITY_PS 7\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 3.0\n#define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n#define FXAA_QUALITY_PS 8\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 4.0\n#define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n#define FXAA_QUALITY_PS 9\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 4.0\n#define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n#define FXAA_QUALITY_PS 10\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 4.0\n#define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n#define FXAA_QUALITY_PS 11\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 4.0\n#define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n#define FXAA_QUALITY_PS 12\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 2.0\n#define FXAA_QUALITY_P10 4.0\n#define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n#define FXAA_QUALITY_PS 12\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.0\n#define FXAA_QUALITY_P2 1.0\n#define FXAA_QUALITY_P3 1.0\n#define FXAA_QUALITY_P4 1.0\n#define FXAA_QUALITY_P5 1.5\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 2.0\n#define FXAA_QUALITY_P10 4.0\n#define FXAA_QUALITY_P11 8.0\n#endif\n#define FxaaBool bool\n#define FxaaFloat float\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaHalf float\n#define FxaaHalf2 vec2\n#define FxaaHalf3 vec3\n#define FxaaHalf4 vec4\n#define FxaaInt2 vec2\n#define FxaaTex sampler2D\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTexTop(t, p) texture2D(t, p)\n#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\nFxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }\nFxaaFloat4 FxaaPixelShader(\nFxaaFloat2 pos,\nFxaaTex tex,\nFxaaFloat2 fxaaQualityRcpFrame,\nFxaaFloat fxaaQualitySubpix,\nFxaaFloat fxaaQualityEdgeThreshold,\nFxaaFloat fxaaQualityEdgeThresholdMin\n) {\nFxaaFloat2 posM;\nposM.x = pos.x;\nposM.y = pos.y;\nFxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n#define lumaM rgbyM.y\nFxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\nFxaaFloat maxSM = max(lumaS, lumaM);\nFxaaFloat minSM = min(lumaS, lumaM);\nFxaaFloat maxESM = max(lumaE, maxSM);\nFxaaFloat minESM = min(lumaE, minSM);\nFxaaFloat maxWN = max(lumaN, lumaW);\nFxaaFloat minWN = min(lumaN, lumaW);\nFxaaFloat rangeMax = max(maxWN, maxESM);\nFxaaFloat rangeMin = min(minWN, minESM);\nFxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\nFxaaFloat range = rangeMax - rangeMin;\nFxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\nFxaaBool earlyExit = range < rangeMaxClamped;\nif(earlyExit)\nreturn rgbyM;\nFxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaNS = lumaN + lumaS;\nFxaaFloat lumaWE = lumaW + lumaE;\nFxaaFloat subpixRcpRange = 1.0/range;\nFxaaFloat subpixNSWE = lumaNS + lumaWE;\nFxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\nFxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\nFxaaFloat lumaNESE = lumaNE + lumaSE;\nFxaaFloat lumaNWNE = lumaNW + lumaNE;\nFxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\nFxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\nFxaaFloat lumaNWSW = lumaNW + lumaSW;\nFxaaFloat lumaSWSE = lumaSW + lumaSE;\nFxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\nFxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\nFxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\nFxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\nFxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\nFxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\nFxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\nFxaaFloat lengthSign = fxaaQualityRcpFrame.x;\nFxaaBool horzSpan = edgeHorz >= edgeVert;\nFxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\nif(!horzSpan) lumaN = lumaW;\nif(!horzSpan) lumaS = lumaE;\nif(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\nFxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\nFxaaFloat gradientN = lumaN - lumaM;\nFxaaFloat gradientS = lumaS - lumaM;\nFxaaFloat lumaNN = lumaN + lumaM;\nFxaaFloat lumaSS = lumaS + lumaM;\nFxaaBool pairN = abs(gradientN) >= abs(gradientS);\nFxaaFloat gradient = max(abs(gradientN), abs(gradientS));\nif(pairN) lengthSign = -lengthSign;\nFxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\nFxaaFloat2 posB;\nposB.x = posM.x;\nposB.y = posM.y;\nFxaaFloat2 offNP;\noffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\noffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\nif(!horzSpan) posB.x += lengthSign * 0.5;\nif( horzSpan) posB.y += lengthSign * 0.5;\nFxaaFloat2 posN;\nposN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\nposN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\nFxaaFloat2 posP;\nposP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\nposP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\nFxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\nFxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\nFxaaFloat subpixE = subpixC * subpixC;\nFxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\nif(!pairN) lumaNN = lumaSS;\nFxaaFloat gradientScaled = gradient * 1.0/4.0;\nFxaaFloat lumaMM = lumaM - lumaNN * 0.5;\nFxaaFloat subpixF = subpixD * subpixE;\nFxaaBool lumaMLTZero = lumaMM < 0.0;\nlumaEndN -= lumaNN * 0.5;\nlumaEndP -= lumaNN * 0.5;\nFxaaBool doneN = abs(lumaEndN) >= gradientScaled;\nFxaaBool doneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\nFxaaBool doneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n#if (FXAA_QUALITY_PS > 3)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n#if (FXAA_QUALITY_PS > 4)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n#if (FXAA_QUALITY_PS > 5)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n#if (FXAA_QUALITY_PS > 6)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n#if (FXAA_QUALITY_PS > 7)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n#if (FXAA_QUALITY_PS > 8)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n#if (FXAA_QUALITY_PS > 9)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n#if (FXAA_QUALITY_PS > 10)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n#if (FXAA_QUALITY_PS > 11)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n#if (FXAA_QUALITY_PS > 12)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\nFxaaFloat dstN = posM.x - posN.x;\nFxaaFloat dstP = posP.x - posM.x;\nif(!horzSpan) dstN = posM.y - posN.y;\nif(!horzSpan) dstP = posP.y - posM.y;\nFxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\nFxaaFloat spanLength = (dstP + dstN);\nFxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\nFxaaFloat spanLengthRcp = 1.0/spanLength;\nFxaaBool directionN = dstN < dstP;\nFxaaFloat dst = min(dstN, dstP);\nFxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\nFxaaFloat subpixG = subpixF * subpixF;\nFxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\nFxaaFloat subpixH = subpixG * fxaaQualitySubpix;\nFxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\nFxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\nif(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\nif( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\nreturn FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n}\n";function PostProcessStageComposite(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._stages=e.stages,this._inputPreviousStageTexture=defaultValue(e.inputPreviousStageTexture,!0);var t=e.name;defined(t)||(t=createGuid()),this._name=t,this._uniforms=e.uniforms,this._textureCache=void 0,this._index=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0}function isSelectedTextureDirty(e){var t=defined(e._selected)?e._selected.length:0,i=defined(e._parentSelected)?e._parentSelected:0,r=e._selected!==e._selectedShadow||t!==e._selectedLength;if(r=r||e._parentSelected!==e._parentSelectedShadow||i!==e._parentSelectedLength,defined(e._selected)&&defined(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):defined(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!r&&defined(e._combinedSelected)){if(!defined(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(var n=0;n<t;++n)if(e._combinedSelected[n]!==e._combinedSelectedShadow[n])return!0}return r}Object.defineProperties(PostProcessStageComposite.prototype,{ready:{get:function(){for(var e=this._stages,t=e.length,i=0;i<t;++i)if(!e[i].ready)return!1;return!0}},name:{get:function(){return this._name}},enabled:{get:function(){return this._stages[0].enabled},set:function(e){for(var t=this._stages,i=t.length,r=0;r<i;++r)t[r].enabled=e}},uniforms:{get:function(){return this._uniforms}},inputPreviousStageTexture:{get:function(){return this._inputPreviousStageTexture}},length:{get:function(){return this._stages.length}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}}),PostProcessStageComposite.prototype._isSupported=function(e){for(var t=this._stages,i=t.length,r=0;r<i;++r)if(!t[r]._isSupported(e))return!1;return!0},PostProcessStageComposite.prototype.get=function(e){return this._stages[e]},PostProcessStageComposite.prototype.update=function(e,t){this._selectedDirty=isSelectedTextureDirty(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=defined(this._selected)?this._selected.length:0,this._parentSelectedLength=defined(this._parentSelected)?this._parentSelected.length:0;for(var i=this._stages,r=i.length,n=0;n<r;++n){var a=i[n];this._selectedDirty&&(a.parentSelected=this._combinedSelected),a.update(e,t)}},PostProcessStageComposite.prototype.isDestroyed=function(){return!1},PostProcessStageComposite.prototype.destroy=function(){for(var e=this._stages,t=e.length,i=0;i<t;++i)e[i].destroy();return destroyObject(this)};var PostProcessStageLibrary={};function createBlur(e){var t="#define USE_STEP_SIZE\n"+GaussianBlur1D,i=new PostProcessStage({name:e+"_x_direction",fragmentShader:t,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:PostProcessStageSampleMode.LINEAR}),r=new PostProcessStage({name:e+"_y_direction",fragmentShader:t,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:PostProcessStageSampleMode.LINEAR}),n={};return Object.defineProperties(n,{delta:{get:function(){return i.uniforms.delta},set:function(e){var t=i.uniforms,n=r.uniforms;t.delta=n.delta=e}},sigma:{get:function(){return i.uniforms.sigma},set:function(e){var t=i.uniforms,n=r.uniforms;t.sigma=n.sigma=e}},stepSize:{get:function(){return i.uniforms.stepSize},set:function(e){var t=i.uniforms,n=r.uniforms;t.stepSize=n.stepSize=e}}}),new PostProcessStageComposite({name:e,stages:[i,r],uniforms:n})}function getSilhouetteEdgeDetection(e){if(!defined(e))return PostProcessStageLibrary.createEdgeDetectionStage();for(var t=new PostProcessStageComposite({name:"czm_edge_detection_multiple",stages:e,inputPreviousStageTexture:!1}),i={},r="",n="",a=0;a<e.length;++a)r+="uniform sampler2D edgeTexture"+a+"; \n",n+=" vec4 edge"+a+" = texture2D(edgeTexture"+a+", v_textureCoordinates); \n if (edge"+a+".a > 0.0) \n { \n color = edge"+a+"; \n break; \n } \n",i["edgeTexture"+a]=e[a].name;return new PostProcessStageComposite({name:"czm_edge_detection_composite",stages:[t,new PostProcessStage({name:"czm_edge_detection_combine",fragmentShader:r+"varying vec2 v_textureCoordinates; \nvoid main() { \n vec4 color = vec4(0.0); \n for (int i = 0; i < "+e.length+"; i++) \n { \n"+n+" } \n gl_FragColor = color; \n} \n",uniforms:i})]})}PostProcessStageLibrary.createBlurStage=function(){return createBlur("czm_blur")},PostProcessStageLibrary.createDepthOfFieldStage=function(){var e=createBlur("czm_depth_of_field_blur"),t=new PostProcessStage({name:"czm_depth_of_field_composite",fragmentShader:DepthOfField,uniforms:{focalDistance:5,blurTexture:e.name}}),i={};return Object.defineProperties(i,{focalDistance:{get:function(){return t.uniforms.focalDistance},set:function(e){t.uniforms.focalDistance=e}},delta:{get:function(){return e.uniforms.delta},set:function(t){e.uniforms.delta=t}},sigma:{get:function(){return e.uniforms.sigma},set:function(t){e.uniforms.sigma=t}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(t){e.uniforms.stepSize=t}}}),new PostProcessStageComposite({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:i})},PostProcessStageLibrary.isDepthOfFieldSupported=function(e){return e.context.depthTexture},PostProcessStageLibrary.createEdgeDetectionStage=function(){return new PostProcessStage({name:"czm_edge_detection_"+createGuid(),fragmentShader:EdgeDetection,uniforms:{length:.25,color:Color.clone(Color.BLACK)}})},PostProcessStageLibrary.isEdgeDetectionSupported=function(e){return e.context.depthTexture},PostProcessStageLibrary.createSilhouetteStage=function(e){var t=getSilhouetteEdgeDetection(e);return new PostProcessStageComposite({name:"czm_silhouette",stages:[t,new PostProcessStage({name:"czm_silhouette_color_edges",fragmentShader:Silhouette,uniforms:{silhouetteTexture:t.name}})],inputPreviousStageTexture:!1,uniforms:t.uniforms})},PostProcessStageLibrary.isSilhouetteSupported=function(e){return e.context.depthTexture},PostProcessStageLibrary.createBloomStage=function(){var e=new PostProcessStage({name:"czm_bloom_contrast_bias",fragmentShader:ContrastBias,uniforms:{contrast:128,brightness:-.3}}),t=createBlur("czm_bloom_blur"),i=new PostProcessStageComposite({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),r=new PostProcessStage({name:"czm_bloom_generate_composite",fragmentShader:BloomComposite,uniforms:{glowOnly:!1,bloomTexture:i.name}}),n={};return Object.defineProperties(n,{glowOnly:{get:function(){return r.uniforms.glowOnly},set:function(e){r.uniforms.glowOnly=e}},contrast:{get:function(){return e.uniforms.contrast},set:function(t){e.uniforms.contrast=t}},brightness:{get:function(){return e.uniforms.brightness},set:function(t){e.uniforms.brightness=t}},delta:{get:function(){return t.uniforms.delta},set:function(e){t.uniforms.delta=e}},sigma:{get:function(){return t.uniforms.sigma},set:function(e){t.uniforms.sigma=e}},stepSize:{get:function(){return t.uniforms.stepSize},set:function(e){t.uniforms.stepSize=e}}}),new PostProcessStageComposite({name:"czm_bloom",stages:[i,r],inputPreviousStageTexture:!1,uniforms:n})},PostProcessStageLibrary.createAmbientOcclusionStage=function(){var e=new PostProcessStage({name:"czm_ambient_occlusion_generate",fragmentShader:AmbientOcclusionGenerate,uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),t=createBlur("czm_ambient_occlusion_blur");t.uniforms.stepSize=.86;var i=new PostProcessStageComposite({name:"czm_ambient_occlusion_generate_blur",stages:[e,t]}),r=new PostProcessStage({name:"czm_ambient_occlusion_composite",fragmentShader:AmbientOcclusionModulate,uniforms:{ambientOcclusionOnly:!1,ambientOcclusionTexture:i.name}}),n={};return Object.defineProperties(n,{intensity:{get:function(){return e.uniforms.intensity},set:function(t){e.uniforms.intensity=t}},bias:{get:function(){return e.uniforms.bias},set:function(t){e.uniforms.bias=t}},lengthCap:{get:function(){return e.uniforms.lengthCap},set:function(t){e.uniforms.lengthCap=t}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(t){e.uniforms.stepSize=t}},frustumLength:{get:function(){return e.uniforms.frustumLength},set:function(t){e.uniforms.frustumLength=t}},randomTexture:{get:function(){return e.uniforms.randomTexture},set:function(t){e.uniforms.randomTexture=t}},delta:{get:function(){return t.uniforms.delta},set:function(e){t.uniforms.delta=e}},sigma:{get:function(){return t.uniforms.sigma},set:function(e){t.uniforms.sigma=e}},blurStepSize:{get:function(){return t.uniforms.stepSize},set:function(e){t.uniforms.stepSize=e}},ambientOcclusionOnly:{get:function(){return r.uniforms.ambientOcclusionOnly},set:function(e){r.uniforms.ambientOcclusionOnly=e}}}),new PostProcessStageComposite({name:"czm_ambient_occlusion",stages:[i,r],inputPreviousStageTexture:!1,uniforms:n})},PostProcessStageLibrary.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};var fxaaFS="#define FXAA_QUALITY_PRESET 39 \n"+FXAA3_11+"\n"+FXAA;function PostProcessStageTextureCache(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function getLastStageName(e){for(;defined(e.length);)e=e.get(e.length-1);return e.name}function getStageDependencies(e,t,i,r,n){if(!r.enabled||!r._isSupported(t))return n;var a=i[r.name]={};defined(n)&&(a[getLastStageName(e.getStageByName(n))]=!0);var o=r.uniforms;if(defined(o))for(var s=Object.getOwnPropertyNames(o),l=s.length,c=0;c<l;++c){var u=o[s[c]];if("string"==typeof u){var d=e.getStageByName(u);defined(d)&&(a[getLastStageName(d)]=!0)}}return r.name}function getCompositeDependencies(e,t,i,r,n){if(defined(r.enabled)&&!r.enabled||defined(r._isSupported)&&!r._isSupported(t))return n;for(var a,o,s=n,l=!defined(r.inputPreviousStageTexture)||r.inputPreviousStageTexture,c=n,u=r.length,d=0;d<u;++d){var h=r.get(d);c=defined(h.length)?getCompositeDependencies(e,t,i,h,n):getStageDependencies(e,t,i,h,n),l&&(n=c)}if(l)for(a=1;a<u;++a)defined(i[o=getLastStageName(r.get(a))])||(i[o]={}),i[o][s]=!0;else for(a=1;a<u;++a)for(var p=i[o=getLastStageName(r.get(a))],f=0;f<a;++f)p[getLastStageName(r.get(f))]=!0;return c}function getDependencies(e,t){var i={};if(defined(e.ambientOcclusion)){var r=e.ambientOcclusion,n=e.bloom,a=e._tonemapping,o=e.fxaa,s=getCompositeDependencies(e,t,i,r,void 0);s=getStageDependencies(e,t,i,a,s=getCompositeDependencies(e,t,i,n,s)),getStageDependencies(e,t,i,o,s=getCompositeDependencies(e,t,i,e,s))}else getCompositeDependencies(e,t,i,e,void 0);return i}function getFramebuffer(e,t,i){var r,n,a=e._collection.getStageByName(t),o=a._textureScale,s=a._forcePowerOfTwo,l=a._pixelFormat,c=a._pixelDatatype,u=a._clearColor,d=e._framebuffers,h=d.length;for(r=0;r<h;++r)if(o===(n=d[r]).textureScale&&s===n.forcePowerOfTwo&&l===n.pixelFormat&&c===n.pixelDatatype&&Color.equals(u,n.clearColor)){for(var p=n.stages,f=p.length,m=!1,g=0;g<f;++g)if(i[p[g]]){m=!0;break}if(!m)break}return defined(n)&&r<h?(n.stages.push(t),n):(n={textureScale:o,forcePowerOfTwo:s,pixelFormat:l,pixelDatatype:c,clearColor:u,stages:[t],buffer:void 0,clear:void 0},d.push(n),n)}function createFramebuffers(e,t){var i=getDependencies(e._collection,t);for(var r in i)i.hasOwnProperty(r)&&(e._stageNameToFramebuffer[r]=getFramebuffer(e,r,i[r]))}function releaseResources(e){for(var t=e._framebuffers,i=t.length,r=0;r<i;++r){var n=t[r];n.buffer=n.buffer&&n.buffer.destroy(),n.buffer=void 0}}function updateFramebuffers(e,t){for(var i=e._width,r=e._height,n=e._framebuffers,a=n.length,o=0;o<a;++o){var s=n[o],l=s.textureScale,c=Math.ceil(i*l),u=Math.ceil(r*l),d=Math.min(c,u);s.forcePowerOfTwo&&(CesiumMath.isPowerOfTwo(d)||(d=CesiumMath.nextPowerOfTwo(d)),c=d,u=d),s.buffer=new Framebuffer({context:t,colorTextures:[new Texture({context:t,width:c,height:u,pixelFormat:s.pixelFormat,pixelDatatype:s.pixelDatatype})]}),s.clear=new ClearCommand({color:s.clearColor,framebuffer:s.buffer})}}PostProcessStageLibrary.createFXAAStage=function(){return new PostProcessStage({name:"czm_FXAA",fragmentShader:fxaaFS,sampleMode:PostProcessStageSampleMode.LINEAR})},PostProcessStageLibrary.createAcesTonemappingStage=function(e){var t=e?"#define AUTO_EXPOSURE\n":"";return new PostProcessStage({name:"czm_aces",fragmentShader:t+=AcesTonemapping,uniforms:{autoExposure:void 0}})},PostProcessStageLibrary.createFilmicTonemappingStage=function(e){var t=e?"#define AUTO_EXPOSURE\n":"";return new PostProcessStage({name:"czm_filmic",fragmentShader:t+=FilmicTonemapping,uniforms:{autoExposure:void 0}})},PostProcessStageLibrary.createReinhardTonemappingStage=function(e){var t=e?"#define AUTO_EXPOSURE\n":"";return new PostProcessStage({name:"czm_reinhard",fragmentShader:t+=ReinhardTonemapping,uniforms:{autoExposure:void 0}})},PostProcessStageLibrary.createModifiedReinhardTonemappingStage=function(e){var t=e?"#define AUTO_EXPOSURE\n":"";return new PostProcessStage({name:"czm_modified_reinhard",fragmentShader:t+=ModifiedReinhardTonemapping,uniforms:{white:Color.WHITE,autoExposure:void 0}})},PostProcessStageLibrary.createAutoExposureStage=function(){return new AutoExposure},PostProcessStageLibrary.createBlackAndWhiteStage=function(){return new PostProcessStage({name:"czm_black_and_white",fragmentShader:BlackAndWhite,uniforms:{gradations:5}})},PostProcessStageLibrary.createBrightnessStage=function(){return new PostProcessStage({name:"czm_brightness",fragmentShader:Brightness,uniforms:{brightness:.5}})},PostProcessStageLibrary.createNightVisionStage=function(){return new PostProcessStage({name:"czm_night_vision",fragmentShader:NightVision})},PostProcessStageLibrary.createDepthViewStage=function(){return new PostProcessStage({name:"czm_depth_view",fragmentShader:DepthView})},PostProcessStageLibrary.createLensFlareStage=function(){return new PostProcessStage({name:"czm_lens_flare",fragmentShader:LensFlare,uniforms:{dirtTexture:buildModuleUrl("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:buildModuleUrl("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:Ellipsoid.WGS84.maximumRadius}})},PostProcessStageTextureCache.prototype.updateDependencies=function(){this._updateDependencies=!0},PostProcessStageTextureCache.prototype.update=function(e){var t=this._collection,i=this._updateDependencies,r=defined(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),n=defined(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),a=defined(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),o=defined(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),s=!defined(t._activeStages)||t._activeStages.length>0||r||n||a||o;if((i||!s&&this._framebuffers.length>0)&&(releaseResources(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),i||s){0===this._framebuffers.length&&createFramebuffers(this,e);var l=e.drawingBufferWidth,c=e.drawingBufferHeight,u=this._width!==l||this._height!==c;(i||u)&&(this._width=l,this._height=c,this._updateDependencies=!1,releaseResources(this),updateFramebuffers(this,e))}},PostProcessStageTextureCache.prototype.clear=function(e){for(var t=this._framebuffers,i=0;i<t.length;++i)t[i].clear.execute(e)},PostProcessStageTextureCache.prototype.getStageByName=function(e){return this._collection.getStageByName(e)},PostProcessStageTextureCache.prototype.getOutputTexture=function(e){return this._collection.getOutputTexture(e)},PostProcessStageTextureCache.prototype.getFramebuffer=function(e){var t=this._stageNameToFramebuffer[e];if(defined(t))return t.buffer},PostProcessStageTextureCache.prototype.isDestroyed=function(){return!1},PostProcessStageTextureCache.prototype.destroy=function(){return releaseResources(this),destroyObject(this)};var Tonemapper={REINHARD:0,MODIFIED_REINHARD:1,FILMIC:2,ACES:3,validate:function(e){return e===Tonemapper.REINHARD||e===Tonemapper.MODIFIED_REINHARD||e===Tonemapper.FILMIC||e===Tonemapper.ACES}},Tonemapper$1=Object.freeze(Tonemapper),stackScratch=[],comparisonPoint;function PostProcessStageCollection(){var e=PostProcessStageLibrary.createFXAAStage(),t=PostProcessStageLibrary.createAmbientOcclusionStage(),i=PostProcessStageLibrary.createBloomStage();this._autoExposureEnabled=!1,this._autoExposure=PostProcessStageLibrary.createAutoExposureStage(),this._tonemapping=void 0,this._tonemapper=void 0,this.tonemapper=Tonemapper$1.ACES;var r=this._tonemapping;e.enabled=!1,t.enabled=!1,i.enabled=!1,r.enabled=!1;var n=new PostProcessStageTextureCache(this),a={},o=stackScratch;for(o.push(e,t,i,r);o.length>0;){var s=o.pop();a[s.name]=s,s._textureCache=n;var l=s.length;if(defined(l))for(var c=0;c<l;++c)o.push(s.get(c))}this._stages=[],this._activeStages=[],this._previousActiveStages=[],this._randomTexture=void 0;var u=this;t.uniforms.randomTexture=function(){return u._randomTexture},this._ao=t,this._bloom=i,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=a,this._textureCache=n}function removeStages(e){if(e._stagesRemoved){e._stagesRemoved=!1;for(var t=[],i=e._stages,r=i.length,n=0,a=0;n<r;++n){var o=i[n];o&&(o._index=a++,t.push(o))}e._stages=t}}function getOutputTexture(e){for(;defined(e.length);)e=e.get(e.length-1);return e.outputTexture}function execute(e,t,i,r,n){if(defined(e.execute))e.execute(t,i,r,n);else{var a,o=e.length;if(e.inputPreviousStageTexture)for(execute(e.get(0),t,i,r,n),a=1;a<o;++a)execute(e.get(a),t,getOutputTexture(e.get(a-1)),r,n);else for(a=0;a<o;++a)execute(e.get(a),t,i,r,n)}}function QuadtreePrimitivezh(e){this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,maxDepthVisited:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastMaxDepthVisited:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};var t=this._tileProvider.tilingScheme.ellipsoid;this._tilesToRender=[],this._tileLoadQueueHigh=[],this._tileLoadQueueMedium=[],this._tileLoadQueueLow=[],this._tileReplacementQueue=new TileReplacementQueue,this._levelZeroTiles=void 0,this._loadQueueTimeSlice=5,this._tilesInvalidated=!1,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this._cameraPositionCartographic=void 0,this._cameraReferenceFrameOriginCartographic=void 0,this.maximumScreenSpaceError=defaultValue(e.maximumScreenSpaceError,2),this.tileCacheSize=defaultValue(e.tileCacheSize,100),this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new QuadtreeOccluders({ellipsoid:t}),this._tileLoadProgressEvent=new Event,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}function invalidateAllTiles(e){var t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,clearTileLoadQueue(e);var i=e._levelZeroTiles;if(defined(i))for(var r=0;r<i.length;++r){for(var n=i[r].customData,a=n.length,o=0;o<a;++o){var s=n[o];s.level=0,e._addHeightCallbacks.push(s)}i[r].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}function clearTileLoadQueue(e){var t=e._debug;t.maxDepth=0,t.maxDepthVisited=0,t.tilesVisited=0,t.tilesCulled=0,t.tilesRendered=0,t.tilesWaitingForChildren=0,e._tileLoadQueueHigh.length=0,e._tileLoadQueueMedium.length=0,e._tileLoadQueueLow.length=0}function updateTileLoadProgress(e,t){var i=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;(i!==e._lastTileLoadQueueLength||e._tilesInvalidated)&&(t.afterRender.push(Event.prototype.raiseEvent.bind(e._tileLoadProgressEvent,i)),e._lastTileLoadQueueLength=i);var r=e._debug;r.enableDebugOutput&&!r.suspendLodUpdate&&(r.maxDepth=e._tilesToRender.reduce((function(e,t){return Math.max(e,t.level)}),-1),r.tilesRendered=e._tilesToRender.length,r.tilesVisited===r.lastTilesVisited&&r.tilesRendered===r.lastTilesRendered&&r.tilesCulled===r.lastTilesCulled&&r.maxDepth===r.lastMaxDepth&&r.tilesWaitingForChildren===r.lastTilesWaitingForChildren&&r.maxDepthVisited===r.lastMaxDepthVisited||(console.log("Visited "+r.tilesVisited+", Rendered: "+r.tilesRendered+", Culled: "+r.tilesCulled+", Max Depth Rendered: "+r.maxDepth+", Max Depth Visited: "+r.maxDepthVisited+", Waiting for children: "+r.tilesWaitingForChildren),r.lastTilesVisited=r.tilesVisited,r.lastTilesRendered=r.tilesRendered,r.lastTilesCulled=r.tilesCulled,r.lastMaxDepth=r.maxDepth,r.lastTilesWaitingForChildren=r.tilesWaitingForChildren,r.lastMaxDepthVisited=r.maxDepthVisited))}Object.defineProperties(PostProcessStageCollection.prototype,{ready:{get:function(){for(var e=!1,t=this._stages,i=t.length-1;i>=0;--i){var r=t[i];e=e||r.ready&&r.enabled}var n=this._fxaa,a=this._ao,o=this._bloom,s=this._tonemapping;return e=(e=(e=(e=e||n.ready&&n.enabled)||a.ready&&a.enabled)||o.ready&&o.enabled)||s.ready&&s.enabled}},fxaa:{get:function(){return this._fxaa}},ambientOcclusion:{get:function(){return this._ao}},bloom:{get:function(){return this._bloom}},length:{get:function(){return removeStages(this),this._stages.length}},outputTexture:{get:function(){var e=this._fxaa;if(e.enabled&&e.ready)return this.getOutputTexture(e.name);for(var t=this._stages,i=t.length-1;i>=0;--i){var r=t[i];if(defined(r)&&r.ready&&r.enabled)return this.getOutputTexture(r.name)}var n=this._tonemapping;if(n.enabled&&n.ready)return this.getOutputTexture(n.name);var a=this._bloom;if(a.enabled&&a.ready)return this.getOutputTexture(a.name);var o=this._ao;return o.enabled&&o.ready?this.getOutputTexture(o.name):void 0}},hasSelected:{get:function(){for(var e=arraySlice(this._stages);e.length>0;){var t=e.pop();if(defined(t)){if(defined(t.selected))return!0;var i=t.length;if(defined(i))for(var r=0;r<i;++r)e.push(t.get(r))}}return!1}},tonemapper:{get:function(){return this._tonemapper},set:function(e){if(this._tonemapper!==e){defined(this._tonemapping)&&(delete this._stageNames[this._tonemapping.name],this._tonemapping.destroy());var t,i=this._autoExposureEnabled;switch(e){case Tonemapper$1.REINHARD:t=PostProcessStageLibrary.createReinhardTonemappingStage(i);break;case Tonemapper$1.MODIFIED_REINHARD:t=PostProcessStageLibrary.createModifiedReinhardTonemappingStage(i);break;case Tonemapper$1.FILMIC:t=PostProcessStageLibrary.createFilmicTonemappingStage(i);break;default:t=PostProcessStageLibrary.createAcesTonemappingStage(i)}if(i){var r=this._autoExposure;t.uniforms.autoExposure=function(){return r.outputTexture}}this._tonemapper=e,this._tonemapping=t,defined(this._stageNames)&&(this._stageNames[t.name]=t,t._textureCache=this._textureCache),this._textureCacheDirty=!0}}}}),PostProcessStageCollection.prototype.add=function(e){var t=this._stageNames,i=stackScratch;for(i.push(e);i.length>0;){var r=i.pop();t[r.name]=r,r._textureCache=this._textureCache;var n=r.length;if(defined(n))for(var a=0;a<n;++a)i.push(r.get(a))}var o=this._stages;return e._index=o.length,o.push(e),this._textureCacheDirty=!0,e},PostProcessStageCollection.prototype.remove=function(e){if(!this.contains(e))return!1;var t=this._stageNames,i=stackScratch;for(i.push(e);i.length>0;){var r=i.pop();delete t[r.name];var n=r.length;if(defined(n))for(var a=0;a<n;++a)i.push(r.get(a))}return this._stages[e._index]=void 0,this._stagesRemoved=!0,this._textureCacheDirty=!0,e._index=void 0,e._textureCache=void 0,e.destroy(),!0},PostProcessStageCollection.prototype.contains=function(e){return defined(e)&&defined(e._index)&&e._textureCache===this._textureCache},PostProcessStageCollection.prototype.get=function(e){return removeStages(this),this._stages[e]},PostProcessStageCollection.prototype.removeAll=function(){for(var e=this._stages,t=e.length,i=0;i<t;++i)this.remove(e[i]);e.length=0},PostProcessStageCollection.prototype.getStageByName=function(e){return this._stageNames[e]},PostProcessStageCollection.prototype.update=function(e,t,i){removeStages(this);var r=this._activeStages,n=this._activeStages=this._previousActiveStages;this._previousActiveStages=r;var a,o,s=this._stages,l=n.length=s.length,c=0;for(a=0;a<l;++a)(o=s[a]).ready&&o.enabled&&o._isSupported(e)&&(n[c++]=o);n.length=c;var u=c!==r.length;if(!u)for(a=0;a<c;++a)if(n[a]!==r[a]){u=!0;break}var d=this._ao,h=this._bloom,p=this._autoExposure,f=this._tonemapping,m=this._fxaa;f.enabled=i;var g=d.enabled&&d._isSupported(e),_=h.enabled&&h._isSupported(e),y=f.enabled&&f._isSupported(e),v=m.enabled&&m._isSupported(e);if((u||this._textureCacheDirty||g!==this._aoEnabled||_!==this._bloomEnabled||y!==this._tonemappingEnabled||v!==this._fxaaEnabled)&&(this._textureCache.updateDependencies(),this._aoEnabled=g,this._bloomEnabled=_,this._tonemappingEnabled=y,this._fxaaEnabled=v,this._textureCacheDirty=!1),defined(this._randomTexture)&&!g&&(this._randomTexture.destroy(),this._randomTexture=void 0),!defined(this._randomTexture)&&g){l=196608;var C=new Uint8Array(l);for(a=0;a<l;a+=3)C[a]=Math.floor(255*Math.random());this._randomTexture=new Texture({context:e,pixelFormat:PixelFormat$1.RGB,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:C,width:256,height:256},sampler:new Sampler({wrapS:TextureWrap$1.REPEAT,wrapT:TextureWrap$1.REPEAT,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})})}for(this._textureCache.update(e),m.update(e,t),d.update(e,t),h.update(e,t),f.update(e,t),this._autoExposureEnabled&&p.update(e,t),l=s.length,a=0;a<l;++a)s[a].update(e,t);for(c=0,a=0;a<l;++a)(o=s[a]).ready&&o.enabled&&o._isSupported(e)&&c++;(u=c!==n.length)&&this.update(e,t,i)},PostProcessStageCollection.prototype.clear=function(e){this._textureCache.clear(e),this._autoExposureEnabled&&this._autoExposure.clear(e)},PostProcessStageCollection.prototype.getOutputTexture=function(e){var t=this.getStageByName(e);if(defined(t))return getOutputTexture(t)},PostProcessStageCollection.prototype.execute=function(e,t,i,r){var n=this._activeStages,a=n.length,o=this._fxaa,s=this._ao,l=this._bloom,c=this._autoExposure,u=this._tonemapping,d=s.enabled&&s._isSupported(e),h=l.enabled&&l._isSupported(e),p=this._autoExposureEnabled,f=u.enabled&&u._isSupported(e),m=o.enabled&&o._isSupported(e);if(m||d||h||f||0!==a){var g=t;d&&s.ready&&(execute(s,e,g,i,r),g=getOutputTexture(s)),h&&l.ready&&(execute(l,e,g,i,r),g=getOutputTexture(l)),p&&c.ready&&execute(c,e,g,i,r),f&&u.ready&&(execute(u,e,g,i,r),g=getOutputTexture(u));var _=g;if(a>0){execute(n[0],e,g,i,r);for(var y=1;y<a;++y)execute(n[y],e,getOutputTexture(n[y-1]),i,r);_=getOutputTexture(n[a-1])}m&&o.ready&&execute(o,e,_,i,r)}},PostProcessStageCollection.prototype.copy=function(e,t){if(!defined(this._copyColorCommand)){var i=this;this._copyColorCommand=e.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return i.outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)},PostProcessStageCollection.prototype.isDestroyed=function(){return!1},PostProcessStageCollection.prototype.destroy=function(){return this._fxaa.destroy(),this._ao.destroy(),this._bloom.destroy(),this._autoExposure.destroy(),this._tonemapping.destroy(),this.removeAll(),this._textureCache=this._textureCache&&this._textureCache.destroy(),destroyObject(this)},Object.defineProperties(QuadtreePrimitivezh.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}}),QuadtreePrimitivezh.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0},QuadtreePrimitivezh.prototype.forEachLoadedTile=function(e){for(var t=this._tileReplacementQueue.head;defined(t);)t.state!==QuadtreeTileLoadState$1.START&&e(t),t=t.replacementNext},QuadtreePrimitivezh.prototype.forEachRenderedTile=function(e){for(var t=this._tilesToRender,i=0,r=t.length;i<r;++i)e(t[i])},QuadtreePrimitivezh.prototype.updateHeight=function(e,t){var i=this,r={positionOnEllipsoidSurface:void 0,positionCartographic:e,level:-1,callback:t,removeFunc:function(){for(var e=i._addHeightCallbacks,t=e.length,n=0;n<t;++n)if(e[n]===r){e.splice(n,1);break}i._removeHeightCallbacks.push(r)}};return i._addHeightCallbacks.push(r),r.removeFunc},QuadtreePrimitivezh.prototype.update=function(e){defined(this._tileProvider.update)&&this._tileProvider.update(e)},QuadtreePrimitivezh.prototype.beginFrame=function(e){e.passes.render&&(this._tilesInvalidated&&(invalidateAllTiles(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),clearTileLoadQueue(this),this._debug.suspendLodUpdate||this._tileReplacementQueue.markStartOfRenderFrame())},QuadtreePrimitivezh.prototype.render=function(e){var t=e.passes,i=this._tileProvider;if(t.render&&(i.beginUpdate(e),selectTilesForRendering(this,e),createRenderCommandsForSelectedTiles(this,e),i.endUpdate(e)),t.pick&&this._tilesToRender.length>0)try{i.updateForPick(e)}catch(e){}},QuadtreePrimitivezh.prototype.endFrame=function(e){e.passes.render&&e.mode!==SceneMode$1.MORPHING&&(processTileLoadQueue(this,e),updateHeights(this,e),updateTileLoadProgress(this,e))},QuadtreePrimitivezh.prototype.isDestroyed=function(){return!1},QuadtreePrimitivezh.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};var centerScratch=new Cartographic;function compareDistanceToPoint(e,t){var i=Rectangle.center(e.rectangle,centerScratch),r=i.longitude-comparisonPoint.longitude,n=i.latitude-comparisonPoint.latitude,a=(i=Rectangle.center(t.rectangle,centerScratch)).longitude-comparisonPoint.longitude,o=i.latitude-comparisonPoint.latitude;return r*r+n*n-(a*a+o*o)}var cameraOriginScratch=new Cartesian3,rootTraversalDetails=[];function selectTilesForRendering(e,t){var i=e._debug;if(!i.suspendLodUpdate){var r;e._tilesToRender.length=0;var n,a=e._tileProvider;if(!defined(e._levelZeroTiles)){if(!a.ready)return;var o=a.tilingScheme;e._levelZeroTiles=QuadtreeTile.createLevelZeroTiles(o);var s=e._levelZeroTiles.length;if(rootTraversalDetails.length<s)for(rootTraversalDetails=new Array(s),r=0;r<s;++r)void 0===rootTraversalDetails[r]&&(rootTraversalDetails[r]=new TraversalDetails)}e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;var l=e._levelZeroTiles,c=l.length>1?e._occluders:void 0;comparisonPoint=t.camera.positionCartographic,l.sort(compareDistanceToPoint);var u,d=e._addHeightCallbacks,h=e._removeHeightCallbacks,p=t.frameNumber;if(d.length>0||h.length>0){for(r=0,u=l.length;r<u;++r)(n=l[r])._updateCustomData(p,d,h);d.length=0,h.length=0}var f=t.camera;e._cameraPositionCartographic=f.positionCartographic;var m=Matrix4.getTranslation(f.transform,cameraOriginScratch);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(m,e._cameraReferenceFrameOriginCartographic),r=0,u=l.length;r<u;++r)n=l[r],e._tileReplacementQueue.markTileRendered(n),n.renderable?visitIfVisible(e,n,a,t,c,!1,rootTraversalDetails[r]):(queueTileLoad(e,e._tileLoadQueueHigh,n,t),++i.tilesWaitingForChildren);e._lastSelectionFrameNumber=p}}function queueTileLoad(e,t,i,r){i.needsLoading&&(void 0!==e.tileProvider.computeTileLoadPriority&&(i._loadPriority=e.tileProvider.computeTileLoadPriority(i,r)),t.push(i))}function TraversalDetails(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function TraversalQuadDetails(){this.southwest=new TraversalDetails,this.southeast=new TraversalDetails,this.northwest=new TraversalDetails,this.northeast=new TraversalDetails}TraversalQuadDetails.prototype.combine=function(e){var t=this.southwest,i=this.southeast,r=this.northwest,n=this.northeast;e.allAreRenderable=t.allAreRenderable&&i.allAreRenderable&&r.allAreRenderable&&n.allAreRenderable,e.anyWereRenderedLastFrame=t.anyWereRenderedLastFrame||i.anyWereRenderedLastFrame||r.anyWereRenderedLastFrame||n.anyWereRenderedLastFrame,e.notYetRenderableCount=t.notYetRenderableCount+i.notYetRenderableCount+r.notYetRenderableCount+n.notYetRenderableCount};for(var traversalQuadsByLevel=new Array(31),i$1=0;i$1<traversalQuadsByLevel.length;++i$1)traversalQuadsByLevel[i$1]=new TraversalQuadDetails;function visitTile(e,t,i,r,n){var a=e._debug;++a.tilesVisited,e._tileReplacementQueue.markTileRendered(i),i._updateCustomData(t.frameNumber),i.level>a.maxDepthVisited&&(a.maxDepthVisited=i.level);var o=screenSpaceError(e,t,i)<e.maximumScreenSpaceError,s=i.southwestChild,l=i.southeastChild,c=i.northwestChild,u=i.northeastChild,d=e._lastSelectionFrameNumber,h=i._lastSelectionResultFrame===d?i._lastSelectionResult:TileSelectionResult.NONE,p=e.tileProvider;if(o||r){var f=TileSelectionResult.originalResult(h)===TileSelectionResult.RENDERED,m=TileSelectionResult.originalResult(h)===TileSelectionResult.CULLED||h===TileSelectionResult.NONE,g=i.state===QuadtreeTileLoadState$1.DONE,_=f||m||g;if(_||defined(p.canRenderWithoutLosingDetail)&&(_=p.canRenderWithoutLosingDetail(i)),_)return o&&queueTileLoad(e,e._tileLoadQueueMedium,i,t),addTileToRenderList(e,i),n.allAreRenderable=i.renderable,n.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,n.notYetRenderableCount=i.renderable?0:1,i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,void(n.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(i));r=!0,o&&queueTileLoad(e,e._tileLoadQueueHigh,i,t)}if(p.canRefine(i)){if(s.upsampledFromParent&&l.upsampledFromParent&&c.upsampledFromParent&&u.upsampledFromParent)return addTileToRenderList(e,i),queueTileLoad(e,e._tileLoadQueueMedium,i,t),e._tileReplacementQueue.markTileRendered(s),e._tileReplacementQueue.markTileRendered(l),e._tileReplacementQueue.markTileRendered(c),e._tileReplacementQueue.markTileRendered(u),n.allAreRenderable=i.renderable,n.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,n.notYetRenderableCount=i.renderable?0:1,i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,void(n.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(i));i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.REFINED;var y=e._tilesToRender.length,v=e._tileLoadQueueLow.length,C=e._tileLoadQueueMedium.length,T=e._tileLoadQueueHigh.length,S=e._tileToUpdateHeights.length;if(visitVisibleChildrenNearToFar(e,s,l,c,u,t,r,n),y!==e._tilesToRender.length){var A=n.allAreRenderable,x=n.anyWereRenderedLastFrame,E=n.notYetRenderableCount,b=!1;if(!A&&!x){for(var P=e._tilesToRender,D=y;D<P.length;++D)for(var w=P[D];void 0!==w&&w._lastSelectionResult!==TileSelectionResult.KICKED&&w!==i;)w._lastSelectionResult=TileSelectionResult.kick(w._lastSelectionResult),w=w.parent;e._tilesToRender.length=y,e._tileToUpdateHeights.length=S,addTileToRenderList(e,i),i._lastSelectionResult=TileSelectionResult.RENDERED;var M=h===TileSelectionResult.RENDERED;!M&&E>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=v,e._tileLoadQueueMedium.length=C,e._tileLoadQueueHigh.length=T,queueTileLoad(e,e._tileLoadQueueMedium,i,t),n.notYetRenderableCount=i.renderable?0:1,b=!0),n.allAreRenderable=i.renderable,n.anyWereRenderedLastFrame=M,M||e._tileToUpdateHeights.push(i),++a.tilesWaitingForChildren}e.preloadAncestors&&!b&&queueTileLoad(e,e._tileLoadQueueLow,i,t)}}else i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,addTileToRenderList(e,i),queueTileLoad(e,e._tileLoadQueueHigh,i,t),n.allAreRenderable=i.renderable,n.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,n.notYetRenderableCount=i.renderable?0:1}function visitVisibleChildrenNearToFar(e,t,i,r,n,a,o,s){var l=a.camera.positionCartographic,c=e._tileProvider,u=e._occluders,d=traversalQuadsByLevel[t.level],h=d.southwest,p=d.southeast,f=d.northwest,m=d.northeast;l.longitude<t.rectangle.east?l.latitude<t.rectangle.north?(visitIfVisible(e,t,c,a,u,o,h),visitIfVisible(e,i,c,a,u,o,p),visitIfVisible(e,r,c,a,u,o,f),visitIfVisible(e,n,c,a,u,o,m)):(visitIfVisible(e,r,c,a,u,o,f),visitIfVisible(e,t,c,a,u,o,h),visitIfVisible(e,n,c,a,u,o,m),visitIfVisible(e,i,c,a,u,o,p)):l.latitude<t.rectangle.north?(visitIfVisible(e,i,c,a,u,o,p),visitIfVisible(e,t,c,a,u,o,h),visitIfVisible(e,n,c,a,u,o,m),visitIfVisible(e,r,c,a,u,o,f)):(visitIfVisible(e,n,c,a,u,o,m),visitIfVisible(e,r,c,a,u,o,f),visitIfVisible(e,i,c,a,u,o,p),visitIfVisible(e,t,c,a,u,o,h)),d.combine(s)}function containsNeededPosition(e,t){var i=t.rectangle;return defined(e._cameraPositionCartographic)&&Rectangle.contains(i,e._cameraPositionCartographic)||defined(e._cameraReferenceFrameOriginCartographic)&&Rectangle.contains(i,e._cameraReferenceFrameOriginCartographic)}function visitIfVisible(e,t,i,r,n,a,o){if(i.computeTileVisibility(t,r,n)!==Visibility$1.NONE)return visitTile(e,r,t,a,o);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),o.allAreRenderable=!0,o.anyWereRenderedLastFrame=!1,o.notYetRenderableCount=0,containsNeededPosition(e,t)){defined(t.data)&&defined(t.data.vertexArray)||queueTileLoad(e,e._tileLoadQueueMedium,t,r);var s=e._lastSelectionFrameNumber,l=t._lastSelectionResultFrame===s?t._lastSelectionResult:TileSelectionResult.NONE;l!==TileSelectionResult.CULLED_BUT_NEEDED&&l!==TileSelectionResult.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=TileSelectionResult.CULLED_BUT_NEEDED}else e.preloadSiblings||0===t.level?(queueTileLoad(e,e._tileLoadQueueLow,t,r),t._lastSelectionResult=TileSelectionResult.CULLED):t._lastSelectionResult=TileSelectionResult.CULLED;t._lastSelectionResultFrame=r.frameNumber}function screenSpaceError(e,t,i){if(t.mode===SceneMode$1.SCENE2D||t.camera.frustum instanceof OrthographicFrustum||t.camera.frustum instanceof OrthographicOffCenterFrustum)return screenSpaceError2D(e,t,i);var r=e._tileProvider.getLevelMaximumGeometricError(i.level),n=i._distance,a=r*t.context.drawingBufferHeight/(n*t.camera.frustum.sseDenominator);return t.fog.enabled&&(a-=CesiumMath.fog(n,t.fog.density)*t.fog.sse),a/=t.pixelRatio}function screenSpaceError2D(e,t,i){var r=t.camera.frustum;defined(r._offCenterFrustum)&&(r=r._offCenterFrustum);var n=t.context,a=n.drawingBufferWidth,o=n.drawingBufferHeight,s=e._tileProvider.getLevelMaximumGeometricError(i.level)/(Math.max(r.top-r.bottom,r.right-r.left)/Math.max(a,o));return t.fog.enabled&&t.mode!==SceneMode$1.SCENE2D&&(s-=CesiumMath.fog(i._distance,t.fog.density)*t.fog.sse),s/=t.pixelRatio}function addTileToRenderList(e,t){e._tilesToRender.push(t)}function processTileLoadQueue(e,t){var i=e._tileLoadQueueHigh,r=e._tileLoadQueueMedium,n=e._tileLoadQueueLow;if(0!==i.length||0!==r.length||0!==n.length){e._tileReplacementQueue.trimTiles(e.tileCacheSize);var a=getTimestamp$1()+e._loadQueueTimeSlice,o=e._tileProvider,s=processSinglePriorityLoadQueue(e,t,o,a,i,!1);s=processSinglePriorityLoadQueue(e,t,o,a,r,s),processSinglePriorityLoadQueue(e,t,o,a,n,s)}}function sortByLoadPriority(e,t){return e._loadPriority-t._loadPriority}function processSinglePriorityLoadQueue(e,t,i,r,n,a){void 0!==i.computeTileLoadPriority&&n.sort(sortByLoadPriority);for(var o=0,s=n.length;o<s&&(getTimestamp$1()<r||!a);++o){var l=n[o];e._tileReplacementQueue.markTileRendered(l),i.loadTile(t,l),a=!0}return a}var scratchRay=new Ray,scratchCartographic$1=new Cartographic,scratchPosition=new Cartesian3,scratchArray=[];function updateHeights(e,t){if(e.tileProvider.ready){var i=scratchArray;i.length=0;for(var r,n=e._tileToUpdateHeights,a=e._tileProvider.terrainProvider,o=getTimestamp$1()+e._updateHeightsTimeSlice,s=t.mode,l=t.mapProjection,c=e.tileProvider.tilingScheme.ellipsoid;n.length>0;){var u=n[0];if(defined(u.data)&&defined(u.data.mesh)){var d=u.customData,h=d.length,p=!1;for(r=e._lastTileIndex;r<h;++r){var f=d[r];if(u.level>f.level){if(defined(f.positionOnEllipsoidSurface)||(f.positionOnEllipsoidSurface=Cartesian3.fromRadians(f.positionCartographic.longitude,f.positionCartographic.latitude,0,c)),s===SceneMode$1.SCENE3D){var m=c.geodeticSurfaceNormal(f.positionOnEllipsoidSurface,scratchRay.direction);if(!defined(c.getSurfaceNormalIntersectionWithZAxis(f.positionOnEllipsoidSurface,11500,scratchRay.origin))){var g;defined(u.data.tileBoundingRegion)&&(g=u.data.tileBoundingRegion.minimumHeight);var _=Math.min(defaultValue(g,0),-11500),y=Cartesian3.multiplyByScalar(m,Math.abs(_)+1,scratchPosition);Cartesian3.subtract(f.positionOnEllipsoidSurface,y,scratchRay.origin)}}else Cartographic.clone(f.positionCartographic,scratchCartographic$1),scratchCartographic$1.height=-11500,l.project(scratchCartographic$1,scratchPosition),Cartesian3.fromElements(scratchPosition.z,scratchPosition.x,scratchPosition.y,scratchPosition),Cartesian3.clone(scratchPosition,scratchRay.origin),Cartesian3.clone(Cartesian3.UNIT_X,scratchRay.direction);var v=u.data.pick(scratchRay,s,l,!1,scratchPosition);defined(v)&&(f.callback(v),f.level=u.level)}else if(u.level===f.level){for(var C,T=u.children,S=T.length,A=0;A<S&&(C=T[A],!Rectangle.contains(C.rectangle,f.positionCartographic));++A);var x=a.getTileDataAvailable(C.x,C.y,C.level),E=u.parent;(defined(x)&&!x||defined(E)&&defined(E.data)&&defined(E.data.terrainData)&&!E.data.terrainData.isChildAvailable(E.x,E.y,C.x,C.y))&&f.removeFunc()}if(getTimestamp$1()>=o){p=!0;break}}if(p){e._lastTileIndex=r;break}e._lastTileIndex=0,n.shift()}else{var b=u._lastSelectionResultFrame===e._lastSelectionFrameNumber?u._lastSelectionResult:TileSelectionResult.NONE;b!==TileSelectionResult.RENDERED&&b!==TileSelectionResult.CULLED_BUT_NEEDED||i.push(u),n.shift(),e._lastTileIndex=0}}for(r=0;r<i.length;r++)n.push(i[r])}}function createRenderCommandsForSelectedTiles(e,t){for(var i=e._tileProvider,r=e._tilesToRender,n=0,a=r.length;n<a;++n){var o=r[n];i.showTileThisFrame(o,t)}}function QuadtreeTileProvider(){DeveloperError.throwInstantiationError()}function SceneTransitioner(e){this._scene=e,this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0,this._morphToOrthographic=!1}QuadtreeTileProvider.computeDefaultLevelZeroMaximumGeometricError=function(e){return 2*e.ellipsoid.maximumRadius*Math.PI*.25/(65*e.getNumberOfXTilesAtLevel(0))},Object.defineProperties(QuadtreeTileProvider.prototype,{quadtree:{get:DeveloperError.throwInstantiationError,set:DeveloperError.throwInstantiationError},ready:{get:DeveloperError.throwInstantiationError},tilingScheme:{get:DeveloperError.throwInstantiationError},errorEvent:{get:DeveloperError.throwInstantiationError}}),QuadtreeTileProvider.prototype.update=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.beginUpdate=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.endUpdate=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.getLevelMaximumGeometricError=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.loadTile=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.computeTileVisibility=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.showTileThisFrame=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.computeDistanceToTile=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.isDestroyed=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.destroy=DeveloperError.throwInstantiationError,SceneTransitioner.prototype.completeMorph=function(){defined(this._completeMorph)&&this._completeMorph()},SceneTransitioner.prototype.morphTo2D=function(e,t){defined(this._completeMorph)&&this._completeMorph();var i=this._scene;this._previousMode=i.mode,this._morphToOrthographic=i.camera.frustum instanceof OrthographicFrustum,this._previousMode!==SceneMode$1.SCENE2D&&this._previousMode!==SceneMode$1.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,SceneMode$1.SCENE2D,!0),i._mode=SceneMode$1.MORPHING,i.camera._setTransform(Matrix4.IDENTITY),this._previousMode===SceneMode$1.COLUMBUS_VIEW?morphFromColumbusViewTo2D(this,e):morphFrom3DTo2D(this,e,t),0===e&&defined(this._completeMorph)&&this._completeMorph())};var scratchToCVPosition=new Cartesian3,scratchToCVDirection=new Cartesian3,scratchToCVUp=new Cartesian3,scratchToCVPosition2D=new Cartesian3,scratchToCVDirection2D=new Cartesian3,scratchToCVUp2D=new Cartesian3,scratchToCVSurfacePosition=new Cartesian3,scratchToCVCartographic=new Cartographic,scratchToCVToENU=new Matrix4,scratchToCVFrustumPerspective=new PerspectiveFrustum,scratchToCVFrustumOrthographic=new OrthographicFrustum,scratchToCVCamera={position:void 0,direction:void 0,up:void 0,position2D:void 0,direction2D:void 0,up2D:void 0,frustum:void 0};SceneTransitioner.prototype.morphToColumbusView=function(e,t){defined(this._completeMorph)&&this._completeMorph();var i=this._scene;if(this._previousMode=i.mode,this._previousMode!==SceneMode$1.COLUMBUS_VIEW&&this._previousMode!==SceneMode$1.MORPHING){this._scene.morphStart.raiseEvent(this,this._previousMode,SceneMode$1.COLUMBUS_VIEW,!0),i.camera._setTransform(Matrix4.IDENTITY);var r,n=scratchToCVPosition,a=scratchToCVDirection,o=scratchToCVUp;if(e>0)n.x=0,n.y=-1,n.z=1,n=Cartesian3.multiplyByScalar(Cartesian3.normalize(n,n),5*t.maximumRadius,n),Cartesian3.negate(Cartesian3.normalize(n,a),a),Cartesian3.cross(Cartesian3.UNIT_X,a,o);else{var s=i.camera;if(this._previousMode===SceneMode$1.SCENE2D)Cartesian3.clone(s.position,n),n.z=s.frustum.right-s.frustum.left,Cartesian3.negate(Cartesian3.UNIT_Z,a),Cartesian3.clone(Cartesian3.UNIT_Y,o);else{Cartesian3.clone(s.positionWC,n),Cartesian3.clone(s.directionWC,a),Cartesian3.clone(s.upWC,o);var l=t.scaleToGeodeticSurface(n,scratchToCVSurfacePosition),c=Transforms.eastNorthUpToFixedFrame(l,t,scratchToCVToENU);Matrix4.inverseTransformation(c,c),i.mapProjection.project(t.cartesianToCartographic(n,scratchToCVCartographic),n),Matrix4.multiplyByPointAsVector(c,a,a),Matrix4.multiplyByPointAsVector(c,o,o)}}this._morphToOrthographic?((r=scratchToCVFrustumOrthographic).width=i.camera.frustum.right-i.camera.frustum.left,r.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight):((r=scratchToCVFrustumPerspective).aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,r.fov=CesiumMath.toRadians(60));var u=scratchToCVCamera;u.position=n,u.direction=a,u.up=o,u.frustum=r;var d=completeColumbusViewCallback(u);createMorphHandler(this,d),this._previousMode===SceneMode$1.SCENE2D?morphFrom2DToColumbusView(this,e,u,d):(u.position2D=Matrix4.multiplyByPoint(Camera.TRANSFORM_2D,n,scratchToCVPosition2D),u.direction2D=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,a,scratchToCVDirection2D),u.up2D=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,o,scratchToCVUp2D),i._mode=SceneMode$1.MORPHING,morphFrom3DToColumbusView(this,e,u,d)),0===e&&defined(this._completeMorph)&&this._completeMorph()}};var scratchCVTo3DCamera={position:new Cartesian3,direction:new Cartesian3,up:new Cartesian3,frustum:void 0},scratch2DTo3DFrustumPersp=new PerspectiveFrustum;function createMorphHandler(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new ScreenSpaceEventHandler(e._scene.canvas);var i=function(){e._morphCancelled=!0,e._scene.camera.cancelFlight(),t(e)};e._completeMorph=i,e._morphHandler.setInputAction(i,ScreenSpaceEventType$1.LEFT_DOWN),e._morphHandler.setInputAction(i,ScreenSpaceEventType$1.MIDDLE_DOWN),e._morphHandler.setInputAction(i,ScreenSpaceEventType$1.RIGHT_DOWN),e._morphHandler.setInputAction(i,ScreenSpaceEventType$1.WHEEL)}}function destroyMorphHandler(e){for(var t=e._currentTweens,i=0;i<t.length;++i)t[i].cancelTween();e._currentTweens.length=0,e._morphHandler=e._morphHandler&&e._morphHandler.destroy()}SceneTransitioner.prototype.morphTo3D=function(e,t){defined(this._completeMorph)&&this._completeMorph();var i=this._scene;if(this._previousMode=i.mode,this._previousMode!==SceneMode$1.SCENE3D&&this._previousMode!==SceneMode$1.MORPHING){if(this._scene.morphStart.raiseEvent(this,this._previousMode,SceneMode$1.SCENE3D,!0),i._mode=SceneMode$1.MORPHING,i.camera._setTransform(Matrix4.IDENTITY),this._previousMode===SceneMode$1.SCENE2D)morphFrom2DTo3D(this,e,t);else{var r,n;e>0?(r=scratchCVTo3DCamera,Cartesian3.fromDegrees(0,0,5*t.maximumRadius,t,r.position),Cartesian3.negate(r.position,r.direction),Cartesian3.normalize(r.direction,r.direction),Cartesian3.clone(Cartesian3.UNIT_Z,r.up)):r=getColumbusViewTo3DCamera(this,t);var a=i.camera;a.frustum instanceof OrthographicFrustum?n=a.frustum.clone():((n=scratch2DTo3DFrustumPersp).aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,n.fov=CesiumMath.toRadians(60)),r.frustum=n;var o=complete3DCallback(r);createMorphHandler(this,o),morphFromColumbusViewTo3D(this,e,r,o)}0===e&&defined(this._completeMorph)&&this._completeMorph()}},SceneTransitioner.prototype.isDestroyed=function(){return!1},SceneTransitioner.prototype.destroy=function(){return destroyMorphHandler(this),destroyObject(this)};var scratchCVTo3DCartographic=new Cartographic,scratchCVTo3DSurfacePoint=new Cartesian3,scratchCVTo3DFromENU=new Matrix4;function getColumbusViewTo3DCamera(e,t){var i=e._scene,r=i.camera,n=scratchCVTo3DCamera,a=n.position,o=n.direction,s=n.up,l=i.mapProjection.unproject(r.position,scratchCVTo3DCartographic);t.cartographicToCartesian(l,a);var c=t.scaleToGeodeticSurface(a,scratchCVTo3DSurfacePoint),u=Transforms.eastNorthUpToFixedFrame(c,t,scratchCVTo3DFromENU);return Matrix4.multiplyByPointAsVector(u,r.direction,o),Matrix4.multiplyByPointAsVector(u,r.up,s),n}var scratchCVTo3DStartPos=new Cartesian3,scratchCVTo3DStartDir=new Cartesian3,scratchCVTo3DStartUp=new Cartesian3,scratchCVTo3DEndPos=new Cartesian3,scratchCVTo3DEndDir=new Cartesian3,scratchCVTo3DEndUp=new Cartesian3;function morphFromColumbusViewTo3D(e,t,i,r){t*=.5;var n=e._scene,a=n.camera,o=Cartesian3.clone(a.position,scratchCVTo3DStartPos),s=Cartesian3.clone(a.direction,scratchCVTo3DStartDir),l=Cartesian3.clone(a.up,scratchCVTo3DStartUp),c=Matrix4.multiplyByPoint(Camera.TRANSFORM_2D_INVERSE,i.position,scratchCVTo3DEndPos),u=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D_INVERSE,i.direction,scratchCVTo3DEndDir),d=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D_INVERSE,i.up,scratchCVTo3DEndUp);var h=n.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(o,c,e.time,a.position),columbusViewMorph(s,u,e.time,a.direction),columbusViewMorph(l,d,e.time,a.up),Cartesian3.cross(a.direction,a.up,a.right),Cartesian3.normalize(a.right,a.right)},complete:function(){addMorphTimeAnimations(e,n,0,1,t,r)}});e._currentTweens.push(h)}var scratch2DTo3DFrustumOrtho=new OrthographicFrustum,scratch3DToCVStartPos=new Cartesian3,scratch3DToCVStartDir=new Cartesian3,scratch3DToCVStartUp=new Cartesian3,scratch3DToCVEndPos=new Cartesian3,scratch3DToCVEndDir=new Cartesian3,scratch3DToCVEndUp=new Cartesian3;function morphFrom2DTo3D(e,t,i){t/=3;var r,n,a=e._scene,o=a.camera;t>0?(r=scratchCVTo3DCamera,Cartesian3.fromDegrees(0,0,5*i.maximumRadius,i,r.position),Cartesian3.negate(r.position,r.direction),Cartesian3.normalize(r.direction,r.direction),Cartesian3.clone(Cartesian3.UNIT_Z,r.up)):(o.position.z=o.frustum.right-o.frustum.left,r=getColumbusViewTo3DCamera(e,i)),e._morphToOrthographic?((n=scratch2DTo3DFrustumOrtho).aspectRatio=a.drawingBufferWidth/a.drawingBufferHeight,n.width=o.frustum.right-o.frustum.left):((n=scratch2DTo3DFrustumPersp).aspectRatio=a.drawingBufferWidth/a.drawingBufferHeight,n.fov=CesiumMath.toRadians(60)),r.frustum=n;var s,l=complete3DCallback(r);createMorphHandler(e,l),s=e._morphToOrthographic?function(){morphFromColumbusViewTo3D(e,t,r,l)}:function(){morphOrthographicToPerspective(e,t,r,(function(){morphFromColumbusViewTo3D(e,t,r,l)}))},t>0?(a._mode=SceneMode$1.SCENE2D,o.flyTo({duration:t,destination:Cartesian3.fromDegrees(0,0,5*i.maximumRadius,i,scratch3DToCVEndPos),complete:function(){a._mode=SceneMode$1.MORPHING,s()}})):s()}function columbusViewMorph(e,t,i,r){return Cartesian3.lerp(e,t,i,r)}function morphPerspectiveToOrthographic(e,t,i,r,n){var a=e._scene,o=a.camera;if(!(o.frustum instanceof OrthographicFrustum)){var s=o.frustum.fov,l=.5*CesiumMath.RADIANS_PER_DEGREE,c=i.position.z*Math.tan(.5*s);o.frustum.far=c/Math.tan(.5*l)+1e7;var u=a.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){o.frustum.fov=CesiumMath.lerp(s,l,e.time);var t=c/Math.tan(.5*o.frustum.fov);r(o,t)},complete:function(){o.frustum=i.frustum.clone(),n(e)}});e._currentTweens.push(u)}}var scratchCVTo2DStartPos=new Cartesian3,scratchCVTo2DStartDir=new Cartesian3,scratchCVTo2DStartUp=new Cartesian3,scratchCVTo2DEndPos=new Cartesian3,scratchCVTo2DEndDir=new Cartesian3,scratchCVTo2DEndUp=new Cartesian3,scratchCVTo2DFrustum=new OrthographicOffCenterFrustum,scratchCVTo2DRay=new Ray,scratchCVTo2DPickPos=new Cartesian3,scratchCVTo2DCamera={position:void 0,direction:void 0,up:void 0,frustum:void 0};function morphFromColumbusViewTo2D(e,t){t*=.5;var i=e._scene,r=i.camera,n=Cartesian3.clone(r.position,scratchCVTo2DStartPos),a=Cartesian3.clone(r.direction,scratchCVTo2DStartDir),o=Cartesian3.clone(r.up,scratchCVTo2DStartUp),s=Cartesian3.negate(Cartesian3.UNIT_Z,scratchCVTo2DEndDir),l=Cartesian3.clone(Cartesian3.UNIT_Y,scratchCVTo2DEndUp),c=scratchCVTo2DEndPos;if(t>0)Cartesian3.clone(Cartesian3.ZERO,scratchCVTo2DEndPos),c.z=5*i.mapProjection.ellipsoid.maximumRadius;else{Cartesian3.clone(n,scratchCVTo2DEndPos);var u=scratchCVTo2DRay;Matrix4.multiplyByPoint(Camera.TRANSFORM_2D,n,u.origin),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,a,u.direction);var d=i.globe;if(defined(d)){var h=d.pickWorldCoordinates(u,i,!0,scratchCVTo2DPickPos);defined(h)&&(Matrix4.multiplyByPoint(Camera.TRANSFORM_2D_INVERSE,h,c),c.z+=Cartesian3.distance(n,c))}}var p=scratchCVTo2DFrustum;p.right=.5*c.z,p.left=-p.right,p.top=p.right*(i.drawingBufferHeight/i.drawingBufferWidth),p.bottom=-p.top;var f=scratchCVTo2DCamera;f.position=c,f.direction=s,f.up=l,f.frustum=p;var m=complete2DCallback(f);function g(e,t){e.position.z=t}createMorphHandler(e,m);var _=i.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(n,c,e.time,r.position),columbusViewMorph(a,s,e.time,r.direction),columbusViewMorph(o,l,e.time,r.up),Cartesian3.cross(r.direction,r.up,r.right),Cartesian3.normalize(r.right,r.right),r._adjustOrthographicFrustum(!0)},complete:function(){morphPerspectiveToOrthographic(e,t,f,g,m)}});e._currentTweens.push(_)}var scratch3DTo2DCartographic=new Cartographic,scratch3DTo2DCamera={position:new Cartesian3,direction:new Cartesian3,up:new Cartesian3,position2D:new Cartesian3,direction2D:new Cartesian3,up2D:new Cartesian3,frustum:new OrthographicOffCenterFrustum},scratch3DTo2DEndCamera={position:new Cartesian3,direction:new Cartesian3,up:new Cartesian3,frustum:void 0},scratch3DTo2DPickPosition=new Cartesian3,scratch3DTo2DRay=new Ray,scratch3DTo2DToENU=new Matrix4,scratch3DTo2DSurfacePoint=new Cartesian3;function morphFrom3DTo2D(e,t,i){t*=.5;var r=e._scene,n=r.camera,a=scratch3DTo2DCamera;if(t>0)Cartesian3.clone(Cartesian3.ZERO,a.position),a.position.z=5*i.maximumRadius,Cartesian3.negate(Cartesian3.UNIT_Z,a.direction),Cartesian3.clone(Cartesian3.UNIT_Y,a.up);else{i.cartesianToCartographic(n.positionWC,scratch3DTo2DCartographic),r.mapProjection.project(scratch3DTo2DCartographic,a.position),Cartesian3.negate(Cartesian3.UNIT_Z,a.direction),Cartesian3.clone(Cartesian3.UNIT_Y,a.up);var o=scratch3DTo2DRay;Cartesian3.clone(a.position2D,o.origin);var s=Cartesian3.clone(n.directionWC,o.direction),l=i.scaleToGeodeticSurface(n.positionWC,scratch3DTo2DSurfacePoint),c=Transforms.eastNorthUpToFixedFrame(l,i,scratch3DTo2DToENU);Matrix4.inverseTransformation(c,c),Matrix4.multiplyByPointAsVector(c,s,s),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,s,s);var u=r.globe;if(defined(u)){var d=u.pickWorldCoordinates(o,r,!0,scratch3DTo2DPickPosition);if(defined(d)){var h=Cartesian3.distance(a.position2D,d);d.x+=h,Cartesian3.clone(d,a.position2D)}}}function p(e,t){e.position.x=t}Matrix4.multiplyByPoint(Camera.TRANSFORM_2D,a.position,a.position2D),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,a.direction,a.direction2D),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,a.up,a.up2D);var f=a.frustum;f.right=.5*a.position.z,f.left=-f.right,f.top=f.right*(r.drawingBufferHeight/r.drawingBufferWidth),f.bottom=-f.top;var m=scratch3DTo2DEndCamera;Matrix4.multiplyByPoint(Camera.TRANSFORM_2D_INVERSE,a.position2D,m.position),Cartesian3.clone(a.direction,m.direction),Cartesian3.clone(a.up,m.up),m.frustum=f;var g=complete2DCallback(m);createMorphHandler(e,g),morphFrom3DToColumbusView(e,t,a,(function(){morphPerspectiveToOrthographic(e,t,a,p,g)}))}function morphOrthographicToPerspective(e,t,i,r){var n=e._scene,a=n.camera,o=a.frustum.right-a.frustum.left;a.frustum=i.frustum.clone();var s=a.frustum.fov,l=.5*CesiumMath.RADIANS_PER_DEGREE,c=o*Math.tan(.5*s);a.frustum.far=c/Math.tan(.5*l)+1e7,a.frustum.fov=l;var u=n.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){a.frustum.fov=CesiumMath.lerp(l,s,e.time),a.position.z=c/Math.tan(.5*a.frustum.fov)},complete:function(){r(e)}});e._currentTweens.push(u)}function morphFrom2DToColumbusView(e,t,i,r){t*=.5;var n=e._scene,a=n.camera,o=Cartesian3.clone(i.position,scratch3DToCVEndPos),s=Cartesian3.clone(i.direction,scratch3DToCVEndDir),l=Cartesian3.clone(i.up,scratch3DToCVEndUp);function c(){a.frustum=i.frustum.clone();var c=Cartesian3.clone(a.position,scratch3DToCVStartPos),u=Cartesian3.clone(a.direction,scratch3DToCVStartDir),d=Cartesian3.clone(a.up,scratch3DToCVStartUp);c.z=o.z;var h=n.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(c,o,e.time,a.position),columbusViewMorph(u,s,e.time,a.direction),columbusViewMorph(d,l,e.time,a.up),Cartesian3.cross(a.direction,a.up,a.right),Cartesian3.normalize(a.right,a.right)},complete:function(){r(e)}});e._currentTweens.push(h)}n._mode=SceneMode$1.MORPHING,e._morphToOrthographic?c():morphOrthographicToPerspective(e,0,i,c)}function morphFrom3DToColumbusView(e,t,i,r){var n=e._scene,a=n.camera,o=Cartesian3.clone(a.position,scratch3DToCVStartPos),s=Cartesian3.clone(a.direction,scratch3DToCVStartDir),l=Cartesian3.clone(a.up,scratch3DToCVStartUp),c=Cartesian3.clone(i.position2D,scratch3DToCVEndPos),u=Cartesian3.clone(i.direction2D,scratch3DToCVEndDir),d=Cartesian3.clone(i.up2D,scratch3DToCVEndUp);var h=n.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(o,c,e.time,a.position),columbusViewMorph(s,u,e.time,a.direction),columbusViewMorph(l,d,e.time,a.up),Cartesian3.cross(a.direction,a.up,a.right),Cartesian3.normalize(a.right,a.right),a._adjustOrthographicFrustum(!0)},complete:function(){addMorphTimeAnimations(e,n,1,0,t,r)}});e._currentTweens.push(h)}function addMorphTimeAnimations(e,t,i,r,n,a){var o={object:t,property:"morphTime",startValue:i,stopValue:r,duration:n,easingFunction:EasingFunction$1.QUARTIC_OUT};defined(a)&&(o.complete=function(){a(e)});var s=t.tweens.addProperty(o);e._currentTweens.push(s)}function complete3DCallback(e){return function(t){var i=t._scene;i._mode=SceneMode$1.SCENE3D,i.morphTime=SceneMode$1.getMorphTime(SceneMode$1.SCENE3D),destroyMorphHandler(t);var r=i.camera;(t._previousMode!==SceneMode$1.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,Cartesian3.clone(e.position,r.position),Cartesian3.clone(e.direction,r.direction),Cartesian3.clone(e.up,r.up),Cartesian3.cross(r.direction,r.up,r.right),Cartesian3.normalize(r.right,r.right),r.frustum=e.frustum.clone());var n=r.frustum;i.frameState.useLogDepth&&(n.near=.1,n.far=1e10);var a=defined(t._completeMorph);t._completeMorph=void 0,i.camera.update(i.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,SceneMode$1.SCENE3D,a)}}function complete2DCallback(e){return function(t){var i=t._scene;i._mode=SceneMode$1.SCENE2D,i.morphTime=SceneMode$1.getMorphTime(SceneMode$1.SCENE2D),destroyMorphHandler(t);var r=i.camera;Cartesian3.clone(e.position,r.position),r.position.z=2*i.mapProjection.ellipsoid.maximumRadius,Cartesian3.clone(e.direction,r.direction),Cartesian3.clone(e.up,r.up),Cartesian3.cross(r.direction,r.up,r.right),Cartesian3.normalize(r.right,r.right),r.frustum=e.frustum.clone();var n=defined(t._completeMorph);t._completeMorph=void 0,i.camera.update(i.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,SceneMode$1.SCENE2D,n)}}function completeColumbusViewCallback(e){return function(t){var i=t._scene;i._mode=SceneMode$1.COLUMBUS_VIEW,i.morphTime=SceneMode$1.getMorphTime(SceneMode$1.COLUMBUS_VIEW),destroyMorphHandler(t);var r=i.camera;(t._previousModeMode!==SceneMode$1.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,Cartesian3.clone(e.position,r.position),Cartesian3.clone(e.direction,r.direction),Cartesian3.clone(e.up,r.up),Cartesian3.cross(r.direction,r.up,r.right),Cartesian3.normalize(r.right,r.right));var n=r.frustum;i.frameState.useLogDepth&&(n.near=.1,n.far=1e10);var a=defined(t._completeMorph);t._completeMorph=void 0,i.camera.update(i.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,SceneMode$1.COLUMBUS_VIEW,a)}}function Tween(e,t,i,r,n,a,o,s,l,c){this._tweens=e,this._tweenjs=t,this._startObject=clone$1(i),this._stopObject=clone$1(r),this._duration=n,this._delay=a,this._easingFunction=o,this._update=s,this._complete=l,this.cancel=c,this.needsStart=!0}function TweenCollection(){this._tweens=[]}function ScreenSpaceCameraController(e){this.enableInputs=!0,this.enableTranslate=!0,this.enableZoom=!0,this.enableRotate=!0,this.enableTilt=!0,this.enableLook=!0,this.inertiaSpin=.9,this.inertiaTranslate=.9,this.inertiaZoom=.8,this.maximumMovementRatio=.1,this.bounceAnimationTime=3,this.minimumZoomDistance=1,this.maximumZoomDistance=Number.POSITIVE_INFINITY,this.translateEventTypes=CameraEventType$1.LEFT_DRAG,this.zoomEventTypes=[CameraEventType$1.RIGHT_DRAG,CameraEventType$1.WHEEL,CameraEventType$1.PINCH],this.rotateEventTypes=CameraEventType$1.LEFT_DRAG,this.tiltEventTypes=[CameraEventType$1.MIDDLE_DRAG,CameraEventType$1.PINCH,{eventType:CameraEventType$1.LEFT_DRAG,modifier:KeyboardEventModifier$1.CTRL},{eventType:CameraEventType$1.RIGHT_DRAG,modifier:KeyboardEventModifier$1.CTRL}],this.lookEventTypes={eventType:CameraEventType$1.LEFT_DRAG,modifier:KeyboardEventModifier$1.SHIFT},this.minimumPickingTerrainHeight=15e4,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight,this.minimumCollisionTerrainHeight=15e3,this._minimumCollisionTerrainHeight=this.minimumCollisionTerrainHeight,this.minimumTrackBallHeight=75e5,this._minimumTrackBallHeight=this.minimumTrackBallHeight,this.enableCollisionDetection=!0,this._scene=e,this._globe=void 0,this._ellipsoid=void 0,this._aggregator=new CameraEventAggregator(e.canvas),this._lastInertiaSpinMovement=void 0,this._lastInertiaZoomMovement=void 0,this._lastInertiaTranslateMovement=void 0,this._lastInertiaTiltMovement=void 0,this._inertiaDisablers={_lastInertiaZoomMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement","_lastInertiaTiltMovement"],_lastInertiaTiltMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement"]},this._tweens=new TweenCollection,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new Cartesian2(-1,-1),this._tiltCenter=new Cartesian3,this._rotateMousePosition=new Cartesian2(-1,-1),this._rotateStartPosition=new Cartesian3,this._strafeStartPosition=new Cartesian3,this._strafeMousePosition=new Cartesian2,this._strafeEndMousePosition=new Cartesian2,this._zoomMouseStart=new Cartesian2(-1,-1),this._zoomWorldPosition=new Cartesian3,this._useZoomWorldPosition=!1,this._tiltCVOffMap=!1,this._looking=!1,this._rotating=!1,this._strafing=!1,this._zoomingOnVector=!1,this._zoomingUnderground=!1,this._rotatingZoom=!1,this._adjustedHeightForTerrain=!1,this._cameraUnderground=!1;var t=e.mapProjection;this._maxCoord=t.project(new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO)),this._zoomFactor=5,this._rotateFactor=void 0,this._rotateRateRangeAdjustment=void 0,this._maximumRotateRate=1.77,this._minimumRotateRate=2e-4,this._minimumZoomRate=20,this._maximumZoomRate=5906376272e3,this._minimumUndergroundPickDistance=2e3,this._maximumUndergroundPickDistance=1e4}function decay(e,t){if(e<0)return 0;var i=25*(1-t);return Math.exp(-i*e)}function sameMousePosition(e){return Cartesian2.equalsEpsilon(e.startPosition,e.endPosition,CesiumMath.EPSILON14)}Object.defineProperties(Tween.prototype,{startObject:{get:function(){return this._startObject}},stopObject:{get:function(){return this._stopObject}},duration:{get:function(){return this._duration}},delay:{get:function(){return this._delay}},easingFunction:{get:function(){return this._easingFunction}},update:{get:function(){return this._update}},complete:{get:function(){return this._complete}},tweenjs:{get:function(){return this._tweenjs}}}),Tween.prototype.cancelTween=function(){this._tweens.remove(this)},Object.defineProperties(TweenCollection.prototype,{length:{get:function(){return this._tweens.length}}}),TweenCollection.prototype.add=function(e){if(0===(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).duration)return defined(e.complete)&&e.complete(),new Tween(this);var t=e.duration/TimeConstants$1.SECONDS_PER_MILLISECOND,i=defaultValue(e.delay,0),r=i/TimeConstants$1.SECONDS_PER_MILLISECOND,n=defaultValue(e.easingFunction,EasingFunction$1.LINEAR_NONE),a=e.startObject,o=new Tween$1.Tween(a);o.to(clone$1(e.stopObject),t),o.delay(r),o.easing(n),defined(e.update)&&o.onUpdate((function(){e.update(a)})),o.onComplete(defaultValue(e.complete,null)),o.repeat(defaultValue(e._repeat,0));var s=new Tween(this,o,e.startObject,e.stopObject,e.duration,i,n,e.update,e.complete,e.cancel);return this._tweens.push(s),s},TweenCollection.prototype.addProperty=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).object,i=e.property,r=e.startValue,n=e.stopValue;return this.add({startObject:{value:r},stopObject:{value:n},duration:defaultValue(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:function(e){t[i]=e.value},complete:e.complete,cancel:e.cancel,_repeat:e._repeat})},TweenCollection.prototype.addAlpha=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).material,i=[];for(var r in t.uniforms)t.uniforms.hasOwnProperty(r)&&defined(t.uniforms[r])&&defined(t.uniforms[r].alpha)&&i.push(r);return this.add({startObject:{alpha:defaultValue(e.startValue,0)},stopObject:{alpha:defaultValue(e.stopValue,1)},duration:defaultValue(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:function(e){for(var r=i.length,n=0;n<r;++n)t.uniforms[i[n]].alpha=e.alpha},complete:e.complete,cancel:e.cancel})},TweenCollection.prototype.addOffsetIncrement=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).material.uniforms;return this.addProperty({object:t,property:"offset",startValue:t.offset,stopValue:t.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})},TweenCollection.prototype.remove=function(e){if(!defined(e))return!1;var t=this._tweens.indexOf(e);return-1!==t&&(e.tweenjs.stop(),defined(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0)},TweenCollection.prototype.removeAll=function(){for(var e=this._tweens,t=0;t<e.length;++t){var i=e[t];i.tweenjs.stop(),defined(i.cancel)&&i.cancel()}e.length=0},TweenCollection.prototype.contains=function(e){return defined(e)&&-1!==this._tweens.indexOf(e)},TweenCollection.prototype.get=function(e){return this._tweens[e]},TweenCollection.prototype.update=function(e){var t=this._tweens,i=0;for(e=defined(e)?e/TimeConstants$1.SECONDS_PER_MILLISECOND:getTimestamp$1();i<t.length;){var r=t[i],n=r.tweenjs;r.needsStart?(r.needsStart=!1,n.start(e)):n.update(e)?i++:(n.stop(),t.splice(i,1))}};var inertiaMaxClickTimeThreshold=.4;function maintainInertia(e,t,i,r,n,a,o){var s=a[o];defined(s)||(s=a[o]={startPosition:new Cartesian2,endPosition:new Cartesian2,motion:new Cartesian2,inertiaEnabled:!0});var l=e.getButtonPressTime(t,i),c=e.getButtonReleaseTime(t,i),u=l&&c&&(c.getTime()-l.getTime())/1e3,d=new Date,h=c&&(d.getTime()-c.getTime())/1e3;if(l&&c&&u<inertiaMaxClickTimeThreshold){var p=decay(h,r),f=e.getLastMovement(t,i);if(!defined(f)||sameMousePosition(f)||!s.inertiaEnabled)return;if(s.motion.x=.5*(f.endPosition.x-f.startPosition.x),s.motion.y=.5*(f.endPosition.y-f.startPosition.y),s.startPosition=Cartesian2.clone(f.startPosition,s.startPosition),s.endPosition=Cartesian2.multiplyByScalar(s.motion,p,s.endPosition),s.endPosition=Cartesian2.add(s.startPosition,s.endPosition,s.endPosition),isNaN(s.endPosition.x)||isNaN(s.endPosition.y)||Cartesian2.distance(s.startPosition,s.endPosition)<.5)return;if(!e.isButtonDown(t,i))n(a,e.getStartMousePosition(t,i),s)}}function activateInertia(e,t){if(defined(t)){var i=e[t];defined(i)&&(i.inertiaEnabled=!0);var r=e._inertiaDisablers[t];if(defined(r))for(var n=r.length,a=0;a<n;++a)defined(i=e[r[a]])&&(i.inertiaEnabled=!1)}}var scratchEventTypeArray=[];function reactToInput(e,t,i,r,n,a){if(defined(i)){var o=e._aggregator;Array.isArray(i)||(scratchEventTypeArray[0]=i,i=scratchEventTypeArray);for(var s=i.length,l=0;l<s;++l){var c=i[l],u=defined(c.eventType)?c.eventType:c,d=c.modifier,h=o.isMoving(u,d)&&o.getMovement(u,d),p=o.getStartMousePosition(u,d);e.enableInputs&&t&&(h?(r(e,p,h),activateInertia(e,a)):n<1&&maintainInertia(o,u,d,n,r,e,a))}}}var scratchZoomPickRay=new Ray,scratchPickCartesian$1=new Cartesian3,scratchZoomOffset=new Cartesian2,scratchZoomDirection=new Cartesian3,scratchCenterPixel=new Cartesian2,scratchCenterPosition=new Cartesian3,scratchPositionNormal=new Cartesian3,scratchPickNormal=new Cartesian3,scratchZoomAxis=new Cartesian3,scratchCameraPositionNormal=new Cartesian3,scratchTargetNormal=new Cartesian3,scratchCameraPosition=new Cartesian3,scratchCameraUpNormal=new Cartesian3,scratchCameraRightNormal=new Cartesian3,scratchForwardNormal=new Cartesian3,scratchPositionToTarget=new Cartesian3,scratchPositionToTargetNormal=new Cartesian3,scratchPan=new Cartesian3,scratchCenterMovement=new Cartesian3,scratchCenter=new Cartesian3,scratchCartesian=new Cartesian3,scratchCartesianTwo=new Cartesian3,scratchCartesianThree=new Cartesian3,scratchZoomViewOptions={orientation:new HeadingPitchRoll};function handleZoom(e,t,i,r,n,a){var o=1;defined(a)&&(o=CesiumMath.clamp(Math.abs(a),.25,1));var s=e.minimumZoomDistance*o,l=e.maximumZoomDistance,c=r*(n-s);c=CesiumMath.clamp(c,e._minimumZoomRate,e._maximumZoomRate);var u=(i.endPosition.y-i.startPosition.y)/e._scene.canvas.clientHeight,d=c*(u=Math.min(u,e.maximumMovementRatio));if(e.enableCollisionDetection||0===e.minimumZoomDistance||!defined(e._globe)){if(d>0&&Math.abs(n-s)<1)return;if(d<0&&Math.abs(n-l)<1)return;n-d<s?d=n-s-1:n-d>l&&(d=n-l)}var h=e._scene,p=h.camera,f=h.mode,m=scratchZoomViewOptions.orientation;if(m.heading=p.heading,m.pitch=p.pitch,m.roll=p.roll,p.frustum instanceof OrthographicFrustum)Math.abs(d)>0&&(p.zoomIn(d),p._adjustOrthographicFrustum());else{var g,_=Cartesian2.equals(t,e._zoomMouseStart),y=e._zoomingOnVector,v=e._rotatingZoom;if(_||(e._zoomMouseStart=Cartesian2.clone(t,e._zoomMouseStart),defined(e._globe)&&(f===SceneMode$1.SCENE2D?(g=p.getPickRay(t,scratchZoomPickRay).origin,g=Cartesian3.fromElements(g.y,g.z,g.x)):g=pickGlobe(e,t,scratchPickCartesian$1)),defined(g)?(e._useZoomWorldPosition=!0,e._zoomWorldPosition=Cartesian3.clone(g,e._zoomWorldPosition)):e._useZoomWorldPosition=!1,y=e._zoomingOnVector=!1,v=e._rotatingZoom=!1,e._zoomingUnderground=e._cameraUnderground),e._useZoomWorldPosition){var C=f===SceneMode$1.COLUMBUS_VIEW;if(p.positionCartographic.height<2e6&&(v=!0),!_||v){if(f===SceneMode$1.SCENE2D){var T=e._zoomWorldPosition,S=p.position;if(!Cartesian3.equals(T,S)&&p.positionCartographic.height<2*e._maxCoord.x){var A=p.position.x,x=Cartesian3.subtract(T,S,scratchZoomDirection);Cartesian3.normalize(x,x);var E=Cartesian3.distance(T,S)*d/(.5*p.getMagnitude());p.move(x,.5*E),(p.position.x<0&&A>0||p.position.x>0&&A<0)&&(g=p.getPickRay(t,scratchZoomPickRay).origin,g=Cartesian3.fromElements(g.y,g.z,g.x),e._zoomWorldPosition=Cartesian3.clone(g,e._zoomWorldPosition))}}else if(f===SceneMode$1.SCENE3D){var b=Cartesian3.normalize(p.position,scratchCameraPositionNormal);if(e._cameraUnderground||e._zoomingUnderground||p.positionCartographic.height<3e3&&Math.abs(Cartesian3.dot(p.direction,b))<.6)C=!0;else{var P=h.canvas,D=scratchCenterPixel;D.x=P.clientWidth/2,D.y=P.clientHeight/2;var w=pickGlobe(e,D,scratchCenterPosition);if(defined(w))if(p.positionCartographic.height<1e6){if(!(Cartesian3.dot(p.direction,b)>=-.5)){var M=scratchCameraPosition;Cartesian3.clone(p.position,M);var I=e._zoomWorldPosition,R=scratchTargetNormal;if(R=Cartesian3.normalize(I,R),Cartesian3.dot(R,b)<0)return;var O=scratchCenter,B=scratchForwardNormal;Cartesian3.clone(p.direction,B),Cartesian3.add(M,Cartesian3.multiplyByScalar(B,1e3,scratchCartesian),O);var L=scratchPositionToTarget,F=scratchPositionToTargetNormal;Cartesian3.subtract(I,M,L),Cartesian3.normalize(L,F);var N=Cartesian3.dot(b,F);if(N>=0)return void(e._zoomMouseStart.x=-1);var V=Math.acos(-N),k=Cartesian3.magnitude(M),U=Cartesian3.magnitude(I),G=k-d,$=Cartesian3.magnitude(L),z=Math.asin(CesiumMath.clamp($/U*Math.sin(V),-1,1))-Math.asin(CesiumMath.clamp(G/U*Math.sin(V),-1,1))+V,H=scratchCameraUpNormal;Cartesian3.normalize(M,H);var W=scratchCameraRightNormal;W=Cartesian3.cross(F,H,W),W=Cartesian3.normalize(W,W),Cartesian3.normalize(Cartesian3.cross(H,W,scratchCartesian),B),Cartesian3.multiplyByScalar(Cartesian3.normalize(O,scratchCartesian),Cartesian3.magnitude(O)-d,O),Cartesian3.normalize(M,M),Cartesian3.multiplyByScalar(M,G,M);var j=scratchPan;Cartesian3.multiplyByScalar(Cartesian3.add(Cartesian3.multiplyByScalar(H,Math.cos(z)-1,scratchCartesianTwo),Cartesian3.multiplyByScalar(B,Math.sin(z),scratchCartesianThree),scratchCartesian),G,j),Cartesian3.add(M,j,M),Cartesian3.normalize(O,H),Cartesian3.normalize(Cartesian3.cross(H,W,scratchCartesian),B);var q=scratchCenterMovement;return Cartesian3.multiplyByScalar(Cartesian3.add(Cartesian3.multiplyByScalar(H,Math.cos(z)-1,scratchCartesianTwo),Cartesian3.multiplyByScalar(B,Math.sin(z),scratchCartesianThree),scratchCartesian),Cartesian3.magnitude(O),q),Cartesian3.add(O,q,O),Cartesian3.clone(M,p.position),Cartesian3.normalize(Cartesian3.subtract(O,M,scratchCartesian),p.direction),Cartesian3.clone(p.direction,p.direction),Cartesian3.cross(p.direction,p.up,p.right),Cartesian3.cross(p.right,p.direction,p.up),void p.setView(scratchZoomViewOptions)}C=!0}else{var X=Cartesian3.normalize(w,scratchPositionNormal),Y=Cartesian3.normalize(e._zoomWorldPosition,scratchPickNormal),K=Cartesian3.dot(Y,X);if(K>0&&K<1){var J=CesiumMath.acosClamped(K),Q=Cartesian3.cross(Y,X,scratchZoomAxis),Z=d/(Math.abs(J)>CesiumMath.toRadians(20)?.75*p.positionCartographic.height:p.positionCartographic.height-d);p.rotate(Q,J*Z)}}else C=!0}}e._rotatingZoom=!C}if(!_&&C||y){var ee=SceneTransforms.wgs84ToWindowCoordinates(h,e._zoomWorldPosition,scratchZoomOffset),te=(f!==SceneMode$1.COLUMBUS_VIEW&&Cartesian2.equals(t,e._zoomMouseStart)&&defined(ee)?p.getPickRay(ee,scratchZoomPickRay):p.getPickRay(t,scratchZoomPickRay)).direction;f!==SceneMode$1.COLUMBUS_VIEW&&f!==SceneMode$1.SCENE2D||Cartesian3.fromElements(te.y,te.z,te.x,te),p.move(te,d),e._zoomingOnVector=!0}else p.zoomIn(d);e._cameraUnderground||p.setView(scratchZoomViewOptions)}else p.zoomIn(d)}}var translate2DStart=new Ray,translate2DEnd=new Ray,scratchTranslateP0=new Cartesian3;function translate2D(e,t,i){var r=e._scene.camera,n=r.getPickRay(i.startPosition,translate2DStart).origin,a=r.getPickRay(i.endPosition,translate2DEnd).origin;n=Cartesian3.fromElements(n.y,n.z,n.x,n),a=Cartesian3.fromElements(a.y,a.z,a.x,a);var o=Cartesian3.subtract(n,a,scratchTranslateP0),s=Cartesian3.magnitude(o);s>0&&(Cartesian3.normalize(o,o),r.move(o,s))}function zoom2D(e,t,i){defined(i.distance)&&(i=i.distance);var r=e._scene.camera;handleZoom(e,t,i,e._zoomFactor,r.getMagnitude())}var twist2DStart=new Cartesian2,twist2DEnd=new Cartesian2;function twist2D(e,t,i){if(defined(i.angleAndHeight))singleAxisTwist2D(e,t,i.angleAndHeight);else{var r=e._scene,n=r.camera,a=r.canvas,o=a.clientWidth,s=a.clientHeight,l=twist2DStart;l.x=2/o*i.startPosition.x-1,l.y=2/s*(s-i.startPosition.y)-1,l=Cartesian2.normalize(l,l);var c=twist2DEnd;c.x=2/o*i.endPosition.x-1,c.y=2/s*(s-i.endPosition.y)-1,c=Cartesian2.normalize(c,c);var u=CesiumMath.acosClamped(l.x);l.y<0&&(u=CesiumMath.TWO_PI-u);var d=CesiumMath.acosClamped(c.x);c.y<0&&(d=CesiumMath.TWO_PI-d);var h=d-u;n.twistRight(h)}}function singleAxisTwist2D(e,t,i){var r=e._rotateFactor*e._rotateRateRangeAdjustment;r>e._maximumRotateRate&&(r=e._maximumRotateRate),r<e._minimumRotateRate&&(r=e._minimumRotateRate);var n=e._scene,a=n.camera,o=n.canvas,s=(i.endPosition.x-i.startPosition.x)/o.clientWidth,l=r*(s=Math.min(s,e.maximumMovementRatio))*Math.PI*4;a.twistRight(l)}function update2D(e){var t=e._scene.mapMode2D===MapMode2D$1.ROTATE;Matrix4.equals(Matrix4.IDENTITY,e._scene.camera.transform)?(reactToInput(e,e.enableTranslate,e.translateEventTypes,translate2D,e.inertiaTranslate,"_lastInertiaTranslateMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom2D,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&reactToInput(e,e.enableRotate,e.tiltEventTypes,twist2D,e.inertiaSpin,"_lastInertiaTiltMovement")):(reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom2D,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&reactToInput(e,e.enableRotate,e.translateEventTypes,twist2D,e.inertiaSpin,"_lastInertiaSpinMovement"))}var pickGlobeScratchRay=new Ray,scratchDepthIntersection=new Cartesian3,scratchRayIntersection=new Cartesian3;function pickGlobe(e,t,i){var r=e._scene,n=e._globe,a=r.camera;if(defined(n)){var o,s=!e._cameraUnderground;r.pickPositionSupported&&(o=r.pickPositionWorldCoordinates(t,scratchDepthIntersection));var l=a.getPickRay(t,pickGlobeScratchRay),c=n.pickWorldCoordinates(l,r,s,scratchRayIntersection);return(defined(o)?Cartesian3.distance(o,a.positionWC):Number.POSITIVE_INFINITY)<(defined(c)?Cartesian3.distance(c,a.positionWC):Number.POSITIVE_INFINITY)?Cartesian3.clone(o,i):Cartesian3.clone(c,i)}}var scratchDistanceCartographic=new Cartographic;function getDistanceFromSurface(e){var t=e._ellipsoid,i=e._scene,r=i.camera,n=0;if(i.mode===SceneMode$1.SCENE3D){var a=t.cartesianToCartographic(r.position,scratchDistanceCartographic);defined(a)&&(n=a.height)}else n=r.position.z;var o=defaultValue(e._scene.globeHeight,0);return Math.abs(o-n)}var scratchSurfaceNormal=new Cartesian3;function getZoomDistanceUnderground(e,t){var i=t.origin,r=t.direction,n=getDistanceFromSurface(e),a=Cartesian3.normalize(i,scratchSurfaceNormal),o=Math.abs(Cartesian3.dot(a,r));return n*(o=2*Math.max(o,.5))}function getTiltCenterUnderground(e,t,i,r){var n=Cartesian3.distance(t.origin,i),a=getDistanceFromSurface(e);return n>CesiumMath.clamp(5*a,e._minimumUndergroundPickDistance,e._maximumUndergroundPickDistance)&&(n=Math.min(n,a/5),n=Math.max(n,100)),Ray.getPoint(t,n,r)}function getStrafeStartPositionUnderground(e,t,i,r){var n;return defined(i)?(n=Cartesian3.distance(t.origin,i))>e._maximumUndergroundPickDistance&&(n=getDistanceFromSurface(e)):n=getDistanceFromSurface(e),Ray.getPoint(t,n,r)}var scratchInertialDelta=new Cartesian2;function continueStrafing(e,t){var i=t.endPosition,r=Cartesian2.subtract(t.endPosition,t.startPosition,scratchInertialDelta),n=e._strafeEndMousePosition;Cartesian2.add(n,r,n),t.endPosition=n,strafe(e,t,e._strafeStartPosition),t.endPosition=i}var translateCVStartRay=new Ray,translateCVEndRay=new Ray,translateCVStartPos=new Cartesian3,translateCVEndPos=new Cartesian3,translateCVDifference=new Cartesian3,translateCVOrigin=new Cartesian3,translateCVPlane=new Plane(Cartesian3.UNIT_X,0),translateCVStartMouse=new Cartesian2,translateCVEndMouse=new Cartesian2;function translateCV(e,t,i){if(Cartesian3.equals(t,e._translateMousePosition)||(e._looking=!1),Cartesian3.equals(t,e._strafeMousePosition)||(e._strafing=!1),e._looking)look3D(e,t,i);else if(e._strafing)continueStrafing(e,i);else{var r,n=e._scene.camera,a=e._cameraUnderground,o=Cartesian2.clone(i.startPosition,translateCVStartMouse),s=Cartesian2.clone(i.endPosition,translateCVEndMouse),l=n.getPickRay(o,translateCVStartRay),c=Cartesian3.clone(Cartesian3.ZERO,translateCVOrigin),u=Cartesian3.UNIT_X;if(n.position.z<e._minimumPickingTerrainHeight&&defined(r=pickGlobe(e,o,translateCVStartPos))&&(c.x=r.x),a||c.x>n.position.z&&defined(r)){var d=r;return a&&(d=getStrafeStartPositionUnderground(e,l,r,translateCVStartPos)),Cartesian2.clone(t,e._strafeMousePosition),Cartesian2.clone(t,e._strafeEndMousePosition),Cartesian3.clone(d,e._strafeStartPosition),e._strafing=!0,void strafe(e,i,e._strafeStartPosition)}var h=Plane.fromPointNormal(c,u,translateCVPlane);l=n.getPickRay(o,translateCVStartRay);var p=IntersectionTests.rayPlane(l,h,translateCVStartPos),f=n.getPickRay(s,translateCVEndRay),m=IntersectionTests.rayPlane(f,h,translateCVEndPos);if(!defined(p)||!defined(m))return e._looking=!0,look3D(e,t,i),void Cartesian2.clone(t,e._translateMousePosition);var g=Cartesian3.subtract(p,m,translateCVDifference),_=g.x;g.x=g.y,g.y=g.z,g.z=_;var y=Cartesian3.magnitude(g);y>CesiumMath.EPSILON6&&(Cartesian3.normalize(g,g),n.move(g,y))}}var rotateCVWindowPos=new Cartesian2,rotateCVWindowRay=new Ray,rotateCVCenter=new Cartesian3,rotateCVVerticalCenter=new Cartesian3,rotateCVTransform=new Matrix4,rotateCVVerticalTransform=new Matrix4,rotateCVOrigin=new Cartesian3,rotateCVPlane=new Plane(Cartesian3.UNIT_X,0),rotateCVCartesian3=new Cartesian3,rotateCVCart=new Cartographic,rotateCVOldTransform=new Matrix4,rotateCVQuaternion=new Quaternion,rotateCVMatrix=new Matrix3,tilt3DCartesian3=new Cartesian3;function rotateCV(e,t,i){if(defined(i.angleAndHeight)&&(i=i.angleAndHeight),Cartesian2.equals(t,e._tiltCenterMousePosition)||(e._tiltCVOffMap=!1,e._looking=!1),e._looking)look3D(e,t,i);else{var r=e._scene.camera;e._tiltCVOffMap||!e.onMap()||Math.abs(r.position.z)>e._minimumPickingTerrainHeight?(e._tiltCVOffMap=!0,rotateCVOnPlane(e,t,i)):rotateCVOnTerrain(e,t,i)}}function rotateCVOnPlane(e,t,i){var r=e._scene,n=r.camera,a=r.canvas,o=rotateCVWindowPos;o.x=a.clientWidth/2,o.y=a.clientHeight/2;var s,l=n.getPickRay(o,rotateCVWindowRay),c=Cartesian3.UNIT_X,u=l.origin,d=l.direction,h=Cartesian3.dot(c,d);if(Math.abs(h)>CesiumMath.EPSILON6&&(s=-Cartesian3.dot(c,u)/h),!defined(s)||s<=0)return e._looking=!0,look3D(e,t,i),void Cartesian2.clone(t,e._tiltCenterMousePosition);var p=Cartesian3.multiplyByScalar(d,s,rotateCVCenter);Cartesian3.add(u,p,p);var f=r.mapProjection,m=f.ellipsoid;Cartesian3.fromElements(p.y,p.z,p.x,p);var g=f.unproject(p,rotateCVCart);m.cartographicToCartesian(g,p);var _=Transforms.eastNorthUpToFixedFrame(p,m,rotateCVTransform),y=e._globe,v=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;var C=Matrix4.clone(n.transform,rotateCVOldTransform);n._setTransform(_),rotate3D(e,t,i,Cartesian3.UNIT_Z),n._setTransform(C),e._globe=y,e._ellipsoid=v;var T=v.maximumRadius;e._rotateFactor=1/T,e._rotateRateRangeAdjustment=T}function rotateCVOnTerrain(e,t,i){var r,n,a=e._scene,o=a.camera,s=e._cameraUnderground,l=Cartesian3.UNIT_X;if(Cartesian2.equals(t,e._tiltCenterMousePosition))r=Cartesian3.clone(e._tiltCenter,rotateCVCenter);else{if(o.position.z<e._minimumPickingTerrainHeight&&(r=pickGlobe(e,t,rotateCVCenter)),!defined(r)){var c,u=(n=o.getPickRay(t,rotateCVWindowRay)).origin,d=n.direction,h=Cartesian3.dot(l,d);if(Math.abs(h)>CesiumMath.EPSILON6&&(c=-Cartesian3.dot(l,u)/h),!defined(c)||c<=0)return e._looking=!0,look3D(e,t,i),void Cartesian2.clone(t,e._tiltCenterMousePosition);r=Cartesian3.multiplyByScalar(d,c,rotateCVCenter),Cartesian3.add(u,r,r)}s&&(defined(n)||(n=o.getPickRay(t,rotateCVWindowRay)),getTiltCenterUnderground(e,n,r,r)),Cartesian2.clone(t,e._tiltCenterMousePosition),Cartesian3.clone(r,e._tiltCenter)}var p=a.canvas,f=rotateCVWindowPos;f.x=p.clientWidth/2,f.y=e._tiltCenterMousePosition.y,n=o.getPickRay(f,rotateCVWindowRay);var m=Cartesian3.clone(Cartesian3.ZERO,rotateCVOrigin);m.x=r.x;var g=Plane.fromPointNormal(m,l,rotateCVPlane),_=IntersectionTests.rayPlane(n,g,rotateCVVerticalCenter),y=o._projection,v=y.ellipsoid;Cartesian3.fromElements(r.y,r.z,r.x,r);var C=y.unproject(r,rotateCVCart);v.cartographicToCartesian(C,r);var T,S=Transforms.eastNorthUpToFixedFrame(r,v,rotateCVTransform);defined(_)?(Cartesian3.fromElements(_.y,_.z,_.x,_),C=y.unproject(_,rotateCVCart),v.cartographicToCartesian(C,_),T=Transforms.eastNorthUpToFixedFrame(_,v,rotateCVVerticalTransform)):T=S;var A=e._globe,x=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;var E=Cartesian3.UNIT_Z,b=Matrix4.clone(o.transform,rotateCVOldTransform);o._setTransform(S);var P=Cartesian3.cross(Cartesian3.UNIT_Z,Cartesian3.normalize(o.position,rotateCVCartesian3),rotateCVCartesian3),D=Cartesian3.dot(o.right,P);if(rotate3D(e,t,i,E,!1,!0),o._setTransform(T),D<0){var w=i.startPosition.y-i.endPosition.y;(s&&w<0||!s&&w>0)&&(E=void 0);var M=o.constrainedAxis;o.constrainedAxis=void 0,rotate3D(e,t,i,E,!0,!1),o.constrainedAxis=M}else rotate3D(e,t,i,E,!0,!1);if(defined(o.constrainedAxis)){var I=Cartesian3.cross(o.direction,o.constrainedAxis,tilt3DCartesian3);Cartesian3.equalsEpsilon(I,Cartesian3.ZERO,CesiumMath.EPSILON6)||(Cartesian3.dot(I,o.right)<0&&Cartesian3.negate(I,I),Cartesian3.cross(I,o.direction,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.normalize(o.up,o.up),Cartesian3.normalize(o.right,o.right))}o._setTransform(b),e._globe=A,e._ellipsoid=x;var R=x.maximumRadius;e._rotateFactor=1/R,e._rotateRateRangeAdjustment=R;var O=Cartesian3.clone(o.positionWC,rotateCVCartesian3);if(e.enableCollisionDetection&&adjustHeightForTerrain(e),!Cartesian3.equals(o.positionWC,O)){o._setTransform(T),o.worldToCameraCoordinatesPoint(O,O);var B=Cartesian3.magnitudeSquared(O);Cartesian3.magnitudeSquared(o.position)>B&&(Cartesian3.normalize(o.position,o.position),Cartesian3.multiplyByScalar(o.position,Math.sqrt(B),o.position));var L=Cartesian3.angleBetween(O,o.position),F=Cartesian3.cross(O,o.position,O);Cartesian3.normalize(F,F);var N=Quaternion.fromAxisAngle(F,L,rotateCVQuaternion),V=Matrix3.fromQuaternion(N,rotateCVMatrix);Matrix3.multiplyByVector(V,o.direction,o.direction),Matrix3.multiplyByVector(V,o.up,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.cross(o.right,o.direction,o.up),o._setTransform(b)}}var zoomCVWindowPos=new Cartesian2,zoomCVWindowRay=new Ray,zoomCVIntersection=new Cartesian3;function zoomCV(e,t,i){defined(i.distance)&&(i=i.distance);var r,n=e._scene,a=n.camera,o=n.canvas,s=e._cameraUnderground;s?r=t:((r=zoomCVWindowPos).x=o.clientWidth/2,r.y=o.clientHeight/2);var l,c,u=a.getPickRay(r,zoomCVWindowRay),d=u.origin,h=u.direction;if(a.position.z<e._minimumPickingTerrainHeight&&(l=pickGlobe(e,r,zoomCVIntersection)),defined(l)&&(c=Cartesian3.distance(d,l)),s){var p=getZoomDistanceUnderground(e,u);c=defined(c)?Math.min(c,p):p}if(!defined(c)){var f=Cartesian3.UNIT_X;c=-Cartesian3.dot(f,d)/Cartesian3.dot(f,h)}handleZoom(e,t,i,e._zoomFactor,c)}function updateCV(e){var t=e._scene.camera;if(Matrix4.equals(Matrix4.IDENTITY,t.transform)){var i=e._tweens;if(e._aggregator.anyButtonDown&&i.removeAll(),reactToInput(e,e.enableTilt,e.tiltEventTypes,rotateCV,e.inertiaSpin,"_lastInertiaTiltMovement"),reactToInput(e,e.enableTranslate,e.translateEventTypes,translateCV,e.inertiaTranslate,"_lastInertiaTranslateMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoomCV,e.inertiaZoom,"_lastInertiaZoomMovement"),reactToInput(e,e.enableLook,e.lookEventTypes,look3D),!e._aggregator.anyButtonDown&&!i.contains(e._tween)){var r=t.createCorrectPositionTween(e.bounceAnimationTime);defined(r)&&(e._tween=i.add(r))}i.update()}else reactToInput(e,e.enableRotate,e.rotateEventTypes,rotate3D,e.inertiaSpin,"_lastInertiaSpinMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom3D,e.inertiaZoom,"_lastInertiaZoomMovement")}var scratchStrafeRay=new Ray,scratchStrafePlane=new Plane(Cartesian3.UNIT_X,0),scratchStrafeIntersection=new Cartesian3,scratchStrafeDirection=new Cartesian3,scratchMousePos=new Cartesian3;function strafe(e,t,i){var r=e._scene,n=r.camera,a=n.getPickRay(t.endPosition,scratchStrafeRay),o=Cartesian3.clone(n.direction,scratchStrafeDirection);r.mode===SceneMode$1.COLUMBUS_VIEW&&Cartesian3.fromElements(o.z,o.x,o.y,o);var s=Plane.fromPointNormal(i,o,scratchStrafePlane),l=IntersectionTests.rayPlane(a,s,scratchStrafeIntersection);defined(l)&&(o=Cartesian3.subtract(i,l,o),r.mode===SceneMode$1.COLUMBUS_VIEW&&Cartesian3.fromElements(o.y,o.z,o.x,o),Cartesian3.add(n.position,o,n.position))}var spin3DPick=new Cartesian3,scratchCartographic=new Cartographic,scratchRadii=new Cartesian3,scratchEllipsoid=new Ellipsoid,scratchLookUp=new Cartesian3,scratchNormal=new Cartesian3;function spin3D(e,t,i){var r=e._scene.camera,n=e._cameraUnderground,a=e._ellipsoid;if(Matrix4.equals(r.transform,Matrix4.IDENTITY)){var o,s,l=a.geodeticSurfaceNormal(r.position,scratchLookUp);if(Cartesian2.equals(t,e._rotateMousePosition))if(e._looking)look3D(e,t,i,l);else if(e._rotating)rotate3D(e,t,i);else if(e._strafing)continueStrafing(e,i);else{if(Cartesian3.magnitude(r.position)<Cartesian3.magnitude(e._rotateStartPosition))return;o=Cartesian3.magnitude(e._rotateStartPosition),(s=scratchRadii).x=s.y=s.z=o,pan3D(e,t,i,a=Ellipsoid.fromCartesian3(s,scratchEllipsoid))}else{e._looking=!1,e._rotating=!1,e._strafing=!1;var c=a.cartesianToCartographic(r.positionWC,scratchCartographic).height;if(defined(e._globe)&&c<e._minimumPickingTerrainHeight){var u=pickGlobe(e,i.startPosition,scratchMousePos);if(defined(u)){var d=!1,h=r.getPickRay(i.startPosition,pickGlobeScratchRay);if(n)d=!0,getStrafeStartPositionUnderground(e,h,u,u);else{var p=a.geodeticSurfaceNormal(u,scratchNormal);d=!!(Math.abs(Cartesian3.dot(h.direction,p))<.05)||Cartesian3.magnitude(r.position)<Cartesian3.magnitude(u)}d?(Cartesian2.clone(t,e._strafeEndMousePosition),Cartesian3.clone(u,e._strafeStartPosition),e._strafing=!0,strafe(e,i,e._strafeStartPosition)):(o=Cartesian3.magnitude(u),(s=scratchRadii).x=s.y=s.z=o,pan3D(e,t,i,a=Ellipsoid.fromCartesian3(s,scratchEllipsoid)),Cartesian3.clone(u,e._rotateStartPosition))}else e._looking=!0,look3D(e,t,i,l)}else defined(r.pickEllipsoid(i.startPosition,e._ellipsoid,spin3DPick))?(pan3D(e,t,i,e._ellipsoid),Cartesian3.clone(spin3DPick,e._rotateStartPosition)):c>e._minimumTrackBallHeight?(e._rotating=!0,rotate3D(e,t,i)):(e._looking=!0,look3D(e,t,i,l));Cartesian2.clone(t,e._rotateMousePosition)}}else rotate3D(e,t,i)}function rotate3D(e,t,i,r,n,a){n=defaultValue(n,!1),a=defaultValue(a,!1);var o=e._scene,s=o.camera,l=o.canvas,c=s.constrainedAxis;defined(r)&&(s.constrainedAxis=r);var u=Cartesian3.magnitude(s.position),d=e._rotateFactor*(u-e._rotateRateRangeAdjustment);d>e._maximumRotateRate&&(d=e._maximumRotateRate),d<e._minimumRotateRate&&(d=e._minimumRotateRate);var h=(i.startPosition.x-i.endPosition.x)/l.clientWidth,p=(i.startPosition.y-i.endPosition.y)/l.clientHeight;h=Math.min(h,e.maximumMovementRatio),p=Math.min(p,e.maximumMovementRatio);var f=d*h*Math.PI*2,m=d*p*Math.PI;n||s.rotateRight(f),a||s.rotateUp(m),s.constrainedAxis=c}var pan3DP0=Cartesian4.clone(Cartesian4.UNIT_W),pan3DP1=Cartesian4.clone(Cartesian4.UNIT_W),pan3DTemp0=new Cartesian3,pan3DTemp1=new Cartesian3,pan3DTemp2=new Cartesian3,pan3DTemp3=new Cartesian3,pan3DStartMousePosition=new Cartesian2,pan3DEndMousePosition=new Cartesian2;function pan3D(e,t,i,r){var n=e._scene.camera,a=Cartesian2.clone(i.startPosition,pan3DStartMousePosition),o=Cartesian2.clone(i.endPosition,pan3DEndMousePosition),s=n.pickEllipsoid(a,r,pan3DP0),l=n.pickEllipsoid(o,r,pan3DP1);if(!defined(s)||!defined(l))return e._rotating=!0,void rotate3D(e,t,i);if(s=n.worldToCameraCoordinates(s,s),l=n.worldToCameraCoordinates(l,l),defined(n.constrainedAxis)){var c=n.constrainedAxis,u=Cartesian3.mostOrthogonalAxis(c,pan3DTemp0);Cartesian3.cross(u,c,u),Cartesian3.normalize(u,u);var d=Cartesian3.cross(c,u,pan3DTemp1),h=Cartesian3.magnitude(s),p=Cartesian3.dot(c,s),f=Math.acos(p/h),m=Cartesian3.multiplyByScalar(c,p,pan3DTemp2);Cartesian3.subtract(s,m,m),Cartesian3.normalize(m,m);var g=Cartesian3.magnitude(l),_=Cartesian3.dot(c,l),y=Math.acos(_/g),v=Cartesian3.multiplyByScalar(c,_,pan3DTemp3);Cartesian3.subtract(l,v,v),Cartesian3.normalize(v,v);var C=Math.acos(Cartesian3.dot(m,u));Cartesian3.dot(m,d)<0&&(C=CesiumMath.TWO_PI-C);var T=Math.acos(Cartesian3.dot(v,u));Cartesian3.dot(v,d)<0&&(T=CesiumMath.TWO_PI-T);var S,A=C-T;S=Cartesian3.equalsEpsilon(c,n.position,CesiumMath.EPSILON2)?n.right:Cartesian3.cross(c,n.position,pan3DTemp0);var x,E=Cartesian3.cross(c,S,pan3DTemp0),b=Cartesian3.dot(E,Cartesian3.subtract(s,c,pan3DTemp1)),P=Cartesian3.dot(E,Cartesian3.subtract(l,c,pan3DTemp1));x=b>0&&P>0?y-f:b>0&&P<=0?Cartesian3.dot(n.position,c)>0?-f-y:f+y:f-y,n.rotateRight(A),n.rotateUp(x)}else{Cartesian3.normalize(s,s),Cartesian3.normalize(l,l);var D=Cartesian3.dot(s,l),w=Cartesian3.cross(s,l,pan3DTemp0);if(D<1&&!Cartesian3.equalsEpsilon(w,Cartesian3.ZERO,CesiumMath.EPSILON14)){var M=Math.acos(D);n.rotate(w,M)}}}var zoom3DUnitPosition=new Cartesian3,zoom3DCartographic=new Cartographic;function zoom3D(e,t,i){defined(i.distance)&&(i=i.distance);var r,n=e._ellipsoid,a=e._scene,o=a.camera,s=a.canvas,l=e._cameraUnderground;l?r=t:((r=zoomCVWindowPos).x=s.clientWidth/2,r.y=s.clientHeight/2);var c,u,d=o.getPickRay(r,zoomCVWindowRay),h=n.cartesianToCartographic(o.position,zoom3DCartographic).height;if(h<e._minimumPickingTerrainHeight&&(c=pickGlobe(e,r,zoomCVIntersection)),defined(c)&&(u=Cartesian3.distance(d.origin,c)),l){var p=getZoomDistanceUnderground(e,d);u=defined(u)?Math.min(u,p):p}defined(u)||(u=h);var f=Cartesian3.normalize(o.position,zoom3DUnitPosition);handleZoom(e,t,i,e._zoomFactor,u,Cartesian3.dot(f,o.direction))}var tilt3DWindowPos=new Cartesian2,tilt3DRay=new Ray,tilt3DCenter=new Cartesian3,tilt3DVerticalCenter=new Cartesian3,tilt3DTransform=new Matrix4,tilt3DVerticalTransform=new Matrix4,tilt3DOldTransform=new Matrix4,tilt3DQuaternion=new Quaternion,tilt3DMatrix=new Matrix3,tilt3DCart=new Cartographic,tilt3DLookUp=new Cartesian3;function tilt3D(e,t,i){var r=e._scene.camera;if(Matrix4.equals(r.transform,Matrix4.IDENTITY))if(defined(i.angleAndHeight)&&(i=i.angleAndHeight),Cartesian2.equals(t,e._tiltCenterMousePosition)||(e._tiltOnEllipsoid=!1,e._looking=!1),e._looking){var n=e._ellipsoid.geodeticSurfaceNormal(r.position,tilt3DLookUp);look3D(e,t,i,n)}else{var a=e._ellipsoid.cartesianToCartographic(r.position,tilt3DCart);e._tiltOnEllipsoid||a.height>e._minimumCollisionTerrainHeight?(e._tiltOnEllipsoid=!0,tilt3DOnEllipsoid(e,t,i)):tilt3DOnTerrain(e,t,i)}}var tilt3DOnEllipsoidCartographic=new Cartographic;function tilt3DOnEllipsoid(e,t,i){var r=e._ellipsoid,n=e._scene,a=n.camera,o=.25*e.minimumZoomDistance,s=r.cartesianToCartographic(a.positionWC,tilt3DOnEllipsoidCartographic).height;if(!(s-o-1<CesiumMath.EPSILON3&&i.endPosition.y-i.startPosition.y<0)){var l=n.canvas,c=tilt3DWindowPos;c.x=l.clientWidth/2,c.y=l.clientHeight/2;var u,d=a.getPickRay(c,tilt3DRay),h=IntersectionTests.rayEllipsoid(d,r);if(defined(h))u=Ray.getPoint(d,h.start,tilt3DCenter);else{if(!(s>e._minimumTrackBallHeight)){e._looking=!0;var p=e._ellipsoid.geodeticSurfaceNormal(a.position,tilt3DLookUp);return look3D(e,t,i,p),void Cartesian2.clone(t,e._tiltCenterMousePosition)}var f=IntersectionTests.grazingAltitudeLocation(d,r);if(!defined(f))return;var m=r.cartesianToCartographic(f,tilt3DCart);m.height=0,u=r.cartographicToCartesian(m,tilt3DCenter)}var g=Transforms.eastNorthUpToFixedFrame(u,r,tilt3DTransform),_=e._globe,y=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;var v=Matrix4.clone(a.transform,tilt3DOldTransform);a._setTransform(g),rotate3D(e,t,i,Cartesian3.UNIT_Z),a._setTransform(v),e._globe=_,e._ellipsoid=y;var C=y.maximumRadius;e._rotateFactor=1/C,e._rotateRateRangeAdjustment=C}}function tilt3DOnTerrain(e,t,i){var r,n,a,o=e._ellipsoid,s=e._scene,l=s.camera,c=e._cameraUnderground;if(Cartesian2.equals(t,e._tiltCenterMousePosition))r=Cartesian3.clone(e._tiltCenter,tilt3DCenter);else{if(!defined(r=pickGlobe(e,t,tilt3DCenter))){if(n=l.getPickRay(t,tilt3DRay),!defined(a=IntersectionTests.rayEllipsoid(n,o))){if(o.cartesianToCartographic(l.position,tilt3DCart).height<=e._minimumTrackBallHeight){e._looking=!0;var u=e._ellipsoid.geodeticSurfaceNormal(l.position,tilt3DLookUp);look3D(e,t,i,u),Cartesian2.clone(t,e._tiltCenterMousePosition)}return}r=Ray.getPoint(n,a.start,tilt3DCenter)}c&&(defined(n)||(n=l.getPickRay(t,tilt3DRay)),getTiltCenterUnderground(e,n,r,r)),Cartesian2.clone(t,e._tiltCenterMousePosition),Cartesian3.clone(r,e._tiltCenter)}var d=s.canvas,h=tilt3DWindowPos;h.x=d.clientWidth/2,h.y=e._tiltCenterMousePosition.y,n=l.getPickRay(h,tilt3DRay);var p=Cartesian3.magnitude(r),f=Cartesian3.fromElements(p,p,p,scratchRadii),m=Ellipsoid.fromCartesian3(f,scratchEllipsoid);if(defined(a=IntersectionTests.rayEllipsoid(n,m))){var g=Cartesian3.magnitude(n.origin)>p?a.start:a.stop,_=Ray.getPoint(n,g,tilt3DVerticalCenter),y=Transforms.eastNorthUpToFixedFrame(r,o,tilt3DTransform),v=Transforms.eastNorthUpToFixedFrame(_,m,tilt3DVerticalTransform),C=e._globe,T=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;var S=Cartesian3.UNIT_Z,A=Matrix4.clone(l.transform,tilt3DOldTransform);l._setTransform(v);var x=Cartesian3.cross(_,l.positionWC,tilt3DCartesian3);if(Cartesian3.dot(l.rightWC,x)<0){var E=i.startPosition.y-i.endPosition.y;(c&&E<0||!c&&E>0)&&(S=void 0);var b=l.constrainedAxis;l.constrainedAxis=void 0,rotate3D(e,t,i,S,!0,!1),l.constrainedAxis=b}else rotate3D(e,t,i,S,!0,!1);if(l._setTransform(y),rotate3D(e,t,i,S,!1,!0),defined(l.constrainedAxis)){var P=Cartesian3.cross(l.direction,l.constrainedAxis,tilt3DCartesian3);Cartesian3.equalsEpsilon(P,Cartesian3.ZERO,CesiumMath.EPSILON6)||(Cartesian3.dot(P,l.right)<0&&Cartesian3.negate(P,P),Cartesian3.cross(P,l.direction,l.up),Cartesian3.cross(l.direction,l.up,l.right),Cartesian3.normalize(l.up,l.up),Cartesian3.normalize(l.right,l.right))}l._setTransform(A),e._globe=C,e._ellipsoid=T;var D=T.maximumRadius;e._rotateFactor=1/D,e._rotateRateRangeAdjustment=D;var w=Cartesian3.clone(l.positionWC,tilt3DCartesian3);if(e.enableCollisionDetection&&adjustHeightForTerrain(e),!Cartesian3.equals(l.positionWC,w)){l._setTransform(v),l.worldToCameraCoordinatesPoint(w,w);var M=Cartesian3.magnitudeSquared(w);Cartesian3.magnitudeSquared(l.position)>M&&(Cartesian3.normalize(l.position,l.position),Cartesian3.multiplyByScalar(l.position,Math.sqrt(M),l.position));var I=Cartesian3.angleBetween(w,l.position),R=Cartesian3.cross(w,l.position,w);Cartesian3.normalize(R,R);var O=Quaternion.fromAxisAngle(R,I,tilt3DQuaternion),B=Matrix3.fromQuaternion(O,tilt3DMatrix);Matrix3.multiplyByVector(B,l.direction,l.direction),Matrix3.multiplyByVector(B,l.up,l.up),Cartesian3.cross(l.direction,l.up,l.right),Cartesian3.cross(l.right,l.direction,l.up),l._setTransform(A)}}}var look3DStartPos=new Cartesian2,look3DEndPos=new Cartesian2,look3DStartRay=new Ray,look3DEndRay=new Ray,look3DNegativeRot=new Cartesian3,look3DTan=new Cartesian3;function look3D(e,t,i,r){var n=e._scene.camera,a=look3DStartPos;a.x=i.startPosition.x,a.y=0;var o=look3DEndPos;o.x=i.endPosition.x,o.y=0;var s,l,c=n.getPickRay(a,look3DStartRay),u=n.getPickRay(o,look3DEndRay),d=0;n.frustum instanceof OrthographicFrustum?(s=c.origin,l=u.origin,Cartesian3.add(n.direction,s,s),Cartesian3.add(n.direction,l,l),Cartesian3.subtract(s,n.position,s),Cartesian3.subtract(l,n.position,l),Cartesian3.normalize(s,s),Cartesian3.normalize(l,l)):(s=c.direction,l=u.direction);var h=Cartesian3.dot(s,l);h<1&&(d=Math.acos(h)),d=i.startPosition.x>i.endPosition.x?-d:d;var p=e._horizontalRotationAxis;if(defined(r)?n.look(r,-d):defined(p)?n.look(p,-d):n.lookLeft(d),a.x=0,a.y=i.startPosition.y,o.x=0,o.y=i.endPosition.y,c=n.getPickRay(a,look3DStartRay),u=n.getPickRay(o,look3DEndRay),d=0,n.frustum instanceof OrthographicFrustum?(s=c.origin,l=u.origin,Cartesian3.add(n.direction,s,s),Cartesian3.add(n.direction,l,l),Cartesian3.subtract(s,n.position,s),Cartesian3.subtract(l,n.position,l),Cartesian3.normalize(s,s),Cartesian3.normalize(l,l)):(s=c.direction,l=u.direction),(h=Cartesian3.dot(s,l))<1&&(d=Math.acos(h)),d=i.startPosition.y>i.endPosition.y?-d:d,defined(r=defaultValue(r,p))){var f=n.direction,m=Cartesian3.negate(r,look3DNegativeRot),g=Cartesian3.equalsEpsilon(f,r,CesiumMath.EPSILON2),_=Cartesian3.equalsEpsilon(f,m,CesiumMath.EPSILON2);if(g||_)(g&&d<0||_&&d>0)&&n.look(n.right,-d);else{h=Cartesian3.dot(f,r);var y=CesiumMath.acosClamped(h);d>0&&d>y&&(d=y-CesiumMath.EPSILON4),h=Cartesian3.dot(f,m),y=CesiumMath.acosClamped(h),d<0&&-d>y&&(d=-y+CesiumMath.EPSILON4);var v=Cartesian3.cross(r,f,look3DTan);n.look(v,d)}}else n.lookUp(d)}function update3D(e){reactToInput(e,e.enableRotate,e.rotateEventTypes,spin3D,e.inertiaSpin,"_lastInertiaSpinMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom3D,e.inertiaZoom,"_lastInertiaZoomMovement"),reactToInput(e,e.enableTilt,e.tiltEventTypes,tilt3D,e.inertiaSpin,"_lastInertiaTiltMovement"),reactToInput(e,e.enableLook,e.lookEventTypes,look3D)}var scratchAdjustHeightTransform=new Matrix4,scratchAdjustHeightCartographic=new Cartographic;function adjustHeightForTerrain(e){e._adjustedHeightForTerrain=!0;var t=e._scene,i=t.mode,r=t.globe;if(defined(r)&&i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.MORPHING){var n,a,o=t.camera,s=r.ellipsoid,l=t.mapProjection;Matrix4.equals(o.transform,Matrix4.IDENTITY)||(n=Matrix4.clone(o.transform,scratchAdjustHeightTransform),a=Cartesian3.magnitude(o.position),o._setTransform(Matrix4.IDENTITY));var c=scratchAdjustHeightCartographic;i===SceneMode$1.SCENE3D?s.cartesianToCartographic(o.position,c):l.unproject(o.position,c);var u=!1;if(c.height<e._minimumCollisionTerrainHeight){var d=e._scene.globeHeight;if(defined(d)){var h=d+e.minimumZoomDistance;c.height<h&&(c.height=h,i===SceneMode$1.SCENE3D?s.cartographicToCartesian(c,o.position):l.project(c,o.position),u=!0)}}defined(n)&&(o._setTransform(n),u&&(Cartesian3.normalize(o.position,o.position),Cartesian3.negate(o.position,o.direction),Cartesian3.multiplyByScalar(o.position,Math.max(a,e.minimumZoomDistance),o.position),Cartesian3.normalize(o.direction,o.direction),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.cross(o.right,o.direction,o.up)))}}ScreenSpaceCameraController.prototype.onMap=function(){var e=this._scene,t=e.mode,i=e.camera;return t!==SceneMode$1.COLUMBUS_VIEW||Math.abs(i.position.x)-this._maxCoord.x<0&&Math.abs(i.position.y)-this._maxCoord.y<0};var scratchPreviousPosition=new Cartesian3,scratchPreviousDirection=new Cartesian3;ScreenSpaceCameraController.prototype.update=function(){var e=this._scene,t=e.camera,i=e.globe,r=e.mode;Matrix4.equals(t.transform,Matrix4.IDENTITY)?(this._globe=i,this._ellipsoid=defined(this._globe)?this._globe.ellipsoid:e.mapProjection.ellipsoid):(this._globe=void 0,this._ellipsoid=Ellipsoid.UNIT_SPHERE);var n=defined(this._globe)?this._globe.terrainExaggeration:1,a=defined(this._globe)?this._globe.terrainExaggerationRelativeHeight:0;this._minimumCollisionTerrainHeight=TerrainExaggeration.getHeight(this.minimumCollisionTerrainHeight,n,a),this._minimumPickingTerrainHeight=TerrainExaggeration.getHeight(this.minimumPickingTerrainHeight,n,a),this._minimumTrackBallHeight=TerrainExaggeration.getHeight(this.minimumTrackBallHeight,n,a),this._cameraUnderground=e.cameraUnderground&&defined(this._globe);var o=this._ellipsoid.maximumRadius;this._rotateFactor=1/o,this._rotateRateRangeAdjustment=o,this._adjustedHeightForTerrain=!1;var s=Cartesian3.clone(t.positionWC,scratchPreviousPosition),l=Cartesian3.clone(t.directionWC,scratchPreviousDirection);(r===SceneMode$1.SCENE2D?update2D(this):r===SceneMode$1.COLUMBUS_VIEW?(this._horizontalRotationAxis=Cartesian3.UNIT_Z,updateCV(this)):r===SceneMode$1.SCENE3D&&(this._horizontalRotationAxis=void 0,update3D(this)),this.enableCollisionDetection&&!this._adjustedHeightForTerrain)&&((!Cartesian3.equals(s,t.positionWC)||!Cartesian3.equals(l,t.directionWC))&&adjustHeightForTerrain(this));this._aggregator.reset()},ScreenSpaceCameraController.prototype.isDestroyed=function(){return!1},ScreenSpaceCameraController.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),destroyObject(this)};var AdditiveBlend="uniform sampler2D colorTexture;\nuniform sampler2D colorTexture2;\nuniform vec2 center;\nuniform float radius;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 color0 = texture2D(colorTexture, v_textureCoordinates);\nvec4 color1 = texture2D(colorTexture2, v_textureCoordinates);\nfloat x = length(gl_FragCoord.xy - center) / radius;\nfloat t = smoothstep(0.5, 0.8, x);\ngl_FragColor = mix(color0 + color1, color1, t);\n}\n",BrightPass="uniform sampler2D colorTexture;\nuniform float avgLuminance;\nuniform float threshold;\nuniform float offset;\nvarying vec2 v_textureCoordinates;\nfloat key(float avg)\n{\nfloat guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));\nreturn max(0.0, guess) + 0.1;\n}\nvoid main()\n{\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\nvec3 xyz = czm_RGBToXYZ(color.rgb);\nfloat luminance = xyz.r;\nfloat scaledLum = key(avgLuminance) * luminance / avgLuminance;\nfloat brightLum = max(scaledLum - threshold, 0.0);\nfloat brightness = brightLum / (offset + brightLum);\nxyz.r = brightness;\ngl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);\n}\n";function SunPostProcess(){this._sceneFramebuffer=new SceneFramebuffer;var e=.125,t=new Array(6);t[0]=new PostProcessStage({fragmentShader:PassThrough,textureScale:e,forcePowerOfTwo:!0,sampleMode:PostProcessStageSampleMode.LINEAR});var i=t[1]=new PostProcessStage({fragmentShader:BrightPass,uniforms:{avgLuminance:.5,threshold:.25,offset:.1},textureScale:e,forcePowerOfTwo:!0}),r=this;this._delta=1,this._sigma=2,this._blurStep=new Cartesian2,t[2]=new PostProcessStage({fragmentShader:GaussianBlur1D,uniforms:{step:function(){return r._blurStep.x=r._blurStep.y=1/i.outputTexture.width,r._blurStep},delta:function(){return r._delta},sigma:function(){return r._sigma},direction:0},textureScale:e,forcePowerOfTwo:!0}),t[3]=new PostProcessStage({fragmentShader:GaussianBlur1D,uniforms:{step:function(){return r._blurStep.x=r._blurStep.y=1/i.outputTexture.width,r._blurStep},delta:function(){return r._delta},sigma:function(){return r._sigma},direction:1},textureScale:e,forcePowerOfTwo:!0}),t[4]=new PostProcessStage({fragmentShader:PassThrough,sampleMode:PostProcessStageSampleMode.LINEAR}),this._uCenter=new Cartesian2,this._uRadius=void 0,t[5]=new PostProcessStage({fragmentShader:AdditiveBlend,uniforms:{center:function(){return r._uCenter},radius:function(){return r._uRadius},colorTexture2:function(){return r._sceneFramebuffer.getFramebuffer().getColorTexture(0)}}}),this._stages=new PostProcessStageComposite({stages:t});for(var n=new PostProcessStageTextureCache(this),a=t.length,o=0;o<a;++o)t[o]._textureCache=n;this._textureCache=n,this.length=t.length}SunPostProcess.prototype.get=function(e){return this._stages.get(e)},SunPostProcess.prototype.getStageByName=function(e){for(var t=this._stages.length,i=0;i<t;++i){var r=this._stages.get(i);if(r.name===e)return r}};var sunPositionECScratch=new Cartesian4,sunPositionWCScratch=new Cartesian2,sizeScratch=new Cartesian2,postProcessMatrix4Scratch=new Matrix4;function updateSunPosition(e,t,i){var r=t.uniformState,n=r.sunPositionWC,a=r.view,o=r.viewProjection,s=r.projection,l=Matrix4.computeViewportTransformation(i,0,1,postProcessMatrix4Scratch),c=Matrix4.multiplyByPoint(a,n,sunPositionECScratch),u=Transforms.pointToGLWindowCoordinates(o,l,n,sunPositionWCScratch);c.x+=CesiumMath.SOLAR_RADIUS;var d=Transforms.pointToGLWindowCoordinates(s,l,c,c),h=30*Cartesian2.magnitude(Cartesian2.subtract(d,u,d))*2,p=sizeScratch;p.x=h,p.y=h,e._uCenter=Cartesian2.clone(u,e._uCenter),e._uRadius=.15*Math.max(p.x,p.y);var f=t.drawingBufferWidth,m=t.drawingBufferHeight,g=e._stages,_=g.get(0),y=_.outputTexture.width,v=_.outputTexture.height,C=new BoundingRectangle;C.width=y,C.height=v,l=Matrix4.computeViewportTransformation(C,0,1,postProcessMatrix4Scratch),u=Transforms.pointToGLWindowCoordinates(o,l,n,sunPositionWCScratch),p.x*=y/f,p.y*=v/m;var T=_.scissorRectangle;T.x=Math.max(u.x-.5*p.x,0),T.y=Math.max(u.y-.5*p.y,0),T.width=Math.min(p.x,f),T.height=Math.min(p.y,m);for(var S=1;S<4;++S)BoundingRectangle.clone(T,g.get(S).scissorRectangle)}SunPostProcess.prototype.clear=function(e,t,i){this._sceneFramebuffer.clear(e,t,i),this._textureCache.clear(e)},SunPostProcess.prototype.update=function(e){var t=e.context,i=e.viewport,r=this._sceneFramebuffer;r.update(t,i);var n=r.getFramebuffer();return this._textureCache.update(t),this._stages.update(t,!1),updateSunPosition(this,t,i),n},SunPostProcess.prototype.execute=function(e){var t=this._sceneFramebuffer.getFramebuffer().getColorTexture(0),i=this._stages,r=i.length;i.get(0).execute(e,t);for(var n=1;n<r;++n)i.get(n).execute(e,i.get(n-1).outputTexture)},SunPostProcess.prototype.copy=function(e,t){if(!defined(this._copyColorCommand)){var i=this;this._copyColorCommand=e.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return i._stages.get(i._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)},SunPostProcess.prototype.isDestroyed=function(){return!1},SunPostProcess.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),destroyObject(this)};var requestRenderAfterFrame=function(e){return function(){e.frameState.afterRender.push((function(){e.requestRender()}))}};function Scene(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).canvas,i=e.creditContainer,r=e.creditViewport,n=clone$1(e.contextOptions);defined(n)||(n={}),defined(n.webgl)||(n.webgl={}),n.webgl.powerPreference=defaultValue(n.webgl.powerPreference,"high-performance");var a=defined(i),o=new Context(t,n);a||((i=document.createElement("div")).style.position="absolute",i.style.bottom="0",i.style["text-shadow"]="0 0 2px #000000",i.style.color="#ffffff",i.style["font-size"]="10px",i.style["padding-right"]="5px",t.parentNode.appendChild(i)),defined(r)||(r=t.parentNode),this._id=createGuid(),this._jobScheduler=new JobScheduler,this._frameState=new FrameState(o,new CreditDisplay(i," • ",r),this._jobScheduler),this._frameState.scene3DOnly=defaultValue(e.scene3DOnly,!1),this._removeCreditContainer=!a,this._creditContainer=i,this._canvas=t,this._context=o,this._computeEngine=new ComputeEngine(o),this._globe=void 0,this._globeTranslucencyState=new GlobeTranslucencyState,this._primitives=new PrimitiveCollection,this._primitivesQuadTrees=[],this._groundPrimitives=new PrimitiveCollection,this._globeHeight=void 0,this._cameraUnderground=!1,this._logDepthBuffer=o.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new TweenCollection,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=defaultValue(e.orderIndependentTranslucency,!0),this._executeOITFunction=void 0,this._depthPlane=new DepthPlane,this._clearColorCommand=new ClearCommand({color:new Color,stencil:0,owner:this}),this._depthClearCommand=new ClearCommand({depth:1,owner:this}),this._stencilClearCommand=new ClearCommand({stencil:0}),this._classificationStencilClearCommand=new ClearCommand({stencil:0,renderState:RenderState.fromCache({stencilMask:StencilConstants$1.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new SceneTransitioner(this),this._preUpdate=new Event,this._postUpdate=new Event,this._renderError=new Event,this._preRender=new Event,this._postRender=new Event,this._minimumDisableDepthTestDistance=0,this._debugInspector=new DebugInspector,this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new Event,this.morphComplete=new Event,this.skyBox=void 0,this.skyAtmosphere=void 0,this.sun=void 0,this.sunBloom=!0,this._sunBloom=void 0,this.moon=void 0,this.backgroundColor=Color.clone(Color.BLACK),this._mode=SceneMode$1.SCENE3D,this._mapProjection=defined(e.mapProjection)?e.mapProjection:new GeographicProjection,this.morphTime=1,this.farToNearRatio=1e3,this.logarithmicDepthFarToNearRatio=1e9,this.nearToFarDistance2D=175e4,this.debugCommandFilter=void 0,this.debugShowCommands=!1,this.debugShowFrustums=!1,this.debugShowFramesPerSecond=!1,this.debugShowDepthFrustum=1,this.debugShowFrustumPlanes=!1,this._debugShowFrustumPlanes=!1,this._debugFrustumPlanes=void 0,this.useDepthPicking=!0,this.pickTranslucentDepth=!1,this.cameraEventWaitTime=500,this.fog=new Fog,this._shadowMapCamera=new Camera(this),this.shadowMap=new ShadowMap({context:o,lightCamera:this._shadowMapCamera,enabled:defaultValue(e.shadows,!1)}),this.invertClassification=!1,this.invertClassificationColor=Color.clone(Color.WHITE),this._actualInvertClassificationColor=Color.clone(this._invertClassificationColor),this._invertClassification=new InvertClassification,this.focalLength=void 0,this.eyeSeparation=void 0,this.postProcessStages=new PostProcessStageCollection,this._brdfLutGenerator=new BrdfLutGenerator,this._performanceDisplay=void 0,this._debugVolume=void 0,this._screenSpaceCameraController=new ScreenSpaceCameraController(this),this._cameraUnderground=!1,this._mapMode2D=defaultValue(e.mapMode2D,MapMode2D$1.INFINITE_SCROLL),this._environmentState={skyBoxCommand:void 0,skyAtmosphereCommand:void 0,sunDrawCommand:void 0,sunComputeCommand:void 0,moonCommand:void 0,isSunVisible:!1,isMoonVisible:!1,isReadyForAtmosphere:!1,isSkyAtmosphereVisible:!1,clearGlobeDepth:!1,useDepthPlane:!1,renderTranslucentDepthForPick:!1,originalFramebuffer:void 0,useGlobeDepthFramebuffer:!1,separatePrimitiveFramebuffer:!1,useOIT:!1,useInvertClassification:!1,usePostProcess:!1,usePostProcessSelected:!1,useWebVR:!1},this._useWebVR=!1,this._cameraVR=void 0,this._aspectRatioVR=void 0,this.requestRenderMode=defaultValue(e.requestRenderMode,!1),this._renderRequested=!0,this.maximumRenderTimeChange=defaultValue(e.maximumRenderTimeChange,0),this._lastRenderTime=void 0,this._frameRateMonitor=void 0,this._removeRequestListenerCallback=RequestScheduler.requestCompletedEvent.addEventListener(requestRenderAfterFrame(this)),this._removeTaskProcessorListenerCallback=TaskProcessor.taskCompletedEvent.addEventListener(requestRenderAfterFrame(this)),this._removeGlobeCallbacks=[];var s=new BoundingRectangle(0,0,o.drawingBufferWidth,o.drawingBufferHeight),l=new Camera(this);this._logDepthBuffer&&(l.frustum.near=.1,l.frustum.far=1e10),this.preloadFlightCamera=new Camera(this),this.preloadFlightCullingVolume=void 0,this._picking=new Picking(this),this._defaultView=new View(this,l,s),this._view=this._defaultView,this._hdr=void 0,this._hdrDirty=void 0,this.highDynamicRange=!1,this.gamma=2.2,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this._specularEnvironmentMapAtlas=void 0,this.light=new SunLight,updateFrameNumber(this,0,JulianDate.now()),this.updateFrameState(),this.initializeFrame()}function updateGlobeListeners(e,t){for(var i=0;i<e._removeGlobeCallbacks.length;++i)e._removeGlobeCallbacks[i]();e._removeGlobeCallbacks.length=0;var r=[];defined(t)&&(r.push(t.imageryLayersUpdatedEvent.addEventListener(requestRenderAfterFrame(e))),r.push(t.terrainProviderChanged.addEventListener(requestRenderAfterFrame(e)))),e._removeGlobeCallbacks=r}function updateDerivedCommands(e,t,i){var r=e._frameState,n=e._context,a=e._view.oit,o=r.shadowState.lightShadowMaps,s=r.shadowState.lightShadowsEnabled,l=t.derivedCommands;defined(t.pickId)&&(l.picking=DerivedCommand.createPickDerivedCommand(e,t,n,l.picking)),t.pickOnly||(l.depth=DerivedCommand.createDepthOnlyDerivedCommand(e,t,n,l.depth)),l.originalCommand=t,e._hdr&&(l.hdr=DerivedCommand.createHdrCommand(t,n,l.hdr),l=(t=l.hdr.command).derivedCommands),s&&t.receiveShadows&&(l.shadows=ShadowMap.createReceiveDerivedCommand(o,t,i,n,l.shadows)),t.pass===Pass$1.TRANSLUCENT&&defined(a)&&a.isSupported()&&(s&&t.receiveShadows?(l.oit=defined(l.oit)?l.oit:{},l.oit.shadows=a.createDerivedCommands(l.shadows.receiveCommand,n,l.oit.shadows)):l.oit=a.createDerivedCommands(t,n,l.oit))}Object.defineProperties(Scene.prototype,{canvas:{get:function(){return this._canvas}},drawingBufferHeight:{get:function(){return this._context.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._context.drawingBufferWidth}},maximumAliasedLineWidth:{get:function(){return ContextLimits.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return ContextLimits.maximumCubeMapSize}},pickPositionSupported:{get:function(){return this._context.depthTexture}},sampleHeightSupported:{get:function(){return this._context.depthTexture}},clampToHeightSupported:{get:function(){return this._context.depthTexture}},invertClassificationSupported:{get:function(){return this._context.depthTexture}},specularEnvironmentMapsSupported:{get:function(){return OctahedralProjectedCubeMap.isSupported(this._context)}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e,updateGlobeListeners(this,e)}},primitives:{get:function(){return this._primitives}},primitivesQuadTrees:{get:function(){return this._primitivesQuadTrees}},groundPrimitives:{get:function(){return this._groundPrimitives}},camera:{get:function(){return this._view.camera},set:function(e){this._view.camera=e}},view:{get:function(){return this._view},set:function(e){this._view=e}},defaultView:{get:function(){return this._defaultView}},picking:{get:function(){return this._picking}},screenSpaceCameraController:{get:function(){return this._screenSpaceCameraController}},mapProjection:{get:function(){return this._mapProjection}},jobScheduler:{get:function(){return this._jobScheduler}},frameState:{get:function(){return this._frameState}},environmentState:{get:function(){return this._environmentState}},tweens:{get:function(){return this._tweens}},imageryLayers:{get:function(){if(defined(this.globe))return this.globe.imageryLayers}},terrainProvider:{get:function(){if(defined(this.globe))return this.globe.terrainProvider},set:function(e){defined(this.globe)&&(this.globe.terrainProvider=e)}},terrainProviderChanged:{get:function(){if(defined(this.globe))return this.globe.terrainProviderChanged}},preUpdate:{get:function(){return this._preUpdate}},postUpdate:{get:function(){return this._postUpdate}},renderError:{get:function(){return this._renderError}},preRender:{get:function(){return this._preRender}},postRender:{get:function(){return this._postRender}},lastRenderTime:{get:function(){return this._lastRenderTime}},context:{get:function(){return this._context}},debugFrustumStatistics:{get:function(){return this._view.debugFrustumStatistics}},scene3DOnly:{get:function(){return this._frameState.scene3DOnly}},orderIndependentTranslucency:{get:function(){return this._useOIT}},id:{get:function(){return this._id}},mode:{get:function(){return this._mode},set:function(e){e===SceneMode$1.SCENE2D?this.morphTo2D(0):e===SceneMode$1.SCENE3D?this.morphTo3D(0):e===SceneMode$1.COLUMBUS_VIEW&&this.morphToColumbusView(0),this._mode=e}},frustumCommandsList:{get:function(){return this._view.frustumCommandsList}},numberOfFrustums:{get:function(){return this._view.frustumCommandsList.length}},useWebVR:{get:function(){return this._useWebVR},set:function(e){this._useWebVR=e,this._useWebVR?(this._frameState.creditDisplay.container.style.visibility="hidden",this._cameraVR=new Camera(this),defined(this._deviceOrientationCameraController)||(this._deviceOrientationCameraController=new DeviceOrientationCameraController(this)),this._aspectRatioVR=this.camera.frustum.aspectRatio):(this._frameState.creditDisplay.container.style.visibility="visible",this._cameraVR=void 0,this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this.camera.frustum.aspectRatio=this._aspectRatioVR,this.camera.frustum.xOffset=0)}},mapMode2D:{get:function(){return this._mapMode2D}},imagerySplitPosition:{get:function(){return this._frameState.imagerySplitPosition},set:function(e){this._frameState.imagerySplitPosition=e}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance},set:function(e){this._minimumDisableDepthTestDistance=e}},logarithmicDepthBuffer:{get:function(){return this._logDepthBuffer},set:function(e){e=this._context.fragmentDepth&&e,this._logDepthBuffer!==e&&(this._logDepthBuffer=e,this._logDepthBufferDirty=!0)}},gamma:{get:function(){return this._context.uniformState.gamma},set:function(e){this._context.uniformState.gamma=e}},highDynamicRange:{get:function(){return this._hdr},set:function(e){var t=this._context,i=e&&t.depthTexture&&(t.colorBufferFloat||t.colorBufferHalfFloat);this._hdrDirty=i!==this._hdr,this._hdr=i}},highDynamicRangeSupported:{get:function(){var e=this._context;return e.depthTexture&&(e.colorBufferFloat||e.colorBufferHalfFloat)}},cameraUnderground:{get:function(){return this._cameraUnderground}},pixelRatio:{get:function(){return this._frameState.pixelRatio},set:function(e){this._frameState.pixelRatio=e}},opaqueFrustumNearOffset:{get:function(){return.9999}},globeHeight:{get:function(){return this._globeHeight}}}),Scene.prototype.getCompressedTextureFormatSupported=function(e){var t=this.context;return("WEBGL_compressed_texture_s3tc"===e||"s3tc"===e)&&t.s3tc||("WEBGL_compressed_texture_pvrtc"===e||"pvrtc"===e)&&t.pvrtc||("WEBGL_compressed_texture_etc"===e||"etc"===e)&&t.etc||("WEBGL_compressed_texture_etc1"===e||"etc1"===e)&&t.etc1||("WEBGL_compressed_texture_astc"===e||"astc"===e)&&t.astc||("EXT_texture_compression_bptc"===e||"bc7"===e)&&t.bc7},Scene.prototype.updateDerivedCommands=function(e){if(defined(e.derivedCommands)){var t=this._frameState,i=this._context,r=!1,n=t.shadowState.lastDirtyTime;e.lastDirtyTime!==n&&(e.lastDirtyTime=n,e.dirty=!0,r=!0);var a=t.useLogDepth,o=this._hdr,s=e.derivedCommands,l=defined(s.logDepth),c=defined(s.hdr),u=defined(s.originalCommand),d=a&&!l,h=o&&!c,p=!(a&&o||u);if(e.dirty=e.dirty||d||h||p,e.dirty){e.dirty=!1;var f=t.shadowState.shadowMaps;t.shadowState.shadowsEnabled&&e.castShadows&&(s.shadows=ShadowMap.createCastDerivedCommand(f,e,r,i,s.shadows)),(l||d)&&(s.logDepth=DerivedCommand.createLogDepthCommand(e,i,s.logDepth),updateDerivedCommands(this,s.logDepth.command,r)),(u||p)&&updateDerivedCommands(this,e,r)}}};var renderTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.RENDER}),preloadTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.PRELOAD}),preloadFlightTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.PRELOAD_FLIGHT}),requestRenderModeDeferCheckPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.REQUEST_RENDER_MODE_DEFER_CHECK}),scratchOccluderBoundingSphere=new BoundingSphere,scratchOccluder;function getOccluder(e){var t=e.globe;if(e._mode===SceneMode$1.SCENE3D&&defined(t)&&t.show&&!e._cameraUnderground&&!e._globeTranslucencyState.translucent){var i=t.ellipsoid,r=e.frameState.minimumTerrainHeight;return scratchOccluderBoundingSphere.radius=i.minimumRadius+r,scratchOccluder=Occluder.fromBoundingSphere(scratchOccluderBoundingSphere,e.camera.positionWC,scratchOccluder)}}function updateFrameNumber(e,t,i){var r=e._frameState;r.frameNumber=t,r.time=JulianDate.clone(i,r.time)}Scene.prototype.clearPasses=function(e){e.render=!1,e.pick=!1,e.depth=!1,e.postProcess=!1,e.offscreen=!1},Scene.prototype.updateFrameState=function(){var e=this.camera,t=this._frameState;t.commandList.length=0,t.shadowMaps.length=0,t.brdfLutGenerator=this._brdfLutGenerator,t.environmentMap=this.skyBox&&this.skyBox._cubeMap,t.mode=this._mode,t.morphTime=this.morphTime,t.mapProjection=this.mapProjection,t.camera=e,t.cullingVolume=e.frustum.computeCullingVolume(e.positionWC,e.directionWC,e.upWC),t.occluder=getOccluder(this),t.minimumTerrainHeight=0,t.minimumDisableDepthTestDistance=this._minimumDisableDepthTestDistance,t.invertClassification=this.invertClassification,t.useLogDepth=this._logDepthBuffer&&!(this.camera.frustum instanceof OrthographicFrustum||this.camera.frustum instanceof OrthographicOffCenterFrustum),t.light=this.light,t.cameraUnderground=this._cameraUnderground,t.globeTranslucencyState=this._globeTranslucencyState,defined(this.globe)&&(t.terrainExaggeration=this.globe.terrainExaggeration,t.terrainExaggerationRelativeHeight=this.globe.terrainExaggerationRelativeHeight),defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready?(t.specularEnvironmentMaps=this._specularEnvironmentMapAtlas.texture,t.specularEnvironmentMapsMaximumLOD=this._specularEnvironmentMapAtlas.maximumMipmapLevel):(t.specularEnvironmentMaps=void 0,t.specularEnvironmentMapsMaximumLOD=void 0),t.sphericalHarmonicCoefficients=this.sphericalHarmonicCoefficients,this._actualInvertClassificationColor=Color.clone(this.invertClassificationColor,this._actualInvertClassificationColor),InvertClassification.isTranslucencySupported(this._context)||(this._actualInvertClassificationColor.alpha=1),t.invertClassificationColor=this._actualInvertClassificationColor,defined(this.globe)?t.maximumScreenSpaceError=this.globe.maximumScreenSpaceError:t.maximumScreenSpaceError=2,this.clearPasses(t.passes),t.tilesetPassState=void 0},Scene.prototype.isVisible=function(e,t,i){return defined(e)&&(!defined(e.boundingVolume)||!e.cull||t.computeVisibility(e.boundingVolume)!==Intersect$1.OUTSIDE&&(!defined(i)||!e.occlude||!e.boundingVolume.isOccluded(i)))};var transformFrom2D=new Matrix4(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);function debugShowBoundingVolume(e,t,i,r){var n,a=t._frameState,o=a.context,s=e.boundingVolume;defined(t._debugVolume)&&t._debugVolume.destroy();var l=Cartesian3.clone(s.center);if(a.mode!==SceneMode$1.SCENE3D){l=Matrix4.multiplyByPoint(transformFrom2D,l,l);var c=a.mapProjection,u=c.unproject(l);l=c.ellipsoid.cartographicToCartesian(u)}if(defined(s.radius)){var d=s.radius;n=GeometryPipeline.toWireframe(EllipsoidGeometry.createGeometry(new EllipsoidGeometry({radii:new Cartesian3(d,d,d),vertexFormat:PerInstanceColorAppearance.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Primitive$2({geometryInstances:new GeometryInstance({geometry:n,modelMatrix:Matrix4.fromTranslation(l),attributes:{color:new ColorGeometryInstanceAttribute(1,0,0,1)}}),appearance:new PerInstanceColorAppearance({flat:!0,translucent:!1}),asynchronous:!1})}else{var h=s.halfAxes;n=GeometryPipeline.toWireframe(BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2),vertexFormat:PerInstanceColorAppearance.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Primitive$2({geometryInstances:new GeometryInstance({geometry:n,modelMatrix:Matrix4.fromRotationTranslation(h,l,new Matrix4),attributes:{color:new ColorGeometryInstanceAttribute(1,0,0,1)}}),appearance:new PerInstanceColorAppearance({flat:!0,translucent:!1}),asynchronous:!1})}var p,f=a.commandList,m=a.commandList=[];(t._debugVolume.update(a),e=m[0],a.useLogDepth)&&(e=DerivedCommand.createLogDepthCommand(e,o).command);defined(r)&&(p=i.framebuffer,i.framebuffer=r),e.execute(o,i),defined(p)&&(i.framebuffer=p),a.commandList=f}function executeCommand(e,t,i,r,n){var a=t._frameState;if(!defined(t.debugCommandFilter)||t.debugCommandFilter(e))if(e instanceof ClearCommand)e.execute(i,r);else{e.debugShowBoundingVolume&&defined(e.boundingVolume)&&debugShowBoundingVolume(e,t,r,n),a.useLogDepth&&defined(e.derivedCommands.logDepth)&&(e=e.derivedCommands.logDepth.command);var o=a.passes;if(!o.pick&&!o.depth&&t._hdr&&defined(e.derivedCommands)&&defined(e.derivedCommands.hdr)&&(e=e.derivedCommands.hdr.command),o.pick||o.depth){if(o.pick&&!o.depth&&defined(e.derivedCommands.picking))return void(e=e.derivedCommands.picking.pickCommand).execute(i,r);if(defined(e.derivedCommands.depth))return void(e=e.derivedCommands.depth.depthOnlyCommand).execute(i,r)}t.debugShowCommands||t.debugShowFrustums?t._debugInspector.executeDebugShowFrustumsCommand(t,e,r):a.shadowState.lightShadowsEnabled&&e.receiveShadows&&defined(e.derivedCommands.shadows)?e.derivedCommands.shadows.receiveCommand.execute(i,r):e.execute(i,r)}}function executeIdCommand(e,t,i,r){var n=t._frameState,a=e.derivedCommands;defined(a)&&(n.useLogDepth&&defined(a.logDepth)&&(e=a.logDepth.command),defined((a=e.derivedCommands).picking)?(e=a.picking.pickCommand).execute(i,r):defined(a.depth)&&(e=a.depth.depthOnlyCommand).execute(i,r))}function backToFront(e,t,i){return t.boundingVolume.distanceSquaredTo(i)-e.boundingVolume.distanceSquaredTo(i)}function frontToBack(e,t,i){return e.boundingVolume.distanceSquaredTo(i)-t.boundingVolume.distanceSquaredTo(i)+CesiumMath.EPSILON12}function executeTranslucentCommandsBackToFront(e,t,i,r,n){var a=e.context;mergeSort(r,backToFront,e.camera.positionWC),defined(n)&&t(n.unclassifiedCommand,e,a,i);for(var o=r.length,s=0;s<o;++s)t(r[s],e,a,i)}function executeTranslucentCommandsFrontToBack(e,t,i,r,n){var a=e.context;mergeSort(r,frontToBack,e.camera.positionWC),defined(n)&&t(n.unclassifiedCommand,e,a,i);for(var o=r.length,s=0;s<o;++s)t(r[s],e,a,i)}transformFrom2D=Matrix4.inverseTransformation(transformFrom2D,transformFrom2D);var scratchPerspectiveFrustum=new PerspectiveFrustum,scratchPerspectiveOffCenterFrustum=new PerspectiveOffCenterFrustum,scratchOrthographicFrustum=new OrthographicFrustum,scratchOrthographicOffCenterFrustum=new OrthographicOffCenterFrustum;function executeCommands(e,t){var i,r=e.camera,n=e.context,a=e.frameState,o=n.uniformState;o.updateCamera(r),(i=defined(r.frustum.fov)?r.frustum.clone(scratchPerspectiveFrustum):defined(r.frustum.infiniteProjectionMatrix)?r.frustum.clone(scratchPerspectiveOffCenterFrustum):defined(r.frustum.width)?r.frustum.clone(scratchOrthographicFrustum):r.frustum.clone(scratchOrthographicOffCenterFrustum)).near=r.frustum.near,i.far=r.frustum.far,o.updateFrustum(i),o.updatePass(Pass$1.ENVIRONMENT);var s,l=a.passes,c=l.pick,u=e._environmentState,d=e._view,h=u.renderTranslucentDepthForPick,p=u.useWebVR;if(!c){var f,m=u.skyBoxCommand;if(defined(m)&&executeCommand(m,e,n,t),u.isSkyAtmosphereVisible&&executeCommand(u.skyAtmosphereCommand,e,n,t),u.isSunVisible)if(u.sunDrawCommand.execute(n,t),e.sunBloom&&!p)f=u.useGlobeDepthFramebuffer?d.globeDepth.framebuffer:u.usePostProcess?d.sceneFramebuffer.getFramebuffer():u.originalFramebuffer,e._sunPostProcess.execute(n),e._sunPostProcess.copy(n,f),t.framebuffer=f;u.isMoonVisible&&u.moonCommand.execute(n,t)}u.useOIT?(defined(e._executeOITFunction)||(e._executeOITFunction=function(e,t,i,r,n){d.oit.executeCommands(e,t,i,r,n)}),s=e._executeOITFunction):s=l.render?executeTranslucentCommandsBackToFront:executeTranslucentCommandsFrontToBack;for(var g,_=d.frustumCommandsList,y=_.length,v=u.clearGlobeDepth,C=u.useDepthPlane,T=e._globeTranslucencyState,S=T.translucent,A=e._view.globeTranslucencyFramebuffer,x=u.separatePrimitiveFramebuffer=!1,E=e._depthClearCommand,b=e._stencilClearCommand,P=e._classificationStencilClearCommand,D=e._depthPlane,w=u.usePostProcessSelected,M=r.position.z,I=0;I<y;++I){var R=y-I-1,O=_[R];e.mode===SceneMode$1.SCENE2D?(r.position.z=M-O.near+1,i.far=Math.max(1,O.far-O.near),i.near=1,o.update(a),o.updateFrustum(i)):(i.near=0!==R?O.near*e.opaqueFrustumNearOffset:O.near,i.far=O.far,o.updateFrustum(i));var B=d.globeDepth;x&&(t.framebuffer=B.framebuffer),E.execute(n,t),n.stencilBuffer&&b.execute(n,t),o.updatePass(Pass$1.GLOBE);var L,F=O.commands[Pass$1.GLOBE],N=O.indices[Pass$1.GLOBE];if(S)T.executeGlobeCommands(O,executeCommand,A,e,t);else for(g=0;g<N;++g)executeCommand(F[g],e,n,t);if(defined(B)&&u.useGlobeDepthFramebuffer&&B.executeCopyDepth(n,t),!u.renderTranslucentDepthForPick)if(o.updatePass(Pass$1.TERRAIN_CLASSIFICATION),F=O.commands[Pass$1.TERRAIN_CLASSIFICATION],N=O.indices[Pass$1.TERRAIN_CLASSIFICATION],S)T.executeGlobeClassificationCommands(O,executeCommand,A,e,t);else for(g=0;g<N;++g)executeCommand(F[g],e,n,t);if(v&&(E.execute(n,t),C&&D.execute(n,t)),x&&(t.framebuffer=B.primitiveFramebuffer),!u.useInvertClassification||c||u.renderTranslucentDepthForPick){for(o.updatePass(Pass$1.CESIUM_3D_TILE),F=O.commands[Pass$1.CESIUM_3D_TILE],N=O.indices[Pass$1.CESIUM_3D_TILE],g=0;g<N;++g)executeCommand(F[g],e,n,t);if(N>0&&(defined(B)&&u.useGlobeDepthFramebuffer&&B.executeUpdateDepth(n,t,v),!u.renderTranslucentDepthForPick))for(o.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION),F=O.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],N=O.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],g=0;g<N;++g)executeCommand(F[g],e,n,t)}else{e._invertClassification.clear(n,t);var V=t.framebuffer;for(t.framebuffer=e._invertClassification._fbo,o.updatePass(Pass$1.CESIUM_3D_TILE),F=O.commands[Pass$1.CESIUM_3D_TILE],N=O.indices[Pass$1.CESIUM_3D_TILE],g=0;g<N;++g)executeCommand(F[g],e,n,t);for(defined(B)&&u.useGlobeDepthFramebuffer&&B.executeUpdateDepth(n,t,v),o.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),F=O.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],N=O.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],g=0;g<N;++g)executeCommand(F[g],e,n,t);for(t.framebuffer=V,e._invertClassification.executeClassified(n,t),1===a.invertClassificationColor.alpha&&e._invertClassification.executeUnclassified(n,t),N>0&&n.stencilBuffer&&P.execute(n,t),o.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION),F=O.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],N=O.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],g=0;g<N;++g)executeCommand(F[g],e,n,t)}for(N>0&&n.stencilBuffer&&b.execute(n,t),o.updatePass(Pass$1.OPAQUE),F=O.commands[Pass$1.OPAQUE],N=O.indices[Pass$1.OPAQUE],g=0;g<N;++g)executeCommand(F[g],e,n,t);if(0!==R&&e.mode!==SceneMode$1.SCENE2D&&(i.near=O.near,o.updateFrustum(i)),!c&&u.useInvertClassification&&a.invertClassificationColor.alpha<1&&(L=e._invertClassification),o.updatePass(Pass$1.TRANSLUCENT),(F=O.commands[Pass$1.TRANSLUCENT]).length=O.indices[Pass$1.TRANSLUCENT],s(e,executeCommand,t,F,L),O.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION]>0&&d.translucentTileClassification.isSupported()&&(d.translucentTileClassification.executeTranslucentCommands(e,executeCommand,t,F,B.framebuffer),d.translucentTileClassification.executeClassificationCommands(e,executeCommand,t,O)),n.depthTexture&&e.useDepthPicking&&(u.useGlobeDepthFramebuffer||h)){var k=h?t.framebuffer.depthStencilTexture:B.framebuffer.depthStencilTexture,U=e._picking.getPickDepth(e,R);U.update(n,k),U.executeCopyDepth(n,t)}if(x&&(t.framebuffer=B.framebuffer),!c&&w){var G=t.framebuffer;if(t.framebuffer=d.sceneFramebuffer.getIdFramebuffer(),i.near=0!==R?O.near*e.opaqueFrustumNearOffset:O.near,i.far=O.far,o.updateFrustum(i),o.updatePass(Pass$1.GLOBE),F=O.commands[Pass$1.GLOBE],N=O.indices[Pass$1.GLOBE],S)T.executeGlobeCommands(O,executeIdCommand,A,e,t);else for(g=0;g<N;++g)executeIdCommand(F[g],e,n,t);for(v&&(E.framebuffer=t.framebuffer,E.execute(n,t),E.framebuffer=void 0),v&&C&&D.execute(n,t),o.updatePass(Pass$1.CESIUM_3D_TILE),F=O.commands[Pass$1.CESIUM_3D_TILE],N=O.indices[Pass$1.CESIUM_3D_TILE],g=0;g<N;++g)executeIdCommand(F[g],e,n,t);for(o.updatePass(Pass$1.OPAQUE),F=O.commands[Pass$1.OPAQUE],N=O.indices[Pass$1.OPAQUE],g=0;g<N;++g)executeIdCommand(F[g],e,n,t);for(o.updatePass(Pass$1.TRANSLUCENT),F=O.commands[Pass$1.TRANSLUCENT],N=O.indices[Pass$1.TRANSLUCENT],g=0;g<N;++g)executeIdCommand(F[g],e,n,t);t.framebuffer=G}}}function executeComputeCommands(e){e.context.uniformState.updatePass(Pass$1.COMPUTE);var t=e._environmentState.sunComputeCommand;defined(t)&&t.execute(e._computeEngine);for(var i=e._computeCommandList,r=i.length,n=0;n<r;++n)i[n].execute(e._computeEngine)}function executeOverlayCommands(e,t){e.context.uniformState.updatePass(Pass$1.OVERLAY);for(var i=e.context,r=e._overlayCommandList,n=r.length,a=0;a<n;++a)r[a].execute(i,t)}function insertShadowCastCommands(e,t,i){for(var r=i.shadowMapCullingVolume,n=i.isPointLight,a=i.passes,o=a.length,s=t.length,l=0;l<s;++l){var c=t[l];if(e.updateDerivedCommands(c),c.castShadows&&(c.pass===Pass$1.GLOBE||c.pass===Pass$1.CESIUM_3D_TILE||c.pass===Pass$1.OPAQUE||c.pass===Pass$1.TRANSLUCENT)&&e.isVisible(c,r))if(n)for(var u=0;u<o;++u)a[u].commandList.push(c);else if(1===o)a[0].commandList.push(c);else for(var d=!1,h=o-1;h>=0;--h){var p=a[h].cullingVolume;if(e.isVisible(c,p))a[h].commandList.push(c),d=!0;else if(d)break}}}function executeShadowMapCastCommands(e){var t=e.frameState,i=t.shadowState.shadowMaps,r=i.length;if(t.shadowState.shadowsEnabled)for(var n=e.context,a=n.uniformState,o=0;o<r;++o){var s=i[o];if(!s.outOfView){var l,c=s.passes,u=c.length;for(l=0;l<u;++l)c[l].commandList.length=0;for(insertShadowCastCommands(e,e.frameState.commandList,s),l=0;l<u;++l){var d=s.passes[l];a.updateCamera(d.camera),s.updatePass(n,l);for(var h=d.commandList.length,p=0;p<h;++p){var f=d.commandList[p];a.updatePass(f.pass),executeCommand(f.derivedCommands.shadows.castCommands[o],e,n,d.passState)}}}}}var scratchEyeTranslation=new Cartesian3;function executeWebVRCommands(e,t,i){var r=e._view,n=r.camera,a=e._environmentState.renderTranslucentDepthForPick;updateAndClearFramebuffers(e,t,i),a||updateAndRenderPrimitives(e),r.createPotentiallyVisibleSet(e),a||(executeComputeCommands(e),executeShadowMapCastCommands(e));var o=t.viewport;o.x=0,o.y=0,o.width=.5*o.width;var s=Camera.clone(n,e._cameraVR);s.frustum=n.frustum;var l=n.frustum.near,c=l*defaultValue(e.focalLength,5),u=defaultValue(e.eyeSeparation,c/30),d=Cartesian3.multiplyByScalar(s.right,.5*u,scratchEyeTranslation);n.frustum.aspectRatio=o.width/o.height;var h=.5*u*l/c;Cartesian3.add(s.position,d,n.position),n.frustum.xOffset=h,executeCommands(e,t),o.x=o.width,Cartesian3.subtract(s.position,d,n.position),n.frustum.xOffset=-h,executeCommands(e,t),Camera.clone(s,n)}Scene.prototype.updateAndExecuteCommands=function(e,t){var i=this._frameState.mode;this._environmentState.useWebVR?executeWebVRCommands(this,e,t):i!==SceneMode$1.SCENE2D||this._mapMode2D===MapMode2D$1.ROTATE?executeCommandsInViewport(!0,this,e,t):(updateAndClearFramebuffers(this,e,t),execute2DViewportCommands(this,e))},Scene.prototype.updateAndExecuteCommandszh=function(e,t){var i=this._frameState.mode;this._environmentState.useWebVR?executeWebVRCommands(this,e,t):i!==SceneMode$1.SCENE2D||this._mapMode2D===MapMode2D$1.ROTATE?executeCommandsInViewportzh(!0,this,e,t):(updateAndClearFramebuffers(this,e,t),execute2DViewportCommands(this,e))};var scratch2DViewportCartographic=new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO),scratch2DViewportMaxCoord=new Cartesian3,scratch2DViewportSavedPosition=new Cartesian3,scratch2DViewportTransform=new Matrix4,scratch2DViewportCameraTransform=new Matrix4,scratch2DViewportEyePoint=new Cartesian3,scratch2DViewportWindowCoords=new Cartesian3,scratch2DViewport=new BoundingRectangle;function execute2DViewportCommands(e,t){var i=e.context,r=e.frameState,n=e.camera,a=t.viewport,o=BoundingRectangle.clone(a,scratch2DViewport);t.viewport=o;var s=scratch2DViewportCartographic,l=scratch2DViewportMaxCoord;e.mapProjection.project(s,l);var c=Cartesian3.clone(n.position,scratch2DViewportSavedPosition),u=Matrix4.clone(n.transform,scratch2DViewportCameraTransform),d=n.frustum.clone();n._setTransform(Matrix4.IDENTITY);var h=Matrix4.computeViewportTransformation(o,0,1,scratch2DViewportTransform),p=n.frustum.projectionMatrix,f=n.positionWC.y,m=Cartesian3.fromElements(CesiumMath.sign(f)*l.x-f,0,-n.positionWC.x,scratch2DViewportEyePoint),g=Transforms.pointToGLWindowCoordinates(p,h,m,scratch2DViewportWindowCoords);g.x=Math.floor(g.x);var _=o.x,y=o.width;if(0===f||g.x<=_||g.x>=_+y)executeCommandsInViewport(!0,e,t);else if(Math.abs(_+.5*y-g.x)<1)o.width=g.x-o.x,n.position.x*=CesiumMath.sign(n.position.x),n.frustum.right=0,r.cullingVolume=n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC),i.uniformState.update(r),executeCommandsInViewport(!0,e,t),o.x=g.x,n.position.x=-n.position.x,n.frustum.right=-n.frustum.left,n.frustum.left=0,r.cullingVolume=n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC),i.uniformState.update(r),executeCommandsInViewport(!1,e,t);else if(g.x>_+.5*y){o.width=g.x-_;var v=n.frustum.right;n.frustum.right=l.x-f,r.cullingVolume=n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC),i.uniformState.update(r),executeCommandsInViewport(!0,e,t),o.x=g.x,o.width=_+y-g.x,n.position.x=-n.position.x,n.frustum.left=-n.frustum.right,n.frustum.right=v-2*n.frustum.right,r.cullingVolume=n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC),i.uniformState.update(r),executeCommandsInViewport(!1,e,t)}else{o.x=g.x,o.width=_+y-g.x;var C=n.frustum.left;n.frustum.left=-l.x-f,r.cullingVolume=n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC),i.uniformState.update(r),executeCommandsInViewport(!0,e,t),o.x=_,o.width=g.x-_,n.position.x=-n.position.x,n.frustum.right=-n.frustum.left,n.frustum.left=C-2*n.frustum.left,r.cullingVolume=n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC),i.uniformState.update(r),executeCommandsInViewport(!1,e,t)}n._setTransform(u),Cartesian3.clone(c,n.position),n.frustum=d.clone(),t.viewport=a}function executeCommandsInViewport(e,t,i,r){var n=t._environmentState,a=t._view,o=n.renderTranslucentDepthForPick;e||o||(t.frameState.commandList.length=0),o||updateAndRenderPrimitives(t),a.createPotentiallyVisibleSet(t),e&&(defined(r)&&updateAndClearFramebuffers(t,i,r),o||(executeComputeCommands(t),executeShadowMapCastCommands(t))),executeCommands(t,i)}function executeCommandsInViewportzh(e,t,i,r){var n=t._environmentState,a=t._view,o=n.renderTranslucentDepthForPick;e||o||(t.frameState.commandList.length=0),o||updateAndRenderPrimitiveszh(t),a.createPotentiallyVisibleSet(t),e&&(defined(r)&&updateAndClearFramebuffers(t,i,r),o||(executeComputeCommands(t),executeShadowMapCastCommands(t))),executeCommands(t,i)}var scratchCullingVolume=new CullingVolume;function updateDebugFrustumPlanes(e){var t=e._frameState;e.debugShowFrustumPlanes!==e._debugShowFrustumPlanes&&(e.debugShowFrustumPlanes?e._debugFrustumPlanes=new DebugCameraPrimitive({camera:e.camera,updateOnChange:!1,frustumSplits:t.frustumSplits}):e._debugFrustumPlanes=e._debugFrustumPlanes&&e._debugFrustumPlanes.destroy(),e._debugShowFrustumPlanes=e.debugShowFrustumPlanes),defined(e._debugFrustumPlanes)&&e._debugFrustumPlanes.update(t)}function updateShadowMaps(e){var t=e._frameState,i=t.shadowMaps,r=i.length,n=r>0&&!t.passes.pick&&e.mode===SceneMode$1.SCENE3D;if(n!==t.shadowState.shadowsEnabled&&(++t.shadowState.lastDirtyTime,t.shadowState.shadowsEnabled=n),t.shadowState.lightShadowsEnabled=!1,n){for(var a=0;a<r;++a)if(i[a]!==t.shadowState.shadowMaps[a]){++t.shadowState.lastDirtyTime;break}t.shadowState.shadowMaps.length=0,t.shadowState.lightShadowMaps.length=0;for(var o=0;o<r;++o){var s=i[o];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 updateAndRenderPrimitives(e){var t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),updateDebugFrustumPlanes(e),updateShadowMaps(e),e._globe&&e._globe.render(t)}function updateAndRenderPrimitiveszh(e){var t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),e.UpdateQuad(t),updateDebugFrustumPlanes(e),updateShadowMaps(e),e._globe&&e._globe.render(t)}function updateAndClearFramebuffers(e,t,i){var r=e._context,n=e._frameState,a=e._environmentState,o=e._view,s=e._frameState.passes.pick,l=a.useWebVR;a.originalFramebuffer=t.framebuffer,defined(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom&&!l?e._sunPostProcess=new SunPostProcess:defined(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!defined(e.sun)&&defined(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);var c=e._clearColorCommand;Color.clone(i,c.color),c.execute(r,t);var u=a.useGlobeDepthFramebuffer=defined(o.globeDepth);u&&(o.globeDepth.update(r,t,o.viewport,e._hdr,a.clearGlobeDepth),o.globeDepth.clear(r,t,i));var d=o.oit,h=a.useOIT=!s&&defined(d)&&d.isSupported();h&&(d.update(r,t,o.globeDepth.framebuffer,e._hdr),d.clear(r,t,i),a.useOIT=d.isSupported());var p,f=e.postProcessStages,m=a.usePostProcess=!s&&(e._hdr||f.length>0||f.ambientOcclusion.enabled||f.fxaa.enabled||f.bloom.enabled);if(a.usePostProcessSelected=!1,m&&(o.sceneFramebuffer.update(r,o.viewport,e._hdr),o.sceneFramebuffer.clear(r,t,i),f.update(r,n.useLogDepth,e._hdr),f.clear(r),m=a.usePostProcess=f.ready,a.usePostProcessSelected=m&&f.hasSelected),a.isSunVisible&&e.sunBloom&&!l?(t.framebuffer=e._sunPostProcess.update(t),e._sunPostProcess.clear(r,t,i)):u?t.framebuffer=o.globeDepth.framebuffer:m&&(t.framebuffer=o.sceneFramebuffer.getFramebuffer()),defined(t.framebuffer)&&c.execute(r,t),a.useInvertClassification=!s&&defined(t.framebuffer)&&e.invertClassification)if(1===e.frameState.invertClassificationColor.alpha&&a.useGlobeDepthFramebuffer&&(p=o.globeDepth.framebuffer),defined(p)||r.depthTexture){if(e._invertClassification.previousFramebuffer=p,e._invertClassification.update(r),e._invertClassification.clear(r,t),e.frameState.invertClassificationColor.alpha<1&&h){var g=e._invertClassification.unclassifiedCommand,_=g.derivedCommands;_.oit=d.createDerivedCommands(g,r,_.oit)}}else a.useInvertClassification=!1;e._globeTranslucencyState.translucent&&o.globeTranslucencyFramebuffer.updateAndClear(e._hdr,o.viewport,r,t)}function callAfterRenderFunctions(e){for(var t=e._frameState.afterRender,i=0,r=t.length;i<r;++i)t[i](),e.requestRender();t.length=0}function getGlobeHeight(e){var t=e._globe,i=e.camera.positionCartographic;if(defined(t)&&t.show&&defined(i))return t.getHeight(i)}function isCameraUnderground(e){var t=e.camera,i=e._mode,r=e.globe,n=e._screenSpaceCameraController,a=t.positionCartographic;if(!defined(a))return!1;if(!n.onMap()&&a.height<0)return!0;if(!defined(r)||!r.show||i===SceneMode$1.SCENE2D||i===SceneMode$1.MORPHING)return!1;var o=e._globeHeight;return defined(o)&&a.height<o}function updateDebugShowFramesPerSecond(e,t){if(e.debugShowFramesPerSecond){if(!defined(e._performanceDisplay)){var i=document.createElement("div");i.className="cesium-performanceDisplay-defaultContainer",e._canvas.parentNode.appendChild(i);var r=new PerformanceDisplay({container:i});e._performanceDisplay=r,e._performanceContainer=i}e._performanceDisplay.throttled=e.requestRenderMode,e._performanceDisplay.update(t)}else defined(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer))}function prePassesUpdate(e){e._jobScheduler.resetBudgets();var t=e._frameState;e.primitives.prePassesUpdate(t),defined(e.globe)&&e.globe.update(t),e._picking.update(),t.creditDisplay.update()}function postPassesUpdate(e){var t=e._frameState;e.primitives.postPassesUpdate(t),RequestScheduler.update()}Scene.prototype.updateEnvironment=function(){var e=this._frameState,t=this._view,i=this._environmentState,r=e.passes.render,n=e.passes.offscreen,a=this.skyAtmosphere,o=this.globe,s=this._globeTranslucencyState;if(!r||this._mode!==SceneMode$1.SCENE2D&&t.camera.frustum instanceof OrthographicFrustum||!s.environmentVisible)i.skyAtmosphereCommand=void 0,i.skyBoxCommand=void 0,i.sunDrawCommand=void 0,i.sunComputeCommand=void 0,i.moonCommand=void 0;else{defined(a)?(defined(o)&&(a.setDynamicAtmosphereColor(o.enableLighting&&o.dynamicAtmosphereLighting,o.dynamicAtmosphereLightingFromSun),i.isReadyForAtmosphere=i.isReadyForAtmosphere||o._surface._tilesToRender.length>0),i.skyAtmosphereCommand=a.update(e,o),defined(i.skyAtmosphereCommand)&&this.updateDerivedCommands(i.skyAtmosphereCommand)):i.skyAtmosphereCommand=void 0,i.skyBoxCommand=defined(this.skyBox)?this.skyBox.update(e,this._hdr):void 0;var l=defined(this.sun)?this.sun.update(e,t.passState,this._hdr):void 0;i.sunDrawCommand=defined(l)?l.drawCommand:void 0,i.sunComputeCommand=defined(l)?l.computeCommand:void 0,i.moonCommand=defined(this.moon)?this.moon.update(e):void 0}var c=i.clearGlobeDepth=defined(o)&&o.show&&(!o.depthTestAgainstTerrain||this.mode===SceneMode$1.SCENE2D);(i.useDepthPlane=c&&this.mode===SceneMode$1.SCENE3D&&s.useDepthPlane)&&this._depthPlane.update(e),i.renderTranslucentDepthForPick=!1,i.useWebVR=this._useWebVR&&this.mode!==SceneMode$1.SCENE2D&&!n;for(var u=e.mode!==SceneMode$1.SCENE3D||s.sunVisibleThroughGlobe?void 0:e.occluder,d=e.cullingVolume,h=scratchCullingVolume.planes,p=0;p<5;++p)h[p]=d.planes[p];d=scratchCullingVolume,i.isSkyAtmosphereVisible=defined(i.skyAtmosphereCommand)&&i.isReadyForAtmosphere,i.isSunVisible=this.isVisible(i.sunDrawCommand,d,u),i.isMoonVisible=this.isVisible(i.moonCommand,d,u);var f=this.specularEnvironmentMaps,m=this._specularEnvironmentMapAtlas;!defined(f)||defined(m)&&m.url===f?!defined(f)&&defined(m)&&(m.destroy(),this._specularEnvironmentMapAtlas=void 0):(m=m&&m.destroy(),this._specularEnvironmentMapAtlas=new OctahedralProjectedCubeMap(f)),defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e)},Scene.prototype.resolveFramebuffers=function(e){var t=this._context,i=this._environmentState,r=this._view,n=r.globeDepth,a=i.useOIT,o=i.useGlobeDepthFramebuffer,s=i.usePostProcess,l=i.originalFramebuffer,c=o?n.framebuffer:void 0,u=r.sceneFramebuffer.getFramebuffer(),d=r.sceneFramebuffer.getIdFramebuffer();i.separatePrimitiveFramebuffer&&n.executeMergeColor(t,e),a&&(e.framebuffer=s?u:l,r.oit.execute(t,e));var h=r.translucentTileClassification;if(h.hasTranslucentDepth&&h.isSupported()&&h.execute(this,e),s){var p=u;o&&!a&&(p=c);var f=this.postProcessStages,m=p.getColorTexture(0),g=d.getColorTexture(0),_=defaultValue(c,u).depthStencilTexture;f.execute(t,m,_,g),f.copy(t,l)}a||s||!o||(e.framebuffer=l,n.executeCopyColor(t,e))},Scene.prototype.initializeFrame=function(){120==this._shaderFrameCount++&&(this._shaderFrameCount=0,this._context.shaderCache.destroyReleasedShaderPrograms(),this._context.textureCache.destroyReleasedTextures()),this._tweens.update(),this._globeHeight=getGlobeHeight(this),this._cameraUnderground=isCameraUnderground(this),this._globeTranslucencyState.update(this),this._screenSpaceCameraController.update(),defined(this._deviceOrientationCameraController)&&this._deviceOrientationCameraController.update(),this.camera.update(this._mode),this.camera._updateCameraChanged()};var scratchBackgroundColor=new Color;function render(e){var t=e._frameState,i=e.context,r=i.uniformState,n=e._defaultView;e._view=n,e.updateFrameState(),t.passes.render=!0,t.passes.postProcess=e.postProcessStages.hasSelected,t.tilesetPassState=renderTilesetPassState;var a=defaultValue(e.backgroundColor,Color.BLACK);e._hdr&&((a=Color.clone(a,scratchBackgroundColor)).red=Math.pow(a.red,e.gamma),a.green=Math.pow(a.green,e.gamma),a.blue=Math.pow(a.blue,e.gamma)),t.backgroundColor=a,e.fog.update(t),r.update(t);var o=e.shadowMap;defined(o)&&o.enabled&&(!defined(e.light)||e.light instanceof SunLight?Cartesian3.negate(r.sunDirectionWC,e._shadowMapCamera.direction):Cartesian3.clone(e.light.direction,e._shadowMapCamera.direction),t.shadowMaps.push(o)),e._computeCommandList.length=0,e._overlayCommandList.length=0;var s=n.viewport;s.x=0,s.y=0,s.width=i.drawingBufferWidth,s.height=i.drawingBufferHeight;var l=n.passState;l.framebuffer=void 0,l.blendingEnabled=void 0,l.scissorTest=void 0,l.viewport=BoundingRectangle.clone(s,l.viewport),defined(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(l,a),e.resolveFramebuffers(l),l.framebuffer=void 0,executeOverlayCommands(e,l),defined(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),i.endFrame()}function tryAndCatchError(e,t){try{t(e)}catch(t){if(e._renderError.raiseEvent(e,t),e.rethrowRenderErrors)throw t}}function updateMostDetailedRayPicks(e){return e._picking.updateMostDetailedRayPicks(e)}function updatePreloadPass(e){var t=e._frameState;preloadTilesetPassState.camera=t.camera,preloadTilesetPassState.cullingVolume=t.cullingVolume,e.primitives.updateForPass(t,preloadTilesetPassState)}function updatePreloadFlightPass(e){var t=e._frameState;t.camera.canPreloadFlight()&&(preloadFlightTilesetPassState.camera=e.preloadFlightCamera,preloadFlightTilesetPassState.cullingVolume=e.preloadFlightCullingVolume,e.primitives.updateForPass(t,preloadFlightTilesetPassState))}function updateRequestRenderModeDeferCheckPass(e){e.primitives.updateForPass(e._frameState,requestRenderModeDeferCheckPassState)}Scene.prototype.render=function(e){this._preUpdate.raiseEvent(this,e);var t=this._frameState;t.newFrame=!1,defined(e)||(e=JulianDate.now());var i=this._view.checkForCameraUpdates(this),r=!this.requestRenderMode||this._renderRequested||i||this._logDepthBufferDirty||this._hdrDirty||this.mode===SceneMode$1.MORPHING;if(!r&&defined(this.maximumRenderTimeChange)&&defined(this._lastRenderTime)){var n=Math.abs(JulianDate.secondsDifference(this._lastRenderTime,e));r=r||n>this.maximumRenderTimeChange}r&&(this._lastRenderTime=JulianDate.clone(e,this._lastRenderTime),this._renderRequested=!1,this._logDepthBufferDirty=!1,this._hdrDirty=!1,updateFrameNumber(this,CesiumMath.incrementWrap(t.frameNumber,15e6,1),e),t.newFrame=!0);tryAndCatchError(this,prePassesUpdate),this.primitives.show&&(tryAndCatchError(this,updateMostDetailedRayPicks),tryAndCatchError(this,updatePreloadPass),tryAndCatchError(this,updatePreloadFlightPass),r||tryAndCatchError(this,updateRequestRenderModeDeferCheckPass)),this._postUpdate.raiseEvent(this,e),r&&(this._preRender.raiseEvent(this,e),t.creditDisplay.beginFrame(),tryAndCatchError(this,render)),updateDebugShowFramesPerSecond(this,r),tryAndCatchError(this,postPassesUpdate),callAfterRenderFunctions(this),r&&(this._postRender.raiseEvent(this,e),t.creditDisplay.endFrame())},Scene.prototype.forceRender=function(e){this._renderRequested=!0,this.render(e)},Scene.prototype.requestRender=function(){this._renderRequested=!0},Scene.prototype.clampLineWidth=function(e){return Math.max(ContextLimits.minimumAliasedLineWidth,Math.min(e,ContextLimits.maximumAliasedLineWidth))},Scene.prototype.pick=function(e,t,i){return this._picking.pick(this,e,t,i)},Scene.prototype.UpdateQuad=function(e){for(var t=0,i=this._primitivesQuadTrees.length;t<i;t++){var r=this._primitivesQuadTrees[t]._tilesToRender;if(r)for(var n=0,a=r.length;n<a;n++){var o=r[n];o.data&&o.data.geometryPrimitive&&o.data.geometryPrimitive.update(e)}}},Scene.prototype.pickPositionWorldCoordinates=function(e,t){return this._picking.pickPositionWorldCoordinates(this,e,t)},Scene.prototype.pickPosition=function(e,t){return this._picking.pickPosition(this,e,t)},Scene.prototype.drillPick=function(e,t,i,r){return this._picking.drillPick(this,e,t,i,r)},Scene.prototype.pickFromRay=function(e,t,i){return this._picking.pickFromRay(this,e,t,i)},Scene.prototype.drillPickFromRay=function(e,t,i,r){return this._picking.drillPickFromRay(this,e,t,i,r)},Scene.prototype.pickFromRayMostDetailed=function(e,t,i){return this._picking.pickFromRayMostDetailed(this,e,t,i)},Scene.prototype.drillPickFromRayMostDetailed=function(e,t,i,r){return this._picking.drillPickFromRayMostDetailed(this,e,t,i,r)},Scene.prototype.sampleHeight=function(e,t,i){return this._picking.sampleHeight(this,e,t,i)},Scene.prototype.clampToHeight=function(e,t,i,r){return this._picking.clampToHeight(this,e,t,i,r)},Scene.prototype.sampleHeightMostDetailed=function(e,t,i){return this._picking.sampleHeightMostDetailed(this,e,t,i)},Scene.prototype.clampToHeightMostDetailed=function(e,t,i){return this._picking.clampToHeightMostDetailed(this,e,t,i)},Scene.prototype.cartesianToCanvasCoordinates=function(e,t){return SceneTransforms.wgs84ToWindowCoordinates(this,e,t)},Scene.prototype.completeMorph=function(){this._transitioner.completeMorph()},Scene.prototype.morphTo2D=function(e){var t,i=this.globe;t=defined(i)?i.ellipsoid:this.mapProjection.ellipsoid,e=defaultValue(e,2),this._transitioner.morphTo2D(e,t)},Scene.prototype.morphToColumbusView=function(e){var t,i=this.globe;t=defined(i)?i.ellipsoid:this.mapProjection.ellipsoid,e=defaultValue(e,2),this._transitioner.morphToColumbusView(e,t)},Scene.prototype.morphTo3D=function(e){var t,i=this.globe;t=defined(i)?i.ellipsoid:this.mapProjection.ellipsoid,e=defaultValue(e,2),this._transitioner.morphTo3D(e,t)},Scene.prototype.isDestroyed=function(){return!1},Scene.prototype.destroy=function(){this._tweens.removeAll(),this._computeEngine=this._computeEngine&&this._computeEngine.destroy(),this._screenSpaceCameraController=this._screenSpaceCameraController&&this._screenSpaceCameraController.destroy(),this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this._primitives=this._primitives&&this._primitives.destroy(),this._groundPrimitives=this._groundPrimitives&&this._groundPrimitives.destroy(),this._globe=this._globe&&this._globe.destroy(),this.skyBox=this.skyBox&&this.skyBox.destroy(),this.skyAtmosphere=this.skyAtmosphere&&this.skyAtmosphere.destroy(),this._debugSphere=this._debugSphere&&this._debugSphere.destroy(),this.sun=this.sun&&this.sun.destroy(),this._sunPostProcess=this._sunPostProcess&&this._sunPostProcess.destroy(),this._depthPlane=this._depthPlane&&this._depthPlane.destroy(),this._transitioner=this._transitioner&&this._transitioner.destroy(),this._debugFrustumPlanes=this._debugFrustumPlanes&&this._debugFrustumPlanes.destroy(),this._brdfLutGenerator=this._brdfLutGenerator&&this._brdfLutGenerator.destroy(),this._picking=this._picking&&this._picking.destroy(),this._defaultView=this._defaultView&&this._defaultView.destroy(),this._view=void 0,this._removeCreditContainer&&this._canvas.parentNode.removeChild(this._creditContainer),this.postProcessStages=this.postProcessStages&&this.postProcessStages.destroy(),this._context=this._context&&this._context.destroy(),this._frameState.creditDisplay=this._frameState.creditDisplay&&this._frameState.creditDisplay.destroy(),defined(this._performanceDisplay)&&(this._performanceDisplay=this._performanceDisplay&&this._performanceDisplay.destroy(),this._performanceContainer.parentNode.removeChild(this._performanceContainer)),this._removeRequestListenerCallback(),this._removeTaskProcessorListenerCallback();for(var e=0;e<this._removeGlobeCallbacks.length;++e)this._removeGlobeCallbacks[e]();return this._removeGlobeCallbacks.length=0,destroyObject(this)};
|