/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../request.js";import r from"../core/Error.js";import{property as o,subclass as i}from"../core/accessorSupport/decorators.js";import s from"../geometry/Extent.js";import a from"../geometry/SpatialReference.js";import{create as l}from"../geometry/support/aaBoundingRect.js";import p from"./Layer.js";import{BlendLayer as n}from"./mixins/BlendLayer.js";import{RefreshableLayer as m}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as f}from"./mixins/ScaleRangeLayer.js";import{createTileBitmap as c}from"./support/imageBitmapUtils.js";import y from"./support/TileInfo.js";import{TileKey as u}from"./support/TileKey.js";var d;const h=new u(0,0,0);let g=d=class extends(n(f(m(p)))){constructor(e){super(e),this.tileInfo=y.create({spatialReference:a.WebMercator,size:256}),this.type="base-tile",this.fullExtent=new s(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,a.WebMercator),this.spatialReference=a.WebMercator}addResolvingPromise(e){super.addResolvingPromise(e)}getTileBounds(e,t,r,o){const i=o||l();return h.level=e,h.row=t,h.col=r,h.extent=i,this.tileInfo.updateTileInfo(h),i}fetchTile(e,r,o,i={}){const{signal:s}=i,a=this.getTileUrl(e,r,o),l={responseType:"image",signal:s,query:{...this.refreshParameters}};return t(a??"",l).then(e=>e.data)}async fetchImageBitmapTile(e,r,o,i={}){const{signal:s}=i;if(this.fetchTile!==d.prototype.fetchTile){const t=await this.fetchTile(e,r,o,i);return c(t,e,r,o,i)}const a=this.getTileUrl(e,r,o)??"",l={responseType:"blob",signal:s,query:{...this.refreshParameters}},{data:p}=await t(a,l);return c(p,e,r,o,i)}getTileUrl(){throw new r("basetilelayer:gettileurl-not-implemented","getTileUrl() is not implemented")}};e([o({type:y})],g.prototype,"tileInfo",void 0),e([o({type:["show","hide"]})],g.prototype,"listMode",void 0),e([o({readOnly:!0,value:"base-tile"})],g.prototype,"type",void 0),e([o({nonNullable:!0})],g.prototype,"fullExtent",void 0),e([o({type:a})],g.prototype,"spatialReference",void 0),g=d=e([i("esri.layers.BaseTileLayer")],g);export{g as default};
