MediaLayerView2D-73NJY27X.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. import {
  2. a as a3
  3. } from "./chunk-B5WNDDCF.js";
  4. import {
  5. n3 as n5,
  6. o as o3
  7. } from "./chunk-264YGWEE.js";
  8. import {
  9. u as u2,
  10. y as y3
  11. } from "./chunk-KUAEOLV3.js";
  12. import {
  13. r as r8
  14. } from "./chunk-ZLQP3WDC.js";
  15. import "./chunk-JBMHQ5RK.js";
  16. import {
  17. E as E2,
  18. a as a2
  19. } from "./chunk-WBWQJQK4.js";
  20. import {
  21. r as r7
  22. } from "./chunk-A22ACVMF.js";
  23. import "./chunk-TDS6IBMU.js";
  24. import "./chunk-DBT4KOKX.js";
  25. import "./chunk-2GP5D74I.js";
  26. import "./chunk-EPMXCACW.js";
  27. import "./chunk-UWKVAZQ6.js";
  28. import "./chunk-T2SKWJGU.js";
  29. import "./chunk-UO3LS2M5.js";
  30. import {
  31. E,
  32. n as n3
  33. } from "./chunk-H2VOWDMO.js";
  34. import "./chunk-QISOH77W.js";
  35. import "./chunk-XO5VJRK4.js";
  36. import "./chunk-3WXSWAUV.js";
  37. import "./chunk-27YO3FKC.js";
  38. import {
  39. I
  40. } from "./chunk-EQNT4A7P.js";
  41. import "./chunk-4OM3EX6P.js";
  42. import {
  43. D,
  44. F,
  45. G,
  46. L,
  47. P
  48. } from "./chunk-3OFVLRSL.js";
  49. import {
  50. e as e3
  51. } from "./chunk-GHN7C53L.js";
  52. import {
  53. mt
  54. } from "./chunk-PTEMIS7J.js";
  55. import {
  56. e as e4
  57. } from "./chunk-IQBIGNPU.js";
  58. import "./chunk-AJFR3FGC.js";
  59. import {
  60. n as n4
  61. } from "./chunk-K7B6OWCU.js";
  62. import "./chunk-L5DZVCCW.js";
  63. import {
  64. r as r6
  65. } from "./chunk-WNPL3C7R.js";
  66. import {
  67. y as y2
  68. } from "./chunk-E7ZLMIQ7.js";
  69. import "./chunk-RG3AHHRL.js";
  70. import {
  71. t as t2
  72. } from "./chunk-UDYHZLTE.js";
  73. import "./chunk-QC7NCR5N.js";
  74. import "./chunk-VQXMCZYH.js";
  75. import "./chunk-JQUWFKNU.js";
  76. import "./chunk-RWQH5X3O.js";
  77. import "./chunk-6334AFGG.js";
  78. import "./chunk-TFHLTN6F.js";
  79. import {
  80. M,
  81. c as c4,
  82. f as f2,
  83. h as h2,
  84. i,
  85. o as o2,
  86. r as r5,
  87. s as s4
  88. } from "./chunk-O3JQY77G.js";
  89. import {
  90. r as r4
  91. } from "./chunk-E3G7BRZB.js";
  92. import "./chunk-JKFWEHNK.js";
  93. import {
  94. un
  95. } from "./chunk-P24XEEHY.js";
  96. import {
  97. U
  98. } from "./chunk-WOXHUQGM.js";
  99. import "./chunk-FMPQIGFA.js";
  100. import "./chunk-EDHROVWI.js";
  101. import "./chunk-3IRT3YKJ.js";
  102. import "./chunk-SAJAEMIJ.js";
  103. import "./chunk-JOYXMSKE.js";
  104. import "./chunk-YZVAB3DF.js";
  105. import "./chunk-PJNBFKPF.js";
  106. import "./chunk-C7742RNZ.js";
  107. import {
  108. a,
  109. f,
  110. h,
  111. l
  112. } from "./chunk-TJV6ODRM.js";
  113. import "./chunk-3WQOA5CB.js";
  114. import "./chunk-FZQZIM7U.js";
  115. import "./chunk-CZBRZ6SU.js";
  116. import "./chunk-VGWC3IKZ.js";
  117. import {
  118. c as c2,
  119. u
  120. } from "./chunk-2H5MD622.js";
  121. import "./chunk-3RSFVUKZ.js";
  122. import {
  123. c as c3
  124. } from "./chunk-UVVU4UUO.js";
  125. import "./chunk-X4SA4ELJ.js";
  126. import "./chunk-ZAY3CMAZ.js";
  127. import "./chunk-ZLNEXZAN.js";
  128. import "./chunk-3GZSQU56.js";
  129. import "./chunk-ZYRIJWLX.js";
  130. import {
  131. c
  132. } from "./chunk-RYY6632W.js";
  133. import {
  134. S,
  135. o
  136. } from "./chunk-DW42UVIT.js";
  137. import "./chunk-YAEIHDJH.js";
  138. import {
  139. n as n2
  140. } from "./chunk-TJNOJH33.js";
  141. import "./chunk-OSHI574D.js";
  142. import "./chunk-ETGAZ7LF.js";
  143. import "./chunk-75U5LM2V.js";
  144. import "./chunk-RMDDCMKS.js";
  145. import {
  146. v2 as v
  147. } from "./chunk-VCH45Q2I.js";
  148. import {
  149. j as j2
  150. } from "./chunk-LBW34VZ2.js";
  151. import "./chunk-GSSTTHIT.js";
  152. import "./chunk-IM3LVQXV.js";
  153. import "./chunk-55RWC67C.js";
  154. import "./chunk-HZRKBTHJ.js";
  155. import "./chunk-DVUG3KID.js";
  156. import "./chunk-FWSQEIAR.js";
  157. import "./chunk-VEGAOVMY.js";
  158. import {
  159. s2 as s3,
  160. w2 as w
  161. } from "./chunk-6T6G6LCQ.js";
  162. import "./chunk-YEJL5NEF.js";
  163. import {
  164. R
  165. } from "./chunk-PQFTYGF5.js";
  166. import {
  167. e,
  168. m,
  169. n5 as n,
  170. y3 as y
  171. } from "./chunk-2Z2TG5CU.js";
  172. import "./chunk-6KZ2LTDA.js";
  173. import "./chunk-U2XHEJM7.js";
  174. import {
  175. r as r3
  176. } from "./chunk-SQOPWYIT.js";
  177. import {
  178. j,
  179. r2
  180. } from "./chunk-V6P2MAQQ.js";
  181. import {
  182. s2 as s,
  183. s3 as s2
  184. } from "./chunk-E5O6P5I2.js";
  185. import "./chunk-SPWQ3AWG.js";
  186. import "./chunk-2TIUKVZN.js";
  187. import {
  188. e as e2,
  189. r,
  190. t
  191. } from "./chunk-YXWMMD76.js";
  192. import "./chunk-S5KM4IGW.js";
  193. // node_modules/@arcgis/core/layers/support/mediaUtils.js
  194. var a4 = class extends m {
  195. constructor(o4) {
  196. super(o4);
  197. }
  198. get bounds() {
  199. const o4 = this.coords;
  200. return t(o4) || t(o4.extent) ? null : c2(o4.extent);
  201. }
  202. get coords() {
  203. var _a;
  204. const o4 = (_a = e2(this.element.georeference)) == null ? void 0 : _a.coords;
  205. return un(o4, this.spatialReference).geometry;
  206. }
  207. get normalizedCoords() {
  208. return v.fromJSON(a3(this.coords));
  209. }
  210. get normalizedBounds() {
  211. const o4 = r(this.normalizedCoords) ? this.normalizedCoords.extent : null;
  212. return r(o4) ? c2(o4) : null;
  213. }
  214. };
  215. e([y()], a4.prototype, "spatialReference", void 0), e([y()], a4.prototype, "element", void 0), e([y()], a4.prototype, "bounds", null), e([y()], a4.prototype, "coords", null), e([y()], a4.prototype, "normalizedCoords", null), e([y()], a4.prototype, "normalizedBounds", null), a4 = e([n("esri.layers.support.media.MediaElementView")], a4);
  216. // node_modules/@arcgis/core/core/perspectiveUtils.js
  217. var f3 = n2();
  218. var i2 = e3();
  219. var e5 = e3();
  220. var p = e3();
  221. function j3(s5, n6, o4) {
  222. return k(e5, n6[0], n6[1], n6[2], n6[3], n6[4], n6[5], n6[6], n6[7]), k(p, o4[0], o4[1], o4[2], o4[3], o4[4], o4[5], o4[6], o4[7]), i(s5, c4(e5, e5), p);
  223. }
  224. function k(o4, c5, u3, e6, p2, h3, j5, k2, v2) {
  225. s4(o4, c5, e6, h3, u3, p2, j5, 1, 1, 1), o(f3, k2, v2, 1), c4(i2, o4);
  226. const [x, b2, d] = S(f3, f3, o2(i2, i2));
  227. return s4(i2, x, 0, 0, 0, b2, 0, 0, 0, d), i(o4, i2, o4);
  228. }
  229. // node_modules/@arcgis/core/views/2d/engine/webgl/Overlay.js
  230. var b = e3();
  231. var V = class extends r8 {
  232. constructor(s5) {
  233. super(), this.elementView = s5, this.isWrapAround = false, this.perspectiveTransform = n4(), this._vertices = new Float32Array(20), this._handles = [], this._handles.push(l(() => this.elementView.element.opacity, (e6) => this.opacity = e6, h), l(() => [this.elementView.coords], () => {
  234. this.requestRender();
  235. }, h), f(() => this.elementView.element.loaded, () => {
  236. const e6 = this.elementView.element;
  237. this.ready(), "video" === e6.type && r(e6.content) && this._handles.push(r2(e6.content, "play", () => this.requestRender()));
  238. }, h)), s5.element.load().catch((t3) => {
  239. s.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new s2("element-load-error", "Element cannot be displayed", { element: s5, error: t3 }));
  240. });
  241. }
  242. destroy() {
  243. var _a;
  244. this._handles.forEach((e6) => e6.remove()), (_a = this.texture) == null ? void 0 : _a.dispose(), this.texture = null;
  245. }
  246. get dvsMat3() {
  247. return this.parent.dvsMat3;
  248. }
  249. beforeRender(e6) {
  250. const { context: t3 } = e6, r9 = this.elementView.element.content;
  251. if (r(r9)) {
  252. const e7 = r9 instanceof HTMLImageElement, i3 = r9 instanceof HTMLVideoElement, o4 = e7 ? r9.naturalWidth : i3 ? r9.videoWidth : r9.width, n6 = e7 ? r9.naturalHeight : i3 ? r9.videoHeight : r9.height;
  253. this._updatePerspectiveTransform(o4, n6), this.texture ? i3 && !r9.paused && (this.texture.setData(r9), this.requestRender(), (n3(t3.gl) || c(o4) && c(n6)) && this.texture.generateMipmap()) : (this.texture = new E(t3, { pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.LINEAR, wrapMode: D.CLAMP_TO_EDGE, width: o4, height: n6, preMultiplyAlpha: true }, r9), (n3(t3.gl) || c(o4) && c(n6)) && this.texture.generateMipmap(), i3 && !r9.paused && this.requestRender());
  254. }
  255. super.beforeRender(e6);
  256. }
  257. _createTransforms() {
  258. return null;
  259. }
  260. updateDrawCoords(e6, t3) {
  261. const r9 = this.elementView.coords;
  262. if (t(r9))
  263. return;
  264. const [s5, i3, n6, a5] = r9.rings[0], m2 = this._vertices, { x: h3, y: c5 } = e6, l2 = 0 !== t3;
  265. l2 ? m2.set([i3[0] - h3, i3[1] - c5, s5[0] - h3, s5[1] - c5, n6[0] - h3, n6[1] - c5, a5[0] - h3, a5[1] - c5, a5[0] - h3, a5[1] - c5, i3[0] + t3 - h3, i3[1] - c5, i3[0] + t3 - h3, i3[1] - c5, s5[0] + t3 - h3, s5[1] - c5, n6[0] + t3 - h3, n6[1] - c5, a5[0] + t3 - h3, a5[1] - c5]) : m2.set([i3[0] - h3, i3[1] - c5, s5[0] - h3, s5[1] - c5, n6[0] - h3, n6[1] - c5, a5[0] - h3, a5[1] - c5]), this.isWrapAround = l2;
  266. }
  267. getVAO(e6, t3, r9) {
  268. if (t(this.elementView.coords))
  269. return null;
  270. const s5 = this._vertices;
  271. if (this._vao)
  272. this._geometryVbo.setData(s5);
  273. else {
  274. this._geometryVbo = E2.createVertex(e6, F.DYNAMIC_DRAW, s5);
  275. const i3 = E2.createVertex(e6, 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]));
  276. this._vao = new a2(e6, r9, t3, { geometry: this._geometryVbo, tex: i3 });
  277. }
  278. return this._vao;
  279. }
  280. _updatePerspectiveTransform(e6, t3) {
  281. const r9 = this._vertices;
  282. j3(b, [0, 0, e6, 0, 0, t3, e6, t3], [r9[0], r9[1], r9[4], r9[5], r9[2], r9[3], r9[6], r9[7]]), r4(this.perspectiveTransform, b[6] / b[8] * e6, b[7] / b[8] * t3);
  283. }
  284. };
  285. // node_modules/@arcgis/core/views/2d/engine/webgl/OverlayContainer.js
  286. var M2 = class extends o3 {
  287. constructor() {
  288. super(...arguments), this._localOrigin = c3(0, 0), this._viewStateId = -1, this._dvsMat3 = e4(), this.requiresDedicatedFBO = false;
  289. }
  290. get dvsMat3() {
  291. return this._dvsMat3;
  292. }
  293. beforeRender(t3) {
  294. this._updateMatrices(t3), this._updateOverlays(t3, this.children);
  295. for (const e6 of this.children)
  296. e6.beforeRender(t3);
  297. }
  298. prepareRenderPasses(t3) {
  299. const e6 = t3.registerRenderPass({ name: "overlay", brushes: [n5.overlay], target: () => this.children, drawPhase: I.MAP });
  300. return [...super.prepareRenderPasses(t3), e6];
  301. }
  302. _updateMatrices(t3) {
  303. const { state: e6 } = t3, { id: n6, size: h3, pixelRatio: l2, resolution: m2, rotation: f4, viewpoint: u3, displayMat3: M3 } = e6;
  304. if (this._viewStateId === n6)
  305. return;
  306. const v2 = Math.PI / 180 * f4, _ = l2 * h3[0], w3 = l2 * h3[1], { x: y4, y: g } = u3.targetGeometry, j5 = U(y4, e6.spatialReference);
  307. this._localOrigin.x = j5, this._localOrigin.y = g;
  308. const b2 = m2 * _, R3 = m2 * w3, O = r5(this._dvsMat3);
  309. i(O, O, M3), M(O, O, t2(_ / 2, w3 / 2)), f2(O, O, r7(_ / b2, -w3 / R3, 1)), h2(O, O, -v2), this._viewStateId = n6;
  310. }
  311. _updateOverlays(e6, s5) {
  312. const { state: r9 } = e6, { rotation: o4, spatialReference: a5, worldScreenWidth: i3, size: n6, viewpoint: c5 } = r9, p2 = this._localOrigin;
  313. let d = 0;
  314. if (a5.isWrappable) {
  315. const e7 = n6[0], m2 = n6[1], f4 = 180 / Math.PI * o4, u3 = Math.abs(Math.cos(f4)), M3 = Math.abs(Math.sin(f4)), v2 = Math.round(e7 * u3 + m2 * M3), [_, w3] = R(a5).valid, y4 = mt(a5), { x: g, y: j5 } = c5.targetGeometry, b2 = [g, j5], R3 = [0, 0];
  316. r9.toScreen(R3, b2);
  317. const O = [0, 0];
  318. let P2;
  319. P2 = v2 > i3 ? 0.5 * i3 : 0.5 * v2;
  320. const x = Math.floor((g + 0.5 * y4) / y4), C = _ + x * y4, D2 = w3 + x * y4, I2 = [R3[0] + P2, 0];
  321. r9.toMap(O, I2), O[0] > D2 && (d = y4), I2[0] = R3[0] - P2, r9.toMap(O, I2), O[0] < C && (d = -y4);
  322. for (const r10 of s5) {
  323. const e8 = r10.elementView.bounds;
  324. if (t(e8))
  325. continue;
  326. const [s6, , o5] = e8;
  327. s6 < _ && o5 > _ ? r10.updateDrawCoords(p2, y4) : o5 > w3 && s6 < w3 ? r10.updateDrawCoords(p2, -y4) : r10.updateDrawCoords(p2, d);
  328. }
  329. } else
  330. for (const t3 of s5)
  331. t3.updateDrawCoords(p2, d);
  332. }
  333. };
  334. // node_modules/@arcgis/core/views/2d/layers/MediaLayerView2D.js
  335. var j4 = class extends y3(u2) {
  336. constructor() {
  337. super(...arguments), this._overlayContainer = null, this._fetchQueue = null, this._tileStrategy = null, this._elementReferences = /* @__PURE__ */ new Map(), this.layer = null, this.elements = new j2();
  338. }
  339. attach() {
  340. this.handles.add(a(() => this.layer.source, "refresh", () => {
  341. for (const e6 of this._tileStrategy.tiles)
  342. this._updateTile(e6);
  343. this.requestUpdate();
  344. })), this._overlayContainer = new M2(), this.container.addChild(this._overlayContainer), this._fetchQueue = new y2({ tileInfoView: this.view.featuresTilingScheme, concurrency: 10, process: (e6, t3) => this._queryElements(e6, t3) }), this._tileStrategy = new r6({ cachePolicy: "purge", resampling: true, acquireTile: (e6) => this._acquireTile(e6), releaseTile: (e6) => this._releaseTile(e6), tileInfoView: this.view.featuresTilingScheme }), this.requestUpdate();
  345. }
  346. detach() {
  347. this.handles.removeAll(), this.elements.removeAll(), this._tileStrategy.destroy(), this._fetchQueue.destroy(), this._overlayContainer.removeAllChildren(), this.container.removeAllChildren(), this._elementReferences.clear();
  348. }
  349. supportsSpatialReference(e6) {
  350. return true;
  351. }
  352. moveStart() {
  353. this.requestUpdate();
  354. }
  355. viewChange() {
  356. this.requestUpdate();
  357. }
  358. moveEnd() {
  359. this.requestUpdate();
  360. }
  361. update(e6) {
  362. this._tileStrategy.update(e6);
  363. }
  364. async hitTest(e6, t3) {
  365. const s5 = [], r9 = e6.normalize(), o4 = [r9.x, r9.y];
  366. for (const { projectedElement: { normalizedCoords: l2, element: n6 } } of this._elementReferences.values())
  367. r(l2) && s3(l2.rings, o4) && s5.push({ type: "media", element: n6, layer: this.layer, mapPoint: e6 });
  368. return s5.reverse();
  369. }
  370. canResume() {
  371. return null != this.layer.source && super.canResume();
  372. }
  373. async doRefresh() {
  374. }
  375. _acquireTile(e6) {
  376. const t3 = new T(e6.clone());
  377. return this._updateTile(t3), t3;
  378. }
  379. _updateTile(e6) {
  380. this.updatingHandles.addPromise(this._fetchQueue.push(e6.key).then((t3) => {
  381. const [s5, r9] = e6.setElements(t3);
  382. this._acquireElements(e6, s5), this._releaseElements(e6, r9), this.requestUpdate();
  383. }, (e7) => {
  384. j(e7) || s.getLogger(this.declaredClass).error(e7);
  385. }));
  386. }
  387. _releaseTile(e6) {
  388. this._fetchQueue.abort(e6.key.id), e6.elements && this._releaseElements(e6, e6.elements), this.requestUpdate();
  389. }
  390. async _queryElements(e6, t3) {
  391. const s5 = this.layer.source;
  392. if (t(s5))
  393. return [];
  394. this.view.featuresTilingScheme.getTileBounds(w2, e6, true);
  395. const r9 = new w({ xmin: w2[0], ymin: w2[1], xmax: w2[2], ymax: w2[3], spatialReference: this.view.spatialReference });
  396. return s5.queryElements(r9, t3);
  397. }
  398. _acquireElements(e6, t3) {
  399. const s5 = this.layer.source, i3 = this.view.spatialReference;
  400. if (!t(s5))
  401. for (const o4 of t3) {
  402. r3(this._elementReferences, o4.uid, () => {
  403. const e7 = new a4({ element: o4, spatialReference: i3 }), t4 = new V(e7);
  404. return this._overlayContainer.addChild(t4), this.elements.add(o4), { tiles: /* @__PURE__ */ new Set(), projectedElement: e7, overlay: t4 };
  405. }).tiles.add(e6);
  406. }
  407. }
  408. _releaseElements(e6, t3) {
  409. for (const s5 of t3) {
  410. const t4 = this._elementReferences.get(s5.uid);
  411. t4.tiles.delete(e6), t4.tiles.size || (this._overlayContainer.removeChild(t4.overlay), t4.overlay.destroy(), t4.projectedElement.destroy(), this._elementReferences.delete(s5.uid), this.elements.remove(s5));
  412. }
  413. }
  414. };
  415. e([y()], j4.prototype, "_fetchQueue", void 0), e([y()], j4.prototype, "layer", void 0), e([y({ readOnly: true })], j4.prototype, "elements", void 0), j4 = e([n("esri.views.2d.layers.MediaLayerView2D")], j4);
  416. var w2 = u();
  417. var T = class {
  418. constructor(e6) {
  419. this.key = e6, this.elements = null, this.isReady = false, this.visible = true;
  420. }
  421. setElements(e6) {
  422. const t3 = [], s5 = new Set(this.elements);
  423. this.elements = e6;
  424. for (const r9 of e6)
  425. s5.has(r9) ? s5.delete(r9) : t3.push(r9);
  426. return this.isReady = true, [t3, Array.from(s5)];
  427. }
  428. };
  429. var R2 = j4;
  430. export {
  431. R2 as default
  432. };
  433. //# sourceMappingURL=MediaLayerView2D-73NJY27X.js.map