/*
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","../../../../chunks/tslib.es6","../../../../core/Handles","../../../../core/handleUtils","../../../../core/accessorSupport/decorators/property","../../../../core/arrayUtils","../../../../core/has","../../../../core/accessorSupport/ensureType","../../../../core/accessorSupport/decorators/subclass","../../../../geometry/Polygon","../../../../geometry/support/aaBoundingRect","../../../support/TileTreeDebugger"],(function(e,t,r,o,n,s,a,i,u,l,c,d,g){"use strict";e.WorkerTileTreeDebugger=function(e){function r(t){var r;return(r=e.call(this,t)||this).handles=new o,r}t._inheritsLoose(r,e);var s=r.prototype;return s.initialize=function(){const e=setInterval((()=>this._fetchDebugInfo()),2e3);this.handles.add(n.makeHandle((()=>clearInterval(e))))},s.destroy=function(){this.handles.destroy()},s.getTiles=function(){if(!this.debugInfo)return[];const e=new Map,t=new Map;this.debugInfo.storedTiles.forEach((t=>{e.set(t.data.id,t.featureCount)})),this.debugInfo.pendingTiles.forEach((r=>{e.set(r.data.id,r.featureCount),t.set(r.data.id,r.state)}));const r=r=>{var o;const n=t.get(r),s=null!=(o=e.get(r))?o:"?";return n?`${n}:${s}\n${r}`:`store:${s}\n${r}`},o=new Map;return this.debugInfo.storedTiles.forEach((e=>{o.set(e.data.id,e.data)})),this.debugInfo.pendingTiles.forEach((e=>{o.set(e.data.id,e.data)})),Array.from(o.values()).map((e=>({lij:[e.level,e.row,e.col],geometry:c.fromExtent(d.toExtent(e.extent,this.view.spatialReference)),label:r(e.id)})))},s._fetchDebugInfo=function(){this.handle.getDebugInfo(null).then((e=>{this.debugInfo=e,this.update()}))},r}(g.TileTreeDebugger),r.__decorate([s.property({constructOnly:!0})],e.WorkerTileTreeDebugger.prototype,"handle",void 0),e.WorkerTileTreeDebugger=r.__decorate([l.subclass("esri.views.interactive.snapping.featureSources.WorkerTileTreeDebugger")],e.WorkerTileTreeDebugger),Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
