@designcombo/video 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +63 -0
  2. package/dist/SharedSystems-BSw9neqH.js +2691 -0
  3. package/dist/WebGLRenderer-BrabW-VK.js +2639 -0
  4. package/dist/WebGPURenderer-BKwBKkzk.js +1655 -0
  5. package/dist/browserAll-C7HVZtqZ.js +1876 -0
  6. package/dist/clips/audio-clip.d.ts +132 -0
  7. package/dist/clips/base-clip.d.ts +86 -0
  8. package/dist/clips/caption-clip.d.ts +257 -0
  9. package/dist/clips/iclip.d.ts +120 -0
  10. package/dist/clips/image-clip.d.ts +110 -0
  11. package/dist/clips/index.d.ts +8 -0
  12. package/dist/clips/text-clip.d.ts +192 -0
  13. package/dist/clips/video-clip.d.ts +200 -0
  14. package/dist/colorToUniform-Du0ROyNd.js +274 -0
  15. package/dist/compositor.d.ts +111 -0
  16. package/dist/index-CjzowIhV.js +28270 -0
  17. package/dist/index.d.ts +14 -0
  18. package/dist/index.es.js +20 -0
  19. package/dist/index.umd.js +1295 -0
  20. package/dist/internal-utils/event-tool.d.ts +50 -0
  21. package/dist/internal-utils/index.d.ts +14 -0
  22. package/dist/internal-utils/log.d.ts +34 -0
  23. package/dist/internal-utils/meta-box.d.ts +1 -0
  24. package/dist/internal-utils/recodemux.d.ts +65 -0
  25. package/dist/internal-utils/stream-utils.d.ts +43 -0
  26. package/dist/internal-utils/worker-timer.d.ts +8 -0
  27. package/dist/json-serialization.d.ts +142 -0
  28. package/dist/mp4-utils/index.d.ts +31 -0
  29. package/dist/mp4-utils/mp4box-utils.d.ts +36 -0
  30. package/dist/mp4-utils/sample-transform.d.ts +23 -0
  31. package/dist/sprite/base-sprite.d.ts +147 -0
  32. package/dist/sprite/pixi-sprite-renderer.d.ts +48 -0
  33. package/dist/studio.d.ts +142 -0
  34. package/dist/transfomer/parts/handle.d.ts +17 -0
  35. package/dist/transfomer/parts/wireframe.d.ts +5 -0
  36. package/dist/transfomer/transformer.d.ts +21 -0
  37. package/dist/utils/audio.d.ts +82 -0
  38. package/dist/utils/chromakey.d.ts +24 -0
  39. package/dist/utils/color.d.ts +4 -0
  40. package/dist/utils/common.d.ts +7 -0
  41. package/dist/utils/dom.d.ts +48 -0
  42. package/dist/utils/fonts.d.ts +16 -0
  43. package/dist/utils/index.d.ts +5 -0
  44. package/dist/utils/srt-parser.d.ts +15 -0
  45. package/dist/utils/video.d.ts +18 -0
  46. package/dist/webworkerAll-DsE6HIYE.js +2497 -0
  47. package/package.json +53 -0
@@ -0,0 +1,1876 @@
1
+ import { T as M, U as Z, P as m, r as te, E as y, b as ie, w as g, e as P, C as V } from "./index-CjzowIhV.js";
2
+ import "./webworkerAll-DsE6HIYE.js";
3
+ class q {
4
+ constructor(e) {
5
+ this._lastTransform = "", this._observer = null, this._tickerAttached = !1, this.updateTranslation = () => {
6
+ if (!this._canvas)
7
+ return;
8
+ const t = this._canvas.getBoundingClientRect(), i = this._canvas.width, n = this._canvas.height, s = t.width / i * this._renderer.resolution, o = t.height / n * this._renderer.resolution, r = t.left, l = t.top, d = `translate(${r}px, ${l}px) scale(${s}, ${o})`;
9
+ d !== this._lastTransform && (this._domElement.style.transform = d, this._lastTransform = d);
10
+ }, this._domElement = e.domElement, this._renderer = e.renderer, !(globalThis.OffscreenCanvas && this._renderer.canvas instanceof OffscreenCanvas) && (this._canvas = this._renderer.canvas, this._attachObserver());
11
+ }
12
+ /** The canvas element that this CanvasObserver is associated with. */
13
+ get canvas() {
14
+ return this._canvas;
15
+ }
16
+ /** Attaches the DOM element to the canvas parent if it is not already attached. */
17
+ ensureAttached() {
18
+ !this._domElement.parentNode && this._canvas.parentNode && (this._canvas.parentNode.appendChild(this._domElement), this.updateTranslation());
19
+ }
20
+ /** Sets up a ResizeObserver if available. This ensures that the DOM element is kept in sync with the canvas size . */
21
+ _attachObserver() {
22
+ "ResizeObserver" in globalThis ? (this._observer && (this._observer.disconnect(), this._observer = null), this._observer = new ResizeObserver((e) => {
23
+ for (const t of e) {
24
+ if (t.target !== this._canvas)
25
+ continue;
26
+ const i = this.canvas.width, n = this.canvas.height, s = t.contentRect.width / i * this._renderer.resolution, o = t.contentRect.height / n * this._renderer.resolution;
27
+ (this._lastScaleX !== s || this._lastScaleY !== o) && (this.updateTranslation(), this._lastScaleX = s, this._lastScaleY = o);
28
+ }
29
+ }), this._observer.observe(this._canvas)) : this._tickerAttached || M.shared.add(this.updateTranslation, this, Z.HIGH);
30
+ }
31
+ /** Destroys the CanvasObserver instance, cleaning up observers and Ticker. */
32
+ destroy() {
33
+ this._observer ? (this._observer.disconnect(), this._observer = null) : this._tickerAttached && M.shared.remove(this.updateTranslation), this._domElement = null, this._renderer = null, this._canvas = null, this._tickerAttached = !1, this._lastTransform = "", this._lastScaleX = null, this._lastScaleY = null;
34
+ }
35
+ }
36
+ class w {
37
+ /**
38
+ * @param manager - The event boundary which manages this event. Propagation can only occur
39
+ * within the boundary's jurisdiction.
40
+ */
41
+ constructor(e) {
42
+ this.bubbles = !0, this.cancelBubble = !0, this.cancelable = !1, this.composed = !1, this.defaultPrevented = !1, this.eventPhase = w.prototype.NONE, this.propagationStopped = !1, this.propagationImmediatelyStopped = !1, this.layer = new m(), this.page = new m(), this.NONE = 0, this.CAPTURING_PHASE = 1, this.AT_TARGET = 2, this.BUBBLING_PHASE = 3, this.manager = e;
43
+ }
44
+ /** @readonly */
45
+ get layerX() {
46
+ return this.layer.x;
47
+ }
48
+ /** @readonly */
49
+ get layerY() {
50
+ return this.layer.y;
51
+ }
52
+ /** @readonly */
53
+ get pageX() {
54
+ return this.page.x;
55
+ }
56
+ /** @readonly */
57
+ get pageY() {
58
+ return this.page.y;
59
+ }
60
+ /**
61
+ * Fallback for the deprecated `InteractionEvent.data`.
62
+ * @deprecated since 7.0.0
63
+ */
64
+ get data() {
65
+ return this;
66
+ }
67
+ /**
68
+ * The propagation path for this event. Alias for {@link EventBoundary.propagationPath}.
69
+ * @advanced
70
+ */
71
+ composedPath() {
72
+ return this.manager && (!this.path || this.path[this.path.length - 1] !== this.target) && (this.path = this.target ? this.manager.propagationPath(this.target) : []), this.path;
73
+ }
74
+ /**
75
+ * Unimplemented method included for implementing the DOM interface `Event`. It will throw an `Error`.
76
+ * @deprecated
77
+ * @ignore
78
+ * @param _type
79
+ * @param _bubbles
80
+ * @param _cancelable
81
+ */
82
+ initEvent(e, t, i) {
83
+ throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.");
84
+ }
85
+ /**
86
+ * Unimplemented method included for implementing the DOM interface `UIEvent`. It will throw an `Error`.
87
+ * @ignore
88
+ * @deprecated
89
+ * @param _typeArg
90
+ * @param _bubblesArg
91
+ * @param _cancelableArg
92
+ * @param _viewArg
93
+ * @param _detailArg
94
+ */
95
+ initUIEvent(e, t, i, n, s) {
96
+ throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.");
97
+ }
98
+ /**
99
+ * Prevent default behavior of both PixiJS and the user agent.
100
+ * @example
101
+ * ```ts
102
+ * sprite.on('click', (event) => {
103
+ * // Prevent both browser's default click behavior
104
+ * // and PixiJS's default handling
105
+ * event.preventDefault();
106
+ *
107
+ * // Custom handling
108
+ * customClickHandler();
109
+ * });
110
+ * ```
111
+ * @remarks
112
+ * - Only works if the native event is cancelable
113
+ * - Does not stop event propagation
114
+ */
115
+ preventDefault() {
116
+ this.nativeEvent instanceof Event && this.nativeEvent.cancelable && this.nativeEvent.preventDefault(), this.defaultPrevented = !0;
117
+ }
118
+ /**
119
+ * Stop this event from propagating to any additional listeners, including those
120
+ * on the current target and any following targets in the propagation path.
121
+ * @example
122
+ * ```ts
123
+ * container.on('pointerdown', (event) => {
124
+ * // Stop all further event handling
125
+ * event.stopImmediatePropagation();
126
+ *
127
+ * // These handlers won't be called:
128
+ * // - Other pointerdown listeners on this container
129
+ * // - Any pointerdown listeners on parent containers
130
+ * });
131
+ * ```
132
+ * @remarks
133
+ * - Immediately stops all event propagation
134
+ * - Prevents other listeners on same target from being called
135
+ * - More aggressive than stopPropagation()
136
+ */
137
+ stopImmediatePropagation() {
138
+ this.propagationImmediatelyStopped = !0;
139
+ }
140
+ /**
141
+ * Stop this event from propagating to the next target in the propagation path.
142
+ * The rest of the listeners on the current target will still be notified.
143
+ * @example
144
+ * ```ts
145
+ * child.on('pointermove', (event) => {
146
+ * // Handle event on child
147
+ * updateChild();
148
+ *
149
+ * // Prevent parent handlers from being called
150
+ * event.stopPropagation();
151
+ * });
152
+ *
153
+ * // This won't be called if child handles the event
154
+ * parent.on('pointermove', (event) => {
155
+ * updateParent();
156
+ * });
157
+ * ```
158
+ * @remarks
159
+ * - Stops event bubbling to parent containers
160
+ * - Does not prevent other listeners on same target
161
+ * - Less aggressive than stopImmediatePropagation()
162
+ */
163
+ stopPropagation() {
164
+ this.propagationStopped = !0;
165
+ }
166
+ }
167
+ var I = /iPhone/i, B = /iPod/i, C = /iPad/i, U = /\biOS-universal(?:.+)Mac\b/i, k = /\bAndroid(?:.+)Mobile\b/i, R = /Android/i, b = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i, O = /Silk/i, v = /Windows Phone/i, X = /\bWindows(?:.+)ARM\b/i, Y = /BlackBerry/i, H = /BB10/i, F = /Opera Mini/i, N = /\b(CriOS|Chrome)(?:.+)Mobile/i, $ = /Mobile(?:.+)Firefox\b/i, K = function(a) {
168
+ return typeof a < "u" && a.platform === "MacIntel" && typeof a.maxTouchPoints == "number" && a.maxTouchPoints > 1 && typeof MSStream > "u";
169
+ };
170
+ function ne(a) {
171
+ return function(e) {
172
+ return e.test(a);
173
+ };
174
+ }
175
+ function G(a) {
176
+ var e = {
177
+ userAgent: "",
178
+ platform: "",
179
+ maxTouchPoints: 0
180
+ };
181
+ !a && typeof navigator < "u" ? e = {
182
+ userAgent: navigator.userAgent,
183
+ platform: navigator.platform,
184
+ maxTouchPoints: navigator.maxTouchPoints || 0
185
+ } : typeof a == "string" ? e.userAgent = a : a && a.userAgent && (e = {
186
+ userAgent: a.userAgent,
187
+ platform: a.platform,
188
+ maxTouchPoints: a.maxTouchPoints || 0
189
+ });
190
+ var t = e.userAgent, i = t.split("[FBAN");
191
+ typeof i[1] < "u" && (t = i[0]), i = t.split("Twitter"), typeof i[1] < "u" && (t = i[0]);
192
+ var n = ne(t), s = {
193
+ apple: {
194
+ phone: n(I) && !n(v),
195
+ ipod: n(B),
196
+ tablet: !n(I) && (n(C) || K(e)) && !n(v),
197
+ universal: n(U),
198
+ device: (n(I) || n(B) || n(C) || n(U) || K(e)) && !n(v)
199
+ },
200
+ amazon: {
201
+ phone: n(b),
202
+ tablet: !n(b) && n(O),
203
+ device: n(b) || n(O)
204
+ },
205
+ android: {
206
+ phone: !n(v) && n(b) || !n(v) && n(k),
207
+ tablet: !n(v) && !n(b) && !n(k) && (n(O) || n(R)),
208
+ device: !n(v) && (n(b) || n(O) || n(k) || n(R)) || n(/\bokhttp\b/i)
209
+ },
210
+ windows: {
211
+ phone: n(v),
212
+ tablet: n(X),
213
+ device: n(v) || n(X)
214
+ },
215
+ other: {
216
+ blackberry: n(Y),
217
+ blackberry10: n(H),
218
+ opera: n(F),
219
+ firefox: n($),
220
+ chrome: n(N),
221
+ device: n(Y) || n(H) || n(F) || n($) || n(N)
222
+ },
223
+ any: !1,
224
+ phone: !1,
225
+ tablet: !1
226
+ };
227
+ return s.any = s.apple.device || s.android.device || s.windows.device || s.other.device, s.phone = s.apple.phone || s.android.phone || s.windows.phone, s.tablet = s.apple.tablet || s.android.tablet || s.windows.tablet, s;
228
+ }
229
+ const se = G.default ?? G, oe = se(globalThis.navigator), re = 9, W = 100, ae = 0, le = 0, j = 2, z = 1, he = -1e3, ce = -1e3, de = 2, L = class J {
230
+ // eslint-disable-next-line jsdoc/require-param
231
+ /**
232
+ * @param {WebGLRenderer|WebGPURenderer} renderer - A reference to the current renderer
233
+ */
234
+ constructor(e, t = oe) {
235
+ this._mobileInfo = t, this.debug = !1, this._activateOnTab = !0, this._deactivateOnMouseMove = !0, this._isActive = !1, this._isMobileAccessibility = !1, this._div = null, this._pools = {}, this._renderId = 0, this._children = [], this._androidUpdateCount = 0, this._androidUpdateFrequency = 500, this._isRunningTests = !1, this._boundOnKeyDown = this._onKeyDown.bind(this), this._boundOnMouseMove = this._onMouseMove.bind(this), this._hookDiv = null, (t.tablet || t.phone) && this._createTouchHook(), this._renderer = e;
236
+ }
237
+ /**
238
+ * Value of `true` if accessibility is currently active and accessibility layers are showing.
239
+ * @type {boolean}
240
+ * @readonly
241
+ */
242
+ get isActive() {
243
+ return this._isActive;
244
+ }
245
+ /**
246
+ * Value of `true` if accessibility is enabled for touch devices.
247
+ * @type {boolean}
248
+ * @readonly
249
+ */
250
+ get isMobileAccessibility() {
251
+ return this._isMobileAccessibility;
252
+ }
253
+ /**
254
+ * Button element for handling touch hooks.
255
+ * @readonly
256
+ */
257
+ get hookDiv() {
258
+ return this._hookDiv;
259
+ }
260
+ /**
261
+ * The DOM element that will sit over the PixiJS element. This is where the div overlays will go.
262
+ * @readonly
263
+ */
264
+ get div() {
265
+ return this._div;
266
+ }
267
+ /**
268
+ * Creates the touch hooks.
269
+ * @private
270
+ */
271
+ _createTouchHook() {
272
+ const e = document.createElement("button");
273
+ e.style.width = `${z}px`, e.style.height = `${z}px`, e.style.position = "absolute", e.style.top = `${he}px`, e.style.left = `${ce}px`, e.style.zIndex = de.toString(), e.style.backgroundColor = "#FF0000", e.title = "select to enable accessibility for this content", e.addEventListener("focus", () => {
274
+ this._isMobileAccessibility = !0, this._activate(), this._destroyTouchHook();
275
+ }), document.body.appendChild(e), this._hookDiv = e;
276
+ }
277
+ /**
278
+ * Destroys the touch hooks.
279
+ * @private
280
+ */
281
+ _destroyTouchHook() {
282
+ this._hookDiv && (document.body.removeChild(this._hookDiv), this._hookDiv = null);
283
+ }
284
+ /**
285
+ * Activating will cause the Accessibility layer to be shown.
286
+ * This is called when a user presses the tab key.
287
+ * @private
288
+ */
289
+ _activate() {
290
+ if (this._isActive)
291
+ return;
292
+ this._isActive = !0, this._div || (this._div = document.createElement("div"), this._div.style.position = "absolute", this._div.style.top = `${ae}px`, this._div.style.left = `${le}px`, this._div.style.pointerEvents = "none", this._div.style.zIndex = j.toString(), this._canvasObserver = new q({
293
+ domElement: this._div,
294
+ renderer: this._renderer
295
+ })), this._activateOnTab && globalThis.addEventListener("keydown", this._boundOnKeyDown, !1), this._deactivateOnMouseMove && globalThis.document.addEventListener("mousemove", this._boundOnMouseMove, !0);
296
+ const e = this._renderer.view.canvas;
297
+ if (e.parentNode)
298
+ this._canvasObserver.ensureAttached(), this._initAccessibilitySetup();
299
+ else {
300
+ const t = new MutationObserver(() => {
301
+ e.parentNode && (t.disconnect(), this._canvasObserver.ensureAttached(), this._initAccessibilitySetup());
302
+ });
303
+ t.observe(document.body, { childList: !0, subtree: !0 });
304
+ }
305
+ }
306
+ // New method to handle initialization after div is ready
307
+ _initAccessibilitySetup() {
308
+ this._renderer.runners.postrender.add(this), this._renderer.lastObjectRendered && this._updateAccessibleObjects(this._renderer.lastObjectRendered);
309
+ }
310
+ /**
311
+ * Deactivates the accessibility system. Removes listeners and accessibility elements.
312
+ * @private
313
+ */
314
+ _deactivate() {
315
+ if (!(!this._isActive || this._isMobileAccessibility)) {
316
+ this._isActive = !1, globalThis.document.removeEventListener("mousemove", this._boundOnMouseMove, !0), this._activateOnTab && globalThis.addEventListener("keydown", this._boundOnKeyDown, !1), this._renderer.runners.postrender.remove(this);
317
+ for (const e of this._children)
318
+ e._accessibleDiv?.parentNode && (e._accessibleDiv.parentNode.removeChild(e._accessibleDiv), e._accessibleDiv = null), e._accessibleActive = !1;
319
+ for (const e in this._pools)
320
+ this._pools[e].forEach((i) => {
321
+ i.parentNode && i.parentNode.removeChild(i);
322
+ }), delete this._pools[e];
323
+ this._div?.parentNode && this._div.parentNode.removeChild(this._div), this._pools = {}, this._children = [];
324
+ }
325
+ }
326
+ /**
327
+ * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.
328
+ * @private
329
+ * @param {Container} container - The Container to check.
330
+ */
331
+ _updateAccessibleObjects(e) {
332
+ if (!e.visible || !e.accessibleChildren)
333
+ return;
334
+ e.accessible && (e._accessibleActive || this._addChild(e), e._renderId = this._renderId);
335
+ const t = e.children;
336
+ if (t)
337
+ for (let i = 0; i < t.length; i++)
338
+ this._updateAccessibleObjects(t[i]);
339
+ }
340
+ /**
341
+ * Runner init called, view is available at this point.
342
+ * @ignore
343
+ */
344
+ init(e) {
345
+ const i = {
346
+ accessibilityOptions: {
347
+ ...J.defaultOptions,
348
+ ...e?.accessibilityOptions || {}
349
+ }
350
+ };
351
+ this.debug = i.accessibilityOptions.debug, this._activateOnTab = i.accessibilityOptions.activateOnTab, this._deactivateOnMouseMove = i.accessibilityOptions.deactivateOnMouseMove, i.accessibilityOptions.enabledByDefault && this._activate(), this._renderer.runners.postrender.remove(this);
352
+ }
353
+ /**
354
+ * Updates the accessibility layer during rendering.
355
+ * - Removes divs for containers no longer in the scene
356
+ * - Updates the position and dimensions of the root div
357
+ * - Updates positions of active accessibility divs
358
+ * Only fires while the accessibility system is active.
359
+ * @ignore
360
+ */
361
+ postrender() {
362
+ const e = performance.now();
363
+ if (this._mobileInfo.android.device && e < this._androidUpdateCount || (this._androidUpdateCount = e + this._androidUpdateFrequency, (!this._renderer.renderingToScreen || !this._renderer.view.canvas) && !this._isRunningTests))
364
+ return;
365
+ const t = /* @__PURE__ */ new Set();
366
+ if (this._renderer.lastObjectRendered) {
367
+ this._updateAccessibleObjects(this._renderer.lastObjectRendered);
368
+ for (const i of this._children)
369
+ i._renderId === this._renderId && t.add(this._children.indexOf(i));
370
+ }
371
+ for (let i = this._children.length - 1; i >= 0; i--) {
372
+ const n = this._children[i];
373
+ t.has(i) || (n._accessibleDiv && n._accessibleDiv.parentNode && (n._accessibleDiv.parentNode.removeChild(n._accessibleDiv), this._getPool(n.accessibleType).push(n._accessibleDiv), n._accessibleDiv = null), n._accessibleActive = !1, te(this._children, i, 1));
374
+ }
375
+ this._renderer.renderingToScreen && this._canvasObserver.ensureAttached();
376
+ for (let i = 0; i < this._children.length; i++) {
377
+ const n = this._children[i];
378
+ if (!n._accessibleActive || !n._accessibleDiv)
379
+ continue;
380
+ const s = n._accessibleDiv, o = n.hitArea || n.getBounds().rectangle;
381
+ if (n.hitArea) {
382
+ const r = n.worldTransform;
383
+ s.style.left = `${r.tx + o.x * r.a}px`, s.style.top = `${r.ty + o.y * r.d}px`, s.style.width = `${o.width * r.a}px`, s.style.height = `${o.height * r.d}px`;
384
+ } else
385
+ this._capHitArea(o), s.style.left = `${o.x}px`, s.style.top = `${o.y}px`, s.style.width = `${o.width}px`, s.style.height = `${o.height}px`;
386
+ }
387
+ this._renderId++;
388
+ }
389
+ /**
390
+ * private function that will visually add the information to the
391
+ * accessibility div
392
+ * @param {HTMLElement} div -
393
+ */
394
+ _updateDebugHTML(e) {
395
+ e.innerHTML = `type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`;
396
+ }
397
+ /**
398
+ * Adjust the hit area based on the bounds of a display object
399
+ * @param {Rectangle} hitArea - Bounds of the child
400
+ */
401
+ _capHitArea(e) {
402
+ e.x < 0 && (e.width += e.x, e.x = 0), e.y < 0 && (e.height += e.y, e.y = 0);
403
+ const { width: t, height: i } = this._renderer;
404
+ e.x + e.width > t && (e.width = t - e.x), e.y + e.height > i && (e.height = i - e.y);
405
+ }
406
+ /**
407
+ * Creates or reuses a div element for a Container and adds it to the accessibility layer.
408
+ * Sets up ARIA attributes, event listeners, and positioning based on the container's properties.
409
+ * @private
410
+ * @param {Container} container - The child to make accessible.
411
+ */
412
+ _addChild(e) {
413
+ let i = this._getPool(e.accessibleType).pop();
414
+ i ? (i.innerHTML = "", i.removeAttribute("title"), i.removeAttribute("aria-label"), i.tabIndex = 0) : (e.accessibleType === "button" ? i = document.createElement("button") : (i = document.createElement(e.accessibleType), i.style.cssText = `
415
+ color: transparent;
416
+ pointer-events: none;
417
+ padding: 0;
418
+ margin: 0;
419
+ border: 0;
420
+ outline: 0;
421
+ background: transparent;
422
+ box-sizing: border-box;
423
+ user-select: none;
424
+ -webkit-user-select: none;
425
+ -moz-user-select: none;
426
+ -ms-user-select: none;
427
+ `, e.accessibleText && (i.innerText = e.accessibleText)), i.style.width = `${W}px`, i.style.height = `${W}px`, i.style.backgroundColor = this.debug ? "rgba(255,255,255,0.5)" : "transparent", i.style.position = "absolute", i.style.zIndex = j.toString(), i.style.borderStyle = "none", navigator.userAgent.toLowerCase().includes("chrome") ? i.setAttribute("aria-live", "off") : i.setAttribute("aria-live", "polite"), navigator.userAgent.match(/rv:.*Gecko\//) ? i.setAttribute("aria-relevant", "additions") : i.setAttribute("aria-relevant", "text"), i.addEventListener("click", this._onClick.bind(this)), i.addEventListener("focus", this._onFocus.bind(this)), i.addEventListener("focusout", this._onFocusOut.bind(this))), i.style.pointerEvents = e.accessiblePointerEvents, i.type = e.accessibleType, e.accessibleTitle && e.accessibleTitle !== null ? i.title = e.accessibleTitle : (!e.accessibleHint || e.accessibleHint === null) && (i.title = `container ${e.tabIndex}`), e.accessibleHint && e.accessibleHint !== null && i.setAttribute("aria-label", e.accessibleHint), e.interactive ? i.tabIndex = e.tabIndex : i.tabIndex = 0, this.debug && this._updateDebugHTML(i), e._accessibleActive = !0, e._accessibleDiv = i, i.container = e, this._children.push(e), this._div.appendChild(e._accessibleDiv);
428
+ }
429
+ /**
430
+ * Dispatch events with the EventSystem.
431
+ * @param e
432
+ * @param type
433
+ * @private
434
+ */
435
+ _dispatchEvent(e, t) {
436
+ const { container: i } = e.target, n = this._renderer.events.rootBoundary, s = Object.assign(new w(n), { target: i });
437
+ n.rootTarget = this._renderer.lastObjectRendered, t.forEach((o) => n.dispatchEvent(s, o));
438
+ }
439
+ /**
440
+ * Maps the div button press to pixi's EventSystem (click)
441
+ * @private
442
+ * @param {MouseEvent} e - The click event.
443
+ */
444
+ _onClick(e) {
445
+ this._dispatchEvent(e, ["click", "pointertap", "tap"]);
446
+ }
447
+ /**
448
+ * Maps the div focus events to pixi's EventSystem (mouseover)
449
+ * @private
450
+ * @param {FocusEvent} e - The focus event.
451
+ */
452
+ _onFocus(e) {
453
+ e.target.getAttribute("aria-live") || e.target.setAttribute("aria-live", "assertive"), this._dispatchEvent(e, ["mouseover"]);
454
+ }
455
+ /**
456
+ * Maps the div focus events to pixi's EventSystem (mouseout)
457
+ * @private
458
+ * @param {FocusEvent} e - The focusout event.
459
+ */
460
+ _onFocusOut(e) {
461
+ e.target.getAttribute("aria-live") || e.target.setAttribute("aria-live", "polite"), this._dispatchEvent(e, ["mouseout"]);
462
+ }
463
+ /**
464
+ * Is called when a key is pressed
465
+ * @private
466
+ * @param {KeyboardEvent} e - The keydown event.
467
+ */
468
+ _onKeyDown(e) {
469
+ e.keyCode !== re || !this._activateOnTab || this._activate();
470
+ }
471
+ /**
472
+ * Is called when the mouse moves across the renderer element
473
+ * @private
474
+ * @param {MouseEvent} e - The mouse event.
475
+ */
476
+ _onMouseMove(e) {
477
+ e.movementX === 0 && e.movementY === 0 || this._deactivate();
478
+ }
479
+ /**
480
+ * Destroys the accessibility system. Removes all elements and listeners.
481
+ * > [!IMPORTANT] This is typically called automatically when the {@link Application} is destroyed.
482
+ * > A typically user should not need to call this method directly.
483
+ */
484
+ destroy() {
485
+ this._deactivate(), this._destroyTouchHook(), this._canvasObserver?.destroy(), this._canvasObserver = null, this._div = null, this._pools = null, this._children = null, this._renderer = null, this._hookDiv = null, globalThis.removeEventListener("keydown", this._boundOnKeyDown), this._boundOnKeyDown = null, globalThis.document.removeEventListener("mousemove", this._boundOnMouseMove, !0), this._boundOnMouseMove = null;
486
+ }
487
+ /**
488
+ * Enables or disables the accessibility system.
489
+ * @param enabled - Whether to enable or disable accessibility.
490
+ * @example
491
+ * ```js
492
+ * app.renderer.accessibility.setAccessibilityEnabled(true); // Enable accessibility
493
+ * app.renderer.accessibility.setAccessibilityEnabled(false); // Disable accessibility
494
+ * ```
495
+ */
496
+ setAccessibilityEnabled(e) {
497
+ e ? this._activate() : this._deactivate();
498
+ }
499
+ _getPool(e) {
500
+ return this._pools[e] || (this._pools[e] = []), this._pools[e];
501
+ }
502
+ };
503
+ L.extension = {
504
+ type: [
505
+ y.WebGLSystem,
506
+ y.WebGPUSystem
507
+ ],
508
+ name: "accessibility"
509
+ };
510
+ L.defaultOptions = {
511
+ /**
512
+ * Whether to enable accessibility features on initialization
513
+ * @default false
514
+ */
515
+ enabledByDefault: !1,
516
+ /**
517
+ * Whether to visually show the accessibility divs for debugging
518
+ * @default false
519
+ */
520
+ debug: !1,
521
+ /**
522
+ * Whether to activate accessibility when tab key is pressed
523
+ * @default true
524
+ */
525
+ activateOnTab: !0,
526
+ /**
527
+ * Whether to deactivate accessibility when mouse moves
528
+ * @default true
529
+ */
530
+ deactivateOnMouseMove: !0
531
+ };
532
+ let ue = L;
533
+ const pe = {
534
+ accessible: !1,
535
+ accessibleTitle: null,
536
+ accessibleHint: null,
537
+ tabIndex: 0,
538
+ accessibleType: "button",
539
+ accessibleText: null,
540
+ accessiblePointerEvents: "auto",
541
+ accessibleChildren: !0,
542
+ _accessibleActive: !1,
543
+ _accessibleDiv: null,
544
+ _renderId: -1
545
+ };
546
+ class Q {
547
+ /**
548
+ * Constructor for the DOMPipe class.
549
+ * @param renderer - The renderer instance that this DOMPipe will be associated with.
550
+ */
551
+ constructor(e) {
552
+ this._attachedDomElements = [], this._renderer = e, this._renderer.runners.postrender.add(this), this._renderer.runners.init.add(this), this._domElement = document.createElement("div"), this._domElement.style.position = "absolute", this._domElement.style.top = "0", this._domElement.style.left = "0", this._domElement.style.pointerEvents = "none", this._domElement.style.zIndex = "1000";
553
+ }
554
+ /** Initializes the DOMPipe, setting up the main DOM element and adding it to the document body. */
555
+ init() {
556
+ this._canvasObserver = new q({
557
+ domElement: this._domElement,
558
+ renderer: this._renderer
559
+ });
560
+ }
561
+ /**
562
+ * Adds a renderable DOM container to the list of attached elements.
563
+ * @param domContainer - The DOM container to be added.
564
+ * @param _instructionSet - The instruction set (unused).
565
+ */
566
+ addRenderable(e, t) {
567
+ this._attachedDomElements.includes(e) || this._attachedDomElements.push(e);
568
+ }
569
+ /**
570
+ * Updates a renderable DOM container.
571
+ * @param _domContainer - The DOM container to be updated (unused).
572
+ */
573
+ updateRenderable(e) {
574
+ }
575
+ /**
576
+ * Validates a renderable DOM container.
577
+ * @param _domContainer - The DOM container to be validated (unused).
578
+ * @returns Always returns true as validation is not required.
579
+ */
580
+ validateRenderable(e) {
581
+ return !0;
582
+ }
583
+ /** Handles the post-rendering process, ensuring DOM elements are correctly positioned and visible. */
584
+ postrender() {
585
+ const e = this._attachedDomElements;
586
+ if (e.length === 0) {
587
+ this._domElement.remove();
588
+ return;
589
+ }
590
+ this._canvasObserver.ensureAttached();
591
+ for (let t = 0; t < e.length; t++) {
592
+ const i = e[t], n = i.element;
593
+ if (!i.parent || i.globalDisplayStatus < 7)
594
+ n?.remove(), e.splice(t, 1), t--;
595
+ else {
596
+ this._domElement.contains(n) || (n.style.position = "absolute", n.style.pointerEvents = "auto", this._domElement.appendChild(n));
597
+ const s = i.worldTransform, o = i._anchor, r = i.width * o.x, l = i.height * o.y;
598
+ n.style.transformOrigin = `${r}px ${l}px`, n.style.transform = `matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.tx - r}, ${s.ty - l})`, n.style.opacity = i.groupAlpha.toString();
599
+ }
600
+ }
601
+ }
602
+ /** Destroys the DOMPipe, removing all attached DOM elements and cleaning up resources. */
603
+ destroy() {
604
+ this._renderer.runners.postrender.remove(this);
605
+ for (let e = 0; e < this._attachedDomElements.length; e++)
606
+ this._attachedDomElements[e].element?.remove();
607
+ this._attachedDomElements.length = 0, this._domElement.remove(), this._canvasObserver.destroy(), this._renderer = null;
608
+ }
609
+ }
610
+ Q.extension = {
611
+ type: [
612
+ y.WebGLPipes,
613
+ y.WebGPUPipes,
614
+ y.CanvasPipes
615
+ ],
616
+ name: "dom"
617
+ };
618
+ class ve {
619
+ constructor() {
620
+ this.interactionFrequency = 10, this._deltaTime = 0, this._didMove = !1, this._tickerAdded = !1, this._pauseUpdate = !0;
621
+ }
622
+ /**
623
+ * Initializes the event ticker.
624
+ * @param events - The event system.
625
+ */
626
+ init(e) {
627
+ this.removeTickerListener(), this.events = e, this.interactionFrequency = 10, this._deltaTime = 0, this._didMove = !1, this._tickerAdded = !1, this._pauseUpdate = !0;
628
+ }
629
+ /** Whether to pause the update checks or not. */
630
+ get pauseUpdate() {
631
+ return this._pauseUpdate;
632
+ }
633
+ set pauseUpdate(e) {
634
+ this._pauseUpdate = e;
635
+ }
636
+ /** Adds the ticker listener. */
637
+ addTickerListener() {
638
+ this._tickerAdded || !this.domElement || (M.system.add(this._tickerUpdate, this, Z.INTERACTION), this._tickerAdded = !0);
639
+ }
640
+ /** Removes the ticker listener. */
641
+ removeTickerListener() {
642
+ this._tickerAdded && (M.system.remove(this._tickerUpdate, this), this._tickerAdded = !1);
643
+ }
644
+ /** Sets flag to not fire extra events when the user has already moved there mouse */
645
+ pointerMoved() {
646
+ this._didMove = !0;
647
+ }
648
+ /** Updates the state of interactive objects. */
649
+ _update() {
650
+ if (!this.domElement || this._pauseUpdate)
651
+ return;
652
+ if (this._didMove) {
653
+ this._didMove = !1;
654
+ return;
655
+ }
656
+ const e = this.events._rootPointerEvent;
657
+ this.events.supportsTouchEvents && e.pointerType === "touch" || globalThis.document.dispatchEvent(this.events.supportsPointerEvents ? new PointerEvent("pointermove", {
658
+ clientX: e.clientX,
659
+ clientY: e.clientY,
660
+ pointerType: e.pointerType,
661
+ pointerId: e.pointerId
662
+ }) : new MouseEvent("mousemove", {
663
+ clientX: e.clientX,
664
+ clientY: e.clientY
665
+ }));
666
+ }
667
+ /**
668
+ * Updates the state of interactive objects if at least {@link interactionFrequency}
669
+ * milliseconds have passed since the last invocation.
670
+ *
671
+ * Invoked by a throttled ticker update from {@link Ticker.system}.
672
+ * @param ticker - The throttled ticker.
673
+ */
674
+ _tickerUpdate(e) {
675
+ this._deltaTime += e.deltaTime, !(this._deltaTime < this.interactionFrequency) && (this._deltaTime = 0, this._update());
676
+ }
677
+ /** Destroys the event ticker. */
678
+ destroy() {
679
+ this.removeTickerListener(), this.events = null, this.domElement = null, this._deltaTime = 0, this._didMove = !1, this._tickerAdded = !1, this._pauseUpdate = !0;
680
+ }
681
+ }
682
+ const f = new ve();
683
+ class A extends w {
684
+ constructor() {
685
+ super(...arguments), this.client = new m(), this.movement = new m(), this.offset = new m(), this.global = new m(), this.screen = new m();
686
+ }
687
+ /** @readonly */
688
+ get clientX() {
689
+ return this.client.x;
690
+ }
691
+ /** @readonly */
692
+ get clientY() {
693
+ return this.client.y;
694
+ }
695
+ /**
696
+ * Alias for {@link FederatedMouseEvent.clientX this.clientX}.
697
+ * @readonly
698
+ */
699
+ get x() {
700
+ return this.clientX;
701
+ }
702
+ /**
703
+ * Alias for {@link FederatedMouseEvent.clientY this.clientY}.
704
+ * @readonly
705
+ */
706
+ get y() {
707
+ return this.clientY;
708
+ }
709
+ /** @readonly */
710
+ get movementX() {
711
+ return this.movement.x;
712
+ }
713
+ /** @readonly */
714
+ get movementY() {
715
+ return this.movement.y;
716
+ }
717
+ /** @readonly */
718
+ get offsetX() {
719
+ return this.offset.x;
720
+ }
721
+ /** @readonly */
722
+ get offsetY() {
723
+ return this.offset.y;
724
+ }
725
+ /** @readonly */
726
+ get globalX() {
727
+ return this.global.x;
728
+ }
729
+ /** @readonly */
730
+ get globalY() {
731
+ return this.global.y;
732
+ }
733
+ /**
734
+ * The pointer coordinates in the renderer's screen. Alias for `screen.x`.
735
+ * @readonly
736
+ */
737
+ get screenX() {
738
+ return this.screen.x;
739
+ }
740
+ /**
741
+ * The pointer coordinates in the renderer's screen. Alias for `screen.y`.
742
+ * @readonly
743
+ */
744
+ get screenY() {
745
+ return this.screen.y;
746
+ }
747
+ /**
748
+ * Converts global coordinates into container-local coordinates.
749
+ *
750
+ * This method transforms coordinates from world space to a container's local space,
751
+ * useful for precise positioning and hit testing.
752
+ * @param container - The Container to get local coordinates for
753
+ * @param point - Optional Point object to store the result. If not provided, a new Point will be created
754
+ * @param globalPos - Optional custom global coordinates. If not provided, the event's global position is used
755
+ * @returns The local coordinates as a Point object
756
+ * @example
757
+ * ```ts
758
+ * // Basic usage - get local coordinates relative to a container
759
+ * sprite.on('pointermove', (event: FederatedMouseEvent) => {
760
+ * // Get position relative to the sprite
761
+ * const localPos = event.getLocalPosition(sprite);
762
+ * console.log('Local position:', localPos.x, localPos.y);
763
+ * });
764
+ * // Using custom global coordinates
765
+ * const customGlobal = new Point(100, 100);
766
+ * sprite.on('pointermove', (event: FederatedMouseEvent) => {
767
+ * // Transform custom coordinates
768
+ * const localPos = event.getLocalPosition(sprite, undefined, customGlobal);
769
+ * console.log('Custom local position:', localPos.x, localPos.y);
770
+ * });
771
+ * ```
772
+ * @see {@link Container.worldTransform} For the transformation matrix
773
+ * @see {@link Point} For the point class used to store coordinates
774
+ */
775
+ getLocalPosition(e, t, i) {
776
+ return e.worldTransform.applyInverse(i || this.global, t);
777
+ }
778
+ /**
779
+ * Whether the modifier key was pressed when this event natively occurred.
780
+ * @param key - The modifier key.
781
+ */
782
+ getModifierState(e) {
783
+ return "getModifierState" in this.nativeEvent && this.nativeEvent.getModifierState(e);
784
+ }
785
+ /**
786
+ * Not supported.
787
+ * @param _typeArg
788
+ * @param _canBubbleArg
789
+ * @param _cancelableArg
790
+ * @param _viewArg
791
+ * @param _detailArg
792
+ * @param _screenXArg
793
+ * @param _screenYArg
794
+ * @param _clientXArg
795
+ * @param _clientYArg
796
+ * @param _ctrlKeyArg
797
+ * @param _altKeyArg
798
+ * @param _shiftKeyArg
799
+ * @param _metaKeyArg
800
+ * @param _buttonArg
801
+ * @param _relatedTargetArg
802
+ * @deprecated since 7.0.0
803
+ * @ignore
804
+ */
805
+ // eslint-disable-next-line max-params
806
+ initMouseEvent(e, t, i, n, s, o, r, l, d, h, _, c, p, D, Ee) {
807
+ throw new Error("Method not implemented.");
808
+ }
809
+ }
810
+ class u extends A {
811
+ constructor() {
812
+ super(...arguments), this.width = 0, this.height = 0, this.isPrimary = !1;
813
+ }
814
+ /**
815
+ * Only included for completeness for now
816
+ * @ignore
817
+ */
818
+ getCoalescedEvents() {
819
+ return this.type === "pointermove" || this.type === "mousemove" || this.type === "touchmove" ? [this] : [];
820
+ }
821
+ /**
822
+ * Only included for completeness for now
823
+ * @ignore
824
+ */
825
+ getPredictedEvents() {
826
+ throw new Error("getPredictedEvents is not supported!");
827
+ }
828
+ }
829
+ class E extends A {
830
+ constructor() {
831
+ super(...arguments), this.DOM_DELTA_PIXEL = 0, this.DOM_DELTA_LINE = 1, this.DOM_DELTA_PAGE = 2;
832
+ }
833
+ }
834
+ E.DOM_DELTA_PIXEL = 0;
835
+ E.DOM_DELTA_LINE = 1;
836
+ E.DOM_DELTA_PAGE = 2;
837
+ const fe = 2048, me = new m(), T = new m();
838
+ class _e {
839
+ /**
840
+ * @param rootTarget - The holder of the event boundary.
841
+ */
842
+ constructor(e) {
843
+ this.dispatch = new ie(), this.moveOnAll = !1, this.enableGlobalMoveEvents = !0, this.mappingState = {
844
+ trackingData: {}
845
+ }, this.eventPool = /* @__PURE__ */ new Map(), this._allInteractiveElements = [], this._hitElements = [], this._isPointerMoveEvent = !1, this.rootTarget = e, this.hitPruneFn = this.hitPruneFn.bind(this), this.hitTestFn = this.hitTestFn.bind(this), this.mapPointerDown = this.mapPointerDown.bind(this), this.mapPointerMove = this.mapPointerMove.bind(this), this.mapPointerOut = this.mapPointerOut.bind(this), this.mapPointerOver = this.mapPointerOver.bind(this), this.mapPointerUp = this.mapPointerUp.bind(this), this.mapPointerUpOutside = this.mapPointerUpOutside.bind(this), this.mapWheel = this.mapWheel.bind(this), this.mappingTable = {}, this.addEventMapping("pointerdown", this.mapPointerDown), this.addEventMapping("pointermove", this.mapPointerMove), this.addEventMapping("pointerout", this.mapPointerOut), this.addEventMapping("pointerleave", this.mapPointerOut), this.addEventMapping("pointerover", this.mapPointerOver), this.addEventMapping("pointerup", this.mapPointerUp), this.addEventMapping("pointerupoutside", this.mapPointerUpOutside), this.addEventMapping("wheel", this.mapWheel);
846
+ }
847
+ /**
848
+ * Adds an event mapping for the event `type` handled by `fn`.
849
+ *
850
+ * Event mappings can be used to implement additional or custom events. They take an event
851
+ * coming from the upstream scene (or directly from the {@link EventSystem}) and dispatch new downstream events
852
+ * generally trickling down and bubbling up to {@link EventBoundary.rootTarget this.rootTarget}.
853
+ *
854
+ * To modify the semantics of existing events, the built-in mapping methods of EventBoundary should be overridden
855
+ * instead.
856
+ * @param type - The type of upstream event to map.
857
+ * @param fn - The mapping method. The context of this function must be bound manually, if desired.
858
+ */
859
+ addEventMapping(e, t) {
860
+ this.mappingTable[e] || (this.mappingTable[e] = []), this.mappingTable[e].push({
861
+ fn: t,
862
+ priority: 0
863
+ }), this.mappingTable[e].sort((i, n) => i.priority - n.priority);
864
+ }
865
+ /**
866
+ * Dispatches the given event
867
+ * @param e - The event to dispatch.
868
+ * @param type - The type of event to dispatch. Defaults to `e.type`.
869
+ */
870
+ dispatchEvent(e, t) {
871
+ e.propagationStopped = !1, e.propagationImmediatelyStopped = !1, this.propagate(e, t), this.dispatch.emit(t || e.type, e);
872
+ }
873
+ /**
874
+ * Maps the given upstream event through the event boundary and propagates it downstream.
875
+ * @param e - The event to map.
876
+ */
877
+ mapEvent(e) {
878
+ if (!this.rootTarget)
879
+ return;
880
+ const t = this.mappingTable[e.type];
881
+ if (t)
882
+ for (let i = 0, n = t.length; i < n; i++)
883
+ t[i].fn(e);
884
+ else
885
+ g(`[EventBoundary]: Event mapping not defined for ${e.type}`);
886
+ }
887
+ /**
888
+ * Finds the Container that is the target of a event at the given coordinates.
889
+ *
890
+ * The passed (x,y) coordinates are in the world space above this event boundary.
891
+ * @param x - The x coordinate of the event.
892
+ * @param y - The y coordinate of the event.
893
+ */
894
+ hitTest(e, t) {
895
+ f.pauseUpdate = !0;
896
+ const n = this._isPointerMoveEvent && this.enableGlobalMoveEvents ? "hitTestMoveRecursive" : "hitTestRecursive", s = this[n](
897
+ this.rootTarget,
898
+ this.rootTarget.eventMode,
899
+ me.set(e, t),
900
+ this.hitTestFn,
901
+ this.hitPruneFn
902
+ );
903
+ return s && s[0];
904
+ }
905
+ /**
906
+ * Propagate the passed event from from {@link EventBoundary.rootTarget this.rootTarget} to its
907
+ * target `e.target`.
908
+ * @param e - The event to propagate.
909
+ * @param type - The type of event to propagate. Defaults to `e.type`.
910
+ */
911
+ propagate(e, t) {
912
+ if (!e.target)
913
+ return;
914
+ const i = e.composedPath();
915
+ e.eventPhase = e.CAPTURING_PHASE;
916
+ for (let n = 0, s = i.length - 1; n < s; n++)
917
+ if (e.currentTarget = i[n], this.notifyTarget(e, t), e.propagationStopped || e.propagationImmediatelyStopped)
918
+ return;
919
+ if (e.eventPhase = e.AT_TARGET, e.currentTarget = e.target, this.notifyTarget(e, t), !(e.propagationStopped || e.propagationImmediatelyStopped)) {
920
+ e.eventPhase = e.BUBBLING_PHASE;
921
+ for (let n = i.length - 2; n >= 0; n--)
922
+ if (e.currentTarget = i[n], this.notifyTarget(e, t), e.propagationStopped || e.propagationImmediatelyStopped)
923
+ return;
924
+ }
925
+ }
926
+ /**
927
+ * Emits the event `e` to all interactive containers. The event is propagated in the bubbling phase always.
928
+ *
929
+ * This is used in the `globalpointermove` event.
930
+ * @param e - The emitted event.
931
+ * @param type - The listeners to notify.
932
+ * @param targets - The targets to notify.
933
+ */
934
+ all(e, t, i = this._allInteractiveElements) {
935
+ if (i.length === 0)
936
+ return;
937
+ e.eventPhase = e.BUBBLING_PHASE;
938
+ const n = Array.isArray(t) ? t : [t];
939
+ for (let s = i.length - 1; s >= 0; s--)
940
+ n.forEach((o) => {
941
+ e.currentTarget = i[s], this.notifyTarget(e, o);
942
+ });
943
+ }
944
+ /**
945
+ * Finds the propagation path from {@link EventBoundary.rootTarget rootTarget} to the passed
946
+ * `target`. The last element in the path is `target`.
947
+ * @param target - The target to find the propagation path to.
948
+ */
949
+ propagationPath(e) {
950
+ const t = [e];
951
+ for (let i = 0; i < fe && e !== this.rootTarget && e.parent; i++) {
952
+ if (!e.parent)
953
+ throw new Error("Cannot find propagation path to disconnected target");
954
+ t.push(e.parent), e = e.parent;
955
+ }
956
+ return t.reverse(), t;
957
+ }
958
+ hitTestMoveRecursive(e, t, i, n, s, o = !1) {
959
+ let r = !1;
960
+ if (this._interactivePrune(e))
961
+ return null;
962
+ if ((e.eventMode === "dynamic" || t === "dynamic") && (f.pauseUpdate = !1), e.interactiveChildren && e.children) {
963
+ const h = e.children;
964
+ for (let _ = h.length - 1; _ >= 0; _--) {
965
+ const c = h[_], p = this.hitTestMoveRecursive(
966
+ c,
967
+ this._isInteractive(t) ? t : c.eventMode,
968
+ i,
969
+ n,
970
+ s,
971
+ o || s(e, i)
972
+ );
973
+ if (p) {
974
+ if (p.length > 0 && !p[p.length - 1].parent)
975
+ continue;
976
+ const D = e.isInteractive();
977
+ (p.length > 0 || D) && (D && this._allInteractiveElements.push(e), p.push(e)), this._hitElements.length === 0 && (this._hitElements = p), r = !0;
978
+ }
979
+ }
980
+ }
981
+ const l = this._isInteractive(t), d = e.isInteractive();
982
+ return d && d && this._allInteractiveElements.push(e), o || this._hitElements.length > 0 ? null : r ? this._hitElements : l && !s(e, i) && n(e, i) ? d ? [e] : [] : null;
983
+ }
984
+ /**
985
+ * Recursive implementation for {@link EventBoundary.hitTest hitTest}.
986
+ * @param currentTarget - The Container that is to be hit tested.
987
+ * @param eventMode - The event mode for the `currentTarget` or one of its parents.
988
+ * @param location - The location that is being tested for overlap.
989
+ * @param testFn - Callback that determines whether the target passes hit testing. This callback
990
+ * can assume that `pruneFn` failed to prune the container.
991
+ * @param pruneFn - Callback that determiness whether the target and all of its children
992
+ * cannot pass the hit test. It is used as a preliminary optimization to prune entire subtrees
993
+ * of the scene graph.
994
+ * @returns An array holding the hit testing target and all its ancestors in order. The first element
995
+ * is the target itself and the last is {@link EventBoundary.rootTarget rootTarget}. This is the opposite
996
+ * order w.r.t. the propagation path. If no hit testing target is found, null is returned.
997
+ */
998
+ hitTestRecursive(e, t, i, n, s) {
999
+ if (this._interactivePrune(e) || s(e, i))
1000
+ return null;
1001
+ if ((e.eventMode === "dynamic" || t === "dynamic") && (f.pauseUpdate = !1), e.interactiveChildren && e.children) {
1002
+ const l = e.children, d = i;
1003
+ for (let h = l.length - 1; h >= 0; h--) {
1004
+ const _ = l[h], c = this.hitTestRecursive(
1005
+ _,
1006
+ this._isInteractive(t) ? t : _.eventMode,
1007
+ d,
1008
+ n,
1009
+ s
1010
+ );
1011
+ if (c) {
1012
+ if (c.length > 0 && !c[c.length - 1].parent)
1013
+ continue;
1014
+ const p = e.isInteractive();
1015
+ return (c.length > 0 || p) && c.push(e), c;
1016
+ }
1017
+ }
1018
+ }
1019
+ const o = this._isInteractive(t), r = e.isInteractive();
1020
+ return o && n(e, i) ? r ? [e] : [] : null;
1021
+ }
1022
+ _isInteractive(e) {
1023
+ return e === "static" || e === "dynamic";
1024
+ }
1025
+ _interactivePrune(e) {
1026
+ return !e || !e.visible || !e.renderable || !e.measurable || e.eventMode === "none" || e.eventMode === "passive" && !e.interactiveChildren;
1027
+ }
1028
+ /**
1029
+ * Checks whether the container or any of its children cannot pass the hit test at all.
1030
+ *
1031
+ * {@link EventBoundary}'s implementation uses the {@link Container.hitArea hitArea}
1032
+ * and {@link Container._maskEffect} for pruning.
1033
+ * @param container - The container to prune.
1034
+ * @param location - The location to test for overlap.
1035
+ */
1036
+ hitPruneFn(e, t) {
1037
+ if (e.hitArea && (e.worldTransform.applyInverse(t, T), !e.hitArea.contains(T.x, T.y)))
1038
+ return !0;
1039
+ if (e.effects && e.effects.length)
1040
+ for (let i = 0; i < e.effects.length; i++) {
1041
+ const n = e.effects[i];
1042
+ if (n.containsPoint && !n.containsPoint(t, this.hitTestFn))
1043
+ return !0;
1044
+ }
1045
+ return !1;
1046
+ }
1047
+ /**
1048
+ * Checks whether the container passes hit testing for the given location.
1049
+ * @param container - The container to test.
1050
+ * @param location - The location to test for overlap.
1051
+ * @returns - Whether `container` passes hit testing for `location`.
1052
+ */
1053
+ hitTestFn(e, t) {
1054
+ return e.hitArea ? !0 : e?.containsPoint ? (e.worldTransform.applyInverse(t, T), e.containsPoint(T)) : !1;
1055
+ }
1056
+ /**
1057
+ * Notify all the listeners to the event's `currentTarget`.
1058
+ *
1059
+ * If the `currentTarget` contains the property `on<type>`, then it is called here,
1060
+ * simulating the behavior from version 6.x and prior.
1061
+ * @param e - The event passed to the target.
1062
+ * @param type - The type of event to notify. Defaults to `e.type`.
1063
+ */
1064
+ notifyTarget(e, t) {
1065
+ if (!e.currentTarget.isInteractive())
1066
+ return;
1067
+ t ?? (t = e.type);
1068
+ const i = `on${t}`;
1069
+ e.currentTarget[i]?.(e);
1070
+ const n = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? `${t}capture` : t;
1071
+ this._notifyListeners(e, n), e.eventPhase === e.AT_TARGET && this._notifyListeners(e, t);
1072
+ }
1073
+ /**
1074
+ * Maps the upstream `pointerdown` events to a downstream `pointerdown` event.
1075
+ *
1076
+ * `touchstart`, `rightdown`, `mousedown` events are also dispatched for specific pointer types.
1077
+ * @param from - The upstream `pointerdown` event.
1078
+ */
1079
+ mapPointerDown(e) {
1080
+ if (!(e instanceof u)) {
1081
+ g("EventBoundary cannot map a non-pointer event as a pointer event");
1082
+ return;
1083
+ }
1084
+ const t = this.createPointerEvent(e);
1085
+ if (this.dispatchEvent(t, "pointerdown"), t.pointerType === "touch")
1086
+ this.dispatchEvent(t, "touchstart");
1087
+ else if (t.pointerType === "mouse" || t.pointerType === "pen") {
1088
+ const n = t.button === 2;
1089
+ this.dispatchEvent(t, n ? "rightdown" : "mousedown");
1090
+ }
1091
+ const i = this.trackingData(e.pointerId);
1092
+ i.pressTargetsByButton[e.button] = t.composedPath(), this.freeEvent(t);
1093
+ }
1094
+ /**
1095
+ * Maps the upstream `pointermove` to downstream `pointerout`, `pointerover`, and `pointermove` events, in that order.
1096
+ *
1097
+ * The tracking data for the specific pointer has an updated `overTarget`. `mouseout`, `mouseover`,
1098
+ * `mousemove`, and `touchmove` events are fired as well for specific pointer types.
1099
+ * @param from - The upstream `pointermove` event.
1100
+ */
1101
+ mapPointerMove(e) {
1102
+ if (!(e instanceof u)) {
1103
+ g("EventBoundary cannot map a non-pointer event as a pointer event");
1104
+ return;
1105
+ }
1106
+ this._allInteractiveElements.length = 0, this._hitElements.length = 0, this._isPointerMoveEvent = !0;
1107
+ const t = this.createPointerEvent(e);
1108
+ this._isPointerMoveEvent = !1;
1109
+ const i = t.pointerType === "mouse" || t.pointerType === "pen", n = this.trackingData(e.pointerId), s = this.findMountedTarget(n.overTargets);
1110
+ if (n.overTargets?.length > 0 && s !== t.target) {
1111
+ const l = e.type === "mousemove" ? "mouseout" : "pointerout", d = this.createPointerEvent(e, l, s);
1112
+ if (this.dispatchEvent(d, "pointerout"), i && this.dispatchEvent(d, "mouseout"), !t.composedPath().includes(s)) {
1113
+ const h = this.createPointerEvent(e, "pointerleave", s);
1114
+ for (h.eventPhase = h.AT_TARGET; h.target && !t.composedPath().includes(h.target); )
1115
+ h.currentTarget = h.target, this.notifyTarget(h), i && this.notifyTarget(h, "mouseleave"), h.target = h.target.parent;
1116
+ this.freeEvent(h);
1117
+ }
1118
+ this.freeEvent(d);
1119
+ }
1120
+ if (s !== t.target) {
1121
+ const l = e.type === "mousemove" ? "mouseover" : "pointerover", d = this.clonePointerEvent(t, l);
1122
+ this.dispatchEvent(d, "pointerover"), i && this.dispatchEvent(d, "mouseover");
1123
+ let h = s?.parent;
1124
+ for (; h && h !== this.rootTarget.parent && h !== t.target; )
1125
+ h = h.parent;
1126
+ if (!h || h === this.rootTarget.parent) {
1127
+ const c = this.clonePointerEvent(t, "pointerenter");
1128
+ for (c.eventPhase = c.AT_TARGET; c.target && c.target !== s && c.target !== this.rootTarget.parent; )
1129
+ c.currentTarget = c.target, this.notifyTarget(c), i && this.notifyTarget(c, "mouseenter"), c.target = c.target.parent;
1130
+ this.freeEvent(c);
1131
+ }
1132
+ this.freeEvent(d);
1133
+ }
1134
+ const o = [], r = this.enableGlobalMoveEvents ?? !0;
1135
+ this.moveOnAll ? o.push("pointermove") : this.dispatchEvent(t, "pointermove"), r && o.push("globalpointermove"), t.pointerType === "touch" && (this.moveOnAll ? o.splice(1, 0, "touchmove") : this.dispatchEvent(t, "touchmove"), r && o.push("globaltouchmove")), i && (this.moveOnAll ? o.splice(1, 0, "mousemove") : this.dispatchEvent(t, "mousemove"), r && o.push("globalmousemove"), this.cursor = t.target?.cursor), o.length > 0 && this.all(t, o), this._allInteractiveElements.length = 0, this._hitElements.length = 0, n.overTargets = t.composedPath(), this.freeEvent(t);
1136
+ }
1137
+ /**
1138
+ * Maps the upstream `pointerover` to downstream `pointerover` and `pointerenter` events, in that order.
1139
+ *
1140
+ * The tracking data for the specific pointer gets a new `overTarget`.
1141
+ * @param from - The upstream `pointerover` event.
1142
+ */
1143
+ mapPointerOver(e) {
1144
+ if (!(e instanceof u)) {
1145
+ g("EventBoundary cannot map a non-pointer event as a pointer event");
1146
+ return;
1147
+ }
1148
+ const t = this.trackingData(e.pointerId), i = this.createPointerEvent(e), n = i.pointerType === "mouse" || i.pointerType === "pen";
1149
+ this.dispatchEvent(i, "pointerover"), n && this.dispatchEvent(i, "mouseover"), i.pointerType === "mouse" && (this.cursor = i.target?.cursor);
1150
+ const s = this.clonePointerEvent(i, "pointerenter");
1151
+ for (s.eventPhase = s.AT_TARGET; s.target && s.target !== this.rootTarget.parent; )
1152
+ s.currentTarget = s.target, this.notifyTarget(s), n && this.notifyTarget(s, "mouseenter"), s.target = s.target.parent;
1153
+ t.overTargets = i.composedPath(), this.freeEvent(i), this.freeEvent(s);
1154
+ }
1155
+ /**
1156
+ * Maps the upstream `pointerout` to downstream `pointerout`, `pointerleave` events, in that order.
1157
+ *
1158
+ * The tracking data for the specific pointer is cleared of a `overTarget`.
1159
+ * @param from - The upstream `pointerout` event.
1160
+ */
1161
+ mapPointerOut(e) {
1162
+ if (!(e instanceof u)) {
1163
+ g("EventBoundary cannot map a non-pointer event as a pointer event");
1164
+ return;
1165
+ }
1166
+ const t = this.trackingData(e.pointerId);
1167
+ if (t.overTargets) {
1168
+ const i = e.pointerType === "mouse" || e.pointerType === "pen", n = this.findMountedTarget(t.overTargets), s = this.createPointerEvent(e, "pointerout", n);
1169
+ this.dispatchEvent(s), i && this.dispatchEvent(s, "mouseout");
1170
+ const o = this.createPointerEvent(e, "pointerleave", n);
1171
+ for (o.eventPhase = o.AT_TARGET; o.target && o.target !== this.rootTarget.parent; )
1172
+ o.currentTarget = o.target, this.notifyTarget(o), i && this.notifyTarget(o, "mouseleave"), o.target = o.target.parent;
1173
+ t.overTargets = null, this.freeEvent(s), this.freeEvent(o);
1174
+ }
1175
+ this.cursor = null;
1176
+ }
1177
+ /**
1178
+ * Maps the upstream `pointerup` event to downstream `pointerup`, `pointerupoutside`,
1179
+ * and `click`/`rightclick`/`pointertap` events, in that order.
1180
+ *
1181
+ * The `pointerupoutside` event bubbles from the original `pointerdown` target to the most specific
1182
+ * ancestor of the `pointerdown` and `pointerup` targets, which is also the `click` event's target. `touchend`,
1183
+ * `rightup`, `mouseup`, `touchendoutside`, `rightupoutside`, `mouseupoutside`, and `tap` are fired as well for
1184
+ * specific pointer types.
1185
+ * @param from - The upstream `pointerup` event.
1186
+ */
1187
+ mapPointerUp(e) {
1188
+ if (!(e instanceof u)) {
1189
+ g("EventBoundary cannot map a non-pointer event as a pointer event");
1190
+ return;
1191
+ }
1192
+ const t = performance.now(), i = this.createPointerEvent(e);
1193
+ if (this.dispatchEvent(i, "pointerup"), i.pointerType === "touch")
1194
+ this.dispatchEvent(i, "touchend");
1195
+ else if (i.pointerType === "mouse" || i.pointerType === "pen") {
1196
+ const r = i.button === 2;
1197
+ this.dispatchEvent(i, r ? "rightup" : "mouseup");
1198
+ }
1199
+ const n = this.trackingData(e.pointerId), s = this.findMountedTarget(n.pressTargetsByButton[e.button]);
1200
+ let o = s;
1201
+ if (s && !i.composedPath().includes(s)) {
1202
+ let r = s;
1203
+ for (; r && !i.composedPath().includes(r); ) {
1204
+ if (i.currentTarget = r, this.notifyTarget(i, "pointerupoutside"), i.pointerType === "touch")
1205
+ this.notifyTarget(i, "touchendoutside");
1206
+ else if (i.pointerType === "mouse" || i.pointerType === "pen") {
1207
+ const l = i.button === 2;
1208
+ this.notifyTarget(i, l ? "rightupoutside" : "mouseupoutside");
1209
+ }
1210
+ r = r.parent;
1211
+ }
1212
+ delete n.pressTargetsByButton[e.button], o = r;
1213
+ }
1214
+ if (o) {
1215
+ const r = this.clonePointerEvent(i, "click");
1216
+ r.target = o, r.path = null, n.clicksByButton[e.button] || (n.clicksByButton[e.button] = {
1217
+ clickCount: 0,
1218
+ target: r.target,
1219
+ timeStamp: t
1220
+ });
1221
+ const l = n.clicksByButton[e.button];
1222
+ if (l.target === r.target && t - l.timeStamp < 200 ? ++l.clickCount : l.clickCount = 1, l.target = r.target, l.timeStamp = t, r.detail = l.clickCount, r.pointerType === "mouse") {
1223
+ const d = r.button === 2;
1224
+ this.dispatchEvent(r, d ? "rightclick" : "click");
1225
+ } else r.pointerType === "touch" && this.dispatchEvent(r, "tap");
1226
+ this.dispatchEvent(r, "pointertap"), this.freeEvent(r);
1227
+ }
1228
+ this.freeEvent(i);
1229
+ }
1230
+ /**
1231
+ * Maps the upstream `pointerupoutside` event to a downstream `pointerupoutside` event, bubbling from the original
1232
+ * `pointerdown` target to `rootTarget`.
1233
+ *
1234
+ * (The most specific ancestor of the `pointerdown` event and the `pointerup` event must the
1235
+ * `{@link EventBoundary}'s root because the `pointerup` event occurred outside of the boundary.)
1236
+ *
1237
+ * `touchendoutside`, `mouseupoutside`, and `rightupoutside` events are fired as well for specific pointer
1238
+ * types. The tracking data for the specific pointer is cleared of a `pressTarget`.
1239
+ * @param from - The upstream `pointerupoutside` event.
1240
+ */
1241
+ mapPointerUpOutside(e) {
1242
+ if (!(e instanceof u)) {
1243
+ g("EventBoundary cannot map a non-pointer event as a pointer event");
1244
+ return;
1245
+ }
1246
+ const t = this.trackingData(e.pointerId), i = this.findMountedTarget(t.pressTargetsByButton[e.button]), n = this.createPointerEvent(e);
1247
+ if (i) {
1248
+ let s = i;
1249
+ for (; s; )
1250
+ n.currentTarget = s, this.notifyTarget(n, "pointerupoutside"), n.pointerType === "touch" ? this.notifyTarget(n, "touchendoutside") : (n.pointerType === "mouse" || n.pointerType === "pen") && this.notifyTarget(n, n.button === 2 ? "rightupoutside" : "mouseupoutside"), s = s.parent;
1251
+ delete t.pressTargetsByButton[e.button];
1252
+ }
1253
+ this.freeEvent(n);
1254
+ }
1255
+ /**
1256
+ * Maps the upstream `wheel` event to a downstream `wheel` event.
1257
+ * @param from - The upstream `wheel` event.
1258
+ */
1259
+ mapWheel(e) {
1260
+ if (!(e instanceof E)) {
1261
+ g("EventBoundary cannot map a non-wheel event as a wheel event");
1262
+ return;
1263
+ }
1264
+ const t = this.createWheelEvent(e);
1265
+ this.dispatchEvent(t), this.freeEvent(t);
1266
+ }
1267
+ /**
1268
+ * Finds the most specific event-target in the given propagation path that is still mounted in the scene graph.
1269
+ *
1270
+ * This is used to find the correct `pointerup` and `pointerout` target in the case that the original `pointerdown`
1271
+ * or `pointerover` target was unmounted from the scene graph.
1272
+ * @param propagationPath - The propagation path was valid in the past.
1273
+ * @returns - The most specific event-target still mounted at the same location in the scene graph.
1274
+ */
1275
+ findMountedTarget(e) {
1276
+ if (!e)
1277
+ return null;
1278
+ let t = e[0];
1279
+ for (let i = 1; i < e.length && e[i].parent === t; i++)
1280
+ t = e[i];
1281
+ return t;
1282
+ }
1283
+ /**
1284
+ * Creates an event whose `originalEvent` is `from`, with an optional `type` and `target` override.
1285
+ *
1286
+ * The event is allocated using {@link EventBoundary#allocateEvent this.allocateEvent}.
1287
+ * @param from - The `originalEvent` for the returned event.
1288
+ * @param [type=from.type] - The type of the returned event.
1289
+ * @param target - The target of the returned event.
1290
+ */
1291
+ createPointerEvent(e, t, i) {
1292
+ const n = this.allocateEvent(u);
1293
+ return this.copyPointerData(e, n), this.copyMouseData(e, n), this.copyData(e, n), n.nativeEvent = e.nativeEvent, n.originalEvent = e, n.target = i ?? this.hitTest(n.global.x, n.global.y) ?? this._hitElements[0], typeof t == "string" && (n.type = t), n;
1294
+ }
1295
+ /**
1296
+ * Creates a wheel event whose `originalEvent` is `from`.
1297
+ *
1298
+ * The event is allocated using {@link EventBoundary#allocateEvent this.allocateEvent}.
1299
+ * @param from - The upstream wheel event.
1300
+ */
1301
+ createWheelEvent(e) {
1302
+ const t = this.allocateEvent(E);
1303
+ return this.copyWheelData(e, t), this.copyMouseData(e, t), this.copyData(e, t), t.nativeEvent = e.nativeEvent, t.originalEvent = e, t.target = this.hitTest(t.global.x, t.global.y), t;
1304
+ }
1305
+ /**
1306
+ * Clones the event `from`, with an optional `type` override.
1307
+ *
1308
+ * The event is allocated using {@link EventBoundary#allocateEvent this.allocateEvent}.
1309
+ * @param from - The event to clone.
1310
+ * @param [type=from.type] - The type of the returned event.
1311
+ */
1312
+ clonePointerEvent(e, t) {
1313
+ const i = this.allocateEvent(u);
1314
+ return i.nativeEvent = e.nativeEvent, i.originalEvent = e.originalEvent, this.copyPointerData(e, i), this.copyMouseData(e, i), this.copyData(e, i), i.target = e.target, i.path = e.composedPath().slice(), i.type = t ?? i.type, i;
1315
+ }
1316
+ /**
1317
+ * Copies wheel {@link FederatedWheelEvent} data from `from` into `to`.
1318
+ *
1319
+ * The following properties are copied:
1320
+ * + deltaMode
1321
+ * + deltaX
1322
+ * + deltaY
1323
+ * + deltaZ
1324
+ * @param from - The event to copy data from.
1325
+ * @param to - The event to copy data into.
1326
+ */
1327
+ copyWheelData(e, t) {
1328
+ t.deltaMode = e.deltaMode, t.deltaX = e.deltaX, t.deltaY = e.deltaY, t.deltaZ = e.deltaZ;
1329
+ }
1330
+ /**
1331
+ * Copies pointer {@link FederatedPointerEvent} data from `from` into `to`.
1332
+ *
1333
+ * The following properties are copied:
1334
+ * + pointerId
1335
+ * + width
1336
+ * + height
1337
+ * + isPrimary
1338
+ * + pointerType
1339
+ * + pressure
1340
+ * + tangentialPressure
1341
+ * + tiltX
1342
+ * + tiltY
1343
+ * @param from - The event to copy data from.
1344
+ * @param to - The event to copy data into.
1345
+ */
1346
+ copyPointerData(e, t) {
1347
+ e instanceof u && t instanceof u && (t.pointerId = e.pointerId, t.width = e.width, t.height = e.height, t.isPrimary = e.isPrimary, t.pointerType = e.pointerType, t.pressure = e.pressure, t.tangentialPressure = e.tangentialPressure, t.tiltX = e.tiltX, t.tiltY = e.tiltY, t.twist = e.twist);
1348
+ }
1349
+ /**
1350
+ * Copies mouse {@link FederatedMouseEvent} data from `from` to `to`.
1351
+ *
1352
+ * The following properties are copied:
1353
+ * + altKey
1354
+ * + button
1355
+ * + buttons
1356
+ * + clientX
1357
+ * + clientY
1358
+ * + metaKey
1359
+ * + movementX
1360
+ * + movementY
1361
+ * + pageX
1362
+ * + pageY
1363
+ * + x
1364
+ * + y
1365
+ * + screen
1366
+ * + shiftKey
1367
+ * + global
1368
+ * @param from - The event to copy data from.
1369
+ * @param to - The event to copy data into.
1370
+ */
1371
+ copyMouseData(e, t) {
1372
+ e instanceof A && t instanceof A && (t.altKey = e.altKey, t.button = e.button, t.buttons = e.buttons, t.client.copyFrom(e.client), t.ctrlKey = e.ctrlKey, t.metaKey = e.metaKey, t.movement.copyFrom(e.movement), t.screen.copyFrom(e.screen), t.shiftKey = e.shiftKey, t.global.copyFrom(e.global));
1373
+ }
1374
+ /**
1375
+ * Copies base {@link FederatedEvent} data from `from` into `to`.
1376
+ *
1377
+ * The following properties are copied:
1378
+ * + isTrusted
1379
+ * + srcElement
1380
+ * + timeStamp
1381
+ * + type
1382
+ * @param from - The event to copy data from.
1383
+ * @param to - The event to copy data into.
1384
+ */
1385
+ copyData(e, t) {
1386
+ t.isTrusted = e.isTrusted, t.srcElement = e.srcElement, t.timeStamp = performance.now(), t.type = e.type, t.detail = e.detail, t.view = e.view, t.which = e.which, t.layer.copyFrom(e.layer), t.page.copyFrom(e.page);
1387
+ }
1388
+ /**
1389
+ * @param id - The pointer ID.
1390
+ * @returns The tracking data stored for the given pointer. If no data exists, a blank
1391
+ * state will be created.
1392
+ */
1393
+ trackingData(e) {
1394
+ return this.mappingState.trackingData[e] || (this.mappingState.trackingData[e] = {
1395
+ pressTargetsByButton: {},
1396
+ clicksByButton: {},
1397
+ overTarget: null
1398
+ }), this.mappingState.trackingData[e];
1399
+ }
1400
+ /**
1401
+ * Allocate a specific type of event from {@link EventBoundary#eventPool this.eventPool}.
1402
+ *
1403
+ * This allocation is constructor-agnostic, as long as it only takes one argument - this event
1404
+ * boundary.
1405
+ * @param constructor - The event's constructor.
1406
+ * @returns An event of the given type.
1407
+ */
1408
+ allocateEvent(e) {
1409
+ this.eventPool.has(e) || this.eventPool.set(e, []);
1410
+ const t = this.eventPool.get(e).pop() || new e(this);
1411
+ return t.eventPhase = t.NONE, t.currentTarget = null, t.defaultPrevented = !1, t.path = null, t.target = null, t;
1412
+ }
1413
+ /**
1414
+ * Frees the event and puts it back into the event pool.
1415
+ *
1416
+ * It is illegal to reuse the event until it is allocated again, using `this.allocateEvent`.
1417
+ *
1418
+ * It is also advised that events not allocated from {@link EventBoundary#allocateEvent this.allocateEvent}
1419
+ * not be freed. This is because of the possibility that the same event is freed twice, which can cause
1420
+ * it to be allocated twice & result in overwriting.
1421
+ * @param event - The event to be freed.
1422
+ * @throws Error if the event is managed by another event boundary.
1423
+ */
1424
+ freeEvent(e) {
1425
+ if (e.manager !== this)
1426
+ throw new Error("It is illegal to free an event not managed by this EventBoundary!");
1427
+ const t = e.constructor;
1428
+ this.eventPool.has(t) || this.eventPool.set(t, []), this.eventPool.get(t).push(e);
1429
+ }
1430
+ /**
1431
+ * Similar to {@link EventEmitter.emit}, except it stops if the `propagationImmediatelyStopped` flag
1432
+ * is set on the event.
1433
+ * @param e - The event to call each listener with.
1434
+ * @param type - The event key.
1435
+ */
1436
+ _notifyListeners(e, t) {
1437
+ const i = e.currentTarget._events[t];
1438
+ if (i)
1439
+ if ("fn" in i)
1440
+ i.once && e.currentTarget.removeListener(t, i.fn, void 0, !0), i.fn.call(i.context, e);
1441
+ else
1442
+ for (let n = 0, s = i.length; n < s && !e.propagationImmediatelyStopped; n++)
1443
+ i[n].once && e.currentTarget.removeListener(t, i[n].fn, void 0, !0), i[n].fn.call(i[n].context, e);
1444
+ }
1445
+ }
1446
+ const ge = 1, ye = {
1447
+ touchstart: "pointerdown",
1448
+ touchend: "pointerup",
1449
+ touchendoutside: "pointerupoutside",
1450
+ touchmove: "pointermove",
1451
+ touchcancel: "pointercancel"
1452
+ }, S = class x {
1453
+ /**
1454
+ * @param {Renderer} renderer
1455
+ */
1456
+ constructor(e) {
1457
+ this.supportsTouchEvents = "ontouchstart" in globalThis, this.supportsPointerEvents = !!globalThis.PointerEvent, this.domElement = null, this.resolution = 1, this.renderer = e, this.rootBoundary = new _e(null), f.init(this), this.autoPreventDefault = !0, this._eventsAdded = !1, this._rootPointerEvent = new u(null), this._rootWheelEvent = new E(null), this.cursorStyles = {
1458
+ default: "inherit",
1459
+ pointer: "pointer"
1460
+ }, this.features = new Proxy({ ...x.defaultEventFeatures }, {
1461
+ set: (t, i, n) => (i === "globalMove" && (this.rootBoundary.enableGlobalMoveEvents = n), t[i] = n, !0)
1462
+ }), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onPointerOverOut = this._onPointerOverOut.bind(this), this.onWheel = this.onWheel.bind(this);
1463
+ }
1464
+ /**
1465
+ * The default interaction mode for all display objects.
1466
+ * @see Container.eventMode
1467
+ * @type {EventMode}
1468
+ * @readonly
1469
+ * @since 7.2.0
1470
+ */
1471
+ static get defaultEventMode() {
1472
+ return this._defaultEventMode;
1473
+ }
1474
+ /**
1475
+ * Runner init called, view is available at this point.
1476
+ * @ignore
1477
+ */
1478
+ init(e) {
1479
+ const { canvas: t, resolution: i } = this.renderer;
1480
+ this.setTargetElement(t), this.resolution = i, x._defaultEventMode = e.eventMode ?? "passive", Object.assign(this.features, e.eventFeatures ?? {}), this.rootBoundary.enableGlobalMoveEvents = this.features.globalMove;
1481
+ }
1482
+ /**
1483
+ * Handle changing resolution.
1484
+ * @ignore
1485
+ */
1486
+ resolutionChange(e) {
1487
+ this.resolution = e;
1488
+ }
1489
+ /** Destroys all event listeners and detaches the renderer. */
1490
+ destroy() {
1491
+ f.destroy(), this.setTargetElement(null), this.renderer = null, this._currentCursor = null;
1492
+ }
1493
+ /**
1494
+ * Sets the current cursor mode, handling any callbacks or CSS style changes.
1495
+ * The cursor can be a CSS cursor string, a custom callback function, or a key from the cursorStyles dictionary.
1496
+ * @param mode - Cursor mode to set. Can be:
1497
+ * - A CSS cursor string (e.g., 'pointer', 'grab')
1498
+ * - A key from the cursorStyles dictionary
1499
+ * - null/undefined to reset to default
1500
+ * @example
1501
+ * ```ts
1502
+ * // Using predefined cursor styles
1503
+ * app.renderer.events.setCursor('pointer'); // Set standard pointer cursor
1504
+ * app.renderer.events.setCursor('grab'); // Set grab cursor
1505
+ * app.renderer.events.setCursor(null); // Reset to default
1506
+ *
1507
+ * // Using custom cursor styles
1508
+ * app.renderer.events.cursorStyles.custom = 'url("cursor.png"), auto';
1509
+ * app.renderer.events.setCursor('custom'); // Apply custom cursor
1510
+ *
1511
+ * // Using callback-based cursor
1512
+ * app.renderer.events.cursorStyles.dynamic = (mode) => {
1513
+ * document.body.style.cursor = mode === 'hover' ? 'pointer' : 'default';
1514
+ * };
1515
+ * app.renderer.events.setCursor('dynamic'); // Trigger cursor callback
1516
+ * ```
1517
+ * @remarks
1518
+ * - Has no effect on OffscreenCanvas except for callback-based cursors
1519
+ * - Caches current cursor to avoid unnecessary DOM updates
1520
+ * - Supports CSS cursor values, style objects, and callback functions
1521
+ * @see {@link EventSystem.cursorStyles} For defining custom cursor styles
1522
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/cursor} MDN Cursor Reference
1523
+ */
1524
+ setCursor(e) {
1525
+ e || (e = "default");
1526
+ let t = !0;
1527
+ if (globalThis.OffscreenCanvas && this.domElement instanceof OffscreenCanvas && (t = !1), this._currentCursor === e)
1528
+ return;
1529
+ this._currentCursor = e;
1530
+ const i = this.cursorStyles[e];
1531
+ if (i)
1532
+ switch (typeof i) {
1533
+ case "string":
1534
+ t && (this.domElement.style.cursor = i);
1535
+ break;
1536
+ case "function":
1537
+ i(e);
1538
+ break;
1539
+ case "object":
1540
+ t && Object.assign(this.domElement.style, i);
1541
+ break;
1542
+ }
1543
+ else t && typeof e == "string" && !Object.prototype.hasOwnProperty.call(this.cursorStyles, e) && (this.domElement.style.cursor = e);
1544
+ }
1545
+ /**
1546
+ * The global pointer event instance containing the most recent pointer state.
1547
+ * This is useful for accessing pointer information without listening to events.
1548
+ * @example
1549
+ * ```ts
1550
+ * // Access current pointer position at any time
1551
+ * const eventSystem = app.renderer.events;
1552
+ * const pointer = eventSystem.pointer;
1553
+ *
1554
+ * // Get global coordinates
1555
+ * console.log('Position:', pointer.global.x, pointer.global.y);
1556
+ *
1557
+ * // Check button state
1558
+ * console.log('Buttons pressed:', pointer.buttons);
1559
+ *
1560
+ * // Get pointer type and pressure
1561
+ * console.log('Type:', pointer.pointerType);
1562
+ * console.log('Pressure:', pointer.pressure);
1563
+ * ```
1564
+ * @readonly
1565
+ * @since 7.2.0
1566
+ * @see {@link FederatedPointerEvent} For all available pointer properties
1567
+ */
1568
+ get pointer() {
1569
+ return this._rootPointerEvent;
1570
+ }
1571
+ /**
1572
+ * Event handler for pointer down events on {@link EventSystem#domElement this.domElement}.
1573
+ * @param nativeEvent - The native mouse/pointer/touch event.
1574
+ */
1575
+ _onPointerDown(e) {
1576
+ if (!this.features.click)
1577
+ return;
1578
+ this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
1579
+ const t = this._normalizeToPointerData(e);
1580
+ this.autoPreventDefault && t[0].isNormalized && (e.cancelable || !("cancelable" in e)) && e.preventDefault();
1581
+ for (let i = 0, n = t.length; i < n; i++) {
1582
+ const s = t[i], o = this._bootstrapEvent(this._rootPointerEvent, s);
1583
+ this.rootBoundary.mapEvent(o);
1584
+ }
1585
+ this.setCursor(this.rootBoundary.cursor);
1586
+ }
1587
+ /**
1588
+ * Event handler for pointer move events on on {@link EventSystem#domElement this.domElement}.
1589
+ * @param nativeEvent - The native mouse/pointer/touch events.
1590
+ */
1591
+ _onPointerMove(e) {
1592
+ if (!this.features.move)
1593
+ return;
1594
+ this.rootBoundary.rootTarget = this.renderer.lastObjectRendered, f.pointerMoved();
1595
+ const t = this._normalizeToPointerData(e);
1596
+ for (let i = 0, n = t.length; i < n; i++) {
1597
+ const s = this._bootstrapEvent(this._rootPointerEvent, t[i]);
1598
+ this.rootBoundary.mapEvent(s);
1599
+ }
1600
+ this.setCursor(this.rootBoundary.cursor);
1601
+ }
1602
+ /**
1603
+ * Event handler for pointer up events on {@link EventSystem#domElement this.domElement}.
1604
+ * @param nativeEvent - The native mouse/pointer/touch event.
1605
+ */
1606
+ _onPointerUp(e) {
1607
+ if (!this.features.click)
1608
+ return;
1609
+ this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
1610
+ let t = e.target;
1611
+ e.composedPath && e.composedPath().length > 0 && (t = e.composedPath()[0]);
1612
+ const i = t !== this.domElement ? "outside" : "", n = this._normalizeToPointerData(e);
1613
+ for (let s = 0, o = n.length; s < o; s++) {
1614
+ const r = this._bootstrapEvent(this._rootPointerEvent, n[s]);
1615
+ r.type += i, this.rootBoundary.mapEvent(r);
1616
+ }
1617
+ this.setCursor(this.rootBoundary.cursor);
1618
+ }
1619
+ /**
1620
+ * Event handler for pointer over & out events on {@link EventSystem#domElement this.domElement}.
1621
+ * @param nativeEvent - The native mouse/pointer/touch event.
1622
+ */
1623
+ _onPointerOverOut(e) {
1624
+ if (!this.features.click)
1625
+ return;
1626
+ this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
1627
+ const t = this._normalizeToPointerData(e);
1628
+ for (let i = 0, n = t.length; i < n; i++) {
1629
+ const s = this._bootstrapEvent(this._rootPointerEvent, t[i]);
1630
+ this.rootBoundary.mapEvent(s);
1631
+ }
1632
+ this.setCursor(this.rootBoundary.cursor);
1633
+ }
1634
+ /**
1635
+ * Passive handler for `wheel` events on {@link EventSystem.domElement this.domElement}.
1636
+ * @param nativeEvent - The native wheel event.
1637
+ */
1638
+ onWheel(e) {
1639
+ if (!this.features.wheel)
1640
+ return;
1641
+ const t = this.normalizeWheelEvent(e);
1642
+ this.rootBoundary.rootTarget = this.renderer.lastObjectRendered, this.rootBoundary.mapEvent(t);
1643
+ }
1644
+ /**
1645
+ * Sets the {@link EventSystem#domElement domElement} and binds event listeners.
1646
+ * This method manages the DOM event bindings for the event system, allowing you to
1647
+ * change or remove the target element that receives input events.
1648
+ * > [!IMPORTANT] This will default to the canvas element of the renderer, so you
1649
+ * > should not need to call this unless you are using a custom element.
1650
+ * @param element - The new DOM element to bind events to, or null to remove all event bindings
1651
+ * @example
1652
+ * ```ts
1653
+ * // Set a new canvas element as the target
1654
+ * const canvas = document.createElement('canvas');
1655
+ * app.renderer.events.setTargetElement(canvas);
1656
+ *
1657
+ * // Remove all event bindings
1658
+ * app.renderer.events.setTargetElement(null);
1659
+ *
1660
+ * // Switch to a different canvas
1661
+ * const newCanvas = document.querySelector('#game-canvas');
1662
+ * app.renderer.events.setTargetElement(newCanvas);
1663
+ * ```
1664
+ * @remarks
1665
+ * - Automatically removes event listeners from previous element
1666
+ * - Required for the event system to function
1667
+ * - Safe to call multiple times
1668
+ * @see {@link EventSystem#domElement} The current DOM element
1669
+ * @see {@link EventsTicker} For the ticker system that tracks pointer movement
1670
+ */
1671
+ setTargetElement(e) {
1672
+ this._removeEvents(), this.domElement = e, f.domElement = e, this._addEvents();
1673
+ }
1674
+ /** Register event listeners on {@link Renderer#domElement this.domElement}. */
1675
+ _addEvents() {
1676
+ if (this._eventsAdded || !this.domElement)
1677
+ return;
1678
+ f.addTickerListener();
1679
+ const e = this.domElement.style;
1680
+ e && (globalThis.navigator.msPointerEnabled ? (e.msContentZooming = "none", e.msTouchAction = "none") : this.supportsPointerEvents && (e.touchAction = "none")), this.supportsPointerEvents ? (globalThis.document.addEventListener("pointermove", this._onPointerMove, !0), this.domElement.addEventListener("pointerdown", this._onPointerDown, !0), this.domElement.addEventListener("pointerleave", this._onPointerOverOut, !0), this.domElement.addEventListener("pointerover", this._onPointerOverOut, !0), globalThis.addEventListener("pointerup", this._onPointerUp, !0)) : (globalThis.document.addEventListener("mousemove", this._onPointerMove, !0), this.domElement.addEventListener("mousedown", this._onPointerDown, !0), this.domElement.addEventListener("mouseout", this._onPointerOverOut, !0), this.domElement.addEventListener("mouseover", this._onPointerOverOut, !0), globalThis.addEventListener("mouseup", this._onPointerUp, !0), this.supportsTouchEvents && (this.domElement.addEventListener("touchstart", this._onPointerDown, !0), this.domElement.addEventListener("touchend", this._onPointerUp, !0), this.domElement.addEventListener("touchmove", this._onPointerMove, !0))), this.domElement.addEventListener("wheel", this.onWheel, {
1681
+ passive: !0,
1682
+ capture: !0
1683
+ }), this._eventsAdded = !0;
1684
+ }
1685
+ /** Unregister event listeners on {@link EventSystem#domElement this.domElement}. */
1686
+ _removeEvents() {
1687
+ if (!this._eventsAdded || !this.domElement)
1688
+ return;
1689
+ f.removeTickerListener();
1690
+ const e = this.domElement.style;
1691
+ e && (globalThis.navigator.msPointerEnabled ? (e.msContentZooming = "", e.msTouchAction = "") : this.supportsPointerEvents && (e.touchAction = "")), this.supportsPointerEvents ? (globalThis.document.removeEventListener("pointermove", this._onPointerMove, !0), this.domElement.removeEventListener("pointerdown", this._onPointerDown, !0), this.domElement.removeEventListener("pointerleave", this._onPointerOverOut, !0), this.domElement.removeEventListener("pointerover", this._onPointerOverOut, !0), globalThis.removeEventListener("pointerup", this._onPointerUp, !0)) : (globalThis.document.removeEventListener("mousemove", this._onPointerMove, !0), this.domElement.removeEventListener("mousedown", this._onPointerDown, !0), this.domElement.removeEventListener("mouseout", this._onPointerOverOut, !0), this.domElement.removeEventListener("mouseover", this._onPointerOverOut, !0), globalThis.removeEventListener("mouseup", this._onPointerUp, !0), this.supportsTouchEvents && (this.domElement.removeEventListener("touchstart", this._onPointerDown, !0), this.domElement.removeEventListener("touchend", this._onPointerUp, !0), this.domElement.removeEventListener("touchmove", this._onPointerMove, !0))), this.domElement.removeEventListener("wheel", this.onWheel, !0), this.domElement = null, this._eventsAdded = !1;
1692
+ }
1693
+ /**
1694
+ * Maps coordinates from DOM/screen space into PixiJS normalized coordinates.
1695
+ * This takes into account the current scale, position, and resolution of the DOM element.
1696
+ * @param point - The point to store the mapped coordinates in
1697
+ * @param x - The x coordinate in DOM/client space
1698
+ * @param y - The y coordinate in DOM/client space
1699
+ * @example
1700
+ * ```ts
1701
+ * // Map mouse coordinates to PixiJS space
1702
+ * const point = new Point();
1703
+ * app.renderer.events.mapPositionToPoint(
1704
+ * point,
1705
+ * event.clientX,
1706
+ * event.clientY
1707
+ * );
1708
+ * console.log('Mapped position:', point.x, point.y);
1709
+ *
1710
+ * // Using with pointer events
1711
+ * sprite.on('pointermove', (event) => {
1712
+ * // event.global already contains mapped coordinates
1713
+ * console.log('Global:', event.global.x, event.global.y);
1714
+ *
1715
+ * // Map to local coordinates
1716
+ * const local = event.getLocalPosition(sprite);
1717
+ * console.log('Local:', local.x, local.y);
1718
+ * });
1719
+ * ```
1720
+ * @remarks
1721
+ * - Accounts for element scaling and positioning
1722
+ * - Adjusts for device pixel ratio/resolution
1723
+ */
1724
+ mapPositionToPoint(e, t, i) {
1725
+ const n = this.domElement.isConnected ? this.domElement.getBoundingClientRect() : {
1726
+ width: this.domElement.width,
1727
+ height: this.domElement.height,
1728
+ left: 0,
1729
+ top: 0
1730
+ }, s = 1 / this.resolution;
1731
+ e.x = (t - n.left) * (this.domElement.width / n.width) * s, e.y = (i - n.top) * (this.domElement.height / n.height) * s;
1732
+ }
1733
+ /**
1734
+ * Ensures that the original event object contains all data that a regular pointer event would have
1735
+ * @param event - The original event data from a touch or mouse event
1736
+ * @returns An array containing a single normalized pointer event, in the case of a pointer
1737
+ * or mouse event, or a multiple normalized pointer events if there are multiple changed touches
1738
+ */
1739
+ _normalizeToPointerData(e) {
1740
+ const t = [];
1741
+ if (this.supportsTouchEvents && e instanceof TouchEvent)
1742
+ for (let i = 0, n = e.changedTouches.length; i < n; i++) {
1743
+ const s = e.changedTouches[i];
1744
+ typeof s.button > "u" && (s.button = 0), typeof s.buttons > "u" && (s.buttons = 1), typeof s.isPrimary > "u" && (s.isPrimary = e.touches.length === 1 && e.type === "touchstart"), typeof s.width > "u" && (s.width = s.radiusX || 1), typeof s.height > "u" && (s.height = s.radiusY || 1), typeof s.tiltX > "u" && (s.tiltX = 0), typeof s.tiltY > "u" && (s.tiltY = 0), typeof s.pointerType > "u" && (s.pointerType = "touch"), typeof s.pointerId > "u" && (s.pointerId = s.identifier || 0), typeof s.pressure > "u" && (s.pressure = s.force || 0.5), typeof s.twist > "u" && (s.twist = 0), typeof s.tangentialPressure > "u" && (s.tangentialPressure = 0), typeof s.layerX > "u" && (s.layerX = s.offsetX = s.clientX), typeof s.layerY > "u" && (s.layerY = s.offsetY = s.clientY), s.isNormalized = !0, s.type = e.type, t.push(s);
1745
+ }
1746
+ else if (!globalThis.MouseEvent || e instanceof MouseEvent && (!this.supportsPointerEvents || !(e instanceof globalThis.PointerEvent))) {
1747
+ const i = e;
1748
+ typeof i.isPrimary > "u" && (i.isPrimary = !0), typeof i.width > "u" && (i.width = 1), typeof i.height > "u" && (i.height = 1), typeof i.tiltX > "u" && (i.tiltX = 0), typeof i.tiltY > "u" && (i.tiltY = 0), typeof i.pointerType > "u" && (i.pointerType = "mouse"), typeof i.pointerId > "u" && (i.pointerId = ge), typeof i.pressure > "u" && (i.pressure = 0.5), typeof i.twist > "u" && (i.twist = 0), typeof i.tangentialPressure > "u" && (i.tangentialPressure = 0), i.isNormalized = !0, t.push(i);
1749
+ } else
1750
+ t.push(e);
1751
+ return t;
1752
+ }
1753
+ /**
1754
+ * Normalizes the native {@link https://w3c.github.io/uievents/#interface-wheelevent WheelEvent}.
1755
+ *
1756
+ * The returned {@link FederatedWheelEvent} is a shared instance. It will not persist across
1757
+ * multiple native wheel events.
1758
+ * @param nativeEvent - The native wheel event that occurred on the canvas.
1759
+ * @returns A federated wheel event.
1760
+ */
1761
+ normalizeWheelEvent(e) {
1762
+ const t = this._rootWheelEvent;
1763
+ return this._transferMouseData(t, e), t.deltaX = e.deltaX, t.deltaY = e.deltaY, t.deltaZ = e.deltaZ, t.deltaMode = e.deltaMode, this.mapPositionToPoint(t.screen, e.clientX, e.clientY), t.global.copyFrom(t.screen), t.offset.copyFrom(t.screen), t.nativeEvent = e, t.type = e.type, t;
1764
+ }
1765
+ /**
1766
+ * Normalizes the `nativeEvent` into a federateed {@link FederatedPointerEvent}.
1767
+ * @param event
1768
+ * @param nativeEvent
1769
+ */
1770
+ _bootstrapEvent(e, t) {
1771
+ return e.originalEvent = null, e.nativeEvent = t, e.pointerId = t.pointerId, e.width = t.width, e.height = t.height, e.isPrimary = t.isPrimary, e.pointerType = t.pointerType, e.pressure = t.pressure, e.tangentialPressure = t.tangentialPressure, e.tiltX = t.tiltX, e.tiltY = t.tiltY, e.twist = t.twist, this._transferMouseData(e, t), this.mapPositionToPoint(e.screen, t.clientX, t.clientY), e.global.copyFrom(e.screen), e.offset.copyFrom(e.screen), e.isTrusted = t.isTrusted, e.type === "pointerleave" && (e.type = "pointerout"), e.type.startsWith("mouse") && (e.type = e.type.replace("mouse", "pointer")), e.type.startsWith("touch") && (e.type = ye[e.type] || e.type), e;
1772
+ }
1773
+ /**
1774
+ * Transfers base & mouse event data from the `nativeEvent` to the federated event.
1775
+ * @param event
1776
+ * @param nativeEvent
1777
+ */
1778
+ _transferMouseData(e, t) {
1779
+ e.isTrusted = t.isTrusted, e.srcElement = t.srcElement, e.timeStamp = performance.now(), e.type = t.type, e.altKey = t.altKey, e.button = t.button, e.buttons = t.buttons, e.client.x = t.clientX, e.client.y = t.clientY, e.ctrlKey = t.ctrlKey, e.metaKey = t.metaKey, e.movement.x = t.movementX, e.movement.y = t.movementY, e.page.x = t.pageX, e.page.y = t.pageY, e.relatedTarget = null, e.shiftKey = t.shiftKey;
1780
+ }
1781
+ };
1782
+ S.extension = {
1783
+ name: "events",
1784
+ type: [
1785
+ y.WebGLSystem,
1786
+ y.CanvasSystem,
1787
+ y.WebGPUSystem
1788
+ ],
1789
+ priority: -1
1790
+ };
1791
+ S.defaultEventFeatures = {
1792
+ /** Enables pointer events associated with pointer movement. */
1793
+ move: !0,
1794
+ /** Enables global pointer move events. */
1795
+ globalMove: !0,
1796
+ /** Enables pointer events associated with clicking. */
1797
+ click: !0,
1798
+ /** Enables wheel events. */
1799
+ wheel: !0
1800
+ };
1801
+ let ee = S;
1802
+ const be = {
1803
+ onclick: null,
1804
+ onmousedown: null,
1805
+ onmouseenter: null,
1806
+ onmouseleave: null,
1807
+ onmousemove: null,
1808
+ onglobalmousemove: null,
1809
+ onmouseout: null,
1810
+ onmouseover: null,
1811
+ onmouseup: null,
1812
+ onmouseupoutside: null,
1813
+ onpointercancel: null,
1814
+ onpointerdown: null,
1815
+ onpointerenter: null,
1816
+ onpointerleave: null,
1817
+ onpointermove: null,
1818
+ onglobalpointermove: null,
1819
+ onpointerout: null,
1820
+ onpointerover: null,
1821
+ onpointertap: null,
1822
+ onpointerup: null,
1823
+ onpointerupoutside: null,
1824
+ onrightclick: null,
1825
+ onrightdown: null,
1826
+ onrightup: null,
1827
+ onrightupoutside: null,
1828
+ ontap: null,
1829
+ ontouchcancel: null,
1830
+ ontouchend: null,
1831
+ ontouchendoutside: null,
1832
+ ontouchmove: null,
1833
+ onglobaltouchmove: null,
1834
+ ontouchstart: null,
1835
+ onwheel: null,
1836
+ get interactive() {
1837
+ return this.eventMode === "dynamic" || this.eventMode === "static";
1838
+ },
1839
+ set interactive(a) {
1840
+ this.eventMode = a ? "static" : "passive";
1841
+ },
1842
+ _internalEventMode: void 0,
1843
+ get eventMode() {
1844
+ return this._internalEventMode ?? ee.defaultEventMode;
1845
+ },
1846
+ set eventMode(a) {
1847
+ this._internalEventMode = a;
1848
+ },
1849
+ isInteractive() {
1850
+ return this.eventMode === "static" || this.eventMode === "dynamic";
1851
+ },
1852
+ interactiveChildren: !0,
1853
+ hitArea: null,
1854
+ addEventListener(a, e, t) {
1855
+ const i = typeof t == "boolean" && t || typeof t == "object" && t.capture, n = typeof t == "object" ? t.signal : void 0, s = typeof t == "object" ? t.once === !0 : !1, o = typeof e == "function" ? void 0 : e;
1856
+ a = i ? `${a}capture` : a;
1857
+ const r = typeof e == "function" ? e : e.handleEvent, l = this;
1858
+ n && n.addEventListener("abort", () => {
1859
+ l.off(a, r, o);
1860
+ }), s ? l.once(a, r, o) : l.on(a, r, o);
1861
+ },
1862
+ removeEventListener(a, e, t) {
1863
+ const i = typeof t == "boolean" && t || typeof t == "object" && t.capture, n = typeof e == "function" ? void 0 : e;
1864
+ a = i ? `${a}capture` : a, e = typeof e == "function" ? e : e.handleEvent, this.off(a, e, n);
1865
+ },
1866
+ dispatchEvent(a) {
1867
+ if (!(a instanceof w))
1868
+ throw new Error("Container cannot propagate events outside of the Federated Events API");
1869
+ return a.defaultPrevented = !1, a.path = null, a.target = this, a.manager.dispatchEvent(a), !a.defaultPrevented;
1870
+ }
1871
+ };
1872
+ P.add(ue);
1873
+ P.mixin(V, pe);
1874
+ P.add(ee);
1875
+ P.mixin(V, be);
1876
+ P.add(Q);