import { a } from "./chunk-YJKEIUMW.js"; import { u } from "./chunk-546QCRS4.js"; import { D, G, M, P } from "./chunk-MI7HWWFL.js"; import { e } from "./chunk-ZHRMTKME.js"; import { t as t2 } from "./chunk-MFFE4I2S.js"; import { M as M2, b, h, i, r as r2 } from "./chunk-CRGVDJI6.js"; import { r, t } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/views/2d/engine/ImageryBitmapSource.js var i2 = class { constructor(e2, t3, i3) { this.pixelBlock = e2, this.extent = t3, this.originalPixelBlock = i3; } get width() { return r(this.pixelBlock) ? this.pixelBlock.width : 0; } get height() { return r(this.pixelBlock) ? this.pixelBlock.height : 0; } render(e2) { const i3 = this.pixelBlock; if (t(i3)) return; const l = this.filter({ pixelBlock: i3 }); if (t(l.pixelBlock)) return; const r3 = l.pixelBlock.getAsRGBA(), o = e2.createImageData(l.pixelBlock.width, l.pixelBlock.height); o.data.set(r3), e2.putImageData(o, 0, 0); } getRenderedRasterPixels() { const e2 = this.filter({ pixelBlock: this.pixelBlock }); return t(e2.pixelBlock) ? null : { width: e2.pixelBlock.width, height: e2.pixelBlock.height, renderedRasterPixels: new Uint8Array(e2.pixelBlock.getAsRGBA().buffer) }; } }; // node_modules/@arcgis/core/views/2d/engine/Bitmap.js function m(t3) { return t3 && "render" in t3; } function g(t3) { return t3 && !("render" in t3); } function p(t3) { const e2 = document.createElement("canvas"); return e2.width = t3.width, e2.height = t3.height, t3.render(e2.getContext("2d")), e2; } function f(t3, e2, i3) { const s = { target: M.TEXTURE_2D, pixelFormat: P.RGBA, internalFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, wrapMode: D.CLAMP_TO_EDGE }; return e2 && i3 && (s.width = e2, s.height = i3), new u(t3, s); } var v = class extends a { constructor(t3 = null, e2, i3 = true) { super(), this.requestRenderOnSourceChangedEnabled = i3, this._textureInvalidated = true, this.stencilRef = 0, this.coordScale = [1, 1], this._height = void 0, this.pixelRatio = 1, this.resolution = 0, this.rotation = 0, this._source = null, this._width = void 0, this.x = 0, this.y = 0, this.blendFunction = e2, this.source = t3, this.requestRender = this.requestRender.bind(this); } destroy() { this._texture && (this._texture.dispose(), this._texture = null); } get isSourceScaled() { return this.width !== this.sourceWidth || this.height !== this.sourceHeight; } get height() { return this._height !== void 0 ? this._height : this.sourceHeight; } set height(t3) { this._height = t3; } get source() { return this._source; } set source(t3) { this._source = t3, this.invalidateTexture(); } get sourceHeight() { return this._source instanceof HTMLImageElement ? this._source.naturalHeight : this._source.height; } get sourceWidth() { return this._source instanceof HTMLImageElement ? this._source.naturalWidth : this._source.width; } get width() { return this._width !== void 0 ? this._width : this.sourceWidth; } set width(t3) { this._width = t3; } beforeRender(t3) { super.beforeRender(t3), this.updateTexture(t3.context); } invalidateTexture() { this._textureInvalidated || (this._textureInvalidated = true, this.requestRenderOnSourceChangedEnabled && this.requestRender()); } _createTransforms() { return { dvs: e() }; } setTransform(t3) { const n = r2(this.transforms.dvs), [u2, a2] = t3.toScreenNoRotation([0, 0], [this.x, this.y]), d = this.resolution / this.pixelRatio / t3.resolution, c = d * this.width, l = d * this.height, _ = Math.PI * this.rotation / 180; M2(n, n, t2(u2, a2)), M2(n, n, t2(c / 2, l / 2)), h(n, n, -_), M2(n, n, t2(-c / 2, -l / 2)), b(n, n, t2(c, l)), i(this.transforms.dvs, t3.displayViewMat3, n); } setSamplingProfile(t3) { this._texture && (t3.mips && !this._texture.descriptor.hasMipmap && this._texture.generateMipmap(), this._texture.setSamplingMode(t3.samplingMode)); } bind(t3, e2) { this._texture && t3.bindTexture(this._texture, e2); } updateTexture(e2) { if (!this.stage) return this._texture?.dispose(), void (this._texture = null); if (!this._textureInvalidated) return; this._textureInvalidated = false, this._texture || (this.source ? this._texture = f(e2, this.sourceWidth, this.sourceHeight) : this._texture = f(e2)); const i3 = this.source; if (i3) { if (this._texture.resize(this.sourceWidth, this.sourceHeight), m(i3)) if (i3 instanceof i2) { const e3 = i3.getRenderedRasterPixels(); this._texture.setData(r(e3) ? e3.renderedRasterPixels : null); } else this._texture.setData(p(i3)); else g(i3) && this._texture.setData(i3); this.ready(); } else this._texture.setData(null); } onAttach() { this.invalidateTexture(); } onDetach() { this.invalidateTexture(); } }; export { i2 as i, v }; //# sourceMappingURL=chunk-TWB5CT7V.js.map