import { n as n2, t } from "./chunk-PVFGZTPJ.js"; import "./chunk-TJ4DVYZ7.js"; import "./chunk-E5TKVDJT.js"; import "./chunk-O6KMIRUU.js"; import "./chunk-264YGWEE.js"; import { i } from "./chunk-YG7DNOY4.js"; import { u, y as y3 } from "./chunk-KUAEOLV3.js"; import "./chunk-ZLQP3WDC.js"; import "./chunk-JBMHQ5RK.js"; import "./chunk-WBWQJQK4.js"; import "./chunk-TDS6IBMU.js"; import "./chunk-DBT4KOKX.js"; import "./chunk-2GP5D74I.js"; import "./chunk-EPMXCACW.js"; import "./chunk-UWKVAZQ6.js"; import "./chunk-T2SKWJGU.js"; import "./chunk-UO3LS2M5.js"; import "./chunk-H2VOWDMO.js"; import "./chunk-QISOH77W.js"; import "./chunk-XO5VJRK4.js"; import "./chunk-3WXSWAUV.js"; import "./chunk-27YO3FKC.js"; import "./chunk-EQNT4A7P.js"; import "./chunk-4OM3EX6P.js"; import "./chunk-3OFVLRSL.js"; import "./chunk-IQBIGNPU.js"; import "./chunk-K7B6OWCU.js"; import { r } from "./chunk-WNPL3C7R.js"; import { y as y2 } from "./chunk-E7ZLMIQ7.js"; import "./chunk-UDYHZLTE.js"; import "./chunk-QC7NCR5N.js"; import { h } from "./chunk-VQXMCZYH.js"; import "./chunk-JQUWFKNU.js"; import "./chunk-RWQH5X3O.js"; import "./chunk-6334AFGG.js"; import { e as e2 } from "./chunk-TFHLTN6F.js"; import "./chunk-O3JQY77G.js"; import "./chunk-E3G7BRZB.js"; import "./chunk-JKFWEHNK.js"; import "./chunk-EDHROVWI.js"; import "./chunk-3IRT3YKJ.js"; import "./chunk-YZVAB3DF.js"; import "./chunk-PJNBFKPF.js"; import "./chunk-C7742RNZ.js"; import { l } from "./chunk-TJV6ODRM.js"; import "./chunk-3WQOA5CB.js"; import "./chunk-FZQZIM7U.js"; import "./chunk-CZBRZ6SU.js"; import "./chunk-VGWC3IKZ.js"; import "./chunk-2H5MD622.js"; import "./chunk-UVVU4UUO.js"; import "./chunk-X4SA4ELJ.js"; import "./chunk-ZAY3CMAZ.js"; import "./chunk-3GZSQU56.js"; import "./chunk-ZYRIJWLX.js"; import "./chunk-RYY6632W.js"; import "./chunk-DW42UVIT.js"; import "./chunk-YAEIHDJH.js"; import "./chunk-TJNOJH33.js"; import "./chunk-OSHI574D.js"; import "./chunk-ETGAZ7LF.js"; import "./chunk-75U5LM2V.js"; import "./chunk-RMDDCMKS.js"; import "./chunk-VCH45Q2I.js"; import "./chunk-LBW34VZ2.js"; import "./chunk-GSSTTHIT.js"; import "./chunk-IM3LVQXV.js"; import "./chunk-55RWC67C.js"; import "./chunk-HZRKBTHJ.js"; import "./chunk-6T6G6LCQ.js"; import "./chunk-YEJL5NEF.js"; import { E } from "./chunk-PQFTYGF5.js"; import { e, n5 as n, y3 as y } from "./chunk-2Z2TG5CU.js"; import "./chunk-6KZ2LTDA.js"; import "./chunk-U2XHEJM7.js"; import "./chunk-SQOPWYIT.js"; import { j } from "./chunk-V6P2MAQQ.js"; import { s2 as s } from "./chunk-E5O6P5I2.js"; import "./chunk-SPWQ3AWG.js"; import "./chunk-2TIUKVZN.js"; import "./chunk-YXWMMD76.js"; import "./chunk-S5KM4IGW.js"; // node_modules/@arcgis/core/views/2d/layers/WMTSLayerView2D.js var y4 = [102113, 102100, 3857, 3785, 900913]; var _ = [0, 0]; var w = class extends i(t(y3(u))) { constructor() { super(...arguments), this._tileStrategy = null, this._fetchQueue = null, this._tileRequests = /* @__PURE__ */ new Map(), this.layer = null; } get tileMatrixSet() { const e3 = this._getTileMatrixSetBySpatialReference(this.layer.activeLayer); return e3 ? (e3.id !== this.layer.activeLayer.tileMatrixSetId && (this.layer.activeLayer.tileMatrixSetId = e3.id), e3) : null; } update(e3) { this._fetchQueue.pause(), this._fetchQueue.state = e3.state, this._tileStrategy.update(e3), this._fetchQueue.resume(); } attach() { if (!this.tileMatrixSet) return; const { tileInfo: e3 } = this.tileMatrixSet; this._tileInfoView = new h(e3), this._fetchQueue = new y2({ tileInfoView: this._tileInfoView, concurrency: 16, process: (e4, t2) => this.fetchTile(e4, t2) }), this._tileStrategy = new r({ cachePolicy: "keep", resampling: true, acquireTile: (e4) => this.acquireTile(e4), releaseTile: (e4) => this.releaseTile(e4), tileInfoView: this._tileInfoView }), this.handles.add(l(() => { var _a, _b; return [(_b = (_a = this.layer) == null ? void 0 : _a.activeLayer) == null ? void 0 : _b.styleId, this.tileMatrixSet]; }, () => this._refresh()), this.declaredClass), super.attach(); } detach() { var _a, _b; super.detach(), this.handles.remove(this.declaredClass), (_a = this._tileStrategy) == null ? void 0 : _a.destroy(), (_b = this._fetchQueue) == null ? void 0 : _b.destroy(), this._fetchQueue = this._tileStrategy = this._tileInfoView = null; } moveStart() { this.requestUpdate(); } viewChange() { this.requestUpdate(); } moveEnd() { this.requestUpdate(); } releaseTile(e3) { this._fetchQueue.abort(e3.key.id), this._bitmapView.removeChild(e3), e3.once("detach", () => e3.destroy()), this.requestUpdate(); } acquireTile(e3) { const t2 = this._bitmapView.createTile(e3), i2 = t2.bitmap; return [i2.x, i2.y] = this._tileInfoView.getTileCoords(_, t2.key), i2.resolution = this._tileInfoView.getTileResolution(t2.key), [i2.width, i2.height] = this._tileInfoView.tileInfo.size, this._enqueueTileFetch(t2), this._bitmapView.addChild(t2), this.requestUpdate(), t2; } async doRefresh() { !this.attached || this.updateRequested || this.suspended || this._refresh(); } isUpdating() { var _a, _b; return (_b = (_a = this._fetchQueue) == null ? void 0 : _a.updating) != null ? _b : false; } async fetchTile(e3, t2 = {}) { const s2 = "tilemapCache" in this.layer ? this.layer.tilemapCache : null, { signal: r2, resamplingLevel: a = 0 } = t2; if (!s2) return this._fetchImage(e3, r2); const l2 = new e2(0, 0, 0, 0); let o; try { await s2.fetchAvailabilityUpsample(e3.level, e3.row, e3.col, l2, { signal: r2 }), o = await this._fetchImage(l2, r2); } catch (h2) { if (j(h2)) throw h2; if (a < 3) { const i2 = this._tileInfoView.getTileParentId(e3.id); if (i2) { const s3 = new e2(i2), r3 = await this.fetchTile(s3, { ...t2, resamplingLevel: a + 1 }); return n2(this._tileInfoView, r3, s3, e3); } } throw h2; } return n2(this._tileInfoView, o, l2, e3); } canResume() { const e3 = super.canResume(); return e3 ? null !== this.tileMatrixSet : e3; } supportsSpatialReference(e3) { return this.layer.activeLayer.tileMatrixSets.some((t2) => E(t2.tileInfo.spatialReference, e3)); } async _enqueueTileFetch(e3) { if (!this._fetchQueue.has(e3.key.id)) { try { const t2 = await this._fetchQueue.push(e3.key); e3.bitmap.source = t2, e3.bitmap.width = this._tileInfoView.tileInfo.size[0], e3.bitmap.height = this._tileInfoView.tileInfo.size[1], e3.once("attach", () => this.requestUpdate()); } catch (s2) { j(s2) || s.getLogger(this.declaredClass).error(s2); } this.requestUpdate(); } } async _fetchImage(e3, t2) { return this.layer.fetchImageBitmapTile(e3.level, e3.row, e3.col, { signal: t2 }); } _refresh() { this._fetchQueue.reset(), this._tileStrategy.tiles.forEach((e3) => { if (!e3.bitmap.source) return; const t2 = { id: e3.key.id, fulfilled: false, promise: this._fetchQueue.push(e3.key).then((t3) => { e3.bitmap.source = t3; }).catch((t3) => { j(t3) || (e3.bitmap.source = null); }).finally(() => { e3.requestRender(), t2.fulfilled = true; }) }; this._tileRequests.set(e3, t2); }); } _getTileMatrixSetBySpatialReference(e3) { const t2 = this.view.spatialReference; if (!e3.tileMatrixSets) return null; let i2 = e3.tileMatrixSets.find((e4) => E(e4.tileInfo.spatialReference, t2)); return !i2 && t2.isWebMercator && (i2 = e3.tileMatrixSets.find((e4) => y4.includes(e4.tileInfo.spatialReference.wkid))), i2; } }; e([y()], w.prototype, "_fetchQueue", void 0), e([y({ readOnly: true })], w.prototype, "tileMatrixSet", null), w = e([n("esri.views.2d.layers.WMTSLayerView2D")], w); var g = w; export { g as default }; //# sourceMappingURL=WMTSLayerView2D-2M4XG2BY.js.map