/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../../../chunks/_rollupPluginBabelHelpers","../../../../../chunks/tslib.es6","../../../../../core/Logger","../../../../../core/accessorSupport/ensureType","../../../../../core/arrayUtils","../../../../../core/has","../../../../../core/accessorSupport/set","../../../../../core/accessorSupport/decorators/subclass","../../../../../renderers/support/heatmapUtils","../../../engine/BitmapTileContainer","./BaseTileRenderer","./support/HeatmapSource"],(function(e,t,i,n,r,s,o,a,c,l,u,p){"use strict";let h=function(t){function i(e){var i;return(i=t.call(this,e)||this)._intensityInfo={minDensity:0,maxDensity:0},i.type="heatmap",i.featuresView={attributeView:{initialize:()=>{},requestUpdate:()=>{}},requestRender:()=>{}},i._container=new l.BitmapTileContainer(e.tileInfoView),i}e._inheritsLoose(i,t);var n=i.prototype;return n.createTile=function(e){const t=this._container.createTile(e);return this.tileInfoView.getTileCoords(t.bitmap,e),t.bitmap.resolution=this.tileInfoView.getTileResolution(e),t},n.onConfigUpdate=function(){const e=this.layer.renderer;if("heatmap"===e.type){const{minDensity:t,maxDensity:i,colorStops:n}=e;this._intensityInfo.minDensity=t,this._intensityInfo.maxDensity=i,this._gradient=c.generateGradient(n),this.tiles.forEach((e=>{const n=e.bitmap.source;n&&(n.minDensity=t,n.maxDensity=i,n.gradient=this._gradient,e.bitmap.invalidateTexture())}))}},n.hitTest=function(){return Promise.resolve([])},n.install=function(e){e.addChild(this._container)},n.uninstall=function(e){this._container.removeAllChildren(),e.removeChild(this._container)},n.disposeTile=function(e){this._container.removeChild(e),e.destroy()},n.supportsRenderer=function(e){return e&&"heatmap"===e.type},n.onTileData=function(e){const t=this.tiles.get(e.tileKey);if(!t)return;const i=e.intensityInfo,{minDensity:n,maxDensity:r}=this._intensityInfo,s=t.bitmap.source||new p.HeatmapSource;s.intensities=i&&i.matrix||null,s.minDensity=n,s.maxDensity=r,s.gradient=this._gradient,t.bitmap.source=s,this._container.addChild(t),this._container.requestRender(),this.requestUpdate()},n.onTileError=function(e){console.error(e)},n.lockGPUUploads=function(){},n.unlockGPUUploads=function(){},n.fetchResource=function(e,t){return console.error(e),Promise.reject()},i}(u);h=t.__decorate([a.subclass("esri.views.2d.layers.features.tileRenderers.HeatmapTileRenderer")],h);return h}));
