/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../chunks/_rollupPluginBabelHelpers","../../../../Graphic","../../../../geometry/Polygon","../../../../symbols/FillSymbol3DLayer","../../../../symbols/PointSymbol3D","../../../../symbols/PolygonSymbol3D","../../../../symbols/TextSymbol3DLayer","../../terrain/TilingScheme"],(function(e,t,i,s,a,n,o,r,h){"use strict";const l=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];let c=function(){function e(e,t,i){this.loadingGraphics=new Map,this.loadedGraphics=new Map,this.pendingGraphics=new Map,this._enabled=!0,this.tileFetcher=e,this.view=i,this.tilingScheme=new h.TilingScheme(t),this.loadedSymbols=l.map((e=>new o(new a({material:{color:[e[0],e[1],e[2],.6]},outline:{color:"black",size:1}})))),this.loadingSymbols=[new o(new a({material:{color:[200,200,200,.4]},outline:{color:[30,30,30],size:1}}))],this.pendingSymbols=[new o(new a({material:{color:[100,100,100,.4]},outline:{color:[30,30,30],size:1}}))],this.dataExtentSymbol=new o(new a({material:{color:[0,0,0,0]},outline:{color:"green",size:4}}))}var c=e.prototype;return c.destroy=function(){this.enabled=!1},c.update=function(){this._enabled?(this._synchronizeMaps(this.loadingGraphics,{filter:e=>e.isFetching,symbols:this.loadingSymbols}),this._synchronizeMaps(this.loadedGraphics,{filter:e=>!e.isFetching,symbols:this.loadedSymbols}),this._synchronizeMaps(this.pendingGraphics,{filter:e=>!e.isFetching,symbols:this.pendingSymbols}),this.showDataExtent(this.tileFetcher.filterExtent)):(this.loadingGraphics.forEach((e=>{this.view.graphics.removeMany(e)})),this.loadingGraphics.clear(),this.loadedGraphics.forEach((e=>{this.view.graphics.removeMany(e)})),this.loadedGraphics.clear(),this.pendingGraphics.forEach((e=>{this.view.graphics.removeMany(e)})),this.pendingGraphics.clear(),this.dataExtentGraphic&&(this.view.graphics.remove(this.dataExtentGraphic),this.dataExtentGraphic=null))},c.showDataExtent=function(e){if(this.dataExtentGraphic&&(this.view.graphics.remove(this.dataExtentGraphic),this.dataExtentGraphic=null),!e)return;const t=s.fromExtent(e);this.dataExtentGraphic=new i({geometry:t,symbol:this.dataExtentSymbol}),this.view.graphics.add(this.dataExtentGraphic)},c._synchronizeMaps=function(e,t){const s=[];e.forEach(((e,i)=>{const a=this.tileFetcher.test.getFeatureTileById(i);a&&t.filter(a)||(this.view.graphics.removeMany(e),s.push(i))})),s.forEach((t=>e.delete(t))),this.tileFetcher.test.forEachFeatureTile((s=>{if(t.filter(s)&&!e.has(s.id)){const[a,o,h]=s.descriptor.lij;this.tilingScheme.ensureMaxLod(a);const l=this.tilingScheme.getExtentGeometry(a,o,h),c=[new i({geometry:l,symbol:t.symbols[a%t.symbols.length]}),new i({geometry:l.center,symbol:new n({verticalOffset:{screenLength:40/.75},callout:{type:"line",color:"white",border:{color:"black"}},symbolLayers:[new r({text:`${a}/${o}/${h}`,halo:{color:"white",size:1/.75},material:{color:"black"},size:16})]})})];e.set(s.id,c),this.view.graphics.addMany(c)}}))},t._createClass(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e,this.update()}}]),e}();e.FeatureTileFetcher3DDebugger=c,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
