@cfxjs/sirius-next-common 0.2.2 → 0.2.3

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 (80) hide show
  1. package/dist/{chunk-N5TMLKGL.js → chunk-3CHXTO52.js} +4 -4
  2. package/dist/chunk-3PF5QYAQ.js +2149 -0
  3. package/dist/chunk-3PF5QYAQ.js.map +1 -0
  4. package/dist/{chunk-73IFRWHE.js → chunk-52R454XN.js} +2 -2
  5. package/dist/{chunk-ZKNMJZ5R.js → chunk-BMO4IZHV.js} +1287 -1706
  6. package/dist/chunk-BMO4IZHV.js.map +1 -0
  7. package/dist/{chunk-4HTI24KG.js → chunk-BVED57CI.js} +2 -2
  8. package/dist/{chunk-RB2U3Y7F.js → chunk-CKOT4CK7.js} +2 -2
  9. package/dist/{chunk-NIYCXPXR.js → chunk-CY4XPEK5.js} +4 -4
  10. package/dist/{chunk-VUULJBTQ.js → chunk-H7V2CGOB.js} +2 -1
  11. package/dist/chunk-H7V2CGOB.js.map +1 -0
  12. package/dist/chunk-JXKHN73X.js +534 -0
  13. package/dist/chunk-JXKHN73X.js.map +1 -0
  14. package/dist/{chunk-XY65HQ35.js → chunk-OQCPL2OI.js} +2 -2
  15. package/dist/{chunk-FMHO65DC.js → chunk-W7ZK4OQA.js} +3 -3
  16. package/dist/{chunk-RWMP7K3H.js → chunk-WML236LE.js} +4 -4
  17. package/dist/{chunk-AAQD5VX5.js → chunk-XZQWPTKA.js} +4 -4
  18. package/dist/components/AddressContainer/CoreAddressContainer.js +8 -7
  19. package/dist/components/AddressContainer/EVMAddressContainer.js +8 -7
  20. package/dist/components/AddressContainer/addressSwitcher.js +6 -5
  21. package/dist/components/AddressContainer/addressView.js +5 -4
  22. package/dist/components/AddressContainer/label.js +4 -3
  23. package/dist/components/Age/index.js +4 -3
  24. package/dist/components/Age/index.js.map +1 -1
  25. package/dist/components/AutoComplete/index.d.ts +16 -0
  26. package/dist/components/AutoComplete/index.js +83 -0
  27. package/dist/components/AutoComplete/index.js.map +1 -0
  28. package/dist/components/Button/index.js +4 -4
  29. package/dist/components/Charts/PreviewChartTemplate.js +5 -5
  30. package/dist/components/Charts/StockChartTemplate.js +2 -2
  31. package/dist/components/CopyButton/index.js +3 -2
  32. package/dist/components/CopyButton/index.js.map +1 -1
  33. package/dist/components/DecimalsSelect/index.d.ts +16 -0
  34. package/dist/components/DecimalsSelect/index.js +126 -0
  35. package/dist/components/DecimalsSelect/index.js.map +1 -0
  36. package/dist/components/DownloadCSV/index.js +4 -3
  37. package/dist/components/DownloadCSV/index.js.map +1 -1
  38. package/dist/components/Dropdown/index.js +2 -2
  39. package/dist/components/GasPriceDropdown/index.js +1 -1
  40. package/dist/components/Icons/index.d.ts +4 -0
  41. package/dist/components/Icons/index.js +68 -0
  42. package/dist/components/Icons/index.js.map +1 -0
  43. package/dist/components/IncreasePercent/index.js +1 -1
  44. package/dist/components/InfoIconWithTooltip/index.js +3 -2
  45. package/dist/components/InfoIconWithTooltip/index.js.map +1 -1
  46. package/dist/components/Modal/index.js +2 -2
  47. package/dist/components/NetworkIcon/index.js +1 -1
  48. package/dist/components/PhishingAddressContainer/index.js +3 -2
  49. package/dist/components/PhishingAddressContainer/index.js.map +1 -1
  50. package/dist/components/Popover/index.d.ts +13 -0
  51. package/dist/components/Popover/index.js +15 -0
  52. package/dist/components/Popover/index.js.map +1 -0
  53. package/dist/components/Price/index.js +3 -2
  54. package/dist/components/Price/index.js.map +1 -1
  55. package/dist/components/Radio/index.js +1 -1
  56. package/dist/components/Select/index.js +2 -2
  57. package/dist/components/Select/select.js +2 -2
  58. package/dist/components/Text/index.js +4 -3
  59. package/dist/components/Tooltip/index.js +3 -2
  60. package/dist/components/TransactionAction/coreTransactionAction.js +8 -7
  61. package/dist/components/TransactionAction/coreTransactionAction.js.map +1 -1
  62. package/dist/components/TransactionAction/evmTransactionAction.js +8 -7
  63. package/dist/components/TransactionAction/evmTransactionAction.js.map +1 -1
  64. package/dist/uno.css +35 -6
  65. package/dist/utils/address.d.ts +1 -1
  66. package/dist/utils/contractManagerTool.js +1 -1
  67. package/dist/utils/index.d.ts +1 -1
  68. package/dist/utils/index.js +1 -1
  69. package/package.json +2 -2
  70. package/dist/chunk-VUULJBTQ.js.map +0 -1
  71. package/dist/chunk-ZKNMJZ5R.js.map +0 -1
  72. /package/dist/{chunk-N5TMLKGL.js.map → chunk-3CHXTO52.js.map} +0 -0
  73. /package/dist/{chunk-73IFRWHE.js.map → chunk-52R454XN.js.map} +0 -0
  74. /package/dist/{chunk-4HTI24KG.js.map → chunk-BVED57CI.js.map} +0 -0
  75. /package/dist/{chunk-RB2U3Y7F.js.map → chunk-CKOT4CK7.js.map} +0 -0
  76. /package/dist/{chunk-NIYCXPXR.js.map → chunk-CY4XPEK5.js.map} +0 -0
  77. /package/dist/{chunk-XY65HQ35.js.map → chunk-OQCPL2OI.js.map} +0 -0
  78. /package/dist/{chunk-FMHO65DC.js.map → chunk-W7ZK4OQA.js.map} +0 -0
  79. /package/dist/{chunk-RWMP7K3H.js.map → chunk-WML236LE.js.map} +0 -0
  80. /package/dist/{chunk-AAQD5VX5.js.map → chunk-XZQWPTKA.js.map} +0 -0
@@ -0,0 +1,2149 @@
1
+ import {
2
+ Portal,
3
+ __objRest,
4
+ __spreadProps,
5
+ __spreadValues,
6
+ addDomEvent,
7
+ callAll,
8
+ compact,
9
+ contains,
10
+ createAnatomy,
11
+ createMachine,
12
+ createScope,
13
+ dataAttr,
14
+ fireCustomEvent,
15
+ getDocument2,
16
+ getEventTarget,
17
+ getPlacement,
18
+ getPlacementStyles,
19
+ getWindow,
20
+ isContextMenuEvent,
21
+ isHTMLElement,
22
+ isIos,
23
+ nextTick,
24
+ normalizeProps,
25
+ raf,
26
+ runIfFn,
27
+ useMachine,
28
+ warn
29
+ } from "./chunk-BMO4IZHV.js";
30
+ import {
31
+ cn
32
+ } from "./chunk-H7V2CGOB.js";
33
+
34
+ // src/components/Popover/index.tsx
35
+ import { useRef } from "react";
36
+
37
+ // ../../node_modules/.pnpm/@cfx-kit+ui-components@0.0.18_@zag-js+accordion@0.19.1_@zag-js+checkbox@0.19.1_@zag-js+dialog_toqhwacqm4ck723ovqekq5mm7u/node_modules/@cfx-kit/ui-components/dist/Popover.js
38
+ import { useEffect, useMemo, useId, isValidElement, cloneElement, Children, Fragment } from "react";
39
+
40
+ // ../../node_modules/.pnpm/@zag-js+tabbable@0.19.1/node_modules/@zag-js/tabbable/dist/index.mjs
41
+ var isHTMLElement2 = (element) => typeof element === "object" && element !== null && element.nodeType === 1;
42
+ var isFrame = (element) => isHTMLElement2(element) && element.tagName === "IFRAME";
43
+ function isVisible(el) {
44
+ if (!isHTMLElement2(el))
45
+ return false;
46
+ return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
47
+ }
48
+ function hasNegativeTabIndex(element) {
49
+ const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
50
+ return tabIndex < 0;
51
+ }
52
+ var focusableSelector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type";
53
+ var getFocusables = (container, includeContainer = false) => {
54
+ if (!container)
55
+ return [];
56
+ const elements = Array.from(container.querySelectorAll(focusableSelector));
57
+ const include = includeContainer == true || includeContainer == "if-empty" && elements.length === 0;
58
+ if (include && isHTMLElement2(container) && isFocusable(container)) {
59
+ elements.unshift(container);
60
+ }
61
+ const focusableElements = elements.filter(isFocusable);
62
+ focusableElements.forEach((element, i) => {
63
+ if (isFrame(element) && element.contentDocument) {
64
+ const frameBody = element.contentDocument.body;
65
+ focusableElements.splice(i, 1, ...getFocusables(frameBody));
66
+ }
67
+ });
68
+ return focusableElements;
69
+ };
70
+ function isFocusable(element) {
71
+ if (!element || element.closest("[inert]"))
72
+ return false;
73
+ return element.matches(focusableSelector) && isVisible(element);
74
+ }
75
+ function getTabbables(container, includeContainer) {
76
+ if (!container)
77
+ return [];
78
+ const elements = Array.from(container.querySelectorAll(focusableSelector));
79
+ const tabbableElements = elements.filter(isTabbable);
80
+ if (includeContainer && isTabbable(container)) {
81
+ tabbableElements.unshift(container);
82
+ }
83
+ tabbableElements.forEach((element, i) => {
84
+ if (isFrame(element) && element.contentDocument) {
85
+ const frameBody = element.contentDocument.body;
86
+ const allFrameTabbable = getTabbables(frameBody);
87
+ tabbableElements.splice(i, 1, ...allFrameTabbable);
88
+ }
89
+ });
90
+ if (!tabbableElements.length && includeContainer) {
91
+ return elements;
92
+ }
93
+ return tabbableElements;
94
+ }
95
+ function isTabbable(el) {
96
+ if (el != null && el.tabIndex > 0)
97
+ return true;
98
+ return isFocusable(el) && !hasNegativeTabIndex(el);
99
+ }
100
+ function getFirstTabbable(container, includeContainer) {
101
+ const [first] = getTabbables(container, includeContainer);
102
+ return first || null;
103
+ }
104
+ function getLastTabbable(container, includeContainer) {
105
+ const elements = getTabbables(container, includeContainer);
106
+ return elements[elements.length - 1] || null;
107
+ }
108
+ function getTabbableEdges(container, includeContainer) {
109
+ const elements = getTabbables(container, includeContainer);
110
+ const first = elements[0] || null;
111
+ const last = elements[elements.length - 1] || null;
112
+ return [first, last];
113
+ }
114
+ function getNextTabbable(container, current) {
115
+ const tabbables = getTabbables(container);
116
+ const doc = container?.ownerDocument || document;
117
+ const currentElement = current ?? doc.activeElement;
118
+ if (!currentElement)
119
+ return null;
120
+ const index = tabbables.indexOf(currentElement);
121
+ return tabbables[index + 1] || null;
122
+ }
123
+ function proxyTabFocusImpl(container, options = {}) {
124
+ const { triggerElement, onFocus } = options;
125
+ const doc = container?.ownerDocument || document;
126
+ const body = doc.body;
127
+ function onKeyDown(event) {
128
+ if (event.key !== "Tab")
129
+ return;
130
+ let elementToFocus = null;
131
+ const [firstTabbable, lastTabbable] = getTabbableEdges(container, true);
132
+ const noTabbableElements = !firstTabbable && !lastTabbable;
133
+ if (event.shiftKey && (doc.activeElement === firstTabbable || noTabbableElements)) {
134
+ elementToFocus = triggerElement;
135
+ } else if (!event.shiftKey && doc.activeElement === triggerElement) {
136
+ elementToFocus = firstTabbable;
137
+ } else if (!event.shiftKey && (doc.activeElement === lastTabbable || noTabbableElements)) {
138
+ elementToFocus = getNextTabbable(body, triggerElement);
139
+ }
140
+ if (!elementToFocus)
141
+ return;
142
+ event.preventDefault();
143
+ onFocus?.(elementToFocus) ?? elementToFocus.focus();
144
+ }
145
+ doc?.addEventListener("keydown", onKeyDown, true);
146
+ return () => {
147
+ doc?.removeEventListener("keydown", onKeyDown, true);
148
+ };
149
+ }
150
+ function proxyTabFocus(container, options) {
151
+ const { defer, triggerElement, ...restOptions } = options;
152
+ const func = defer ? raf : (v) => v();
153
+ const cleanups = [];
154
+ cleanups.push(
155
+ func(() => {
156
+ const node = typeof container === "function" ? container() : container;
157
+ const trigger = typeof triggerElement === "function" ? triggerElement() : triggerElement;
158
+ cleanups.push(proxyTabFocusImpl(node, { triggerElement: trigger, ...restOptions }));
159
+ })
160
+ );
161
+ return () => {
162
+ cleanups.forEach((fn) => fn?.());
163
+ };
164
+ }
165
+
166
+ // ../../node_modules/.pnpm/@zag-js+aria-hidden@0.19.1/node_modules/@zag-js/aria-hidden/dist/index.mjs
167
+ var refCountMap = /* @__PURE__ */ new WeakMap();
168
+ var observerStack = [];
169
+ function ariaHiddenImpl(targets, options = {}) {
170
+ const { rootEl } = options;
171
+ const exclude = targets.filter(Boolean);
172
+ if (exclude.length === 0)
173
+ return;
174
+ const doc = exclude[0].ownerDocument || document;
175
+ const win = doc.defaultView ?? window;
176
+ const visibleNodes = new Set(exclude);
177
+ const hiddenNodes = /* @__PURE__ */ new Set();
178
+ const root = rootEl ?? doc.body;
179
+ let walk = (root2) => {
180
+ for (let element of root2.querySelectorAll("[data-live-announcer], [data-zag-top-layer]")) {
181
+ visibleNodes.add(element);
182
+ }
183
+ let acceptNode = (node) => {
184
+ if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute("role") !== "row") {
185
+ return NodeFilter.FILTER_REJECT;
186
+ }
187
+ for (let target of visibleNodes) {
188
+ if (node.contains(target)) {
189
+ return NodeFilter.FILTER_SKIP;
190
+ }
191
+ }
192
+ return NodeFilter.FILTER_ACCEPT;
193
+ };
194
+ let walker = doc.createTreeWalker(root2, NodeFilter.SHOW_ELEMENT, { acceptNode });
195
+ let acceptRoot = acceptNode(root2);
196
+ if (acceptRoot === NodeFilter.FILTER_ACCEPT) {
197
+ hide(root2);
198
+ }
199
+ if (acceptRoot !== NodeFilter.FILTER_REJECT) {
200
+ let node = walker.nextNode();
201
+ while (node != null) {
202
+ hide(node);
203
+ node = walker.nextNode();
204
+ }
205
+ }
206
+ };
207
+ let hide = (node) => {
208
+ let refCount = refCountMap.get(node) ?? 0;
209
+ if (node.getAttribute("aria-hidden") === "true" && refCount === 0) {
210
+ return;
211
+ }
212
+ if (refCount === 0) {
213
+ node.setAttribute("aria-hidden", "true");
214
+ }
215
+ hiddenNodes.add(node);
216
+ refCountMap.set(node, refCount + 1);
217
+ };
218
+ if (observerStack.length) {
219
+ observerStack[observerStack.length - 1].disconnect();
220
+ }
221
+ walk(root);
222
+ const observer = new win.MutationObserver((changes) => {
223
+ for (let change of changes) {
224
+ if (change.type !== "childList" || change.addedNodes.length === 0) {
225
+ continue;
226
+ }
227
+ if (![...visibleNodes, ...hiddenNodes].some((node) => node.contains(change.target))) {
228
+ for (let node of change.removedNodes) {
229
+ if (node instanceof win.Element) {
230
+ visibleNodes.delete(node);
231
+ hiddenNodes.delete(node);
232
+ }
233
+ }
234
+ for (let node of change.addedNodes) {
235
+ if ((node instanceof win.HTMLElement || node instanceof win.SVGElement) && (node.dataset.liveAnnouncer === "true" || node.dataset.zagTopLayer === "true")) {
236
+ visibleNodes.add(node);
237
+ } else if (node instanceof win.Element) {
238
+ walk(node);
239
+ }
240
+ }
241
+ }
242
+ }
243
+ });
244
+ observer.observe(root, { childList: true, subtree: true });
245
+ let observerWrapper = {
246
+ observe() {
247
+ observer.observe(root, { childList: true, subtree: true });
248
+ },
249
+ disconnect() {
250
+ observer.disconnect();
251
+ }
252
+ };
253
+ observerStack.push(observerWrapper);
254
+ return () => {
255
+ observer.disconnect();
256
+ for (let node of hiddenNodes) {
257
+ let count = refCountMap.get(node);
258
+ if (count === 1) {
259
+ node.removeAttribute("aria-hidden");
260
+ refCountMap.delete(node);
261
+ } else {
262
+ refCountMap.set(node, count - 1);
263
+ }
264
+ }
265
+ if (observerWrapper === observerStack[observerStack.length - 1]) {
266
+ observerStack.pop();
267
+ if (observerStack.length) {
268
+ observerStack[observerStack.length - 1].observe();
269
+ }
270
+ } else {
271
+ observerStack.splice(observerStack.indexOf(observerWrapper), 1);
272
+ }
273
+ };
274
+ }
275
+ function ariaHidden(targetsOrFn, options = {}) {
276
+ const { defer } = options;
277
+ const func = defer ? raf : (v) => v();
278
+ const cleanups = [];
279
+ cleanups.push(
280
+ func(() => {
281
+ const targets = typeof targetsOrFn === "function" ? targetsOrFn() : targetsOrFn;
282
+ cleanups.push(ariaHiddenImpl(targets, options));
283
+ })
284
+ );
285
+ return () => {
286
+ cleanups.forEach((fn) => fn?.());
287
+ };
288
+ }
289
+
290
+ // ../../node_modules/.pnpm/@zag-js+interact-outside@0.19.1/node_modules/@zag-js/interact-outside/dist/index.mjs
291
+ function getWindowFrames(win) {
292
+ const frames = {
293
+ each(cb) {
294
+ for (let i = 0; i < win.frames?.length; i += 1) {
295
+ const frame = win.frames[i];
296
+ if (frame)
297
+ cb(frame);
298
+ }
299
+ },
300
+ addEventListener(event, listener, options) {
301
+ frames.each((frame) => {
302
+ try {
303
+ frame.document.addEventListener(event, listener, options);
304
+ } catch (err) {
305
+ console.warn(err);
306
+ }
307
+ });
308
+ return () => {
309
+ try {
310
+ frames.removeEventListener(event, listener, options);
311
+ } catch (err) {
312
+ console.warn(err);
313
+ }
314
+ };
315
+ },
316
+ removeEventListener(event, listener, options) {
317
+ frames.each((frame) => {
318
+ try {
319
+ frame.document.removeEventListener(event, listener, options);
320
+ } catch (err) {
321
+ console.warn(err);
322
+ }
323
+ });
324
+ }
325
+ };
326
+ return frames;
327
+ }
328
+ var POINTER_OUTSIDE_EVENT = "pointerdown.outside";
329
+ var FOCUS_OUTSIDE_EVENT = "focus.outside";
330
+ function isComposedPathFocusable(event) {
331
+ const composedPath = event.composedPath() ?? [event.target];
332
+ for (const node of composedPath) {
333
+ if (isHTMLElement(node) && isFocusable(node))
334
+ return true;
335
+ }
336
+ return false;
337
+ }
338
+ var isPointerEvent = (event) => "clientY" in event;
339
+ function isEventPointWithin(node, event) {
340
+ if (!isPointerEvent(event) || !node)
341
+ return false;
342
+ const rect = node.getBoundingClientRect();
343
+ if (rect.width === 0 || rect.height === 0)
344
+ return false;
345
+ return rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
346
+ }
347
+ function trackInteractOutsideImpl(node, options) {
348
+ const { exclude, onFocusOutside, onPointerDownOutside, onInteractOutside } = options;
349
+ if (!node)
350
+ return;
351
+ const doc = getDocument2(node);
352
+ const win = getWindow(node);
353
+ const frames = getWindowFrames(win);
354
+ function isEventOutside(event) {
355
+ const target = getEventTarget(event);
356
+ if (!isHTMLElement(target))
357
+ return false;
358
+ if (contains(node, target))
359
+ return false;
360
+ if (isEventPointWithin(node, event))
361
+ return false;
362
+ return !exclude?.(target);
363
+ }
364
+ let clickHandler;
365
+ function onPointerDown(event) {
366
+ function handler() {
367
+ if (!node || !isEventOutside(event))
368
+ return;
369
+ if (onPointerDownOutside || onInteractOutside) {
370
+ const handler2 = callAll(onPointerDownOutside, onInteractOutside);
371
+ node.addEventListener(POINTER_OUTSIDE_EVENT, handler2, { once: true });
372
+ }
373
+ fireCustomEvent(node, POINTER_OUTSIDE_EVENT, {
374
+ bubbles: false,
375
+ cancelable: true,
376
+ detail: {
377
+ originalEvent: event,
378
+ contextmenu: isContextMenuEvent(event),
379
+ focusable: isComposedPathFocusable(event)
380
+ }
381
+ });
382
+ }
383
+ if (event.pointerType === "touch") {
384
+ frames.removeEventListener("click", handler);
385
+ doc.removeEventListener("click", handler);
386
+ clickHandler = handler;
387
+ doc.addEventListener("click", handler, { once: true });
388
+ frames.addEventListener("click", handler, { once: true });
389
+ } else {
390
+ handler();
391
+ }
392
+ }
393
+ const cleanups = /* @__PURE__ */ new Set();
394
+ const timer = setTimeout(() => {
395
+ cleanups.add(frames.addEventListener("pointerdown", onPointerDown, true));
396
+ cleanups.add(addDomEvent(doc, "pointerdown", onPointerDown, true));
397
+ }, 0);
398
+ function onFocusin(event) {
399
+ if (!node || !isEventOutside(event))
400
+ return;
401
+ if (onFocusOutside || onInteractOutside) {
402
+ const handler = callAll(onFocusOutside, onInteractOutside);
403
+ node.addEventListener(FOCUS_OUTSIDE_EVENT, handler, { once: true });
404
+ }
405
+ fireCustomEvent(node, FOCUS_OUTSIDE_EVENT, {
406
+ bubbles: false,
407
+ cancelable: true,
408
+ detail: {
409
+ originalEvent: event,
410
+ contextmenu: false,
411
+ focusable: isFocusable(getEventTarget(event))
412
+ }
413
+ });
414
+ }
415
+ cleanups.add(addDomEvent(doc, "focusin", onFocusin, true));
416
+ cleanups.add(frames.addEventListener("focusin", onFocusin, true));
417
+ return () => {
418
+ clearTimeout(timer);
419
+ if (clickHandler) {
420
+ frames.removeEventListener("click", clickHandler);
421
+ doc.removeEventListener("click", clickHandler);
422
+ }
423
+ cleanups.forEach((fn) => fn());
424
+ };
425
+ }
426
+ function trackInteractOutside(nodeOrFn, options) {
427
+ const { defer } = options;
428
+ const func = defer ? raf : (v) => v();
429
+ const cleanups = [];
430
+ cleanups.push(
431
+ func(() => {
432
+ const node = typeof nodeOrFn === "function" ? nodeOrFn() : nodeOrFn;
433
+ cleanups.push(trackInteractOutsideImpl(node, options));
434
+ })
435
+ );
436
+ return () => {
437
+ cleanups.forEach((fn) => fn?.());
438
+ };
439
+ }
440
+
441
+ // ../../node_modules/.pnpm/@zag-js+dismissable@0.19.1/node_modules/@zag-js/dismissable/dist/index.mjs
442
+ function trackEscapeKeydown(node, fn) {
443
+ const handleKeyDown = (event) => {
444
+ if (event.key === "Escape")
445
+ fn?.(event);
446
+ };
447
+ return addDomEvent(getDocument2(node), "keydown", handleKeyDown);
448
+ }
449
+ var layerStack = {
450
+ layers: [],
451
+ branches: [],
452
+ count() {
453
+ return this.layers.length;
454
+ },
455
+ pointerBlockingLayers() {
456
+ return this.layers.filter((layer) => layer.pointerBlocking);
457
+ },
458
+ topMostPointerBlockingLayer() {
459
+ return [...this.pointerBlockingLayers()].slice(-1)[0];
460
+ },
461
+ hasPointerBlockingLayer() {
462
+ return this.pointerBlockingLayers().length > 0;
463
+ },
464
+ isBelowPointerBlockingLayer(node) {
465
+ const index = this.indexOf(node);
466
+ const highestBlockingIndex = this.topMostPointerBlockingLayer() ? this.indexOf(this.topMostPointerBlockingLayer()?.node) : -1;
467
+ return index < highestBlockingIndex;
468
+ },
469
+ isTopMost(node) {
470
+ const layer = this.layers[this.count() - 1];
471
+ return layer?.node === node;
472
+ },
473
+ getNestedLayers(node) {
474
+ return Array.from(this.layers).slice(this.indexOf(node) + 1);
475
+ },
476
+ isInNestedLayer(node, target) {
477
+ return this.getNestedLayers(node).some((layer) => contains(layer.node, target));
478
+ },
479
+ isInBranch(target) {
480
+ return Array.from(this.branches).some((branch) => contains(branch, target));
481
+ },
482
+ add(layer) {
483
+ this.layers.push(layer);
484
+ },
485
+ addBranch(node) {
486
+ this.branches.push(node);
487
+ },
488
+ remove(node) {
489
+ const index = this.indexOf(node);
490
+ if (index < 0)
491
+ return;
492
+ if (index < this.count() - 1) {
493
+ const _layers = this.getNestedLayers(node);
494
+ _layers.forEach((layer) => layer.dismiss());
495
+ }
496
+ this.layers.splice(index, 1);
497
+ },
498
+ removeBranch(node) {
499
+ const index = this.branches.indexOf(node);
500
+ if (index >= 0)
501
+ this.branches.splice(index, 1);
502
+ },
503
+ indexOf(node) {
504
+ return this.layers.findIndex((layer) => layer.node === node);
505
+ },
506
+ dismiss(node) {
507
+ this.layers[this.indexOf(node)]?.dismiss();
508
+ },
509
+ clear() {
510
+ this.remove(this.layers[0].node);
511
+ }
512
+ };
513
+ var originalBodyPointerEvents;
514
+ function assignPointerEventToLayers() {
515
+ layerStack.layers.forEach(({ node }) => {
516
+ node.style.pointerEvents = layerStack.isBelowPointerBlockingLayer(node) ? "none" : "auto";
517
+ });
518
+ }
519
+ function clearPointerEvent(node) {
520
+ node.style.pointerEvents = "";
521
+ }
522
+ var DATA_ATTR = "data-inert";
523
+ function disablePointerEventsOutside(node) {
524
+ const doc = getDocument2(node);
525
+ if (layerStack.hasPointerBlockingLayer() && !doc.body.hasAttribute(DATA_ATTR)) {
526
+ originalBodyPointerEvents = document.body.style.pointerEvents;
527
+ doc.body.style.pointerEvents = "none";
528
+ doc.body.setAttribute(DATA_ATTR, "");
529
+ }
530
+ return () => {
531
+ if (layerStack.hasPointerBlockingLayer())
532
+ return;
533
+ doc.body.style.pointerEvents = originalBodyPointerEvents;
534
+ doc.body.removeAttribute(DATA_ATTR);
535
+ if (doc.body.style.length === 0)
536
+ doc.body.removeAttribute("style");
537
+ };
538
+ }
539
+ function trackDismissableElementImpl(node, options) {
540
+ if (!node) {
541
+ warn("[@zag-js/dismissable] node is `null` or `undefined`");
542
+ return;
543
+ }
544
+ const { onDismiss, pointerBlocking, exclude: excludeContainers, debug } = options;
545
+ const layer = { dismiss: onDismiss, node, pointerBlocking };
546
+ layerStack.add(layer);
547
+ assignPointerEventToLayers();
548
+ function onPointerDownOutside(event) {
549
+ const target = getEventTarget(event.detail.originalEvent);
550
+ if (layerStack.isBelowPointerBlockingLayer(node) || layerStack.isInBranch(target))
551
+ return;
552
+ options.onPointerDownOutside?.(event);
553
+ options.onInteractOutside?.(event);
554
+ if (event.defaultPrevented)
555
+ return;
556
+ if (debug) {
557
+ console.log("onPointerDownOutside:", event.detail.originalEvent);
558
+ }
559
+ onDismiss?.();
560
+ }
561
+ function onFocusOutside(event) {
562
+ const target = getEventTarget(event.detail.originalEvent);
563
+ if (layerStack.isInBranch(target))
564
+ return;
565
+ options.onFocusOutside?.(event);
566
+ options.onInteractOutside?.(event);
567
+ if (event.defaultPrevented)
568
+ return;
569
+ if (debug) {
570
+ console.log("onFocusOutside:", event.detail.originalEvent);
571
+ }
572
+ onDismiss?.();
573
+ }
574
+ function onEscapeKeyDown(event) {
575
+ if (!layerStack.isTopMost(node))
576
+ return;
577
+ options.onEscapeKeyDown?.(event);
578
+ if (!event.defaultPrevented && onDismiss) {
579
+ event.preventDefault();
580
+ onDismiss();
581
+ }
582
+ }
583
+ function exclude(target) {
584
+ if (!node)
585
+ return false;
586
+ const containers = typeof excludeContainers === "function" ? excludeContainers() : excludeContainers;
587
+ const _containers = Array.isArray(containers) ? containers : [containers];
588
+ return _containers.some((node2) => contains(node2, target)) || layerStack.isInNestedLayer(node, target);
589
+ }
590
+ const cleanups = [
591
+ pointerBlocking ? disablePointerEventsOutside(node) : void 0,
592
+ trackEscapeKeydown(node, onEscapeKeyDown),
593
+ trackInteractOutside(node, { exclude, onFocusOutside, onPointerDownOutside })
594
+ ];
595
+ return () => {
596
+ layerStack.remove(node);
597
+ assignPointerEventToLayers();
598
+ clearPointerEvent(node);
599
+ cleanups.forEach((fn) => fn?.());
600
+ };
601
+ }
602
+ function trackDismissableElement(nodeOrFn, options) {
603
+ const { defer } = options;
604
+ const func = defer ? raf : (v) => v();
605
+ const cleanups = [];
606
+ cleanups.push(
607
+ func(() => {
608
+ const node = typeof nodeOrFn === "function" ? nodeOrFn() : nodeOrFn;
609
+ cleanups.push(trackDismissableElementImpl(node, options));
610
+ })
611
+ );
612
+ return () => {
613
+ cleanups.forEach((fn) => fn?.());
614
+ };
615
+ }
616
+
617
+ // ../../node_modules/.pnpm/@zag-js+remove-scroll@0.19.1/node_modules/@zag-js/remove-scroll/dist/index.mjs
618
+ var LOCK_CLASSNAME = "data-zag-scroll-lock";
619
+ function assignStyle(el, style) {
620
+ if (!el)
621
+ return;
622
+ const previousStyle = el.style.cssText;
623
+ Object.assign(el.style, style);
624
+ return () => {
625
+ el.style.cssText = previousStyle;
626
+ };
627
+ }
628
+ function setCSSProperty(el, property, value) {
629
+ if (!el)
630
+ return;
631
+ const previousValue = el.style.getPropertyValue(property);
632
+ el.style.setProperty(property, value);
633
+ return () => {
634
+ if (previousValue) {
635
+ el.style.setProperty(property, previousValue);
636
+ } else {
637
+ el.style.removeProperty(property);
638
+ }
639
+ };
640
+ }
641
+ function getPaddingProperty(documentElement) {
642
+ const documentLeft = documentElement.getBoundingClientRect().left;
643
+ const scrollbarX = Math.round(documentLeft) + documentElement.scrollLeft;
644
+ return scrollbarX ? "paddingLeft" : "paddingRight";
645
+ }
646
+ function preventBodyScroll(_document) {
647
+ const doc = _document ?? document;
648
+ const win = doc.defaultView ?? window;
649
+ const { documentElement, body } = doc;
650
+ const locked = body.hasAttribute(LOCK_CLASSNAME);
651
+ if (locked)
652
+ return;
653
+ body.setAttribute(LOCK_CLASSNAME, "");
654
+ const scrollbarWidth = win.innerWidth - documentElement.clientWidth;
655
+ const setScrollbarWidthProperty = () => setCSSProperty(documentElement, "--scrollbar-width", `${scrollbarWidth}px`);
656
+ const paddingProperty = getPaddingProperty(documentElement);
657
+ const setStyle = () => assignStyle(body, {
658
+ overflow: "hidden",
659
+ [paddingProperty]: `${scrollbarWidth}px`
660
+ });
661
+ const setIOSStyle = () => {
662
+ const { scrollX, scrollY, visualViewport } = win;
663
+ const offsetLeft = visualViewport?.offsetLeft ?? 0;
664
+ const offsetTop = visualViewport?.offsetTop ?? 0;
665
+ const restoreStyle = assignStyle(body, {
666
+ position: "fixed",
667
+ overflow: "hidden",
668
+ top: `${-(scrollY - Math.floor(offsetTop))}px`,
669
+ left: `${-(scrollX - Math.floor(offsetLeft))}px`,
670
+ right: "0",
671
+ [paddingProperty]: `${scrollbarWidth}px`
672
+ });
673
+ return () => {
674
+ restoreStyle?.();
675
+ win.scrollTo(scrollX, scrollY);
676
+ };
677
+ };
678
+ const cleanups = [setScrollbarWidthProperty(), isIos() ? setIOSStyle() : setStyle()];
679
+ return () => {
680
+ cleanups.forEach((fn) => fn?.());
681
+ body.removeAttribute(LOCK_CLASSNAME);
682
+ };
683
+ }
684
+
685
+ // ../../node_modules/.pnpm/tabbable@6.2.0/node_modules/tabbable/dist/index.esm.js
686
+ var candidateSelectors = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"];
687
+ var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
688
+ var NoElement = typeof Element === "undefined";
689
+ var matches = NoElement ? function() {
690
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
691
+ var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) {
692
+ var _element$getRootNode;
693
+ return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
694
+ } : function(element) {
695
+ return element === null || element === void 0 ? void 0 : element.ownerDocument;
696
+ };
697
+ var isInert = function isInert2(node, lookUp) {
698
+ var _node$getAttribute;
699
+ if (lookUp === void 0) {
700
+ lookUp = true;
701
+ }
702
+ var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, "inert");
703
+ var inert = inertAtt === "" || inertAtt === "true";
704
+ var result = inert || lookUp && node && isInert2(node.parentNode);
705
+ return result;
706
+ };
707
+ var isContentEditable = function isContentEditable2(node) {
708
+ var _node$getAttribute2;
709
+ var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, "contenteditable");
710
+ return attValue === "" || attValue === "true";
711
+ };
712
+ var getCandidates = function getCandidates2(el, includeContainer, filter) {
713
+ if (isInert(el)) {
714
+ return [];
715
+ }
716
+ var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
717
+ if (includeContainer && matches.call(el, candidateSelector)) {
718
+ candidates.unshift(el);
719
+ }
720
+ candidates = candidates.filter(filter);
721
+ return candidates;
722
+ };
723
+ var getCandidatesIteratively = function getCandidatesIteratively2(elements, includeContainer, options) {
724
+ var candidates = [];
725
+ var elementsToCheck = Array.from(elements);
726
+ while (elementsToCheck.length) {
727
+ var element = elementsToCheck.shift();
728
+ if (isInert(element, false)) {
729
+ continue;
730
+ }
731
+ if (element.tagName === "SLOT") {
732
+ var assigned = element.assignedElements();
733
+ var content = assigned.length ? assigned : element.children;
734
+ var nestedCandidates = getCandidatesIteratively2(content, true, options);
735
+ if (options.flatten) {
736
+ candidates.push.apply(candidates, nestedCandidates);
737
+ } else {
738
+ candidates.push({
739
+ scopeParent: element,
740
+ candidates: nestedCandidates
741
+ });
742
+ }
743
+ } else {
744
+ var validCandidate = matches.call(element, candidateSelector);
745
+ if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
746
+ candidates.push(element);
747
+ }
748
+ var shadowRoot = element.shadowRoot || // check for an undisclosed shadow
749
+ typeof options.getShadowRoot === "function" && options.getShadowRoot(element);
750
+ var validShadowRoot = !isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
751
+ if (shadowRoot && validShadowRoot) {
752
+ var _nestedCandidates = getCandidatesIteratively2(shadowRoot === true ? element.children : shadowRoot.children, true, options);
753
+ if (options.flatten) {
754
+ candidates.push.apply(candidates, _nestedCandidates);
755
+ } else {
756
+ candidates.push({
757
+ scopeParent: element,
758
+ candidates: _nestedCandidates
759
+ });
760
+ }
761
+ } else {
762
+ elementsToCheck.unshift.apply(elementsToCheck, element.children);
763
+ }
764
+ }
765
+ }
766
+ return candidates;
767
+ };
768
+ var hasTabIndex = function hasTabIndex2(node) {
769
+ return !isNaN(parseInt(node.getAttribute("tabindex"), 10));
770
+ };
771
+ var getTabIndex = function getTabIndex2(node) {
772
+ if (!node) {
773
+ throw new Error("No node provided");
774
+ }
775
+ if (node.tabIndex < 0) {
776
+ if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
777
+ return 0;
778
+ }
779
+ }
780
+ return node.tabIndex;
781
+ };
782
+ var getSortOrderTabIndex = function getSortOrderTabIndex2(node, isScope) {
783
+ var tabIndex = getTabIndex(node);
784
+ if (tabIndex < 0 && isScope && !hasTabIndex(node)) {
785
+ return 0;
786
+ }
787
+ return tabIndex;
788
+ };
789
+ var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
790
+ return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
791
+ };
792
+ var isInput = function isInput2(node) {
793
+ return node.tagName === "INPUT";
794
+ };
795
+ var isHiddenInput = function isHiddenInput2(node) {
796
+ return isInput(node) && node.type === "hidden";
797
+ };
798
+ var isDetailsWithSummary = function isDetailsWithSummary2(node) {
799
+ var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
800
+ return child.tagName === "SUMMARY";
801
+ });
802
+ return r;
803
+ };
804
+ var getCheckedRadio = function getCheckedRadio2(nodes, form) {
805
+ for (var i = 0; i < nodes.length; i++) {
806
+ if (nodes[i].checked && nodes[i].form === form) {
807
+ return nodes[i];
808
+ }
809
+ }
810
+ };
811
+ var isTabbableRadio = function isTabbableRadio2(node) {
812
+ if (!node.name) {
813
+ return true;
814
+ }
815
+ var radioScope = node.form || getRootNode(node);
816
+ var queryRadios = function queryRadios2(name) {
817
+ return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
818
+ };
819
+ var radioSet;
820
+ if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") {
821
+ radioSet = queryRadios(window.CSS.escape(node.name));
822
+ } else {
823
+ try {
824
+ radioSet = queryRadios(node.name);
825
+ } catch (err) {
826
+ console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message);
827
+ return false;
828
+ }
829
+ }
830
+ var checked = getCheckedRadio(radioSet, node.form);
831
+ return !checked || checked === node;
832
+ };
833
+ var isRadio = function isRadio2(node) {
834
+ return isInput(node) && node.type === "radio";
835
+ };
836
+ var isNonTabbableRadio = function isNonTabbableRadio2(node) {
837
+ return isRadio(node) && !isTabbableRadio(node);
838
+ };
839
+ var isNodeAttached = function isNodeAttached2(node) {
840
+ var _nodeRoot;
841
+ var nodeRoot = node && getRootNode(node);
842
+ var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
843
+ var attached = false;
844
+ if (nodeRoot && nodeRoot !== node) {
845
+ var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
846
+ attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));
847
+ while (!attached && nodeRootHost) {
848
+ var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
849
+ nodeRoot = getRootNode(nodeRootHost);
850
+ nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
851
+ attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
852
+ }
853
+ }
854
+ return attached;
855
+ };
856
+ var isZeroArea = function isZeroArea2(node) {
857
+ var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
858
+ return width === 0 && height === 0;
859
+ };
860
+ var isHidden = function isHidden2(node, _ref) {
861
+ var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot;
862
+ if (getComputedStyle(node).visibility === "hidden") {
863
+ return true;
864
+ }
865
+ var isDirectSummary = matches.call(node, "details>summary:first-of-type");
866
+ var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
867
+ if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
868
+ return true;
869
+ }
870
+ if (!displayCheck || displayCheck === "full" || displayCheck === "legacy-full") {
871
+ if (typeof getShadowRoot === "function") {
872
+ var originalNode = node;
873
+ while (node) {
874
+ var parentElement = node.parentElement;
875
+ var rootNode = getRootNode(node);
876
+ if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) {
877
+ return isZeroArea(node);
878
+ } else if (node.assignedSlot) {
879
+ node = node.assignedSlot;
880
+ } else if (!parentElement && rootNode !== node.ownerDocument) {
881
+ node = rootNode.host;
882
+ } else {
883
+ node = parentElement;
884
+ }
885
+ }
886
+ node = originalNode;
887
+ }
888
+ if (isNodeAttached(node)) {
889
+ return !node.getClientRects().length;
890
+ }
891
+ if (displayCheck !== "legacy-full") {
892
+ return true;
893
+ }
894
+ } else if (displayCheck === "non-zero-area") {
895
+ return isZeroArea(node);
896
+ }
897
+ return false;
898
+ };
899
+ var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
900
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
901
+ var parentNode = node.parentElement;
902
+ while (parentNode) {
903
+ if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
904
+ for (var i = 0; i < parentNode.children.length; i++) {
905
+ var child = parentNode.children.item(i);
906
+ if (child.tagName === "LEGEND") {
907
+ return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node);
908
+ }
909
+ }
910
+ return true;
911
+ }
912
+ parentNode = parentNode.parentElement;
913
+ }
914
+ }
915
+ return false;
916
+ };
917
+ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
918
+ if (node.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
919
+ // because we're limited in the type of selectors we can use in JSDom (see related
920
+ // note related to `candidateSelectors`)
921
+ isInert(node) || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus
922
+ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
923
+ return false;
924
+ }
925
+ return true;
926
+ };
927
+ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
928
+ if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
929
+ return false;
930
+ }
931
+ return true;
932
+ };
933
+ var isValidShadowRootTabbable = function isValidShadowRootTabbable2(shadowHostNode) {
934
+ var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10);
935
+ if (isNaN(tabIndex) || tabIndex >= 0) {
936
+ return true;
937
+ }
938
+ return false;
939
+ };
940
+ var sortByOrder = function sortByOrder2(candidates) {
941
+ var regularTabbables = [];
942
+ var orderedTabbables = [];
943
+ candidates.forEach(function(item, i) {
944
+ var isScope = !!item.scopeParent;
945
+ var element = isScope ? item.scopeParent : item;
946
+ var candidateTabindex = getSortOrderTabIndex(element, isScope);
947
+ var elements = isScope ? sortByOrder2(item.candidates) : element;
948
+ if (candidateTabindex === 0) {
949
+ isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
950
+ } else {
951
+ orderedTabbables.push({
952
+ documentOrder: i,
953
+ tabIndex: candidateTabindex,
954
+ item,
955
+ isScope,
956
+ content: elements
957
+ });
958
+ }
959
+ });
960
+ return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) {
961
+ sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
962
+ return acc;
963
+ }, []).concat(regularTabbables);
964
+ };
965
+ var tabbable = function tabbable2(container, options) {
966
+ options = options || {};
967
+ var candidates;
968
+ if (options.getShadowRoot) {
969
+ candidates = getCandidatesIteratively([container], options.includeContainer, {
970
+ filter: isNodeMatchingSelectorTabbable.bind(null, options),
971
+ flatten: false,
972
+ getShadowRoot: options.getShadowRoot,
973
+ shadowRootFilter: isValidShadowRootTabbable
974
+ });
975
+ } else {
976
+ candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
977
+ }
978
+ return sortByOrder(candidates);
979
+ };
980
+ var focusable = function focusable2(container, options) {
981
+ options = options || {};
982
+ var candidates;
983
+ if (options.getShadowRoot) {
984
+ candidates = getCandidatesIteratively([container], options.includeContainer, {
985
+ filter: isNodeMatchingSelectorFocusable.bind(null, options),
986
+ flatten: true,
987
+ getShadowRoot: options.getShadowRoot
988
+ });
989
+ } else {
990
+ candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
991
+ }
992
+ return candidates;
993
+ };
994
+ var isTabbable2 = function isTabbable3(node, options) {
995
+ options = options || {};
996
+ if (!node) {
997
+ throw new Error("No node provided");
998
+ }
999
+ if (matches.call(node, candidateSelector) === false) {
1000
+ return false;
1001
+ }
1002
+ return isNodeMatchingSelectorTabbable(options, node);
1003
+ };
1004
+ var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe").join(",");
1005
+ var isFocusable2 = function isFocusable3(node, options) {
1006
+ options = options || {};
1007
+ if (!node) {
1008
+ throw new Error("No node provided");
1009
+ }
1010
+ if (matches.call(node, focusableCandidateSelector) === false) {
1011
+ return false;
1012
+ }
1013
+ return isNodeMatchingSelectorFocusable(options, node);
1014
+ };
1015
+
1016
+ // ../../node_modules/.pnpm/focus-trap@7.5.2/node_modules/focus-trap/dist/focus-trap.esm.js
1017
+ function ownKeys(object, enumerableOnly) {
1018
+ var keys = Object.keys(object);
1019
+ if (Object.getOwnPropertySymbols) {
1020
+ var symbols = Object.getOwnPropertySymbols(object);
1021
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
1022
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1023
+ })), keys.push.apply(keys, symbols);
1024
+ }
1025
+ return keys;
1026
+ }
1027
+ function _objectSpread2(target) {
1028
+ for (var i = 1; i < arguments.length; i++) {
1029
+ var source = null != arguments[i] ? arguments[i] : {};
1030
+ i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
1031
+ _defineProperty(target, key, source[key]);
1032
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
1033
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1034
+ });
1035
+ }
1036
+ return target;
1037
+ }
1038
+ function _defineProperty(obj, key, value) {
1039
+ key = _toPropertyKey(key);
1040
+ if (key in obj) {
1041
+ Object.defineProperty(obj, key, {
1042
+ value,
1043
+ enumerable: true,
1044
+ configurable: true,
1045
+ writable: true
1046
+ });
1047
+ } else {
1048
+ obj[key] = value;
1049
+ }
1050
+ return obj;
1051
+ }
1052
+ function _toPrimitive(input, hint) {
1053
+ if (typeof input !== "object" || input === null)
1054
+ return input;
1055
+ var prim = input[Symbol.toPrimitive];
1056
+ if (prim !== void 0) {
1057
+ var res = prim.call(input, hint || "default");
1058
+ if (typeof res !== "object")
1059
+ return res;
1060
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1061
+ }
1062
+ return (hint === "string" ? String : Number)(input);
1063
+ }
1064
+ function _toPropertyKey(arg) {
1065
+ var key = _toPrimitive(arg, "string");
1066
+ return typeof key === "symbol" ? key : String(key);
1067
+ }
1068
+ var activeFocusTraps = {
1069
+ activateTrap: function activateTrap(trapStack, trap) {
1070
+ if (trapStack.length > 0) {
1071
+ var activeTrap = trapStack[trapStack.length - 1];
1072
+ if (activeTrap !== trap) {
1073
+ activeTrap.pause();
1074
+ }
1075
+ }
1076
+ var trapIndex = trapStack.indexOf(trap);
1077
+ if (trapIndex === -1) {
1078
+ trapStack.push(trap);
1079
+ } else {
1080
+ trapStack.splice(trapIndex, 1);
1081
+ trapStack.push(trap);
1082
+ }
1083
+ },
1084
+ deactivateTrap: function deactivateTrap(trapStack, trap) {
1085
+ var trapIndex = trapStack.indexOf(trap);
1086
+ if (trapIndex !== -1) {
1087
+ trapStack.splice(trapIndex, 1);
1088
+ }
1089
+ if (trapStack.length > 0) {
1090
+ trapStack[trapStack.length - 1].unpause();
1091
+ }
1092
+ }
1093
+ };
1094
+ var isSelectableInput = function isSelectableInput2(node) {
1095
+ return node.tagName && node.tagName.toLowerCase() === "input" && typeof node.select === "function";
1096
+ };
1097
+ var isEscapeEvent = function isEscapeEvent2(e) {
1098
+ return (e === null || e === void 0 ? void 0 : e.key) === "Escape" || (e === null || e === void 0 ? void 0 : e.key) === "Esc" || (e === null || e === void 0 ? void 0 : e.keyCode) === 27;
1099
+ };
1100
+ var isTabEvent = function isTabEvent2(e) {
1101
+ return (e === null || e === void 0 ? void 0 : e.key) === "Tab" || (e === null || e === void 0 ? void 0 : e.keyCode) === 9;
1102
+ };
1103
+ var isKeyForward = function isKeyForward2(e) {
1104
+ return isTabEvent(e) && !e.shiftKey;
1105
+ };
1106
+ var isKeyBackward = function isKeyBackward2(e) {
1107
+ return isTabEvent(e) && e.shiftKey;
1108
+ };
1109
+ var delay = function delay2(fn) {
1110
+ return setTimeout(fn, 0);
1111
+ };
1112
+ var findIndex = function findIndex2(arr, fn) {
1113
+ var idx = -1;
1114
+ arr.every(function(value, i) {
1115
+ if (fn(value)) {
1116
+ idx = i;
1117
+ return false;
1118
+ }
1119
+ return true;
1120
+ });
1121
+ return idx;
1122
+ };
1123
+ var valueOrHandler = function valueOrHandler2(value) {
1124
+ for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1125
+ params[_key - 1] = arguments[_key];
1126
+ }
1127
+ return typeof value === "function" ? value.apply(void 0, params) : value;
1128
+ };
1129
+ var getActualTarget = function getActualTarget2(event) {
1130
+ return event.target.shadowRoot && typeof event.composedPath === "function" ? event.composedPath()[0] : event.target;
1131
+ };
1132
+ var internalTrapStack = [];
1133
+ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
1134
+ var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;
1135
+ var trapStack = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.trapStack) || internalTrapStack;
1136
+ var config = _objectSpread2({
1137
+ returnFocusOnDeactivate: true,
1138
+ escapeDeactivates: true,
1139
+ delayInitialFocus: true,
1140
+ isKeyForward,
1141
+ isKeyBackward
1142
+ }, userOptions);
1143
+ var state = {
1144
+ // containers given to createFocusTrap()
1145
+ // @type {Array<HTMLElement>}
1146
+ containers: [],
1147
+ // list of objects identifying tabbable nodes in `containers` in the trap
1148
+ // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
1149
+ // is active, but the trap should never get to a state where there isn't at least one group
1150
+ // with at least one tabbable node in it (that would lead to an error condition that would
1151
+ // result in an error being thrown)
1152
+ // @type {Array<{
1153
+ // container: HTMLElement,
1154
+ // tabbableNodes: Array<HTMLElement>, // empty if none
1155
+ // focusableNodes: Array<HTMLElement>, // empty if none
1156
+ // posTabIndexesFound: boolean,
1157
+ // firstTabbableNode: HTMLElement|undefined,
1158
+ // lastTabbableNode: HTMLElement|undefined,
1159
+ // firstDomTabbableNode: HTMLElement|undefined,
1160
+ // lastDomTabbableNode: HTMLElement|undefined,
1161
+ // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
1162
+ // }>}
1163
+ containerGroups: [],
1164
+ // same order/length as `containers` list
1165
+ // references to objects in `containerGroups`, but only those that actually have
1166
+ // tabbable nodes in them
1167
+ // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
1168
+ // the same length
1169
+ tabbableGroups: [],
1170
+ nodeFocusedBeforeActivation: null,
1171
+ mostRecentlyFocusedNode: null,
1172
+ active: false,
1173
+ paused: false,
1174
+ // timer ID for when delayInitialFocus is true and initial focus in this trap
1175
+ // has been delayed during activation
1176
+ delayInitialFocusTimer: void 0,
1177
+ // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
1178
+ recentNavEvent: void 0
1179
+ };
1180
+ var trap;
1181
+ var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) {
1182
+ return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName];
1183
+ };
1184
+ var findContainerIndex = function findContainerIndex2(element, event) {
1185
+ var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === "function" ? event.composedPath() : void 0;
1186
+ return state.containerGroups.findIndex(function(_ref) {
1187
+ var container = _ref.container, tabbableNodes = _ref.tabbableNodes;
1188
+ return container.contains(element) || // fall back to explicit tabbable search which will take into consideration any
1189
+ // web components if the `tabbableOptions.getShadowRoot` option was used for
1190
+ // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
1191
+ // look inside web components even if open)
1192
+ (composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function(node) {
1193
+ return node === element;
1194
+ });
1195
+ });
1196
+ };
1197
+ var getNodeForOption = function getNodeForOption2(optionName) {
1198
+ var optionValue = config[optionName];
1199
+ if (typeof optionValue === "function") {
1200
+ for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1201
+ params[_key2 - 1] = arguments[_key2];
1202
+ }
1203
+ optionValue = optionValue.apply(void 0, params);
1204
+ }
1205
+ if (optionValue === true) {
1206
+ optionValue = void 0;
1207
+ }
1208
+ if (!optionValue) {
1209
+ if (optionValue === void 0 || optionValue === false) {
1210
+ return optionValue;
1211
+ }
1212
+ throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
1213
+ }
1214
+ var node = optionValue;
1215
+ if (typeof optionValue === "string") {
1216
+ node = doc.querySelector(optionValue);
1217
+ if (!node) {
1218
+ throw new Error("`".concat(optionName, "` as selector refers to no known node"));
1219
+ }
1220
+ }
1221
+ return node;
1222
+ };
1223
+ var getInitialFocusNode = function getInitialFocusNode2() {
1224
+ var node = getNodeForOption("initialFocus");
1225
+ if (node === false) {
1226
+ return false;
1227
+ }
1228
+ if (node === void 0 || !isFocusable2(node, config.tabbableOptions)) {
1229
+ if (findContainerIndex(doc.activeElement) >= 0) {
1230
+ node = doc.activeElement;
1231
+ } else {
1232
+ var firstTabbableGroup = state.tabbableGroups[0];
1233
+ var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
1234
+ node = firstTabbableNode || getNodeForOption("fallbackFocus");
1235
+ }
1236
+ }
1237
+ if (!node) {
1238
+ throw new Error("Your focus-trap needs to have at least one focusable element");
1239
+ }
1240
+ return node;
1241
+ };
1242
+ var updateTabbableNodes = function updateTabbableNodes2() {
1243
+ state.containerGroups = state.containers.map(function(container) {
1244
+ var tabbableNodes = tabbable(container, config.tabbableOptions);
1245
+ var focusableNodes = focusable(container, config.tabbableOptions);
1246
+ var firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : void 0;
1247
+ var lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : void 0;
1248
+ var firstDomTabbableNode = focusableNodes.find(function(node) {
1249
+ return isTabbable2(node);
1250
+ });
1251
+ var lastDomTabbableNode = focusableNodes.slice().reverse().find(function(node) {
1252
+ return isTabbable2(node);
1253
+ });
1254
+ var posTabIndexesFound = !!tabbableNodes.find(function(node) {
1255
+ return getTabIndex(node) > 0;
1256
+ });
1257
+ return {
1258
+ container,
1259
+ tabbableNodes,
1260
+ focusableNodes,
1261
+ /** True if at least one node with positive `tabindex` was found in this container. */
1262
+ posTabIndexesFound,
1263
+ /** First tabbable node in container, __tabindex__ order; `undefined` if none. */
1264
+ firstTabbableNode,
1265
+ /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
1266
+ lastTabbableNode,
1267
+ // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
1268
+ // would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
1269
+ // because that API doesn't work with Shadow DOM as well as it should (@see
1270
+ // https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
1271
+ // to address an edge case related to positive tabindex support, this seems like a much easier,
1272
+ // "close enough most of the time" alternative for positive tabindexes which should generally
1273
+ // be avoided anyway...
1274
+ /** First tabbable node in container, __DOM__ order; `undefined` if none. */
1275
+ firstDomTabbableNode,
1276
+ /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
1277
+ lastDomTabbableNode,
1278
+ /**
1279
+ * Finds the __tabbable__ node that follows the given node in the specified direction,
1280
+ * in this container, if any.
1281
+ * @param {HTMLElement} node
1282
+ * @param {boolean} [forward] True if going in forward tab order; false if going
1283
+ * in reverse.
1284
+ * @returns {HTMLElement|undefined} The next tabbable node, if any.
1285
+ */
1286
+ nextTabbableNode: function nextTabbableNode(node) {
1287
+ var forward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
1288
+ var nodeIdx = tabbableNodes.indexOf(node);
1289
+ if (nodeIdx < 0) {
1290
+ if (forward) {
1291
+ return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find(function(el) {
1292
+ return isTabbable2(el);
1293
+ });
1294
+ }
1295
+ return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function(el) {
1296
+ return isTabbable2(el);
1297
+ });
1298
+ }
1299
+ return tabbableNodes[nodeIdx + (forward ? 1 : -1)];
1300
+ }
1301
+ };
1302
+ });
1303
+ state.tabbableGroups = state.containerGroups.filter(function(group) {
1304
+ return group.tabbableNodes.length > 0;
1305
+ });
1306
+ if (state.tabbableGroups.length <= 0 && !getNodeForOption("fallbackFocus")) {
1307
+ throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
1308
+ }
1309
+ if (state.containerGroups.find(function(g) {
1310
+ return g.posTabIndexesFound;
1311
+ }) && state.containerGroups.length > 1) {
1312
+ throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
1313
+ }
1314
+ };
1315
+ var tryFocus = function tryFocus2(node) {
1316
+ if (node === false) {
1317
+ return;
1318
+ }
1319
+ if (node === doc.activeElement) {
1320
+ return;
1321
+ }
1322
+ if (!node || !node.focus) {
1323
+ tryFocus2(getInitialFocusNode());
1324
+ return;
1325
+ }
1326
+ node.focus({
1327
+ preventScroll: !!config.preventScroll
1328
+ });
1329
+ state.mostRecentlyFocusedNode = node;
1330
+ if (isSelectableInput(node)) {
1331
+ node.select();
1332
+ }
1333
+ };
1334
+ var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) {
1335
+ var node = getNodeForOption("setReturnFocus", previousActiveElement);
1336
+ return node ? node : node === false ? false : previousActiveElement;
1337
+ };
1338
+ var findNextNavNode = function findNextNavNode2(_ref2) {
1339
+ var target = _ref2.target, event = _ref2.event, _ref2$isBackward = _ref2.isBackward, isBackward = _ref2$isBackward === void 0 ? false : _ref2$isBackward;
1340
+ target = target || getActualTarget(event);
1341
+ updateTabbableNodes();
1342
+ var destinationNode = null;
1343
+ if (state.tabbableGroups.length > 0) {
1344
+ var containerIndex = findContainerIndex(target, event);
1345
+ var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : void 0;
1346
+ if (containerIndex < 0) {
1347
+ if (isBackward) {
1348
+ destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
1349
+ } else {
1350
+ destinationNode = state.tabbableGroups[0].firstTabbableNode;
1351
+ }
1352
+ } else if (isBackward) {
1353
+ var startOfGroupIndex = findIndex(state.tabbableGroups, function(_ref3) {
1354
+ var firstTabbableNode = _ref3.firstTabbableNode;
1355
+ return target === firstTabbableNode;
1356
+ });
1357
+ if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable2(target, config.tabbableOptions) && !isTabbable2(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
1358
+ startOfGroupIndex = containerIndex;
1359
+ }
1360
+ if (startOfGroupIndex >= 0) {
1361
+ var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
1362
+ var destinationGroup = state.tabbableGroups[destinationGroupIndex];
1363
+ destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode;
1364
+ } else if (!isTabEvent(event)) {
1365
+ destinationNode = containerGroup.nextTabbableNode(target, false);
1366
+ }
1367
+ } else {
1368
+ var lastOfGroupIndex = findIndex(state.tabbableGroups, function(_ref4) {
1369
+ var lastTabbableNode = _ref4.lastTabbableNode;
1370
+ return target === lastTabbableNode;
1371
+ });
1372
+ if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable2(target, config.tabbableOptions) && !isTabbable2(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
1373
+ lastOfGroupIndex = containerIndex;
1374
+ }
1375
+ if (lastOfGroupIndex >= 0) {
1376
+ var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
1377
+ var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
1378
+ destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode;
1379
+ } else if (!isTabEvent(event)) {
1380
+ destinationNode = containerGroup.nextTabbableNode(target);
1381
+ }
1382
+ }
1383
+ } else {
1384
+ destinationNode = getNodeForOption("fallbackFocus");
1385
+ }
1386
+ return destinationNode;
1387
+ };
1388
+ var checkPointerDown = function checkPointerDown2(e) {
1389
+ var target = getActualTarget(e);
1390
+ if (findContainerIndex(target, e) >= 0) {
1391
+ return;
1392
+ }
1393
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
1394
+ trap.deactivate({
1395
+ // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
1396
+ // which will result in the outside click setting focus to the node
1397
+ // that was clicked (and if not focusable, to "nothing"); by setting
1398
+ // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
1399
+ // on activation (or the configured `setReturnFocus` node), whether the
1400
+ // outside click was on a focusable node or not
1401
+ returnFocus: config.returnFocusOnDeactivate
1402
+ });
1403
+ return;
1404
+ }
1405
+ if (valueOrHandler(config.allowOutsideClick, e)) {
1406
+ return;
1407
+ }
1408
+ e.preventDefault();
1409
+ };
1410
+ var checkFocusIn = function checkFocusIn2(event) {
1411
+ var target = getActualTarget(event);
1412
+ var targetContained = findContainerIndex(target, event) >= 0;
1413
+ if (targetContained || target instanceof Document) {
1414
+ if (targetContained) {
1415
+ state.mostRecentlyFocusedNode = target;
1416
+ }
1417
+ } else {
1418
+ event.stopImmediatePropagation();
1419
+ var nextNode;
1420
+ var navAcrossContainers = true;
1421
+ if (state.mostRecentlyFocusedNode) {
1422
+ if (getTabIndex(state.mostRecentlyFocusedNode) > 0) {
1423
+ var mruContainerIdx = findContainerIndex(state.mostRecentlyFocusedNode);
1424
+ var tabbableNodes = state.containerGroups[mruContainerIdx].tabbableNodes;
1425
+ if (tabbableNodes.length > 0) {
1426
+ var mruTabIdx = tabbableNodes.findIndex(function(node) {
1427
+ return node === state.mostRecentlyFocusedNode;
1428
+ });
1429
+ if (mruTabIdx >= 0) {
1430
+ if (config.isKeyForward(state.recentNavEvent)) {
1431
+ if (mruTabIdx + 1 < tabbableNodes.length) {
1432
+ nextNode = tabbableNodes[mruTabIdx + 1];
1433
+ navAcrossContainers = false;
1434
+ }
1435
+ } else {
1436
+ if (mruTabIdx - 1 >= 0) {
1437
+ nextNode = tabbableNodes[mruTabIdx - 1];
1438
+ navAcrossContainers = false;
1439
+ }
1440
+ }
1441
+ }
1442
+ }
1443
+ } else {
1444
+ if (!state.containerGroups.some(function(g) {
1445
+ return g.tabbableNodes.some(function(n) {
1446
+ return getTabIndex(n) > 0;
1447
+ });
1448
+ })) {
1449
+ navAcrossContainers = false;
1450
+ }
1451
+ }
1452
+ } else {
1453
+ navAcrossContainers = false;
1454
+ }
1455
+ if (navAcrossContainers) {
1456
+ nextNode = findNextNavNode({
1457
+ // move FROM the MRU node, not event-related node (which will be the node that is
1458
+ // outside the trap causing the focus escape we're trying to fix)
1459
+ target: state.mostRecentlyFocusedNode,
1460
+ isBackward: config.isKeyBackward(state.recentNavEvent)
1461
+ });
1462
+ }
1463
+ if (nextNode) {
1464
+ tryFocus(nextNode);
1465
+ } else {
1466
+ tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
1467
+ }
1468
+ }
1469
+ state.recentNavEvent = void 0;
1470
+ };
1471
+ var checkKeyNav = function checkKeyNav2(event) {
1472
+ var isBackward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
1473
+ state.recentNavEvent = event;
1474
+ var destinationNode = findNextNavNode({
1475
+ event,
1476
+ isBackward
1477
+ });
1478
+ if (destinationNode) {
1479
+ if (isTabEvent(event)) {
1480
+ event.preventDefault();
1481
+ }
1482
+ tryFocus(destinationNode);
1483
+ }
1484
+ };
1485
+ var checkKey = function checkKey2(event) {
1486
+ if (isEscapeEvent(event) && valueOrHandler(config.escapeDeactivates, event) !== false) {
1487
+ event.preventDefault();
1488
+ trap.deactivate();
1489
+ return;
1490
+ }
1491
+ if (config.isKeyForward(event) || config.isKeyBackward(event)) {
1492
+ checkKeyNav(event, config.isKeyBackward(event));
1493
+ }
1494
+ };
1495
+ var checkClick = function checkClick2(e) {
1496
+ var target = getActualTarget(e);
1497
+ if (findContainerIndex(target, e) >= 0) {
1498
+ return;
1499
+ }
1500
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
1501
+ return;
1502
+ }
1503
+ if (valueOrHandler(config.allowOutsideClick, e)) {
1504
+ return;
1505
+ }
1506
+ e.preventDefault();
1507
+ e.stopImmediatePropagation();
1508
+ };
1509
+ var addListeners = function addListeners2() {
1510
+ if (!state.active) {
1511
+ return;
1512
+ }
1513
+ activeFocusTraps.activateTrap(trapStack, trap);
1514
+ state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function() {
1515
+ tryFocus(getInitialFocusNode());
1516
+ }) : tryFocus(getInitialFocusNode());
1517
+ doc.addEventListener("focusin", checkFocusIn, true);
1518
+ doc.addEventListener("mousedown", checkPointerDown, {
1519
+ capture: true,
1520
+ passive: false
1521
+ });
1522
+ doc.addEventListener("touchstart", checkPointerDown, {
1523
+ capture: true,
1524
+ passive: false
1525
+ });
1526
+ doc.addEventListener("click", checkClick, {
1527
+ capture: true,
1528
+ passive: false
1529
+ });
1530
+ doc.addEventListener("keydown", checkKey, {
1531
+ capture: true,
1532
+ passive: false
1533
+ });
1534
+ return trap;
1535
+ };
1536
+ var removeListeners = function removeListeners2() {
1537
+ if (!state.active) {
1538
+ return;
1539
+ }
1540
+ doc.removeEventListener("focusin", checkFocusIn, true);
1541
+ doc.removeEventListener("mousedown", checkPointerDown, true);
1542
+ doc.removeEventListener("touchstart", checkPointerDown, true);
1543
+ doc.removeEventListener("click", checkClick, true);
1544
+ doc.removeEventListener("keydown", checkKey, true);
1545
+ return trap;
1546
+ };
1547
+ var checkDomRemoval = function checkDomRemoval2(mutations) {
1548
+ var isFocusedNodeRemoved = mutations.some(function(mutation) {
1549
+ var removedNodes = Array.from(mutation.removedNodes);
1550
+ return removedNodes.some(function(node) {
1551
+ return node === state.mostRecentlyFocusedNode;
1552
+ });
1553
+ });
1554
+ if (isFocusedNodeRemoved) {
1555
+ tryFocus(getInitialFocusNode());
1556
+ }
1557
+ };
1558
+ var mutationObserver = typeof window !== "undefined" && "MutationObserver" in window ? new MutationObserver(checkDomRemoval) : void 0;
1559
+ var updateObservedNodes = function updateObservedNodes2() {
1560
+ if (!mutationObserver) {
1561
+ return;
1562
+ }
1563
+ mutationObserver.disconnect();
1564
+ if (state.active && !state.paused) {
1565
+ state.containers.map(function(container) {
1566
+ mutationObserver.observe(container, {
1567
+ subtree: true,
1568
+ childList: true
1569
+ });
1570
+ });
1571
+ }
1572
+ };
1573
+ trap = {
1574
+ get active() {
1575
+ return state.active;
1576
+ },
1577
+ get paused() {
1578
+ return state.paused;
1579
+ },
1580
+ activate: function activate(activateOptions) {
1581
+ if (state.active) {
1582
+ return this;
1583
+ }
1584
+ var onActivate = getOption(activateOptions, "onActivate");
1585
+ var onPostActivate = getOption(activateOptions, "onPostActivate");
1586
+ var checkCanFocusTrap = getOption(activateOptions, "checkCanFocusTrap");
1587
+ if (!checkCanFocusTrap) {
1588
+ updateTabbableNodes();
1589
+ }
1590
+ state.active = true;
1591
+ state.paused = false;
1592
+ state.nodeFocusedBeforeActivation = doc.activeElement;
1593
+ onActivate === null || onActivate === void 0 ? void 0 : onActivate();
1594
+ var finishActivation = function finishActivation2() {
1595
+ if (checkCanFocusTrap) {
1596
+ updateTabbableNodes();
1597
+ }
1598
+ addListeners();
1599
+ updateObservedNodes();
1600
+ onPostActivate === null || onPostActivate === void 0 ? void 0 : onPostActivate();
1601
+ };
1602
+ if (checkCanFocusTrap) {
1603
+ checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
1604
+ return this;
1605
+ }
1606
+ finishActivation();
1607
+ return this;
1608
+ },
1609
+ deactivate: function deactivate(deactivateOptions) {
1610
+ if (!state.active) {
1611
+ return this;
1612
+ }
1613
+ var options = _objectSpread2({
1614
+ onDeactivate: config.onDeactivate,
1615
+ onPostDeactivate: config.onPostDeactivate,
1616
+ checkCanReturnFocus: config.checkCanReturnFocus
1617
+ }, deactivateOptions);
1618
+ clearTimeout(state.delayInitialFocusTimer);
1619
+ state.delayInitialFocusTimer = void 0;
1620
+ removeListeners();
1621
+ state.active = false;
1622
+ state.paused = false;
1623
+ updateObservedNodes();
1624
+ activeFocusTraps.deactivateTrap(trapStack, trap);
1625
+ var onDeactivate = getOption(options, "onDeactivate");
1626
+ var onPostDeactivate = getOption(options, "onPostDeactivate");
1627
+ var checkCanReturnFocus = getOption(options, "checkCanReturnFocus");
1628
+ var returnFocus = getOption(options, "returnFocus", "returnFocusOnDeactivate");
1629
+ onDeactivate === null || onDeactivate === void 0 ? void 0 : onDeactivate();
1630
+ var finishDeactivation = function finishDeactivation2() {
1631
+ delay(function() {
1632
+ if (returnFocus) {
1633
+ tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
1634
+ }
1635
+ onPostDeactivate === null || onPostDeactivate === void 0 ? void 0 : onPostDeactivate();
1636
+ });
1637
+ };
1638
+ if (returnFocus && checkCanReturnFocus) {
1639
+ checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
1640
+ return this;
1641
+ }
1642
+ finishDeactivation();
1643
+ return this;
1644
+ },
1645
+ pause: function pause(pauseOptions) {
1646
+ if (state.paused || !state.active) {
1647
+ return this;
1648
+ }
1649
+ var onPause = getOption(pauseOptions, "onPause");
1650
+ var onPostPause = getOption(pauseOptions, "onPostPause");
1651
+ state.paused = true;
1652
+ onPause === null || onPause === void 0 ? void 0 : onPause();
1653
+ removeListeners();
1654
+ updateObservedNodes();
1655
+ onPostPause === null || onPostPause === void 0 ? void 0 : onPostPause();
1656
+ return this;
1657
+ },
1658
+ unpause: function unpause(unpauseOptions) {
1659
+ if (!state.paused || !state.active) {
1660
+ return this;
1661
+ }
1662
+ var onUnpause = getOption(unpauseOptions, "onUnpause");
1663
+ var onPostUnpause = getOption(unpauseOptions, "onPostUnpause");
1664
+ state.paused = false;
1665
+ onUnpause === null || onUnpause === void 0 ? void 0 : onUnpause();
1666
+ updateTabbableNodes();
1667
+ addListeners();
1668
+ updateObservedNodes();
1669
+ onPostUnpause === null || onPostUnpause === void 0 ? void 0 : onPostUnpause();
1670
+ return this;
1671
+ },
1672
+ updateContainerElements: function updateContainerElements(containerElements) {
1673
+ var elementsAsArray = [].concat(containerElements).filter(Boolean);
1674
+ state.containers = elementsAsArray.map(function(element) {
1675
+ return typeof element === "string" ? doc.querySelector(element) : element;
1676
+ });
1677
+ if (state.active) {
1678
+ updateTabbableNodes();
1679
+ }
1680
+ updateObservedNodes();
1681
+ return this;
1682
+ }
1683
+ };
1684
+ trap.updateContainerElements(elements);
1685
+ return trap;
1686
+ };
1687
+
1688
+ // ../../node_modules/.pnpm/@zag-js+popover@0.19.1/node_modules/@zag-js/popover/dist/index.mjs
1689
+ var anatomy = createAnatomy("popover").parts(
1690
+ "arrow",
1691
+ "arrowTip",
1692
+ "anchor",
1693
+ "trigger",
1694
+ "positioner",
1695
+ "content",
1696
+ "title",
1697
+ "description",
1698
+ "closeTrigger"
1699
+ );
1700
+ var parts = anatomy.build();
1701
+ var dom = createScope({
1702
+ getActiveEl: (ctx) => dom.getDoc(ctx).activeElement,
1703
+ getAnchorId: (ctx) => ctx.ids?.anchor ?? `popover:${ctx.id}:anchor`,
1704
+ getTriggerId: (ctx) => ctx.ids?.trigger ?? `popover:${ctx.id}:trigger`,
1705
+ getContentId: (ctx) => ctx.ids?.content ?? `popover:${ctx.id}:content`,
1706
+ getPositionerId: (ctx) => ctx.ids?.positioner ?? `popover:${ctx.id}:popper`,
1707
+ getArrowId: (ctx) => ctx.ids?.arrow ?? `popover:${ctx.id}:arrow`,
1708
+ getTitleId: (ctx) => ctx.ids?.title ?? `popover:${ctx.id}:title`,
1709
+ getDescriptionId: (ctx) => ctx.ids?.description ?? `popover:${ctx.id}:desc`,
1710
+ getCloseTriggerId: (ctx) => ctx.ids?.closeTrigger ?? `popover:${ctx.id}:close`,
1711
+ getAnchorEl: (ctx) => dom.getById(ctx, dom.getAnchorId(ctx)),
1712
+ getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
1713
+ getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
1714
+ getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
1715
+ getTitleEl: (ctx) => dom.getById(ctx, dom.getTitleId(ctx)),
1716
+ getDescriptionEl: (ctx) => dom.getById(ctx, dom.getDescriptionId(ctx)),
1717
+ getFocusableEls: (ctx) => getFocusables(dom.getContentEl(ctx)),
1718
+ getFirstFocusableEl: (ctx) => dom.getFocusableEls(ctx)[0],
1719
+ getDocTabbableEls: (ctx) => getTabbables(dom.getDoc(ctx).body),
1720
+ getTabbableEls: (ctx) => getTabbables(dom.getContentEl(ctx), "if-empty"),
1721
+ getFirstTabbableEl: (ctx) => getFirstTabbable(dom.getContentEl(ctx), "if-empty"),
1722
+ getLastTabbableEl: (ctx) => getLastTabbable(dom.getContentEl(ctx), "if-empty"),
1723
+ getInitialFocusEl: (ctx) => {
1724
+ let el = runIfFn(ctx.initialFocusEl);
1725
+ if (!el && ctx.autoFocus)
1726
+ el = dom.getFirstFocusableEl(ctx);
1727
+ if (!el)
1728
+ el = dom.getContentEl(ctx);
1729
+ return el;
1730
+ }
1731
+ });
1732
+ function connect(state, send, normalize) {
1733
+ const isOpen = state.matches("open");
1734
+ const currentPlacement = state.context.currentPlacement;
1735
+ const portalled = state.context.currentPortalled;
1736
+ const rendered = state.context.renderedElements;
1737
+ const popperStyles = getPlacementStyles({
1738
+ ...state.context.positioning,
1739
+ placement: currentPlacement
1740
+ });
1741
+ return {
1742
+ portalled,
1743
+ isOpen,
1744
+ open() {
1745
+ send("OPEN");
1746
+ },
1747
+ close() {
1748
+ send("CLOSE");
1749
+ },
1750
+ setPositioning(options = {}) {
1751
+ send({ type: "SET_POSITIONING", options });
1752
+ },
1753
+ arrowProps: normalize.element({
1754
+ id: dom.getArrowId(state.context),
1755
+ ...parts.arrow.attrs,
1756
+ style: popperStyles.arrow
1757
+ }),
1758
+ arrowTipProps: normalize.element({
1759
+ ...parts.arrowTip.attrs,
1760
+ style: popperStyles.arrowTip
1761
+ }),
1762
+ anchorProps: normalize.element({
1763
+ ...parts.anchor.attrs,
1764
+ id: dom.getAnchorId(state.context)
1765
+ }),
1766
+ triggerProps: normalize.button({
1767
+ ...parts.trigger.attrs,
1768
+ type: "button",
1769
+ "data-placement": currentPlacement,
1770
+ id: dom.getTriggerId(state.context),
1771
+ "aria-haspopup": "dialog",
1772
+ "aria-expanded": isOpen,
1773
+ "data-state": isOpen ? "open" : "closed",
1774
+ "aria-controls": dom.getContentId(state.context),
1775
+ onClick() {
1776
+ send("TOGGLE");
1777
+ },
1778
+ onBlur(event) {
1779
+ send({ type: "TRIGGER_BLUR", target: event.relatedTarget });
1780
+ }
1781
+ }),
1782
+ positionerProps: normalize.element({
1783
+ id: dom.getPositionerId(state.context),
1784
+ ...parts.positioner.attrs,
1785
+ style: popperStyles.floating
1786
+ }),
1787
+ contentProps: normalize.element({
1788
+ ...parts.content.attrs,
1789
+ id: dom.getContentId(state.context),
1790
+ tabIndex: -1,
1791
+ role: "dialog",
1792
+ hidden: !isOpen,
1793
+ "data-state": isOpen ? "open" : "closed",
1794
+ "data-expanded": dataAttr(isOpen),
1795
+ "aria-labelledby": rendered.title ? dom.getTitleId(state.context) : void 0,
1796
+ "aria-describedby": rendered.description ? dom.getDescriptionId(state.context) : void 0,
1797
+ "data-placement": currentPlacement
1798
+ }),
1799
+ titleProps: normalize.element({
1800
+ ...parts.title.attrs,
1801
+ id: dom.getTitleId(state.context)
1802
+ }),
1803
+ descriptionProps: normalize.element({
1804
+ ...parts.description.attrs,
1805
+ id: dom.getDescriptionId(state.context)
1806
+ }),
1807
+ closeTriggerProps: normalize.button({
1808
+ ...parts.closeTrigger.attrs,
1809
+ id: dom.getCloseTriggerId(state.context),
1810
+ type: "button",
1811
+ "aria-label": "close",
1812
+ onClick() {
1813
+ send("REQUEST_CLOSE");
1814
+ }
1815
+ })
1816
+ };
1817
+ }
1818
+ function machine(userContext) {
1819
+ const ctx = compact(userContext);
1820
+ return createMachine(
1821
+ {
1822
+ id: "popover",
1823
+ initial: ctx.open ? "open" : "closed",
1824
+ context: {
1825
+ closeOnInteractOutside: true,
1826
+ closeOnEsc: true,
1827
+ autoFocus: true,
1828
+ modal: false,
1829
+ portalled: true,
1830
+ positioning: {
1831
+ placement: "bottom",
1832
+ ...ctx.positioning
1833
+ },
1834
+ currentPlacement: void 0,
1835
+ ...ctx,
1836
+ renderedElements: {
1837
+ title: true,
1838
+ description: true
1839
+ }
1840
+ },
1841
+ computed: {
1842
+ currentPortalled: (ctx2) => !!ctx2.modal || !!ctx2.portalled
1843
+ },
1844
+ watch: {
1845
+ open: ["toggleVisibility"]
1846
+ },
1847
+ entry: ["checkRenderedElements"],
1848
+ states: {
1849
+ closed: {
1850
+ on: {
1851
+ TOGGLE: {
1852
+ target: "open",
1853
+ actions: ["invokeOnOpen"]
1854
+ },
1855
+ OPEN: {
1856
+ target: "open",
1857
+ actions: ["invokeOnOpen"]
1858
+ }
1859
+ }
1860
+ },
1861
+ open: {
1862
+ activities: [
1863
+ "trapFocus",
1864
+ "preventScroll",
1865
+ "hideContentBelow",
1866
+ "trackPositioning",
1867
+ "trackDismissableElement",
1868
+ "proxyTabFocus"
1869
+ ],
1870
+ entry: ["setInitialFocus"],
1871
+ on: {
1872
+ CLOSE: {
1873
+ target: "closed",
1874
+ actions: ["invokeOnClose"]
1875
+ },
1876
+ REQUEST_CLOSE: {
1877
+ target: "closed",
1878
+ actions: ["restoreFocusIfNeeded", "invokeOnClose"]
1879
+ },
1880
+ TOGGLE: {
1881
+ target: "closed",
1882
+ actions: ["invokeOnClose"]
1883
+ },
1884
+ SET_POSITIONING: {
1885
+ actions: "setPositioning"
1886
+ }
1887
+ }
1888
+ }
1889
+ }
1890
+ },
1891
+ {
1892
+ activities: {
1893
+ trackPositioning(ctx2) {
1894
+ ctx2.currentPlacement = ctx2.positioning.placement;
1895
+ const anchorEl = dom.getAnchorEl(ctx2) ?? dom.getTriggerEl(ctx2);
1896
+ const getPositionerEl = () => dom.getPositionerEl(ctx2);
1897
+ return getPlacement(anchorEl, getPositionerEl, {
1898
+ ...ctx2.positioning,
1899
+ defer: true,
1900
+ onComplete(data) {
1901
+ ctx2.currentPlacement = data.placement;
1902
+ },
1903
+ onCleanup() {
1904
+ ctx2.currentPlacement = void 0;
1905
+ }
1906
+ });
1907
+ },
1908
+ trackDismissableElement(ctx2, _evt, { send }) {
1909
+ const getContentEl = () => dom.getContentEl(ctx2);
1910
+ let restoreFocus = true;
1911
+ return trackDismissableElement(getContentEl, {
1912
+ pointerBlocking: ctx2.modal,
1913
+ exclude: dom.getTriggerEl(ctx2),
1914
+ defer: true,
1915
+ onEscapeKeyDown(event) {
1916
+ ctx2.onEscapeKeyDown?.(event);
1917
+ if (ctx2.closeOnEsc)
1918
+ return;
1919
+ event.preventDefault();
1920
+ },
1921
+ onInteractOutside(event) {
1922
+ ctx2.onInteractOutside?.(event);
1923
+ if (event.defaultPrevented)
1924
+ return;
1925
+ restoreFocus = !(event.detail.focusable || event.detail.contextmenu);
1926
+ if (!ctx2.closeOnInteractOutside) {
1927
+ event.preventDefault();
1928
+ }
1929
+ },
1930
+ onPointerDownOutside: ctx2.onPointerDownOutside,
1931
+ onFocusOutside: ctx2.onFocusOutside,
1932
+ onDismiss() {
1933
+ send({ type: "REQUEST_CLOSE", src: "interact-outside", restoreFocus });
1934
+ }
1935
+ });
1936
+ },
1937
+ proxyTabFocus(ctx2) {
1938
+ if (ctx2.modal || !ctx2.portalled)
1939
+ return;
1940
+ const getContentEl = () => dom.getContentEl(ctx2);
1941
+ return proxyTabFocus(getContentEl, {
1942
+ triggerElement: dom.getTriggerEl(ctx2),
1943
+ defer: true,
1944
+ onFocus(el) {
1945
+ el.focus({ preventScroll: true });
1946
+ }
1947
+ });
1948
+ },
1949
+ hideContentBelow(ctx2) {
1950
+ if (!ctx2.modal)
1951
+ return;
1952
+ const getElements = () => [dom.getContentEl(ctx2), dom.getTriggerEl(ctx2)];
1953
+ return ariaHidden(getElements, { defer: true });
1954
+ },
1955
+ preventScroll(ctx2) {
1956
+ if (!ctx2.modal)
1957
+ return;
1958
+ return preventBodyScroll(dom.getDoc(ctx2));
1959
+ },
1960
+ trapFocus(ctx2) {
1961
+ if (!ctx2.modal)
1962
+ return;
1963
+ let trap;
1964
+ nextTick(() => {
1965
+ const el = dom.getContentEl(ctx2);
1966
+ if (!el)
1967
+ return;
1968
+ trap = createFocusTrap(el, {
1969
+ escapeDeactivates: false,
1970
+ allowOutsideClick: true,
1971
+ preventScroll: true,
1972
+ returnFocusOnDeactivate: true,
1973
+ document: dom.getDoc(ctx2),
1974
+ fallbackFocus: el,
1975
+ initialFocus: runIfFn(ctx2.initialFocusEl)
1976
+ });
1977
+ try {
1978
+ trap.activate();
1979
+ } catch {
1980
+ }
1981
+ });
1982
+ return () => trap?.deactivate();
1983
+ }
1984
+ },
1985
+ actions: {
1986
+ setPositioning(ctx2, evt) {
1987
+ const anchorEl = dom.getAnchorEl(ctx2) ?? dom.getTriggerEl(ctx2);
1988
+ const getPositionerEl = () => dom.getPositionerEl(ctx2);
1989
+ getPlacement(anchorEl, getPositionerEl, {
1990
+ ...ctx2.positioning,
1991
+ ...evt.options,
1992
+ defer: true,
1993
+ listeners: false
1994
+ });
1995
+ },
1996
+ checkRenderedElements(ctx2) {
1997
+ raf(() => {
1998
+ Object.assign(ctx2.renderedElements, {
1999
+ title: !!dom.getTitleEl(ctx2),
2000
+ description: !!dom.getDescriptionEl(ctx2)
2001
+ });
2002
+ });
2003
+ },
2004
+ setInitialFocus(ctx2) {
2005
+ raf(() => {
2006
+ dom.getInitialFocusEl(ctx2)?.focus({ preventScroll: true });
2007
+ });
2008
+ },
2009
+ restoreFocusIfNeeded(ctx2, evt) {
2010
+ if (!evt.restoreFocus)
2011
+ return;
2012
+ raf(() => {
2013
+ dom.getTriggerEl(ctx2)?.focus({ preventScroll: true });
2014
+ });
2015
+ },
2016
+ invokeOnOpen(ctx2) {
2017
+ ctx2.onOpen?.();
2018
+ },
2019
+ invokeOnClose(ctx2) {
2020
+ ctx2.onClose?.();
2021
+ },
2022
+ toggleVisibility(ctx2, _evt, { send }) {
2023
+ send({ type: ctx2.open ? "OPEN" : "CLOSE", src: "controlled" });
2024
+ }
2025
+ }
2026
+ }
2027
+ );
2028
+ }
2029
+
2030
+ // ../../node_modules/.pnpm/@cfx-kit+ui-components@0.0.18_@zag-js+accordion@0.19.1_@zag-js+checkbox@0.19.1_@zag-js+dialog_toqhwacqm4ck723ovqekq5mm7u/node_modules/@cfx-kit/ui-components/dist/Popover.js
2031
+ import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
2032
+ var Popover = (_a) => {
2033
+ var _b = _a, {
2034
+ id,
2035
+ open,
2036
+ closeOnEsc = true,
2037
+ closeOnInteractOutside = true,
2038
+ arrow = false,
2039
+ children,
2040
+ containerClassName,
2041
+ trigger
2042
+ } = _b, props = __objRest(_b, [
2043
+ "id",
2044
+ "open",
2045
+ "closeOnEsc",
2046
+ "closeOnInteractOutside",
2047
+ "arrow",
2048
+ "children",
2049
+ "containerClassName",
2050
+ "trigger"
2051
+ ]);
2052
+ const uniqueId = useId();
2053
+ const [state, send] = useMachine(machine(__spreadValues({ id: id != null ? id : uniqueId, closeOnEsc, closeOnInteractOutside }, props)));
2054
+ const api = connect(state, send, normalizeProps);
2055
+ const Wrapper = useMemo(() => api.portalled ? Portal : Fragment, [api.portalled]);
2056
+ useEffect(() => {
2057
+ if (open === true) {
2058
+ api.open();
2059
+ } else {
2060
+ api.close();
2061
+ }
2062
+ }, [open]);
2063
+ return /* @__PURE__ */ jsxs(Fragment2, { children: [
2064
+ typeof trigger === "function" ? trigger({ triggerProps: api.triggerProps, isOpen: api.isOpen }) : null,
2065
+ api.isOpen && /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ className: `ui-popover${containerClassName ? ` ${containerClassName}` : ""}` }, api.positionerProps), { children: [
2066
+ arrow && /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, api.arrowProps), { children: /* @__PURE__ */ jsx("div", __spreadValues({}, api.arrowTipProps)) })),
2067
+ typeof children === "function" && children({ contentProps: api.contentProps, closeTriggerProps: api.closeTriggerProps, close: api.close }),
2068
+ typeof children !== "function" ? Children.count(children) === 1 && isValidElement(children) ? cloneElement(children, __spreadValues({}, api.contentProps)) : /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, api.contentProps), { children })) : null
2069
+ ] })) })
2070
+ ] });
2071
+ };
2072
+ var Popover_default = Popover;
2073
+
2074
+ // src/components/Popover/index.tsx
2075
+ import clsx from "clsx";
2076
+ import { jsx as jsx2 } from "react/jsx-runtime";
2077
+ var Popover2 = ({
2078
+ content,
2079
+ children = null,
2080
+ positioning = {},
2081
+ className,
2082
+ containerClassName,
2083
+ arrow = true,
2084
+ ...rest
2085
+ }) => {
2086
+ const { placement = "top" } = positioning;
2087
+ const triggerRef = useRef(null);
2088
+ return /* @__PURE__ */ jsx2(
2089
+ Popover_default,
2090
+ {
2091
+ trigger: ({ triggerProps }) => {
2092
+ return /* @__PURE__ */ jsx2(
2093
+ "span",
2094
+ {
2095
+ ref: triggerRef,
2096
+ ...content ? triggerProps : {},
2097
+ className: cn(
2098
+ "sirius-popover-trigger",
2099
+ className,
2100
+ triggerProps.className
2101
+ ),
2102
+ children
2103
+ }
2104
+ );
2105
+ },
2106
+ containerClassName: clsx(
2107
+ "sirius-popover-container",
2108
+ "text-#333 text-14px lh-[1.5715] font-400 ws-normal cursor-auto text-left select-text absolute top-0 left-0 z-1030 text-transform-none filter-drop-shadow",
2109
+ "[&>[data-part=arrow]]:[--arrow-size:12px] [&>[data-part=arrow]]:[--arrow-background:#fff] [&>[data-part=arrow]]:[--arrow-shadow-color:gray]",
2110
+ containerClassName
2111
+ ),
2112
+ ...rest,
2113
+ positioning: {
2114
+ ...positioning,
2115
+ placement
2116
+ },
2117
+ arrow,
2118
+ children: ({ contentProps }) => {
2119
+ return /* @__PURE__ */ jsx2(
2120
+ "div",
2121
+ {
2122
+ className: "sirius-popover-content px-12px py-16px shadow decoration-none rounded-5px bg-#fff bg-clip-padding",
2123
+ ...contentProps,
2124
+ children: content
2125
+ }
2126
+ );
2127
+ }
2128
+ }
2129
+ );
2130
+ };
2131
+
2132
+ export {
2133
+ Popover2 as Popover
2134
+ };
2135
+ /*! Bundled license information:
2136
+
2137
+ tabbable/dist/index.esm.js:
2138
+ (*!
2139
+ * tabbable 6.2.0
2140
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
2141
+ *)
2142
+
2143
+ focus-trap/dist/focus-trap.esm.js:
2144
+ (*!
2145
+ * focus-trap 7.5.2
2146
+ * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
2147
+ *)
2148
+ */
2149
+ //# sourceMappingURL=chunk-3PF5QYAQ.js.map