chunk-4NE3ZC7B.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. import {
  2. e as e2
  3. } from "./chunk-6334AFGG.js";
  4. import {
  5. t as t3
  6. } from "./chunk-KOKTANE6.js";
  7. import {
  8. a
  9. } from "./chunk-RYY6632W.js";
  10. import {
  11. e,
  12. m,
  13. n5 as n,
  14. t4 as t2,
  15. x,
  16. y2 as y,
  17. y3 as y2
  18. } from "./chunk-2Z2TG5CU.js";
  19. import {
  20. i
  21. } from "./chunk-V6P2MAQQ.js";
  22. import {
  23. s2 as s
  24. } from "./chunk-E5O6P5I2.js";
  25. import {
  26. has
  27. } from "./chunk-SPWQ3AWG.js";
  28. import {
  29. f,
  30. t
  31. } from "./chunk-YXWMMD76.js";
  32. // node_modules/@arcgis/core/core/throttle.js
  33. function e3(e8, t5, l2, n3) {
  34. let o3 = null, p = 1e3;
  35. "number" == typeof t5 ? (p = t5, n3 = l2) : (o3 = t5 != null ? t5 : null, p = l2);
  36. let r2, u3 = 0;
  37. const a4 = () => {
  38. u3 = 0, e8.apply(n3, r2);
  39. }, c2 = (...e9) => {
  40. o3 && o3.apply(n3, e9), r2 = e9, p ? u3 || (u3 = setTimeout(a4, p)) : a4();
  41. };
  42. return c2.remove = () => {
  43. u3 && (clearTimeout(u3), u3 = 0);
  44. }, c2.forceUpdate = () => {
  45. u3 && (clearTimeout(u3), a4());
  46. }, c2.hasPendingUpdates = () => !!u3, c2;
  47. }
  48. // node_modules/@arcgis/core/views/2d/support/Timeline.js
  49. var s2 = (s6) => s6.includes("Brush");
  50. var e4 = class {
  51. constructor() {
  52. this._names = /* @__PURE__ */ new Map();
  53. }
  54. begin(e8) {
  55. this._names.has(e8) || (this._names.set(e8, false), s2(e8) && this.record("Esri.FirstDraw"), performance.mark(`Esri.${e8}.Start`));
  56. }
  57. end(s6) {
  58. this._names.has(s6) && !this._names.get(s6) && (this._names.set(s6, true), performance.mark(`Esri.${s6}.End`));
  59. }
  60. record(s6) {
  61. this._names.has(s6) || (this._names.set(s6, true), performance.mark(`Esri.${s6}`));
  62. }
  63. };
  64. // node_modules/@arcgis/core/views/support/screenshotUtils.js
  65. function r(t5, h, i4) {
  66. const { ctx: e8, canvas: o3 } = g(t5, i4), n3 = e8.getImageData(0, 0, t5.width, t5.height), a4 = c(o3, h);
  67. return f2(o3), { dataUrl: a4, data: n3 };
  68. }
  69. function l(t5, h) {
  70. const { ctx: i4, canvas: e8 } = g(t5, h), o3 = i4.getImageData(0, 0, t5.width, t5.height);
  71. return f2(e8), o3;
  72. }
  73. function g(t5, h) {
  74. const i4 = d();
  75. h.premultipliedAlpha && v(t5), i4.width = t5.width, i4.height = t5.height;
  76. const e8 = i4.getContext("2d");
  77. return e8.putImageData(t5, 0, 0), h.flipY && q(e8), { ctx: e8, canvas: i4 };
  78. }
  79. function f2(t5) {
  80. t5.width = 0, t5.height = 0;
  81. }
  82. function d() {
  83. return t(u) && (u = document.createElement("canvas")), u;
  84. }
  85. var u = null;
  86. function c(t5, h) {
  87. const i4 = I[h.format], e8 = h.quality / 100;
  88. return t5.toDataURL(i4, e8);
  89. }
  90. function s3(h, i4) {
  91. const e8 = D(h), o3 = B[e8];
  92. return { format: e8, quality: a(null != i4 ? i4 : o3, 0, 100) };
  93. }
  94. function w(t5, h) {
  95. return h / Math.max(t5[0], t5[1]);
  96. }
  97. function m2(t5, h, i4, e8 = 0, o3 = 0, n3 = t5.width - e8, a4 = t5.height - o3, r2 = false) {
  98. const { data: l2 } = t5, { width: g3, height: f3, data: d2 } = h, u3 = n3 / g3, c2 = a4 / f3, s6 = Math.ceil(u3 / 2), w2 = Math.ceil(c2 / 2), m3 = t5.width;
  99. for (let M = 0; M < f3; M++)
  100. for (let t6 = 0; t6 < g3; t6++) {
  101. const h2 = 4 * (t6 + (r2 ? f3 - M - 1 : M) * g3);
  102. let n4 = 0, a5 = 0, p = 0, y3 = 0, x2 = 0, b = 0;
  103. const j = (M + 0.5) * c2;
  104. for (let r3 = Math.floor(M * c2); r3 < (M + 1) * c2; r3++) {
  105. const h3 = Math.abs(j - (r3 + 0.5)) / w2, g4 = (t6 + 0.5) * u3, f4 = h3 * h3;
  106. for (let d3 = Math.floor(t6 * u3); d3 < (t6 + 1) * u3; d3++) {
  107. const t7 = Math.abs(g4 - (d3 + 0.5)) / s6, h4 = Math.sqrt(f4 + t7 * t7);
  108. if (h4 >= 1)
  109. continue;
  110. let u4 = 2 * h4 * h4 * h4 - 3 * h4 * h4 + 1;
  111. const c3 = 4 * (e8 + d3 + (o3 + r3) * m3);
  112. b += u4 * l2[c3 + 3], a5 += u4, !i4 && l2[c3 + 3] < 255 && (u4 = u4 * l2[c3 + 3] / 255), p += u4 * l2[c3], y3 += u4 * l2[c3 + 1], x2 += u4 * l2[c3 + 2], n4 += u4;
  113. }
  114. }
  115. d2[h2] = p / n4, d2[h2 + 1] = y3 / n4, d2[h2 + 2] = x2 / n4, d2[h2 + 3] = b / a5;
  116. }
  117. return h;
  118. }
  119. function D(t5) {
  120. switch (t5) {
  121. case "png":
  122. case "jpg":
  123. case "jpeg":
  124. return t5;
  125. default:
  126. return k;
  127. }
  128. }
  129. function q(t5) {
  130. t5.save(), t5.globalCompositeOperation = "copy", t5.scale(1, -1), t5.translate(0, -t5.canvas.height), t5.drawImage(t5.canvas, 0, 0), t5.restore();
  131. }
  132. function v(t5) {
  133. const h = t5.data, i4 = h.length;
  134. for (let e8 = 0; e8 < i4; e8 += 4) {
  135. const t6 = h[e8 + 3];
  136. if (255 !== t6 && t6 > 0) {
  137. const i5 = 255 / t6;
  138. h[e8 + 0] = h[e8 + 0] * i5, h[e8 + 1] = h[e8 + 1] * i5, h[e8 + 2] = h[e8 + 2] * i5;
  139. }
  140. }
  141. }
  142. var I = { png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg" };
  143. var P = 98;
  144. var k = "png";
  145. var B = { png: 100, jpg: P, jpeg: P };
  146. // node_modules/@arcgis/core/views/3d/support/PropertiesPool.js
  147. var o = class {
  148. constructor(r2, o3) {
  149. this._owner = o3, this._properties = {}, this._afterDispatchHandle = null;
  150. for (const t5 in r2) {
  151. const o4 = r2[t5], s6 = new t2(o4, void 0, void 0, 2, 2);
  152. this._properties[t5] = { pool: s6, acquired: [] };
  153. }
  154. this._afterDispatchHandle = y(() => this._release());
  155. }
  156. destroy() {
  157. this._afterDispatchHandle && (this._afterDispatchHandle.remove(), this._afterDispatchHandle = null);
  158. for (const e8 in this._properties) {
  159. const t5 = this._properties[e8];
  160. for (const e9 of t5.acquired)
  161. x(e9) || t5.pool.release(e9);
  162. t5.pool.destroy(), t5.pool = null, t5.acquired = null;
  163. }
  164. this._properties = null, this._owner = null;
  165. }
  166. get(e8) {
  167. const t5 = this._owner._get(e8), r2 = this._properties[e8];
  168. let o3 = r2.pool.acquire();
  169. for (r2.acquired.push(o3); o3 === t5; )
  170. r2.acquired.push(o3), o3 = r2.pool.acquire();
  171. return o3;
  172. }
  173. _release() {
  174. for (const e8 in this._properties) {
  175. const t5 = this._properties[e8];
  176. let o3 = 0;
  177. for (const e9 of t5.acquired)
  178. x(e9) ? t5.acquired[o3++] = e9 : t5.pool.release(e9);
  179. t5.acquired.length = o3;
  180. }
  181. }
  182. };
  183. // node_modules/@arcgis/core/views/input/keys.js
  184. var e6 = has("mac") ? "Meta" : "Ctrl";
  185. var t4 = { 8: "Backspace", 9: "Tab", 13: "Enter", 27: "Escape", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", 37: "ArrowLeft", 38: "ArrowUp", 39: "ArrowRight", 40: "ArrowDown", 45: "Insert", 46: "Delete" };
  186. for (let n3 = 48; n3 < 58; n3++)
  187. t4[n3] = String.fromCharCode(n3);
  188. for (let n3 = 1; n3 < 25; n3++)
  189. t4[111 + n3] = `F${n3}`;
  190. for (let n3 = 65; n3 < 91; n3++)
  191. t4[n3] = [String.fromCharCode(n3 + 32), String.fromCharCode(n3)];
  192. function o2(e8) {
  193. if (void 0 !== e8.key)
  194. return i(e8);
  195. const o3 = t4[e8.keyCode];
  196. return Array.isArray(o3) ? e8.shiftKey ? o3[1] : o3[0] : o3;
  197. }
  198. function a2(r2) {
  199. switch (r2) {
  200. case "Ctrl":
  201. case "Alt":
  202. case "Shift":
  203. case "Meta":
  204. case "Primary":
  205. return true;
  206. }
  207. return false;
  208. }
  209. // node_modules/@arcgis/core/views/input/EventMatch.js
  210. var e7 = class {
  211. constructor(e8, t5 = []) {
  212. this.eventType = e8, this.keyModifiers = t5;
  213. }
  214. matches(e8) {
  215. if (e8.type !== this.eventType)
  216. return false;
  217. if (0 === this.keyModifiers.length)
  218. return true;
  219. const t5 = e8.modifiers;
  220. for (const i4 of this.keyModifiers)
  221. if (!t5.has(i4))
  222. return false;
  223. return true;
  224. }
  225. };
  226. // node_modules/@arcgis/core/views/input/InputHandler.js
  227. var n2 = s.getLogger("esri.views.input.InputHandler");
  228. var i2 = class {
  229. constructor(e8) {
  230. this._manager = null, this._incoming = {}, this._outgoing = {}, this._incomingEventMatches = null, this._incomingEventTypes = null, this._outgoingEventTypes = null, this._hasSideEffects = e8;
  231. }
  232. get incomingEventMatches() {
  233. if (!this._incomingEventMatches) {
  234. this._incomingEventMatches = [];
  235. for (const e8 in this._incoming) {
  236. const t5 = this._incoming[e8];
  237. for (const e9 of t5)
  238. this._incomingEventMatches.push(e9.match);
  239. }
  240. }
  241. return this._incomingEventMatches;
  242. }
  243. get incomingEventTypes() {
  244. return this._incomingEventTypes || (this._incomingEventTypes = this.incomingEventMatches.map((e8) => e8.eventType)), this._incomingEventTypes;
  245. }
  246. get outgoingEventTypes() {
  247. return this._outgoingEventTypes || (this._outgoingEventTypes = Object.keys(this._outgoing)), this._outgoingEventTypes;
  248. }
  249. get hasSideEffects() {
  250. return this._hasSideEffects;
  251. }
  252. get hasPendingInputs() {
  253. return false;
  254. }
  255. onInstall(e8) {
  256. this._manager ? n2.error("This InputHandler has already been registered with an InputManager") : (e8.setEventCallback((e9) => this._handleEvent(e9)), e8.setUninstallCallback(() => this._onUninstall()), this._manager = e8);
  257. }
  258. onUninstall() {
  259. }
  260. registerIncoming(e8, n3, i4) {
  261. let a4;
  262. "function" == typeof n3 ? (i4 = n3, a4 = []) : a4 = n3 || [];
  263. const o3 = "string" == typeof e8 ? new e7(e8, a4) : e8, h = () => {
  264. this._incomingEventTypes = null, this._incomingEventMatches = null;
  265. }, r2 = (e9) => {
  266. const t5 = this._incoming[e9.match.eventType];
  267. if (t5) {
  268. const n4 = t5.indexOf(e9);
  269. t5.splice(n4, 1), h(), this._manager && this._manager.updateDependencies();
  270. }
  271. }, g3 = new s4(o3, i4, { onPause: r2, onRemove: r2, onResume: (e9) => {
  272. const t5 = this._incoming[e9.match.eventType];
  273. t5 && !t5.includes(e9) && (t5.push(e9), h(), this._manager && this._manager.updateDependencies());
  274. } });
  275. let c2 = this._incoming[o3.eventType];
  276. return c2 || (c2 = [], this._incoming[o3.eventType] = c2), c2.push(g3), h(), this._manager && this._manager.updateDependencies(), g3;
  277. }
  278. registerOutgoing(e8) {
  279. if (this._outgoing[e8])
  280. throw new Error("There is already a callback registered for this outgoing InputEvent: " + e8);
  281. const t5 = new a3(e8, { onEmit: (e9, t6, n3, i4) => {
  282. var _a;
  283. (_a = this._manager) == null ? void 0 : _a.emit(e9.eventType, t6, n3, i4);
  284. }, onRemove: (e9) => {
  285. var _a;
  286. delete this._outgoing[e9.eventType], (_a = this._manager) == null ? void 0 : _a.updateDependencies();
  287. } });
  288. return this._outgoing[e8] = t5, this._outgoingEventTypes = null, this._manager && this._manager.updateDependencies(), t5;
  289. }
  290. startCapturingPointer(e8) {
  291. var _a;
  292. (_a = this._manager) == null ? void 0 : _a.setPointerCapture(e8, true);
  293. }
  294. stopCapturingPointer(e8) {
  295. var _a;
  296. (_a = this._manager) == null ? void 0 : _a.setPointerCapture(e8, false);
  297. }
  298. refreshHasPendingInputs() {
  299. var _a;
  300. (_a = this._manager) == null ? void 0 : _a.refreshHasPendingInputs();
  301. }
  302. _onUninstall() {
  303. this._manager ? (this.onUninstall(), this._manager = null) : n2.error("This InputHandler is not registered with an InputManager");
  304. }
  305. _handleEvent(e8) {
  306. var _a;
  307. const t5 = this._incoming[e8.type];
  308. if (t5) {
  309. for (const n3 of t5)
  310. if (n3.match.matches(e8) && ((_a = n3.callback) == null ? void 0 : _a.call(n3, e8), e8.shouldStopPropagation()))
  311. break;
  312. }
  313. }
  314. };
  315. var s4 = class {
  316. constructor(e8, t5, n3) {
  317. this.match = e8, this._callback = t5, this._handler = n3;
  318. }
  319. pause() {
  320. this._handler.onPause(this);
  321. }
  322. resume() {
  323. this._handler.onResume(this);
  324. }
  325. remove() {
  326. this._handler.onRemove(this);
  327. }
  328. get callback() {
  329. return this._callback;
  330. }
  331. };
  332. var a3 = class {
  333. constructor(e8, t5) {
  334. this.eventType = e8, this._removed = false, this._handler = t5;
  335. }
  336. emit(e8, t5, n3) {
  337. this._removed || this._handler.onEmit(this, e8, t5, n3);
  338. }
  339. remove() {
  340. this._removed = true, this._handler.onRemove(this);
  341. }
  342. };
  343. // node_modules/@arcgis/core/views/input/handlers/LatestPointer.js
  344. var s5 = class extends i2 {
  345. constructor(t5) {
  346. super(true), this._onChange = t5, this._value = "mouse", this._x = null, this._y = null, this.registerIncoming("pointer-move", (t6) => {
  347. this._update(t6.data);
  348. });
  349. }
  350. _update(t5) {
  351. const s6 = "touch" === t5.native.pointerType ? "touch" : "mouse", { x: e8, y: i4 } = t5;
  352. s6 === this._value && this._x === e8 && this._y === i4 || (this._value = s6, this._x = e8, this._y = i4, this._onChange(s6, e8, i4));
  353. }
  354. };
  355. // node_modules/@arcgis/core/views/input/handlers/MultiTouch.js
  356. var i3 = class extends i2 {
  357. constructor() {
  358. super(true), this._activeTouchPointerIds = /* @__PURE__ */ new Set(), this._multiTouchActive = new t3(false), this._onPointerAdd = ({ data: t5 }) => {
  359. "touch" === t5.pointerType && (this._activeTouchPointerIds.add(t5.native.pointerId), this._update());
  360. }, this._onPointerRemove = ({ data: t5 }) => {
  361. "touch" === t5.pointerType && (this._activeTouchPointerIds.delete(t5.native.pointerId), this._update());
  362. }, this.registerIncoming("pointer-down", this._onPointerAdd), this.registerIncoming("pointer-up", this._onPointerRemove), this.registerIncoming("pointer-capture-lost", this._onPointerRemove), this.registerIncoming("pointer-cancel", this._onPointerRemove);
  363. }
  364. get multiTouchActive() {
  365. return this._multiTouchActive.get();
  366. }
  367. _update() {
  368. this._multiTouchActive.set(this._activeTouchPointerIds.size > 1);
  369. }
  370. };
  371. // node_modules/@arcgis/core/views/input/InputManager.js
  372. var u2 = class extends m {
  373. constructor(e8) {
  374. super(e8), this._pointerCaptures = /* @__PURE__ */ new Map(), this._nameToGroup = {}, this._handlers = [], this._handlersPriority = [], this._currentPropagation = null, this._updateDependenciesAfterPropagation = false, this._sourceEvents = /* @__PURE__ */ new Set(), this._keyModifiers = /* @__PURE__ */ new Set(), this._activeKeyModifiers = /* @__PURE__ */ new Set(), this._stoppedPropagationEventIds = /* @__PURE__ */ new Set(), this.primaryKey = e6, this._latestPointerType = "mouse", this._propertiesPool = new o({ latestPointerLocation: v2 }, this), this.latestPointerLocation = null, this.test = { timestamp: void 0, hasCurrentPropagation: () => !!this._currentPropagation };
  375. }
  376. initialize() {
  377. this.eventSource.onEventReceived = this._onEventReceived.bind(this), this._installRecognizers();
  378. }
  379. destroy() {
  380. const e8 = Object.keys(this._nameToGroup);
  381. for (const t5 of e8)
  382. this.uninstallHandlers(t5);
  383. this.eventSource.destroy(), this._currentPropagation = null, this._propertiesPool.destroy();
  384. }
  385. get hasPendingInputs() {
  386. return this._handlers.some((e8) => e8.handler.hasPendingInputs);
  387. }
  388. get latestPointerType() {
  389. return this._latestPointerType;
  390. }
  391. get multiTouchActive() {
  392. return this._multiTouchHandler.multiTouchActive;
  393. }
  394. installHandlers(e8, t5, i4 = P2.INTERNAL) {
  395. if (this._nameToGroup[e8])
  396. return void s.getLogger(this.declaredClass).error("There is already an InputHandler group registered under the name `" + e8 + "`");
  397. if (0 === t5.length)
  398. return void s.getLogger(this.declaredClass).error("Can't register a group of zero handlers");
  399. const n3 = { name: e8, handlers: t5.map((e9) => ({ handler: e9, active: true, removed: false, priorityIndex: 0, groupPriority: i4, eventCallback: null, uninstallCallback: null })) };
  400. this._nameToGroup[e8] = n3;
  401. for (let r2 = n3.handlers.length - 1; r2 >= 0; r2--) {
  402. const e9 = n3.handlers[r2];
  403. this._handlers.push(e9), e9.handler.onInstall({ updateDependencies: () => {
  404. this.updateDependencies();
  405. }, emit: (t6, r3, i5, n4, s6) => {
  406. this._emitInputEvent(e9.priorityIndex + 1, t6, r3, i5, s6, n4);
  407. }, setPointerCapture: (t6, r3) => {
  408. this._setPointerCapture(n3, e9, t6, r3);
  409. }, setEventCallback: (t6) => {
  410. e9.eventCallback = t6;
  411. }, setUninstallCallback: (t6) => {
  412. e9.uninstallCallback = t6;
  413. }, refreshHasPendingInputs: () => {
  414. this.notifyChange("hasPendingInputs");
  415. } });
  416. }
  417. this.updateDependencies();
  418. }
  419. uninstallHandlers(e8) {
  420. const t5 = this._nameToGroup[e8];
  421. t5 ? (t5.handlers.forEach((e9) => {
  422. var _a;
  423. e9.removed = true, (_a = e9.uninstallCallback) == null ? void 0 : _a.call(e9);
  424. }), delete this._nameToGroup[e8], this._currentPropagation ? this._currentPropagation.needsHandlerGarbageCollect = true : this._garbageCollectRemovedHandlers()) : s.getLogger(this.declaredClass).error("There is no InputHandler group registered under the name `" + e8 + "`");
  425. }
  426. hasHandlers(e8) {
  427. return void 0 !== this._nameToGroup[e8];
  428. }
  429. updateDependencies() {
  430. if (this._currentPropagation)
  431. return void (this._updateDependenciesAfterPropagation = true);
  432. this._updateDependenciesAfterPropagation = false;
  433. const e8 = /* @__PURE__ */ new Set(), t5 = /* @__PURE__ */ new Set();
  434. this._handlersPriority = [];
  435. for (let r2 = this._handlers.length - 1; r2 >= 0; r2--) {
  436. const e9 = this._handlers[r2];
  437. e9.priorityIndex = r2, this._handlersPriority.push(e9);
  438. }
  439. this._handlersPriority = this._sortHandlersPriority(this._handlersPriority);
  440. for (let r2 = this._handlersPriority.length - 1; r2 >= 0; r2--) {
  441. const i4 = this._handlersPriority[r2];
  442. i4.priorityIndex = r2;
  443. let n3 = i4.handler.hasSideEffects;
  444. if (!n3) {
  445. for (const t6 of i4.handler.outgoingEventTypes)
  446. if (e8.has(t6)) {
  447. n3 = true;
  448. break;
  449. }
  450. }
  451. if (n3)
  452. for (const r3 of i4.handler.incomingEventMatches) {
  453. e8.add(r3.eventType);
  454. for (const e9 of r3.keyModifiers)
  455. a2(e9) || t5.add(e9);
  456. }
  457. i4.active = n3;
  458. }
  459. this._sourceEvents = e8, this._keyModifiers = t5, this._pointerCaptures.size > 0 && this._sourceEvents.add("pointer-capture-lost"), this._keyModifiers.size > 0 && (this._sourceEvents.add("key-down"), this._sourceEvents.add("key-up")), this.eventSource && (this.eventSource.activeEvents = this._sourceEvents);
  460. }
  461. _setLatestPointer(e8, t5, r2) {
  462. this._latestPointerType = e8;
  463. const n3 = this._get("latestPointerLocation");
  464. if (t(n3) || n3.x !== t5 || n3.y !== r2) {
  465. const e9 = this._propertiesPool.get("latestPointerLocation");
  466. e9.x = t5, e9.y = r2, this._set("latestPointerLocation", e9);
  467. }
  468. }
  469. _onEventReceived(e8, t5) {
  470. if ("pointer-capture-lost" === e8) {
  471. const e9 = t5;
  472. this._pointerCaptures.delete(e9.native.pointerId);
  473. }
  474. this._updateKeyModifiers(e8, t5);
  475. const r2 = null != this.test.timestamp ? this.test.timestamp : t5.native ? t5.native.timestamp : void 0, i4 = t5.native ? t5.native.cancelable : void 0;
  476. this._emitInputEventFromSource(e8, t5, r2, i4);
  477. }
  478. _updateKeyModifiers(e8, t5) {
  479. if (!t5)
  480. return;
  481. let r2 = false;
  482. const i4 = () => {
  483. if (!r2) {
  484. const e9 = /* @__PURE__ */ new Set();
  485. this._activeKeyModifiers.forEach((t6) => {
  486. e9.add(t6);
  487. }), this._activeKeyModifiers = e9, r2 = true;
  488. }
  489. }, n3 = (e9, t6) => {
  490. t6 && !this._activeKeyModifiers.has(e9) ? (i4(), this._activeKeyModifiers.add(e9)) : !t6 && this._activeKeyModifiers.has(e9) && (i4(), this._activeKeyModifiers.delete(e9));
  491. };
  492. if ("key-down" === e8 || "key-up" === e8) {
  493. const r3 = t5.key;
  494. this._keyModifiers.has(r3) && n3(r3, "key-down" === e8);
  495. }
  496. const s6 = t5.native;
  497. n3("Alt", !(!s6 || !s6.altKey)), n3("Ctrl", !(!s6 || !s6.ctrlKey)), n3("Shift", !(!s6 || !s6.shiftKey)), n3("Meta", !(!s6 || !s6.metaKey)), n3("Primary", this._activeKeyModifiers.has(this.primaryKey));
  498. }
  499. _installRecognizers() {
  500. this._latestPointerHandler = new s5((e8, t5, r2) => this._setLatestPointer(e8, t5, r2)), this._multiTouchHandler = new i3(), this.installHandlers("input-manager-logic", [this._latestPointerHandler, this._multiTouchHandler], P2.ALWAYS), this.recognizers.length > 0 && this.installHandlers("default", this.recognizers, P2.INTERNAL);
  501. }
  502. _setPointerCapture(e8, t5, r2, i4) {
  503. const n3 = e8.name + "-" + t5.priorityIndex, s6 = this._pointerCaptures.get(r2.pointerId) || /* @__PURE__ */ new Set();
  504. this._pointerCaptures.set(r2.pointerId, s6), i4 ? (s6.add(n3), 1 === s6.size && this.eventSource && this.eventSource.setPointerCapture(r2, true)) : s6.has(n3) && (s6.delete(n3), 0 === s6.size && (this._pointerCaptures.delete(r2.pointerId), this.eventSource && this.eventSource.setPointerCapture(r2, false)));
  505. }
  506. _garbageCollectRemovedHandlers() {
  507. this._handlers = this._handlers.filter((e8) => !e8.removed), this.updateDependencies();
  508. }
  509. _emitInputEventFromSource(e8, t5, r2, i4) {
  510. this._emitInputEvent(0, e8, t5, r2, i4);
  511. }
  512. _emitInputEvent(e8, t5, r2, i4, n3, s6) {
  513. const o3 = void 0 !== i4 ? i4 : this._currentPropagation ? this._currentPropagation.timestamp : performance.now(), a4 = void 0 !== n3 && n3, l2 = { event: new _(t5, r2, o3, s6 || this._activeKeyModifiers, a4), priorityIndex: e8 };
  514. this._currentPropagation ? this._currentPropagation.events.push(l2) : this._doNewPropagation(l2);
  515. }
  516. _doNewPropagation(e8) {
  517. this._currentPropagation = { events: new e2(), currentHandler: null, needsHandlerGarbageCollect: false, timestamp: e8.event.timestamp }, this._currentPropagation.events.push(e8), this._continuePropagation();
  518. }
  519. _continuePropagation() {
  520. var _a, _b;
  521. const e8 = f(this._currentPropagation);
  522. for (; e8.events.length > 0; ) {
  523. const { event: t5, priorityIndex: r2 } = e8.events.pop(), i4 = t5.data && t5.data.eventId;
  524. if (!(null != i4 && this._stoppedPropagationEventIds.has(i4)))
  525. for (e8.currentHandler = this._handlersPriority[r2]; e8.currentHandler; ) {
  526. if (e8.currentHandler.removed)
  527. e8.needsHandlerGarbageCollect = true;
  528. else {
  529. if (e8.currentHandler.active && !t5.shouldStopPropagation() && ((_b = (_a = e8.currentHandler).eventCallback) == null ? void 0 : _b.call(_a, t5)), t5.shouldStopPropagation()) {
  530. null != i4 && this._stoppedPropagationEventIds.add(i4);
  531. break;
  532. }
  533. if (t5.shouldPausePropagation(() => this._continuePropagation()))
  534. return void this._pausePropagation({ event: t5, priorityIndex: e8.currentHandler.priorityIndex + 1 });
  535. }
  536. e8.currentHandler = this._handlersPriority[e8.currentHandler.priorityIndex + 1];
  537. }
  538. }
  539. e8.needsHandlerGarbageCollect && this._garbageCollectRemovedHandlers(), this.hasPendingInputs || this._stoppedPropagationEventIds.clear(), this._currentPropagation = null, this._updateDependenciesAfterPropagation && this.updateDependencies();
  540. }
  541. _pausePropagation(e8) {
  542. const t5 = new e2();
  543. t5.push(e8);
  544. const r2 = this._currentPropagation;
  545. if (r2) {
  546. for (; r2.events.length; )
  547. t5.push(r2.events.pop());
  548. r2.events = t5, r2.currentHandler = null;
  549. }
  550. }
  551. _compareHandlerPriority(e8, t5) {
  552. if (e8.handler.hasSideEffects !== t5.handler.hasSideEffects)
  553. return e8.handler.hasSideEffects ? 1 : -1;
  554. if (e8.groupPriority !== t5.groupPriority)
  555. return e8.groupPriority > t5.groupPriority ? -1 : 1;
  556. for (const r2 of e8.handler.incomingEventMatches)
  557. for (const e9 of t5.handler.incomingEventMatches) {
  558. if (r2.eventType !== e9.eventType)
  559. continue;
  560. const t6 = r2.keyModifiers.filter((t7) => e9.keyModifiers.includes(t7));
  561. if (t6.length === r2.keyModifiers.length !== (t6.length === e9.keyModifiers.length))
  562. return r2.keyModifiers.length > e9.keyModifiers.length ? -1 : 1;
  563. }
  564. return e8.priorityIndex > t5.priorityIndex ? -1 : 1;
  565. }
  566. _sortHandlersPriority(e8) {
  567. const t5 = [];
  568. for (const r2 of e8) {
  569. let e9 = 0;
  570. for (; e9 < t5.length && this._compareHandlerPriority(r2, t5[e9]) >= 0; )
  571. e9++;
  572. t5.splice(e9, 0, r2);
  573. }
  574. return t5;
  575. }
  576. get debug() {
  577. const e8 = (e9) => {
  578. const t5 = this._setPointerCapture;
  579. this._setPointerCapture = () => {
  580. }, e9(), this._setPointerCapture = t5;
  581. };
  582. return { injectEvent: (t5, r2) => {
  583. e8(() => {
  584. this._onEventReceived(t5, r2);
  585. });
  586. }, disablePointerCapture: e8 };
  587. }
  588. };
  589. e([y2({ readOnly: true })], u2.prototype, "hasPendingInputs", null), e([y2({ constructOnly: true })], u2.prototype, "eventSource", void 0), e([y2({ constructOnly: true })], u2.prototype, "recognizers", void 0), e([y2()], u2.prototype, "_latestPointerType", void 0), e([y2()], u2.prototype, "latestPointerType", null), e([y2()], u2.prototype, "multiTouchActive", null), e([y2({ readOnly: true })], u2.prototype, "latestPointerLocation", void 0), u2 = e([n("esri.views.input.InputManager")], u2);
  590. var _ = class {
  591. constructor(e8, t5, r2, i4, n3) {
  592. this.type = e8, this.data = t5, this.timestamp = r2, this.modifiers = i4, this.cancelable = n3, this._propagationState = g2.NONE, this._resumeCallback = null;
  593. }
  594. stopPropagation() {
  595. this._propagationState |= g2.STOPPED;
  596. }
  597. shouldStopPropagation() {
  598. return 0 != (this._propagationState & g2.STOPPED);
  599. }
  600. async(e8) {
  601. this._propagationState |= g2.PAUSED;
  602. const t5 = (e9, t6) => {
  603. this._propagationState &= ~g2.PAUSED;
  604. const r2 = this._resumeCallback;
  605. if (this._resumeCallback = null, r2 && r2(), t6)
  606. throw e9;
  607. return e9;
  608. };
  609. return ("function" == typeof e8 ? e8() : e8).then((e9) => t5(e9, false), (e9) => t5(e9, true));
  610. }
  611. shouldPausePropagation(e8) {
  612. return !!(this._propagationState & g2.PAUSED) && (this._resumeCallback = e8, true);
  613. }
  614. preventDefault() {
  615. this.data.native.preventDefault();
  616. }
  617. };
  618. var g2;
  619. !function(e8) {
  620. e8[e8.NONE = 0] = "NONE", e8[e8.STOPPED = 1] = "STOPPED", e8[e8.PAUSED = 2] = "PAUSED";
  621. }(g2 || (g2 = {}));
  622. var P2 = { ALWAYS: 1, DEFAULT: 0, TOOL: -1, WIDGET: -2, INTERNAL: -3 };
  623. var v2 = class {
  624. };
  625. export {
  626. e3 as e,
  627. o2 as o,
  628. i2 as i,
  629. u2 as u,
  630. P2 as P,
  631. e4 as e2,
  632. r,
  633. l,
  634. s3 as s,
  635. w,
  636. m2 as m
  637. };
  638. //# sourceMappingURL=chunk-4NE3ZC7B.js.map