@dooherceg/tiptap-controlled-editor-with-table 0.0.7 → 0.0.8

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 (112) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +8 -0
  2. package/dist/_virtual/index.js +7 -0
  3. package/dist/assets/components/tiptap-node/blockquote-node/blockquote-node.css +1 -0
  4. package/dist/assets/components/tiptap-node/code-block-node/code-block-node.css +1 -0
  5. package/dist/assets/components/tiptap-node/heading-node/heading-node.css +1 -0
  6. package/dist/assets/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.css +1 -0
  7. package/dist/assets/components/tiptap-node/image-node/image-node.css +1 -0
  8. package/dist/assets/components/tiptap-node/list-node/list-node.css +1 -0
  9. package/dist/assets/components/tiptap-node/paragraph-node/paragraph-node.css +1 -0
  10. package/dist/assets/components/tiptap-templates/simple/simple-editor.css +1 -0
  11. package/dist/assets/{badge.css → components/tiptap-ui-primitive/badge/badge-colors.css} +1 -1
  12. package/dist/assets/components/tiptap-ui-primitive/badge/badge-group.css +1 -0
  13. package/dist/assets/components/tiptap-ui-primitive/badge/badge.css +1 -0
  14. package/dist/assets/{button.css → components/tiptap-ui-primitive/button/button-colors.css} +1 -1
  15. package/dist/assets/components/tiptap-ui-primitive/button/button-group.css +1 -0
  16. package/dist/assets/components/tiptap-ui-primitive/button/button.css +1 -0
  17. package/dist/assets/styles/_keyframe-animations.css +1 -0
  18. package/dist/assets/styles/_variables.css +1 -0
  19. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js +6 -58
  20. package/dist/components/tiptap-node/image-upload-node/image-upload-node.js +4 -3
  21. package/dist/components/tiptap-templates/simple/simple-editor.js +159 -1898
  22. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.js +6 -5
  23. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.js +1 -1
  24. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.js +16 -16
  25. package/dist/components/tiptap-ui-primitive/badge/badge.js +19 -16
  26. package/dist/components/tiptap-ui-primitive/button/button.js +18 -15
  27. package/dist/components/tiptap-ui-primitive/card/card.js +13 -12
  28. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.js +39 -1012
  29. package/dist/components/tiptap-ui-primitive/input/input.js +7 -6
  30. package/dist/components/tiptap-ui-primitive/popover/popover.js +24 -233
  31. package/dist/components/tiptap-ui-primitive/separator/separator.js +9 -8
  32. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.js +2 -1
  33. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.js +84 -1330
  34. package/dist/hooks/use-throttled-callback.js +13 -108
  35. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +527 -0
  36. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +402 -0
  37. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.js +932 -0
  38. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +185 -0
  39. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +208 -0
  40. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
  41. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +130 -0
  42. package/dist/node_modules/@radix-ui/primitive/dist/index.js +9 -0
  43. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +24 -0
  44. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +48 -0
  45. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +29 -0
  46. package/dist/node_modules/@radix-ui/react-context/dist/index.js +53 -0
  47. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +10 -0
  48. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +127 -0
  49. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +221 -0
  50. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +17 -0
  51. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +136 -0
  52. package/dist/node_modules/@radix-ui/react-id/dist/index.js +13 -0
  53. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +636 -0
  54. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +239 -0
  55. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +219 -0
  56. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +15 -0
  57. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +70 -0
  58. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +36 -0
  59. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +183 -0
  60. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +49 -0
  61. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +10 -0
  62. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +52 -0
  63. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +14 -0
  64. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +6 -0
  65. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +27 -0
  66. package/dist/node_modules/@tiptap/extension-highlight/dist/index.js +84 -0
  67. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +57 -0
  68. package/dist/node_modules/@tiptap/extension-image/dist/index.js +128 -0
  69. package/dist/node_modules/@tiptap/extension-list/dist/index.js +713 -0
  70. package/dist/node_modules/@tiptap/extension-subscript/dist/index.js +40 -0
  71. package/dist/node_modules/@tiptap/extension-superscript/dist/index.js +40 -0
  72. package/dist/node_modules/@tiptap/extension-table/dist/index.js +380 -0
  73. package/dist/node_modules/@tiptap/extension-text-align/dist/index.js +46 -0
  74. package/dist/node_modules/@tiptap/extension-typography/dist/index.js +125 -0
  75. package/dist/node_modules/@tiptap/extensions/dist/index.js +288 -0
  76. package/dist/node_modules/aria-hidden/dist/es2015/index.js +52 -0
  77. package/dist/node_modules/get-nonce/dist/es2015/index.js +7 -0
  78. package/dist/node_modules/lodash.throttle/index.js +95 -0
  79. package/dist/{index-Bqw9S4qP.js → node_modules/react-hotkeys-hook/packages/react-hotkeys-hook/dist/index.js} +57 -55
  80. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +11 -0
  81. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +112 -0
  82. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +31 -0
  83. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +16 -0
  84. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +68 -0
  85. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
  86. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
  87. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +71 -0
  88. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +7 -0
  89. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +25 -0
  90. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +11 -0
  91. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +15 -0
  92. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +30 -0
  93. package/dist/node_modules/tabbable/dist/index.esm.js +197 -0
  94. package/dist/node_modules/tslib/tslib.es6.js +27 -0
  95. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +6 -0
  96. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +26 -0
  97. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +25 -0
  98. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +18 -0
  99. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +67 -0
  100. package/package.json +1 -1
  101. package/dist/Combination-CO0ZtURs.js +0 -1333
  102. package/dist/assets/simple-editor.css +0 -1
  103. package/dist/floating-ui.react-dom-DgOuULHo.js +0 -1334
  104. /package/dist/assets/{image-upload-node.css → components/tiptap-node/image-upload-node/image-upload-node.css} +0 -0
  105. /package/dist/assets/{color-highlight-button.css → components/tiptap-ui/color-highlight-button/color-highlight-button.css} +0 -0
  106. /package/dist/assets/{card.css → components/tiptap-ui-primitive/card/card.css} +0 -0
  107. /package/dist/assets/{dropdown-menu.css → components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.css} +0 -0
  108. /package/dist/assets/{input.css → components/tiptap-ui-primitive/input/input.css} +0 -0
  109. /package/dist/assets/{popover.css → components/tiptap-ui-primitive/popover/popover.css} +0 -0
  110. /package/dist/assets/{separator.css → components/tiptap-ui-primitive/separator/separator.css} +0 -0
  111. /package/dist/assets/{toolbar.css → components/tiptap-ui-primitive/toolbar/toolbar.css} +0 -0
  112. /package/dist/assets/{tooltip.css → components/tiptap-ui-primitive/tooltip/tooltip.css} +0 -0
@@ -1,1333 +0,0 @@
1
- import * as a from "react";
2
- import { useState as ut } from "react";
3
- import { jsx as P } from "react/jsx-runtime";
4
- import { u as lt, o as dt, s as ft, k as vt, m as pt, n as ht, p as mt, q as yt, l as gt } from "./floating-ui.react-dom-DgOuULHo.js";
5
- import * as Et from "react-dom";
6
- import bt from "react-dom";
7
- function Q(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
8
- return function(o) {
9
- if (e?.(o), n === !1 || !o.defaultPrevented)
10
- return t?.(o);
11
- };
12
- }
13
- function he(e, t) {
14
- if (typeof e == "function")
15
- return e(t);
16
- e != null && (e.current = t);
17
- }
18
- function Ne(...e) {
19
- return (t) => {
20
- let n = !1;
21
- const r = e.map((o) => {
22
- const i = he(o, t);
23
- return !n && typeof i == "function" && (n = !0), i;
24
- });
25
- if (n)
26
- return () => {
27
- for (let o = 0; o < r.length; o++) {
28
- const i = r[o];
29
- typeof i == "function" ? i() : he(e[o], null);
30
- }
31
- };
32
- };
33
- }
34
- function _(...e) {
35
- return a.useCallback(Ne(...e), e);
36
- }
37
- function wt(e, t = []) {
38
- let n = [];
39
- function r(i, c) {
40
- const s = a.createContext(c), d = n.length;
41
- n = [...n, c];
42
- const l = (f) => {
43
- const { scope: p, children: h, ...g } = f, u = p?.[e]?.[d] || s, m = a.useMemo(() => g, Object.values(g));
44
- return /* @__PURE__ */ P(u.Provider, { value: m, children: h });
45
- };
46
- l.displayName = i + "Provider";
47
- function v(f, p) {
48
- const h = p?.[e]?.[d] || s, g = a.useContext(h);
49
- if (g) return g;
50
- if (c !== void 0) return c;
51
- throw new Error(`\`${f}\` must be used within \`${i}\``);
52
- }
53
- return [l, v];
54
- }
55
- const o = () => {
56
- const i = n.map((c) => a.createContext(c));
57
- return function(s) {
58
- const d = s?.[e] || i;
59
- return a.useMemo(
60
- () => ({ [`__scope${e}`]: { ...s, [e]: d } }),
61
- [s, d]
62
- );
63
- };
64
- };
65
- return o.scopeName = e, [r, St(o, ...t)];
66
- }
67
- function St(...e) {
68
- const t = e[0];
69
- if (e.length === 1) return t;
70
- const n = () => {
71
- const r = e.map((o) => ({
72
- useScope: o(),
73
- scopeName: o.scopeName
74
- }));
75
- return function(i) {
76
- const c = r.reduce((s, { useScope: d, scopeName: l }) => {
77
- const f = d(i)[`__scope${l}`];
78
- return { ...s, ...f };
79
- }, {});
80
- return a.useMemo(() => ({ [`__scope${t.scopeName}`]: c }), [c]);
81
- };
82
- };
83
- return n.scopeName = t.scopeName, n;
84
- }
85
- // @__NO_SIDE_EFFECTS__
86
- function Ct(e) {
87
- const t = /* @__PURE__ */ Pt(e), n = a.forwardRef((r, o) => {
88
- const { children: i, ...c } = r, s = a.Children.toArray(i), d = s.find(Rt);
89
- if (d) {
90
- const l = d.props.children, v = s.map((f) => f === d ? a.Children.count(l) > 1 ? a.Children.only(null) : a.isValidElement(l) ? l.props.children : null : f);
91
- return /* @__PURE__ */ P(t, { ...c, ref: o, children: a.isValidElement(l) ? a.cloneElement(l, void 0, v) : null });
92
- }
93
- return /* @__PURE__ */ P(t, { ...c, ref: o, children: i });
94
- });
95
- return n.displayName = `${e}.Slot`, n;
96
- }
97
- // @__NO_SIDE_EFFECTS__
98
- function Pt(e) {
99
- const t = a.forwardRef((n, r) => {
100
- const { children: o, ...i } = n;
101
- if (a.isValidElement(o)) {
102
- const c = Nt(o), s = Ot(i, o.props);
103
- return o.type !== a.Fragment && (s.ref = r ? Ne(r, c) : c), a.cloneElement(o, s);
104
- }
105
- return a.Children.count(o) > 1 ? a.Children.only(null) : null;
106
- });
107
- return t.displayName = `${e}.SlotClone`, t;
108
- }
109
- var At = Symbol("radix.slottable");
110
- function Rt(e) {
111
- return a.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === At;
112
- }
113
- function Ot(e, t) {
114
- const n = { ...t };
115
- for (const r in t) {
116
- const o = e[r], i = t[r];
117
- /^on[A-Z]/.test(r) ? o && i ? n[r] = (...s) => {
118
- const d = i(...s);
119
- return o(...s), d;
120
- } : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...i } : r === "className" && (n[r] = [o, i].filter(Boolean).join(" "));
121
- }
122
- return { ...e, ...n };
123
- }
124
- function Nt(e) {
125
- let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
126
- return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
127
- }
128
- var xt = [
129
- "a",
130
- "button",
131
- "div",
132
- "form",
133
- "h2",
134
- "h3",
135
- "img",
136
- "input",
137
- "label",
138
- "li",
139
- "nav",
140
- "ol",
141
- "p",
142
- "select",
143
- "span",
144
- "svg",
145
- "ul"
146
- ], M = xt.reduce((e, t) => {
147
- const n = /* @__PURE__ */ Ct(`Primitive.${t}`), r = a.forwardRef((o, i) => {
148
- const { asChild: c, ...s } = o, d = c ? n : t;
149
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ P(d, { ...s, ref: i });
150
- });
151
- return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
152
- }, {});
153
- function Tt(e, t) {
154
- e && Et.flushSync(() => e.dispatchEvent(t));
155
- }
156
- function W(e) {
157
- const t = a.useRef(e);
158
- return a.useEffect(() => {
159
- t.current = e;
160
- }), a.useMemo(() => (...n) => t.current?.(...n), []);
161
- }
162
- function Mt(e, t = globalThis?.document) {
163
- const n = W(e);
164
- a.useEffect(() => {
165
- const r = (o) => {
166
- o.key === "Escape" && n(o);
167
- };
168
- return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 });
169
- }, [n, t]);
170
- }
171
- var Lt = "DismissableLayer", ie = "dismissableLayer.update", Dt = "dismissableLayer.pointerDownOutside", It = "dismissableLayer.focusOutside", me, xe = a.createContext({
172
- layers: /* @__PURE__ */ new Set(),
173
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
174
- branches: /* @__PURE__ */ new Set()
175
- }), kt = a.forwardRef(
176
- (e, t) => {
177
- const {
178
- disableOutsidePointerEvents: n = !1,
179
- onEscapeKeyDown: r,
180
- onPointerDownOutside: o,
181
- onFocusOutside: i,
182
- onInteractOutside: c,
183
- onDismiss: s,
184
- ...d
185
- } = e, l = a.useContext(xe), [v, f] = a.useState(null), p = v?.ownerDocument ?? globalThis?.document, [, h] = a.useState({}), g = _(t, (E) => f(E)), u = Array.from(l.layers), [m] = [...l.layersWithOutsidePointerEventsDisabled].slice(-1), y = u.indexOf(m), w = v ? u.indexOf(v) : -1, S = l.layersWithOutsidePointerEventsDisabled.size > 0, b = w >= y, C = _t((E) => {
186
- const R = E.target, T = [...l.branches].some((B) => B.contains(R));
187
- !b || T || (o?.(E), c?.(E), E.defaultPrevented || s?.());
188
- }, p), A = Bt((E) => {
189
- const R = E.target;
190
- [...l.branches].some((B) => B.contains(R)) || (i?.(E), c?.(E), E.defaultPrevented || s?.());
191
- }, p);
192
- return Mt((E) => {
193
- w === l.layers.size - 1 && (r?.(E), !E.defaultPrevented && s && (E.preventDefault(), s()));
194
- }, p), a.useEffect(() => {
195
- if (v)
196
- return n && (l.layersWithOutsidePointerEventsDisabled.size === 0 && (me = p.body.style.pointerEvents, p.body.style.pointerEvents = "none"), l.layersWithOutsidePointerEventsDisabled.add(v)), l.layers.add(v), ye(), () => {
197
- n && l.layersWithOutsidePointerEventsDisabled.size === 1 && (p.body.style.pointerEvents = me);
198
- };
199
- }, [v, p, n, l]), a.useEffect(() => () => {
200
- v && (l.layers.delete(v), l.layersWithOutsidePointerEventsDisabled.delete(v), ye());
201
- }, [v, l]), a.useEffect(() => {
202
- const E = () => h({});
203
- return document.addEventListener(ie, E), () => document.removeEventListener(ie, E);
204
- }, []), /* @__PURE__ */ P(
205
- M.div,
206
- {
207
- ...d,
208
- ref: g,
209
- style: {
210
- pointerEvents: S ? b ? "auto" : "none" : void 0,
211
- ...e.style
212
- },
213
- onFocusCapture: Q(e.onFocusCapture, A.onFocusCapture),
214
- onBlurCapture: Q(e.onBlurCapture, A.onBlurCapture),
215
- onPointerDownCapture: Q(
216
- e.onPointerDownCapture,
217
- C.onPointerDownCapture
218
- )
219
- }
220
- );
221
- }
222
- );
223
- kt.displayName = Lt;
224
- var Ft = "DismissableLayerBranch", Wt = a.forwardRef((e, t) => {
225
- const n = a.useContext(xe), r = a.useRef(null), o = _(t, r);
226
- return a.useEffect(() => {
227
- const i = r.current;
228
- if (i)
229
- return n.branches.add(i), () => {
230
- n.branches.delete(i);
231
- };
232
- }, [n.branches]), /* @__PURE__ */ P(M.div, { ...e, ref: o });
233
- });
234
- Wt.displayName = Ft;
235
- function _t(e, t = globalThis?.document) {
236
- const n = W(e), r = a.useRef(!1), o = a.useRef(() => {
237
- });
238
- return a.useEffect(() => {
239
- const i = (s) => {
240
- if (s.target && !r.current) {
241
- let d = function() {
242
- Te(
243
- Dt,
244
- n,
245
- l,
246
- { discrete: !0 }
247
- );
248
- };
249
- const l = { originalEvent: s };
250
- s.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = d, t.addEventListener("click", o.current, { once: !0 })) : d();
251
- } else
252
- t.removeEventListener("click", o.current);
253
- r.current = !1;
254
- }, c = window.setTimeout(() => {
255
- t.addEventListener("pointerdown", i);
256
- }, 0);
257
- return () => {
258
- window.clearTimeout(c), t.removeEventListener("pointerdown", i), t.removeEventListener("click", o.current);
259
- };
260
- }, [t, n]), {
261
- // ensures we check React component tree (not just DOM tree)
262
- onPointerDownCapture: () => r.current = !0
263
- };
264
- }
265
- function Bt(e, t = globalThis?.document) {
266
- const n = W(e), r = a.useRef(!1);
267
- return a.useEffect(() => {
268
- const o = (i) => {
269
- i.target && !r.current && Te(It, n, { originalEvent: i }, {
270
- discrete: !1
271
- });
272
- };
273
- return t.addEventListener("focusin", o), () => t.removeEventListener("focusin", o);
274
- }, [t, n]), {
275
- onFocusCapture: () => r.current = !0,
276
- onBlurCapture: () => r.current = !1
277
- };
278
- }
279
- function ye() {
280
- const e = new CustomEvent(ie);
281
- document.dispatchEvent(e);
282
- }
283
- function Te(e, t, n, { discrete: r }) {
284
- const o = n.originalEvent.target, i = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
285
- t && o.addEventListener(e, t, { once: !0 }), r ? Tt(o, i) : o.dispatchEvent(i);
286
- }
287
- var J = 0;
288
- function ar() {
289
- a.useEffect(() => {
290
- const e = document.querySelectorAll("[data-radix-focus-guard]");
291
- return document.body.insertAdjacentElement("afterbegin", e[0] ?? ge()), document.body.insertAdjacentElement("beforeend", e[1] ?? ge()), J++, () => {
292
- J === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), J--;
293
- };
294
- }, []);
295
- }
296
- function ge() {
297
- const e = document.createElement("span");
298
- return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
299
- }
300
- var ee = "focusScope.autoFocusOnMount", te = "focusScope.autoFocusOnUnmount", Ee = { bubbles: !1, cancelable: !0 }, Ut = "FocusScope", $t = a.forwardRef((e, t) => {
301
- const {
302
- loop: n = !1,
303
- trapped: r = !1,
304
- onMountAutoFocus: o,
305
- onUnmountAutoFocus: i,
306
- ...c
307
- } = e, [s, d] = a.useState(null), l = W(o), v = W(i), f = a.useRef(null), p = _(t, (u) => d(u)), h = a.useRef({
308
- paused: !1,
309
- pause() {
310
- this.paused = !0;
311
- },
312
- resume() {
313
- this.paused = !1;
314
- }
315
- }).current;
316
- a.useEffect(() => {
317
- if (r) {
318
- let u = function(S) {
319
- if (h.paused || !s) return;
320
- const b = S.target;
321
- s.contains(b) ? f.current = b : N(f.current, { select: !0 });
322
- }, m = function(S) {
323
- if (h.paused || !s) return;
324
- const b = S.relatedTarget;
325
- b !== null && (s.contains(b) || N(f.current, { select: !0 }));
326
- }, y = function(S) {
327
- if (document.activeElement === document.body)
328
- for (const C of S)
329
- C.removedNodes.length > 0 && N(s);
330
- };
331
- document.addEventListener("focusin", u), document.addEventListener("focusout", m);
332
- const w = new MutationObserver(y);
333
- return s && w.observe(s, { childList: !0, subtree: !0 }), () => {
334
- document.removeEventListener("focusin", u), document.removeEventListener("focusout", m), w.disconnect();
335
- };
336
- }
337
- }, [r, s, h.paused]), a.useEffect(() => {
338
- if (s) {
339
- we.add(h);
340
- const u = document.activeElement;
341
- if (!s.contains(u)) {
342
- const y = new CustomEvent(ee, Ee);
343
- s.addEventListener(ee, l), s.dispatchEvent(y), y.defaultPrevented || (Ht(Kt(Me(s)), { select: !0 }), document.activeElement === u && N(s));
344
- }
345
- return () => {
346
- s.removeEventListener(ee, l), setTimeout(() => {
347
- const y = new CustomEvent(te, Ee);
348
- s.addEventListener(te, v), s.dispatchEvent(y), y.defaultPrevented || N(u ?? document.body, { select: !0 }), s.removeEventListener(te, v), we.remove(h);
349
- }, 0);
350
- };
351
- }
352
- }, [s, l, v, h]);
353
- const g = a.useCallback(
354
- (u) => {
355
- if (!n && !r || h.paused) return;
356
- const m = u.key === "Tab" && !u.altKey && !u.ctrlKey && !u.metaKey, y = document.activeElement;
357
- if (m && y) {
358
- const w = u.currentTarget, [S, b] = zt(w);
359
- S && b ? !u.shiftKey && y === b ? (u.preventDefault(), n && N(S, { select: !0 })) : u.shiftKey && y === S && (u.preventDefault(), n && N(b, { select: !0 })) : y === w && u.preventDefault();
360
- }
361
- },
362
- [n, r, h.paused]
363
- );
364
- return /* @__PURE__ */ P(M.div, { tabIndex: -1, ...c, ref: p, onKeyDown: g });
365
- });
366
- $t.displayName = Ut;
367
- function Ht(e, { select: t = !1 } = {}) {
368
- const n = document.activeElement;
369
- for (const r of e)
370
- if (N(r, { select: t }), document.activeElement !== n) return;
371
- }
372
- function zt(e) {
373
- const t = Me(e), n = be(t, e), r = be(t.reverse(), e);
374
- return [n, r];
375
- }
376
- function Me(e) {
377
- const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
378
- acceptNode: (r) => {
379
- const o = r.tagName === "INPUT" && r.type === "hidden";
380
- return r.disabled || r.hidden || o ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
381
- }
382
- });
383
- for (; n.nextNode(); ) t.push(n.currentNode);
384
- return t;
385
- }
386
- function be(e, t) {
387
- for (const n of e)
388
- if (!jt(n, { upTo: t })) return n;
389
- }
390
- function jt(e, { upTo: t }) {
391
- if (getComputedStyle(e).visibility === "hidden") return !0;
392
- for (; e; ) {
393
- if (t !== void 0 && e === t) return !1;
394
- if (getComputedStyle(e).display === "none") return !0;
395
- e = e.parentElement;
396
- }
397
- return !1;
398
- }
399
- function Vt(e) {
400
- return e instanceof HTMLInputElement && "select" in e;
401
- }
402
- function N(e, { select: t = !1 } = {}) {
403
- if (e && e.focus) {
404
- const n = document.activeElement;
405
- e.focus({ preventScroll: !0 }), e !== n && Vt(e) && t && e.select();
406
- }
407
- }
408
- var we = Yt();
409
- function Yt() {
410
- let e = [];
411
- return {
412
- add(t) {
413
- const n = e[0];
414
- t !== n && n?.pause(), e = Se(e, t), e.unshift(t);
415
- },
416
- remove(t) {
417
- e = Se(e, t), e[0]?.resume();
418
- }
419
- };
420
- }
421
- function Se(e, t) {
422
- const n = [...e], r = n.indexOf(t);
423
- return r !== -1 && n.splice(r, 1), n;
424
- }
425
- function Kt(e) {
426
- return e.filter((t) => t.tagName !== "A");
427
- }
428
- var x = globalThis?.document ? a.useLayoutEffect : () => {
429
- }, Xt = a[" useId ".trim().toString()] || (() => {
430
- }), Zt = 0;
431
- function ir(e) {
432
- const [t, n] = a.useState(Xt());
433
- return x(() => {
434
- n((r) => r ?? String(Zt++));
435
- }, [e]), e || (t ? `radix-${t}` : "");
436
- }
437
- var Gt = "Arrow", Le = a.forwardRef((e, t) => {
438
- const { children: n, width: r = 10, height: o = 5, ...i } = e;
439
- return /* @__PURE__ */ P(
440
- M.svg,
441
- {
442
- ...i,
443
- ref: t,
444
- width: r,
445
- height: o,
446
- viewBox: "0 0 30 10",
447
- preserveAspectRatio: "none",
448
- children: e.asChild ? n : /* @__PURE__ */ P("polygon", { points: "0,0 30,0 15,10" })
449
- }
450
- );
451
- });
452
- Le.displayName = Gt;
453
- var qt = Le;
454
- function Qt(e) {
455
- const [t, n] = a.useState(void 0);
456
- return x(() => {
457
- if (e) {
458
- n({ width: e.offsetWidth, height: e.offsetHeight });
459
- const r = new ResizeObserver((o) => {
460
- if (!Array.isArray(o) || !o.length)
461
- return;
462
- const i = o[0];
463
- let c, s;
464
- if ("borderBoxSize" in i) {
465
- const d = i.borderBoxSize, l = Array.isArray(d) ? d[0] : d;
466
- c = l.inlineSize, s = l.blockSize;
467
- } else
468
- c = e.offsetWidth, s = e.offsetHeight;
469
- n({ width: c, height: s });
470
- });
471
- return r.observe(e, { box: "border-box" }), () => r.unobserve(e);
472
- } else
473
- n(void 0);
474
- }, [e]), t;
475
- }
476
- var ce = "Popper", [De, sr] = wt(ce), [Jt, Ie] = De(ce), ke = (e) => {
477
- const { __scopePopper: t, children: n } = e, [r, o] = a.useState(null);
478
- return /* @__PURE__ */ P(Jt, { scope: t, anchor: r, onAnchorChange: o, children: n });
479
- };
480
- ke.displayName = ce;
481
- var Fe = "PopperAnchor", We = a.forwardRef(
482
- (e, t) => {
483
- const { __scopePopper: n, virtualRef: r, ...o } = e, i = Ie(Fe, n), c = a.useRef(null), s = _(t, c), d = a.useRef(null);
484
- return a.useEffect(() => {
485
- const l = d.current;
486
- d.current = r?.current || c.current, l !== d.current && i.onAnchorChange(d.current);
487
- }), r ? null : /* @__PURE__ */ P(M.div, { ...o, ref: s });
488
- }
489
- );
490
- We.displayName = Fe;
491
- var ue = "PopperContent", [en, tn] = De(ue), _e = a.forwardRef(
492
- (e, t) => {
493
- const {
494
- __scopePopper: n,
495
- side: r = "bottom",
496
- sideOffset: o = 0,
497
- align: i = "center",
498
- alignOffset: c = 0,
499
- arrowPadding: s = 0,
500
- avoidCollisions: d = !0,
501
- collisionBoundary: l = [],
502
- collisionPadding: v = 0,
503
- sticky: f = "partial",
504
- hideWhenDetached: p = !1,
505
- updatePositionStrategy: h = "optimized",
506
- onPlaced: g,
507
- ...u
508
- } = e, m = Ie(ue, n), [y, w] = a.useState(null), S = _(t, (U) => w(U)), [b, C] = a.useState(null), A = Qt(b), E = A?.width ?? 0, R = A?.height ?? 0, T = r + (i !== "center" ? "-" + i : ""), B = typeof v == "number" ? v : { top: 0, right: 0, bottom: 0, left: 0, ...v }, le = Array.isArray(l) ? l : [l], Ge = le.length > 0, $ = {
509
- padding: B,
510
- boundary: le.filter(rn),
511
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
512
- altBoundary: Ge
513
- }, { refs: qe, floatingStyles: de, placement: Qe, isPositioned: H, middlewareData: L } = lt({
514
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
515
- strategy: "fixed",
516
- placement: T,
517
- whileElementsMounted: (...U) => gt(...U, {
518
- animationFrame: h === "always"
519
- }),
520
- elements: {
521
- reference: m.anchor
522
- },
523
- middleware: [
524
- dt({ mainAxis: o + R, alignmentAxis: c }),
525
- d && ft({
526
- mainAxis: !0,
527
- crossAxis: !1,
528
- limiter: f === "partial" ? yt() : void 0,
529
- ...$
530
- }),
531
- d && vt({ ...$ }),
532
- pt({
533
- ...$,
534
- apply: ({ elements: U, rects: pe, availableWidth: at, availableHeight: it }) => {
535
- const { width: st, height: ct } = pe.reference, z = U.floating.style;
536
- z.setProperty("--radix-popper-available-width", `${at}px`), z.setProperty("--radix-popper-available-height", `${it}px`), z.setProperty("--radix-popper-anchor-width", `${st}px`), z.setProperty("--radix-popper-anchor-height", `${ct}px`);
537
- }
538
- }),
539
- b && ht({ element: b, padding: s }),
540
- on({ arrowWidth: E, arrowHeight: R }),
541
- p && mt({ strategy: "referenceHidden", ...$ })
542
- ]
543
- }), [fe, Je] = $e(Qe), ve = W(g);
544
- x(() => {
545
- H && ve?.();
546
- }, [H, ve]);
547
- const et = L.arrow?.x, tt = L.arrow?.y, nt = L.arrow?.centerOffset !== 0, [rt, ot] = a.useState();
548
- return x(() => {
549
- y && ot(window.getComputedStyle(y).zIndex);
550
- }, [y]), /* @__PURE__ */ P(
551
- "div",
552
- {
553
- ref: qe.setFloating,
554
- "data-radix-popper-content-wrapper": "",
555
- style: {
556
- ...de,
557
- transform: H ? de.transform : "translate(0, -200%)",
558
- // keep off the page when measuring
559
- minWidth: "max-content",
560
- zIndex: rt,
561
- "--radix-popper-transform-origin": [
562
- L.transformOrigin?.x,
563
- L.transformOrigin?.y
564
- ].join(" "),
565
- // hide the content if using the hide middleware and should be hidden
566
- // set visibility to hidden and disable pointer events so the UI behaves
567
- // as if the PopperContent isn't there at all
568
- ...L.hide?.referenceHidden && {
569
- visibility: "hidden",
570
- pointerEvents: "none"
571
- }
572
- },
573
- dir: e.dir,
574
- children: /* @__PURE__ */ P(
575
- en,
576
- {
577
- scope: n,
578
- placedSide: fe,
579
- onArrowChange: C,
580
- arrowX: et,
581
- arrowY: tt,
582
- shouldHideArrow: nt,
583
- children: /* @__PURE__ */ P(
584
- M.div,
585
- {
586
- "data-side": fe,
587
- "data-align": Je,
588
- ...u,
589
- ref: S,
590
- style: {
591
- ...u.style,
592
- // if the PopperContent hasn't been placed yet (not all measurements done)
593
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
594
- animation: H ? void 0 : "none"
595
- }
596
- }
597
- )
598
- }
599
- )
600
- }
601
- );
602
- }
603
- );
604
- _e.displayName = ue;
605
- var Be = "PopperArrow", nn = {
606
- top: "bottom",
607
- right: "left",
608
- bottom: "top",
609
- left: "right"
610
- }, Ue = a.forwardRef(function(t, n) {
611
- const { __scopePopper: r, ...o } = t, i = tn(Be, r), c = nn[i.placedSide];
612
- return (
613
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
614
- // doesn't report size as we'd expect on SVG elements.
615
- // it reports their bounding box which is effectively the largest path inside the SVG.
616
- /* @__PURE__ */ P(
617
- "span",
618
- {
619
- ref: i.onArrowChange,
620
- style: {
621
- position: "absolute",
622
- left: i.arrowX,
623
- top: i.arrowY,
624
- [c]: 0,
625
- transformOrigin: {
626
- top: "",
627
- right: "0 0",
628
- bottom: "center 0",
629
- left: "100% 0"
630
- }[i.placedSide],
631
- transform: {
632
- top: "translateY(100%)",
633
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
634
- bottom: "rotate(180deg)",
635
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
636
- }[i.placedSide],
637
- visibility: i.shouldHideArrow ? "hidden" : void 0
638
- },
639
- children: /* @__PURE__ */ P(
640
- qt,
641
- {
642
- ...o,
643
- ref: n,
644
- style: {
645
- ...o.style,
646
- // ensures the element can be measured correctly (mostly for if SVG)
647
- display: "block"
648
- }
649
- }
650
- )
651
- }
652
- )
653
- );
654
- });
655
- Ue.displayName = Be;
656
- function rn(e) {
657
- return e !== null;
658
- }
659
- var on = (e) => ({
660
- name: "transformOrigin",
661
- options: e,
662
- fn(t) {
663
- const { placement: n, rects: r, middlewareData: o } = t, c = o.arrow?.centerOffset !== 0, s = c ? 0 : e.arrowWidth, d = c ? 0 : e.arrowHeight, [l, v] = $e(n), f = { start: "0%", center: "50%", end: "100%" }[v], p = (o.arrow?.x ?? 0) + s / 2, h = (o.arrow?.y ?? 0) + d / 2;
664
- let g = "", u = "";
665
- return l === "bottom" ? (g = c ? f : `${p}px`, u = `${-d}px`) : l === "top" ? (g = c ? f : `${p}px`, u = `${r.floating.height + d}px`) : l === "right" ? (g = `${-d}px`, u = c ? f : `${h}px`) : l === "left" && (g = `${r.floating.width + d}px`, u = c ? f : `${h}px`), { data: { x: g, y: u } };
666
- }
667
- });
668
- function $e(e) {
669
- const [t, n = "center"] = e.split("-");
670
- return [t, n];
671
- }
672
- var cr = ke, ur = We, lr = _e, dr = Ue, an = "Portal", sn = a.forwardRef((e, t) => {
673
- const { container: n, ...r } = e, [o, i] = a.useState(!1);
674
- x(() => i(!0), []);
675
- const c = n || o && globalThis?.document?.body;
676
- return c ? bt.createPortal(/* @__PURE__ */ P(M.div, { ...r, ref: t }), c) : null;
677
- });
678
- sn.displayName = an;
679
- function cn(e, t) {
680
- return a.useReducer((n, r) => t[n][r] ?? n, e);
681
- }
682
- var un = (e) => {
683
- const { present: t, children: n } = e, r = ln(t), o = typeof n == "function" ? n({ present: r.isPresent }) : a.Children.only(n), i = _(r.ref, dn(o));
684
- return typeof n == "function" || r.isPresent ? a.cloneElement(o, { ref: i }) : null;
685
- };
686
- un.displayName = "Presence";
687
- function ln(e) {
688
- const [t, n] = a.useState(), r = a.useRef(null), o = a.useRef(e), i = a.useRef("none"), c = e ? "mounted" : "unmounted", [s, d] = cn(c, {
689
- mounted: {
690
- UNMOUNT: "unmounted",
691
- ANIMATION_OUT: "unmountSuspended"
692
- },
693
- unmountSuspended: {
694
- MOUNT: "mounted",
695
- ANIMATION_END: "unmounted"
696
- },
697
- unmounted: {
698
- MOUNT: "mounted"
699
- }
700
- });
701
- return a.useEffect(() => {
702
- const l = j(r.current);
703
- i.current = s === "mounted" ? l : "none";
704
- }, [s]), x(() => {
705
- const l = r.current, v = o.current;
706
- if (v !== e) {
707
- const p = i.current, h = j(l);
708
- e ? d("MOUNT") : h === "none" || l?.display === "none" ? d("UNMOUNT") : d(v && p !== h ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
709
- }
710
- }, [e, d]), x(() => {
711
- if (t) {
712
- let l;
713
- const v = t.ownerDocument.defaultView ?? window, f = (h) => {
714
- const u = j(r.current).includes(CSS.escape(h.animationName));
715
- if (h.target === t && u && (d("ANIMATION_END"), !o.current)) {
716
- const m = t.style.animationFillMode;
717
- t.style.animationFillMode = "forwards", l = v.setTimeout(() => {
718
- t.style.animationFillMode === "forwards" && (t.style.animationFillMode = m);
719
- });
720
- }
721
- }, p = (h) => {
722
- h.target === t && (i.current = j(r.current));
723
- };
724
- return t.addEventListener("animationstart", p), t.addEventListener("animationcancel", f), t.addEventListener("animationend", f), () => {
725
- v.clearTimeout(l), t.removeEventListener("animationstart", p), t.removeEventListener("animationcancel", f), t.removeEventListener("animationend", f);
726
- };
727
- } else
728
- d("ANIMATION_END");
729
- }, [t, d]), {
730
- isPresent: ["mounted", "unmountSuspended"].includes(s),
731
- ref: a.useCallback((l) => {
732
- r.current = l ? getComputedStyle(l) : null, n(l);
733
- }, [])
734
- };
735
- }
736
- function j(e) {
737
- return e?.animationName || "none";
738
- }
739
- function dn(e) {
740
- let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
741
- return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
742
- }
743
- var fn = a[" useInsertionEffect ".trim().toString()] || x;
744
- function fr({
745
- prop: e,
746
- defaultProp: t,
747
- onChange: n = () => {
748
- },
749
- caller: r
750
- }) {
751
- const [o, i, c] = vn({
752
- defaultProp: t,
753
- onChange: n
754
- }), s = e !== void 0, d = s ? e : o;
755
- {
756
- const v = a.useRef(e !== void 0);
757
- a.useEffect(() => {
758
- const f = v.current;
759
- f !== s && console.warn(
760
- `${r} is changing from ${f ? "controlled" : "uncontrolled"} to ${s ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
761
- ), v.current = s;
762
- }, [s, r]);
763
- }
764
- const l = a.useCallback(
765
- (v) => {
766
- if (s) {
767
- const f = pn(v) ? v(e) : v;
768
- f !== e && c.current?.(f);
769
- } else
770
- i(v);
771
- },
772
- [s, e, i, c]
773
- );
774
- return [d, l];
775
- }
776
- function vn({
777
- defaultProp: e,
778
- onChange: t
779
- }) {
780
- const [n, r] = a.useState(e), o = a.useRef(n), i = a.useRef(t);
781
- return fn(() => {
782
- i.current = t;
783
- }, [t]), a.useEffect(() => {
784
- o.current !== n && (i.current?.(n), o.current = n);
785
- }, [n, o]), [n, r, i];
786
- }
787
- function pn(e) {
788
- return typeof e == "function";
789
- }
790
- var hn = function(e) {
791
- if (typeof document > "u")
792
- return null;
793
- var t = Array.isArray(e) ? e[0] : e;
794
- return t.ownerDocument.body;
795
- }, D = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), Y = {}, ne = 0, He = function(e) {
796
- return e && (e.host || He(e.parentNode));
797
- }, mn = function(e, t) {
798
- return t.map(function(n) {
799
- if (e.contains(n))
800
- return n;
801
- var r = He(n);
802
- return r && e.contains(r) ? r : (console.error("aria-hidden", n, "in not contained inside", e, ". Doing nothing"), null);
803
- }).filter(function(n) {
804
- return !!n;
805
- });
806
- }, yn = function(e, t, n, r) {
807
- var o = mn(t, Array.isArray(e) ? e : [e]);
808
- Y[n] || (Y[n] = /* @__PURE__ */ new WeakMap());
809
- var i = Y[n], c = [], s = /* @__PURE__ */ new Set(), d = new Set(o), l = function(f) {
810
- !f || s.has(f) || (s.add(f), l(f.parentNode));
811
- };
812
- o.forEach(l);
813
- var v = function(f) {
814
- !f || d.has(f) || Array.prototype.forEach.call(f.children, function(p) {
815
- if (s.has(p))
816
- v(p);
817
- else
818
- try {
819
- var h = p.getAttribute(r), g = h !== null && h !== "false", u = (D.get(p) || 0) + 1, m = (i.get(p) || 0) + 1;
820
- D.set(p, u), i.set(p, m), c.push(p), u === 1 && g && V.set(p, !0), m === 1 && p.setAttribute(n, "true"), g || p.setAttribute(r, "true");
821
- } catch (y) {
822
- console.error("aria-hidden: cannot operate on ", p, y);
823
- }
824
- });
825
- };
826
- return v(t), s.clear(), ne++, function() {
827
- c.forEach(function(f) {
828
- var p = D.get(f) - 1, h = i.get(f) - 1;
829
- D.set(f, p), i.set(f, h), p || (V.has(f) || f.removeAttribute(r), V.delete(f)), h || f.removeAttribute(n);
830
- }), ne--, ne || (D = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), Y = {});
831
- };
832
- }, vr = function(e, t, n) {
833
- n === void 0 && (n = "data-aria-hidden");
834
- var r = Array.from(Array.isArray(e) ? e : [e]), o = hn(e);
835
- return o ? (r.push.apply(r, Array.from(o.querySelectorAll("[aria-live], script"))), yn(r, o, n, "aria-hidden")) : function() {
836
- return null;
837
- };
838
- }, O = function() {
839
- return O = Object.assign || function(t) {
840
- for (var n, r = 1, o = arguments.length; r < o; r++) {
841
- n = arguments[r];
842
- for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
843
- }
844
- return t;
845
- }, O.apply(this, arguments);
846
- };
847
- function ze(e, t) {
848
- var n = {};
849
- for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
850
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
851
- for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++)
852
- t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (n[r[o]] = e[r[o]]);
853
- return n;
854
- }
855
- function gn(e, t, n) {
856
- if (n || arguments.length === 2) for (var r = 0, o = t.length, i; r < o; r++)
857
- (i || !(r in t)) && (i || (i = Array.prototype.slice.call(t, 0, r)), i[r] = t[r]);
858
- return e.concat(i || Array.prototype.slice.call(t));
859
- }
860
- var Z = "right-scroll-bar-position", G = "width-before-scroll-bar", En = "with-scroll-bars-hidden", bn = "--removed-body-scroll-bar-size";
861
- function re(e, t) {
862
- return typeof e == "function" ? e(t) : e && (e.current = t), e;
863
- }
864
- function wn(e, t) {
865
- var n = ut(function() {
866
- return {
867
- // value
868
- value: e,
869
- // last callback
870
- callback: t,
871
- // "memoized" public interface
872
- facade: {
873
- get current() {
874
- return n.value;
875
- },
876
- set current(r) {
877
- var o = n.value;
878
- o !== r && (n.value = r, n.callback(r, o));
879
- }
880
- }
881
- };
882
- })[0];
883
- return n.callback = t, n.facade;
884
- }
885
- var Sn = typeof window < "u" ? a.useLayoutEffect : a.useEffect, Ce = /* @__PURE__ */ new WeakMap();
886
- function Cn(e, t) {
887
- var n = wn(null, function(r) {
888
- return e.forEach(function(o) {
889
- return re(o, r);
890
- });
891
- });
892
- return Sn(function() {
893
- var r = Ce.get(n);
894
- if (r) {
895
- var o = new Set(r), i = new Set(e), c = n.current;
896
- o.forEach(function(s) {
897
- i.has(s) || re(s, null);
898
- }), i.forEach(function(s) {
899
- o.has(s) || re(s, c);
900
- });
901
- }
902
- Ce.set(n, e);
903
- }, [e]), n;
904
- }
905
- function Pn(e) {
906
- return e;
907
- }
908
- function An(e, t) {
909
- t === void 0 && (t = Pn);
910
- var n = [], r = !1, o = {
911
- read: function() {
912
- if (r)
913
- throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
914
- return n.length ? n[n.length - 1] : e;
915
- },
916
- useMedium: function(i) {
917
- var c = t(i, r);
918
- return n.push(c), function() {
919
- n = n.filter(function(s) {
920
- return s !== c;
921
- });
922
- };
923
- },
924
- assignSyncMedium: function(i) {
925
- for (r = !0; n.length; ) {
926
- var c = n;
927
- n = [], c.forEach(i);
928
- }
929
- n = {
930
- push: function(s) {
931
- return i(s);
932
- },
933
- filter: function() {
934
- return n;
935
- }
936
- };
937
- },
938
- assignMedium: function(i) {
939
- r = !0;
940
- var c = [];
941
- if (n.length) {
942
- var s = n;
943
- n = [], s.forEach(i), c = n;
944
- }
945
- var d = function() {
946
- var v = c;
947
- c = [], v.forEach(i);
948
- }, l = function() {
949
- return Promise.resolve().then(d);
950
- };
951
- l(), n = {
952
- push: function(v) {
953
- c.push(v), l();
954
- },
955
- filter: function(v) {
956
- return c = c.filter(v), n;
957
- }
958
- };
959
- }
960
- };
961
- return o;
962
- }
963
- function Rn(e) {
964
- e === void 0 && (e = {});
965
- var t = An(null);
966
- return t.options = O({ async: !0, ssr: !1 }, e), t;
967
- }
968
- var je = function(e) {
969
- var t = e.sideCar, n = ze(e, ["sideCar"]);
970
- if (!t)
971
- throw new Error("Sidecar: please provide `sideCar` property to import the right car");
972
- var r = t.read();
973
- if (!r)
974
- throw new Error("Sidecar medium not found");
975
- return a.createElement(r, O({}, n));
976
- };
977
- je.isSideCarExport = !0;
978
- function On(e, t) {
979
- return e.useMedium(t), je;
980
- }
981
- var Ve = Rn(), oe = function() {
982
- }, q = a.forwardRef(function(e, t) {
983
- var n = a.useRef(null), r = a.useState({
984
- onScrollCapture: oe,
985
- onWheelCapture: oe,
986
- onTouchMoveCapture: oe
987
- }), o = r[0], i = r[1], c = e.forwardProps, s = e.children, d = e.className, l = e.removeScrollBar, v = e.enabled, f = e.shards, p = e.sideCar, h = e.noRelative, g = e.noIsolation, u = e.inert, m = e.allowPinchZoom, y = e.as, w = y === void 0 ? "div" : y, S = e.gapMode, b = ze(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), C = p, A = Cn([n, t]), E = O(O({}, b), o);
988
- return a.createElement(
989
- a.Fragment,
990
- null,
991
- v && a.createElement(C, { sideCar: Ve, removeScrollBar: l, shards: f, noRelative: h, noIsolation: g, inert: u, setCallbacks: i, allowPinchZoom: !!m, lockRef: n, gapMode: S }),
992
- c ? a.cloneElement(a.Children.only(s), O(O({}, E), { ref: A })) : a.createElement(w, O({}, E, { className: d, ref: A }), s)
993
- );
994
- });
995
- q.defaultProps = {
996
- enabled: !0,
997
- removeScrollBar: !0,
998
- inert: !1
999
- };
1000
- q.classNames = {
1001
- fullWidth: G,
1002
- zeroRight: Z
1003
- };
1004
- var Nn = function() {
1005
- if (typeof __webpack_nonce__ < "u")
1006
- return __webpack_nonce__;
1007
- };
1008
- function xn() {
1009
- if (!document)
1010
- return null;
1011
- var e = document.createElement("style");
1012
- e.type = "text/css";
1013
- var t = Nn();
1014
- return t && e.setAttribute("nonce", t), e;
1015
- }
1016
- function Tn(e, t) {
1017
- e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
1018
- }
1019
- function Mn(e) {
1020
- var t = document.head || document.getElementsByTagName("head")[0];
1021
- t.appendChild(e);
1022
- }
1023
- var Ln = function() {
1024
- var e = 0, t = null;
1025
- return {
1026
- add: function(n) {
1027
- e == 0 && (t = xn()) && (Tn(t, n), Mn(t)), e++;
1028
- },
1029
- remove: function() {
1030
- e--, !e && t && (t.parentNode && t.parentNode.removeChild(t), t = null);
1031
- }
1032
- };
1033
- }, Dn = function() {
1034
- var e = Ln();
1035
- return function(t, n) {
1036
- a.useEffect(function() {
1037
- return e.add(t), function() {
1038
- e.remove();
1039
- };
1040
- }, [t && n]);
1041
- };
1042
- }, Ye = function() {
1043
- var e = Dn(), t = function(n) {
1044
- var r = n.styles, o = n.dynamic;
1045
- return e(r, o), null;
1046
- };
1047
- return t;
1048
- }, In = {
1049
- left: 0,
1050
- top: 0,
1051
- right: 0,
1052
- gap: 0
1053
- }, ae = function(e) {
1054
- return parseInt(e || "", 10) || 0;
1055
- }, kn = function(e) {
1056
- var t = window.getComputedStyle(document.body), n = t[e === "padding" ? "paddingLeft" : "marginLeft"], r = t[e === "padding" ? "paddingTop" : "marginTop"], o = t[e === "padding" ? "paddingRight" : "marginRight"];
1057
- return [ae(n), ae(r), ae(o)];
1058
- }, Fn = function(e) {
1059
- if (e === void 0 && (e = "margin"), typeof window > "u")
1060
- return In;
1061
- var t = kn(e), n = document.documentElement.clientWidth, r = window.innerWidth;
1062
- return {
1063
- left: t[0],
1064
- top: t[1],
1065
- right: t[2],
1066
- gap: Math.max(0, r - n + t[2] - t[0])
1067
- };
1068
- }, Wn = Ye(), F = "data-scroll-locked", _n = function(e, t, n, r) {
1069
- var o = e.left, i = e.top, c = e.right, s = e.gap;
1070
- return n === void 0 && (n = "margin"), `
1071
- .`.concat(En, ` {
1072
- overflow: hidden `).concat(r, `;
1073
- padding-right: `).concat(s, "px ").concat(r, `;
1074
- }
1075
- body[`).concat(F, `] {
1076
- overflow: hidden `).concat(r, `;
1077
- overscroll-behavior: contain;
1078
- `).concat([
1079
- t && "position: relative ".concat(r, ";"),
1080
- n === "margin" && `
1081
- padding-left: `.concat(o, `px;
1082
- padding-top: `).concat(i, `px;
1083
- padding-right: `).concat(c, `px;
1084
- margin-left:0;
1085
- margin-top:0;
1086
- margin-right: `).concat(s, "px ").concat(r, `;
1087
- `),
1088
- n === "padding" && "padding-right: ".concat(s, "px ").concat(r, ";")
1089
- ].filter(Boolean).join(""), `
1090
- }
1091
-
1092
- .`).concat(Z, ` {
1093
- right: `).concat(s, "px ").concat(r, `;
1094
- }
1095
-
1096
- .`).concat(G, ` {
1097
- margin-right: `).concat(s, "px ").concat(r, `;
1098
- }
1099
-
1100
- .`).concat(Z, " .").concat(Z, ` {
1101
- right: 0 `).concat(r, `;
1102
- }
1103
-
1104
- .`).concat(G, " .").concat(G, ` {
1105
- margin-right: 0 `).concat(r, `;
1106
- }
1107
-
1108
- body[`).concat(F, `] {
1109
- `).concat(bn, ": ").concat(s, `px;
1110
- }
1111
- `);
1112
- }, Pe = function() {
1113
- var e = parseInt(document.body.getAttribute(F) || "0", 10);
1114
- return isFinite(e) ? e : 0;
1115
- }, Bn = function() {
1116
- a.useEffect(function() {
1117
- return document.body.setAttribute(F, (Pe() + 1).toString()), function() {
1118
- var e = Pe() - 1;
1119
- e <= 0 ? document.body.removeAttribute(F) : document.body.setAttribute(F, e.toString());
1120
- };
1121
- }, []);
1122
- }, Un = function(e) {
1123
- var t = e.noRelative, n = e.noImportant, r = e.gapMode, o = r === void 0 ? "margin" : r;
1124
- Bn();
1125
- var i = a.useMemo(function() {
1126
- return Fn(o);
1127
- }, [o]);
1128
- return a.createElement(Wn, { styles: _n(i, !t, o, n ? "" : "!important") });
1129
- }, se = !1;
1130
- if (typeof window < "u")
1131
- try {
1132
- var K = Object.defineProperty({}, "passive", {
1133
- get: function() {
1134
- return se = !0, !0;
1135
- }
1136
- });
1137
- window.addEventListener("test", K, K), window.removeEventListener("test", K, K);
1138
- } catch {
1139
- se = !1;
1140
- }
1141
- var I = se ? { passive: !1 } : !1, $n = function(e) {
1142
- return e.tagName === "TEXTAREA";
1143
- }, Ke = function(e, t) {
1144
- if (!(e instanceof Element))
1145
- return !1;
1146
- var n = window.getComputedStyle(e);
1147
- return (
1148
- // not-not-scrollable
1149
- n[t] !== "hidden" && // contains scroll inside self
1150
- !(n.overflowY === n.overflowX && !$n(e) && n[t] === "visible")
1151
- );
1152
- }, Hn = function(e) {
1153
- return Ke(e, "overflowY");
1154
- }, zn = function(e) {
1155
- return Ke(e, "overflowX");
1156
- }, Ae = function(e, t) {
1157
- var n = t.ownerDocument, r = t;
1158
- do {
1159
- typeof ShadowRoot < "u" && r instanceof ShadowRoot && (r = r.host);
1160
- var o = Xe(e, r);
1161
- if (o) {
1162
- var i = Ze(e, r), c = i[1], s = i[2];
1163
- if (c > s)
1164
- return !0;
1165
- }
1166
- r = r.parentNode;
1167
- } while (r && r !== n.body);
1168
- return !1;
1169
- }, jn = function(e) {
1170
- var t = e.scrollTop, n = e.scrollHeight, r = e.clientHeight;
1171
- return [
1172
- t,
1173
- n,
1174
- r
1175
- ];
1176
- }, Vn = function(e) {
1177
- var t = e.scrollLeft, n = e.scrollWidth, r = e.clientWidth;
1178
- return [
1179
- t,
1180
- n,
1181
- r
1182
- ];
1183
- }, Xe = function(e, t) {
1184
- return e === "v" ? Hn(t) : zn(t);
1185
- }, Ze = function(e, t) {
1186
- return e === "v" ? jn(t) : Vn(t);
1187
- }, Yn = function(e, t) {
1188
- return e === "h" && t === "rtl" ? -1 : 1;
1189
- }, Kn = function(e, t, n, r, o) {
1190
- var i = Yn(e, window.getComputedStyle(t).direction), c = i * r, s = n.target, d = t.contains(s), l = !1, v = c > 0, f = 0, p = 0;
1191
- do {
1192
- if (!s)
1193
- break;
1194
- var h = Ze(e, s), g = h[0], u = h[1], m = h[2], y = u - m - i * g;
1195
- (g || y) && Xe(e, s) && (f += y, p += g);
1196
- var w = s.parentNode;
1197
- s = w && w.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? w.host : w;
1198
- } while (
1199
- // portaled content
1200
- !d && s !== document.body || // self content
1201
- d && (t.contains(s) || t === s)
1202
- );
1203
- return (v && Math.abs(f) < 1 || !v && Math.abs(p) < 1) && (l = !0), l;
1204
- }, X = function(e) {
1205
- return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
1206
- }, Re = function(e) {
1207
- return [e.deltaX, e.deltaY];
1208
- }, Oe = function(e) {
1209
- return e && "current" in e ? e.current : e;
1210
- }, Xn = function(e, t) {
1211
- return e[0] === t[0] && e[1] === t[1];
1212
- }, Zn = function(e) {
1213
- return `
1214
- .block-interactivity-`.concat(e, ` {pointer-events: none;}
1215
- .allow-interactivity-`).concat(e, ` {pointer-events: all;}
1216
- `);
1217
- }, Gn = 0, k = [];
1218
- function qn(e) {
1219
- var t = a.useRef([]), n = a.useRef([0, 0]), r = a.useRef(), o = a.useState(Gn++)[0], i = a.useState(Ye)[0], c = a.useRef(e);
1220
- a.useEffect(function() {
1221
- c.current = e;
1222
- }, [e]), a.useEffect(function() {
1223
- if (e.inert) {
1224
- document.body.classList.add("block-interactivity-".concat(o));
1225
- var u = gn([e.lockRef.current], (e.shards || []).map(Oe), !0).filter(Boolean);
1226
- return u.forEach(function(m) {
1227
- return m.classList.add("allow-interactivity-".concat(o));
1228
- }), function() {
1229
- document.body.classList.remove("block-interactivity-".concat(o)), u.forEach(function(m) {
1230
- return m.classList.remove("allow-interactivity-".concat(o));
1231
- });
1232
- };
1233
- }
1234
- }, [e.inert, e.lockRef.current, e.shards]);
1235
- var s = a.useCallback(function(u, m) {
1236
- if ("touches" in u && u.touches.length === 2 || u.type === "wheel" && u.ctrlKey)
1237
- return !c.current.allowPinchZoom;
1238
- var y = X(u), w = n.current, S = "deltaX" in u ? u.deltaX : w[0] - y[0], b = "deltaY" in u ? u.deltaY : w[1] - y[1], C, A = u.target, E = Math.abs(S) > Math.abs(b) ? "h" : "v";
1239
- if ("touches" in u && E === "h" && A.type === "range")
1240
- return !1;
1241
- var R = Ae(E, A);
1242
- if (!R)
1243
- return !0;
1244
- if (R ? C = E : (C = E === "v" ? "h" : "v", R = Ae(E, A)), !R)
1245
- return !1;
1246
- if (!r.current && "changedTouches" in u && (S || b) && (r.current = C), !C)
1247
- return !0;
1248
- var T = r.current || C;
1249
- return Kn(T, m, u, T === "h" ? S : b);
1250
- }, []), d = a.useCallback(function(u) {
1251
- var m = u;
1252
- if (!(!k.length || k[k.length - 1] !== i)) {
1253
- var y = "deltaY" in m ? Re(m) : X(m), w = t.current.filter(function(C) {
1254
- return C.name === m.type && (C.target === m.target || m.target === C.shadowParent) && Xn(C.delta, y);
1255
- })[0];
1256
- if (w && w.should) {
1257
- m.cancelable && m.preventDefault();
1258
- return;
1259
- }
1260
- if (!w) {
1261
- var S = (c.current.shards || []).map(Oe).filter(Boolean).filter(function(C) {
1262
- return C.contains(m.target);
1263
- }), b = S.length > 0 ? s(m, S[0]) : !c.current.noIsolation;
1264
- b && m.cancelable && m.preventDefault();
1265
- }
1266
- }
1267
- }, []), l = a.useCallback(function(u, m, y, w) {
1268
- var S = { name: u, delta: m, target: y, should: w, shadowParent: Qn(y) };
1269
- t.current.push(S), setTimeout(function() {
1270
- t.current = t.current.filter(function(b) {
1271
- return b !== S;
1272
- });
1273
- }, 1);
1274
- }, []), v = a.useCallback(function(u) {
1275
- n.current = X(u), r.current = void 0;
1276
- }, []), f = a.useCallback(function(u) {
1277
- l(u.type, Re(u), u.target, s(u, e.lockRef.current));
1278
- }, []), p = a.useCallback(function(u) {
1279
- l(u.type, X(u), u.target, s(u, e.lockRef.current));
1280
- }, []);
1281
- a.useEffect(function() {
1282
- return k.push(i), e.setCallbacks({
1283
- onScrollCapture: f,
1284
- onWheelCapture: f,
1285
- onTouchMoveCapture: p
1286
- }), document.addEventListener("wheel", d, I), document.addEventListener("touchmove", d, I), document.addEventListener("touchstart", v, I), function() {
1287
- k = k.filter(function(u) {
1288
- return u !== i;
1289
- }), document.removeEventListener("wheel", d, I), document.removeEventListener("touchmove", d, I), document.removeEventListener("touchstart", v, I);
1290
- };
1291
- }, []);
1292
- var h = e.removeScrollBar, g = e.inert;
1293
- return a.createElement(
1294
- a.Fragment,
1295
- null,
1296
- g ? a.createElement(i, { styles: Zn(o) }) : null,
1297
- h ? a.createElement(Un, { noRelative: e.noRelative, gapMode: e.gapMode }) : null
1298
- );
1299
- }
1300
- function Qn(e) {
1301
- for (var t = null; e !== null; )
1302
- e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode;
1303
- return t;
1304
- }
1305
- const Jn = On(Ve, qn);
1306
- var er = a.forwardRef(function(e, t) {
1307
- return a.createElement(q, O({}, e, { ref: t, sideCar: Jn }));
1308
- });
1309
- er.classNames = q.classNames;
1310
- export {
1311
- ur as A,
1312
- lr as C,
1313
- kt as D,
1314
- $t as F,
1315
- M as P,
1316
- cr as R,
1317
- wt as a,
1318
- ir as b,
1319
- sr as c,
1320
- _ as d,
1321
- Q as e,
1322
- un as f,
1323
- sn as g,
1324
- vr as h,
1325
- er as i,
1326
- Ct as j,
1327
- ar as k,
1328
- dr as l,
1329
- W as m,
1330
- Tt as n,
1331
- Ne as o,
1332
- fr as u
1333
- };