chunk-39efb0b6.127adb4c.js 135 KB

12
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-39efb0b6"],{"16d0":function(e,t,i){"use strict";i.d(t,"a",(function(){return l}));var r=i("a4ee"),s=i("e92d"),n=i("59b2"),a=(i("b50f"),i("c120"),i("cea0"),i("d386")),o=i("66a2"),d=i("ee9c");const c=s["a"].getLogger("esri.views.3d.layers.support.DefinitionExpressionSceneLayerView"),l=e=>{let t=class extends e{constructor(){super(...arguments),this._definitionExpressionErrors=0,this._maxDefinitionExpressionErrors=20,this.logError=e=>{this._definitionExpressionErrors<this._maxDefinitionExpressionErrors&&c.error("Error while evaluating definitionExpression: "+e),this._definitionExpressionErrors++,this._definitionExpressionErrors===this._maxDefinitionExpressionErrors&&c.error("Further errors are ignored")}}get parsedDefinitionExpression(){if(!this.i3slayer||!this.i3slayer.definitionExpression)return null;try{const e=o["WhereClause"].create(this.i3slayer.definitionExpression,this.i3slayer.fieldsIndex);if(!e.isStandardized)return c.error("definitionExpression is using non standard function"),null;const t=[],i=e.fieldNames;return Object(d["l"])(i,this.i3slayer.fields,{missingFields:t}),t.length>0?(c.error("definitionExpression references unknown fields: "+t.join(", ")),null):(this._definitionExpressionErrors=0,e)}catch(e){return c.error("Failed to parse definitionExpression: "+e),null}}get definitionExpressionFields(){return this.parsedDefinitionExpression?this.parsedDefinitionExpression.fieldNames:null}_evaluateClause(e,t){try{return e.testFeature(t)}catch(i){return this.logError(i),!1}}_addDefinitionExpressionToQuery(e){if(!this.parsedDefinitionExpression)return e;const t=this.i3slayer.definitionExpression,i=e.clone();return i.where?i.where=`(${t}) AND (${i.where})`:i.where=t,i}};return Object(r["a"])([Object(n["b"])()],t.prototype,"i3slayer",void 0),Object(r["a"])([Object(n["b"])({readOnly:!0})],t.prototype,"parsedDefinitionExpression",null),Object(r["a"])([Object(n["b"])({readOnly:!0})],t.prototype,"definitionExpressionFields",null),t=Object(r["a"])([Object(a["a"])("esri.views.3d.layers.support.DefinitionExpressionSceneLayerView")],t),t}},"2b13":function(e,t,i){"use strict";var r,s;i.d(t,"a",(function(){return r})),i.d(t,"b",(function(){return s})),function(e){e[e.KTX2=1]="KTX2",e[e.Basis=2]="Basis",e[e.DDS_S3TC=4]="DDS_S3TC",e[e.PNG=8]="PNG",e[e.JPG=16]="JPG",e[e.KTX_ETC2=32]="KTX_ETC2"}(r||(r={})),function(e){e[e.None=0]="None",e[e.Color=1]="Color",e[e.MetallicRoughness=2]="MetallicRoughness",e[e.Normal=4]="Normal",e[e.Occlusion=8]="Occlusion",e[e.Emissive=16]="Emissive",e[e.AlphaMask=32]="AlphaMask",e[e.ColorTextures=19]="ColorTextures",e[e.GeometryTextures=36]="GeometryTextures",e[e.GeometryTexturesPBR=44]="GeometryTexturesPBR",e[e.AllTextures=37]="AllTextures",e[e.AllTexturesPBR=63]="AllTexturesPBR"}(s||(s={}))},"38a2":function(e,t,i){"use strict";i.d(t,"a",(function(){return Le}));var r=i("a4ee"),s=i("fc29"),n=i("af40"),a=i("c120"),o=i("e92d"),d=i("b2b2"),c=i("8a44"),l=i("fab3"),u=i("f4cc"),h=i("477c"),b=i("59b2"),f=i("b50f"),g=(i("cea0"),i("d386")),p=i("8188"),m=i("9180"),_=i("1a54"),y=i("306f"),O=i("9305");class j{constructor(e){this.referenceCount=0,this.callbacks=[],this.runIndex=0,this.handle=e.registerTask(O["c"].I3S_CONTROLLER,this)}destroy(){this.handle&&(this.handle.remove(),this.handle=null)}get running(){for(const e of this.callbacks)if(e.needsUpdate())return!0;return!1}runTask(e){this._sort();const t=this.callbacks,i={numIndexLoading:0,numNodesLoading:0};for(let r=0;r<t.length&&!e.done;++r)t[r].priority=t[r].update(e,i),this.runIndex=r}_sort(){const e=this.callbacks;let t=e.length;for(let i=this.runIndex;i>0;i--){const r=e[i-1];let s=i;for(;s<e.length&&r.priority<=e[s].priority&&(s!==t||r.priority<e[s].priority);)e[s-1]=e[s],s++;e[s-1]=r,t=s-1}this.runIndex=0}add(e){this._sort(),e.priority=1/0,this.callbacks.unshift(e)}remove(e){Object(f["k"])(this.callbacks,e),this.runIndex=this.callbacks.length,this._sort()}}const v=new Map;function x(e,t){let i=v.get(e);return null==i&&(i=new j(e),v.set(e,i)),i.add(t),{remove:()=>{null!=i&&(i.remove(t),i.callbacks.length>0||(v.delete(e),i.destroy()),i=null)}}}var w=i("e431"),C=i("0fc4"),I=i("c453"),N=i("ee9c"),S=i("cee3");class D{constructor(e,t,i,r,s){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this.ref=r,this.node=s,this.useAsHole=0,this.filterImpact=I["e"].NotChecked}}class E{constructor(e,t,i,r,s,n,a,o,d,l,u,h,b,f){this.streamDataController=i,this.viewportQueries=r,this.logger=s,this.holeFilling=n,this._isLoaded=a,this._isReloading=o,this._isSelected=d,this._enable=l,this._needsUpdate=u,this._canRequest=h,this._computeVisibilityObb=b,this._computeNodeFiltering=f,this._dirty=!0,this._nodePages=[],this.nodeCount=0,this.nodesPerPage=0,this.rootIndex=0,this.lodMetric=I["b"].None,this._lodConversion=e=>e,this.urlPrefix="",this._loading=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._nodeTraversalState=new Map,this._version=T(0),this._visibilityCacheVersion=T(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missing=new c["a"]({deallocator:null}),this._prefetch=new c["a"]({deallocator:null}),this._updates=new M(this._missing),this._imModificationUncategorized=new c["a"]({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=[],this.layerHasModifications=!1,this._layerHasFilter=!1,this.logLayer=e,e.serviceUpdateTimeStamp&&e.serviceUpdateTimeStamp.lastUpdate&&(this.lastUpdate=""+e.serviceUpdateTimeStamp.lastUpdate),this._maxLodLevel=this.viewportQueries?this.viewportQueries.maxLodLevel:1,this._init(t)}_init(e){if("page"===e.type){switch(this.urlPrefix=e.urlPrefix,this.nodesPerPage=e.pageSize,this.rootIndex=e.rootIndex,e.lodMetric){case"maxScreenThreshold":this.lodMetric=I["b"].MaxScreenThreshold;break;case"maxScreenThresholdSQ":this.lodMetric=I["b"].MaxScreenThreshold,this._lodConversion=z}this._addPage(R(this.rootIndex,this.nodesPerPage),e.rootPage),this._updateParentsAndLevel()}else if("node"===e.type){this.urlPrefix=e.urlPrefix,this._nodePages.push({nodes:[],children:[],parents:[]}),this._makeRefNode(new I["d"](e.rootNode.id,null),-1);const t=this._validateNode(e.rootNode.id,e.rootNode);t&&this._addNode(t,0)}}_loadPage(e){this._loading.add(e);const t=this.urlPrefix+e;this.streamDataController.request(t,"json").then(t=>{this._pageQueue.push({pageIndex:e,page:t})}).catch(t=>{this._loading.delete(e),Object(u["m"])(t)||(this._failedPages.add(e),this.logger.error("#loadPage()",this.logLayer,"Error when loading page "+e,t))})}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loading.delete(t),e.madeProgress()}this._updateParentsAndLevel()}_addPage(e,t){for(let n=this._nodePages.length;n<e;n++)this._nodePages[n]=null;const i=[],r=[],s=t.nodes.map((t,s)=>{const n=i.length,a=t.children?t.children.length:0;r.push(-1);for(let e=0;e<a;e++)i.push(t.children[e]);const o=""+t.index,d=Object(S["b"])(t.obb),c=Object(C["f"])([d.center[0],d.center[1],d.center[2],Object(w["r"])(d.halfSize)]),l=t.mesh&&t.mesh.attribute,u=t.mesh&&t.mesh.geometry,h=t.mesh&&t.mesh.material,b={hasSharedResource:!1,hasFeatureData:!!u,attributes:l&&null!=l.resource?""+l.resource:null,geometry:u&&null!=u.resource?""+u.resource:null,texture:h&&null!=h.resource?""+h.resource:null,geometryDefinition:u?u.definition:-1,materialDefinition:h?h.definition:-1},f=new I["c"](o,e*this.nodesPerPage+s,c,a,0,b,this.lastUpdate,this.lodMetric,this._lodConversion(t.lodThreshold),u?u.featureCount:null);return f.serviceObb=d,f.visibilityObb=this._computeVisibilityObb(f),f.vertexCount=u?u.vertexCount:0,new D(n,a,P(this._visibilityCacheVersion),null,f)});this._nodePages[e]={nodes:s,children:i,parents:r},this.nodeCount+=s.length}_updateParentsAndLevel(){const e=new Array,t=(t,i,r)=>{const s=this._getPage(t);if(Object(d["k"])(s)){const n=U(t,this.nodesPerPage);s.parents[n]=i;const a=s.nodes[n].node;Object(d["k"])(a)&&(a.level=r,e.push(t))}};for(t(this.rootIndex,-1,0);e.length;){const i=e.pop(),r=this.getNode(i);if(Object(d["k"])(r))for(let e=0;e<r.childCount;e++)t(this.getChildIndex(r,e),i,r.level+1),this._maxLevel=Math.max(this._maxLevel,r.level+1)}}_getPage(e){return this._nodePages[R(e,this.nodesPerPage)]}_getNodeInternal(e){const t=this._getPage(e);return Object(d["j"])(t)?null:t.nodes[U(e,this.nodesPerPage)]}_addNode(e,t){null!=e.children&&this.populateChildren(t,e.children);const i=this.getParent(t),r=Object(d["k"])(i)?i.level+1:0;this._maxLevel=Math.max(this._maxLevel,e.children?r+1:r);const{lodMetric:s,maxError:n}=q(e.lodSelection),a=Object(d["t"])(this._getNodeInternal(t));return a.node=new I["c"](e.id,t,Object(C["f"])(e.mbs),a.childCount,r,e.resources,e.version,s,n,e.numFeatures),e.obb&&(a.node.serviceObb=Object(S["b"])(e.obb)),a.node.visibilityObb=this._computeVisibilityObb(a.node),Object(d["k"])(a.ref)&&(null==a.ref.mbs&&(a.ref.mbs=e.mbs),a.node.renderMbs=a.ref.renderMbs,a.node.serviceObbInRenderSR=a.ref.serviceObbInRenderSR,a.ref.visibilityObb=a.node.visibilityObb),a.node}_makeRefNode(e,t){const i=this._nodePages[0],r=i.nodes.length;return i.nodes.push(new D(0,0,P(this._visibilityCacheVersion),e,null)),this.nodeCount++,i.parents.push(t),e.renderMbs[3]=-1,Object(d["k"])(e.serviceObbInRenderSR)&&(e.serviceObbInRenderSR.halfSize[0]=-1),r}populateChildren(e,t){const i=Object(d["t"])(this._getNodeInternal(e)),r=Object(d["t"])(this._getPage(e));i.childOffset=r.children.length,i.childCount=t.length;for(let s=0;s<t.length;s++){const i=this._makeRefNode(t[s],e);r.children.push(i)}}getNode(e){const t=this._getNodeInternal(e);return Object(d["k"])(t)?t.node:null}getIndexById(e){let t;return this._forAllNodes((i,r)=>{(Object(d["k"])(i.node)&&i.node.id===e||Object(d["k"])(i.ref)&&i.ref.id===e)&&(t=r)}),t}getNodeById(e){const t=this.getIndexById(e);return t>=0?this.getNode(t):null}getChildIndex(e,t){const i=this._getPage(e.index);if(Object(d["j"])(i))return-1;const r=i.nodes[U(e.index,this.nodesPerPage)];return i.children[r.childOffset+t]}getParentIndex(e){const t=this._getPage(e);return Object(d["k"])(t)?t.parents[U(e,this.nodesPerPage)]:-1}getParent(e){return(e=this.getParentIndex(e))>=0?this.getNode(e):null}isLeaf(e){const t=this._getNodeInternal(e);return Object(d["k"])(t)&&0===t.childCount}get rootNode(){return this.getNode(this.rootIndex)}get size(){return this.nodeCount}invalidateVisibilityCache(){this._visibilityCacheVersion=T(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(e){const t=this._getNodeInternal(e);Object(d["k"])(t)&&this.invalidateNodeVisibilityCacheInternal(t)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=P(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(e){const t=this._getNodeInternal(e);Object(d["k"])(t)&&(A(t),this.invalidateNodeVisibilityCacheInternal(t))}invalidateGeometryVisibility(e){const t=this._getNodeInternal(e);Object(d["k"])(t)&&Object(d["k"])(t.node)&&(t.node.geometryObb=null,t.node.renderMbs[3]=-1,Object(d["k"])(t.node.serviceObbInRenderSR)&&(t.node.serviceObbInRenderSR.halfSize[0]=-1))}invalidateVisibilityObbs(){Object(d["j"])(this.rootNode)||this.traverse(this.rootNode,e=>(e.visibilityObb=this._computeVisibilityObb(e),e.geometryObb=null,!0))}isNodeVisible(e){const t=this._getNodeInternal(e);if(Object(d["j"])(t)||Object(d["k"])(t.ref)&&!t.ref.mbs)return!0;if(!k(t.visibilityCache,this._visibilityCacheVersion)){const e=t.node,i=Object(d["k"])(e)&&(Object(d["j"])(t.ref)||Object(d["k"])(e.visibilityObb))?e:Object(d["k"])(t.ref)?t.ref:null;if(this._layerHasFilter&&this._computeNodeFiltering&&(Object(d["k"])(e)||Object(d["k"])(t.ref))&&t.filterImpact===I["e"].NotChecked){const i=Object(d["k"])(e)?e.mbs:Object(d["k"])(t.ref)?t.ref.mbs:null;t.filterImpact=null!=i?this._computeNodeFiltering(i):I["e"].Unmodified}const r=Object(d["k"])(e)&&t.filterImpact===I["e"].Culled,s=!(Object(d["k"])(e)&&e.imModificationImpact===I["f"].Culled)&&(!i||this.viewportQueries.isNodeVisible(i))&&!r;return t.visibilityCache=L(s,this._visibilityCacheVersion),s}return V(t.visibilityCache)}isGeometryVisible(e){if(!this.isNodeVisible(e))return!1;const t=this._getNodeInternal(e);return!(Object(d["k"])(t)&&Object(d["k"])(t.node)&&Object(d["k"])(t.node.geometryObb)&&(!this.layerHasModifications||t.node.imModificationImpact!==I["f"].NotChecked))||this.viewportQueries.isGeometryVisible(t.node)}_traverseCoverage(e,t,i,r,s){const n=this._getPage(e);if(Object(d["j"])(n)||0===t.childCount)return;const a=t.childOffset+t.childCount,o=new Array;for(let c=t.childOffset;c<a;++c){const e=n.children[c],t=this._getNodeInternal(e);Object(d["k"])(t)&&Object(d["k"])(t.node)&&this.isGeometryVisible(e)&&o.push(t)}r/=o.length;for(const c of o){const e=Object(d["t"])(c.node).index;this._isLoaded(e)||this._isReloading(e)?(s.delta=Math.max(s.delta,i),s.coverage+=r):this._traverseCoverage(e,c,i+1,r,s)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const t=this._getNodeInternal(e);if(Object(d["j"])(t))return!1;if("always"===this.holeFilling)return!0;if(k(t.useAsHole,this._version))return V(t.useAsHole);const i={delta:0,coverage:0};this._traverseCoverage(e,t,0,1,i);const r=i.delta*i.coverage<=.5;return t.useAsHole=L(r,this._version),r}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.add.prune(),this._updates.update.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=T(this._version)}imModificationsChanged(e){this.layerHasModifications=e,this._forAllNodes(({node:e})=>{Object(d["k"])(e)&&(e.imModificationImpact=I["f"].NotChecked,e.visibilityObb=this._computeVisibilityObb(e),e.hasModifications&&this.invalidateGeometryVisibility(e.index))}),this.invalidateVisibilityCache()}layerFilterChanged(e){this._layerHasFilter=e,this._forAllNodes(e=>{if(Object(d["k"])(e)){e.filterImpact=I["e"].NotChecked;const t=e.node;Object(d["k"])(t)&&this.invalidateNodeVisibilityCache(t.index)}}),this.invalidateVisibilityCache()}update(e,t,i){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(t),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missing.clear(),this._prefetch.clear(),this._updates.reset(e),F.clear();let r=!0;const s=new B,n=new B,a=this._imModificationUncategorized;a.clear();const o=new Set,c=(c,l,u)=>{if(Object(d["j"])(l)){let e=this._entryPriority(c);e===1/0&&(e=this._entryPriority(u));const t=R(c,this.nodesPerPage);return F.set(t,Math.max(e,F.get(t)||0)),this._loading.has(t)||this._failedPages.has(t)||this._missing.push(t),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const h=l.node;if(this._updateNodeFeatureEstimate(h,n),Object(d["j"])(h)){const e=this._entryPriority(c);return this._loading.has(c)||this._failedNodes.has(c)||(this._missing.push(c),F.set(c,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const b=Object(d["t"])(this._getPage(c));if(0===this._missing.length&&0===this.nodesPerPage)for(let e=0;e<l.childCount;e++){const t=b.children[l.childOffset+e],i=this._getNodeInternal(t);!Object(d["k"])(i)||i.node||this._loading.has(t)||this._failedNodes.has(t)||(F.set(t,this._entryPriority(t)),this._prefetch.push(t))}if(h.failed)return;if(o.add(h.id),this._isLoaded(c)){if(s.known+=h.memory,++s.knownNodes,this._isSelected(h)?l.childCount>0&&(r=!1):(s.unremoved+=h.memory,r=!1),this._needsUpdate(h)){const e=this._entryPriority(c);F.set(c,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(c)}return}if(h.memory&&(s.known+=h.memory,++s.knownNodes),!this._isSelected(h))return void(this._isReloading(c)&&this._updates.remove.push(c));if(l.childCount>0&&(r=!1),h.memory?(s.missing+=h.memory,s.known+=h.memory,++s.knownNodes):++s.missingNodes,e.indexOf(h.index)>=0)return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(c)),void(this._updates.cancel=this._updates.cancel.filter(e=>e!==h.index));if(!t.done&&this._enable(h))return void t.madeProgress();const f=this._entryPriority(c);F.set(c,f),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f),this._updates.add.push(c),this.layerHasModifications&&i&&Object(d["k"])(h)&&h.imModificationImpact===I["f"].NotChecked&&a.push(c)};this.traverseVisible(c);const l=this._updates.add;l.length>0&&this.layerHasModifications&&(a.length>0&&i(a),l.filterInPlace(e=>{const t=this._getNodeInternal(e),i=Object(d["j"])(t)||Object(d["j"])(t.node)||t.node.imModificationImpact!==I["f"].Culled;return i||this.invalidateNodeVisibilityCache(e),i})),this._unloadedMemoryEstimate=s.missing-s.unremoved,s.knownNodes>3&&s.missingNodes>0&&(this._unloadedMemoryEstimate+=s.known/s.knownNodes*s.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(n),this._featureEstimate.leavesReached=r,this._missing.sort((e,t)=>e-t),this._missing.filterInPlace((e,t)=>t<1||this._missing.data[t-1]!==e),this._missing.sort((e,t)=>F.get(e)-F.get(t)),this._missing.length>0&&(this._maxUnloadedPrio=F.get(this._missing.back()),this._prefetch.clear()),this._updates.add.filterInPlace(e=>F.get(e)>=this._maxUnloadedPrio).sort((e,t)=>F.get(e)-F.get(t)),this._updates.update.sort((e,t)=>F.get(e)-F.get(t)),this._indexMissing=this._loading.size+this._missing.length,this._dirty=this._indexMissing>0,F.clear()}checkFeatureTarget(e,t){const i=this.viewportQueries.updateScreenSpaceErrorBias(t);let r=t,s=t,n=i,a=10;for(;a--;){const i=new B;if(this._updateFeatureEstimate(r,i),this._computeFeatureEstimate(i)<=e){if(r>=t||i.missingNodes>0||0===a)break;n=r,r=.5*(r+s)}else s=r,r=.5*(r+n)}return this._version=T(this._version),this.viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,r)}_updateFeatureEstimate(e,t){this._version=T(this._version),this.viewportQueries.updateScreenSpaceErrorBias(e),this.traverseVisible((e,i)=>this._updateNodeFeatureEstimate(Object(d["k"])(i)&&i.node,t))}_updateNodeFeatureEstimate(e,t){if(!(Object(d["j"])(e)||e.failed||Object(d["j"])(e.numFeatures)))return this._isLoaded(e.index)?(t.known+=e.numFeatures,++t.knownNodes,void(this._isSelected(e)||(t.unremoved+=e.numFeatures))):void(this._isSelected(e)&&(Object(d["k"])(e.numFeatures)?(t.missing+=e.numFeatures,t.known+=e.numFeatures,++t.knownNodes):++t.missingNodes))}_computeFeatureEstimate(e){let t=e.known-e.unremoved;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.known/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missing)}prefetch(){return this._prefetch.sort((e,t)=>F.get(e)-F.get(t)),this._load(this._prefetch)}_load(e){if(0===e.length||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();)0===this.nodesPerPage?this._loadNode(e.pop()):this._loadPage(e.pop());return!0}isLoading(){return this._indexMissing>0}getIndexLoading(){return this._loading.size}getIndexMissing(){return this._indexMissing}getUnloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}nodeTraversalState(e){if(Object(d["j"])(e))return null;let t=this._nodeTraversalState.get(e.index);if(t&&k(t.version,this._version))return t;const i=this.viewportQueries.getLodLevel(e),r=this.viewportQueries.hasLOD(e);let s=!0;if(r){const t=this.getParentIndex(e.index);if(t>=0){const e=this._nodeTraversalState.get(t);s=e&&i>e.lodLevel}else s=i>0}else s=0===e.childCount;return t?(t.lodLevel=i,t.isChosen=s,t.version=L(!0,this._version),t):(t=new I["h"](r,s,i,L(!0,this._version)),this._nodeTraversalState.set(e.index,t),t)}_loadNode(e){this._loading.add(e);const t=Object(d["t"])(this._getNodeInternal(e)).ref;if(Object(d["j"])(t))return void this._failedNodes.add(e);const i=t.id,r=this.urlPrefix+i,s=()=>{this._loading.delete(e),0===this._missing.length&&0===this._loading.size&&this.requestUpdate()};this.streamDataController.request(r,"json").then(t=>{s();const r=this._validateNode(i,t);if(null==r)return;r.obb&&this.invalidateNodeVisibilityCache(e);const n=this._addNode(r,e);this.nodeTraversalState(n)},t=>{s(),Object(u["m"])(t)||(this.logger.error("#loadNode()",this.logLayer,"Error loading node: "+r),this._failedNodes.add(e))})}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this.logger.error("#validateNode()",this.logLayer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this.logger.error("#validateNode()",this.logLayer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this.logger.warn("#validateNode()",this.logLayer,`Invalid shared resource href on node "${e}"`),null==t.geometryData||Array.isArray(t.geometryData)&&1===t.geometryData.length&&"./geometries/0"===t.geometryData[0].href||this.logger.warn("#validateNode()",this.logLayer,`Invalid geometry data on node "${e}"`),null==t.attributeData||Array.isArray(t.attributeData)&&!t.attributeData.some((e,t)=>e.href!==`./attributes/f_${t}/0`)||this.logger.warn("#validateNode()",this.logLayer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this.logger.warn("#validateNode()",this.logLayer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const i=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,r=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:null,s=t=>{if(null==t)return null;const i=t=>this.logger.error("#validateNode()",this.logLayer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this.logger.error("#validateNode()",this.logLayer,`Invalid node href on node "${e}"`);const r=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,s=new I["d"](""+t.id,t.mbs);return s.serviceObb=r,s.visibilityObb=this._computeVisibilityObb(s),s},n=Array.isArray(t.children)?t.children.map(s).filter(e=>null!=e):null;return{id:e,mbs:t.mbs,obb:i,children:n,resources:{hasFeatureData:t.featureData&&t.featureData.length>0,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:null,texture:t.textureData&&t.textureData.length>0?e:null,geometry:null!=t.geometryData?e:null},version:"string"==typeof t.version?t.version:null,lodSelection:Array.isArray(t.lodSelection)?t.lodSelection:null,numFeatures:r}}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes(e=>{Object(d["k"])(e.node)&&(e.node.failed=!1)})}_entryPriority(e){const t=this._getNodeInternal(e),i=this.getParentIndex(e);if(Object(d["j"])(t)||i<0&&null==t.node)return i<0?1/0:this._entryPriority(i);let r=0;if(t.node&&i>=0){const e=this._nodeTraversalState.get(i);null!=e&&(r=e.lodLevel)}let s=this.progressiveLoadPenalty;for(let a=e;a>=0;a=this.getParentIndex(a))if(this._isLoaded(a)){s=0;break}const n=Object(d["k"])(t.ref)?this.viewportQueries.distToPOI(t.ref):Object(d["k"])(t.node)?this.viewportQueries.distToPOI(t.node):0;return-n-r*(n+this.progressiveLoadPenalty)+s}traverseVisible(e){const t=this._getNodeInternal(this.rootIndex);Object(d["j"])(t)?e(this.rootIndex,null,null):this._traverseVisible(this.rootIndex,-1,t,e)}_traverseVisible(e,t,i,r){if(i.node&&0===i.childCount)return void(this.isGeometryVisible(e)&&r(e,i,t));if(!this.isNodeVisible(e))return;if(r(e,i,t),null==i.node)return;const s=this.nodeTraversalState(i.node);if(s.nodeHasLOD&&s.lodLevel===this._maxLodLevel)return;const n=Object(d["t"])(this._getPage(e));for(let a=0;a<i.childCount;a++){const t=n.children[i.childOffset+a],s=this._getNodeInternal(t);Object(d["k"])(s)?this._traverseVisible(t,e,s,r):r(t,null,e)}}traverse(e,t){t(e)&&this.traverseChildren(e,t)}traverseChildren(e,t){const i=e.index,r=this._getNodeInternal(i);Object(d["k"])(r)&&this._traverseChildren(i,r,t)}_traverseChildren(e,t,i){const r=this._getPage(e);if(Object(d["j"])(r))return;const s=t.childOffset+t.childCount;for(let n=t.childOffset;n<s;++n){const e=r.children[n],t=this._getNodeInternal(e);Object(d["k"])(t)&&Object(d["k"])(t.node)&&i(t.node)&&this._traverseChildren(e,t,i)}}updateStats(e){if(this._updates.add.length>0&&(e.nodes+=" + "+this._updates.add.length),(this._indexMissing||this._prefetch.length>0)&&(e.index+=" + "+this._indexMissing||!1),e.prio=this._maxProcessingPrio,this._featureEstimate.estimate){const t=this._featureEstimate.estimate-e.features;t>0?e.features+=" + "+t:t<0&&(e.features+=" - "+-t)}}getPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}updateElevationInfo(e){this._forAllNodes(A),this.viewportQueries.updateElevationInfo(e)}_forAllNodes(e){for(let t=0;t<this._nodePages.length;t++){const i=this._nodePages[t];if(i){const r=t*this.nodesPerPage;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],r+t)}}}get test(){return{addNode:(e,t)=>this._addNode(e,t)}}}const F=new Map;class M{constructor(e){this.missing=e,this.update=new c["a"]({deallocator:null}),this.add=new c["a"]({deallocator:null}),this.remove=new c["a"]({deallocator:null}),this.cancel=[]}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function A(e){Object(d["k"])(e.node)&&(e.node.renderMbs[3]=-1,Object(d["k"])(e.node.serviceObbInRenderSR)&&(e.node.serviceObbInRenderSR.halfSize[0]=-1)),Object(d["k"])(e.ref)&&(e.ref.renderMbs[3]=-1,Object(d["k"])(e.ref.serviceObbInRenderSR)&&(e.ref.serviceObbInRenderSR.halfSize[0]=-1))}function P(e){return Object(N["b"])(e,-2)}function T(e){return Object(N["b"])(e,2)}function L(e,t){return t+(e?1:0)}function k(e,t){return(-2&e)===t}function V(e){return 1==(1&e)}function R(e,t){return 0===t?0:e/t|0}function U(e,t){return 0===t?e:e%t}const G=[["maxScreenThreshold",I["b"].MaxScreenThreshold],["screenSpaceRelative",I["b"].ScreenSpaceRelative],["removedFeatureDiameter",I["b"].RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",I["b"].DistanceRangeFromDefaultCamera]];function q(e){if(e)for(let t=0;t<e.length;t++)for(const i of G)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:I["b"].None,maxError:0}}class B{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}function z(e){return Math.sqrt(e*(4/Math.PI))}var H=i("673a");class Q{constructor(e){this.layerView=e,this._lodGlobalDirty=!1}startNodeLoading(e,t,i,r){this._maxLodLevel=r.maxLodLevel,this._index=i,this._isNodeInScaleBounds=e,this._removeNodes=t}shouldLoadNode(e){if(Object(d["j"])(e))return!1;const t=this._index.nodeTraversalState(e);return!!this._isChosenMaxLOD(t)||!!t.isChosen&&this._childrenRequireLoading(e)}setLodGlobalDirty(){this._lodGlobalDirty=!0}get requiresLODGlobalHandling(){return null!=this._index&&!0===this._lodGlobalDirty}lodGlobalHandling(e){if(!this.requiresLODGlobalHandling)return!1;this._lodGlobalDirty=!1;const t=this.layerView.view.resourceController.memoryController.usedMemory,i=Math.max(0,Math.floor(10*(t-1)));$.clear(),this._lodGlobalHandling(this._index.rootNode,i,!1);const r=$.length;this._removeNodes($,e);const s=$.length<r;return 0!==$.length&&(this._lodGlobalDirty=!0),$.clear(),s}_lodGlobalHandling(e,t,i){if(Object(d["j"])(e))return!1;const r=e.index,s=this._index,n=this.layerView,a=s.nodeTraversalState(e),o=this._isChosenMaxLOD(a),c=n.isNodeLoaded(r),l=n.nodeCrossfadingEnabled;if(l&&c&&o){const t=!i&&this.hasNoVisibleChildren(e);n.fadeNode(r,H["a"].FadeIn,!t)}const u=c&&(!n.isNodeFullyFadedIn||n.isNodeFullyFadedIn(r));if(c&&(n.updateNodeState(r,o?I["g"].Leaf:I["g"].Hole),o))return u&&this._removeChildrenRecursive(e),u;const h=e.childCount>0;let b=h;if(h)for(let p=0;p<e.childCount;p++){const r=s.getChildIndex(e,p),n=s.getNode(r);Object(d["k"])(n)?s.isGeometryVisible(r)&&!this._lodGlobalHandling(n,t,i||u)&&this._isNodeInScaleBounds(n)&&(b=!1):s.isNodeVisible(r)&&(b=!1)}const f=c&&!o&&(b||$.length<t);f&&$.push(r),!l||f||!c||i||b||n.fadeNode(r,H["a"].FadeIn,!1);const g=!e.resources.hasFeatureData;return b||u&&!f||g}_removeChildrenRecursive(e){this._index.traverseChildren(e,e=>((this.layerView.isNodeLoaded(e.index)||this.layerView.isNodeReloading(e.index))&&$.push(e.index),!0))}hasNoVisibleChildren(e){let t=!0;return this._index.traverseChildren(e,e=>!(!t||!this._index.isNodeVisible(e.index))&&(!this.layerView.isNodeLoaded(e.index)||(t=!1,!1))),t}_childrenRequireLoading(e){let t=!1,i=!0;return this._index.traverseChildren(e,e=>{if(!i||!this._index.isNodeVisible(e.index))return!1;const r=this._index.nodeTraversalState(e);return this._isChosenMaxLOD(r)&&this._index.isGeometryVisible(e.index)&&(t=!0),!this.layerView.isNodeLoaded(e.index)||(i=!1,!1)}),i&&t}_isChosenMaxLOD(e){return e.isChosen&&(!e.nodeHasLOD||e.lodLevel===this._maxLodLevel)}}const $=new c["a"]({deallocator:null});var K=i("792b"),X=i("7ffa"),W=i("e041"),Y=i("2b13"),Z=i("ad64"),J=i("8752");class ee{constructor(e,t,i,r,s,n){if(this.streamDataController=t,this.logger=i,this.defaultGeometrySchema=r,this.requiredAttributes=s,this.options=n,this.logLayer=e,this.layerUrl=e.parsedUrl.path,this.geometryDefinitions=e.geometryDefinitions,e.materialDefinitions){const t=e.textureSetDefinitions;this.materialAndTextures=e.materialDefinitions.map(e=>Object(J["d"])(t,e))}}_load(e,t,i){return this.streamDataController.request(e,t,i)}_loadAttribute(e,t,i){const r=`${this.layerUrl}/nodes/${e.resources.attributes}/attributes/${t.key}/0`;return this._load(r,"binary",i).then(e=>Object(Z["d"])(t,e))}loadAttributes(e,t,i){return Object(u["j"])(t.map(t=>this._loadAttribute(e,t.attributeStorageInfo,i))).then(i=>{const r={};for(let s=0;s<t.length;++s)if(i[s].value)r[t[s].name]=i[s].value;else{if(Object(u["m"])(i[s].error))throw i[s].error;this.logger.error("#loadAttributes",this.logLayer,`Failed to load attributeData for '${t[s].name}' on node '${e.id}'`,i[s].error)}return r})}async loadNodeData(e,t){const i=null!=this.requiredAttributes&&e.resources.attributes?Object(K["d"])(this.loadAttributes(e,this.requiredAttributes,t)):null,{bufferDefinition:r,bufferIndex:s}=ne(this.geometryDefinitions,e),n=!!e.resources.geometry,a=n?Object(K["d"])(this._loadGeometry(e.resources.geometry,s,t)):null,o=e.resources.hasSharedResource?await this._loadShared(e,t):null,c=this.materialAndTextures&&e.resources.materialDefinition>=0?this.materialAndTextures[e.resources.materialDefinition]:null!=o?Object(J["e"])(o):null,l=c&&c.material,u=c&&c.textures,h=""+e.id,b=!n&&this.options.loadFeatureData,f=b?await this._loadFeatureData(h,t):null,g=b?ie(f):te(l),p=Object(d["j"])(g)&&re(f),m=null!=u&&u.length>0?Object(K["d"])(this.loadTextures(e,u,t)):null;let _=null,y=null;if(a){_=Object(K["a"])(await a);const e=se(this.defaultGeometrySchema,o);y=Object(Z["a"])(r,e)}const O=m?Object(K["a"])(await m):null,j=i?Object(K["a"])(await i):{},v=j?{attributeData:j,loadedAttributes:this.requiredAttributes}:null;return Object(d["k"])(g)?{geometryData:g,attributeDataInfo:v,geometryBuffer:_,geometryDescriptor:y,requiredTextures:u,textureData:O}:Object(d["k"])(p)?{pointData:p,attributeDataInfo:v,geometryBuffer:_,geometryDescriptor:y,requiredTextures:u,textureData:O}:Promise.reject()}static _addAbsoluteHrefTexture(e,t){const i=e.textureDefinitions;if(null!=i)for(const r of Object.keys(i))for(const e of i[r].images)Array.isArray(e.href)?e.hrefConcat=e.href.map(e=>Object(W["C"])(e,t)):e.hrefConcat=Object(W["C"])(e.href,t)}static _fixTextureEncodings(e){const t=e.textureDefinitions;if(null!=t)for(const i in t){const e=t[i];if(Array.isArray(e.encoding))for(let t=0;t<e.encoding.length;t++){const i=e.encoding[t];"data:"===i.substring(0,5)&&(e.encoding[t]=i.substring(5))}else{const t=e.encoding;"data:"===t.substring(0,5)&&(e.encoding=t.substring(5))}}}_loadShared(e,t){const i=`${this.layerUrl}/nodes/${e.resources.geometry}/shared`;return this._load(i,"json",t).then(e=>(ee._fixTextureEncodings(e),ee._addAbsoluteHrefTexture(e,i),e))}_loadTexture(e,t,i,r,s,n){let a=!1;return s===Y["a"].DDS_S3TC||s===Y["a"].KTX2||s===Y["a"].Basis?this._load(e,"binary",n).then(e=>({id:t,usage:i,data:e,encoding:s,downsampled:a})):this._load(e,"image",n).then(e=>{let n=e;const o=4096,d=2;if(r&&e.width*e.height>=o){const t=Math.ceil(e.width/d),i=Math.ceil(e.height/d),r=document.createElement("canvas");r.width=t,r.height=i,r.getContext("2d").drawImage(e,0,0,t,i),n=r,a=!0}return{id:t,usage:i,data:n,encoding:s,downsampled:a}})}loadTextures(e,t,i){const r=this.options.uncompressedTextureDownsamplingEnabled,s=this.options.textureUsageMask;return Promise.all(t.map(t=>{if(0==(t.usage&s))return null;const n=Object(J["g"])(t.encodings,this.options.textureEncodings);if(null==n)return this.logger.error("#loadTextures",this.logLayer,"No known encoding for texture found on node "+e.id),Promise.reject();const a=e.resources.texture||e.id,o=`${this.layerUrl}/nodes/${a}/textures/${n.name}`;return this._loadTexture(o,t.id,t.usage,r,n.encoding,i)}))}_loadFeatureData(e,t){const i=`${this.layerUrl}/nodes/${e}/features/0`;return this._load(i,"json",t)}_loadGeometry(e,t,i){const r=`${this.layerUrl}/nodes/${e}/geometries/${t}`;return this._load(r,"binary",i)}}function te(e){return{featureIds:[],geometries:[{type:"ArrayBufferView",params:{material:e}}],featureDataPosition:[0,0,0]}}function ie(e){for(const t of e.featureData){const e=t.geometries;if(null!=e)for(const i of e)return{featureIds:[t.id],featureDataPosition:t.position,geometries:[i]}}return null}function re(e){const t=new Array;for(const i of e.featureData)null!=i.position&&t.push({featureIds:[i.id],featureDataPosition:i.position,geometries:null});return t}function se(e,t){if(!e||!t||!t.materialDefinitions)return e;const i=Object.keys(t.materialDefinitions)[0];return!t.materialDefinitions[i].params.vertexRegions&&e.vertexAttributes.region&&delete(e=Object(X["a"])(e)).vertexAttributes.region,e}function ne(e,t){const i={bufferDefinition:null,bufferIndex:0};if(null==e||t.resources.geometryDefinition<0)return i;const r=t.resources.geometryDefinition>=0?e[t.resources.geometryDefinition].geometryBuffers:null;if(null==r)return i;for(let s=0;s<r.length;s++){const e=r[s];if(null==e.compressedAttributes)i.bufferIndex=s,i.bufferDefinition=r[s];else if("draco"===e.compressedAttributes.encoding&&!Object(a["a"])("disable-feature:i3s-draco"))return i.bufferIndex=s,i.bufferDefinition=e,i}return i}class ae{constructor(e,t){this.requester=e,this.apiKey=t,this.activeRequests=new Set}get busy(){return this.requester.busy}request(e,t,i){const r=new AbortController,s=Object(u["r"])(i,()=>r.abort()),n={signal:r.signal,query:{token:this.apiKey}},a=this.requester.request(e,t,n),o={response:a,abortController:r,abortHandle:s};return this.activeRequests.add(o),Object(u["c"])(a,()=>{var e;o.abortController=null,null==(e=o.abortHandle)||e.remove(),o.abortHandle=null,this.activeRequests.delete(o)}),a}cancelAll(){this.activeRequests.forEach(e=>{var t,i;null==(t=e.abortController)||t.abort(),e.abortController=null,null==(i=e.abortHandle)||i.remove()}),this.activeRequests.clear()}}var oe=i("0b2d"),de=i("7577"),ce=i("f694"),le=i("d359"),ue=i("f895"),he=i("2e0f"),be=i("0eb9"),fe=i("e9d6");const ge=1e5;class pe{constructor(e,t,i,r,s,n,a,o={}){this._indexSR=e,this._renderCoordsHelper=t,this.clippingArea=s,this._elevationProvider=n,this._options=o,this._frustum=Object(le["f"])(),this._useFrustumCulling=!1,this._poi=Object(oe["f"])(),this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmp1=Object(oe["f"])(),this._tmp2=Object(oe["f"])(),this._tmp3=Object(oe["f"])(),this._tmp0=Object(oe["f"])(),this._screenspaceErrorBias=o.screenspaceErrorBias||1,this._progressiveLoadFactor=o.progressiveLoadFactor||1,this.updateCamera(i,r),this.engineSR=this._renderCoordsHelper.spatialReference,this.updateElevationInfo(a),this._tmpPoint=Object(_["j"])(0,0,0,e)}updateElevationInfo(e){null!=e?(this._elevationContext=be["a"].fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(Object(fe["c"])(Object(fe["f"])(e,!1)))):this._elevationContext=null}updateCamera(e,t){this._useFrustumCulling=t,t&&Object(le["h"])(e.viewMatrix,e.projectionMatrix,this._frustum),this._screenSizeFactor=1/(e.perScreenPixelRatio/2),this._camPos=e.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this.clippingArea=e}getRenderMbs(e){const t=e.renderMbs;return t[3]<0&&(Object(de["c"])(t,e.mbs),this._elevationContext&&t[3]<ge&&(this._tmpPoint.x=t[0],this._tmpPoint.y=t[1],this._tmpPoint.z=t[2],t[2]=Object(he["f"])(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper)),Object(p["o"])(t,this._indexSR,t,this.engineSR)),t}getVisibilityObb(e){if(Object(d["k"])(e.visibilityObb))return e.visibilityObb;const t=e.serviceObb;return Object(d["j"])(t)||t.halfSize[0]<0?void 0:(e.serviceObbInRenderSR=this._computeRenderObb(t,e.serviceObbInRenderSR,e.mbs[3]),e.serviceObbInRenderSR)}_computeRenderObb(e,t,i){if(Object(d["j"])(t)&&(t=Object(S["e"])()),t.halfSize[0]<0){let r=0;this._elevationContext&&i<ge&&(this._tmpPoint.x=e.center[0],this._tmpPoint.y=e.center[1],this._tmpPoint.z=e.center[2],r=Object(he["f"])(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper)-e.center[2]),Object(N["w"])(e,this._indexSR,t,this.engineSR,r)}return t}isNodeVisible(e){const t=this.getRenderMbs(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getVisibilityObb(e);return Object(d["k"])(i)?Object(S["h"])(i,this._frustum):Object(le["m"])(this._frustum,Object(ue["n"])(t))}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObb;return Object(d["k"])(t)?Object(S["h"])(t,this._frustum):this.isNodeVisible(e)}_isMBSinClippingArea(e){return!!Object(d["j"])(this.clippingArea)||Object(N["t"])(this.clippingArea,e)!==N["a"].OUTSIDE}_screenSpaceDiameterMbs(e,t){const i=this.getRenderMbs(e),r=Math.sqrt(Object(w["n"])(i,this._camPos)),s=r-i[3];return this._updateMinMaxDistance(r),s<0?.5*Number.MAX_VALUE:t/s*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getRenderMbs(e)[3]}calcCameraDistanceToCenter(e){const t=this.getRenderMbs(e),i=Object(w["o"])(t,this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getRenderMbs(e),i=t[3],r=(Math.abs(t[0]*(t[0]-this._camPos[0])+t[1]*(t[1]-this._camPos[1])+t[2]*(t[2]-this._camPos[2]))/Object(w["r"])(t)+i)/Object(w["o"])(t,this._camPos);return Math.min(1,r)}hasLOD(e){return e.lodMetric!==I["b"].None}_getDistancePlanarMode(e,t){const i=e[0]-t[0],r=e[1]-t[1],s=e[2]-t[2],n=i*i+r*r,a=t[3];if(n<=a*a)return Math.abs(s);const o=Math.sqrt(n)-a;return Math.sqrt(s*s+o*o)}_getDistanceGlobeMode(e,t){const i=Object(w["r"])(t),r=Object(w["r"])(e)-i;Object(w["g"])(this._tmp0,e,Object(w["j"])(e,t)/Object(w["v"])(e));const s=Object(w["n"])(t,this._tmp0),n=t[3];if(s<=n*n)return Math.abs(r);{const s=Object(w["g"])(this._tmp0,t,1/i),a=i,o=n*n/2/a,d=Object(w["g"])(this._tmp1,s,a-o),c=e,l=Object(w["l"])(this._tmp2,c,d),u=Object(w["l"])(this._tmp2,l,Object(w["g"])(this._tmp3,s,Object(w["j"])(s,l))),h=Object(w["h"])(this._tmp2,d,Object(w["g"])(this._tmp2,u,n/Object(w["r"])(u)));let b=Object(w["o"])(c,h);if(r>=2e5){const e=Object(w["l"])(this._tmp1,c,h);let t=Object(w["j"])(e,s)/Object(w["r"])(e);t<.08&&(t=1e-4),b/=t}return b}}_getDistance(e,t){return this.engineSR===Object(ce["g"])(this.engineSR)?this._getDistanceGlobeMode(e,t):this._getDistancePlanarMode(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===I["b"].None)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case I["b"].ScreenSpaceRelative:{const i=this.getRenderMbs(e),r=this._getDistance(this._camPos,i),s=2*r/this._screenSizeFactor,n=r+i[3];return this._updateMinMaxDistance(n),e.maxError*t<=s}case I["b"].MaxScreenThreshold:{let i=this._screenSpaceDiameterMbs(e,e.mbs[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case I["b"].RemovedFeatureDiameter:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case I["b"].DistanceRangeFromDefaultCamera:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToPOI(e){const t=this.getRenderMbs(e);return Object(w["o"])(t,this._poi)-t[3]}distCameraToPOI(){return Object(w["o"])(this._camPos,this._poi)}}var me=i("4b49"),_e=i("2aa2"),ye=i("5e70");const Oe=o["a"].getLogger("esri.layers.graphics.controllers.I3SOnDemandController"),je=100,ve=2,xe=1e4,we=1e-4,Ce=1.2,Ie=500,Ne=1.5;let Se=class extends(Object(l["b"])(s["a"])){constructor(e){super(e),this.screenSizeFactor=0,this.featureTarget=5e4,this.fixedFeatureTarget=!1,this.updating=!0,this.updatingProgress=1,this.leavesReached=!1,this.scaleVisibilityEnabled=!0,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new c["a"]({deallocator:null}),this._loadedNodeScales=new Map,this._modificationsNodeFilteringArray=new c["a"],this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._handles=new n["a"],this._idleQueue=new y["a"],this._elevationUpdateNodes=new c["a"]({deallocator:null}),this._errorCount=0}get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(this.layer.version.major<2||!Object(a["a"])("enable-feature:point-base-layer"))}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(_e["a"].I3S_INDEX);return new ae(e,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(_e["a"].I3S_DATA);return new ae(e,this.layer.apiKey)}get crsVertex(){return Object(N["s"])(this.layer)}get crsIndex(){return Object(N["q"])(this.layer)}get rootNodeVisible(){if(Object(d["k"])(this._index)){const e=this._index.rootNode;if(Object(d["k"])(e))return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}initialize(){this._disableMemCache=!this.layerView.loadCachedGPUData||!this.layerView.addCachedGPUData,this._lodHandling=new Q(this.layerView);const e=this.layerView.i3slayer;this.layer=e,this._defaultGeometrySchema=e.store.defaultGeometrySchema,this.disableIDBCache=Object(a["a"])("disable-feature:idb-cache"),"fields"in e&&(this._fields=e.fields,this._attributeStorageInfo=e.attributeStorageInfo),this.addResolvingPromise(Promise.all([this.layer.indexInfo,this.layer.when(),this.layerView.when()]).then(([t])=>{var i;if(this.destroyed||!this.layerView||this.layerView.destroyed)return;const r=this.layerView.view;this._setClippingArea(r.clippingArea);const s=this.layerView.view.resourceController;this._handles.add([Object(h["e"])(()=>{var e,t;return null==r||null==(e=r.pointsOfInterest)||null==(t=e.focus)?void 0:t.renderLocation},e=>this._pointOfInterestChanged(e),h["a"]),s.memoryController.events.on("quality-changed",()=>this._setCameraDirty()),Object(h["e"])(()=>{var e;return null==(e=this.layerView)?void 0:e.suspended},e=>{const t=e?()=>this._updateViewData():()=>this._updateIdleState(!0),i=e?()=>{}:()=>this._updateIdleState(!1);this._idleStateCallbacks?(e&&this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=t,this._idleStateCallbacks.idleEnd=i):this._idleStateCallbacks=s.scheduler.registerIdleStateCallbacks(t,i)},h["a"]),x(this.layerView.view.resourceController.scheduler,{update:(e,t)=>this._frame(e,t),needsUpdate:()=>this.updating}),this.watch("uncompressedTextureDownsamplingEnabled",()=>this.restartNodeLoading()),this.watch(["featureTarget","fixedFeatureTarget"],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),r.state.watch("contentCamera",()=>this._setCameraDirty()),this.layer.watch("elevationInfo",()=>this._elevationInfoChanged()),this.layer.watch("effectiveScaleRange",()=>this._scaleBoundsChanged()),this.layerView.watch("lodFactor",()=>this._setCameraDirty()),this.layerView.watch("availableFields?",()=>this._requiredFieldsChange()),this.layerView.watch("holeFilling",e=>Object(d["k"])(this._index)&&(this._index.holeFilling=e))]),this._updateScaleHandles(),this._viewportQueries=new pe(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,r.elevationProvider,this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this.lod,angleDependentLoD:this.lod<.5}),this._index=new E(e,t,this.indexStreamController,this._viewportQueries,Oe,this.layerView.holeFilling,e=>this.layerView.isNodeLoaded(e),e=>this.layerView.isNodeReloading(e),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,I["g"].Leaf),e=>this._needsUpdate(e),()=>!this.indexStreamController.busy,e=>this.layerView.computeVisibilityObb?this.layerView.computeVisibilityObb(e):null,null!=(i=this.layerView)&&i.computeNodeFiltering?e=>this.layerView.computeNodeFiltering(e):void 0),this._index.imModificationsChanged(!!this.layerView.hasModifications),this._startNodeLoading()})),this._tmpPoint=Object(_["j"])(0,0,0,this.crsIndex)}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;Object(d["k"])(t)&&i&&i.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);Object(d["k"])(i)&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._handles.destroy(),this._nodeLoader=null,De.prune(),Object(d["k"])(Ee)&&(Ee.hide(),Ee=null)}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const r=Me(e,i),s=Me(t,i);return r>=0&&s>=0?{index:r,name:t[s].name,field:t[s],attributeStorageInfo:e[r]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();Fe(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=Object(m["l"])();Object(me["b"])(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){Object(d["k"])(this._viewportQueries)&&(this._viewportQueries.setPointOfInterest(e),Object(d["k"])(this._index)&&(this._index.progressiveLoadPenalty=Ae.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),Object(d["k"])(this._viewportQueries)&&Object(d["k"])(this._index)&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this.notifyChange("rootNodeVisible"),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}updateElevationChanged(e,t){const i=this._index;if(Object(d["j"])(i))return;const r=i.rootNode;if(Object(d["j"])(r))return;const s=this._elevationUpdateNodes;s.clear(),Object(N["m"])(e,t,r,this.crsIndex,i,e=>s.push(e.index)),s.forAll(e=>{i.invalidateBoundingVolumeCache(e),e===r.index&&this.notifyChange("rootNodeVisible")}),s.length&&this.restartNodeLoading()}getParentIndex(e){return Object(d["k"])(this._index)&&this._index.getParentIndex(e)}_elevationInfoChanged(){Object(d["k"])(this._index)&&this._index.updateElevationInfo(this.layer.elevationInfo),this._setCameraDirty()}_updateScaleHandles(){const e="scale-bounds";this._handles.remove(e),this.areScaleBoundsActive&&this._handles.add(this.layerView.view.basemapTerrain.on("scale-change",e=>this._scaleUpdateHandler(e)),e)}_scaleBoundsChanged(){this.areScaleBoundsActive||this._loadedNodeScales.clear(),this._updateScaleHandles(),this._setCameraDirty()}_scaleUpdateHandler(e){this._updateScaleInBoundingRect(e.extent,e.spatialReference),this._setCameraDirty()}_updateScaleInBoundingRect(e,t){const i=this._index;if(Object(d["j"])(i))return;const r=i.rootNode;!Object(d["j"])(r)&&Object(p["n"])(e,t,Pe,this.crsIndex)&&this._loadedNodeScales.forEach((e,t)=>{const r=i.getNode(t);Object(d["k"])(r)&&Object(m["y"])(Pe,r.mbs)&&this._loadedNodeScales.set(t,this._computeScale(r))})}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateUpdating()}schedule(e,t){return this._idleQueue.push(e,t)}reschedule(e,t){return this._idleQueue.unshift(e,t)}get isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get areScaleBoundsActive(){const{minScale:e,maxScale:t}=Object(ye["a"])(this.layer);return this.scaleVisibilityEnabled&&(e>0||t>0)}get unloadedMemoryEstimate(){return Object(d["j"])(this._index)||this.layerView.suspended?0:this._index.getUnloadedMemoryEstimate()*this.lodDropFactor}get indexDepth(){return Object(d["k"])(this._index)?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData||(this._disableMemCache=!0),this._disableMemCache=e}_frame(e,t){return this.layerView.suspended?(this._updateViewData(),this._evaluateUpdating(),-1/0):!this.layerView.visible||Object(d["j"])(this._index)?-1/0:(this._processLogError(e,t),this._index.getPriority())}_processLogError(e,t){try{this._process(e,t)}catch(i){this._errorCount<50?Oe.error("Error during processing: "+i):50===this._errorCount&&Oe.error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null==this._nodeLoader||Object(d["j"])(this._index)||(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this.isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this.isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.getIndexLoading(),t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateUpdating())}_processIndex(e){if(Object(d["j"])(this._index))return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update([...this._loadingNodes.keys()],e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading()||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(Object(d["j"])(this._index)||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||Object(d["j"])(this._index)||Object(d["j"])(this._viewportQueries))return;const e=!this._index.isLoading(),t=this.featureTarget*this.baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.getIndexMissing()>Ie){if(this._featureLOD<=we)return;this._featureLOD/=Ne,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=xe||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const r=this.lod,s=this._index.checkFeatureTarget(t,r);s!==r&&(this._featureLOD=s/this.baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*Ce||e&&i.estimate>t))return;if(this._featureLOD<=we)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(xe,Math.max(we,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this.lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(Object(d["j"])(t))return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let r=t.getParent(i);Object(d["k"])(r)&&!this.layerView.isNodeLoaded(r.index)&&this._isNodeInScaleBounds(r);r=t.getParent(r.index))if(this._enableFromGPUCache(r,I["g"].Hole)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(Object(d["j"])(this._index))return!1;let i=(this._isIdle?je:ve)-this._loadingNodes.size;const r=this._index.updates;for(r.cancel.forEach(this._cancelNode,this),r.cancel=[];r.remove.length>0&&!e.done;)this.layerView.removeNode(r.remove.pop()),e.madeProgress();for(;r.update.length>0&&!e.done;){const t=this._index.getNode(r.update.pop());Object(d["k"])(t)&&(this._updateLoadedNode(t),e.madeProgress())}for(;r.add.length>0&&!e.done&&i>0;){--i;const s=this._index.getNode(r.add.back());if(Object(d["j"])(s)||s.cacheState!==I["a"].Cached&&!this._hasNodeLoadToken(t))break;r.add.pop(),this._loadNode(s),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=ve)&&this._downloadingCount<_e["c"]&&!this.dataStreamController.busy}_evaluateUpdating(){let e=!1,t=0;if(this.layerView.suspended)e=this._cameraDirty,t=e?0:1;else{const i=(Object(d["k"])(this._index)?this._index.getIndexMissing():0)+3*(Object(d["k"])(this._index)?this._index.updates.add.length:0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.running||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}this.updating=e,this.updatingProgress=t}_updateViewData(){if(!this._cameraDirty||Object(d["j"])(this._index)||Object(d["j"])(this._viewportQueries))return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this.screenSizeFactor=1/(t.perScreenPixelRatio/2),this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this.lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=Ae.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.resourceController.memoryController.memoryFactor<1?1:this.layerView.progressiveLoadFactor}get lod(){return this._featureLOD*this.baseLOD}get baseLOD(){const e=this.layerView.lodFactor,t=this.layerView.view.resourceController.memoryController.memoryFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*t}get lodDropFactor(){if(this.fixedFeatureTarget)return 1;const e=this.layerView.view.resourceController.memoryController;return(Math.min(e.memoryFactor,.5)-e.minQuality)/(.5-e.minQuality)}isGeometryVisible(e){return Object(d["k"])(this._index)&&this._index.isGeometryVisible(e.index)}updateVisibility(e){Object(d["k"])(this._index)&&this._index.invalidateNodeVisibilityCache(e)}updateBoundingVolume(e){Object(d["k"])(this._index)&&this._index.invalidateBoundingVolumeCache(e)}invalidateGeometryVisibility(e){Object(d["k"])(this._index)&&this._index.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){Object(d["k"])(this._index)&&this._index.invalidateVisibilityObbs()}modificationsChanged(){Object(d["k"])(this._index)&&this._index.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&!(!Object(d["k"])(this._index)||!this._index.isGeometryVisible(e.index))&&this._isNodeInScaleBounds(e)}_shouldDropNode(e){if(Object(d["j"])(this._viewportQueries))return!1;const t=this.lodDropFactor;return!(t>=1||!this._lodHandling.hasNoVisibleChildren(e))&&Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||Object(d["j"])(e)||Object(d["j"])(this._viewportQueries))return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,uncompressedTextureDownsamplingEnabled:this.layerView.uncompressedTextureDownsamplingEnabled,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new ee(this.layer,this.dataStreamController,Oe,this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading(e=>this._isNodeInScaleBounds(e),(e,t)=>this._removeNodes(e,t,Te.fadeout),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateUpdating()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateUpdating())}_removeInvisibleNodes(e){const t=this._index;if(Object(d["j"])(t)||Object(d["j"])(this._viewportQueries))return!1;De.clear(),this.layerView.getLoadedNodeIndices(De);const i=0===this._viewportQueries.maxDistance,r=i?()=>!1:e=>this._shouldDropNode(e);return De.filterInPlace(e=>{const i=t.getNode(e);return Object(d["j"])(i)||!t.isGeometryVisible(e)||r(i)||!this._isNodeInScaleBounds(i)}),De.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(De,e,Te.pop),!(i&&this.lodDropFactor<1)&&(0===De.length||(De.clear(),!1))}markNodeToRemove(e){De.push(e)}removeMarkedNodes(){this._removeNodes(De,O["e"],Te.pop)}_removeNodes(e,t,i){const r=e.length;if(0!==r&&!t.done){for(Object(d["k"])(this._index)&&this._index.requestUpdate();e.length>0&&!t.done;){const r=e.pop(),s=this._index;i===Te.fadeout&&this.layerView.nodeFadeoutEnabled&&Object(d["k"])(s)&&s.isGeometryVisible(r)?this.layerView.fadeNode(r,H["a"].FadeOut,!0):this.layerView.removeNode(r),t.madeProgress()}if(this._loadedNodeScales.size>0)for(let t=e.length;t<r;t++){const i=e.data[t];this._loadedNodeScales.delete(i)}}}_needsUpdate(e){if(!e.resources.hasFeatureData||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}_updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),(Fe(this.layerView.getLoadedAttributes(e.index),this._requiredAttributes)?Promise.resolve(this.layerView.getAttributeData(e.index)):this._nodeLoader.loadAttributes(e,this._requiredAttributes,t.signal)).then(i=>this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:i},t.signal),t.signal)).catch(i=>{if(!Object(u["m"])(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}).catch(()=>{}).then(()=>{this._updatingNodes.delete(e.index),this._evaluateUpdating()}),this._evaluateUpdating()}_loadNode(e){if(this._loadingNodes.has(e.index))return void Oe.error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateUpdating(),this._loadAndAddNode(e,t.signal).then(i=>{i&&Object(d["k"])(this._index)&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(e=>{if(!Object(u["m"])(e))throw e}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateUpdating()})}_loadAndAddNode(e,t){return e.cacheState===I["a"].Uncached?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=I["a"].Uncached,!0)).catch(t=>!Object(u["m"])(t)&&(e.cacheState=I["a"].Uncached,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||Object(d["j"])(this._index))return!1;if(t===I["g"].Hole&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e);return Object(d["k"])(t)&&Object(d["k"])(t.attributeInfo)&&Fe(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){Object(d["k"])(this._index)&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}_loadCached(e,t){if(this._enableFromGPUCache(e,I["g"].Leaf))return Promise.resolve(!0);const i=this.layerView;return!this.disableIDBCache&&i.loadCachedNodeData&&i.addCachedNodeData?this.schedule(()=>i.loadCachedNodeData(e,t,(t,i)=>this._nodeLoader.loadTextures(e,t,i)),t).then(r=>{if(Object(d["j"])(r))return!1;const s=this._requiredAttributes;return this.reschedule(()=>this._nodeLoader.loadAttributes(e,s,t),t).then(n=>this.reschedule(()=>i.addCachedNodeData(e,r,{loadedAttributes:s,attributeData:n},t),t)).then(()=>(this._nodeAdded(),!0))}):Promise.resolve(!1)}_loadUncached(e,t){return this._downloadingCount++,this._nodeLoader.loadNodeData(e,t).catch(e=>{throw this._downloadingCount--,e}).then(i=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(e,i,t),t))).then(()=>{this._nodeAdded(),e.cacheState=I["a"].Cached}).catch(t=>{if(!Object(u["m"])(t))throw Oe.error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,Object(d["k"])(this._index)&&this._index.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateUpdating(),e&&this._index&&Object(d["k"])(this._index)&&this._index.resetFailedNodes())}_getScale(e){if(this._loadedNodeScales.has(e.index))return this._loadedNodeScales.get(e.index);const t=this._computeScale(e);return this.layerView.isNodeLoaded(e.index)&&this._loadedNodeScales.set(e.index,t),t}_computeScale(e){this._tmpPoint.x=e.mbs[0],this._tmpPoint.y=e.mbs[1],this._tmpPoint.z=e.mbs[2];const t=e.mbs[3];return this.layerView.view.basemapTerrain.getSphereScale(this._tmpPoint,t)}_isNodeInScaleBounds(e){if(!this.areScaleBoundsActive)return!0;const t=this._getScale(e),{minScale:i,maxScale:r}=Object(ye["a"])(this.layer);return Object(ye["e"])(t,i,r)}updateStats(e){e.index=Object(d["k"])(this._index)?this._index.size:0,this.isGraphics3D&&(e.detail=this._featureLOD,e.target=this.featureTarget*this.baseLOD),Object(d["k"])(this._index)&&this._index.updateStats(e)}get test(){const e=this;return{index:this._index,set disableUpdates(t){e._updatesDisabled=t,t?e.cancelNodeLoading():e.requestUpdate()},set disableIDBCache(t){e.disableIDBCache=t},set ignoreServiceObb(t){Object(d["k"])(e._index)&&(e._index.ignoreServiceObb=t)},shouldLoadNode:t=>e._shouldLoadNode(t)}}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating(),Object(d["k"])(this._index)&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;Object(d["k"])(t)&&t.layerFilterChanged(e),this.requestUpdate()}};Object(r["a"])([Object(b["b"])({readOnly:!0})],Se.prototype,"isMeshPyramid",null),Object(r["a"])([Object(b["b"])({readOnly:!0})],Se.prototype,"isGraphics3D",null),Object(r["a"])([Object(b["b"])({readOnly:!0})],Se.prototype,"useMaximumNumberOfFeatures",null),Object(r["a"])([Object(b["b"])({readOnly:!0})],Se.prototype,"indexStreamController",null),Object(r["a"])([Object(b["b"])({readOnly:!0})],Se.prototype,"dataStreamController",null),Object(r["a"])([Object(b["b"])({readOnly:!0})],Se.prototype,"crsVertex",null),Object(r["a"])([Object(b["b"])({readOnly:!0})],Se.prototype,"crsIndex",null),Object(r["a"])([Object(b["b"])()],Se.prototype,"screenSizeFactor",void 0),Object(r["a"])([Object(b["b"])()],Se.prototype,"featureTarget",void 0),Object(r["a"])([Object(b["b"])()],Se.prototype,"fixedFeatureTarget",void 0),Object(r["a"])([Object(b["b"])()],Se.prototype,"layerView",void 0),Object(r["a"])([Object(b["b"])()],Se.prototype,"layer",void 0),Object(r["a"])([Object(b["b"])({})],Se.prototype,"updating",void 0),Object(r["a"])([Object(b["b"])({})],Se.prototype,"updatingProgress",void 0),Object(r["a"])([Object(b["b"])({readOnly:!0})],Se.prototype,"leavesReached",void 0),Object(r["a"])([Object(b["b"])({constructOnly:!0})],Se.prototype,"scaleVisibilityEnabled",void 0),Object(r["a"])([Object(b["b"])({readOnly:!0,dependsOn:[]})],Se.prototype,"rootNodeVisible",null),Se=Object(r["a"])([Object(g["a"])("esri.layers.graphics.controllers.I3SOnDemandController")],Se);const De=new c["a"]({deallocator:null});let Ee;function Fe(e,t){return Object(d["k"])(e)&&e.length===t.length&&e.every(e=>Me(t,e.name)>=0)}function Me(e,t){const i=t.toLowerCase();for(let r=0;r<e.length;r++)if(e[r].name.toLowerCase()===i)return r;return-1}const Ae={factorIM:.2,factor3dObject:.05,distancePenalty:10},Pe=Object(m["l"])();var Te;!function(e){e[e.pop=0]="pop",e[e.fadeout=1]="fadeout"}(Te||(Te={}));const Le=Se},"673a":function(e,t,i){"use strict";var r;i.d(t,"a",(function(){return r})),function(e){e[e.FadeIn=0]="FadeIn",e[e.FadeOut=1]="FadeOut"}(r||(r={}))},"82de":function(e,t,i){"use strict";i.d(t,"a",(function(){return o})),i.d(t,"b",(function(){return l}));var r=i("afe1"),s=i("0b2d"),n=i("8188"),a=i("f694");function o(e,t,i,s){const a=l(e,t,i),o=Object(r["d"])();return Object(n["d"])(i,a,o,s),o}const d=1,c=5-d;function l(e,t,i){const r=Object(s["f"])(),n=e[3],o=2**(Math.ceil(Math.log(n)*Math.LOG2E/c)*c+d);if(i.isGeographic){const t=o/Object(a["e"])(i).radius*180/Math.PI,s=Math.round(e[1]/t),n=Math.max(-90,Math.min(90,s*t)),d=t/Math.cos((Math.abs(n)-t/2)/180*Math.PI),c=Math.round(e[0]/d)*d;r[0]=c,r[1]=n}else{const t=Math.round(e[0]/o),i=Math.round(e[1]/o);r[0]=t*o,r[1]=i*o}const l=e[2]+t,u=Math.round(l/o);return r[2]=u*o,r}},8752:function(e,t,i){"use strict";i.d(t,"a",(function(){return w})),i.d(t,"b",(function(){return j})),i.d(t,"c",(function(){return O})),i.d(t,"d",(function(){return g})),i.d(t,"e",(function(){return y})),i.d(t,"f",(function(){return C})),i.d(t,"g",(function(){return I}));var r=i("c120"),s=i("38a4"),n=i("b2b2"),a=i("2b13"),o=i("f4cc");class d{constructor(e,t){this._textureRep=e,this._disposed=!1;const i=this._textureRep.acquire(t);Object(o["o"])(i)?(i.then(e=>{this._disposed?Object(n["r"])(e):this._textureRef=e}),this.loadPromise=i):this._textureRef=i}dispose(){this._textureRef=Object(n["r"])(this._textureRef),this._disposed=!0}bind(e,t,i){const r=Object(n["k"])(this._textureRef)?this._textureRef.glTexture:null;Object(n["k"])(r)&&(e.bindTexture(r,t),e.setUniform2f(i,r.descriptor.width,r.descriptor.height))}}var c=i("a7d7"),l=i("ebd5"),u=i("7c7f"),h=i("b7c2"),b=i("1e2c"),f=i("d17d");function g(e,t){const i=new Map,r=(e,t)=>{if(Object(n["j"])(e))return-1;if(i.has(e.id)){const r=i.get(e.id);return r.usage|=t,r.id}const r=i.size;return i.set(e.id,{id:r,usage:t}),r},s=t.pbrMetallicRoughness,o=s&&s.baseColorFactor,d=t.emissiveFactor,l=null==t.normalTexture&&null==t.emissiveTexture&&null==t.occlusionTexture&&(!s||null==s.metallicRoughnessTexture&&1===s.roughnessFactor&&(1===s.metallicFactor||0===s.metallicFactor)),u=l?c["b"][0]:s?s.metallicFactor:1,b=l?c["b"][1]:s?s.roughnessFactor:1,f="mask"===t.alphaMode?a["b"].Color|a["b"].AlphaMask:a["b"].Color,g={baseColorFactor:o?[o[0],o[1],o[2],o[3]]:[1,1,1,1],baseColorTextureId:r(s&&s.baseColorTexture,f),metallicRoughnessTextureId:r(s&&s.metallicRoughnessTexture,a["b"].MetallicRoughness),metallicFactor:u,roughnessFactor:b},_={alphaMode:t.alphaMode,alphaCutoff:t.alphaCutoff,doubleSided:t.doubleSided,cullFace:"none"===t.cullFace?h["c"].None:"back"===t.cullFace?h["c"].Back:"front"===t.cullFace?h["c"].Front:void 0,normalTextureId:r(t.normalTexture,a["b"].Normal),emissiveTextureId:r(t.emissiveTexture,a["b"].Emissive),occlusionTextureId:r(t.occlusionTexture,a["b"].Occlusion),emissiveFactor:d?[d[0],d[1],d[2]]:[0,0,0],metallicRoughness:g,wrapTextures:!1,hasParametersFromSource:l},y=[];return i.forEach(({usage:t},i)=>{const r=Object(n["k"])(e)&&e[i]&&e[i].formats,s=r?p(r.map(({name:e,format:t})=>({name:e,encoding:m[t]}))):[];y.push({id:i,usage:t,encodings:s})}),{material:_,textures:y}}function p(e){return e.sort((e,t)=>e.encoding-t.encoding)}const m={ktx2:a["a"].KTX2,basis:a["a"].Basis,dds:a["a"].DDS_S3TC,png:a["a"].PNG,jpg:a["a"].JPG,"ktx-etc2":a["a"].KTX_ETC2},_={[b["a"].KTX2_ENCODING]:a["a"].Basis,[b["a"].BASIS_ENCODING]:a["a"].Basis,[b["a"].DDS_ENCODING]:a["a"].DDS_S3TC,"image/png":a["a"].PNG,"image/jpg":a["a"].JPG,"image/jpeg":a["a"].JPG,"image/ktx":a["a"].KTX_ETC2};function y(e){const t=e&&e.materialDefinitions?Object.keys(e.materialDefinitions)[0]:null,i=e&&e.textureDefinitions?Object.keys(e.textureDefinitions)[0]:null,r=t&&e.materialDefinitions[t],n=i&&e.textureDefinitions[i],o=O();if(null!=r){const e=r.params;e.diffuse&&(o.metallicRoughness.baseColorFactor=[e.diffuse[0],e.diffuse[1],e.diffuse[2],1]),null!=e.doubleSided&&(o.doubleSided=e.doubleSided,o.cullFace=e.doubleSided?h["c"].None:h["c"].Back),"none"!==e.cullFace&&"front"!==e.cullFace&&"back"!==e.cullFace||(o.cullFace="none"===e.cullFace?h["c"].None:"back"===e.cullFace?h["c"].Back:h["c"].Front),e.transparency&&(o.metallicRoughness.baseColorFactor[3]=Object(s["f"])(1-e.transparency,0,1)),(e.useVertexColorAlpha||o.metallicRoughness.baseColorFactor[3]<1)&&(o.alphaMode="blend")}const d=[];if(null!=n){const e=0;!n.wrap||"repeat"!==n.wrap[0]&&"repeat"!==n.wrap[1]||(o.wrapTextures=!0);let t=a["b"].Color;"rgba"===n.channels&&(o.alphaMode="blend",t|=a["b"].AlphaMask);const i=n.images.length-1,r=n.images[i],s=e=>e&&e.split("/").pop(),c=Array.isArray(n.encoding)?p(n.encoding.map((e,t)=>({name:s(r.href[t]),encoding:_[e]||0}))):[{name:s(r.href),encoding:_[n.encoding]||0}];d.push({id:e,usage:t,encodings:c}),o.metallicRoughness.baseColorTextureId=e}return{material:o,textures:d}}const O=()=>({alphaMode:"opaque",alphaCutoff:l["b"],doubleSided:!0,cullFace:h["c"].None,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[.8,.8,.8,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6},wrapTextures:!1,hasParametersFromSource:!0});function j(e,t,i,r){if(Object(n["j"])(e)||null==e.data)return null;const o=e.data,d=!(o instanceof HTMLImageElement)||Object(s["k"])(o.width)&&Object(s["k"])(o.height),c=r.renderingContext.parameters.maxMaxAnisotropy,l=i&&!r.capabilities.shaderTextureLOD?1:c,u=d&&!e.downsampled&&l>1,h=i||!t.wrapTextures?v:x,f=S(e.encoding),g=e.usage&a["b"].Color?"opaque"===t.alphaMode?3:4:3;return new b["a"](o,{mipmap:u,maxAnisotropy:l,encoding:f,wrap:h,components:g,noUnpackFlip:!0})}const v={s:f["B"].CLAMP_TO_EDGE,t:f["B"].CLAMP_TO_EDGE},x={s:f["B"].REPEAT,t:f["B"].REPEAT};function w(e,t,i,r,o,c){const b=c.rendererTextureUsage,f=e=>N(r,i,e&b),g=t.metallicRoughness.baseColorFactor,p=Object(s["f"])(t.metallicRoughness.baseColorFactor[3],0,1);e.baseColor=[g[0],g[1],g[2],p],e.hasParametersFromSource=!!t.hasParametersFromSource,e.usePBR=c.usePBR,e.mrrFactors=[t.metallicRoughness.metallicFactor,t.metallicRoughness.roughnessFactor,t.hasParametersFromSource?.2:.5],e.emissiveFactor=t.emissiveFactor,e.isIntegratedMesh=c.isIntegratedMesh,e.alphaCutoff="mask"===t.alphaMode?t.alphaCutoff:l["b"],e.alphaDiscardMode="opaque"===t.alphaMode?h["a"].Opaque:"mask"===t.alphaMode?h["a"].Mask:h["a"].MaskBlend;const m=[],_=f(a["b"].Color|a["b"].AlphaMask);Object(n["k"])(_)&&(e.baseColorTexture=new d(o,_),m.push(e.baseColorTexture.loadPromise));const y=f(a["b"].MetallicRoughness);Object(n["k"])(y)&&(e.metallicRoughnessTexture=new d(o,y),m.push(e.metallicRoughnessTexture.loadPromise));const O=f(a["b"].Emissive);Object(n["k"])(O)&&(e.emissionTexture=new d(o,O),m.push(e.emissionTexture.loadPromise));const j=f(a["b"].Occlusion);Object(n["k"])(j)&&(e.occlusionTexture=new d(o,j),m.push(e.occlusionTexture.loadPromise));const v=f(a["b"].Normal);return Object(n["k"])(v)&&(e.normalTexture=new d(o,v),m.push(e.normalTexture.loadPromise)),e.commonMaterialParameters.slicePlaneEnabled=c.slicePlaneEnabled,e.commonMaterialParameters.doubleSided=t.doubleSided,e.commonMaterialParameters.cullFace=t.cullFace,e.ellipsoidMode=Object(u["b"])(c.viewSpatialReference),Promise.all(m)}function C(e){const t=!!e.compressedTextureS3TC,i=!!e.compressedTextureETC,s=Object(r["a"])("disable-feature:i3s-basis")?0:a["a"].Basis|a["a"].KTX2,n=a["a"].JPG|a["a"].PNG,o=s|a["a"].DDS_S3TC;return n|(t?o:0)|(i?s:0)}function I(e,t){return e.find(e=>0!=(e.encoding&t))}function N(e,t,i){if(Object(n["j"])(e)||i===a["b"].None)return null;for(let r=0;r<e.length;r++){const s=e[r];if(Object(n["k"])(s)&&0!=(s.usage&i)){const e=t[r];return Object(n["k"])(e)?e.id:null}}return null}function S(e){switch(e){case a["a"].KTX2:return b["a"].KTX2_ENCODING;case a["a"].Basis:return b["a"].BASIS_ENCODING;case a["a"].DDS_S3TC:return b["a"].DDS_ENCODING;case a["a"].PNG:return"image/png";case a["a"].JPG:return"image/jpeg";case a["a"].KTX_ETC2:return"image/ktx";default:return""}}},ad64:function(e,t,i){"use strict";i.d(t,"a",(function(){return _})),i.d(t,"b",(function(){return m})),i.d(t,"c",(function(){return h})),i.d(t,"d",(function(){return v}));var r=i("ce50"),s=i("7ffa"),n=i("e92d"),a=i("d207"),o=i("b7bd");const d=n["a"].getLogger("esri.views.3d.layers.i3s.I3SBinaryReader");function c(e,t,i){let s="",n=0;for(;n<i;){const a=e[t+n];if(a<128)s+=String.fromCharCode(a),n++;else if(a>=192&&a<224){if(n+1>=i)throw new r["a"]("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const o=(31&a)<<6|63&e[t+n+1];s+=String.fromCharCode(o),n+=2}else if(a>=224&&a<240){if(n+2>=i)throw new r["a"]("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const o=(15&a)<<12|(63&e[t+n+1])<<6|63&e[t+n+2];s+=String.fromCharCode(o),n+=3}else{if(!(a>=240&&a<248))throw new r["a"]("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(n+3>=i)throw new r["a"]("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const o=(7&a)<<18|(63&e[t+n+1])<<12|(63&e[t+n+2])<<6|63&e[t+n+3];if(o>=65536){const e=55296+(o-65536>>10),t=56320+(1023&o);s+=String.fromCharCode(e,t)}else s+=String.fromCharCode(o);n+=4}}}return s}function l(e,t){const i={byteOffset:0,byteCount:0,fields:Object.create(null)};let r=0;for(let s=0;s<t.length;s++){const n=t[s],a=n.valueType||n.type,o=w[a];i.fields[n.property]=o(e,r),r+=x[a].BYTES_PER_ELEMENT}return i.byteCount=r,i}function u(e,t,i){const s=[];let n,a,o=0;for(a=0;a<e;a+=1){if(n=t[a],n>0){if(s.push(c(i,o,n-1)),0!==i[o+n-1])throw new r["a"]("string-array-error","Invalid string array: missing null termination.")}else s.push(null);o+=n}return s}function h(e,t){return new(0,x[t.valueType])(e,t.byteOffset,t.count*t.valuesPerElement)}function b(e,t){return new Uint8Array(e,t.byteOffset,t.byteCount)}function f(e,t,i){const n=null!=t.header?l(e,t.header):{byteOffset:0,byteCount:0,fields:{count:i}},a={header:n,byteOffset:n.byteCount,byteCount:0,entries:Object.create(null)};let o=n.byteCount;for(let d=0;d<t.ordering.length;d++){const e=t.ordering[d],i=Object(s["a"])(t[e]);if(i.count=n.fields.count,"String"===i.valueType){if(i.byteOffset=o,i.byteCount=n.fields[e+"ByteCount"],"UTF-8"!==i.encoding)throw new r["a"]("unsupported-encoding","Unsupported String encoding.",{encoding:i.encoding})}else{if(!C(i.valueType))throw new r["a"]("unsupported-value-type","Unsupported binary valueType",{valueType:i.valueType});{const e=I(i.valueType);o+=o%e!=0?e-o%e:0,i.byteOffset=o,i.byteCount=e*i.valuesPerElement*i.count}}o+=i.byteCount,a.entries[e]=i}return a.byteCount=o-a.byteOffset,a}function g(e,t,i){if(t!==e&&d.error(`Invalid ${i} buffer size\n expected: ${e}, actual: ${t})`),t<e)throw new r["a"]("buffer-too-small","Binary buffer is too small",{expectedSize:e,actualSize:t})}function p(e){return{isDraco:!1,isLegacy:!1,color:null!=e.color,normal:null!=e.normal,uv0:null!=e.uv0,uvRegion:null!=e.uvRegion,featureIndex:null!=e.faceRange&&null!=e.featureId}}function m(e,t){const i=l(e,t&&t.header);let r=i.byteCount;const s={isDraco:!1,header:i,byteOffset:i.byteCount,byteCount:0,vertexAttributes:{}},n=i.fields,a=null!=n.vertexCount?n.vertexCount:n.count;for(const c of t.ordering){if(!t.vertexAttributes[c])continue;const e={...t.vertexAttributes[c],byteOffset:r,count:a},i=j[c]?j[c]:"_"+c;s.vertexAttributes[i]=e,r+=I(e.valueType)*e.valuesPerElement*a}const o=n.faceCount;if(t.faces&&o){s.faces={};for(const e of t.ordering){if(!t.faces[e])continue;const i={...t.faces[e],byteOffset:r,count:o};s.faces[e]=i,r+=I(i.valueType)*i.valuesPerElement*o}}const d=n.featureCount;if(t.featureAttributes&&t.featureAttributeOrder&&d){s.featureAttributes={};for(const e of t.featureAttributeOrder){if(!t.featureAttributes[e])continue;const i={...t.featureAttributes[e],byteOffset:r,count:d};s.featureAttributes[e]=i,r+=("UInt64"===i.valueType?8:I(i.valueType))*i.valuesPerElement*d}}return g(r,e.byteLength,"geometry"),s.byteCount=r-s.byteOffset,s}function _(e,t){return e&&e.compressedAttributes&&"draco"===e.compressedAttributes.encoding?O(e.compressedAttributes.attributes):e?p(e):y(t)}function y(e){const t={isDraco:!1,isLegacy:!0,color:!1,normal:!1,uv0:!1,uvRegion:!1,featureIndex:!1};for(const i of e.ordering)if(e.vertexAttributes[i])switch(i){case"position":break;case"normal":t.normal=!0;break;case"color":t.color=!0;break;case"uv0":t.uv0=!0;break;case"region":t.uvRegion=!0}return e.featureAttributes&&e.featureAttributeOrder&&(t.featureIndex=!0),t}function O(e){const t={isDraco:!0,isLegacy:!1,color:!1,normal:!1,uv0:!1,uvRegion:!1,featureIndex:!1};for(const i of e)switch(i){case"position":break;case"normal":t.normal=!0;break;case"uv0":t.uv0=!0;break;case"color":t.color=!0;break;case"uv-region":t.uvRegion=!0;break;case"feature-index":t.featureIndex=!0}return t}const j={position:o["a"].POSITION,normal:o["a"].NORMAL,color:o["a"].COLOR,uv0:o["a"].UV0,region:o["a"].UVREGION};function v(e,t,i){if("lepcc-rgb"===e.encoding)return Object(a["b"])(t);if("lepcc-intensity"===e.encoding)return Object(a["a"])(t);if(null!=e.encoding&&""!==e.encoding)throw new r["a"]("unknown-attribute-storage-info-encoding","Unknown Attribute Storage Info Encoding");e["attributeByteCounts "]&&!e.attributeByteCounts&&(d.warn("Warning: Trailing space in 'attributeByteCounts '."),e.attributeByteCounts=e["attributeByteCounts "]),"ObjectIds"===e.ordering[0]&&e.hasOwnProperty("objectIds")&&(d.warn("Warning: Case error in objectIds"),e.ordering[0]="objectIds");const s=f(t,e,i);g(s.byteOffset+s.byteCount,t.byteLength,"attribute");const n=s.entries.attributeValues||s.entries.objectIds;if(n){if("String"===n.valueType){const e=s.entries.attributeByteCounts,i=h(t,e),r=b(t,n);return u(e.count,i,r)}return h(t,n)}throw new r["a"]("bad-attribute-storage-info","Bad attributeStorageInfo specification.")}const x={Float32:Float32Array,Float64:Float64Array,UInt8:Uint8Array,Int8:Int8Array,UInt16:Uint16Array,Int16:Int16Array,UInt32:Uint32Array,Int32:Int32Array},w={Float32:(e,t)=>new DataView(e,0).getFloat32(t,!0),Float64:(e,t)=>new DataView(e,0).getFloat64(t,!0),UInt8:(e,t)=>new DataView(e,0).getUint8(t),Int8:(e,t)=>new DataView(e,0).getInt8(t),UInt16:(e,t)=>new DataView(e,0).getUint16(t,!0),Int16:(e,t)=>new DataView(e,0).getInt16(t,!0),UInt32:(e,t)=>new DataView(e,0).getUint32(t,!0),Int32:(e,t)=>new DataView(e,0).getInt32(t,!0)};function C(e){return x.hasOwnProperty(e)}function I(e){return C(e)?x[e].BYTES_PER_ELEMENT:0}},ad73:function(e,t,i){"use strict";i.d(t,"a",(function(){return a})),i.d(t,"b",(function(){return n}));var r=i("b2b2"),s=i("c1da");async function n(e,t=e.popupTemplate){if(!Object(r["k"])(t))return[];const i=await t.getRequiredFields(e.fieldsIndex),{lastEditInfoEnabled:n}=t,{objectIdField:a,typeIdField:o,globalIdField:d,relationships:c}=e;if(i.includes("*"))return["*"];const l=n?await Object(s["n"])(e):[],u=Object(s["j"])(e.fieldsIndex,[...i,...l]);return o&&u.push(o),u&&a&&e.fieldsIndex.has(a)&&-1===u.indexOf(a)&&u.push(a),u&&d&&e.fieldsIndex.has(d)&&-1===u.indexOf(d)&&u.push(d),c&&c.forEach(t=>{const{keyField:i}=t;u&&i&&e.fieldsIndex.has(i)&&-1===u.indexOf(i)&&u.push(i)}),u}function a(e,t){return e.popupTemplate?e.popupTemplate:Object(r["k"])(t)&&t.defaultPopupTemplateEnabled&&Object(r["k"])(e.defaultPopupTemplate)?e.defaultPopupTemplate:null}},bb87:function(e,t,i){"use strict";i.d(t,"a",(function(){return _}));var r=i("a4ee"),s=i("fc29"),n=i("e92d"),a=i("c0d3"),o=i("59b2"),d=i("d386"),c=i("cb26");const l=e=>{let t=class extends e{constructor(){super(...arguments),this._numUpdating=0,this.asyncUpdateState=new Map}get updating(){return this._numUpdating>0}autoUpdateAsync(e,t){return h(t=>this._updateAsync(e,t),t)}async _updateAsync(e,i){if(!this._startAsyncUpdate(e)){try{const t=await i();this._set(e,t)}catch(t){n["a"].getLogger(this.declaredClass).warn(`Async update of "${e}" failed. Async update functions should not throw exceptions.`)}this._endAsyncUpdate(e)&&this._updateAsync(e,i)}}_startAsyncUpdate(e){var t;const i=null!=(t=this.asyncUpdateState.get(e))?t:u.None;return i&u.Updating?(this.asyncUpdateState.set(e,i|u.Invalidated),!0):(++this._numUpdating,this.asyncUpdateState.set(e,i|u.Updating),!1)}_endAsyncUpdate(e){var t;--this._numUpdating;const i=(null!=(t=this.asyncUpdateState.get(e))?t:u.None)&~u.Updating;return i&u.Invalidated?(this.asyncUpdateState.set(e,i&~u.Invalidated),!0):(this.asyncUpdateState.set(e,i),!1)}};return Object(r["a"])([Object(o["b"])({readOnly:!0})],t.prototype,"updating",null),Object(r["a"])([Object(o["b"])()],t.prototype,"_numUpdating",void 0),t=Object(r["a"])([Object(d["a"])("esri.core.AsyncUpdate")],t),t};var u;function h(e,t){const i=()=>{n&&!o&&e(r)},r=()=>{if(!n||o)return t();n.clear(),o=!0;const e=Object(a["b"])(n,t);return o=!1,e},s=()=>{n&&(n.destroy(),n=null)};let n=new c["a"](i),o=!1;return e(r),{remove:s}}!function(e){e[e.None=0]="None",e[e.Updating=1]="Updating",e[e.Invalidated=2]="Invalidated"}(u||(u={}));let b=class extends(l(s["a"])){};b=Object(r["a"])([Object(d["a"])("esri.core.AsyncUpdate")],b);var f=i("9096"),g=i("b2b2"),p=(i("b50f"),i("c120"),i("cea0"),i("c1da"));const m=n["a"].getLogger("esri.views.3d.layers.support.SceneLayerViewRequiredFields");let _=class extends(l(f["a"])){constructor(e){super(e)}get requiredFields(){const{layerView:{layer:{fieldsIndex:e},definitionExpressionFields:t},rendererFields:i,labelingFields:r,viewFilterFields:s}=this;return Object(p["j"])(e,[...Object(g["u"])(t,[]),...Object(g["u"])(i,[]),...Object(g["u"])(r,[]),...Object(g["u"])(s,[])])}initialize(){const e=this.layerView.layer;this.layer=e,this.handles.add([this.autoUpdateAsync("rendererFields",()=>{const{fieldsIndex:e,renderer:t}=this.layer;return t?y(i=>t.collectRequiredFields(i,e)):null}),this.autoUpdateAsync("labelingFields",()=>{const{layer:e}=this;return e.labelsVisible?y(t=>Object(p["g"])(t,e)):null}),this.autoUpdateAsync("viewFilterFields",()=>{const{layer:e,filter:t}=this.layerView;return y(i=>Object(p["f"])(i,e,t))})])}};async function y(e){const t=new Set;try{return await e(t),Array.from(t).sort()}catch(i){return m.error(i),null}}Object(r["a"])([Object(o["b"])()],_.prototype,"layerView",void 0),Object(r["a"])([Object(o["b"])()],_.prototype,"layer",void 0),Object(r["a"])([Object(o["b"])()],_.prototype,"requiredFields",null),Object(r["a"])([Object(o["b"])()],_.prototype,"rendererFields",void 0),Object(r["a"])([Object(o["b"])()],_.prototype,"labelingFields",void 0),Object(r["a"])([Object(o["b"])()],_.prototype,"viewFilterFields",void 0),_=Object(r["a"])([Object(d["a"])("esri.views.3d.layers.support.SceneLayerViewRequiredFields")],_)},c453:function(e,t,i){"use strict";i.d(t,"a",(function(){return n})),i.d(t,"b",(function(){return a})),i.d(t,"c",(function(){return l})),i.d(t,"d",(function(){return c})),i.d(t,"e",(function(){return r})),i.d(t,"f",(function(){return s})),i.d(t,"g",(function(){return o})),i.d(t,"h",(function(){return u}));var r,s,n,a,o,d=i("0fc4");class c{constructor(e,t){this.id=e,this.mbs=t,this.renderMbs=Object(d["f"])([0,0,0,-1]),this.imModificationImpact=s.NotChecked}}!function(e){e[e.Unmodified=0]="Unmodified",e[e.Culled=1]="Culled",e[e.NotChecked=2]="NotChecked"}(r||(r={})),function(e){e[e.Unmodified=0]="Unmodified",e[e.PotentiallyModified=1]="PotentiallyModified",e[e.Culled=2]="Culled",e[e.Unknown=3]="Unknown",e[e.NotChecked=4]="NotChecked"}(s||(s={}));class l extends c{constructor(e,t,i,r,s,a,o,d,c,l){super(e,i),this.index=t,this.childCount=r,this.level=s,this.resources=a,this.version=o,this.lodMetric=d,this.maxError=c,this.numFeatures=l,this.failed=!1,this.hasModifications=!1,this.cacheState=n.Unknown,this.vertexCount=0,this.memory=0}}!function(e){e[e.Unknown=0]="Unknown",e[e.Uncached=1]="Uncached",e[e.Cached=2]="Cached"}(n||(n={})),function(e){e[e.None=0]="None",e[e.MaxScreenThreshold=1]="MaxScreenThreshold",e[e.ScreenSpaceRelative=2]="ScreenSpaceRelative",e[e.RemovedFeatureDiameter=3]="RemovedFeatureDiameter",e[e.DistanceRangeFromDefaultCamera=4]="DistanceRangeFromDefaultCamera"}(a||(a={})),function(e){e[e.Hole=0]="Hole",e[e.Leaf=1]="Leaf"}(o||(o={}));class u{constructor(e,t,i,r){this.nodeHasLOD=e,this.isChosen=t,this.lodLevel=i,this.version=r}}},c5729:function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return Q}));var r=i("a4ee"),s=i("8d60"),n=i("b50f"),a=i("e92d"),o=i("b2b2"),d=i("477c"),c=i("3795"),l=i("59b2"),u=(i("c120"),i("cea0"),i("d386")),h=i("e431"),b=i("0b2d"),f=i("8188"),g=i("9180"),p=i("2172"),m=i("b0f5"),_=i("1a54"),y=i("d3cf"),O=i("38a2"),j=i("96d4"),v=i("69dd"),x=i("78ba");class w extends x["a"]{constructor(e){super("SceneLayerWorker","dracoDecompressPointCloudData",e,{hasInitialize:!0})}getTransferList(e){return[e.geometryBuffer]}}var C=i("648c"),I=i("66af"),N=i("a5de"),S=i("a207"),D=i("dd25"),E=i("d5bc"),F=i("ee9c"),M=i("16d0"),A=i("f426"),P=i("f7f0"),T=i("bb87"),L=i("6611"),k=i("e411"),V=i("cee3"),R=i("deae"),U=i("b7c2"),G=i("e315"),q=i("9305");const B=a["a"].getLogger("esri.views.3d.layers.SceneLayerGraphicsView3D"),z=Object(A["a"])();let H=class extends(Object(M["a"])(Object(P["a"])(Object(I["a"])(G["a"])))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._nodesAddedToStage=new Map,this.drapeSourceType=C["b"].Features,this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this.loadedGraphics=new k["a"],this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}initialize(){var e,t;const r=this.layer;this.addResolvingPromise(r.indexInfo),this._attributeOverrides=new E["a"](this.layer,null==(e=this.view.resourceController)?void 0:e.memoryController),Object(F["h"])(r,this.view.spatialReference,this.view.viewingMode),this.fieldsHelper=new T["a"]({layerView:this}),this.updatingHandles.add(()=>r.rangeInfos,e=>this._rangeInfosChanged(e),d["a"]),this.updatingHandles.add(()=>r.renderer,(e,t)=>this._rendererChange(e,t)),this.updatingHandles.add(()=>[this.parsedDefinitionExpression,this.excludeObjectIdsSorted],()=>this._filterChange()),this.updatingHandles.add(()=>this.view.floors,()=>this.processor.filterVisibility.filterChanged()),this.handles.add(Object(c["a"])(L["a"],"I3S_TREE_SHOW_TILES",e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;i.e("chunk-71e77862").then(i.bind(null,"4d47")).then(({I3STreeDebugger:t})=>{!this._treeDebugger&&L["a"].I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||!this._treeDebugger||L["a"].I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)})),this._set("processor",new N["a"]({owner:this,preferredUpdatePolicy:U["m"].ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentVisibilityEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,dataExtent:r.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),null==(t=this.processor.elevationAlignment)||t.events.on("invalidate-elevation",e=>this._invalidateElevation(e)),this.supportsHeightUnitConversion&&(this._verticalScale=Object(m["a"])("point",r.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.setup()),this._memCache=this.view.resourceController.memoryController.newCache(r.uid),this._controller=new O["a"]({layerView:this,scaleVisibilityEnabled:!1}),Object(F["j"])(this.layer.geometryDefinitions)&&(this._worker=new w(e=>this.view.resourceController.schedule(e))),this.handles.add(this.layer.on("apply-edits",e=>this.updatingHandles.addPromise(e.result))),this.handles.add(this.layer.on("edits",e=>this._handleEdits(e))),this.when(()=>{this._queryEngine=new S["a"]({layerView:this,priority:q["c"].FEATURE_QUERY_ENGINE}),this.updatingHandles.add(()=>this.maximumNumberOfFeatures,e=>this._controller.featureTarget=e,d["a"]),this.updatingHandles.add(()=>this.suspended,e=>{e&&this._removeAllNodeData()})})}destroy(){this._treeDebugger=Object(o["d"])(this._treeDebugger),this._attributeOverrides=Object(o["d"])(this._attributeOverrides),this._set("processor",Object(o["d"])(this.processor)),this._controller=Object(o["d"])(this._controller),this._queryEngine=Object(o["d"])(this._queryEngine),this._worker=Object(o["d"])(this._worker),this._memCache=Object(o["d"])(this._memCache),this._nodesAddedToStage.clear(),this.fieldsHelper=Object(o["d"])(this.fieldsHelper)}get requiredFields(){var e,t;return null!=(e=null==(t=this.fieldsHelper)?void 0:t.requiredFields)?e:[]}get maximumNumberOfFeatures(){var e,t,i;const r=null==(e=this.processor)||null==(t=e.graphicsCore)?void 0:t.displayFeatureLimit;return null!=(i=null==r?void 0:r.maximumNumberOfFeatures)?i:0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){var e;return!this.suspended&&!(null==(e=this._controller)||!e.useMaximumNumberOfFeatures||this._controller.leavesReached)}get excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort((e,t)=>e-t):null}get hasM(){return!1}get hasZ(){return!0}async whenGraphicAttributes(e,t){return Object(F["y"])(this.layer,e,this._getObjectIdField(),t,()=>[...this._nodesAddedToStage.values()])}getGraphicFromGraphicUid(e){if(!this.loadedGraphics)return null;const t=Object(y["c"])(this.loadedGraphics.find(t=>t.uid===e),this.layer),i=this._getObjectIdField();return t&&t.attributes&&t.attributes[i]?(t.layer=this.layer,t.sourceLayer=this.layer,t):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}isUpdating(){var e,t,i;return!!(null!=(e=this._controller)&&e.updating||null!=(t=this.processor)&&t.updating||null!=(i=this.fieldsHelper)&&i.updating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return Object(D["a"])(this.attributeEditingContext,e)}async _extractBinaryPointData(e,t){const i={geometryBuffer:e.geometryBuffer};return Object(o["j"])(this._worker)&&(this._worker=new w(e=>this.view.resourceController.schedule(e))),this._worker.invoke(i,t).then(e=>{if(Object(o["k"])(e))return{positionData:e.positions,featureIds:e.featureIds};throw new Error("Failed to decompress Draco point data")})}_checkExtent(e,t){e&&!Object(p["b"])(e,t)&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&B.error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&B.error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++)}async addNode(e,t,i){if(!K(t)&&!$(t))return Promise.reject();if(this._nodesAddedToStage.has(e.index))return void B.error("I3S node "+e.id+" already added");const r=Object(o["k"])(this.layer.fullExtent)?W(this.layer.fullExtent.clone(),.5):null,s=this._controller.crsVertex,n=[],a={graphics:null,featureIds:null,attributeInfo:t.attributeDataInfo,node:e};if(K(t)?await this._addNodeBinaryPointData(e,a,t,r,n,i):$(t)&&this._addNodeLegacyPointData(e,a,t,r,n),await this._attributeOverrides.apply(a.featureIds,t.attributeDataInfo,i),e.numFeatures=a.graphics.length,this._updateNodeMemory(e),X(a),n.length>0&&(this._computeObb(e,n,s),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return this._cacheNodeData(a),Promise.resolve();if(Object(o["k"])(this._verticalScale))for(const o of a.graphics)this._verticalScale(o.geometry);return this._nodesAddedToStage.set(e.index,a),this.loadedGraphics.addMany(a.graphics),this._filterNode(a),this._treeDebugger&&this._treeDebugger.update(),Promise.resolve()}_computeObb(e,t,i){const r=this._controller.crsIndex,s=r.isGeographic?this.view.renderSpatialReference:r;Object(f["p"])(t,i,0,t,s,0,t.length/3);const n={data:t,size:3};e.serviceObb=Object(V["c"])(n),r.isGeographic&&Object(f["y"])(e.serviceObb.center,s,e.serviceObb.center,r)}isNodeLoaded(e){return this._nodesAddedToStage.has(e)}isNodeReloading(){return!1}updateNodeState(){}async _addNodeBinaryPointData(e,t,i,r,n,a){const d=await this._extractBinaryPointData(i,a);if(null==d)return Promise.reject();const c=this._getObjectIdField(),l=this._controller.crsVertex,u=this.view.spatialReference,g=this.processor.graphicsCore,{positionData:p,featureIds:m}=d,y=3,O=p.length/y,j=new Array;for(let v=0;v<O;v++){const t=Object(o["k"])(e.serviceObb)?e.serviceObb.center:[0,0,0],i=v*y,a=Object(b["h"])(p[i+0],p[i+1],p[i+2]);Object(h["h"])(a,a,t),e.serviceObb||n.push(a[0],a[1],a[2]),Object(o["k"])(r)&&this._checkExtent(r,a);const d=m[v],O={};null!=d&&(O[c]=d);const x=null==d?s["a"].generateUID():d;Object(f["p"])(a,l,0,Z,u,0,1);const w=Object(_["j"])(Z[0],Z[1],Z[2],u),C=this.loadedGraphics.get(x);if(Object(o["k"])(C))C.level<e.level&&(J.property="geometry",J.graphic=C,J.oldValue=Object(o["t"])(C.geometry),J.newValue=w,C.geometry=w,g.graphicUpdateHandler(J)),j.push(C);else{const t=s["a"].generateUID();j.push({objectId:x,uid:t,geometry:w,attributes:O,visible:!0,level:e.level})}}t.graphics=j,t.featureIds=Array.from(m)}_addNodeLegacyPointData(e,t,i,r,n){const a=this._getObjectIdField(),d=this._controller.crsVertex,c=this.view.spatialReference,l=[0,0,0],u=new Array,h=new Array;for(const b of i.pointData){const t=b.featureDataPosition,i=t.length,g=b.geometries&&b.geometries[0]||Y[i],p=b.featureIds[0];if("points"!==g.params.type)continue;Object(o["k"])(r)&&this._checkExtent(r,t);const m={};null!=p&&(m[a]=p);const y=null==p?s["a"].generateUID():p;let O;"Embedded"===g.type&&(O=g.params.vertexAttributes.position);for(let r=0;r<O.length;r+=i){for(let e=0;e<i;e++)l[e]=t[e]+O[r+e];const a=3===i;e.serviceObb||n.push(l[0],l[1],a?l[2]:0),Object(f["p"])(l,d,0,Z,c,0,1);const u=Object(_["j"])(Z[0],Z[1],a?Z[2]:void 0,c),b=this.loadedGraphics.get(y);Object(o["k"])(b)?h.push(b):h.push({objectId:y,uid:s["a"].generateUID(),geometry:u,attributes:m,visible:!0})}u.push(p)}t.graphics=h,t.featureIds=u}_updateNodeMemory(e){e.memory=4096+(Object(o["k"])(e.numFeatures)?e.numFeatures*this.processor.graphicsCore.usedMemoryPerGraphic:0)}_cacheNodeData(e){const t=e.graphics.reduce((e,t)=>Object(_["e"])(t)+e,512+8*e.featureIds.length+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return""+e.index}_removeAllNodeData(){this._nodesAddedToStage.forEach(e=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}}),this._nodesAddedToStage.clear(),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this._nodesAddedToStage.get(e);return t?(this.loadedGraphics.removeMany(t.graphics),this._nodesAddedToStage.delete(e),this._treeDebugger&&this._treeDebugger.update(),t):null}async loadCachedNodeData(e){return this._memCache.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,i,r){if(!this._nodesAddedToStage.has(e.index))return this.loadedGraphics.addMany(t.graphics),this._nodesAddedToStage.set(e.index,t),this._updateNodeMemory(e),await this.updateAttributes(e.index,i,r),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update(),Promise.resolve();B.error("I3S node "+e.id+" already added")}getLoadedNodeIds(){const e=[];return this._nodesAddedToStage.forEach(t=>e.push(t.node.id)),e.sort()}getVisibleNodes(){const e=new Array;return this._nodesAddedToStage.forEach(t=>e.push(t.node)),e}getLoadedNodeIndices(e){this._nodesAddedToStage.forEach((t,i)=>e.push(i))}getLoadedAttributes(e){const t=this._nodesAddedToStage.get(e);if(t&&Object(o["k"])(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodesAddedToStage.get(e);if(t&&Object(o["k"])(t.attributeInfo))return t.attributeInfo.attributeData}_setAttributeData(e,t){const i=this._nodesAddedToStage.get(e);i&&!Object(o["j"])(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const r=this._nodesAddedToStage.get(e);r&&(await this._attributeOverrides.apply(r.featureIds,t,i),r.attributeInfo=t,this._attributeValuesChanged(r))}_attributeValuesChanged(e){if(X(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map(e=>e.uid);this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||"OBJECTID"}async _rendererChange(e,t){const{layer:{fieldsIndex:i}}=this,r=new Set;let s,n;e?(await e.collectRequiredFields(r,i),s=Array.from(r).sort()):s=[],r.clear(),t?(await t.collectRequiredFields(r,i),n=Array.from(r).sort()):n=[],s.length===n.length&&s.every((e,t)=>s[t]===n[t])||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&B.warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this._nodesAddedToStage.forEach(e=>this._filterNode(e))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,i=this.excludeObjectIdsSorted,r=this._getObjectIdField();for(const s of e.graphics){const e=s.visible,a=!t||this._evaluateClause(t,s),d=Object(o["j"])(i)||Object(n["b"])(i,s.attributes[r])<0;s.visible=a&&d,e!==s.visible&&(J.graphic=s,J.property="visible",J.oldValue=e,J.newValue=s.visible,this.processor.graphicsCore.graphicUpdateHandler(J))}}_invalidateElevation(e){const t=this._controller.crsIndex;Object(f["n"])(e.extent,e.spatialReference,ee,t),this._controller.updateElevationChanged(ee,t)}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return Object(o["k"])(this.filter)?this.filter.createQuery(e):new v["a"](e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),null==t?void 0:t.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),null==t?void 0:t.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),null==t?void 0:t.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),null==t?void 0:t.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(Object(o["j"])(e)?this.createQuery():v["a"].from(e))}getUsedMemory(){var e,t,i;return null!=(e=null==(t=this.processor)||null==(i=t.graphicsCore)?void 0:i.usedMemory)?e:0}getUnloadedMemory(){var e,t,i,r,s;return.8*((null!=(e=null==(t=this._controller)?void 0:t.unloadedMemoryEstimate)?e:0)+(null!=(i=null==(r=this.processor)||null==(s=r.graphicsCore)?void 0:s.unprocessedMemoryEstimate)?i:0))}ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}_handleEdits(e){Object(D["b"])(this.attributeEditingContext,e)}get attributeEditingContext(){const e=this._getObjectIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,forEachNode:e=>this._nodesAddedToStage.forEach(t=>e(t.node,t.featureIds)),attributeStorageInfo:this.i3slayer.attributeStorageInfo,attributeOverrides:this._attributeOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,i,r)=>{this._setAttributeData(t,i);const s=this._nodesAddedToStage.get(t);if(Object(o["k"])(r)){const t=this.loadedGraphics.get(r.attributes[e]);Object(o["k"])(t)&&this.processor.graphicsCore.recreateGraphics([t])}else Object(o["k"])(s)&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this._nodesAddedToStage.size,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this._nodesAddedToStage.size,numFeatures:this.loadedGraphics.length}}};Object(r["a"])([Object(l["b"])()],H.prototype,"processor",void 0),Object(r["a"])([Object(l["b"])({type:j["a"]})],H.prototype,"filter",void 0),Object(r["a"])([Object(l["b"])()],H.prototype,"loadedGraphics",void 0),Object(r["a"])([Object(l["b"])({aliasOf:"layer"})],H.prototype,"i3slayer",void 0),Object(r["a"])([Object(l["b"])()],H.prototype,"_controller",void 0),Object(r["a"])([Object(l["b"])()],H.prototype,"updating",void 0),Object(r["a"])([Object(l["b"])()],H.prototype,"suspended",void 0),Object(r["a"])([Object(l["b"])()],H.prototype,"holeFilling",void 0),Object(r["a"])([Object(l["b"])(R["a"])],H.prototype,"updatingProgress",void 0),Object(r["a"])([Object(l["b"])({aliasOf:"_controller.updatingProgress"})],H.prototype,"updatingProgressValue",void 0),Object(r["a"])([Object(l["b"])(z.requiredFields)],H.prototype,"requiredFields",null),Object(r["a"])([Object(l["b"])(z.availableFields)],H.prototype,"availableFields",void 0),Object(r["a"])([Object(l["b"])()],H.prototype,"fieldsHelper",void 0),Object(r["a"])([Object(l["b"])({type:Number})],H.prototype,"maximumNumberOfFeatures",null),Object(r["a"])([Object(l["b"])({readOnly:!0})],H.prototype,"maximumNumberOfFeaturesExceeded",null),Object(r["a"])([Object(l["b"])()],H.prototype,"excludeObjectIdsSorted",null),Object(r["a"])([Object(l["b"])({readOnly:!0,aliasOf:"view.qualitySettings.sceneService.point.lodFactor"})],H.prototype,"lodFactor",void 0),Object(r["a"])([Object(l["b"])({readOnly:!0})],H.prototype,"hasM",null),Object(r["a"])([Object(l["b"])({readOnly:!0})],H.prototype,"hasZ",null),H=Object(r["a"])([Object(u["a"])("esri.views.3d.layers.SceneLayerGraphicsView3D")],H);const Q=H;function $(e){return"pointData"in e}function K(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function X(e){const t=e.attributeInfo;for(let i=0;i<e.graphics.length;i++){const r=e.graphics[i];if(r.attributes||(r.attributes={}),Object(o["k"])(t)&&Object(o["k"])(t.loadedAttributes))for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(r.attributes[e]=Object(F["o"])(t.attributeData[e],i))}}function W(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,e.hasZ&&(e.zmin-=t,e.zmax+=t),e.hasM&&(e.mmin-=t,e.mmax+=t),e}const Y={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},Z=Object(b["f"])(),J={graphic:null,property:null,oldValue:null,newValue:null},ee=Object(g["l"])()},d207:function(e,t,i){"use strict";i.d(t,"a",(function(){return m})),i.d(t,"b",(function(){return f})),i.d(t,"c",(function(){return c}));var r=i("ce50");const s=!0,n={identifierOffset:0,identifierLength:10,versionOffset:10,checksumOffset:12,byteCount:16};function a(e,t,i){return{identifier:String.fromCharCode.apply(null,new Uint8Array(e,i+n.identifierOffset,n.identifierLength)),version:t.getUint16(i+n.versionOffset,s),checksum:t.getUint32(i+n.checksumOffset,s)}}const o={sizeLo:0,sizeHi:4,minX:8,minY:16,minZ:24,maxX:32,maxY:40,maxZ:48,errorX:56,errorY:64,errorZ:72,count:80,reserved:84,byteCount:88};function d(e,t){return{sizeLo:e.getUint32(t+o.sizeLo,s),sizeHi:e.getUint32(t+o.sizeHi,s),minX:e.getFloat64(t+o.minX,s),minY:e.getFloat64(t+o.minY,s),minZ:e.getFloat64(t+o.minZ,s),maxX:e.getFloat64(t+o.maxX,s),maxY:e.getFloat64(t+o.maxY,s),maxZ:e.getFloat64(t+o.maxZ,s),errorX:e.getFloat64(t+o.errorX,s),errorY:e.getFloat64(t+o.errorY,s),errorZ:e.getFloat64(t+o.errorZ,s),count:e.getUint32(t+o.count,s),reserved:e.getUint32(t+o.reserved,s)}}function c(e){const t=new DataView(e,0);let i=0;const{identifier:s,version:c}=a(e,t,i);if(i+=n.byteCount,"LEPCC "!==s)throw new r["a"]("lepcc-decode-error","Bad identifier");if(c>1)throw new r["a"]("lepcc-decode-error","Unknown version");const u=d(t,i);if(i+=o.byteCount,u.sizeHi*2**32+u.sizeLo!==e.byteLength)throw new r["a"]("lepcc-decode-error","Bad size");const h=new Float64Array(3*u.count),b=[],f=[],g=[],p=[];if(i=l(e,i,b),i=l(e,i,f),i=l(e,i,g),i=l(e,i,p),i!==e.byteLength)throw new r["a"]("lepcc-decode-error","Bad length");let m=0,_=0;for(let r=0;r<b.length;r++){_+=b[r];let e=0;for(let t=0;t<f[r];t++){e+=g[m];const t=p[m];h[3*m]=Math.min(u.maxX,u.minX+2*u.errorX*e),h[3*m+1]=Math.min(u.maxY,u.minY+2*u.errorY*_),h[3*m+2]=Math.min(u.maxZ,u.minZ+2*u.errorZ*t),m++}}return{errorX:u.errorX,errorY:u.errorY,errorZ:u.errorZ,result:h}}function l(e,t,i){const r=[];t=u(e,t,r);const s=[];for(let n=0;n<r.length;n++){s.length=0,t=u(e,t,s);for(let e=0;e<s.length;e++)i.push(s[e]+r[n])}return t}function u(e,t,i){const n=new DataView(e,t),a=n.getUint8(0),o=31&a,d=!!(32&a),c=(192&a)>>6;let l=0;if(0===c)l=n.getUint32(1,s),t+=5;else if(1===c)l=n.getUint16(1,s),t+=3;else{if(2!==c)throw new r["a"]("lepcc-decode-error","Bad count type");l=n.getUint8(1),t+=2}if(d)throw new r["a"]("lepcc-decode-error","LUT not implemented");const u=Math.ceil(l*o/8),h=new Uint8Array(e,t,u);let b=0,f=0,g=0;const p=-1>>>32-o;for(let r=0;r<l;r++){for(;f<o;)b|=h[g]<<f,f+=8,g+=1;i[r]=b&p,b>>>=o,f-=o,f+o>32&&(b|=h[g-1]>>8-f)}return t+g}const h={sizeLo:0,sizeHi:4,count:8,colorMapCount:12,lookupMethod:14,compressionMethod:15,byteCount:16};function b(e,t){return{sizeLo:e.getUint32(t+h.sizeLo,s),sizeHi:e.getUint32(t+h.sizeHi,s),count:e.getUint32(t+h.count,s),colorMapCount:e.getUint16(t+h.colorMapCount,s),lookupMethod:e.getUint8(t+h.lookupMethod),compressionMethod:e.getUint8(t+h.compressionMethod)}}function f(e){const t=new DataView(e,0);let i=0;const{identifier:s,version:o}=a(e,t,i);if(i+=n.byteCount,"ClusterRGB"!==s)throw new r["a"]("lepcc-decode-error","Bad identifier");if(o>1)throw new r["a"]("lepcc-decode-error","Unknown version");const d=b(t,i);if(i+=h.byteCount,d.sizeHi*2**32+d.sizeLo!==e.byteLength)throw new r["a"]("lepcc-decode-error","Bad size");if((2===d.lookupMethod||1===d.lookupMethod)&&0===d.compressionMethod){if(3*d.colorMapCount+d.count+i!==e.byteLength||d.colorMapCount>256)throw new r["a"]("lepcc-decode-error","Bad count");const t=new Uint8Array(e,i,3*d.colorMapCount),s=new Uint8Array(e,i+3*d.colorMapCount,d.count),n=new Uint8Array(3*d.count);for(let e=0;e<d.count;e++){const i=s[e];n[3*e]=t[3*i],n[3*e+1]=t[3*i+1],n[3*e+2]=t[3*i+2]}return n}if(0===d.lookupMethod&&0===d.compressionMethod){if(3*d.count+i!==e.byteLength||0!==d.colorMapCount)throw new r["a"]("lepcc-decode-error","Bad count");return new Uint8Array(e,i).slice()}if(d.lookupMethod<=2&&1===d.compressionMethod){if(i+3!==e.byteLength||1!==d.colorMapCount)throw new r["a"]("lepcc-decode-error","Bad count");const s=t.getUint8(i),n=t.getUint8(i+1),a=t.getUint8(i+2),o=new Uint8Array(3*d.count);for(let e=0;e<d.count;e++)o[3*e]=s,o[3*e+1]=n,o[3*e+2]=a;return o}throw new r["a"]("lepcc-decode-error","Bad method "+d.lookupMethod+","+d.compressionMethod)}const g={sizeLo:0,sizeHi:4,count:8,scaleFactor:12,bitsPerPoint:14,reserved:15,byteCount:16};function p(e,t){return{sizeLo:e.getUint32(t+g.sizeLo,s),sizeHi:e.getUint32(t+g.sizeHi,s),count:e.getUint32(t+g.count,s),scaleFactor:e.getUint16(t+g.scaleFactor,s),bitsPerPoint:e.getUint8(t+g.bitsPerPoint),reserved:e.getUint8(t+g.reserved)}}function m(e){const t=new DataView(e,0);let i=0;const{identifier:s,version:o}=a(e,t,i);if(i+=n.byteCount,"Intensity "!==s)throw new r["a"]("lepcc-decode-error","Bad identifier");if(o>1)throw new r["a"]("lepcc-decode-error","Unknown version");const d=p(t,i);if(i+=g.byteCount,d.sizeHi*2**32+d.sizeLo!==e.byteLength)throw new r["a"]("lepcc-decode-error","Bad size");const c=new Uint16Array(d.count);if(8===d.bitsPerPoint){if(d.count+i!==e.byteLength)throw new r["a"]("lepcc-decode-error","Bad size");const t=new Uint8Array(e,i,d.count);for(let e=0;e<d.count;e++)c[e]=t[e]*d.scaleFactor}else if(16===d.bitsPerPoint){if(2*d.count+i!==e.byteLength)throw new r["a"]("lepcc-decode-error","Bad size");const t=new Uint16Array(e,i,d.count);for(let e=0;e<d.count;e++)c[e]=t[e]*d.scaleFactor}else{const t=[];if(u(e,i,t)!==e.byteLength)throw new r["a"]("lepcc-decode-error","Bad size");for(let e=0;e<d.count;e++)c[e]=t[e]*d.scaleFactor}return c}},d5bc:function(e,t,i){"use strict";i.d(t,"a",(function(){return m}));var r=i("2eab"),s=i("b50f"),n=i("792b"),a=i("f0b9"),o=i("e92d"),d=i("b2b2"),c=i("f4cc"),l=i("21e2"),u=i("69dd");async function h(e,t,i){t=t.clone(),e.capabilities.query.supportsMaxRecordCountFactor&&(t.maxRecordCountFactor=g(e));const r=b(e),s=e.capabilities.query.supportsPagination;t.start=0,t.num=r;let n=null;for(;;){const a=await e.source.queryFeaturesJSON(t,i);if(Object(d["j"])(n)?n=a:n.features=n.features.concat(a.features),n.exceededTransferLimit=a.exceededTransferLimit,!s||!a.exceededTransferLimit)break;t.start+=r}return n}function b(e){return g(e)*f(e)}function f(e){return e.capabilities.query.maxRecordCount||2e3}function g(e){return e.capabilities.query.supportsMaxRecordCountFactor?u["a"].MAX_MAX_RECORD_COUNT_FACTOR:1}const p=o["a"].getLogger("esri.views.3d.layers.i3s.I3SAttributeOverrides");class m{constructor(e,t){this.layer=e,this.warnMaximumChangedObjectsExceeded=!1,this.changedObjectIds=new Set,this.pendingFetchAbortController=new AbortController,this.interactiveEditingSessions=null,this._maximumNumberOfEditOVerrides=j,this.memCache=t.newCache(e.uid+"-attribute-overrides"),this.pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this.pendingFetchAbortController.signal),this.pendingFetchChangedObjectIds.then(()=>this.pendingFetchAbortController=null)}destroy(){this.layer=null,this.memCache.destroy(),this.memCache=null,this.pendingFetchAbortController&&(this.pendingFetchAbortController.abort(),this.pendingFetchAbortController=null),this.pendingFetchChangedObjectIds=null}createInteractiveEditSession(e){this.changedObjectIds.add(e),Object(d["j"])(this.interactiveEditingSessions)&&(this.interactiveEditingSessions=[]);const t=this.interactiveEditingSessions,i=new _(e,{rollback:()=>{Object(s["j"])(t,i),0===t.length&&(this.interactiveEditingSessions=null)},commit:t=>{for(const[i,r]of t)this.updateValue(e,i,r)}});return t.unshift(i),i}async apply(e,t,i){if(Object(d["j"])(t))return;const{loadedAttributes:r,attributeData:s}=t;if(Object(d["j"])(r)||0===r.length||Object(d["j"])(s))return;if(await Object(c["z"])(this.pendingFetchChangedObjectIds,i),0===this.changedObjectIds.size)return;const n={loadedAttributes:r,attributeData:s},a=this._getOverridesFromCache(e,n,this.changedObjectIds),{objectIds:o,fieldNames:l}=a,u=await this._queryOverridesFromAssociatedLayer(o,l,i);Object(d["j"])(u)||this._processOverridesFromAssociatedLayer(e,u,l,n)}updateValue(e,t,i){this.changedObjectIds.add(e),this._cacheValue(e,t,i)}_cacheValue(e,t,i){this.memCache.put(this._getCacheKey(e,t),i,this._memCacheValueSize(i))}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:i},r){const s=new Set,n=new Array;for(const o of t)n[o.index]=i[o.name];const a=new Set;for(let o=0;o<e.length;o++){const i=e[o];if(r.has(i))for(const e of t){const t=this._fromCache(i,e.index);void 0===t?(s.add(i),a.add(e.name)):n[e.index][o]=t}}return{objectIds:Array.from(s),fieldNames:Array.from(a)}}_fromCache(e,t){const i=this._fromInteractiveEditingSession(e,t);if(void 0!==i)return i;const r=this._getCacheKey(e,t);return this.memCache.get(r)}_fromInteractiveEditingSession(e,t){if(!Object(d["j"])(this.interactiveEditingSessions))for(const i of this.interactiveEditingSessions){if(i.objectId!==e)continue;const r=i.get(t);if(void 0!==r)return r}}_getCacheKey(e,t){return`${e}-${t}`}async _queryOverridesFromAssociatedLayer(e,t,i){if(0===e.length||0===t.length)return null;e=e.sort((e,t)=>e-t),this.warnMaximumChangedObjectsExceeded&&(this.warnMaximumChangedObjectsExceeded=!1,this._logMaximumObjectsExceededWarning());const r=Object(d["t"])(this.layer.associatedLayer),a=r.createQuery();a.where="1=1",a.returnGeometry=!1,a.outFields=[r.objectIdField,...t],a.cacheHint=!0,a.objectIds=e;const o=b(r),c=e.length>o?Object(s["n"])(e,o).map(e=>{const t=a.clone();return t.objectIds=e,Object(n["e"])(h(r,t,{signal:i}))}):[Object(n["e"])(h(r,a,{signal:i}))];return(await Promise.all(c)).reduce((e,t)=>e.concat(t.ok?t.value.features:[]),[])}_logMaximumObjectsExceededWarning(){let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${Object(l["b"])(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;t&&t.loaded?e+=` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:e+=` (${this.layer.parsedUrl.path})`,p.warn("#queryOverrides()",this.layer.title,e+".")}_processOverridesFromAssociatedLayer(e,t,i,{loadedAttributes:r,attributeData:s}){const n=Object(d["t"])(this.layer.associatedLayer).objectIdField,a=i.map(e=>s[e]),o=new Map(r.map(e=>[e.name,e.index])),c=i.map(e=>o.get(e)),l=new Map(Array.from(e,(e,t)=>[e,t]));for(const d of t){const e=d.attributes[n];for(let t=0;t<i.length;t++){const r=c[t],s=l.get(e),n=d.attributes[i[t]];a[t][s]=n,this._cacheValue(e,r,n)}}}_memCacheValueSize(e){return"string"==typeof e?Object(a["e"])(e):Object(a["d"])()}async _fetchChangedObjectIds(e){var t,i,s;const a=this.layer;if(await a.load({signal:e}),this.changedObjectIds.clear(),Object(d["j"])(a.associatedLayer)||null==(t=a.associatedLayer.capabilities)||null==(i=t.operations)||!i.supportsChangeTracking)return;const o=this._getFetchChangedObjectIdsServerGen();if(Object(d["j"])(o))return null;const c=a.associatedLayer.layerId,l=await Object(n["d"])(Object(r["default"])(a.associatedLayer.url+"/extractChanges",{method:"post",query:{f:"json",returnIdsOnly:!0,layers:""+c,returnUpdates:!0,returnDeletes:!1,returnInserts:!1,layerServerGens:JSON.stringify([{id:c,serverGen:o}])},timeout:O,signal:e})),u=l.ok&&null!=(s=l.value.data)&&s.edits?Object(d["i"])(l.value.data.edits[0],"objectIds","updates"):null;if(Object(d["k"])(u)){const e=Math.min(this._maximumNumberOfEditOVerrides,u.length);e<u.length&&(this.warnMaximumChangedObjectsExceeded=!0);const t=u.sort((e,t)=>e-t);for(let i=0;i<e;i++)this.changedObjectIds.add(t[i])}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(Object(d["k"])(e.serviceUpdateTimeStamp)&&Object(d["k"])(e.serviceUpdateTimeStamp.lastUpdate))return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return Object(d["k"])(t)&&Object(d["k"])(t.serverGens)&&Object(d["k"])(t.serverGens.minServerGen)?t.serverGens.minServerGen:null}get test(){const e=Array.from(this.changedObjectIds),t=this.pendingFetchChangedObjectIds,i=this;return{changedObjectIds:e,pendingFetchChangedObjectIds:t,get maximumNumberOfEditOVerrides(){return i._maximumNumberOfEditOVerrides},set maximumNumberOfEditOVerrides(e){i._maximumNumberOfEditOVerrides=e}}}}class _{constructor(e,t){this.objectId=e,this.options=t,this.updates=new Map,this.state=y.ACTIVE}get(e){return this.updates.get(e)}set(e,t){this.isActive&&this.updates.set(e,t)}rollback(){this.isActive&&(this.state=y.ROLLED_BACK,this.options.rollback())}commit(){this.isActive&&(this.state=y.COMMITTED,this.options.commit(this.updates),this.updates.clear())}get isActive(){return this.state===y.ACTIVE}}var y;!function(e){e[e.ACTIVE=0]="ACTIVE",e[e.COMMITTED=1]="COMMITTED",e[e.ROLLED_BACK=2]="ROLLED_BACK"}(y||(y={}));const O=1e4,j=5e4},dd25:function(e,t,i){"use strict";i.d(t,"a",(function(){return d})),i.d(t,"b",(function(){return c}));var r=i("7ffa"),s=i("b2b2"),n=i("d36d");const a={setAttribute(){},rollback(){},commit(){}};var o;function d(e,t){const i=t.attributes[e.objectIdField],n=e.sessions.get(i);if(n)return n;const d=Object(r["a"])(t.attributes),c=new Set;if(null==i)return a;const l=e.attributeOverrides.createInteractiveEditSession(i),u=new Map,h=(e,t)=>{const r=u.get(e);if(null==r){const r=t.indexOf(i);return u.set(e,r),r}return r};let b=o.EDITING;const f={setAttribute(i,r){if(b!==o.EDITING)return;const n=e.fieldsIndex.get(i);if(Object(s["j"])(n))return;const a=e.attributeStorageInfo.findIndex(e=>e.name===n.name);if(a<0)return;l.set(a,r);const d=e.attributeStorageInfo[a];let u=!1;c.add(i),e.forEachNode((i,s)=>{const n=h(i,s);if(-1===n)return;const a=e.getAttributeData(i.index);if(a){const s=a[d.name];s&&(s[n]=r,e.setAttributeData(i.index,a,t),u=!0)}}),u&&e.clearMemCache()},rollback(){if(b===o.EDITING){for(const e of c)this.setAttribute(e,d[e]);l.rollback(),b=o.ROLLED_BACK,e.sessions.delete(i)}},commit(){b===o.EDITING&&(l.commit(),b=o.COMMITTED,e.sessions.delete(i))}};return e.sessions.set(i,f),f}function c(e,t){const i=l(e,t);if(0===i.size)return;const r=new Map;for(let s=0;s<e.attributeStorageInfo.length;s++)r.set(e.attributeStorageInfo[s].name,s);let n=!1;i.forEach((t,i)=>{const a=e.getAttributeData(i);let o=!1;t.forEach((t,i)=>{const d=Object(s["k"])(a)?a[i]:null,c=r.get(i);for(const{featureIndex:r,value:s,featureId:a}of t)d&&(d[r]=s,o=!0,n=!0),e.attributeOverrides.updateValue(a,c,s)}),o&&e.setAttributeData(i,a,null)}),n&&e.clearMemCache()}function l(e,t){const i=t.edits.updateFeatures;if(!i||0===i.length)return new g;const r=b(t),s=new g,a=new Map;for(let n=0;n<e.attributeStorageInfo.length;n++)a.set(e.attributeStorageInfo[n].name,n);const o=e.fieldsIndex,d=e.objectIdField,c=i.filter(e=>{const t=Object(n["a"])(o,e.attributes,d);return r.has(t)});return e.forEachNode((t,i)=>{const r=new Set(i);for(const a of c){const c=Object(n["a"])(o,a.attributes,d);if(!r.has(c))continue;const l=i.indexOf(c);for(const i in a.attributes){const r=e.fieldsIndex.normalizeFieldName(i),n=u(s,t.index,r),o=a.attributes[i];n.push({featureIndex:l,featureId:c,value:o})}}}),s}function u(e,t,i){const r=h(e,t),s=r.get(i);if(s)return s;const n=new Array;return r.set(i,n),n}function h(e,t){const i=e.get(t);if(i)return i;const r=new f;return e.set(t,r),r}function b(e){const t=new Set;if(!e.updatedFeatures)return t;for(const i of e.updatedFeatures)null!=i.objectId&&null==i.error&&t.add(i.objectId);return t}!function(e){e[e.EDITING=0]="EDITING",e[e.ROLLED_BACK=1]="ROLLED_BACK",e[e.COMMITTED=2]="COMMITTED"}(o||(o={}));const f=Map,g=Map},e315:function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var r=i("a4ee"),s=i("59b2"),n=(i("b50f"),i("c120"),i("cea0"),i("3eec"),i("c0d3"),i("0b86"),i("25245"),i("365a"));class a extends n["a"]{constructor(){super(...arguments),this.layer=null,this.filter=null}get availableFields(){return[]}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){throw new Error("Not implemented")}get maximumNumberOfFeaturesExceeded(){return!1}highlight(e){throw new Error("Not implemented")}queryFeatures(e,t){throw new Error("Not implemented")}queryObjectIds(e,t){throw new Error("Not implemented")}queryFeatureCount(e,t){throw new Error("Not implemented")}createQuery(){throw new Error("Not implemented")}queryExtent(e,t){throw new Error("Not implemented")}}Object(r["a"])([Object(s["b"])()],a.prototype,"layer",void 0),Object(r["a"])([Object(s["b"])()],a.prototype,"availableFields",null),Object(r["a"])([Object(s["b"])()],a.prototype,"maximumNumberOfFeatures",null),Object(r["a"])([Object(s["b"])({readOnly:!0})],a.prototype,"maximumNumberOfFeaturesExceeded",null),Object(r["a"])([Object(s["b"])()],a.prototype,"filter",void 0)},e411:function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var r=i("ce6d"),s=i("28eb");class n extends r["a"]{constructor(){super(...arguments),this._map=new Map}clear(){if(this._map.size>0){const e=this.toArray();this._map.clear(),this.emit("change",{added:[],removed:e})}}get length(){return this._map.size}get(e){return this._map.get(e)}addMany(e){if(0===e.length)return;const t=new Set;for(let r=0;r<e.length;r++){const i=e[r],s=i.objectId,n=this._map.get(s);n?(t.add(s),i!==n&&(e[r]=n),++n.refCount):(i.refCount=1,this._map.set(s,i))}const i=t.size>0?e.filter(e=>!t.has(e.objectId)):e;i.length>0&&this.emit("change",{added:i,removed:[]})}removeMany(e){const t=[];for(const i of e){const e=i.objectId,r=this._map.get(e);null!=r&&--r.refCount<=0&&(this._map.delete(e),t.push(i))}t.length>0&&this.emit("change",{added:[],removed:t})}removeManyByObjectId(e){const t=[];for(const i of e){const e=this._map.get(i);null!=e&&--e.refCount<=0&&(this._map.delete(i),t.push(e))}t.length>0&&this.emit("change",{added:[],removed:t})}toArray(){return[...this._map.values()]}find(e){let t;return Object(s["c"])(this._map,i=>!!e(i)&&(t=i,!0)),t}forEach(e){this._map.forEach(t=>e(t))}}},ee9c:function(e,t,i){"use strict";i.d(t,"a",(function(){return V})),i.d(t,"b",(function(){return be})),i.d(t,"c",(function(){return ae})),i.d(t,"d",(function(){return ne})),i.d(t,"e",(function(){return re})),i.d(t,"f",(function(){return ie})),i.d(t,"g",(function(){return Z})),i.d(t,"h",(function(){return ee})),i.d(t,"i",(function(){return Ce})),i.d(t,"j",(function(){return F})),i.d(t,"k",(function(){return A})),i.d(t,"l",(function(){return U})),i.d(t,"m",(function(){return M})),i.d(t,"n",(function(){return Y})),i.d(t,"o",(function(){return K})),i.d(t,"p",(function(){return L})),i.d(t,"q",(function(){return X})),i.d(t,"r",(function(){return he})),i.d(t,"s",(function(){return W})),i.d(t,"t",(function(){return R})),i.d(t,"u",(function(){return P})),i.d(t,"v",(function(){return ce})),i.d(t,"w",(function(){return fe})),i.d(t,"x",(function(){return le})),i.d(t,"y",(function(){return G}));var r=i("2eab"),s=i("b50f"),n=i("ce50"),a=i("c120"),o=i("b2b2"),d=i("f4cc"),c=i("a21b"),l=i("1c92"),u=i("dae5"),h=i("d791"),b=i("afe1"),f=i("04f0"),g=i("e764"),p=i("e431"),m=i("0b2d"),_=i("0fc4"),y=i("8188"),O=i("f694"),j=i("5996"),v=i("9180"),x=i("7f83"),w=i("69dd"),C=i("ad64"),I=i("82de"),N=i("ec13"),S=i("caf1"),D=i("cee3");function E(e){return e&&parseInt(e.substring(e.lastIndexOf("/")+1,e.length),10)}function F(e){if(Object(a["a"])("disable-feature:i3s-draco")||!e)return!1;for(const i of e)for(const e of i.geometryBuffers){var t;if("draco"===(null==(t=e.compressedAttributes)?void 0:t.encoding))return!0}return!1}function M(e,t,i,r,s,n){s.traverse(i,i=>{let s=i.mbs;t!==r&&(s=k,Object(y["o"])(i.mbs,r,s,t));const a=R(e,s);return a!==V.OUTSIDE&&(n(i,a),!0)})}function A(e,t,i){let r=0,s=0;for(let n=0;n<t.length&&r<e.length;n++)e[r]===t[n]&&(i(n)&&(e[s]=e[r],s++),r++);e.length=s}function P(e,t,i){let r=0,n=0;for(;r<i.length;)Object(s["b"])(e,i[r])>=0===t&&(i[n]=i[r],n++),r++;i.length=n}const T=Object(v["l"])();function L(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return T[0]=(e[0]-t.position[0])/t.rotationScale[0],T[1]=(e[1]-t.position[1])/t.rotationScale[4],T[2]=(e[2]-t.position[0])/t.rotationScale[0],T[3]=(e[3]-t.position[1])/t.rotationScale[4],T}const k=Object(_["e"])();var V;function R(e,t){const i=t[0],r=t[1],s=t[3],n=e[0]-i,a=i-e[2],o=e[1]-r,d=r-e[3],c=Math.max(n,a,0),l=Math.max(o,d,0),u=c*c+l*l;return u>s*s?V.OUTSIDE:u>0?V.INTERSECTS_CENTER_OUTSIDE:-Math.max(n,a,o,d)>s?V.INSIDE:V.INTERSECTS_CENTER_INSIDE}function U(e,t,i){const r=[],s=i&&i.missingFields,n=i&&i.originalFields;for(const a of e){const e=a.toLowerCase();let i=!1;for(const s of t)if(e===s.name.toLowerCase()){r.push(s.name),i=!0,n&&n.push(a);break}!i&&s&&s.push(a)}return r}async function G(e,t,i,r,a){if(0===t.length)return[];const d=e.attributeStorageInfo;if(Object(o["k"])(e.associatedLayer))try{return await B(e.associatedLayer,t,i,r)}catch(c){if(e.associatedLayer.loaded)throw c}if(d){const c=q(t,i,a);if(Object(o["j"])(c))throw new n["a"]("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const l=e.parsedUrl.path,u=await Promise.all(c.map(e=>H(l,d,e.node,e.indices,r).then(t=>{for(let i=0;i<e.graphics.length;i++){const r=e.graphics[i],s=t[i];if(r.attributes)for(const e in r.attributes)e in s||(s[e]=r.attributes[e]);r.attributes=s}return e.graphics})));return Object(s["f"])(u)}throw new n["a"]("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function q(e,t,i){const r=new Map,s=[],n=i();for(const a of e){const e=a.attributes[t];for(let t=0;t<n.length;t++){const i=n[t],o=i.featureIds.indexOf(e);if(o>=0){let e=r.get(i.node);e||(e={node:i.node,indices:[],graphics:[]},s.push(e),r.set(i.node,e)),e.indices.push(o),e.graphics.push(a);for(let i=t;i>0;i--)n[i]=n[i-1];n[0]=i;break}}}return s}async function B(e,t,i,r){t.sort((e,t)=>e.attributes[i]-t.attributes[i]);const s=t.map(e=>e.attributes[i]),n=[],a=U(r,e.fields,{originalFields:n}),o=await z(e,s,a);for(let d=0;d<t.length;d++){const e=t[d],i=o[d],r={};if(e.attributes)for(const t in e.attributes)r[t]=e.attributes[t];for(let t=0;t<n.length;t++)r[n[t]]=i[a[t]];e.attributes=r}return t}function z(e,t,i){const r=e.capabilities.query.maxRecordCount;if(null!=r&&t.length>r){const n=Object(s["n"])(t,r);return Promise.all(n.map(t=>z(e,t,i))).then(s["f"])}const a=new w["a"]({objectIds:t,outFields:i,orderByFields:[e.objectIdField]});return e.queryFeatures(a).then(e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map(e=>e.attributes);throw new n["a"]("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")})}function H(e,t,i,s,n){const a=[];for(const r of t)if(r&&-1!==n.indexOf(r.name)){const t=`${e}/nodes/${i.resources.attributes}/attributes/${r.key}/0`;a.push({url:t,storageInfo:r})}return Object(d["j"])(a.map(e=>Object(r["default"])(e.url,{responseType:"array-buffer"}).then(t=>Object(C["d"])(e.storageInfo,t.data)))).then(e=>{const t=[];for(const i of s){const r={};for(let t=0;t<e.length;t++)null!=e[t].value&&(r[a[t].storageInfo.name]=K(e[t].value,i));t.push(r)}return t})}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(V||(V={}));const Q=-32768,$=-(2**31);function K(e,t){if(!e)return null;const i=e[t];return Object(c["f"])(e)?i===Q?null:i:Object(c["g"])(e)?i===$?null:i:i!=i?null:i}function X(e){const t=e.store.indexCRS||e.store.geographicCRS,i=void 0===t?e.store.indexWKT:void 0;if(i){if(!e.spatialReference)throw new n["a"]("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indeWKT in the scene layer store but no layer spatial reference",{});if(i!==e.spatialReference.wkt)throw new n["a"]("layerview:store-spatial-reference-wkt-index-incompatible","The indeWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const r=t?new j["a"](E(t)):e.spatialReference;return r.equals(e.spatialReference)?e.spatialReference:r}function W(e){const t=e.store.vertexCRS||e.store.projectedCRS,i=void 0===t?e.store.vertexWKT:void 0;if(i){if(!e.spatialReference)throw new n["a"]("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(i!==e.spatialReference.wkt)throw new n["a"]("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const r=t?new j["a"](E(t)):e.spatialReference;return r.equals(e.spatialReference)?e.spatialReference:r}function Y(e,t){return Object(o["j"])(t)?"@null":t===Object(O["g"])(t)?"@ECEF":e.equals(t)?"":null!=t.wkid?"@"+t.wkid:null}function Z(e,t,i){if(!Object(y["b"])(e,t))throw new n["a"]("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});if("local"===i&&!J(e,t))throw new n["a"]("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{})}function J(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function ee(e,t,i){const r=X(e),s=W(e);Z(r,t,i),Z(s,t,i)}function te(e){return(null==e.geometryType||"triangles"===e.geometryType)&&(null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes&&null!=e.vertexAttributes.position}function ie(e){if(null==e.store||null==e.store.defaultGeometrySchema||!te(e.store.defaultGeometrySchema))throw new n["a"]("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function re(e,t){ee(e,t.spatialReference,t.viewingMode)}function se(e){return null!=e.geometryType&&"points"===e.geometryType&&(null==e.topology||"PerAttributeArray"===e.topology)&&(null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes&&null!=e.vertexAttributes.position}function ne(e){if(null==e.store||null==e.store.defaultGeometrySchema||!se(e.store.defaultGeometrySchema))throw new n["a"]("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function ae(e,t){Z(e.spatialReference,t.spatialReference,t.viewingMode)}function oe(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function de(e){return"mesh-3d"===e.type}function ce(e){if(null==e||!oe(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.getSymbols();if(0===t.length)return!0;for(const i of t){if(!de(i)||0===i.symbolLayers.length)return!0;for(const e of i.symbolLayers.items)if("fill"!==e.type||Object(o["j"])(e.material)||Object(o["j"])(e.material.color)||"replace"!==e.material.colorMixMode)return!0}return!1}const le=Object(N["c"])({color:[0,0,0,0],opacity:0});class ue{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function he(e){const t=new ue;let i=!1,r=!1;for(const s of e.symbolLayers.items)if("fill"===s.type&&s.enabled){const e=s.material,n=s.edges;if(Object(o["k"])(e)&&!i){const r=e.color,n=Object(S["c"])(e.colorMixMode);Object(o["k"])(r)?t.material={color:[r.r/255,r.g/255,r.b/255],alpha:r.a,colorMixMode:n}:t.material={color:[1,1,1],alpha:1,colorMixMode:S["a"].Multiply},t.castShadows=s.castShadows,i=!0}Object(o["k"])(n)&&!r&&(t.edgeMaterial=Object(N["b"])(n,{}),r=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:S["a"].Multiply}),t}function be(e,t){return(0|e)+(0|t)|0}function fe(e,t,i,r,s=0){r===Object(O["g"])(r)?t.isGeographic?we(e,i,t,s):xe(e,i,t,s):t.isWGS84&&(r.isWebMercator||Object(x["k"])(r))?ge(t,e,r,i,s):t.isWebMercator&&Object(x["k"])(r)?je(t,e,r,i,s):e===i?(i.center[2]+=s,Object(y["p"])(i.center,t,0,i.center,r,0,1)):(Object(p["y"])(i.center,e.center[0],e.center[1],e.center[2]+s),Object(y["p"])(i.center,t,0,i.center,r,0,1),Object(f["a"])(i.quaternion,e.quaternion),Object(p["m"])(i.halfSize,e.halfSize))}function ge(e,t,i,r,s){Object(p["m"])(ye,t.center),ye[2]+=s;const n=Object(O["g"])(i);Object(y["p"])(ye,e,0,ye,n,0,1),ve(n,t,ye,i,r)}const pe=new Float64Array(24),me={data:pe,size:3},_e=Object(m["f"])(),ye=Object(m["f"])(),Oe=Object(u["b"])();function je(e,t,i,r,s){Object(p["m"])(ye,t.center),ye[2]+=s,ve(e,t,ye,i,r)}function ve(e,t,i,r,s){const n=Object(l["h"])(Oe,t.quaternion);for(let a=0;a<8;++a){for(let e=0;e<3;++e)_e[e]=t.halfSize[e]*(0!=(a&1<<e)?-1:1);for(let e=0;e<3;++e){let t=i[e];for(let i=0;i<3;++i)t+=_e[i]*n[3*i+e];pe[3*a+e]=t}}Object(y["p"])(pe,e,0,pe,r,0,8),Object(D["c"])(me,s)}function xe(e,t,i,r){Object(D["d"])(e,Se),Object(p["y"])(t.center,e.center[0],e.center[1],e.center[2]+r),Object(y["d"])(i,t.center,Ie,Object(O["g"])(i)),Object(p["y"])(t.center,Ie[12],Ie[13],Ie[14]);const s=2*Math.sqrt(1+Ie[0]+Ie[5]+Ie[10]);Ne[0]=(Ie[6]-Ie[9])/s,Ne[1]=(Ie[8]-Ie[2])/s,Ne[2]=(Ie[1]-Ie[4])/s,Ne[3]=.25*s,Object(f["f"])(t.quaternion,Ne,e.quaternion),Object(f["b"])(Ne,t.quaternion);let n=0,a=0,o=0;for(const d of Se)d[2]+=r,Object(y["p"])(d,i,0,d,Object(O["g"])(i),0,1),Object(p["B"])(Me,d,t.center),Object(p["w"])(Me,Me,Ne),n=Math.max(n,Math.abs(Me[0])),a=Math.max(a,Math.abs(Me[1])),o=Math.max(o,Math.abs(Me[2]));Object(p["y"])(t.halfSize,n,a,o)}function we(e,t,i,r){const s=Object(O["e"])(i),n=1+Math.max(0,r)/(s.radius+e.center[2]);Object(p["y"])(t.center,e.center[0],e.center[1],e.center[2]+r),Object(y["p"])(t.center,i,0,t.center,Object(O["g"])(i),0,1),Object(f["a"])(t.quaternion,e.quaternion),Object(f["b"])(Ne,e.quaternion),Object(p["y"])(Me,0,0,1),Object(p["w"])(Me,Me,Ne),Object(p["y"])(Me,e.halfSize[0]*Math.abs(Me[0]),e.halfSize[1]*Math.abs(Me[1]),e.halfSize[2]*Math.abs(Me[2])),Object(p["g"])(Me,Me,s.inverseFlattening),Object(p["h"])(t.halfSize,e.halfSize,Me),Object(p["g"])(t.halfSize,t.halfSize,n)}function Ce(e,t,i,r,s,n){if(!n||0===n.length||Object(o["j"])(t))return null;const a=Object(I["a"])(e.mbs,s,i,t);let d;Object(h["b"])(Pe,a);const c=()=>{if(!d)if(d=Se,Object(v["n"])(Ee),Object(o["k"])(e.serviceObb)){fe(e.serviceObb,i,Fe,t,s),Object(D["d"])(Fe,d);for(const e of d)Object(p["s"])(e,e,Pe),Object(v["q"])(Ee,e)}else{const r=e.mbs,n=r[3];Object(y["y"])(r,i,Me,t),Object(p["s"])(Me,Me,Pe),Me[2]+=s;for(let e=0;e<8;++e){const t=1&e?n:-n,i=2&e?n:-n,r=4&e?n:-n,s=d[e];Object(p["m"])(s,[Me[0]+t,Me[1]+i,Me[2]+r]),Object(v["q"])(Ee,s)}}};let l=1/0,u=-1/0;const b=e=>{if("replace"!==e.type)return;const i=e.geometry;if(!i.hasZ)return;Object(v["n"])(De);const s=i.spatialReference||r,n=i.rings.reduce((e,i)=>i.reduce((e,i)=>(Object(y["y"])(i,s,Me,t),Object(p["s"])(Me,Me,Pe),Object(v["q"])(De,Me),Math.min(Me[2],e)),e),1/0);c(),Object(v["w"])(Ee,De)&&(l=Math.min(l,n),u=Math.max(u,n))};if(n.forEach(e=>b(e)),l===1/0)return null;const f=(e,t,i)=>{Object(p["s"])(Me,i,a),e[t+0]=Me[0],e[t+1]=Me[1],e[t+2]=Me[2],t+=24,i[2]=l,Object(p["s"])(Me,i,a),e[t+0]=Me[0],e[t+1]=Me[1],e[t+2]=Me[2],t+=24,i[2]=u,Object(p["s"])(Me,i,a),e[t+0]=Me[0],e[t+1]=Me[1],e[t+2]=Me[2]};for(let o=0;o<8;++o)f(Ae.data,3*o,d[o]);return Object(D["c"])(Ae)}const Ie=Object(b["d"])(),Ne=Object(g["b"])(),Se=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],De=Object(v["l"])(),Ee=Object(v["l"])(),Fe=Object(D["e"])(),Me=[0,0,0],Ae={data:new Array(72),size:3},Pe=Object(b["d"])()},f426:function(e,t,i){"use strict";i.d(t,"a",(function(){return s}));var r=i("c1da");function s(){return{requiredFields:{type:[String],readOnly:!0},availableFields:{type:[String],readOnly:!0,get:function(){const{layer:e,layer:{fieldsIndex:t},requiredFields:i}=this;return e.outFields?Object(r["j"])(t,[...Object(r["u"])(t,e.outFields),...i]):Object(r["j"])(t,i)}}}}},f7f0:function(e,t,i){"use strict";i.d(t,"a",(function(){return c}));var r=i("a4ee"),s=i("ce50"),n=i("b2b2"),a=(i("e92d"),i("cea0"),i("b50f"),i("c120"),i("2dd4"),i("d386")),o=i("c1da"),d=i("ad73");const c=e=>{let t=class extends e{_validateFetchPopupFeatures(e){const{layer:t}=this,{popupEnabled:i}=t;return i?Object(d["a"])(t,e)?void 0:new s["a"]("scenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{layer:t}):new s["a"]("scenelayerview3d:fetchPopupFeatures","Popups are disabled",{layer:t})}async prepareFetchPopupFeatures(e){}async fetchPopupFeatures(e,t){const i=this._validateFetchPopupFeatures(t);if(i)return Promise.reject(i);const r=Object(n["k"])(t)?t.clientGraphics:null;if(!r||0===r.length)return Promise.resolve([]);const s="scene"===this.layer.type&&Object(n["k"])(this.layer.associatedLayer)?this.layer.associatedLayer:this.layer,a=Object(o["u"])(this.layer.fieldsIndex,await Object(d["b"])(s,Object(d["a"])(this.layer,t)));await this.prepareFetchPopupFeatures(a);const c=new Set,l=[],u=[];for(const n of r)Object(o["s"])(a,n,c)?u.push(n):l.push(n);return 0===u.length?Promise.resolve(l):this.whenGraphicAttributes(u,[...c]).catch(()=>u).then(e=>l.concat(e))}};return t=Object(r["a"])([Object(a["a"])("esri.views.3d.layers.support.PopupSceneLayerView")],t),t}}}]);
  2. //# sourceMappingURL=chunk-39efb0b6.127adb4c.js.map