ember-attacher 4.4.0 → 5.0.0-beta.1

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/dist/{attacher-core-m7x5g04q.js → attacher-core-CtbFbuD_.js} +934 -977
  2. package/dist/attacher-core-CtbFbuD_.js.map +1 -0
  3. package/dist/attacher-overlay-BoI7s8AI.js +40 -0
  4. package/dist/attacher-overlay-BoI7s8AI.js.map +1 -0
  5. package/dist/components/attach-popover.d.ts +10 -12
  6. package/dist/components/attach-popover.js +7 -4
  7. package/dist/components/attach-popover.js.map +1 -1
  8. package/dist/components/attach-tooltip.d.ts +11 -13
  9. package/dist/components/attach-tooltip.js +10 -7
  10. package/dist/components/attach-tooltip.js.map +1 -1
  11. package/dist/components/attacher.d.ts +12 -12
  12. package/dist/components/attacher.js +7 -15
  13. package/dist/components/attacher.js.map +1 -1
  14. package/dist/defaults.d.ts +27 -28
  15. package/dist/defaults.js +11 -11
  16. package/dist/defaults.js.map +1 -1
  17. package/dist/index.d.ts +9 -60
  18. package/dist/index.js +13 -3
  19. package/dist/index.js.map +1 -1
  20. package/dist/{is-visible-DQGdmVDv.js → is-visible-CeN9qZyc.js} +6 -3
  21. package/dist/is-visible-CeN9qZyc.js.map +1 -0
  22. package/dist/lib/a11y.d.ts +77 -0
  23. package/dist/lib/attacher-core.d.ts +342 -0
  24. package/dist/lib/attacher-overlay.d.ts +18 -0
  25. package/dist/lib/attachment-tree.d.ts +32 -0
  26. package/dist/lib/delay-group.d.ts +15 -0
  27. package/dist/lib/dom.d.ts +32 -0
  28. package/dist/lib/host.d.ts +21 -0
  29. package/dist/lib/positioning.d.ts +27 -0
  30. package/dist/lib/schedule.d.ts +12 -0
  31. package/dist/lib/singleton-tooltip-pool.d.ts +32 -0
  32. package/dist/lib/target-resolution.d.ts +44 -0
  33. package/dist/modifiers/tooltip.d.ts +18 -15
  34. package/dist/modifiers/tooltip.js +55 -67
  35. package/dist/modifiers/tooltip.js.map +1 -1
  36. package/dist/styles/ember-attacher.css +1 -1
  37. package/dist/template-registry.d.ts +7 -11
  38. package/dist/test-support/index.d.ts +1 -2
  39. package/dist/test-support/index.js +1 -1
  40. package/dist/test-support/is-visible.d.ts +1 -2
  41. package/package.json +15 -6
  42. package/dist/_app_/components/basic-attacher.js +0 -1
  43. package/dist/attacher-core-m7x5g04q.js.map +0 -1
  44. package/dist/components/basic-attacher.d.ts +0 -151
  45. package/dist/components/basic-attacher.js +0 -44
  46. package/dist/components/basic-attacher.js.map +0 -1
  47. package/dist/is-visible-DQGdmVDv.js.map +0 -1
@@ -1,14 +1,11 @@
1
- import { schedule, cancel, later, next, debounce, run } from '@ember/runloop';
2
1
  import { getOwner } from '@ember/application';
3
- import { guidFor } from '@ember/object/internals';
4
2
  import { isDestroying, isDestroyed, registerDestructor } from '@ember/destroyable';
5
- import { isHTMLSafe } from '@ember/template';
6
- import { runInDebug, warn, assert, deprecate } from '@ember/debug';
3
+ import { runInDebug, warn, assert } from '@ember/debug';
7
4
  import { arrow, flip, shift, limitShift, autoUpdate, computePosition } from '@floating-ui/dom';
8
- import { buildWaiter } from '@ember/test-waiters';
9
5
  import { tracked } from '@glimmer/tracking';
10
6
  import Modifier, { modifier } from 'ember-modifier';
11
- import DEFAULTS from './defaults.js';
7
+ import DEFAULTS, { POPOVER_DEFAULTS } from './defaults.js';
8
+ import { buildWaiter } from '@ember/test-waiters';
12
9
 
13
10
  function _applyDecoratedDescriptor(i, e, r, n, l) {
14
11
  var a = {};
@@ -28,20 +25,97 @@ function _initializerDefineProperty(e, i, r, l) {
28
25
  }
29
26
 
30
27
  /**
31
- * Accessibility and ARIA attribute management for BasicAttacher.
28
+ * Accessibility and ARIA attribute management for ember-attacher.
32
29
  *
33
- * Manages token-safe open-only `aria-describedby` for tooltips, automatic
34
- * disclosure attributes (`aria-expanded`, `aria-controls`, `aria-haspopup`)
35
- * for popovers when not supplied by callers, and focus restoration on Escape.
30
+ * Implements modern-web-guidance smart tooltip ARIA:
31
+ * - Binds token-safe `aria-labelledby` when a trigger has no accessible name of its own.
32
+ * - Suppresses `aria-describedby` when the tooltip text duplicates the trigger's accessible name.
33
+ * - Otherwise binds token-safe open-only `aria-describedby` for tooltips, and automatic
34
+ * disclosure attributes (`aria-expanded`, `aria-controls`, `aria-haspopup`) for popovers.
35
+ * - Restores focus on Escape when focus lives inside an interactive popover.
36
36
  */
37
37
 
38
38
  const KNOWN_HASPOPUP_ROLES = new Set(['dialog', 'menu', 'listbox', 'tree', 'grid', 'true', 'false']);
39
39
  function splitTokens(value) {
40
40
  return value ? value.trim().split(/\s+/).filter(Boolean) : [];
41
41
  }
42
+ function normalizeText(value) {
43
+ return value ? String(value).replace(/\s+/g, ' ').trim() : '';
44
+ }
45
+ function collectAccessibleText(node, ignoreId) {
46
+ if (!node) {
47
+ return '';
48
+ }
49
+ if (node.nodeType === 3 /* Node.TEXT_NODE */) {
50
+ return node.nodeValue || '';
51
+ }
52
+ if (node.nodeType !== 1 /* Node.ELEMENT_NODE */) {
53
+ return '';
54
+ }
55
+ const el = node;
56
+ if (ignoreId && el.id === ignoreId || el.classList?.contains('ember-attacher') || el.getAttribute('aria-hidden') === 'true' || el.hidden) {
57
+ return '';
58
+ }
59
+ const tag = el.tagName ? el.tagName.toLowerCase() : '';
60
+ if (tag === 'img' || tag === 'area') {
61
+ return ` ${el.getAttribute('alt') || ''} `;
62
+ }
63
+ if (tag === 'input') {
64
+ const type = (el.getAttribute('type') || '').toLowerCase();
65
+ if (type === 'button' || type === 'submit' || type === 'reset') {
66
+ return ` ${el.getAttribute('value') || ''} `;
67
+ }
68
+ return '';
69
+ }
70
+ if (tag === 'svg') {
71
+ const svgLabel = el.getAttribute('aria-label');
72
+ if (svgLabel) {
73
+ return ` ${svgLabel} `;
74
+ }
75
+ const titleEl = el.querySelector('title');
76
+ return titleEl ? ` ${titleEl.textContent || ''} ` : '';
77
+ }
78
+ let text = '';
79
+ const children = el.childNodes;
80
+ for (let i = 0; i < children.length; i += 1) {
81
+ text += collectAccessibleText(children[i], ignoreId);
82
+ }
83
+ return text;
84
+ }
42
85
 
43
86
  /**
44
- * Tracks and restores ARIA attributes owned by a single BasicAttacher instance
87
+ * Resolve a target Element's accessible name per modern-web-guidance rules
88
+ * (`aria-labelledby` excluding `ignoreId`, `aria-label`, text/alt content, `title`).
89
+ *
90
+ * @param {Element | null} target
91
+ * @param {string | null} [ignoreId]
92
+ * @returns {string}
93
+ */
94
+ function getTargetAccessibleName(target, ignoreId = null) {
95
+ if (!target || typeof target.getAttribute !== 'function') {
96
+ return '';
97
+ }
98
+ const doc = target.ownerDocument || (typeof document !== 'undefined' ? document : null);
99
+ const labelledByIds = splitTokens(target.getAttribute('aria-labelledby')).filter(token => token !== ignoreId);
100
+ if (labelledByIds.length > 0 && doc) {
101
+ const labelText = labelledByIds.map(id => doc.getElementById(id)?.textContent || '').map(normalizeText).filter(Boolean).join(' ');
102
+ if (labelText) {
103
+ return labelText;
104
+ }
105
+ }
106
+ const ariaLabel = normalizeText(target.getAttribute('aria-label'));
107
+ if (ariaLabel) {
108
+ return ariaLabel;
109
+ }
110
+ const contentText = normalizeText(collectAccessibleText(target, ignoreId));
111
+ if (contentText) {
112
+ return contentText;
113
+ }
114
+ return normalizeText(target.getAttribute('title'));
115
+ }
116
+
117
+ /**
118
+ * Tracks and restores ARIA attributes owned by a single AttacherCore instance
45
119
  * without clobbering pre-existing caller attributes or tokens.
46
120
  */
47
121
  class AttachmentAriaController {
@@ -50,7 +124,9 @@ class AttachmentAriaController {
50
124
  this._isTooltip = false;
51
125
  this._attachmentId = null;
52
126
  this._ariaRole = undefined;
127
+ this._tooltipMode = 'describedby';
53
128
  this._addedDescribedByToken = false;
129
+ this._addedLabelledByToken = false;
54
130
  this._ownsHasPopup = false;
55
131
  this._ownsControls = false;
56
132
  this._ownsExpanded = false;
@@ -59,13 +135,22 @@ class AttachmentAriaController {
59
135
  * Bind ARIA metadata to a target Element (no-op when target is null/non-Element).
60
136
  *
61
137
  * @param {Element | null} target
62
- * @param {{ isTooltip: boolean, id: string, ariaRole?: string, isOpen: boolean }} options
138
+ * @param {{
139
+ * isTooltip: boolean,
140
+ * id: string,
141
+ * ariaRole?: string,
142
+ * isOpen: boolean,
143
+ * attachmentEl?: Element | null,
144
+ * tooltipText?: string | null,
145
+ * }} options
63
146
  */
64
147
  bind(target, {
65
148
  isTooltip,
66
149
  id,
67
150
  ariaRole,
68
- isOpen
151
+ isOpen,
152
+ attachmentEl = null,
153
+ tooltipText = null
69
154
  }) {
70
155
  if (this._boundTarget && (this._boundTarget !== target || this._attachmentId !== id || this._isTooltip !== isTooltip || this._ariaRole !== ariaRole)) {
71
156
  this.unbind();
@@ -96,6 +181,18 @@ class AttachmentAriaController {
96
181
  target.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
97
182
  this._ownsExpanded = true;
98
183
  }
184
+ } else {
185
+ const targetName = getTargetAccessibleName(target, id);
186
+ const rawTip = tooltipText != null && tooltipText !== '' ? tooltipText : attachmentEl?.textContent || '';
187
+ const normalizedTip = normalizeText(rawTip);
188
+ const hasExternalLabelledBy = splitTokens(target.getAttribute('aria-labelledby')).some(token => token !== id);
189
+ if (!targetName && !hasExternalLabelledBy) {
190
+ this._tooltipMode = 'labelledby';
191
+ } else if (normalizedTip && targetName === normalizedTip) {
192
+ this._tooltipMode = 'none';
193
+ } else {
194
+ this._tooltipMode = 'describedby';
195
+ }
99
196
  }
100
197
  this.setOpen(isOpen);
101
198
  }
@@ -111,7 +208,28 @@ class AttachmentAriaController {
111
208
  return;
112
209
  }
113
210
  if (this._isTooltip) {
114
- this._setDescribedByOpen(target, isOpen);
211
+ if (this._tooltipMode === 'labelledby') {
212
+ if (this._addedDescribedByToken) {
213
+ this._removeAttributeToken(target, 'aria-describedby', this._attachmentId);
214
+ this._addedDescribedByToken = false;
215
+ }
216
+ this._addedLabelledByToken = this._ensureAttributeToken(target, 'aria-labelledby', this._attachmentId, this._addedLabelledByToken);
217
+ } else if (this._tooltipMode === 'none') {
218
+ if (this._addedDescribedByToken) {
219
+ this._removeAttributeToken(target, 'aria-describedby', this._attachmentId);
220
+ this._addedDescribedByToken = false;
221
+ }
222
+ if (this._addedLabelledByToken) {
223
+ this._removeAttributeToken(target, 'aria-labelledby', this._attachmentId);
224
+ this._addedLabelledByToken = false;
225
+ }
226
+ } else {
227
+ if (this._addedLabelledByToken) {
228
+ this._removeAttributeToken(target, 'aria-labelledby', this._attachmentId);
229
+ this._addedLabelledByToken = false;
230
+ }
231
+ this._setTokenOnOpen(target, 'aria-describedby', isOpen);
232
+ }
115
233
  } else if (this._ownsExpanded) {
116
234
  target.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
117
235
  }
@@ -126,9 +244,13 @@ class AttachmentAriaController {
126
244
  return;
127
245
  }
128
246
  if (this._addedDescribedByToken) {
129
- this._removeDescribedByToken(target, this._attachmentId);
247
+ this._removeAttributeToken(target, 'aria-describedby', this._attachmentId);
130
248
  this._addedDescribedByToken = false;
131
249
  }
250
+ if (this._addedLabelledByToken) {
251
+ this._removeAttributeToken(target, 'aria-labelledby', this._attachmentId);
252
+ this._addedLabelledByToken = false;
253
+ }
132
254
  if (this._ownsHasPopup) {
133
255
  target.removeAttribute('aria-haspopup');
134
256
  this._ownsHasPopup = false;
@@ -144,47 +266,56 @@ class AttachmentAriaController {
144
266
  this._boundTarget = null;
145
267
  this._attachmentId = null;
146
268
  this._isTooltip = false;
269
+ this._tooltipMode = 'describedby';
147
270
  this._ariaRole = undefined;
148
271
  }
149
- _setDescribedByOpen(target, isOpen) {
272
+ _setTokenOnOpen(target, attrName, isOpen) {
150
273
  const id = this._attachmentId;
151
274
  if (!id) {
152
275
  return;
153
276
  }
154
277
  if (isOpen) {
155
- const tokens = splitTokens(target.getAttribute('aria-describedby'));
156
- if (!tokens.includes(id)) {
157
- tokens.push(id);
158
- target.setAttribute('aria-describedby', tokens.join(' '));
159
- this._addedDescribedByToken = true;
160
- }
278
+ this._addedDescribedByToken = this._ensureAttributeToken(target, attrName, id, this._addedDescribedByToken);
161
279
  } else if (this._addedDescribedByToken) {
162
- this._removeDescribedByToken(target, id);
280
+ this._removeAttributeToken(target, attrName, id);
163
281
  this._addedDescribedByToken = false;
164
282
  }
165
283
  }
166
- _removeDescribedByToken(target, token) {
284
+ _ensureAttributeToken(target, attrName, token, alreadyOwned) {
285
+ if (!token) {
286
+ return alreadyOwned;
287
+ }
288
+ const tokens = splitTokens(target.getAttribute(attrName));
289
+ if (!tokens.includes(token)) {
290
+ tokens.push(token);
291
+ target.setAttribute(attrName, tokens.join(' '));
292
+ return true;
293
+ }
294
+ return alreadyOwned;
295
+ }
296
+ _removeAttributeToken(target, attrName, token) {
167
297
  if (!token) {
168
298
  return;
169
299
  }
170
- const remaining = splitTokens(target.getAttribute('aria-describedby')).filter(t => t !== token);
300
+ const remaining = splitTokens(target.getAttribute(attrName)).filter(t => t !== token);
171
301
  if (remaining.length > 0) {
172
- target.setAttribute('aria-describedby', remaining.join(' '));
302
+ target.setAttribute(attrName, remaining.join(' '));
173
303
  } else {
174
- target.removeAttribute('aria-describedby');
304
+ target.removeAttribute(attrName);
175
305
  }
176
306
  }
177
307
  }
178
308
 
179
309
  /**
180
310
  * Restore focus to the Target if focus currently lives inside the floating attachment
181
- * or on another element outside the Target when dismissed via Escape.
311
+ * when dismissed via Escape.
182
312
  *
183
313
  * @param {Element | null} target
184
314
  * @param {Element | null} floatingElement
185
315
  */
186
316
  function restoreFocusOnEscape(target, floatingElement) {
187
- if (!target || typeof target.focus !== 'function' || typeof document === 'undefined') {
317
+ const focusable = target;
318
+ if (!focusable || typeof focusable.focus !== 'function' || typeof document === 'undefined') {
188
319
  return;
189
320
  }
190
321
  const active = document.activeElement;
@@ -194,11 +325,11 @@ function restoreFocusOnEscape(target, floatingElement) {
194
325
  const focusInsideAttachment = Boolean(floatingElement && active && floatingElement.contains(active));
195
326
  if (focusInsideAttachment) {
196
327
  try {
197
- target.focus({
328
+ focusable.focus({
198
329
  preventScroll: true
199
330
  });
200
331
  } catch {
201
- target.focus();
332
+ focusable.focus();
202
333
  }
203
334
  }
204
335
  }
@@ -214,9 +345,6 @@ function restoreFocusOnEscape(target, floatingElement) {
214
345
  * removed from the DOM during event handling (e.g. self-disappearing buttons).
215
346
  * Falls back to `element.contains(event.target)` when `composedPath` is unavailable.
216
347
  *
217
- * @param {Element | null | undefined} element
218
- * @param {Event | null | undefined} event
219
- * @returns {boolean}
220
348
  */
221
349
  function elementContainsEvent(element, event) {
222
350
  if (!element) {
@@ -226,7 +354,7 @@ function elementContainsEvent(element, event) {
226
354
  if (path && path.length > 0) {
227
355
  return path.includes(element);
228
356
  }
229
- return Boolean(event?.target && element.contains(event.target));
357
+ return Boolean(typeof Node !== 'undefined' && event?.target instanceof Node && element.contains(event.target));
230
358
  }
231
359
  const CORRIDOR_BUFFER = 2;
232
360
  function isPointInRect(x, y, rect) {
@@ -255,11 +383,6 @@ function pointInQuad(px, py, x1, y1, x2, y2, x3, y3, x4, y4) {
255
383
  *
256
384
  * Supports both DOM Elements and Floating UI VirtualElements via `getBoundingClientRect()`.
257
385
  *
258
- * @param {MouseEvent | { clientX: number, clientY: number }} event
259
- * @param {{ x: number, y: number } | null | undefined} origin
260
- * @param {Element | { getBoundingClientRect: Function } | null | undefined} target
261
- * @param {Element | { getBoundingClientRect: Function } | null | undefined} floatingElement
262
- * @returns {boolean}
263
386
  */
264
387
  function isCursorInSafePolygon(event, origin, target, floatingElement) {
265
388
  if (!event || !target || !floatingElement || typeof target.getBoundingClientRect !== 'function' || typeof floatingElement.getBoundingClientRect !== 'function') {
@@ -275,7 +398,7 @@ function isCursorInSafePolygon(event, origin, target, floatingElement) {
275
398
  if (isPointInRect(px, py, targetRect) || isPointInRect(px, py, floatingRect)) {
276
399
  return true;
277
400
  }
278
- const hasRealOrigin = Boolean(origin) && (origin.x !== 0 || origin.y !== 0 || isPointInRect(0, 0, targetRect));
401
+ const hasRealOrigin = origin != null && (origin.x !== 0 || origin.y !== 0 || isPointInRect(0, 0, targetRect));
279
402
 
280
403
  // Attachment is above target: gap is between floatingRect.bottom and targetRect.top
281
404
  if (floatingRect.bottom <= targetRect.top + CORRIDOR_BUFFER) {
@@ -283,7 +406,7 @@ function isCursorInSafePolygon(event, origin, target, floatingElement) {
283
406
  const by = floatingRect.bottom;
284
407
  const cx = floatingRect.right + CORRIDOR_BUFFER;
285
408
  const cy = floatingRect.bottom;
286
- if (hasRealOrigin) {
409
+ if (origin && hasRealOrigin) {
287
410
  return pointInTriangle(px, py, origin.x, origin.y + CORRIDOR_BUFFER, bx, by, cx, cy);
288
411
  }
289
412
  return pointInQuad(px, py, targetRect.left, targetRect.top + CORRIDOR_BUFFER, targetRect.right, targetRect.top + CORRIDOR_BUFFER, cx, cy, bx, by);
@@ -295,7 +418,7 @@ function isCursorInSafePolygon(event, origin, target, floatingElement) {
295
418
  const by = floatingRect.top;
296
419
  const cx = floatingRect.right + CORRIDOR_BUFFER;
297
420
  const cy = floatingRect.top;
298
- if (hasRealOrigin) {
421
+ if (origin && hasRealOrigin) {
299
422
  return pointInTriangle(px, py, origin.x, origin.y - CORRIDOR_BUFFER, bx, by, cx, cy);
300
423
  }
301
424
  return pointInQuad(px, py, targetRect.left, targetRect.bottom - CORRIDOR_BUFFER, targetRect.right, targetRect.bottom - CORRIDOR_BUFFER, cx, cy, bx, by);
@@ -307,7 +430,7 @@ function isCursorInSafePolygon(event, origin, target, floatingElement) {
307
430
  const by = floatingRect.top - CORRIDOR_BUFFER;
308
431
  const cx = floatingRect.right;
309
432
  const cy = floatingRect.bottom + CORRIDOR_BUFFER;
310
- if (hasRealOrigin) {
433
+ if (origin && hasRealOrigin) {
311
434
  return pointInTriangle(px, py, origin.x + CORRIDOR_BUFFER, origin.y, bx, by, cx, cy);
312
435
  }
313
436
  return pointInQuad(px, py, targetRect.left + CORRIDOR_BUFFER, targetRect.top, targetRect.left + CORRIDOR_BUFFER, targetRect.bottom, cx, cy, bx, by);
@@ -319,7 +442,7 @@ function isCursorInSafePolygon(event, origin, target, floatingElement) {
319
442
  const by = floatingRect.top - CORRIDOR_BUFFER;
320
443
  const cx = floatingRect.left;
321
444
  const cy = floatingRect.bottom + CORRIDOR_BUFFER;
322
- if (hasRealOrigin) {
445
+ if (origin && hasRealOrigin) {
323
446
  return pointInTriangle(px, py, origin.x - CORRIDOR_BUFFER, origin.y, bx, by, cx, cy);
324
447
  }
325
448
  return pointInQuad(px, py, targetRect.right - CORRIDOR_BUFFER, targetRect.top, targetRect.right - CORRIDOR_BUFFER, targetRect.bottom, cx, cy, bx, by);
@@ -331,34 +454,23 @@ const activeAttachers = new Set();
331
454
  const floatingElementParentMap = new WeakMap();
332
455
  const handledEscapeEvents = new WeakSet();
333
456
 
334
- /**
335
- * Register a mounted AttacherCore instance in the in-process attachment tree.
336
- *
337
- * @param {object} attacher
338
- */
457
+ /** Register a mounted `AttacherCore` instance in the in-process attachment tree. */
339
458
  function registerAttacher(attacher) {
340
459
  activeAttachers.add(attacher);
341
460
  }
342
461
 
343
- /**
344
- * Unregister a destroyed AttacherCore instance from the in-process attachment tree.
345
- *
346
- * @param {object} attacher
347
- */
462
+ /** Unregister a destroyed `AttacherCore` instance from the in-process attachment tree. */
348
463
  function unregisterAttacher(attacher) {
349
464
  activeAttachers.delete(attacher);
350
465
  }
351
466
 
352
467
  /**
353
- * Resolve the logical parent AttacherCore whose floating element contains
354
- * this attacher's target or template parent element.
355
- *
356
- * @param {object} child
357
- * @returns {object | null}
468
+ * Resolve the logical parent `AttacherCore` whose floating element contains
469
+ * this attacher's listener target.
358
470
  */
359
471
  function getParentAttacher(child) {
360
- const anchors = [child._listenerTarget, child.parentElement].filter(Boolean);
361
- if (activeAttachers.size > 1 && anchors.length > 0) {
472
+ const anchor = child._listenerTarget;
473
+ if (activeAttachers.size > 1 && anchor) {
362
474
  const byFloatingEl = new Map();
363
475
  for (const candidate of activeAttachers) {
364
476
  if (candidate !== child && candidate._floatingElement) {
@@ -366,24 +478,22 @@ function getParentAttacher(child) {
366
478
  }
367
479
  }
368
480
  if (byFloatingEl.size > 0) {
369
- for (const anchor of anchors) {
370
- let node = anchor === child._floatingElement ? anchor.parentElement : anchor;
371
- while (node) {
372
- if (node !== child._floatingElement) {
373
- const candidate = byFloatingEl.get(node);
374
- if (candidate) {
375
- if (child._floatingElement) {
376
- floatingElementParentMap.set(child._floatingElement, candidate);
377
- }
378
- return candidate;
481
+ let node = anchor === child._floatingElement ? anchor.parentElement : anchor;
482
+ while (node) {
483
+ if (node !== child._floatingElement) {
484
+ const candidate = byFloatingEl.get(node);
485
+ if (candidate) {
486
+ if (child._floatingElement) {
487
+ floatingElementParentMap.set(child._floatingElement, candidate);
379
488
  }
489
+ return candidate;
380
490
  }
381
- node = node.parentElement;
382
491
  }
492
+ node = node.parentElement;
383
493
  }
384
494
  }
385
495
  }
386
- if (anchors.some(anchor => anchor.isConnected)) {
496
+ if (anchor && anchor.isConnected) {
387
497
  if (child._floatingElement) {
388
498
  floatingElementParentMap.delete(child._floatingElement);
389
499
  }
@@ -397,21 +507,13 @@ function getParentAttacher(child) {
397
507
 
398
508
  /**
399
509
  * Cache the parent attachment relationship on the child's floating element so
400
- * clicks that unmount the child mid-event still trace back to the parent via composedPath.
401
- *
402
- * @param {object} attacher
510
+ * clicks that unmount the child mid-event still trace back to the parent via `composedPath`.
403
511
  */
404
512
  function syncParentAttachment(attacher) {
405
513
  getParentAttacher(attacher);
406
514
  }
407
515
 
408
- /**
409
- * Check whether `candidate` is a logical descendant of `ancestor` in the attachment tree.
410
- *
411
- * @param {object} candidate
412
- * @param {object} ancestor
413
- * @returns {boolean}
414
- */
516
+ /** Check whether `candidate` is a logical descendant of `ancestor` in the attachment tree. */
415
517
  function isDescendantOf(candidate, ancestor) {
416
518
  const visited = new Set();
417
519
  let current = getParentAttacher(candidate);
@@ -428,10 +530,6 @@ function isDescendantOf(candidate, ancestor) {
428
530
  /**
429
531
  * Determine whether a DOM event originated inside any logical descendant Attachment
430
532
  * (or its Target) of `parent`.
431
- *
432
- * @param {object} parent
433
- * @param {Event} event
434
- * @returns {boolean}
435
533
  */
436
534
  function descendantAttachmentContainsEvent(parent, event) {
437
535
  if (activeAttachers.size > 1) {
@@ -456,7 +554,7 @@ function descendantAttachmentContainsEvent(parent, event) {
456
554
  return true;
457
555
  }
458
556
  visited.add(currentParent);
459
- currentParent = getParentAttacher(currentParent) ?? (currentParent._floatingElement ? floatingElementParentMap.get(currentParent._floatingElement) : null);
557
+ currentParent = getParentAttacher(currentParent) ?? (currentParent._floatingElement ? floatingElementParentMap.get(currentParent._floatingElement) : undefined);
460
558
  }
461
559
  }
462
560
  }
@@ -466,10 +564,6 @@ function descendantAttachmentContainsEvent(parent, event) {
466
564
  /**
467
565
  * Determine whether a DOM node is contained inside any logical descendant Attachment
468
566
  * (or its Target) of `parent`.
469
- *
470
- * @param {object} parent
471
- * @param {Node | null | undefined} node
472
- * @returns {boolean}
473
567
  */
474
568
  function descendantAttachmentContainsNode(parent, node) {
475
569
  if (!node || activeAttachers.size <= 1) {
@@ -491,10 +585,6 @@ function descendantAttachmentContainsNode(parent, node) {
491
585
  /**
492
586
  * Enforce LIFO Escape dismissal across nested Attachments: only the deepest
493
587
  * currently open escapable Attachment handles a given Escape keydown event.
494
- *
495
- * @param {object} attacher
496
- * @param {KeyboardEvent} event
497
- * @returns {boolean}
498
588
  */
499
589
  function shouldHandleEscapeKey(attacher, event) {
500
590
  if (handledEscapeEvents.has(event)) {
@@ -502,7 +592,7 @@ function shouldHandleEscapeKey(attacher, event) {
502
592
  }
503
593
  if (activeAttachers.size > 1) {
504
594
  for (const candidate of activeAttachers) {
505
- if (candidate !== attacher && !candidate.isDestroyed && !candidate.isDestroying && !candidate._isHiding && !candidate._positioningSuspended && Boolean(candidate._hideListenersOnDocumentByEvent?.keydown) && isDescendantOf(candidate, attacher)) {
595
+ if (candidate !== attacher && !candidate.isDestroyed && !candidate.isDestroying && !candidate._isHiding && !candidate._positioningSuspended && Boolean(candidate._hideListenersOnDocumentByEvent.keydown) && isDescendantOf(candidate, attacher)) {
506
596
  return false;
507
597
  }
508
598
  }
@@ -514,7 +604,6 @@ function shouldHandleEscapeKey(attacher, event) {
514
604
  // Owner-scoped delay group isolating 300ms warm tooltip handoff per app/test container.
515
605
 
516
606
  const DEFAULT_WARM_WINDOW_MS = 300;
517
- const groupsByOwner = new WeakMap();
518
607
  class TooltipDelayGroup {
519
608
  constructor() {
520
609
  this._openTooltips = new Set();
@@ -540,6 +629,7 @@ class TooltipDelayGroup {
540
629
  return this._openTooltips.size > 0 || this._closedAt > 0 && Date.now() - this._closedAt < this._windowMs;
541
630
  }
542
631
  }
632
+ const groupsByOwner = new WeakMap();
543
633
 
544
634
  // Read-only lookup safe during owner teardown (never allocates).
545
635
  function peekDelayGroup(owner) {
@@ -561,29 +651,18 @@ function getDelayGroup(owner) {
561
651
  }
562
652
 
563
653
  /**
564
- * Target resolution seam for BasicAttacher.
654
+ * Target resolution seam.
565
655
  *
566
656
  * Keeps listener target and Floating UI reference selection in one private
567
- * module so explicit targets (elements, virtual references, and selectors)
568
- * can be resolved cleanly without cluttering positioning or lifecycle logic.
657
+ * module so targets (elements, virtual references, and selectors) can be
658
+ * resolved cleanly without cluttering positioning or lifecycle logic.
569
659
  */
570
660
 
571
- /**
572
- * Determine whether a target is a DOM Element.
573
- *
574
- * @param {unknown} value
575
- * @returns {boolean}
576
- */
577
661
  function isElementTarget(value) {
578
662
  return typeof Element !== 'undefined' && value instanceof Element;
579
663
  }
580
664
 
581
- /**
582
- * Floating UI virtual references are plain objects with `getBoundingClientRect`.
583
- *
584
- * @param {unknown} value
585
- * @returns {boolean}
586
- */
665
+ /** Floating UI virtual references are plain objects with `getBoundingClientRect`. */
587
666
  function isVirtualReference(value) {
588
667
  if (value == null || typeof value !== 'object') {
589
668
  return false;
@@ -595,16 +674,11 @@ function isVirtualReference(value) {
595
674
  }
596
675
 
597
676
  /**
598
- * Resolve a public `@explicitTarget` value (Element | selector | virtual ref).
677
+ * Resolve a public `@target` value (Element | selector | virtual ref).
599
678
  *
600
- * Selector strings use `querySelectorAll` and must match exactly one node
601
- * (same contract as `@floatingElementContainer`).
602
- *
603
- * @param {Element | string | { getBoundingClientRect: Function } | null | undefined} value
604
- * @param {ParentNode | Document | null | undefined} root
605
- * @returns {Element | { getBoundingClientRect: Function } | null}
679
+ * Selector strings use `querySelectorAll` and must match exactly one node.
606
680
  */
607
- function coerceExplicitTarget(value, root) {
681
+ function coerceTarget(value, root) {
608
682
  if (value == null) {
609
683
  return null;
610
684
  }
@@ -613,12 +687,12 @@ function coerceExplicitTarget(value, root) {
613
687
  }
614
688
  if (typeof value === 'string') {
615
689
  const doc = root ?? (typeof document !== 'undefined' ? document : null);
616
- assert(`explicitTarget selector "${value}" cannot be resolved without a document`, doc != null);
690
+ assert(`@target selector "${value}" cannot be resolved without a document`, doc != null);
617
691
  const matches = doc.querySelectorAll(value);
618
- assert(`explicitTarget selector "${value}" found ${matches.length} possible targets when there should be exactly 1`, matches.length === 1);
619
- return matches[0];
692
+ assert(`@target selector "${value}" found ${matches.length} possible targets when there should be exactly 1`, matches.length === 1);
693
+ return matches[0] ?? null;
620
694
  }
621
- assert('explicitTarget must be an Element, a CSS selector string, or a Floating UI virtual reference with getBoundingClientRect', false);
695
+ assert('@target must be an Element, a CSS selector string, or a Floating UI virtual reference with getBoundingClientRect', false);
622
696
  return null;
623
697
  }
624
698
  function escapeAttributeSelectorValue(value) {
@@ -627,64 +701,60 @@ function escapeAttributeSelectorValue(value) {
627
701
  }
628
702
  return String(value).replace(/["\\]/g, '\\$&');
629
703
  }
630
- function findPopoverTargetElements(id, root) {
704
+ /** Find native `[popovertarget="<id>"]` / `[interestfor="<id>"]` triggers for an attachment id. */
705
+ function findTriggerTargetElements(id, root) {
706
+ const empty = {
707
+ popoverTargets: [],
708
+ interestTargets: [],
709
+ allTargets: []
710
+ };
631
711
  if (!id || typeof id !== 'string') {
632
- return [];
712
+ return empty;
633
713
  }
634
714
  const doc = (typeof document !== 'undefined' ? document : null);
635
715
  if (!doc || typeof doc.querySelectorAll !== 'function') {
636
- return [];
637
- }
638
- return Array.from(doc.querySelectorAll(`[popovertarget="${escapeAttributeSelectorValue(id)}"]`));
716
+ return empty;
717
+ }
718
+ const escaped = escapeAttributeSelectorValue(id);
719
+ const popoverTargets = Array.from(doc.querySelectorAll(`[popovertarget="${escaped}"]`));
720
+ const interestTargets = Array.from(doc.querySelectorAll(`[interestfor="${escaped}"]`));
721
+ const seen = new Set(popoverTargets);
722
+ const allTargets = [...popoverTargets];
723
+ for (const el of interestTargets) {
724
+ if (!seen.has(el)) {
725
+ seen.add(el);
726
+ allTargets.push(el);
727
+ }
728
+ }
729
+ return {
730
+ popoverTargets,
731
+ interestTargets,
732
+ allTargets
733
+ };
639
734
  }
640
-
641
- // Pick the Floating UI reference: explicit arg (@target / @explicitTarget),
642
- // then yielded registration, then parent. Accepts options-bag or positional args.
643
- function resolveAttachmentTarget(optionsOrExplicit, registeredOrParent, parentElement, root) {
644
- let explicitTarget;
645
- let registeredTarget;
646
- let popoverTargets;
647
- let parent;
648
- let allowParentFallback = true;
649
- let searchRoot;
650
- if (optionsOrExplicit != null && typeof optionsOrExplicit === 'object' && !isElementTarget(optionsOrExplicit) && !isVirtualReference(optionsOrExplicit)) {
651
- ({
652
- explicitTarget,
653
- registeredTarget,
654
- popoverTargets,
655
- parentElement: parent,
656
- allowParentFallback = true,
657
- root: searchRoot
658
- } = optionsOrExplicit);
659
- } else {
660
- explicitTarget = optionsOrExplicit;
661
- if (arguments.length <= 2) {
662
- parent = registeredOrParent;
663
- } else {
664
- registeredTarget = registeredOrParent;
665
- parent = parentElement;
666
- searchRoot = root;
667
- }
668
- }
669
- if (explicitTarget != null) {
670
- return coerceExplicitTarget(explicitTarget, searchRoot);
735
+ /** Pick the Floating UI reference: `@target`, then yielded registration, then native triggers. */
736
+ function resolveAttachmentTarget({
737
+ target,
738
+ registeredTarget,
739
+ triggerTargets,
740
+ root
741
+ }) {
742
+ if (target != null) {
743
+ return coerceTarget(target, root);
671
744
  }
672
745
  if (registeredTarget != null) {
673
746
  return registeredTarget;
674
747
  }
675
- if (Array.isArray(popoverTargets) && popoverTargets.length > 0) {
676
- return popoverTargets[0];
748
+ if (triggerTargets && triggerTargets.length > 0) {
749
+ return triggerTargets[0] ?? null;
677
750
  }
678
- return allowParentFallback ? parent ?? null : null;
751
+ return null;
679
752
  }
680
753
 
681
754
  /**
682
755
  * Extract the DOM Element that should receive event listeners.
683
756
  * Real Elements receive events directly. Virtual references may provide a
684
757
  * `contextElement`; virtual references without a contextElement attach no listeners.
685
- *
686
- * @param {Element | { getBoundingClientRect: Function, contextElement?: Element } | null | undefined} target
687
- * @returns {Element | null}
688
758
  */
689
759
  function getListenerTarget(target) {
690
760
  if (isElementTarget(target)) {
@@ -698,8 +768,6 @@ function getListenerTarget(target) {
698
768
 
699
769
  /**
700
770
  * Whether the current browser environment supports Top-Layer `[popover="manual"]`.
701
- *
702
- * @returns {boolean}
703
771
  */
704
772
  function supportsPopoverHost() {
705
773
  return typeof HTMLElement !== 'undefined' && typeof HTMLElement.prototype.showPopover === 'function';
@@ -710,8 +778,6 @@ function supportsPopoverHost() {
710
778
  * so Top-Layer attachments opened inside `showModal()` stay DOM-inside the modal
711
779
  * and do not become inert.
712
780
  *
713
- * @param {Element | null | undefined} contextNode
714
- * @returns {Element | null}
715
781
  */
716
782
  function getModalDialogContainer(contextNode) {
717
783
  if (!isElementTarget(contextNode) || typeof contextNode.closest !== 'function') {
@@ -724,59 +790,13 @@ function getModalDialogContainer(contextNode) {
724
790
  }
725
791
  }
726
792
 
727
- /**
728
- * Resolve the DOM destination element for `MaybeInElement`.
729
- *
730
- * @param {{
731
- * renderInPlace: boolean,
732
- * parentElement: Element | null,
733
- * maybeContainer: Element | string | null | undefined,
734
- * hasCustomContainer: boolean,
735
- * modalContainer: Element | null,
736
- * usePopoverHost: boolean,
737
- * }} options
738
- * @returns {Element | undefined}
739
- */
740
- function resolveHostContainer({
741
- renderInPlace,
742
- parentElement,
743
- maybeContainer,
744
- hasCustomContainer,
745
- modalContainer,
746
- usePopoverHost
747
- }) {
748
- if (renderInPlace) {
749
- return parentElement;
750
- }
751
- if (maybeContainer instanceof Element) {
752
- return maybeContainer;
753
- }
754
- if (!hasCustomContainer && modalContainer) {
755
- return modalContainer;
756
- }
757
- if (typeof maybeContainer === 'string') {
758
- const possibleContainers = document.querySelectorAll(maybeContainer);
759
-
760
- // DEFAULTS.floatingElementContainer is '.ember-application'; embedded or
761
- // standalone Top-Layer mounts without .ember-application fall back to body.
762
- if (possibleContainers.length === 0 && !hasCustomContainer && usePopoverHost) {
763
- return document.body;
764
- }
765
- assert(`floatingElementContainer selector "${maybeContainer}" found ` + `${possibleContainers.length} possible containers when there should be exactly 1`, possibleContainers.length === 1);
766
- return possibleContainers[0];
767
- }
768
- return undefined;
769
- }
770
-
771
793
  /**
772
794
  * Promote a `[popover]` host element into the browser Top Layer.
773
795
  * If `showPopover()` throws, logs a debug warning and removes `[popover]` so the
774
- * `{{#in-element}}` portal fallback stays visible instead of matching UA `:not(:popover-open)`.
775
- *
776
- * @param {Element | null | undefined} el
796
+ * in-place host remains visible instead of matching UA `:not(:popover-open)`.
777
797
  */
778
798
  function showPopoverHost(el) {
779
- if (el && el.isConnected && el.hasAttribute('popover') && typeof el.showPopover === 'function') {
799
+ if (el instanceof HTMLElement && el.isConnected && el.hasAttribute('popover') && typeof el.showPopover === 'function') {
780
800
  try {
781
801
  if (!el.matches(':popover-open')) {
782
802
  el.showPopover();
@@ -792,11 +812,9 @@ function showPopoverHost(el) {
792
812
 
793
813
  /**
794
814
  * Remove a `[popover]` host element from the browser Top Layer.
795
- *
796
- * @param {Element | null | undefined} el
797
815
  */
798
816
  function hidePopoverHost(el) {
799
- if (el && el.isConnected && el.hasAttribute('popover') && typeof el.hidePopover === 'function') {
817
+ if (el instanceof HTMLElement && el.isConnected && el.hasAttribute('popover') && typeof el.hidePopover === 'function') {
800
818
  try {
801
819
  if (el.matches(':popover-open')) {
802
820
  el.hidePopover();
@@ -809,56 +827,9 @@ function hidePopoverHost(el) {
809
827
  }
810
828
  }
811
829
 
812
- function consume(positional) {
813
- for (let i = 0; i < positional.length; i++) {
814
- void positional[i];
815
- }
816
- }
817
-
818
- /**
819
- * Run once per element, after render, so tracked writes do not hit the modifier's tracking frame.
820
- *
821
- * @param {Function} fn
822
- * @returns {import('ember-modifier').ModifierFunction}
823
- */
824
- function onInsert(fn) {
825
- const seen = new WeakSet();
826
- return modifier(element => {
827
- if (seen.has(element)) {
828
- return;
829
- }
830
- seen.add(element);
831
- const timer = schedule('actions', fn, element);
832
- return () => cancel(timer);
833
- });
834
- }
835
-
836
- /**
837
- * Skip install ({{did-update}} semantics). Each factory has its own WeakSet so two
838
- * onUpdate modifiers on the same node do not steal each other's first run.
839
- *
840
- * @param {Function} fn
841
- * @returns {import('ember-modifier').ModifierFunction}
842
- */
843
- function onUpdate(fn) {
844
- const seen = new WeakSet();
845
- return modifier((element, positional) => {
846
- consume(positional);
847
- if (!seen.has(element)) {
848
- seen.add(element);
849
- return;
850
- }
851
- const timer = schedule('actions', fn);
852
- return () => cancel(timer);
853
- });
854
- }
830
+ const DEFAULT_SHIFT_PADDING = 5;
855
831
 
856
- /**
857
- * Check whether an attachment target (DOM Element or VirtualElement) is still connected.
858
- *
859
- * @param {Element | { contextElement?: Element } | null | undefined} target
860
- * @returns {boolean}
861
- */
832
+ /** Check whether an attachment target (DOM Element or VirtualElement) is still connected. */
862
833
  function isTargetConnected(target) {
863
834
  if (!target) {
864
835
  return false;
@@ -871,84 +842,61 @@ function isTargetConnected(target) {
871
842
  }
872
843
  return true;
873
844
  }
874
-
875
845
  /**
876
846
  * Normalize and deduplicate the Floating UI middleware array without mutating
877
847
  * caller-supplied middleware objects.
878
- *
879
- * @param {{
880
- * rawMiddleware: Array<any> | null | undefined,
881
- * arrowElement: Element | null,
882
- * flipOption: string | null | undefined,
883
- * overflowPadding: number | boolean | undefined,
884
- * arrowEnabled: boolean,
885
- * }} options
886
- * @returns {Array<any>}
887
848
  */
888
849
  function buildMiddleware({
889
850
  rawMiddleware,
890
851
  arrowElement,
891
- flipOption,
892
- overflowPadding,
893
852
  arrowEnabled
894
853
  }) {
895
- const middleware = (rawMiddleware || []).map(m => {
896
- if (m?.name === 'arrow' && arrowElement) {
854
+ const middleware = [];
855
+ for (const m of rawMiddleware || []) {
856
+ if (!m) {
857
+ continue;
858
+ }
859
+ if (m.name === 'arrow' && arrowElement) {
897
860
  if (typeof m.options === 'function') {
898
- return arrow(state => {
899
- const resolved = m.options(state) || {};
861
+ const optionsFn = m.options;
862
+ middleware.push(arrow(state => {
863
+ const resolved = optionsFn(state) || {};
900
864
  return resolved.element ? resolved : {
901
865
  ...resolved,
902
866
  element: arrowElement
903
867
  };
904
- });
868
+ }));
869
+ continue;
905
870
  }
906
871
  if (!m.options?.element) {
907
- return arrow({
872
+ middleware.push(arrow({
908
873
  ...m.options,
909
874
  element: arrowElement
910
- });
875
+ }));
876
+ continue;
911
877
  }
912
878
  }
913
- return m;
914
- });
915
- if (!middleware.some(m => m?.name === 'flip')) {
916
- if (flipOption) {
917
- middleware.push(flip({
918
- fallbackPlacements: flipOption.split(' ')
919
- }));
920
- } else if (overflowPadding !== false) {
921
- middleware.push(flip());
922
- }
879
+ middleware.push(m);
880
+ }
881
+ if (!middleware.some(m => m.name === 'flip')) {
882
+ middleware.push(flip());
923
883
  }
924
- if (overflowPadding !== false && !middleware.some(m => m?.name === 'shift')) {
884
+ if (!middleware.some(m => m.name === 'shift')) {
925
885
  middleware.push(shift({
926
886
  limiter: limitShift(),
927
- padding: overflowPadding
887
+ padding: DEFAULT_SHIFT_PADDING
928
888
  }));
929
889
  }
930
- if (arrowEnabled && arrowElement && !middleware.some(m => m?.name === 'arrow')) {
890
+ if (arrowEnabled && arrowElement && !middleware.some(m => m.name === 'arrow')) {
931
891
  middleware.push(arrow({
932
892
  element: arrowElement
933
893
  }));
934
894
  }
935
895
  return middleware;
936
896
  }
937
-
938
897
  /**
939
898
  * Apply the resolved `computePosition` coordinates, arrow offset, `middlewareData.hide`
940
- * attributes, and `x-placement` to the floating and arrow elements.
941
- *
942
- * @param {Element} floatingElement
943
- * @param {Element | null} arrowElement
944
- * @param {{
945
- * x: number,
946
- * y: number,
947
- * placement: string,
948
- * strategy: string,
949
- * middlewareData: Record<string, any>,
950
- * isHidden: boolean,
951
- * }} result
899
+ * attributes, `data-placement`, and `x-placement` to the floating and arrow elements.
952
900
  */
953
901
  function applyPositionResult(floatingElement, arrowElement, {
954
902
  x,
@@ -973,11 +921,13 @@ function applyPositionResult(floatingElement, arrowElement, {
973
921
  top: arrowY != null ? `${arrowY}px` : ''
974
922
  });
975
923
  }
924
+ let hiddenByMiddleware = false;
976
925
  if (middlewareData.hide) {
977
926
  const {
978
927
  referenceHidden,
979
928
  escaped
980
929
  } = middlewareData.hide;
930
+ hiddenByMiddleware = Boolean(referenceHidden || escaped);
981
931
  if (referenceHidden) {
982
932
  floatingElement.setAttribute('data-reference-hidden', '');
983
933
  } else {
@@ -988,60 +938,108 @@ function applyPositionResult(floatingElement, arrowElement, {
988
938
  } else {
989
939
  floatingElement.removeAttribute('data-escaped');
990
940
  }
991
- if (referenceHidden || escaped) {
992
- floatingElement.style.visibility = 'hidden';
993
- } else if (!isHidden) {
994
- floatingElement.style.visibility = '';
995
- }
941
+ } else {
942
+ floatingElement.removeAttribute('data-reference-hidden');
943
+ floatingElement.removeAttribute('data-escaped');
996
944
  }
945
+ if (hiddenByMiddleware) {
946
+ floatingElement.style.visibility = 'hidden';
947
+ } else if (!isHidden) {
948
+ floatingElement.style.visibility = '';
949
+ }
950
+ floatingElement.setAttribute('data-placement', placement);
997
951
  floatingElement.setAttribute('x-placement', placement);
998
952
  }
999
953
 
1000
- var _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor0, _descriptor1, _descriptor10;
1001
- function resolveTooltipClass(envConfig) {
1002
- const {
1003
- tooltip,
1004
- tooltipClass
1005
- } = envConfig || {};
1006
- return tooltip?.tooltipClass ?? tooltipClass ?? DEFAULTS.tooltipClass;
954
+ const attacherWaiter = buildWaiter('ember-attacher');
955
+
956
+ /** Cancel a scheduled task handle if present. */
957
+ function cancelScheduled(handle) {
958
+ handle?.cancel?.();
1007
959
  }
1008
- function createTargetModifier(core) {
1009
- return class AttacherTargetModifier extends Modifier {
1010
- constructor(owner, args) {
1011
- super(owner, args);
1012
- this._element = null;
1013
- this._installed = false;
1014
- this._destroyed = false;
1015
- this._mountTimer = null;
1016
- registerDestructor(this, () => {
1017
- this._destroyed = true;
1018
- cancel(this._mountTimer);
1019
- if (this._element) {
1020
- core.unregisterTargetElement(this._element);
1021
- this._element = null;
1022
- }
1023
- });
960
+
961
+ /** Defer a callback to a microtask while holding a test-waiter token until it runs or cancels. */
962
+ function scheduleMicrotask(fn) {
963
+ let active = true;
964
+ const token = attacherWaiter.beginAsync();
965
+ queueMicrotask(() => {
966
+ if (!active) {
967
+ return;
1024
968
  }
1025
- modify(element, positional, named) {
1026
- if (this._destroyed || core.isDestroyed) {
1027
- return;
969
+ active = false;
970
+ attacherWaiter.endAsync(token);
971
+ fn();
972
+ });
973
+ return {
974
+ cancel() {
975
+ if (active) {
976
+ active = false;
977
+ attacherWaiter.endAsync(token);
1028
978
  }
1029
- const data = positional.length > 0 ? positional[0] : named?.data;
1030
- const entry = core.registerTargetElement(element, data, null, getOwner(this));
1031
- if (!this._installed) {
1032
- this._installed = true;
1033
- this._element = element;
1034
- this._mountTimer = schedule('actions', () => {
1035
- this._mountTimer = null;
1036
- if (!this._destroyed && !core.isDestroyed) {
1037
- core._onRegisteredEntryMounted(element, entry.data);
1038
- }
1039
- });
979
+ }
980
+ };
981
+ }
982
+
983
+ /** Schedule a `setTimeout` tracked by `@ember/test-waiters`, returning a cancellable handle. */
984
+ function scheduleTimeout(fn, ms) {
985
+ let active = true;
986
+ const token = attacherWaiter.beginAsync();
987
+ const timerId = setTimeout(() => {
988
+ if (!active) {
989
+ return;
990
+ }
991
+ active = false;
992
+ attacherWaiter.endAsync(token);
993
+ fn();
994
+ }, ms);
995
+ return {
996
+ cancel() {
997
+ if (active) {
998
+ active = false;
999
+ clearTimeout(timerId);
1000
+ attacherWaiter.endAsync(token);
1040
1001
  }
1041
1002
  }
1042
1003
  };
1043
1004
  }
1044
- const animationTestWaiter = buildWaiter('basic-attacher');
1005
+
1006
+ /** Cancel any existing handle and either run synchronously (`immediate` or `!ms`) or after `ms`. */
1007
+ function debounceTimeout(currentHandle, fn, ms, immediate = false) {
1008
+ cancelScheduled(currentHandle);
1009
+ if (immediate || !ms) {
1010
+ fn();
1011
+ return null;
1012
+ }
1013
+ return scheduleTimeout(fn, ms);
1014
+ }
1015
+
1016
+ var _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9;
1017
+ let nextInstanceNumber = 0;
1018
+ function nextFloatingId() {
1019
+ nextInstanceNumber += 1;
1020
+ return `ember-attacher-${nextInstanceNumber}-floating`;
1021
+ }
1022
+ function resolveTooltipClass(envConfig) {
1023
+ const {
1024
+ tooltip,
1025
+ tooltipClass
1026
+ } = envConfig || {};
1027
+ return tooltip?.tooltipClass ?? tooltipClass ?? DEFAULTS.tooltipClass;
1028
+ }
1029
+ const TRUTHY_OPTION_KEYS = new Set(['animation', 'class']);
1030
+ const REMOVED_4X_ARGS = {
1031
+ explicitTarget: 'Use `@target` instead.',
1032
+ flip: 'Pass `flip()` in `@middleware` instead.',
1033
+ overflowPadding: 'Pass `shift({ padding })` / `flip({ padding })` in `@middleware` instead.',
1034
+ floatingUiOptions: 'Use `@placement`, `@strategy`, and `@middleware` instead.',
1035
+ floatingElementContainer: 'Use the default Top-Layer host or `@renderInPlace={{true}}`.',
1036
+ isOffset: 'Remove; the diagonal safePolygon corridor is active automatically when `@interactive={{true}}`.',
1037
+ style: 'Style via `@class` / `class="..."` or `--ember-attacher-*` CSS custom properties instead.',
1038
+ additionalClass: 'Use `@class` or `class="..."` instead.',
1039
+ onInitializeAttacher: 'Use an element modifier on the Target or Attachment instead.',
1040
+ onWillDestroy: 'Use an element modifier teardown or `registerDestructor` instead.',
1041
+ configKey: 'Use `<AttachTooltip>` or `<AttachPopover>` instead.'
1042
+ };
1045
1043
  const EMPTY_OBJECT = Object.freeze({});
1046
1044
  const rawEnvByOwner = new WeakMap();
1047
1045
  function readEmberAttacherEnv(owner) {
@@ -1055,6 +1053,26 @@ function readEmberAttacherEnv(owner) {
1055
1053
  }
1056
1054
  return env?.emberAttacher || EMPTY_OBJECT;
1057
1055
  }
1056
+ function resolveOwnerRootElement(owner, doc) {
1057
+ if (!doc) {
1058
+ return null;
1059
+ }
1060
+ let root = null;
1061
+ if (owner && typeof owner.lookup === 'function') {
1062
+ const app = owner.lookup('application:main');
1063
+ root = app?.rootElement ?? null;
1064
+ }
1065
+ if (root instanceof Element) {
1066
+ return root;
1067
+ }
1068
+ if (typeof root === 'string') {
1069
+ const matched = doc.querySelector(root);
1070
+ if (matched) {
1071
+ return matched;
1072
+ }
1073
+ }
1074
+ return doc.querySelector('.ember-application') || doc.body;
1075
+ }
1058
1076
  function shallowValueEqual(a, b) {
1059
1077
  if (a === b) {
1060
1078
  return true;
@@ -1062,21 +1080,25 @@ function shallowValueEqual(a, b) {
1062
1080
  if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {
1063
1081
  return false;
1064
1082
  }
1065
- const keysA = Object.keys(a);
1066
- const keysB = Object.keys(b);
1083
+ const objA = a;
1084
+ const objB = b;
1085
+ const keysA = Object.keys(objA);
1086
+ const keysB = Object.keys(objB);
1067
1087
  if (keysA.length !== keysB.length) {
1068
1088
  return false;
1069
1089
  }
1070
1090
  return keysA.every(key => {
1071
- const valA = a[key];
1072
- const valB = b[key];
1091
+ const valA = objA[key];
1092
+ const valB = objB[key];
1073
1093
  if (valA === valB) {
1074
1094
  return true;
1075
1095
  }
1076
1096
  if (valA && valB && typeof valA === 'object' && typeof valB === 'object') {
1077
- const subKeysA = Object.keys(valA);
1078
- const subKeysB = Object.keys(valB);
1079
- return subKeysA.length === subKeysB.length && subKeysA.every(subKey => valA[subKey] === valB[subKey]);
1097
+ const subA = valA;
1098
+ const subB = valB;
1099
+ const subKeysA = Object.keys(subA);
1100
+ const subKeysB = Object.keys(subB);
1101
+ return subKeysA.length === subKeysB.length && subKeysA.every(subKey => subA[subKey] === subB[subKey]);
1080
1102
  }
1081
1103
  return false;
1082
1104
  });
@@ -1085,32 +1107,85 @@ function normalizeTriggerList(value, fallback) {
1085
1107
  const resolved = value === undefined ? fallback : value;
1086
1108
  return resolved === null ? [] : resolved.split(' ').filter(Boolean);
1087
1109
  }
1110
+ function createTargetModifier(core) {
1111
+ class AttacherTargetModifierImpl extends Modifier {
1112
+ constructor(owner, args) {
1113
+ super(owner, args);
1114
+ this._element = null;
1115
+ this._installed = false;
1116
+ this._destroyed = false;
1117
+ this._mountHandle = null;
1118
+ this._lastBoundData = undefined;
1119
+ registerDestructor(this, () => {
1120
+ this._destroyed = true;
1121
+ cancelScheduled(this._mountHandle);
1122
+ if (this._element) {
1123
+ core.unregisterTargetElement(this._element);
1124
+ this._element = null;
1125
+ }
1126
+ });
1127
+ }
1128
+ modify(element, positional, named) {
1129
+ if (this._destroyed || core.isDestroyed) {
1130
+ return;
1131
+ }
1132
+ core._usedTargetModifier = true;
1133
+ const boundData = positional.length > 0 ? positional[0] : named?.data;
1134
+ const data = this._installed && element === this._element && boundData === this._lastBoundData ? core._registeredEntries.get(element)?.data : boundData;
1135
+ this._lastBoundData = boundData;
1136
+ const entry = core.registerTargetElement(element, data, null, getOwner(this) ?? null);
1137
+ if (!this._installed) {
1138
+ this._installed = true;
1139
+ this._element = element;
1140
+ this._mountHandle = scheduleMicrotask(() => {
1141
+ this._mountHandle = null;
1142
+ if (!this._destroyed && !core.isDestroyed) {
1143
+ core._onRegisteredEntryMounted(element, entry.data);
1144
+ }
1145
+ });
1146
+ }
1147
+ }
1148
+ }
1149
+ return AttacherTargetModifierImpl;
1150
+ }
1088
1151
 
1089
- // Shared reactive controller backing <BasicAttacher> and <Attacher>.
1152
+ /**
1153
+ * Shared reactive controller backing `<AttachTooltip>`, `<AttachPopover>`,
1154
+ * `<Attacher>`, and the `{{tooltip}}` singleton pool.
1155
+ */
1090
1156
  let AttacherCore = (_class = class AttacherCore {
1091
1157
  constructor(ownerContext, getArgs, {
1092
1158
  defaultConfigKey = null,
1093
1159
  defaultAriaRole = undefined,
1094
- getAdditionalClass = null,
1095
- allowParentFallback = true,
1160
+ getDefaultClass = null,
1096
1161
  isComponentHost = true,
1097
1162
  onRenderStateChange = null
1098
1163
  } = {}) {
1099
- _initializerDefineProperty(this, "_parentNotFound", _descriptor, this);
1100
- _initializerDefineProperty(this, "_parentElement", _descriptor2, this);
1101
- _initializerDefineProperty(this, "_isStartingAnimation", _descriptor3, this);
1102
- _initializerDefineProperty(this, "_arrowElement", _descriptor4, this);
1103
- _initializerDefineProperty(this, "_currentTarget", _descriptor5, this);
1104
- _initializerDefineProperty(this, "_registeredTarget", _descriptor6, this);
1105
- _initializerDefineProperty(this, "_mustRender", _descriptor7, this);
1106
- _initializerDefineProperty(this, "_modalContainer", _descriptor8, this);
1107
- _initializerDefineProperty(this, "_isShown", _descriptor9, this);
1108
- _initializerDefineProperty(this, "_data", _descriptor0, this);
1109
- _initializerDefineProperty(this, "_resolvedPlacement", _descriptor1, this);
1110
- _initializerDefineProperty(this, "_middlewareData", _descriptor10, this);
1111
- this._defaultId = null;
1164
+ _initializerDefineProperty(this, "_arrowElement", _descriptor, this);
1165
+ _initializerDefineProperty(this, "_currentTarget", _descriptor2, this);
1166
+ _initializerDefineProperty(this, "_registeredTarget", _descriptor3, this);
1167
+ _initializerDefineProperty(this, "_mustRender", _descriptor4, this);
1168
+ _initializerDefineProperty(this, "_modalContainer", _descriptor5, this);
1169
+ _initializerDefineProperty(this, "_isShown", _descriptor6, this);
1170
+ _initializerDefineProperty(this, "_data", _descriptor7, this);
1171
+ _initializerDefineProperty(this, "_resolvedPlacement", _descriptor8, this);
1172
+ _initializerDefineProperty(this, "_middlewareData", _descriptor9, this);
1173
+ this._ownerContext = void 0;
1174
+ this._owner = void 0;
1175
+ this._getArgs = void 0;
1176
+ this._defaultConfigKey = void 0;
1177
+ this._defaultAriaRole = void 0;
1178
+ this._getDefaultClass = void 0;
1179
+ this._isComponentHost = void 0;
1180
+ this._onRenderStateChange = void 0;
1181
+ this._defaultId = void 0;
1112
1182
  this._elementId = null;
1113
- this._setReferenceTimer = null;
1183
+ this._hasTargetBlock = false;
1184
+ this._usedTargetModifier = false;
1185
+ this._usedSetTarget = false;
1186
+ this._hasCheckedInitialTarget = false;
1187
+ this._setTargetHandle = null;
1188
+ this._syncArgsHandle = null;
1114
1189
  // Untracked copy of the node listeners are on so `_removeHideEventListeners`
1115
1190
  // does not read `_currentTarget` in the same frame that writes it.
1116
1191
  this._listenerTarget = null;
@@ -1125,45 +1200,41 @@ let AttacherCore = (_class = class AttacherCore {
1125
1200
  this._skipNativePopoverToggle = false;
1126
1201
  this._addedManagedPopover = false;
1127
1202
  this._attachedPopoverEventsOn = null;
1128
- this._syncArgsTimer = null;
1129
1203
  this._prevSyncedIsShown = undefined;
1130
1204
  this._prevSyncedTargetKey = undefined;
1131
- this._lastShownByDelay = 0;
1132
- this.parentFinder = modifier((element, [hasTargetBlock]) => {
1133
- if (hasTargetBlock !== undefined) {
1134
- this._allowParentFallback = !hasTargetBlock;
1135
- }
1136
- const timer = schedule('actions', () => {
1137
- if (!this._isDestroyed) {
1138
- this._setTracked('_parentElement', element.parentElement);
1139
- this._initializeAttacher();
1140
- }
1141
- });
1142
- return () => cancel(timer);
1143
- });
1144
- // Insert + autoUpdate teardown. Must not read tracked state synchronously in
1145
- // the modifier callback (the scheduled fn is fine) or tracked updates will re-fire teardown.
1205
+ this._prevSyncedTarget = undefined;
1206
+ this._closeGeneration = 0;
1207
+ this._activeCloseCancel = null;
1208
+ this._delayedVisibilityToggle = null;
1209
+ this._isHidden = true;
1210
+ this._isHiding = false;
1211
+ this._positioningSuspended = true;
1212
+ this._isDestroyed = false;
1213
+ this._hideListenersOnDocumentByEvent = {};
1214
+ this._hideListenersOnTargetByEvent = {};
1215
+ this._targetShowListenersByEvent = {};
1216
+ this._aria = new AttachmentAriaController();
1217
+ this._ariaOpen = false;
1218
+ this._mouseLeaveOrigin = null;
1219
+ this._restoreFocusOnHide = false;
1220
+ this._suppressFocusShow = false;
1221
+ this._lastUseCaptureArgumentValue = void 0;
1222
+ this._warnedRemovedArgs = new Set();
1223
+ this._cleanup = null;
1224
+ this.api = void 0;
1225
+ /** Tracks template args read inside `<template>` and schedules an idle args sync. */
1226
+ this.syncArgs = (..._positional) => {
1227
+ this.scheduleArgsSync();
1228
+ return '';
1229
+ };
1230
+ // In-place host mount & cleanup for `<AttachTooltip>` / `<AttachPopover>` (pass 1).
1146
1231
  this.setupFloatingElement = modifier((element, [hasTargetBlock]) => {
1147
- if (hasTargetBlock !== undefined) {
1148
- this._allowParentFallback = !hasTargetBlock;
1149
- }
1232
+ this._hasTargetBlock = Boolean(hasTargetBlock);
1150
1233
  this._floatingElement = element;
1151
1234
  registerAttacher(this);
1152
- const timer = schedule('actions', () => {
1153
- if (this._isDestroyed) {
1154
- return;
1155
- }
1156
- this._floatingElement = element;
1157
- this._attachPopoverEvents(element);
1158
- if (this.renderInPlace) {
1159
- this._setTracked('_parentElement', element.parentElement);
1160
- this._initializeAttacher();
1161
- } else {
1162
- syncParentAttachment(this);
1163
- }
1164
- });
1235
+ this._attachPopoverEvents(element);
1236
+ this.scheduleArgsSync();
1165
1237
  return () => {
1166
- cancel(timer);
1167
1238
  this._detachPopoverEvents(element);
1168
1239
  if (this._floatingElement === element) {
1169
1240
  this._floatingElement = null;
@@ -1172,10 +1243,11 @@ let AttacherCore = (_class = class AttacherCore {
1172
1243
  this._cleanup = null;
1173
1244
  };
1174
1245
  });
1246
+ // Headless `<Attacher as |a|>` floating element modifier.
1175
1247
  this.attachment = modifier(element => {
1176
1248
  this._floatingElement = element;
1177
1249
  registerAttacher(this);
1178
- const timer = schedule('actions', () => {
1250
+ const handle = scheduleMicrotask(() => {
1179
1251
  if (this._isDestroyed) {
1180
1252
  return;
1181
1253
  }
@@ -1189,15 +1261,12 @@ let AttacherCore = (_class = class AttacherCore {
1189
1261
  if (elementHadExplicitId && !hadId && !this._arg('id') || !hadTarget) {
1190
1262
  this._initializeAttacher();
1191
1263
  } else if (this._isShown && !this._isHiding) {
1192
- if (element.style.display !== 'block') {
1193
- this._cancelAnimation();
1194
- this._applyVisibility(true);
1195
- }
1196
- this._startShowAnimation();
1264
+ this._applyVisibility(true);
1265
+ this._update();
1197
1266
  }
1198
1267
  });
1199
1268
  return () => {
1200
- cancel(timer);
1269
+ cancelScheduled(handle);
1201
1270
  this._detachPopoverEvents(element);
1202
1271
  if (this._addedManagedPopover && element.getAttribute('popover') === 'manual') {
1203
1272
  element.removeAttribute('popover');
@@ -1210,13 +1279,8 @@ let AttacherCore = (_class = class AttacherCore {
1210
1279
  this._cleanup = null;
1211
1280
  };
1212
1281
  });
1213
- this.insertArrow = onInsert(element => {
1214
- if (!this._isDestroyed) {
1215
- this._setTracked('_arrowElement', element);
1216
- }
1217
- });
1218
1282
  this.arrowModifier = modifier(element => {
1219
- const timer = schedule('actions', () => {
1283
+ const handle = scheduleMicrotask(() => {
1220
1284
  if (this._isDestroyed) {
1221
1285
  return;
1222
1286
  }
@@ -1226,64 +1290,28 @@ let AttacherCore = (_class = class AttacherCore {
1226
1290
  }
1227
1291
  });
1228
1292
  return () => {
1229
- cancel(timer);
1293
+ cancelScheduled(handle);
1230
1294
  if (!this._isDestroyed && this._arrowElement === element) {
1231
1295
  this._setTracked('_arrowElement', null);
1232
1296
  }
1233
1297
  };
1234
1298
  });
1235
- this.isShownDidUpdate = onUpdate(() => this._syncIsShown());
1236
- this.targetDidUpdate = onUpdate(() => this._initializeAttacher());
1237
- this.optionsDidUpdate = onUpdate(() => {
1238
- this._checkDeprecatedArgs(this._getArgs());
1239
- this._ensureArgumentsAreValid();
1240
- if (this._floatingElement && !this._isComponentHost) {
1241
- this._syncHeadlessAttachmentElement(this._floatingElement);
1242
- }
1243
- this._syncAria();
1244
- this._update();
1245
- });
1299
+ this.insertArrow = this.arrowModifier;
1246
1300
  this.target = createTargetModifier(this);
1247
- this.reference = modifier(element => {
1248
- this._deprecateOnce('ember-attacher.api.reference', '[ember-attacher] The yielded `reference` modifier is deprecated and will be removed in ember-attacher 5.0.0. Use `target` (e.g. `{{a.target}}`) instead.');
1249
- this.setReference(element);
1250
- return () => {
1251
- if (!this._isDestroyed && this._registeredTarget === element) {
1252
- this.setReference(null);
1253
- }
1254
- };
1255
- });
1256
1301
  this._ownerContext = ownerContext;
1257
- this._owner = ownerContext && typeof ownerContext === 'object' ? getOwner(ownerContext) : null;
1302
+ this._owner = ownerContext && typeof ownerContext === 'object' ? getOwner(ownerContext) ?? null : null;
1258
1303
  this._getArgs = getArgs;
1259
1304
  this._defaultConfigKey = defaultConfigKey;
1260
1305
  this._defaultAriaRole = defaultAriaRole;
1261
- this._getAdditionalClass = getAdditionalClass;
1262
- this._allowParentFallback = allowParentFallback;
1306
+ this._getDefaultClass = getDefaultClass;
1263
1307
  this._isComponentHost = isComponentHost;
1264
1308
  this._onRenderStateChange = onRenderStateChange;
1265
- this._defaultId = `${guidFor(this)}-floating`;
1266
- this._delayedVisibilityToggle = null;
1267
- this._isHidden = true;
1268
- this._isHiding = false;
1269
- this._positioningSuspended = true;
1270
- this._pendingRafs = new Set();
1271
- this._isDestroyed = false;
1272
- this._warnedDeprecations = new Set();
1273
- this._hideListenersOnDocumentByEvent = {};
1274
- this._hideListenersOnTargetByEvent = {};
1275
- this._legacyShowListenersOnTargetByEvent = {};
1276
- this._aria = new AttachmentAriaController();
1277
- this._ariaOpen = false;
1278
- this._mouseLeaveOrigin = null;
1279
- this._restoreFocusOnHide = false;
1280
- this._suppressFocusShow = false;
1309
+ this._defaultId = nextFloatingId();
1281
1310
  this.hide = this.hide.bind(this);
1282
1311
  this.show = this.show.bind(this);
1283
1312
  this.toggle = this.toggle.bind(this);
1284
1313
  this.update = this.update.bind(this);
1285
1314
  this.setTarget = this.setTarget.bind(this);
1286
- this.setReference = this.setReference.bind(this);
1287
1315
  this._hide = this._hide.bind(this);
1288
1316
  this._hideAfterDelay = this._hideAfterDelay.bind(this);
1289
1317
  this._hideIfMouseOutsideTargetOrAttachment = this._hideIfMouseOutsideTargetOrAttachment.bind(this);
@@ -1296,35 +1324,38 @@ let AttacherCore = (_class = class AttacherCore {
1296
1324
  this._updatePosition = this._updatePosition.bind(this);
1297
1325
  this._onPopoverTargetClick = this._onPopoverTargetClick.bind(this);
1298
1326
  this._onPopoverBeforeToggle = this._onPopoverBeforeToggle.bind(this);
1299
- this._lastUseCaptureArgumentValue = this.useCapture;
1300
- const core = this;
1301
- this.api = {
1327
+ this._lastUseCaptureArgumentValue = Boolean(this._opt('useCapture'));
1328
+ this.api = Object.defineProperties({
1302
1329
  target: this.target,
1303
1330
  attachment: this.attachment,
1304
1331
  arrow: this.arrowModifier,
1305
- reference: this.reference,
1306
1332
  setTarget: this.setTarget,
1307
- setReference: this.setReference,
1308
1333
  show: this.show,
1309
1334
  hide: this.hide,
1310
1335
  toggle: this.toggle,
1311
- update: this.update,
1312
- get isShown() {
1313
- return core.liveIsShown;
1336
+ update: this.update
1337
+ }, {
1338
+ isShown: {
1339
+ enumerable: true,
1340
+ get: () => this.liveIsShown
1314
1341
  },
1315
- get shouldRender() {
1316
- return core.shouldRenderFloatingElement;
1342
+ shouldRender: {
1343
+ enumerable: true,
1344
+ get: () => this.shouldRenderFloatingElement
1317
1345
  },
1318
- get data() {
1319
- return core._data;
1346
+ data: {
1347
+ enumerable: true,
1348
+ get: () => this._data
1320
1349
  },
1321
- get placement() {
1322
- return core._resolvedPlacement ?? core.placement;
1350
+ placement: {
1351
+ enumerable: true,
1352
+ get: () => this._resolvedPlacement ?? this._opt('placement')
1323
1353
  },
1324
- get middlewareData() {
1325
- return core._middlewareData;
1354
+ middlewareData: {
1355
+ enumerable: true,
1356
+ get: () => this._middlewareData
1326
1357
  }
1327
- };
1358
+ });
1328
1359
  if (ownerContext && typeof ownerContext === 'object') {
1329
1360
  registerDestructor(ownerContext, () => this.destroy());
1330
1361
  }
@@ -1334,36 +1365,6 @@ let AttacherCore = (_class = class AttacherCore {
1334
1365
  this[field] = value;
1335
1366
  }
1336
1367
  }
1337
- _deprecateOnce(id, message) {
1338
- runInDebug(() => {
1339
- if (!this._warnedDeprecations.has(id)) {
1340
- this._warnedDeprecations.add(id);
1341
- deprecate(message, false, {
1342
- id,
1343
- until: '5.0.0',
1344
- for: 'ember-attacher',
1345
- since: {
1346
- available: '4.4.0',
1347
- enabled: '4.4.0'
1348
- }
1349
- });
1350
- }
1351
- });
1352
- }
1353
- _checkDeprecatedArgs(args) {
1354
- if (!args) {
1355
- return;
1356
- }
1357
- runInDebug(() => {
1358
- const deprecatedArgs = [['explicitTarget', 'ember-attacher.arg.explicit-target', 'Use @target instead.'], ['flip', 'ember-attacher.arg.flip', 'Pass `flip()` in @middleware instead.'], ['overflowPadding', 'ember-attacher.arg.overflow-padding', 'Pass `shift({ padding })` / `flip({ padding })` in @middleware instead.'], ['floatingUiOptions', 'ember-attacher.arg.floating-ui-options', 'Use @placement, @strategy, and @middleware instead.'], ['floatingElementContainer', 'ember-attacher.arg.floating-element-container', 'Attachments promote into the browser Top Layer via [popover="manual"] by default, or use @renderInPlace={{true}}.'], ['isOffset', 'ember-attacher.arg.is-offset', 'The interactive safePolygon hover corridor is active automatically when @interactive={{true}}.'], ['style', 'ember-attacher.arg.style', 'Style the attachment via CSS classes or custom properties instead.'], ['additionalClass', 'ember-attacher.arg.additional-class', 'Use @class or `class="..."` instead.'], ['onInitializeAttacher', 'ember-attacher.arg.on-initialize-attacher', 'Use an element modifier on the Target or Attachment instead.'], ['onWillDestroy', 'ember-attacher.arg.on-will-destroy', 'Use an element modifier or `registerDestructor` instead.']];
1359
- for (let i = 0; i < deprecatedArgs.length; i++) {
1360
- const [argName, id, hint] = deprecatedArgs[i];
1361
- if (args[argName] !== undefined) {
1362
- this._deprecateOnce(id, `[ember-attacher] Passing @${argName} is deprecated and will be removed in ember-attacher 5.0.0. ${hint}`);
1363
- }
1364
- }
1365
- });
1366
- }
1367
1368
  _arg(key) {
1368
1369
  const entryOpts = this._activeEntryOptions;
1369
1370
  if (entryOpts && entryOpts[key] !== undefined) {
@@ -1371,143 +1372,70 @@ let AttacherCore = (_class = class AttacherCore {
1371
1372
  }
1372
1373
  return this._getArgs()?.[key];
1373
1374
  }
1375
+ _defaultFor(key) {
1376
+ if (!this._isTooltip && this.configKey === 'popover' && key in POPOVER_DEFAULTS) {
1377
+ return POPOVER_DEFAULTS[key];
1378
+ }
1379
+ return DEFAULTS[key];
1380
+ }
1374
1381
  _opt(key) {
1375
1382
  const argVal = this._arg(key);
1376
- if (argVal != null) {
1383
+ if ((key === 'showOn' || key === 'hideOn') && argVal === null) {
1384
+ return null;
1385
+ }
1386
+ const truthyOnly = TRUTHY_OPTION_KEYS.has(key);
1387
+ if (truthyOnly ? argVal : argVal != null) {
1377
1388
  return argVal;
1378
1389
  }
1379
1390
  const env = this._envConfig;
1380
1391
  const keyed = env[this.configKey];
1381
- if (keyed && keyed[key] != null) {
1382
- return keyed[key];
1392
+ const keyedVal = keyed?.[key];
1393
+ if (truthyOnly ? keyedVal : keyedVal != null) {
1394
+ return keyedVal;
1383
1395
  }
1384
- if (env[key] != null) {
1385
- return env[key];
1396
+ const envVal = env[key];
1397
+ if (truthyOnly ? envVal : envVal != null) {
1398
+ return envVal;
1386
1399
  }
1387
- return DEFAULTS[key];
1388
- }
1389
- get arrow() {
1390
- return this._opt('arrow');
1391
- }
1392
- get autoUpdate() {
1393
- return this._opt('autoUpdate');
1394
- }
1395
- get animation() {
1396
- return this._arg('animation') || this._envConfig[this.configKey]?.animation || this._envConfig.animation || DEFAULTS.animation;
1397
- }
1398
- get flip() {
1399
- return this._opt('flip');
1400
- }
1401
- get hideDelay() {
1402
- return this._opt('hideDelay');
1403
- }
1404
- get hideDuration() {
1405
- return this._opt('hideDuration');
1406
- }
1407
- get hideOn() {
1408
- return this._arg('hideOn') === null ? null : this._opt('hideOn');
1409
- }
1410
- get interactive() {
1411
- return this._opt('interactive');
1412
- }
1413
- get isOffset() {
1414
- return this._opt('isOffset');
1415
- }
1416
- get controlledIsShown() {
1417
- return this._opt('isShown');
1418
- }
1419
- get liveIsShown() {
1420
- return this._isShown;
1421
- }
1422
- get lazyRender() {
1423
- return this._opt('lazyRender');
1424
- }
1425
- get overflowPadding() {
1426
- return this._opt('overflowPadding');
1427
- }
1428
- get placement() {
1429
- return this._opt('placement');
1430
- }
1431
- get renderInPlace() {
1432
- return this._opt('renderInPlace');
1433
- }
1434
- get showDelay() {
1435
- return this._opt('showDelay');
1436
- }
1437
- get showDuration() {
1438
- return this._opt('showDuration');
1439
- }
1440
- get showOn() {
1441
- return this._arg('showOn') === null ? null : this._opt('showOn');
1442
- }
1443
- get strategy() {
1444
- return this._opt('strategy');
1445
- }
1446
- get style() {
1447
- return this._opt('style');
1448
- }
1449
- get useCapture() {
1450
- return this._opt('useCapture');
1451
- }
1452
- get class() {
1453
- return this._arg('class') || this._envConfig[this.configKey]?.class || this._envConfig.class;
1400
+ return this._defaultFor(key);
1454
1401
  }
1455
1402
  get ariaRole() {
1456
1403
  return this._arg('ariaRole') || this._defaultAriaRole;
1457
1404
  }
1458
- get explicitTarget() {
1459
- const targetArg = this._arg('target');
1460
- return targetArg !== undefined ? targetArg : this._arg('explicitTarget');
1461
- }
1462
- get floatingElementContainer() {
1463
- return this._arg('floatingElementContainer') || this._envConfig[this.configKey]?.floatingElementContainer || this._envConfig.floatingElementContainer || DEFAULTS.floatingElementContainer;
1464
- }
1465
- get floatingUiOptions() {
1466
- return this._arg('floatingUiOptions') || this._envConfig[this.configKey]?.floatingUiOptions || this._envConfig.floatingUiOptions || DEFAULTS.floatingUiOptions;
1405
+ get targetArg() {
1406
+ return this._arg('target');
1467
1407
  }
1468
1408
  get configKey() {
1469
1409
  if (this._defaultConfigKey) {
1470
1410
  return this._defaultConfigKey;
1471
1411
  }
1472
- const argKey = this._arg('configKey');
1473
- if (argKey) {
1474
- return argKey;
1475
- }
1476
1412
  return this.ariaRole === 'tooltip' ? 'tooltip' : 'popover';
1477
1413
  }
1478
1414
  get _isTooltip() {
1479
1415
  return this.configKey === 'tooltip' || this.ariaRole === 'tooltip';
1480
1416
  }
1481
- get isFillAnimation() {
1482
- return this.animation === 'fill';
1417
+ get arrow() {
1418
+ return Boolean(this._opt('arrow'));
1483
1419
  }
1484
- get renderFloatingElement() {
1485
- return Boolean(this.renderInPlace || this._currentTarget);
1420
+ get isFillAnimation() {
1421
+ return this._opt('animation') === 'fill';
1486
1422
  }
1487
1423
  get shouldRenderFloatingElement() {
1488
- return !this.lazyRender || this._mustRender;
1424
+ return !this._opt('lazyRender') || this._mustRender;
1489
1425
  }
1490
1426
  get id() {
1491
1427
  return this._arg('id') || this._elementId || this._defaultId;
1492
1428
  }
1493
- get parentElement() {
1494
- return this._parentElement;
1429
+ get popoverAttr() {
1430
+ return this._usePopoverHost ? 'manual' : undefined;
1495
1431
  }
1496
- get _class() {
1497
- const showOrHideClass = `ember-attacher-${this._isStartingAnimation ? 'show' : 'hide'}`;
1498
- const arrowClass = `ember-attacher-${this.arrow ? 'with' : 'without'}-arrow`;
1499
- const additionalClass = this._getAdditionalClass ? this._getAdditionalClass() : this._arg('additionalClass') || '';
1500
- return [`ember-attacher-${this.animation}`, this.class || '', additionalClass, showOrHideClass, arrowClass].filter(Boolean).join(' ');
1432
+ get liveIsShown() {
1433
+ return this._isShown;
1501
1434
  }
1502
- get _style() {
1503
- const style = this.style;
1504
- if (!style) {
1505
- return undefined;
1506
- }
1507
- warn('@ember/string/htmlSafe must be used for any `style` passed to ember-attacher', isHTMLSafe(style), {
1508
- id: 'ember-attacher-require-html-safe-style'
1509
- });
1510
- return style;
1435
+ get innerClass() {
1436
+ const arrowClass = `ember-attacher-${this.arrow ? 'with' : 'without'}-arrow`;
1437
+ const defaultClass = this._getDefaultClass ? this._getDefaultClass() : '';
1438
+ return [`ember-attacher-${this._opt('animation')}`, this._opt('class') || '', defaultClass, arrowClass].filter(Boolean).join(' ');
1511
1439
  }
1512
1440
  get isDestroyed() {
1513
1441
  return this._isDestroyed;
@@ -1547,32 +1475,18 @@ let AttacherCore = (_class = class AttacherCore {
1547
1475
  hasContent: false
1548
1476
  };
1549
1477
  }
1550
- const entry = this._registeredEntries.get(activeEl);
1551
- const parentElement = this._parentElement || this._listenerTarget?.parentElement || null;
1552
- const reuseMountedContainer = !this._hasCustomFloatingElementContainer && !this._renderInPlace && !this._modalContainer && this._floatingElement?.isConnected && this._floatingElement.parentNode?.tagName !== 'DIALOG';
1553
- let container;
1554
- if (reuseMountedContainer) {
1555
- container = this._floatingElement.parentNode;
1556
- } else {
1557
- container = resolveHostContainer({
1558
- renderInPlace: this._renderInPlace,
1559
- parentElement,
1560
- maybeContainer: this.floatingElementContainer,
1561
- hasCustomContainer: this._hasCustomFloatingElementContainer,
1562
- modalContainer: this._modalContainer,
1563
- usePopoverHost: this._usePopoverHost
1564
- });
1565
- }
1478
+ const entry = isElementTarget(activeEl) ? this._registeredEntries.get(activeEl) : undefined;
1479
+ const ownerForRoot = entry?.owner || this._owner;
1480
+ const container = typeof document !== 'undefined' ? this._modalContainer || resolveOwnerRootElement(ownerForRoot, document) : null;
1566
1481
  return {
1567
1482
  activeElement: activeEl,
1568
1483
  id: this.id,
1569
1484
  role: this.ariaRole || 'tooltip',
1570
- popoverAttr: this._popoverAttr,
1571
- className: this._class,
1572
- style: this._style,
1485
+ popoverAttr: this.popoverAttr,
1486
+ className: this.innerClass,
1573
1487
  text: entry?.data != null ? String(entry.data) : '',
1574
1488
  hasContent: Boolean(entry && entry.data != null && entry.data !== ''),
1575
- arrow: Boolean(this.arrow),
1489
+ arrow: this.arrow,
1576
1490
  isFillAnimation: this.isFillAnimation,
1577
1491
  isShown: this._isShown,
1578
1492
  isHiding: this._isHiding,
@@ -1588,62 +1502,83 @@ let AttacherCore = (_class = class AttacherCore {
1588
1502
  return this._envConfig;
1589
1503
  }
1590
1504
  get _envConfig() {
1591
- const entryOwner = this._currentTarget && this._registeredEntries.get(this._currentTarget)?.owner || this._registeredTarget && this._registeredEntries.get(this._registeredTarget)?.owner || this._registeredEntries.values().next().value?.owner || this._owner;
1505
+ const currentEl = isElementTarget(this._currentTarget) ? this._currentTarget : null;
1506
+ const registeredEl = isElementTarget(this._registeredTarget) ? this._registeredTarget : null;
1507
+ const entryOwner = currentEl && this._registeredEntries.get(currentEl)?.owner || registeredEl && this._registeredEntries.get(registeredEl)?.owner || this._registeredEntries.values().next().value?.owner || this._owner;
1592
1508
  return readEmberAttacherEnv(entryOwner);
1593
1509
  }
1594
1510
  get _hideOn() {
1595
- return normalizeTriggerList(this.hideOn, DEFAULTS.hideOn);
1511
+ const fallback = this._defaultFor('hideOn') ?? null;
1512
+ return normalizeTriggerList(this._opt('hideOn'), fallback);
1596
1513
  }
1597
1514
  get _showOn() {
1598
- return normalizeTriggerList(this.showOn, DEFAULTS.showOn);
1515
+ const fallback = this._defaultFor('showOn') ?? null;
1516
+ return normalizeTriggerList(this._opt('showOn'), fallback);
1599
1517
  }
1600
1518
  get _middleware() {
1601
1519
  return buildMiddleware({
1602
1520
  rawMiddleware: this._opt('middleware'),
1603
1521
  arrowElement: this._arrowElement,
1604
- flipOption: this.flip,
1605
- overflowPadding: this.overflowPadding,
1606
- arrowEnabled: Boolean(this.arrow) || !this._isComponentHost && Boolean(this._arrowElement)
1522
+ arrowEnabled: this.arrow || !this._isComponentHost && Boolean(this._arrowElement)
1607
1523
  });
1608
1524
  }
1609
- get _hasCustomFloatingElementContainer() {
1610
- return Boolean(this._arg('floatingElementContainer') || this._envConfig[this.configKey]?.floatingElementContainer || this._envConfig.floatingElementContainer);
1611
- }
1612
1525
  get _usePopoverHost() {
1613
- return supportsPopoverHost() && !this._renderInPlace && !this._hasCustomFloatingElementContainer;
1614
- }
1615
- get _popoverAttr() {
1616
- return this._usePopoverHost ? 'manual' : undefined;
1526
+ return supportsPopoverHost() && !this._renderInPlace;
1617
1527
  }
1618
1528
  get _renderInPlace() {
1619
- return typeof document !== 'undefined' ? Boolean(this.renderInPlace) : true;
1620
- }
1621
- get _floatingElementContainer() {
1622
- return resolveHostContainer({
1623
- renderInPlace: this._renderInPlace,
1624
- parentElement: this._parentElement,
1625
- maybeContainer: this.floatingElementContainer,
1626
- hasCustomContainer: this._hasCustomFloatingElementContainer,
1627
- modalContainer: this._modalContainer,
1628
- usePopoverHost: this._usePopoverHost
1529
+ return typeof document !== 'undefined' ? Boolean(this._opt('renderInPlace')) : true;
1530
+ }
1531
+ get _delayGroupOwner() {
1532
+ const currentEl = isElementTarget(this._currentTarget) ? this._currentTarget : null;
1533
+ const registeredEl = isElementTarget(this._registeredTarget) ? this._registeredTarget : null;
1534
+ return this._owner || currentEl && this._registeredEntries.get(currentEl)?.owner || registeredEl && this._registeredEntries.get(registeredEl)?.owner || this._registeredEntries.values().next().value?.owner || null;
1535
+ }
1536
+ _hasSuppliedTargetBinding() {
1537
+ const args = this._getArgs() || EMPTY_OBJECT;
1538
+ if ('target' in args || this._hasTargetBlock || this._usedTargetModifier || this._usedSetTarget || this._registeredTarget != null || this._registeredEntries.size > 0 || this._popoverTargetEntries.size > 0 || this._currentTarget != null) {
1539
+ return true;
1540
+ }
1541
+ const explicitId = this._arg('id') || this._elementId;
1542
+ if (explicitId) {
1543
+ const {
1544
+ allTargets
1545
+ } = findTriggerTargetElements(explicitId);
1546
+ if (allTargets.length > 0) {
1547
+ return true;
1548
+ }
1549
+ }
1550
+ return false;
1551
+ }
1552
+ _assertInitialTargetBinding() {
1553
+ if (!this._isComponentHost || this._hasCheckedInitialTarget || typeof document === 'undefined') {
1554
+ return;
1555
+ }
1556
+ this._hasCheckedInitialTarget = true;
1557
+ runInDebug(() => {
1558
+ assert('[ember-attacher] <AttachTooltip> and <AttachPopover> require a Target in 5.0.0. Supply @target, <:target>, {{a.target}}, a.setTarget(), [popovertarget], or [interestfor].', this._hasSuppliedTargetBinding());
1629
1559
  });
1630
1560
  }
1631
1561
  scheduleArgsSync() {
1632
- cancel(this._syncArgsTimer);
1633
- this._syncArgsTimer = schedule('actions', () => {
1634
- this._syncArgsTimer = null;
1562
+ cancelScheduled(this._syncArgsHandle);
1563
+ this._syncArgsHandle = scheduleMicrotask(() => {
1564
+ this._syncArgsHandle = null;
1635
1565
  if (this._isDestroyed) {
1636
1566
  return;
1637
1567
  }
1638
- this._checkDeprecatedArgs(this._getArgs());
1639
- const targetKey = `${this.showOn}|${this.hideOn}|${this.id}`;
1640
- const explicitTarget = this.explicitTarget;
1641
- if (!this._prevSyncedTargetKey || this._prevSyncedTargetKey !== targetKey || this._prevSyncedExplicitTarget !== explicitTarget) {
1568
+ this._warnRemoved4xArgs(this._getArgs());
1569
+ const targetKey = `${this._opt('showOn')}|${this._opt('hideOn')}|${this.id}|${this._renderInPlace}`;
1570
+ const targetArg = this.targetArg;
1571
+ const isInitialSync = !this._prevSyncedTargetKey;
1572
+ const targetChanged = isInitialSync || this._prevSyncedTargetKey !== targetKey || this._prevSyncedTarget !== targetArg;
1573
+ if (targetChanged) {
1642
1574
  this._prevSyncedTargetKey = targetKey;
1643
- this._prevSyncedExplicitTarget = explicitTarget;
1575
+ this._prevSyncedTarget = targetArg;
1644
1576
  this._initializeAttacher();
1645
1577
  }
1646
- const isShown = this.controlledIsShown;
1578
+ if (isInitialSync) {
1579
+ this._assertInitialTargetBinding();
1580
+ }
1581
+ const isShown = this._opt('isShown');
1647
1582
  if (this._prevSyncedIsShown !== isShown) {
1648
1583
  this._prevSyncedIsShown = isShown;
1649
1584
  this._syncIsShown();
@@ -1653,18 +1588,15 @@ let AttacherCore = (_class = class AttacherCore {
1653
1588
  this._syncHeadlessAttachmentElement(this._floatingElement);
1654
1589
  }
1655
1590
  this._syncAria();
1656
- this._update();
1591
+ if (!targetChanged) {
1592
+ this._update();
1593
+ }
1657
1594
  });
1658
1595
  }
1659
- /**
1660
- * Owner used for the tooltip delay-group. Pool cores are constructed without an
1661
- * Ember owner; fall back to the active/registered target's modifier owner.
1662
- */
1663
- get _delayGroupOwner() {
1664
- return this._owner || this._currentTarget && this._registeredEntries.get(this._currentTarget)?.owner || this._registeredTarget && this._registeredEntries.get(this._registeredTarget)?.owner || this._registeredEntries.values().next().value?.owner || null;
1665
- }
1666
1596
  registerTargetElement(element, data, options = null, owner = null) {
1667
- this._checkDeprecatedArgs(options);
1597
+ if (options) {
1598
+ this._warnRemoved4xArgs(options);
1599
+ }
1668
1600
  let entry = this._registeredEntries.get(element);
1669
1601
  const isNew = !entry;
1670
1602
  if (!entry) {
@@ -1675,7 +1607,8 @@ let AttacherCore = (_class = class AttacherCore {
1675
1607
  owner,
1676
1608
  showListeners: {},
1677
1609
  showOnKey: null,
1678
- useCapture: null
1610
+ useCapture: null,
1611
+ updateHandle: null
1679
1612
  };
1680
1613
  this._registeredEntries.set(element, entry);
1681
1614
  } else {
@@ -1685,22 +1618,25 @@ let AttacherCore = (_class = class AttacherCore {
1685
1618
  entry.owner = owner;
1686
1619
  }
1687
1620
  }
1688
- if (owner && !this._owner) {
1689
- this._owner = owner;
1621
+ const internalOwner = owner;
1622
+ if (internalOwner && !this._owner) {
1623
+ this._owner = internalOwner;
1690
1624
  }
1691
1625
  this._syncEntryShowListeners(entry);
1692
1626
  if (!isNew && (this._registeredTarget === element || this._currentTarget === element)) {
1693
1627
  this._activeEntryOptions = options;
1694
- cancel(entry.updateTimer);
1695
- entry.updateTimer = schedule('actions', () => {
1696
- entry.updateTimer = null;
1628
+ cancelScheduled(entry.updateHandle);
1629
+ entry.updateHandle = scheduleMicrotask(() => {
1630
+ if (entry) {
1631
+ entry.updateHandle = null;
1632
+ }
1697
1633
  if (this._isDestroyed) {
1698
1634
  return;
1699
1635
  }
1700
1636
  if (this._registeredTarget === element || this._currentTarget === element) {
1701
1637
  this._setTracked('_data', data);
1702
- this._syncAria();
1703
1638
  this._notifyRenderStateChange();
1639
+ this._syncAria();
1704
1640
  if (!this._isHidden || this._isShown) {
1705
1641
  this._update();
1706
1642
  }
@@ -1714,7 +1650,7 @@ let AttacherCore = (_class = class AttacherCore {
1714
1650
  if (!entry) {
1715
1651
  return;
1716
1652
  }
1717
- cancel(entry.updateTimer);
1653
+ cancelScheduled(entry.updateHandle);
1718
1654
  this._removeEntryShowListeners(entry);
1719
1655
  this._registeredEntries.delete(element);
1720
1656
  if (this._listenerTarget === element) {
@@ -1728,7 +1664,7 @@ let AttacherCore = (_class = class AttacherCore {
1728
1664
  if (this._registeredTarget === element || this._currentTarget === element) {
1729
1665
  this._activeEntryOptions = null;
1730
1666
  const shouldHide = !this._isHidden || this._isShown;
1731
- schedule('actions', () => {
1667
+ scheduleMicrotask(() => {
1732
1668
  if (this._isDestroyed) {
1733
1669
  return;
1734
1670
  }
@@ -1745,7 +1681,7 @@ let AttacherCore = (_class = class AttacherCore {
1745
1681
  if (!this._registeredEntries.has(element)) {
1746
1682
  return;
1747
1683
  }
1748
- const currentRegistered = this._registeredTarget;
1684
+ const currentRegistered = isElementTarget(this._registeredTarget) ? this._registeredTarget : null;
1749
1685
  if (!currentRegistered || !this._registeredEntries.has(currentRegistered)) {
1750
1686
  this._setTracked('_registeredTarget', element);
1751
1687
  this._setTracked('_data', data);
@@ -1776,7 +1712,7 @@ let AttacherCore = (_class = class AttacherCore {
1776
1712
  element.removeAttribute('popover');
1777
1713
  this._addedManagedPopover = false;
1778
1714
  }
1779
- if (this._isHidden && !this._isShown) {
1715
+ if (this._isHidden && !this._isShown && !element.classList.contains('ember-attacher')) {
1780
1716
  element.style.display = 'none';
1781
1717
  element.setAttribute('aria-hidden', 'true');
1782
1718
  }
@@ -1798,11 +1734,12 @@ let AttacherCore = (_class = class AttacherCore {
1798
1734
  element.removeEventListener('beforetoggle', this._onPopoverBeforeToggle);
1799
1735
  this._attachedPopoverEventsOn = null;
1800
1736
  }
1801
- _onPopoverBeforeToggle(event) {
1737
+ _onPopoverBeforeToggle(rawEvent) {
1802
1738
  if (this._isDestroyed || this._syncingPopoverHost) {
1803
1739
  return;
1804
1740
  }
1805
- const trigger = this._pendingPopoverTrigger || (event.source?.hasAttribute?.('popovertarget') ? event.source : null);
1741
+ const event = rawEvent;
1742
+ const trigger = this._pendingPopoverTrigger || (event.source?.hasAttribute?.('popovertarget') || event.source?.hasAttribute?.('interestfor') ? event.source : null);
1806
1743
  this._pendingPopoverTrigger = null;
1807
1744
  if (!trigger && this._popoverTargetEntries.size === 0) {
1808
1745
  return;
@@ -1831,14 +1768,11 @@ let AttacherCore = (_class = class AttacherCore {
1831
1768
  }
1832
1769
  _onPopoverTargetClick(event) {
1833
1770
  const trigger = event.currentTarget;
1834
- if (!trigger || this._isDestroyed) {
1771
+ if (!(trigger instanceof Element) || this._isDestroyed) {
1835
1772
  return;
1836
1773
  }
1837
1774
  const floatingEl = this._floatingElement;
1838
1775
  const actionAttr = (trigger.getAttribute('popovertargetaction') || 'toggle').toLowerCase();
1839
-
1840
- // When the browser promotes `[popover]` natively, the native invoker runs after
1841
- // click dispatch and emits `beforetoggle`, so avoid double-toggling here.
1842
1776
  if (floatingEl?.hasAttribute('popover') && typeof floatingEl.showPopover === 'function') {
1843
1777
  this._pendingPopoverTrigger = trigger;
1844
1778
  if (actionAttr !== 'hide' && this._currentTarget !== trigger) {
@@ -1867,13 +1801,14 @@ let AttacherCore = (_class = class AttacherCore {
1867
1801
  const baseArgs = this._getArgs() || EMPTY_OBJECT;
1868
1802
  const env = this._envConfig;
1869
1803
  const keyedEnv = env[this.configKey];
1870
- const showOn = normalizeTriggerList(opts.showOn === undefined ? baseArgs.showOn : opts.showOn, keyedEnv?.showOn ?? env.showOn ?? DEFAULTS.showOn);
1804
+ const showOnFallback = keyedEnv?.showOn ?? env.showOn ?? this._defaultFor('showOn') ?? null;
1805
+ const showOn = normalizeTriggerList(opts.showOn === undefined ? baseArgs.showOn : opts.showOn, showOnFallback);
1871
1806
  const useCapture = Boolean(opts.useCapture ?? baseArgs.useCapture ?? keyedEnv?.useCapture ?? env.useCapture ?? DEFAULTS.useCapture);
1872
1807
  const showOnKey = showOn.join(' ');
1873
1808
  if (entry.showOnKey === showOnKey && entry.useCapture === useCapture) {
1874
1809
  return;
1875
1810
  }
1876
- cancel(entry.updateTimer);
1811
+ cancelScheduled(entry.updateHandle);
1877
1812
  this._removeEntryShowListeners(entry);
1878
1813
  entry.showOnKey = showOnKey;
1879
1814
  entry.useCapture = useCapture;
@@ -1897,7 +1832,10 @@ let AttacherCore = (_class = class AttacherCore {
1897
1832
  const listeners = entry.showListeners;
1898
1833
  const capture = Boolean(entry.useCapture);
1899
1834
  for (const eventName of Object.keys(listeners)) {
1900
- entry.element.removeEventListener(eventName, listeners[eventName], capture);
1835
+ const listener = listeners[eventName];
1836
+ if (listener) {
1837
+ entry.element.removeEventListener(eventName, listener, capture);
1838
+ }
1901
1839
  delete listeners[eventName];
1902
1840
  }
1903
1841
  entry.showOnKey = null;
@@ -1922,41 +1860,38 @@ let AttacherCore = (_class = class AttacherCore {
1922
1860
  this._setTracked('_currentTarget', targetEl);
1923
1861
  this._syncModalContainer();
1924
1862
  syncParentAttachment(this);
1925
- this._aria.bind(this._listenerTarget, {
1926
- isTooltip: this._isTooltip,
1927
- id: this.id,
1928
- ariaRole: this.ariaRole,
1929
- isOpen: this._ariaOpen
1930
- });
1931
1863
  this._notifyRenderStateChange();
1864
+ this._syncAria();
1932
1865
  }
1933
1866
  _syncPopoverTargetListeners(popoverTargets) {
1934
1867
  const nextSet = new Set(popoverTargets);
1868
+ const useCapture = Boolean(this._opt('useCapture'));
1935
1869
  for (const [el, listener] of this._popoverTargetEntries) {
1936
1870
  if (!nextSet.has(el)) {
1937
- el.removeEventListener('click', listener, this.useCapture);
1871
+ el.removeEventListener('click', listener, useCapture);
1938
1872
  this._popoverTargetEntries.delete(el);
1939
1873
  }
1940
1874
  }
1941
1875
  for (const el of nextSet) {
1942
1876
  if (!this._popoverTargetEntries.has(el)) {
1943
- el.addEventListener('click', this._onPopoverTargetClick, this.useCapture);
1877
+ el.addEventListener('click', this._onPopoverTargetClick, useCapture);
1944
1878
  this._popoverTargetEntries.set(el, this._onPopoverTargetClick);
1945
1879
  }
1946
1880
  }
1947
1881
  }
1948
1882
  _clearPopoverTargetListeners() {
1883
+ const useCapture = Boolean(this._opt('useCapture'));
1949
1884
  for (const [el, listener] of this._popoverTargetEntries) {
1950
- el.removeEventListener('click', listener, this.useCapture);
1885
+ el.removeEventListener('click', listener, useCapture);
1951
1886
  }
1952
1887
  this._popoverTargetEntries.clear();
1953
1888
  }
1954
1889
  _syncModalContainer() {
1955
- if (this._renderInPlace || this._hasCustomFloatingElementContainer) {
1890
+ if (this._renderInPlace) {
1956
1891
  this._setTracked('_modalContainer', null);
1957
1892
  return false;
1958
1893
  }
1959
- const modalDialog = getModalDialogContainer(this._listenerTarget || this._parentElement);
1894
+ const modalDialog = getModalDialogContainer(this._listenerTarget);
1960
1895
  if (this._modalContainer !== modalDialog) {
1961
1896
  this._modalContainer = modalDialog;
1962
1897
  return true;
@@ -1967,66 +1902,142 @@ let AttacherCore = (_class = class AttacherCore {
1967
1902
  if (!isVisible) {
1968
1903
  this._cleanup?.();
1969
1904
  this._cleanup = null;
1905
+ return;
1970
1906
  }
1971
- if (!this._floatingElement) {
1907
+ this._isHidden = false;
1908
+ const el = this._floatingElement;
1909
+ if (!el) {
1972
1910
  return;
1973
1911
  }
1974
- this._floatingElement.style.display = isVisible ? 'block' : 'none';
1975
- // Prevent jank until _startShowAnimation() positions the attachment.
1976
- this._floatingElement.style.visibility = isVisible ? 'hidden' : '';
1912
+ const showDuration = parseInt(String(this._opt('showDuration') ?? 0), 10) || 0;
1913
+ const initialPlacement = this._opt('placement') || DEFAULTS.placement;
1914
+ el.removeAttribute('data-closing');
1915
+ if (!el.hasAttribute('data-placement')) {
1916
+ el.setAttribute('data-placement', initialPlacement);
1917
+ }
1918
+ if (!el.hasAttribute('x-placement')) {
1919
+ el.setAttribute('x-placement', initialPlacement);
1920
+ }
1921
+ el.style.setProperty('--ember-attacher-transition-duration', `${showDuration}ms`);
1922
+ if (!el.classList.contains('ember-attacher')) {
1923
+ el.style.display = 'block';
1924
+ } else if (el.style.display === 'none') {
1925
+ el.style.display = '';
1926
+ }
1927
+ if (!el.style.left) {
1928
+ // Avoid a 0,0 flash for the microtask before computePosition() resolves.
1929
+ el.style.visibility = 'hidden';
1930
+ } else if (!el.hasAttribute('data-reference-hidden') && !el.hasAttribute('data-escaped')) {
1931
+ el.style.visibility = '';
1932
+ }
1933
+ el.setAttribute('data-open', '');
1934
+ el.setAttribute('aria-hidden', 'false');
1977
1935
  this._syncingPopoverHost = true;
1978
1936
  try {
1979
1937
  if (!this._skipNativePopoverToggle) {
1980
- if (isVisible) {
1981
- showPopoverHost(this._floatingElement);
1982
- } else {
1983
- hidePopoverHost(this._floatingElement);
1984
- }
1938
+ showPopoverHost(el);
1985
1939
  }
1986
1940
  } finally {
1987
1941
  this._syncingPopoverHost = false;
1988
1942
  }
1989
- this._arg('onChange')?.(isVisible);
1943
+ this._arg('onChange')?.(true);
1990
1944
  }
1991
- _setIsVisibleAfterDelay(isVisible, delay) {
1992
- if (!this._floatingElement) {
1993
- this._scheduleAnimationFrame(() => {
1994
- if (this._isDestroyed || (isVisible ? this._isHiding : !this._isHiding)) {
1995
- return;
1996
- }
1997
- this._setIsVisibleAfterDelay(isVisible, delay);
1998
- });
1945
+ _waitForExitAnimations(element, hideDuration, onDone) {
1946
+ if (hideDuration <= 0 || !element) {
1947
+ onDone();
1999
1948
  return;
2000
1949
  }
2001
- if (delay) {
2002
- this._delayedVisibilityToggle = later(this, () => {
2003
- if (this._isDestroyed || (isVisible ? this._isHiding : !this._isHiding)) {
2004
- return;
1950
+
1951
+ // Flush styles so CSS transitions triggered by [data-closing] are registered
1952
+ // before querying WAAPI animations on the same turn.
1953
+ if (typeof getComputedStyle === 'function') {
1954
+ void getComputedStyle(element).opacity;
1955
+ }
1956
+ const animations = typeof element.getAnimations === 'function' ? element.getAnimations({
1957
+ subtree: true
1958
+ }) : [];
1959
+ const generation = this._closeGeneration;
1960
+ const token = attacherWaiter.beginAsync();
1961
+ let done = false;
1962
+ let timeoutId = null;
1963
+ const finish = () => {
1964
+ if (done) {
1965
+ return;
1966
+ }
1967
+ done = true;
1968
+ if (timeoutId !== null) {
1969
+ clearTimeout(timeoutId);
1970
+ timeoutId = null;
1971
+ }
1972
+ attacherWaiter.endAsync(token);
1973
+ this._activeCloseCancel = null;
1974
+ if (!this._isDestroyed && this._closeGeneration === generation && this._isHiding) {
1975
+ onDone();
1976
+ }
1977
+ };
1978
+ this._activeCloseCancel = () => {
1979
+ if (!done) {
1980
+ done = true;
1981
+ if (timeoutId !== null) {
1982
+ clearTimeout(timeoutId);
1983
+ timeoutId = null;
2005
1984
  }
2006
- this._scheduleAnimationFrame(() => {
2007
- if (this._isDestroyed || (isVisible ? this._isHiding : !this._isHiding)) {
2008
- return;
2009
- }
2010
- this._applyVisibility(isVisible);
2011
- });
2012
- }, delay);
1985
+ attacherWaiter.endAsync(token);
1986
+ this._activeCloseCancel = null;
1987
+ }
1988
+ };
1989
+ if (animations.length > 0) {
1990
+ timeoutId = setTimeout(finish, hideDuration + 250);
1991
+ Promise.allSettled(animations.map(anim => anim.finished)).then(finish);
2013
1992
  } else {
2014
- this._applyVisibility(isVisible);
1993
+ // Fall back to hideDuration timer when no WAAPI animations are reported
1994
+ // (older engines, headless custom markup without CSS transitions, etc.)
1995
+ // so exit never silently short-circuits to an instant hide.
1996
+ timeoutId = setTimeout(finish, hideDuration);
1997
+ }
1998
+ }
1999
+ _finishHide() {
2000
+ const el = this._floatingElement;
2001
+ if (el) {
2002
+ el.style.setProperty('--ember-attacher-transition-duration', '0ms');
2003
+ el.removeAttribute('data-closing');
2004
+ el.removeAttribute('data-open');
2005
+ if (!el.classList.contains('ember-attacher')) {
2006
+ el.style.display = 'none';
2007
+ } else {
2008
+ el.style.display = '';
2009
+ }
2010
+ el.style.visibility = '';
2011
+ this._syncingPopoverHost = true;
2012
+ try {
2013
+ if (!this._skipNativePopoverToggle) {
2014
+ hidePopoverHost(el);
2015
+ }
2016
+ } finally {
2017
+ this._syncingPopoverHost = false;
2018
+ }
2015
2019
  }
2020
+ this._arg('onChange')?.(false);
2021
+ }
2022
+ _cancelCloseAnimation() {
2023
+ this._closeGeneration += 1;
2024
+ this._activeCloseCancel?.();
2025
+ this._activeCloseCancel = null;
2016
2026
  }
2017
2027
  show(target = undefined, data = undefined) {
2018
2028
  if (typeof Event !== 'undefined' && target instanceof Event) {
2019
2029
  target = undefined;
2020
2030
  }
2021
2031
  if (target !== undefined) {
2022
- if (this._registeredEntries.has(target)) {
2023
- const entry = this._registeredEntries.get(target);
2032
+ const targetEl = target;
2033
+ const entry = isElementTarget(targetEl) ? this._registeredEntries.get(targetEl) : undefined;
2034
+ if (entry) {
2024
2035
  if (data !== undefined) {
2025
2036
  entry.data = data;
2026
2037
  }
2027
2038
  this._activateRegisteredEntry(entry);
2028
- } else if (isElementTarget(target) || isVirtualReference(target)) {
2029
- this._switchTargetFromEvent(target, data, this._activeEntryOptions);
2039
+ } else if (isElementTarget(targetEl) || isVirtualReference(targetEl)) {
2040
+ this._switchTargetFromEvent(targetEl, data, this._activeEntryOptions);
2030
2041
  } else {
2031
2042
  runInDebug(() => {
2032
2043
  warn('[ember-attacher] Ignoring non-Target argument passed to show().', false, {
@@ -2034,10 +2045,13 @@ let AttacherCore = (_class = class AttacherCore {
2034
2045
  });
2035
2046
  });
2036
2047
  }
2048
+ } else if (data !== undefined) {
2049
+ this._setTracked('_data', data);
2050
+ this._notifyRenderStateChange();
2037
2051
  }
2038
2052
  this._show();
2039
2053
  if (!this._isDestroyed) {
2040
- next(this, () => {
2054
+ scheduleMicrotask(() => {
2041
2055
  if (!this._isDestroyed && !this._isHidden) {
2042
2056
  this._addListenersForHideEvents();
2043
2057
  }
@@ -2058,13 +2072,14 @@ let AttacherCore = (_class = class AttacherCore {
2058
2072
  this._updatePosition();
2059
2073
  }
2060
2074
  setTarget(target, data = undefined) {
2061
- cancel(this._setReferenceTimer);
2075
+ this._usedSetTarget = true;
2076
+ cancelScheduled(this._setTargetHandle);
2062
2077
  if (data !== undefined) {
2063
2078
  this._pendingRegisteredData = data;
2064
2079
  this._hasPendingData = true;
2065
2080
  }
2066
- this._setReferenceTimer = schedule('actions', () => {
2067
- this._setReferenceTimer = null;
2081
+ this._setTargetHandle = scheduleMicrotask(() => {
2082
+ this._setTargetHandle = null;
2068
2083
  if (this._isDestroyed) {
2069
2084
  return;
2070
2085
  }
@@ -2083,13 +2098,24 @@ let AttacherCore = (_class = class AttacherCore {
2083
2098
  this._initializeAttacher();
2084
2099
  });
2085
2100
  }
2086
- setReference(target) {
2087
- this._deprecateOnce('ember-attacher.api.set-reference', '[ember-attacher] The yielded `setReference` method is deprecated and will be removed in ember-attacher 5.0.0. Use `setTarget` instead.');
2088
- this.setTarget(target);
2101
+ _warnRemoved4xArgs(args) {
2102
+ if (!args) {
2103
+ return;
2104
+ }
2105
+ runInDebug(() => {
2106
+ for (const argName of Object.keys(REMOVED_4X_ARGS)) {
2107
+ if (args[argName] !== undefined && !this._warnedRemovedArgs.has(argName)) {
2108
+ this._warnedRemovedArgs.add(argName);
2109
+ warn(`[ember-attacher] @${argName} was removed in 5.0.0 and is ignored. ${REMOVED_4X_ARGS[argName]}`, false, {
2110
+ id: `ember-attacher.removed-arg.${argName}`
2111
+ });
2112
+ }
2113
+ }
2114
+ });
2089
2115
  }
2090
2116
  _ensureArgumentsAreValid() {
2091
2117
  runInDebug(() => {
2092
- if (this.useCapture !== this._lastUseCaptureArgumentValue) {
2118
+ if (Boolean(this._opt('useCapture')) !== this._lastUseCaptureArgumentValue) {
2093
2119
  warn('The value of the useCapture argument was mutated', {
2094
2120
  id: 'ember-attacher.use-capture-mutated'
2095
2121
  });
@@ -2097,91 +2123,98 @@ let AttacherCore = (_class = class AttacherCore {
2097
2123
  });
2098
2124
  }
2099
2125
  _syncAria() {
2126
+ const entryText = this._data != null && this._data !== '' ? String(this._data) : null;
2100
2127
  this._aria.bind(this._listenerTarget, {
2101
2128
  isTooltip: this._isTooltip,
2102
2129
  id: this.id,
2103
2130
  ariaRole: this.ariaRole,
2104
- isOpen: this._ariaOpen
2131
+ isOpen: this._ariaOpen,
2132
+ attachmentEl: this._floatingElement,
2133
+ tooltipText: entryText
2105
2134
  });
2106
2135
  }
2107
2136
  _initializeAttacher() {
2108
2137
  if (this._isDestroyed) {
2109
2138
  return;
2110
2139
  }
2111
- this._checkDeprecatedArgs(this._getArgs());
2112
- this._removeLegacyShowEventListeners();
2140
+ this._removeTargetShowEventListeners();
2113
2141
  this._removeHideEventListeners();
2114
2142
  const explicitId = this._arg('id') || this._elementId;
2115
- const popoverTargets = explicitId ? findPopoverTargetElements(explicitId) : [];
2143
+ const {
2144
+ popoverTargets,
2145
+ allTargets
2146
+ } = explicitId ? findTriggerTargetElements(explicitId) : {
2147
+ popoverTargets: [],
2148
+ allTargets: []
2149
+ };
2116
2150
  this._syncPopoverTargetListeners(popoverTargets);
2117
2151
  const target = resolveAttachmentTarget({
2118
- explicitTarget: this.explicitTarget,
2152
+ target: this.targetArg,
2119
2153
  registeredTarget: this._registeredTarget,
2120
- popoverTargets,
2121
- parentElement: this._parentElement,
2122
- allowParentFallback: this._allowParentFallback
2154
+ triggerTargets: allTargets
2123
2155
  });
2124
- const usedParentFallback = this._allowParentFallback && this.explicitTarget == null && this._registeredTarget == null && popoverTargets.length === 0 && target != null && target === this._parentElement;
2125
- if (usedParentFallback) {
2126
- this._deprecateOnce('ember-attacher.implicit-parent-target', '[ember-attacher] Attaching implicitly to the parent DOM element is deprecated and will be removed in ember-attacher 5.0.0. Bind an explicit Target with {{tooltip}}, @target, {{a.target}}, <:target>, or [popovertarget].');
2127
- }
2128
2156
  this._listenerTarget = getListenerTarget(target);
2129
2157
  this._setTracked('_currentTarget', target);
2130
- if (target && this._registeredEntries.has(target)) {
2158
+ if (isElementTarget(target) && this._registeredEntries.has(target)) {
2131
2159
  const entry = this._registeredEntries.get(target);
2132
2160
  this._activeEntryOptions = entry.options || null;
2133
2161
  this._setTracked('_data', entry.data);
2134
2162
  }
2135
2163
  this._syncModalContainer();
2136
2164
  syncParentAttachment(this);
2137
- this._addLegacyShowListenersIfUnregistered();
2165
+ this._addShowListenersIfUnregistered();
2138
2166
  this._notifyRenderStateChange();
2139
- const shouldBeOpen = !this._isHiding && (!this._isHidden || this._isShown) || Boolean(this.controlledIsShown);
2140
- if (shouldBeOpen) {
2167
+ const shouldBeOpen = !this._isHiding && (!this._isHidden || this._isShown) || Boolean(this._opt('isShown'));
2168
+ if (shouldBeOpen && target) {
2141
2169
  this._ariaOpen = true;
2142
2170
  this._syncAria();
2143
2171
  this._addListenersForHideEvents();
2144
2172
  if (!this._isShown) {
2145
2173
  this._show();
2146
- } else if (this._floatingElement && this._floatingElement.style.display !== 'block') {
2147
- this._cancelAnimation();
2148
- this._applyVisibility(true);
2149
- this._startShowAnimation();
2150
2174
  } else {
2175
+ this._applyVisibility(true);
2151
2176
  this._update();
2152
2177
  }
2153
2178
  } else {
2154
2179
  this._ariaOpen = false;
2155
2180
  this._syncAria();
2156
2181
  }
2157
- this._arg('onInitializeAttacher')?.(this._currentTarget, this.id);
2158
2182
  }
2159
- _addLegacyShowListenersIfUnregistered() {
2183
+ _addShowListenersIfUnregistered() {
2160
2184
  const target = this._listenerTarget;
2161
2185
  if (!target || this._registeredEntries.has(target) || this._popoverTargetEntries.has(target)) {
2162
2186
  return;
2163
2187
  }
2188
+ const useCapture = Boolean(this._opt('useCapture'));
2164
2189
  this._showOn.forEach(event => {
2165
- this._legacyShowListenersOnTargetByEvent[event] = this._showAfterDelay;
2166
- target.addEventListener(event, this._showAfterDelay, this.useCapture);
2190
+ this._targetShowListenersByEvent[event] = this._showAfterDelay;
2191
+ target.addEventListener(event, this._showAfterDelay, useCapture);
2167
2192
  });
2168
2193
  }
2169
- _removeLegacyShowEventListeners() {
2194
+ _removeTargetShowEventListeners() {
2170
2195
  const target = this._listenerTarget;
2171
2196
  if (!target) {
2172
2197
  return;
2173
2198
  }
2174
- Object.keys(this._legacyShowListenersOnTargetByEvent).forEach(event => {
2175
- target.removeEventListener(event, this._legacyShowListenersOnTargetByEvent[event], this.useCapture);
2176
- delete this._legacyShowListenersOnTargetByEvent[event];
2199
+ const useCapture = Boolean(this._opt('useCapture'));
2200
+ Object.keys(this._targetShowListenersByEvent).forEach(event => {
2201
+ const listener = this._targetShowListenersByEvent[event];
2202
+ if (listener) {
2203
+ target.removeEventListener(event, listener, useCapture);
2204
+ }
2205
+ delete this._targetShowListenersByEvent[event];
2177
2206
  });
2178
2207
  }
2179
2208
  _removeHideEventListeners({
2180
2209
  restoreClickShow = false
2181
2210
  } = {}) {
2211
+ const useCapture = Boolean(this._opt('useCapture'));
2182
2212
  this._mouseLeaveOrigin = null;
2183
2213
  Object.keys(this._hideListenersOnDocumentByEvent).forEach(eventType => {
2184
- document.removeEventListener(eventType, this._hideListenersOnDocumentByEvent[eventType], this.useCapture);
2214
+ const listener = this._hideListenersOnDocumentByEvent[eventType];
2215
+ if (listener) {
2216
+ document.removeEventListener(eventType, listener, useCapture);
2217
+ }
2185
2218
  delete this._hideListenersOnDocumentByEvent[eventType];
2186
2219
  });
2187
2220
  const target = this._listenerTarget;
@@ -2191,23 +2224,26 @@ let AttacherCore = (_class = class AttacherCore {
2191
2224
  if (restoreClickShow && this._showOn.includes('click') && !this._registeredEntries.has(target) && !this._popoverTargetEntries.has(target)) {
2192
2225
  const hideOnClickListener = this._hideListenersOnTargetByEvent.click;
2193
2226
  if (hideOnClickListener) {
2194
- target.removeEventListener('click', hideOnClickListener, this.useCapture);
2227
+ target.removeEventListener('click', hideOnClickListener, useCapture);
2195
2228
  delete this._hideListenersOnTargetByEvent.click;
2196
2229
  }
2197
- this._legacyShowListenersOnTargetByEvent.click = this._showAfterDelay;
2198
- target.addEventListener('click', this._showAfterDelay, this.useCapture);
2230
+ this._targetShowListenersByEvent.click = this._showAfterDelay;
2231
+ target.addEventListener('click', this._showAfterDelay, useCapture);
2199
2232
  }
2200
2233
  Object.keys(this._hideListenersOnTargetByEvent).forEach(event => {
2201
- target.removeEventListener(event, this._hideListenersOnTargetByEvent[event], this.useCapture);
2234
+ const listener = this._hideListenersOnTargetByEvent[event];
2235
+ if (listener) {
2236
+ target.removeEventListener(event, listener, useCapture);
2237
+ }
2202
2238
  delete this._hideListenersOnTargetByEvent[event];
2203
2239
  });
2204
2240
  }
2205
2241
  _syncIsShown() {
2206
- const isShown = this.controlledIsShown;
2242
+ const isShown = this._opt('isShown');
2207
2243
  if (isShown === true && this._isHidden) {
2208
2244
  this._show();
2209
- next(this, () => {
2210
- if (!this._isDestroyed) {
2245
+ scheduleMicrotask(() => {
2246
+ if (!this._isDestroyed && !this._isHidden) {
2211
2247
  this._addListenersForHideEvents();
2212
2248
  }
2213
2249
  });
@@ -2219,20 +2255,21 @@ let AttacherCore = (_class = class AttacherCore {
2219
2255
  if (this._suppressFocusShow && (event?.type === 'focus' || event?.type === 'focusin')) {
2220
2256
  return;
2221
2257
  }
2222
- cancel(this._delayedVisibilityToggle);
2223
- this._cancelAnimation();
2258
+ cancelScheduled(this._delayedVisibilityToggle);
2259
+ this._cancelCloseAnimation();
2224
2260
  this._isHiding = false;
2225
2261
  this._setTracked('_mustRender', true);
2226
2262
  syncParentAttachment(this);
2227
2263
  this._addListenersForHideEvents();
2228
- const parsedShowDelay = parseInt(this.showDelay, 10) || 0;
2264
+ const parsedShowDelay = parseInt(String(this._opt('showDelay') ?? 0), 10) || 0;
2229
2265
  const isWarm = Boolean(this._isTooltip && peekDelayGroup(this._delayGroupOwner)?.isWarmFor());
2230
2266
  const effectiveDelay = isWarm ? 0 : parsedShowDelay;
2231
- this._delayedVisibilityToggle = debounce(this, this._show, effectiveDelay, !effectiveDelay);
2267
+ this._delayedVisibilityToggle = debounceTimeout(this._delayedVisibilityToggle, this._show, effectiveDelay, !effectiveDelay);
2232
2268
  }
2233
2269
  _show() {
2234
- cancel(this._delayedVisibilityToggle);
2235
- this._cancelAnimation();
2270
+ cancelScheduled(this._delayedVisibilityToggle);
2271
+ this._delayedVisibilityToggle = null;
2272
+ this._cancelCloseAnimation();
2236
2273
  if (!this._currentTarget) {
2237
2274
  return;
2238
2275
  }
@@ -2242,67 +2279,27 @@ let AttacherCore = (_class = class AttacherCore {
2242
2279
  this._setTracked('_mustRender', true);
2243
2280
  this._setTracked('_isShown', true);
2244
2281
  this._ariaOpen = true;
2245
- this._aria.setOpen(true);
2246
- if (this._isTooltip && this.controlledIsShown !== true) {
2282
+ if (this._isTooltip && this._opt('isShown') !== true) {
2247
2283
  getDelayGroup(this._delayGroupOwner)?.open(this);
2248
2284
  }
2249
- const modalContainerChanged = this._syncModalContainer();
2285
+ this._syncModalContainer();
2250
2286
  syncParentAttachment(this);
2251
2287
  this._notifyRenderStateChange();
2252
- if (modalContainerChanged) {
2253
- next(this, () => {
2254
- if (!this._isDestroyed && !this._isHiding && this._currentTarget) {
2255
- this._setIsVisibleAfterDelay(true, 0);
2256
- this._startShowAnimation();
2257
- }
2258
- });
2259
- return;
2260
- }
2261
- this._setIsVisibleAfterDelay(true, 0);
2262
- this._startShowAnimation();
2263
- }
2264
- _startShowAnimation() {
2265
- this._scheduleAnimationFrame(() => {
2266
- if (this._isDestroyed || !this._currentTarget || this._isHiding) {
2267
- return;
2268
- }
2269
- const floatingElement = this._floatingElement;
2270
- if (!floatingElement || floatingElement.style.display === 'none') {
2271
- this._startShowAnimation();
2272
- return;
2273
- }
2274
- this._update();
2275
- this._scheduleAnimationFrame(() => {
2276
- if (this._isDestroyed || !this._currentTarget || this._isHiding) {
2277
- return;
2278
- }
2279
- run(() => {
2280
- if (this._isDestroyed || !this._currentTarget || this._isHiding) {
2281
- return;
2282
- }
2283
- if (!floatingElement.hasAttribute('data-reference-hidden') && !floatingElement.hasAttribute('data-escaped')) {
2284
- floatingElement.style.visibility = '';
2285
- }
2286
- const showDuration = parseInt(this.showDuration, 10) || 0;
2287
- floatingElement.style.setProperty('--ember-attacher-transition-duration', `${showDuration}ms`);
2288
- this._setTracked('_isStartingAnimation', true);
2289
- this._notifyRenderStateChange();
2290
- floatingElement.setAttribute('aria-hidden', 'false');
2291
- });
2292
- this._isHidden = false;
2293
- });
2294
- });
2288
+ this._applyVisibility(true);
2289
+ this._syncAria();
2290
+ this._update();
2295
2291
  }
2296
2292
  _hideAfterDelay() {
2297
- cancel(this._delayedVisibilityToggle);
2293
+ cancelScheduled(this._delayedVisibilityToggle);
2298
2294
  this._isHiding = true;
2299
- const hideDelay = parseInt(this.hideDelay, 10) || 0;
2300
- this._delayedVisibilityToggle = debounce(this, this._hide, hideDelay, !hideDelay);
2295
+ const hideDelay = parseInt(String(this._opt('hideDelay') ?? 0), 10) || 0;
2296
+ this._delayedVisibilityToggle = debounceTimeout(this._delayedVisibilityToggle, this._hide, hideDelay, !hideDelay);
2301
2297
  }
2302
2298
  _hide() {
2303
2299
  const wasShown = this._isShown || !this._isHidden;
2304
- cancel(this._delayedVisibilityToggle);
2305
- this._cancelAnimation();
2300
+ cancelScheduled(this._delayedVisibilityToggle);
2301
+ this._delayedVisibilityToggle = null;
2302
+ this._cancelCloseAnimation();
2306
2303
  this._isHiding = true;
2307
2304
  this._positioningSuspended = true;
2308
2305
  this._ariaOpen = false;
@@ -2318,104 +2315,109 @@ let AttacherCore = (_class = class AttacherCore {
2318
2315
  this._removeHideEventListeners({
2319
2316
  restoreClickShow: true
2320
2317
  });
2321
- if (!this._floatingElement) {
2322
- this._setTracked('_isStartingAnimation', false);
2323
- this._aria.setOpen(false);
2324
- this._isHidden = true;
2325
- return;
2318
+ if (this._restoreFocusOnHide) {
2319
+ this._restoreFocusOnHide = false;
2320
+ this._suppressFocusShow = true;
2321
+ try {
2322
+ restoreFocusOnEscape(this._listenerTarget, this._floatingElement);
2323
+ } finally {
2324
+ this._suppressFocusShow = false;
2325
+ }
2326
2326
  }
2327
- this._scheduleAnimationFrame(() => {
2328
- if (this._isDestroyed || !this._isHiding) {
2329
- return;
2327
+ this._aria.setOpen(false);
2328
+ this._isHidden = true;
2329
+ this._notifyRenderStateChange();
2330
+ const floatingElement = this._floatingElement;
2331
+ if (!floatingElement) {
2332
+ if (wasShown) {
2333
+ this._arg('onChange')?.(false);
2330
2334
  }
2331
- const hideDuration = parseInt(this.hideDuration, 10) || 0;
2332
- run(() => {
2333
- if (this._isDestroyed || !this._isHiding) {
2334
- return;
2335
- }
2336
- if (this._restoreFocusOnHide) {
2337
- this._restoreFocusOnHide = false;
2338
- this._suppressFocusShow = true;
2339
- try {
2340
- restoreFocusOnEscape(this._listenerTarget, this._floatingElement);
2341
- } finally {
2342
- this._suppressFocusShow = false;
2343
- }
2344
- }
2345
- if (this._floatingElement) {
2346
- this._floatingElement.style.setProperty('--ember-attacher-transition-duration', `${hideDuration}ms`);
2347
- this._floatingElement.setAttribute('aria-hidden', 'true');
2348
- }
2349
- this._setTracked('_isStartingAnimation', false);
2350
- this._notifyRenderStateChange();
2351
- this._aria.setOpen(false);
2352
- this._setIsVisibleAfterDelay(false, hideDuration);
2353
- });
2354
- this._isHidden = true;
2335
+ return;
2336
+ }
2337
+ const hideDuration = parseInt(String(this._opt('hideDuration') ?? 0), 10) || 0;
2338
+ floatingElement.setAttribute('aria-hidden', 'true');
2339
+ if (hideDuration <= 0) {
2340
+ this._finishHide();
2341
+ return;
2342
+ }
2343
+ floatingElement.style.setProperty('--ember-attacher-transition-duration', `${hideDuration}ms`);
2344
+ floatingElement.setAttribute('data-closing', '');
2345
+ this._waitForExitAnimations(floatingElement, hideDuration, () => {
2346
+ this._finishHide();
2355
2347
  });
2356
2348
  }
2357
2349
  _addListenersForHideEvents() {
2358
2350
  const hideOn = this._hideOn;
2359
2351
  const target = this._listenerTarget;
2352
+ const useCapture = Boolean(this._opt('useCapture'));
2360
2353
  if (!this._currentTarget || this._isDestroyed) {
2361
2354
  return;
2362
2355
  }
2363
2356
  const entry = target ? this._registeredEntries.get(target) : null;
2364
2357
  const entryHandlesClickToggle = Boolean(entry && entry.showOnKey?.split(' ').includes('click')) || Boolean(target && this._popoverTargetEntries.has(target));
2365
2358
  if (target && hideOn.includes('click') && !entryHandlesClickToggle) {
2366
- const showOnClickListener = this._legacyShowListenersOnTargetByEvent.click;
2359
+ const showOnClickListener = this._targetShowListenersByEvent.click;
2367
2360
  if (showOnClickListener) {
2368
- target.removeEventListener('click', showOnClickListener, this.useCapture);
2369
- delete this._legacyShowListenersOnTargetByEvent.click;
2361
+ target.removeEventListener('click', showOnClickListener, useCapture);
2362
+ delete this._targetShowListenersByEvent.click;
2370
2363
  }
2371
2364
  this._hideListenersOnTargetByEvent.click = this._hideAfterDelay;
2372
- target.addEventListener('click', this._hideAfterDelay, this.useCapture);
2365
+ target.addEventListener('click', this._hideAfterDelay, useCapture);
2373
2366
  }
2374
2367
  if (hideOn.includes('clickout') && !this._hideListenersOnDocumentByEvent.click && !this._hideListenersOnDocumentByEvent.touchend) {
2375
- const clickoutEvent = 'ontouchstart' in window ? 'touchend' : 'click';
2368
+ const clickoutEvent = typeof window !== 'undefined' && 'ontouchstart' in window ? 'touchend' : 'click';
2376
2369
  this._hideListenersOnDocumentByEvent[clickoutEvent] = this._hideOnClickOut;
2377
- document.addEventListener(clickoutEvent, this._hideOnClickOut, this.useCapture);
2370
+ document.addEventListener(clickoutEvent, this._hideOnClickOut, useCapture);
2378
2371
  }
2379
2372
  if (hideOn.includes('escapekey') && !this._hideListenersOnDocumentByEvent.keydown) {
2380
2373
  this._hideListenersOnDocumentByEvent.keydown = this._hideOnEscapeKey;
2381
- document.addEventListener('keydown', this._hideOnEscapeKey, this.useCapture);
2374
+ document.addEventListener('keydown', this._hideOnEscapeKey, useCapture);
2382
2375
  }
2383
2376
  if (target && hideOn.includes('mouseleave') && !this._hideListenersOnTargetByEvent.mouseleave) {
2384
2377
  this._hideListenersOnTargetByEvent.mouseleave = this._hideOnMouseLeaveTarget;
2385
- target.addEventListener('mouseleave', this._hideOnMouseLeaveTarget, this.useCapture);
2378
+ target.addEventListener('mouseleave', this._hideOnMouseLeaveTarget, useCapture);
2386
2379
  }
2387
2380
  if (target) {
2388
2381
  ['blur', 'focusout'].forEach(eventType => {
2389
2382
  if (hideOn.includes(eventType) && !this._hideListenersOnTargetByEvent[eventType]) {
2390
2383
  this._hideListenersOnTargetByEvent[eventType] = this._hideOnLostFocus;
2391
- target.addEventListener(eventType, this._hideOnLostFocus, this.useCapture);
2384
+ target.addEventListener(eventType, this._hideOnLostFocus, useCapture);
2392
2385
  }
2393
2386
  });
2394
2387
  }
2395
2388
  }
2396
- _hideOnMouseLeaveTarget(event) {
2397
- if (this.interactive) {
2389
+ _hideOnMouseLeaveTarget(rawEvent) {
2390
+ const event = rawEvent;
2391
+ if (this._isHidden && !this._isShown) {
2392
+ this._hideAfterDelay();
2393
+ return;
2394
+ }
2395
+ if (this._opt('interactive')) {
2398
2396
  this._mouseLeaveOrigin = event ? {
2399
2397
  x: event.clientX,
2400
2398
  y: event.clientY
2401
2399
  } : null;
2402
2400
  if (!this._hideListenersOnDocumentByEvent.mousemove) {
2401
+ const useCapture = Boolean(this._opt('useCapture'));
2403
2402
  this._hideListenersOnDocumentByEvent.mousemove = this._hideIfMouseOutsideTargetOrAttachment;
2404
- document.addEventListener('mousemove', this._hideIfMouseOutsideTargetOrAttachment, this.useCapture);
2403
+ document.addEventListener('mousemove', this._hideIfMouseOutsideTargetOrAttachment, useCapture);
2405
2404
  }
2406
2405
  } else {
2407
2406
  this._hideAfterDelay();
2408
2407
  }
2409
2408
  }
2410
- _hideIfMouseOutsideTargetOrAttachment(event) {
2409
+ _hideIfMouseOutsideTargetOrAttachment(rawEvent) {
2410
+ const event = rawEvent;
2411
2411
  const target = this._listenerTarget;
2412
2412
  if (!target) {
2413
2413
  return;
2414
2414
  }
2415
- if (!target.contains(event.target) && !descendantAttachmentContainsEvent(this, event) && !isCursorInSafePolygon(event, this._mouseLeaveOrigin, this._currentTarget, this._floatingElement) && this._floatingElement && !this._floatingElement.contains(event.target)) {
2415
+ const eventTarget = event.target instanceof Node ? event.target : null;
2416
+ if (!target.contains(eventTarget) && !descendantAttachmentContainsEvent(this, event) && !isCursorInSafePolygon(event, this._mouseLeaveOrigin, this._currentTarget, this._floatingElement) && this._floatingElement && !this._floatingElement.contains(eventTarget)) {
2417
+ const useCapture = Boolean(this._opt('useCapture'));
2416
2418
  this._mouseLeaveOrigin = null;
2417
2419
  delete this._hideListenersOnDocumentByEvent.mousemove;
2418
- document.removeEventListener('mousemove', this._hideIfMouseOutsideTargetOrAttachment, this.useCapture);
2420
+ document.removeEventListener('mousemove', this._hideIfMouseOutsideTargetOrAttachment, useCapture);
2419
2421
  this._hideAfterDelay();
2420
2422
  }
2421
2423
  }
@@ -2424,17 +2426,19 @@ let AttacherCore = (_class = class AttacherCore {
2424
2426
  if (elementContainsEvent(target, event) || descendantAttachmentContainsEvent(this, event)) {
2425
2427
  return;
2426
2428
  }
2427
- if (!this.interactive || !elementContainsEvent(this._floatingElement, event)) {
2429
+ if (!this._opt('interactive') || !elementContainsEvent(this._floatingElement, event)) {
2428
2430
  this._hideAfterDelay();
2429
2431
  }
2430
2432
  }
2431
- _hideOnEscapeKey(event) {
2433
+ _hideOnEscapeKey(rawEvent) {
2434
+ const event = rawEvent;
2432
2435
  if ((event.key === 'Escape' || event.keyCode === 27) && shouldHandleEscapeKey(this, event)) {
2433
2436
  this._restoreFocusOnHide = !this._isTooltip;
2434
- return this._hideAfterDelay();
2437
+ this._hideAfterDelay();
2435
2438
  }
2436
2439
  }
2437
- _hideOnLostFocus(event) {
2440
+ _hideOnLostFocus(rawEvent) {
2441
+ const event = rawEvent;
2438
2442
  if (event.relatedTarget === null) {
2439
2443
  this._hideAfterDelay();
2440
2444
  return;
@@ -2443,10 +2447,11 @@ let AttacherCore = (_class = class AttacherCore {
2443
2447
  if (!target) {
2444
2448
  return;
2445
2449
  }
2446
- if (target.contains(event.relatedTarget) || descendantAttachmentContainsNode(this, event.relatedTarget)) {
2450
+ const relatedNode = event.relatedTarget instanceof Node ? event.relatedTarget : null;
2451
+ if (target.contains(relatedNode) || descendantAttachmentContainsNode(this, relatedNode)) {
2447
2452
  return;
2448
2453
  }
2449
- if (!this.interactive || !this._floatingElement?.contains(event.relatedTarget)) {
2454
+ if (!this._opt('interactive') || !this._floatingElement?.contains(relatedNode)) {
2450
2455
  this._hideAfterDelay();
2451
2456
  }
2452
2457
  }
@@ -2456,8 +2461,9 @@ let AttacherCore = (_class = class AttacherCore {
2456
2461
  if (this._isDestroyed || this._positioningSuspended || !this._currentTarget || !this._floatingElement || !isTargetConnected(this._currentTarget) || !this._floatingElement.isConnected) {
2457
2462
  return;
2458
2463
  }
2459
- if (this.autoUpdate) {
2460
- this._cleanup = autoUpdate(this._currentTarget, this._floatingElement, this._updatePosition, typeof this.autoUpdate === 'object' && this.autoUpdate !== null ? this.autoUpdate : undefined);
2464
+ const autoUpdateOpt = this._opt('autoUpdate');
2465
+ if (autoUpdateOpt) {
2466
+ this._cleanup = autoUpdate(this._currentTarget, this._floatingElement, this._updatePosition, typeof autoUpdateOpt === 'object' && autoUpdateOpt !== null ? autoUpdateOpt : undefined);
2461
2467
  } else {
2462
2468
  this._updatePosition();
2463
2469
  }
@@ -2471,12 +2477,11 @@ let AttacherCore = (_class = class AttacherCore {
2471
2477
  this._cleanup = null;
2472
2478
  return;
2473
2479
  }
2474
- const strategy = this.strategy;
2475
- const computePositionToken = animationTestWaiter.beginAsync();
2480
+ const strategy = this._opt('strategy') || DEFAULTS.strategy;
2481
+ const computePositionToken = attacherWaiter.beginAsync();
2476
2482
  computePosition(this._currentTarget, this._floatingElement, {
2477
- ...this.floatingUiOptions,
2478
2483
  middleware: this._middleware,
2479
- placement: this.placement,
2484
+ placement: this._opt('placement'),
2480
2485
  strategy
2481
2486
  }).then(({
2482
2487
  x,
@@ -2485,7 +2490,7 @@ let AttacherCore = (_class = class AttacherCore {
2485
2490
  strategy: computedStrategy,
2486
2491
  middlewareData
2487
2492
  }) => {
2488
- animationTestWaiter.endAsync(computePositionToken);
2493
+ attacherWaiter.endAsync(computePositionToken);
2489
2494
  if (this._isDestroyed || !this._floatingElement || !this._floatingElement.isConnected) {
2490
2495
  return;
2491
2496
  }
@@ -2502,7 +2507,7 @@ let AttacherCore = (_class = class AttacherCore {
2502
2507
  this._middlewareData = middlewareData;
2503
2508
  }
2504
2509
  }).catch(error => {
2505
- animationTestWaiter.endAsync(computePositionToken);
2510
+ attacherWaiter.endAsync(computePositionToken);
2506
2511
  if (!this._isDestroyed) {
2507
2512
  warn(`[ember-attacher] Positioning error: ${error?.message ?? error}`, {
2508
2513
  id: 'ember-attacher.positioning-error'
@@ -2510,31 +2515,6 @@ let AttacherCore = (_class = class AttacherCore {
2510
2515
  }
2511
2516
  });
2512
2517
  }
2513
- _scheduleAnimationFrame(callback) {
2514
- if (typeof requestAnimationFrame !== 'function') {
2515
- return;
2516
- }
2517
- const token = animationTestWaiter.beginAsync();
2518
- const entry = {
2519
- id: null,
2520
- token
2521
- };
2522
- entry.id = requestAnimationFrame(() => {
2523
- this._pendingRafs.delete(entry);
2524
- animationTestWaiter.endAsync(token);
2525
- callback();
2526
- });
2527
- this._pendingRafs.add(entry);
2528
- }
2529
- _cancelAnimation() {
2530
- for (const entry of this._pendingRafs) {
2531
- if (typeof cancelAnimationFrame === 'function') {
2532
- cancelAnimationFrame(entry.id);
2533
- }
2534
- animationTestWaiter.endAsync(entry.token);
2535
- }
2536
- this._pendingRafs.clear();
2537
- }
2538
2518
  destroy() {
2539
2519
  if (this._isDestroyed) {
2540
2520
  return;
@@ -2546,101 +2526,78 @@ let AttacherCore = (_class = class AttacherCore {
2546
2526
  unregisterAttacher(this);
2547
2527
  this._cleanup?.();
2548
2528
  this._cleanup = null;
2549
- cancel(this._syncArgsTimer);
2550
- cancel(this._setReferenceTimer);
2551
- this._cancelAnimation();
2552
- cancel(this._delayedVisibilityToggle);
2529
+ cancelScheduled(this._syncArgsHandle);
2530
+ cancelScheduled(this._setTargetHandle);
2531
+ this._cancelCloseAnimation();
2532
+ cancelScheduled(this._delayedVisibilityToggle);
2553
2533
  this._detachPopoverEvents(this._attachedPopoverEventsOn);
2554
2534
  this._aria.unbind();
2555
- this._removeLegacyShowEventListeners();
2535
+ this._removeTargetShowEventListeners();
2556
2536
  this._removeHideEventListeners();
2557
2537
  this._clearPopoverTargetListeners();
2558
2538
  for (const entry of this._registeredEntries.values()) {
2559
- cancel(entry.updateTimer);
2539
+ cancelScheduled(entry.updateHandle);
2560
2540
  this._removeEntryShowListeners(entry);
2561
2541
  }
2562
2542
  this._registeredEntries.clear();
2563
- this._checkDeprecatedArgs(this._getArgs());
2564
- this._arg('onWillDestroy')?.(this._currentTarget, this.id);
2565
- }
2566
- }, _descriptor = _applyDecoratedDescriptor(_class.prototype, "_parentNotFound", [tracked], {
2567
- configurable: true,
2568
- enumerable: true,
2569
- writable: true,
2570
- initializer: function () {
2571
- return true;
2572
- }
2573
- }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "_parentElement", [tracked], {
2574
- configurable: true,
2575
- enumerable: true,
2576
- writable: true,
2577
- initializer: function () {
2578
- return null;
2579
- }
2580
- }), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "_isStartingAnimation", [tracked], {
2581
- configurable: true,
2582
- enumerable: true,
2583
- writable: true,
2584
- initializer: function () {
2585
- return false;
2586
2543
  }
2587
- }), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "_arrowElement", [tracked], {
2544
+ }, _descriptor = _applyDecoratedDescriptor(_class.prototype, "_arrowElement", [tracked], {
2588
2545
  configurable: true,
2589
2546
  enumerable: true,
2590
2547
  writable: true,
2591
2548
  initializer: function () {
2592
2549
  return null;
2593
2550
  }
2594
- }), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, "_currentTarget", [tracked], {
2551
+ }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "_currentTarget", [tracked], {
2595
2552
  configurable: true,
2596
2553
  enumerable: true,
2597
2554
  writable: true,
2598
2555
  initializer: function () {
2599
2556
  return null;
2600
2557
  }
2601
- }), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, "_registeredTarget", [tracked], {
2558
+ }), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "_registeredTarget", [tracked], {
2602
2559
  configurable: true,
2603
2560
  enumerable: true,
2604
2561
  writable: true,
2605
2562
  initializer: function () {
2606
2563
  return null;
2607
2564
  }
2608
- }), _descriptor7 = _applyDecoratedDescriptor(_class.prototype, "_mustRender", [tracked], {
2565
+ }), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "_mustRender", [tracked], {
2609
2566
  configurable: true,
2610
2567
  enumerable: true,
2611
2568
  writable: true,
2612
2569
  initializer: function () {
2613
2570
  return false;
2614
2571
  }
2615
- }), _descriptor8 = _applyDecoratedDescriptor(_class.prototype, "_modalContainer", [tracked], {
2572
+ }), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, "_modalContainer", [tracked], {
2616
2573
  configurable: true,
2617
2574
  enumerable: true,
2618
2575
  writable: true,
2619
2576
  initializer: function () {
2620
2577
  return null;
2621
2578
  }
2622
- }), _descriptor9 = _applyDecoratedDescriptor(_class.prototype, "_isShown", [tracked], {
2579
+ }), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, "_isShown", [tracked], {
2623
2580
  configurable: true,
2624
2581
  enumerable: true,
2625
2582
  writable: true,
2626
2583
  initializer: function () {
2627
2584
  return false;
2628
2585
  }
2629
- }), _descriptor0 = _applyDecoratedDescriptor(_class.prototype, "_data", [tracked], {
2586
+ }), _descriptor7 = _applyDecoratedDescriptor(_class.prototype, "_data", [tracked], {
2630
2587
  configurable: true,
2631
2588
  enumerable: true,
2632
2589
  writable: true,
2633
2590
  initializer: function () {
2634
2591
  return undefined;
2635
2592
  }
2636
- }), _descriptor1 = _applyDecoratedDescriptor(_class.prototype, "_resolvedPlacement", [tracked], {
2593
+ }), _descriptor8 = _applyDecoratedDescriptor(_class.prototype, "_resolvedPlacement", [tracked], {
2637
2594
  configurable: true,
2638
2595
  enumerable: true,
2639
2596
  writable: true,
2640
2597
  initializer: function () {
2641
2598
  return undefined;
2642
2599
  }
2643
- }), _descriptor10 = _applyDecoratedDescriptor(_class.prototype, "_middlewareData", [tracked], {
2600
+ }), _descriptor9 = _applyDecoratedDescriptor(_class.prototype, "_middlewareData", [tracked], {
2644
2601
  configurable: true,
2645
2602
  enumerable: true,
2646
2603
  writable: true,
@@ -2649,5 +2606,5 @@ let AttacherCore = (_class = class AttacherCore {
2649
2606
  }
2650
2607
  }), _class);
2651
2608
 
2652
- export { AttacherCore as A, resolveTooltipClass as r };
2653
- //# sourceMappingURL=attacher-core-m7x5g04q.js.map
2609
+ export { AttacherCore as A, cancelScheduled as c, resolveTooltipClass as r, scheduleMicrotask as s };
2610
+ //# sourceMappingURL=attacher-core-CtbFbuD_.js.map