import { p as p2 } from "./chunk-CR67YDNV.js"; import { W, a as a3 } from "./chunk-H3QCF24A.js"; import { f as f4, u as u3 } from "./chunk-MNZXIBJ7.js"; import { a as a2 } from "./chunk-YJKEIUMW.js"; import "./chunk-JH3PLIM6.js"; import "./chunk-FCDUTNBY.js"; import "./chunk-LL6JU3GU.js"; import "./chunk-ZIWBDWEW.js"; import "./chunk-IQNZZCQJ.js"; import "./chunk-Q4LKAPDF.js"; import "./chunk-TODU7HVH.js"; import { I } from "./chunk-23ONSYIH.js"; import "./chunk-3T4BXU2T.js"; import "./chunk-YLVXZ2PS.js"; import "./chunk-EE6TL7XD.js"; import { c as c3, f as f3 } from "./chunk-GDB2KX4Y.js"; import { n as n2, u as u2 } from "./chunk-546QCRS4.js"; import "./chunk-QXZVBSBH.js"; import { r as r6 } from "./chunk-T4GXZJ3D.js"; import "./chunk-773XI6MQ.js"; import "./chunk-WFSV2B2I.js"; import "./chunk-J525NRN3.js"; import { D, F, G, L, P } from "./chunk-MI7HWWFL.js"; import { mt } from "./chunk-7BTL34ZE.js"; import { e as e3 } from "./chunk-ZHRMTKME.js"; import "./chunk-ZVHTCCQC.js"; import { r as r5 } from "./chunk-PCGDLSZ4.js"; import { p } from "./chunk-CAYFEZCR.js"; import { t as t2 } from "./chunk-MFFE4I2S.js"; import "./chunk-K3NA3LQS.js"; import "./chunk-LMCIAW5S.js"; import "./chunk-OTS3UE5B.js"; import "./chunk-6RAL4JPQ.js"; import "./chunk-LGW7TID4.js"; import "./chunk-3OHML7FO.js"; import "./chunk-G5AI6ZNE.js"; import "./chunk-FIYKFRB2.js"; import { z } from "./chunk-P4UZNLD5.js"; import "./chunk-FYNVVMWY.js"; import "./chunk-Q52DVFYK.js"; import "./chunk-HBMVUVZX.js"; import { M as M2, f as f2, h as h2, i as i2, r as r4 } from "./chunk-CRGVDJI6.js"; import { un } from "./chunk-DH2OBAUC.js"; import "./chunk-TNLRDNTC.js"; import "./chunk-6P6NA7JB.js"; import "./chunk-3D3QEPRE.js"; import "./chunk-XLV7RUSE.js"; import "./chunk-NTUXR253.js"; import "./chunk-RMX2AZ4P.js"; import "./chunk-NE3ESGA6.js"; import { a, f, h, l } from "./chunk-YIS6BAC3.js"; import "./chunk-7XXXCK2A.js"; import "./chunk-WJW5DUN6.js"; import "./chunk-PJ7ZQ4VD.js"; import "./chunk-WDLTDV2L.js"; import "./chunk-TERAW6FT.js"; import { c as c2, u } from "./chunk-N2663GRX.js"; import "./chunk-O4FY3ITT.js"; import { c } from "./chunk-WEMIK25H.js"; import "./chunk-7N4X6GF3.js"; import "./chunk-JXW4QTJA.js"; import "./chunk-UXF37FQ4.js"; import "./chunk-ZOEK6QHJ.js"; import { i2 as i } from "./chunk-XNLG7T2T.js"; import "./chunk-IR4PV7VK.js"; import "./chunk-2Z6LERTI.js"; import { v2 as v } from "./chunk-OWVBLVP3.js"; import "./chunk-AFZ7XSEW.js"; import "./chunk-MXB2XLKV.js"; import "./chunk-YBSUITLL.js"; import { j } from "./chunk-ALDCDSPV.js"; import "./chunk-DT6EAZQ5.js"; import "./chunk-HNOZUNJ4.js"; import "./chunk-VNFRAYHO.js"; import "./chunk-R5IG2D6H.js"; import "./chunk-VBRY5KJM.js"; import "./chunk-PDKDCAAD.js"; import { M2 as M, s2 as s3 } from "./chunk-ECW2QABR.js"; import "./chunk-GCDJLKH4.js"; import { R } from "./chunk-MRJEICT6.js"; import { d, e, n2 as n, y3 as y } from "./chunk-Y3WMVFTW.js"; import "./chunk-SAS7RONY.js"; import "./chunk-WSRBH7BF.js"; import { r as r2 } from "./chunk-IHXECKQQ.js"; import { g, r2 as r3 } from "./chunk-ULGDPLM2.js"; import { s, s3 as s2 } from "./chunk-EMJ4ZSM2.js"; import "./chunk-IKP3YN53.js"; import { e as e2, r, t } from "./chunk-GZT4BVFP.js"; import "./chunk-A5ICIBVI.js"; // node_modules/@arcgis/core/layers/support/mediaUtils.js var a4 = class extends y { constructor(o) { super(o); } get bounds() { const o = this.coords; return t(o) ? null : c2(o.extent); } get coords() { const o = e2(this.element.georeference)?.coords; return un(o, this.spatialReference).geometry; } get normalizedCoords() { return v.fromJSON(p2(this.coords)); } get normalizedBounds() { return r(this.normalizedCoords) ? c2(this.normalizedCoords.extent) : null; } }; e([d()], a4.prototype, "spatialReference", void 0), e([d()], a4.prototype, "element", void 0), e([d()], a4.prototype, "bounds", null), e([d()], a4.prototype, "coords", null), e([d()], a4.prototype, "normalizedCoords", null), e([d()], a4.prototype, "normalizedBounds", null), a4 = e([n("esri.layers.support.media.MediaElementView")], a4); // node_modules/@arcgis/core/views/2d/engine/webgl/Overlay.js var _ = class extends a2 { constructor(s4) { super(), this.elementView = s4, this.isWrapAround = false, this._vertices = new Float32Array(20), this._handles = [], this._handles.push(l(() => this.elementView.element.opacity, (e4) => this.opacity = e4, h), l(() => [this.elementView.coords], () => { this.requestRender(); }, h), f(() => this.elementView.element.loaded, () => { const e4 = this.elementView.element; this.ready(), e4.type === "video" && r(e4.content) && this._handles.push(r3(e4.content, "play", () => this.requestRender())); }, h)), s4.element.load().catch((t3) => { s.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new s2("element-load-error", "Element cannot be displayed", { element: s4, error: t3 })); }); } destroy() { this._handles.forEach((e4) => e4.remove()), this.texture?.dispose(), this.texture = null; } get dvsMat3() { return this.parent.dvsMat3; } beforeRender(e4) { const { context: t3 } = e4, r7 = this.elementView.element.content; if (r(r7)) { const e5 = r7 instanceof HTMLImageElement, i3 = r7 instanceof HTMLVideoElement, o = e5 ? r7.naturalWidth : i3 ? r7.videoWidth : r7.width, n3 = e5 ? r7.naturalHeight : i3 ? r7.videoHeight : r7.height; this.texture ? i3 && !r7.paused && (this.texture.setData(r7), this.requestRender(), (n2(t3.gl) || i(o) && i(n3)) && this.texture.generateMipmap()) : (this.texture = new u2(t3, { pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.LINEAR, wrapMode: D.CLAMP_TO_EDGE, width: o, height: n3 }, r7), (n2(t3.gl) || i(o) && i(n3)) && this.texture.generateMipmap(), i3 && !r7.paused && this.requestRender()); } super.beforeRender(e4); } _createTransforms() { return null; } updateDrawCoords(e4, t3) { const r7 = this.elementView.coords; if (t(r7)) return; const [s4, i3, n3, a5] = r7.rings[0], h3 = this._vertices, { x: m, y: l2 } = e4, d2 = t3 !== 0; d2 ? h3.set([i3[0] - m, i3[1] - l2, s4[0] - m, s4[1] - l2, n3[0] - m, n3[1] - l2, a5[0] - m, a5[1] - l2, a5[0] - m, a5[1] - l2, i3[0] + t3 - m, i3[1] - l2, i3[0] + t3 - m, i3[1] - l2, s4[0] + t3 - m, s4[1] - l2, n3[0] + t3 - m, n3[1] - l2, a5[0] + t3 - m, a5[1] - l2]) : h3.set([i3[0] - m, i3[1] - l2, s4[0] - m, s4[1] - l2, n3[0] - m, n3[1] - l2, a5[0] - m, a5[1] - l2]), this.isWrapAround = d2; } getVAO(e4, t3, r7) { if (t(this.elementView.coords)) return null; const s4 = this._vertices; if (this._vao) this._geometryVbo.setData(s4); else { this._geometryVbo = c3.createVertex(e4, F.DYNAMIC_DRAW, s4); const i3 = c3.createVertex(e4, F.STATIC_DRAW, new Uint16Array([0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1])); this._vao = new f3(e4, r7, t3, { geometry: this._geometryVbo, tex: i3 }); } return this._vao; } }; // node_modules/@arcgis/core/views/2d/engine/webgl/OverlayContainer.js var M3 = class extends a3 { constructor() { super(...arguments), this._localOrigin = c(0, 0), this._viewStateId = -1, this._dvsMat3 = e3(), this.requiresDedicatedFBO = false; } get dvsMat3() { return this._dvsMat3; } beforeRender(t3) { this._updateMatrices(t3), this._updateOverlays(t3, this.children); for (const e4 of this.children) e4.beforeRender(t3); } prepareRenderPasses(t3) { const e4 = t3.registerRenderPass({ name: "overlay", brushes: [W.overlay], target: () => this.children, drawPhase: I.MAP }); return [...super.prepareRenderPasses(t3), e4]; } _updateMatrices(t3) { const { state: e4 } = t3, { id: n3, size: l2, pixelRatio: m, resolution: h3, rotation: f5, viewpoint: u4, displayMat3: M4 } = e4; if (this._viewStateId === n3) return; const v2 = Math.PI / 180 * f5, _2 = m * l2[0], w2 = m * l2[1], { x: y2, y: j2 } = u4.targetGeometry, g2 = z(y2, e4.spatialReference); this._localOrigin.x = g2, this._localOrigin.y = j2; const b = h3 * _2, R3 = h3 * w2, O = r4(this._dvsMat3); i2(O, O, M4), M2(O, O, t2(_2 / 2, w2 / 2)), f2(O, O, r6(_2 / b, -w2 / R3, 1)), h2(O, O, -v2), this._viewStateId = n3; } _updateOverlays(e4, s4) { const { state: r7 } = e4, { rotation: o, spatialReference: a5, worldScreenWidth: i3, size: n3, viewpoint: c4 } = r7, p3 = this._localOrigin; let d2 = 0; if (a5.isWrappable) { const e5 = n3[0], h3 = n3[1], f5 = 180 / Math.PI * o, u4 = Math.abs(Math.cos(f5)), M4 = Math.abs(Math.sin(f5)), v2 = Math.round(e5 * u4 + h3 * M4), [_2, w2] = R(a5).valid, y2 = mt(a5), { x: j2, y: g2 } = c4.targetGeometry, b = [j2, g2], R3 = [0, 0]; r7.toScreen(R3, b); const O = [0, 0]; let P2; P2 = v2 > i3 ? 0.5 * i3 : 0.5 * v2; const x = Math.floor((j2 + 0.5 * y2) / y2), C = _2 + x * y2, D2 = w2 + x * y2, I2 = [R3[0] + P2, 0]; r7.toMap(O, I2), O[0] > D2 && (d2 = y2), I2[0] = R3[0] - P2, r7.toMap(O, I2), O[0] < C && (d2 = -y2); for (const r8 of s4) { const e6 = r8.elementView.bounds; if (t(e6)) continue; const [s5, , o2] = e6; s5 < _2 && o2 > _2 ? r8.updateDrawCoords(p3, y2) : o2 > w2 && s5 < w2 ? r8.updateDrawCoords(p3, -y2) : r8.updateDrawCoords(p3, d2); } } else for (const t3 of s4) t3.updateDrawCoords(p3, d2); } }; // node_modules/@arcgis/core/views/2d/layers/MediaLayerView2D.js var w = class extends f4(u3) { constructor() { super(...arguments), this._overlayContainer = null, this._fetchQueue = null, this._tileStrategy = null, this._elementReferences = new Map(), this.layer = null, this.elements = new j(); } attach() { this.handles.add(a(() => this.layer.source, "refresh", () => { for (const e4 of this._tileStrategy.tiles) this._updateTile(e4); this.requestUpdate(); })), this._overlayContainer = new M3(), this.container.addChild(this._overlayContainer), this._fetchQueue = new p({ tileInfoView: this.view.featuresTilingScheme, concurrency: 10, process: (e4, t3) => this._queryElements(e4, t3) }), this._tileStrategy = new r5({ cachePolicy: "purge", resampling: true, acquireTile: (e4) => this._acquireTile(e4), releaseTile: (e4) => this._releaseTile(e4), tileInfoView: this.view.featuresTilingScheme }), this.requestUpdate(); } detach() { this.handles.removeAll(), this.elements.removeAll(), this._tileStrategy.destroy(), this._fetchQueue.destroy(), this._overlayContainer.removeAllChildren(), this.container.removeAllChildren(), this._elementReferences.clear(); } supportsSpatialReference(e4) { return true; } moveStart() { this.requestUpdate(); } viewChange() { this.requestUpdate(); } moveEnd() { this.requestUpdate(); } update(e4) { this._tileStrategy.update(e4); } async hitTest(e4, t3) { const s4 = [], r7 = [e4.x, e4.y]; for (const l2 of this.elements) { const t4 = e2(l2.georeference)?.coords; r(t4) && s3(t4.rings, r7) && s4.push({ type: "media", element: l2, layer: this.layer, mapPoint: e4 }); } return s4.reverse(); } canResume() { return this.layer.source != null && super.canResume(); } async doRefresh() { } _acquireTile(e4) { const t3 = new R2(e4.clone()); return this._updateTile(t3), t3; } _updateTile(e4) { this.updatingHandles.addPromise(this._fetchQueue.push(e4.key).then((t3) => { const [s4, r7] = e4.setElements(t3); this._acquireElements(e4, s4), this._releaseElements(e4, r7), this.requestUpdate(); }, (e5) => { g(e5) || s.getLogger(this.declaredClass).error(e5); })); } _releaseTile(e4) { this._fetchQueue.abort(e4.key.id), e4.elements && this._releaseElements(e4, e4.elements), this.requestUpdate(); } async _queryElements(e4, t3) { const s4 = this.layer.source; if (t(s4)) return []; this.view.featuresTilingScheme.getTileBounds(T, e4, true); const r7 = new M({ xmin: T[0], ymin: T[1], xmax: T[2], ymax: T[3], spatialReference: this.view.spatialReference }); return s4.queryElements(r7, t3); } _acquireElements(e4, t3) { const s4 = this.layer.source, i3 = this.view.spatialReference; if (!t(s4)) for (const o of t3) { r2(this._elementReferences, o.uid, () => { const e5 = new a4({ element: o, spatialReference: i3 }), t4 = new _(e5); return this._overlayContainer.addChild(t4), this.elements.add(o), { tiles: new Set(), projectedElement: e5, overlay: t4 }; }).tiles.add(e4); } } _releaseElements(e4, t3) { for (const s4 of t3) { const t4 = this._elementReferences.get(s4.uid); t4.tiles.delete(e4), t4.tiles.size || (this._overlayContainer.removeChild(t4.overlay), t4.overlay.destroy(), t4.projectedElement.destroy(), this._elementReferences.delete(s4.uid), this.elements.remove(s4)); } } }; e([d()], w.prototype, "_fetchQueue", void 0), e([d()], w.prototype, "layer", void 0), e([d({ readOnly: true })], w.prototype, "elements", void 0), w = e([n("esri.views.2d.layers.MediaLayerView2D")], w); var T = u(); var R2 = class { constructor(e4) { this.key = e4, this.elements = null, this.isReady = false, this.visible = true; } setElements(e4) { const t3 = [], s4 = new Set(this.elements); this.elements = e4; for (const r7 of e4) s4.has(r7) ? s4.delete(r7) : t3.push(r7); return this.isReady = true, [t3, Array.from(s4)]; } }; var S = w; export { S as default }; //# sourceMappingURL=MediaLayerView2D-NAXGI6LP.js.map