@orioncactuscorp/ui 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +22 -3
  2. package/dist/components/Accordion/Accordion.css +1 -1
  3. package/dist/components/Accordion/Accordion.js +206 -214
  4. package/dist/components/ActionArea/ActionArea.css +1 -1
  5. package/dist/components/ActionArea/ActionAreaLayout.css +1 -1
  6. package/dist/components/BackgroundIconButton/BackgroundIconButton.css +1 -1
  7. package/dist/components/Badge/Badge.css +1 -1
  8. package/dist/components/Badge/Badge.js +13 -13
  9. package/dist/components/Cell/Cell.css +1 -1
  10. package/dist/components/IconButton/IconButton.css +1 -1
  11. package/dist/components/IconButton/IconButton.js +1 -1
  12. package/dist/components/Loading/Loading.css +1 -1
  13. package/dist/components/Menu/Menu.css +1 -1
  14. package/dist/components/Menu/Menu.js +156 -140
  15. package/dist/components/Modal/Modal.css +1 -1
  16. package/dist/components/Modal/Modal.js +571 -391
  17. package/dist/components/Modal/Modal.module.scss.js +58 -38
  18. package/dist/components/Modal/snapPoints.js +59 -35
  19. package/dist/components/Modal/useModalDrag.js +754 -579
  20. package/dist/components/Modal.js +7 -6
  21. package/dist/components/Skeleton/Skeleton.css +1 -0
  22. package/dist/components/Skeleton/Skeleton.js +55 -0
  23. package/dist/components/Skeleton/Skeleton.module.scss.js +16 -0
  24. package/dist/components/Skeleton.d.ts +6 -0
  25. package/dist/components/Skeleton.js +4 -0
  26. package/dist/components/TextButton/TextButton.css +1 -1
  27. package/dist/components/TextButton/TextButton.js +45 -48
  28. package/dist/components/internal/DisclosureIndicator.js +39 -0
  29. package/dist/components/internal/Pressable.js +28 -27
  30. package/dist/foundations/motion.css +1 -1
  31. package/dist/foundations/space.css +1 -1
  32. package/dist/foundations.css +2 -2
  33. package/dist/index.js +90 -87
  34. package/dist/react/motion.js +79 -74
  35. package/dist/styles.css +14 -13
  36. package/dist/ui/src/components/Accordion/Accordion.d.ts.map +1 -1
  37. package/dist/ui/src/components/Menu/Menu.d.ts +1 -1
  38. package/dist/ui/src/components/Menu/Menu.d.ts.map +1 -1
  39. package/dist/ui/src/components/Menu/index.d.ts +1 -1
  40. package/dist/ui/src/components/Menu/index.d.ts.map +1 -1
  41. package/dist/ui/src/components/Menu/types.d.ts +6 -2
  42. package/dist/ui/src/components/Menu/types.d.ts.map +1 -1
  43. package/dist/ui/src/components/Modal/Modal.d.ts +3 -1
  44. package/dist/ui/src/components/Modal/Modal.d.ts.map +1 -1
  45. package/dist/ui/src/components/Modal/contexts.d.ts +2 -0
  46. package/dist/ui/src/components/Modal/contexts.d.ts.map +1 -1
  47. package/dist/ui/src/components/Modal/index.d.ts +2 -2
  48. package/dist/ui/src/components/Modal/index.d.ts.map +1 -1
  49. package/dist/ui/src/components/Modal/snapPoints.d.ts +7 -10
  50. package/dist/ui/src/components/Modal/snapPoints.d.ts.map +1 -1
  51. package/dist/ui/src/components/Modal/types.d.ts +17 -0
  52. package/dist/ui/src/components/Modal/types.d.ts.map +1 -1
  53. package/dist/ui/src/components/Modal/useModalDrag.d.ts +2 -1
  54. package/dist/ui/src/components/Modal/useModalDrag.d.ts.map +1 -1
  55. package/dist/ui/src/components/Skeleton/Skeleton.d.ts +4 -0
  56. package/dist/ui/src/components/Skeleton/Skeleton.d.ts.map +1 -0
  57. package/dist/ui/src/components/Skeleton/index.d.ts +3 -0
  58. package/dist/ui/src/components/Skeleton/index.d.ts.map +1 -0
  59. package/dist/ui/src/components/Skeleton/types.d.ts +17 -0
  60. package/dist/ui/src/components/Skeleton/types.d.ts.map +1 -0
  61. package/dist/ui/src/components/TextButton/TextButton.d.ts.map +1 -1
  62. package/dist/ui/src/components/TextButton/types.d.ts +4 -2
  63. package/dist/ui/src/components/TextButton/types.d.ts.map +1 -1
  64. package/dist/ui/src/components/internal/DisclosureIndicator.d.ts +10 -0
  65. package/dist/ui/src/components/internal/DisclosureIndicator.d.ts.map +1 -0
  66. package/dist/ui/src/components/internal/Pressable.d.ts +8 -1
  67. package/dist/ui/src/components/internal/Pressable.d.ts.map +1 -1
  68. package/dist/ui/src/index.d.ts +5 -3
  69. package/dist/ui/src/index.d.ts.map +1 -1
  70. package/dist/ui/src/react/motion/index.d.ts +3 -1
  71. package/dist/ui/src/react/motion/index.d.ts.map +1 -1
  72. package/dist/ui/src/utils/motion.d.ts +2 -2
  73. package/dist/ui/src/utils/motion.d.ts.map +1 -1
  74. package/dist/utils/motion.js +24 -18
  75. package/dist/vscode/oc-ui-vars.css +6 -4
  76. package/package.json +1 -1
  77. package/src/scss/foundations/motion.scss +3 -1
  78. package/src/scss/foundations/responsive.test.ts +22 -0
  79. package/src/scss/foundations/space.scss +9 -4
  80. package/src/scss/mixins/_motion.scss +5 -8
  81. package/src/scss/mixins/_motion.test.ts +20 -0
@@ -1,10 +1,10 @@
1
- import { useRef as S, useLayoutEffect as ot, useCallback as p, useEffect as kt } from "react";
2
- import { ocSpring as Ee } from "../../utils/spring.js";
3
- import { resolveOcMotion as Ct } from "../../utils/motion.js";
4
- import { resolveModalPopupSnapPositions as Le } from "./snapPoints.js";
5
- import { setModalBodyTouchScrollLock as It, shouldLockModalBodyTouchScroll as be, shouldIgnoreDragTarget as Ot, getScrollableAncestor as Fe, getBottomTouchDragDecision as Ae, getPopupTouchDragDecision as Be } from "./modalScrollArbitration.js";
6
- import { createSpringAnimator as Vt } from "../../utils/spring/animator.js";
7
- const L = {
1
+ import { useRef as S, useLayoutEffect as Z, useCallback as d, useEffect as Mt } from "react";
2
+ import { ocSpring as Ce } from "../../utils/spring.js";
3
+ import { resolveOcMotion as Nt } from "../../utils/motion.js";
4
+ import { resolveModalPopupSnapPositions as Be } from "./snapPoints.js";
5
+ import { setModalBodyTouchScrollLock as Ot, shouldLockModalBodyTouchScroll as Ie, shouldIgnoreDragTarget as Vt, getScrollableAncestor as Ae, getBottomTouchDragDecision as Ne, getPopupTouchDragDecision as Oe } from "./modalScrollArbitration.js";
6
+ import { createSpringAnimator as Ht } from "../../utils/spring/animator.js";
7
+ const M = {
8
8
  dragStartThresholdPx: {
9
9
  touch: 10,
10
10
  mouse: 2
@@ -35,31 +35,31 @@ const L = {
35
35
  popupDragFollower: {
36
36
  settleDurationFactor: 1 / 6
37
37
  }
38
- }, ke = Ee.snappy({
39
- duration: L.settleSpring.durationSeconds * L.popupDragFollower.settleDurationFactor
40
- }), Ce = [], Ie = [];
41
- function oe(r) {
38
+ }, Ve = Ce.snappy({
39
+ duration: M.settleSpring.durationSeconds * M.popupDragFollower.settleDurationFactor
40
+ }), He = [], je = [];
41
+ function le(r) {
42
42
  r.cancelable !== !1 && r.preventDefault();
43
43
  }
44
44
  function b(r, n, i) {
45
45
  return Math.min(Math.max(r, n), i);
46
46
  }
47
- function se(r) {
47
+ function ce(r) {
48
48
  return [...new Set(r)].sort((n, i) => n - i);
49
49
  }
50
- function Oe(r, n) {
50
+ function ze(r, n) {
51
51
  return r.reduce(
52
52
  (i, a) => Math.abs(a - n) < Math.abs(i - n) ? a : i
53
53
  );
54
54
  }
55
- function ie({
55
+ function ue({
56
56
  deltaX: r,
57
57
  deltaY: n,
58
58
  placement: i
59
59
  }) {
60
60
  return i === "bottom" ? Math.abs(n) : Math.hypot(r, n);
61
61
  }
62
- function Ve(r, n, i) {
62
+ function _e(r, n, i) {
63
63
  if (i === "down")
64
64
  return r.find((l) => l > n + 1) ?? r[r.length - 1] ?? 0;
65
65
  for (let l = r.length - 1; l >= 0; l -= 1) {
@@ -69,44 +69,55 @@ function Ve(r, n, i) {
69
69
  }
70
70
  return r[0] ?? 0;
71
71
  }
72
- function Ne(r, n, i, a, l = i) {
73
- const y = Ve(r, n, a), T = a === "down" ? Math.max(i, l) : Math.min(i, l);
72
+ function Re(r, n, i, a, l = i) {
73
+ const y = _e(r, n, a), T = a === "down" ? Math.max(i, l) : Math.min(i, l);
74
74
  if (a === "down") {
75
75
  if (r.filter(
76
- (F) => F > n + 1 && F <= i + 1
76
+ (k) => k > n + 1 && k <= i + 1
77
77
  ).length === 0) return y;
78
- const lt = r.filter(
79
- (F) => F > n + 1 && F <= T + 1
78
+ const dt = r.filter(
79
+ (k) => k > n + 1 && k <= T + 1
80
80
  );
81
- return lt[lt.length - 1] ?? y;
81
+ return dt[dt.length - 1] ?? y;
82
82
  }
83
83
  return r.filter(
84
- (E) => E < n - 1 && E >= i - 1
84
+ (L) => L < n - 1 && L >= i - 1
85
85
  ).length === 0 ? y : r.filter(
86
- (E) => E < n - 1 && E >= T - 1
86
+ (L) => L < n - 1 && L >= T - 1
87
87
  )[0] ?? y;
88
88
  }
89
- function le(r, n) {
89
+ function pe(r, n) {
90
90
  if (n <= 0) return 0;
91
- const i = n, { resistance: a } = L.rubberBand;
91
+ const i = n, { resistance: a } = M.rubberBand;
92
92
  return r * a * i / (i + a * r);
93
93
  }
94
- function Nt({
94
+ function jt({
95
95
  targetTranslate: r,
96
96
  minTranslate: n,
97
97
  maxTranslate: i,
98
98
  minBoundaryLimit: a,
99
99
  maxBoundaryLimit: l
100
100
  }) {
101
- return r < n ? n - le(n - r, a) : r > i ? i + le(r - i, l) : r;
101
+ return r < n ? n - pe(n - r, a) : r > i ? i + pe(r - i, l) : r;
102
102
  }
103
- function ce(r) {
103
+ function de(r) {
104
104
  return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest('[data-oc-part="handle"], [data-oc-part="header"]');
105
105
  }
106
- function He(r, n) {
106
+ function fe(r) {
107
+ return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest(
108
+ '[data-oc-part="handle"], [data-oc-component="modal-navigation"]'
109
+ );
110
+ }
111
+ function Ue(r) {
112
+ return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest('[data-oc-component="modal-navigation"]');
113
+ }
114
+ function We(r) {
115
+ return typeof Element > "u" || !(r instanceof Element) ? null : r.closest('[data-oc-component="modal-navigation"]');
116
+ }
117
+ function $e(r, n) {
107
118
  return n ? !0 : r.pointerType ? r.pointerType === "touch" : typeof window > "u" ? !1 : window.matchMedia?.("(pointer: coarse)").matches ?? !1;
108
119
  }
109
- function ue(r, n) {
120
+ function ge(r, n) {
110
121
  if (!r.length)
111
122
  return {
112
123
  minTranslate: 0,
@@ -125,14 +136,14 @@ function ue(r, n) {
125
136
  maxTranslate: l
126
137
  };
127
138
  }
128
- function pe(r, n) {
139
+ function me(r, n) {
129
140
  for (let i = 0; i < r.length; i += 1) {
130
141
  const a = "item" in r && typeof r.item == "function" ? r.item(i) : r[i];
131
142
  if (a?.identifier === n) return a;
132
143
  }
133
144
  return null;
134
145
  }
135
- function xe(r) {
146
+ function De(r) {
136
147
  if (!r) return { x: 0, y: 0 };
137
148
  const n = window.getComputedStyle(r).transform;
138
149
  if (!n || n === "none") return { x: 0, y: 0 };
@@ -154,62 +165,62 @@ function xe(r) {
154
165
  }
155
166
  return { x: 0, y: 0 };
156
167
  }
157
- function Ht(r) {
158
- return xe(r).y;
168
+ function zt(r) {
169
+ return De(r).y;
159
170
  }
160
- function de(r) {
161
- return xe(r);
171
+ function he(r) {
172
+ return De(r);
162
173
  }
163
- function st(r) {
164
- if (!r) return;
174
+ function pt(r) {
175
+ if (!r || !/^-?\d*\.?\d+(?:px)?$/.test(r.trim())) return;
165
176
  const n = Number.parseFloat(r);
166
177
  return Number.isFinite(n) ? n : void 0;
167
178
  }
168
- function ut() {
179
+ function $() {
169
180
  return Date.now();
170
181
  }
171
- function je(r, n) {
172
- const i = n - L.releaseVelocity.sampleWindowMs;
182
+ function Ge(r, n) {
183
+ const i = n - M.releaseVelocity.sampleWindowMs;
173
184
  for (; r.length > 2 && (r[1]?.time ?? n) < i; )
174
185
  r.shift();
175
186
  }
176
- function pt(r, n) {
177
- const i = n.time ?? ut();
187
+ function mt(r, n) {
188
+ const i = n.time ?? $();
178
189
  r.samples.push({
179
190
  time: i,
180
191
  pageX: n.pageX,
181
192
  pageY: n.pageY,
182
193
  translateX: n.translateX,
183
194
  translateY: n.translateY
184
- }), je(r.samples, i);
195
+ }), Ge(r.samples, i);
185
196
  }
186
- function Yt(r, n) {
197
+ function Lt(r, n) {
187
198
  return {
188
199
  x: r.startTranslateX + n.pageX - r.startX,
189
200
  y: r.startTranslate + n.pageY - r.startY
190
201
  };
191
202
  }
192
- function fe(r, n) {
193
- const i = Yt(r, n);
194
- pt(r, {
203
+ function ye(r, n) {
204
+ const i = Lt(r, n);
205
+ mt(r, {
195
206
  pageX: n.pageX,
196
207
  pageY: n.pageY,
197
208
  translateX: i.x,
198
209
  translateY: i.y
199
210
  });
200
211
  }
201
- function ge({
212
+ function Te({
202
213
  session: r,
203
214
  fallbackDeltaY: n,
204
215
  fallbackElapsed: i
205
216
  }) {
206
- const a = r.samples[r.samples.length - 1], { maxPxPerSecond: l, sampleWindowMs: f } = L.releaseVelocity;
217
+ const a = r.samples[r.samples.length - 1], { maxPxPerSecond: l, sampleWindowMs: f } = M.releaseVelocity;
207
218
  if (a) {
208
- const y = a.time - f, T = r.samples.find((w) => w.time >= y) ?? r.samples[0];
219
+ const y = a.time - f, T = r.samples.find((D) => D.time >= y) ?? r.samples[0];
209
220
  if (T && T !== a) {
210
- const w = Math.max(a.time - T.time, 1), D = (a.translateY - T.translateY) / w * 1e3;
211
- if (Number.isFinite(D))
212
- return b(D, -l, l);
221
+ const D = Math.max(a.time - T.time, 1), Y = (a.translateY - T.translateY) / D * 1e3;
222
+ if (Number.isFinite(Y))
223
+ return b(Y, -l, l);
213
224
  }
214
225
  }
215
226
  return b(
@@ -218,23 +229,23 @@ function ge({
218
229
  l
219
230
  );
220
231
  }
221
- function me({
232
+ function xe({
222
233
  session: r,
223
234
  fallbackDelta: n,
224
235
  fallbackElapsed: i
225
236
  }) {
226
- const a = r.samples[r.samples.length - 1], { maxPxPerSecond: l, sampleWindowMs: f } = L.releaseVelocity;
237
+ const a = r.samples[r.samples.length - 1], { maxPxPerSecond: l, sampleWindowMs: f } = M.releaseVelocity;
227
238
  if (a) {
228
- const y = a.time - f, T = r.samples.find((w) => w.time >= y) ?? r.samples[0];
239
+ const y = a.time - f, T = r.samples.find((D) => D.time >= y) ?? r.samples[0];
229
240
  if (T && T !== a) {
230
- const w = Math.max(a.time - T.time, 1), D = {
231
- x: (a.translateX - T.translateX) / w * 1e3,
232
- y: (a.translateY - T.translateY) / w * 1e3
241
+ const D = Math.max(a.time - T.time, 1), Y = {
242
+ x: (a.translateX - T.translateX) / D * 1e3,
243
+ y: (a.translateY - T.translateY) / D * 1e3
233
244
  };
234
- if (Number.isFinite(D.x) && Number.isFinite(D.y))
245
+ if (Number.isFinite(Y.x) && Number.isFinite(Y.y))
235
246
  return {
236
- x: b(D.x, -l, l),
237
- y: b(D.y, -l, l)
247
+ x: b(Y.x, -l, l),
248
+ y: b(Y.y, -l, l)
238
249
  };
239
250
  }
240
251
  }
@@ -251,18 +262,18 @@ function me({
251
262
  )
252
263
  };
253
264
  }
254
- function ze({
265
+ function Ke({
255
266
  currentTranslate: r,
256
267
  releaseVelocity: n
257
268
  }) {
258
- const { lookaheadSeconds: i, maxDistancePx: a } = L.snapProjection;
269
+ const { lookaheadSeconds: i, maxDistancePx: a } = M.snapProjection;
259
270
  return r + b(n * i, -a, a);
260
271
  }
261
- function Re({
272
+ function Je({
262
273
  currentTranslate: r,
263
274
  releaseVelocity: n
264
275
  }) {
265
- const { lookaheadSeconds: i, maxDistancePx: a } = L.snapProjection;
276
+ const { lookaheadSeconds: i, maxDistancePx: a } = M.snapProjection;
266
277
  return {
267
278
  x: r.x + b(
268
279
  n.x * i,
@@ -276,55 +287,119 @@ function Re({
276
287
  )
277
288
  };
278
289
  }
279
- function _e(r) {
280
- return Math.abs(r) / 1e3 > L.releaseVelocity.flickThresholdPxPerMs;
290
+ function Qe(r) {
291
+ return Math.abs(r) / 1e3 > M.releaseVelocity.flickThresholdPxPerMs;
281
292
  }
282
- function Ue(r) {
283
- return Math.hypot(r.x, r.y) / 1e3 > L.releaseVelocity.flickThresholdPxPerMs;
293
+ function Ze(r) {
294
+ return Math.hypot(r.x, r.y) / 1e3 > M.releaseVelocity.flickThresholdPxPerMs;
284
295
  }
285
- function it(r, n) {
296
+ function G(r, n) {
286
297
  return Math.hypot(r.x - n.x, r.y - n.y);
287
298
  }
288
- function he(r, n) {
299
+ function Pe(r, n) {
289
300
  return r.reduce(
290
- (i, a) => it(a, n) < it(i, n) ? a : i
301
+ (i, a) => G(a, n) < G(i, n) ? a : i
291
302
  );
292
303
  }
293
- function We({
304
+ function qe({
294
305
  currentTranslate: r,
295
306
  releaseVelocity: n,
296
307
  targets: i
297
308
  }) {
298
- const a = Re({
309
+ const a = Je({
299
310
  currentTranslate: r,
300
311
  releaseVelocity: n
301
312
  });
302
- if (!Ue(n))
303
- return he(i, r);
313
+ if (!Ze(n))
314
+ return Pe(i, r);
304
315
  const l = i.filter((f) => {
305
316
  const y = f.x - r.x, T = f.y - r.y;
306
317
  return y * n.x + T * n.y > 0;
307
318
  });
308
- return he(
319
+ return Pe(
309
320
  l.length ? l : i,
310
321
  a
311
322
  );
312
323
  }
313
- function $e({
324
+ function Xe(r) {
325
+ return r === "top" || r.startsWith("top-") ? "top" : r === "bottom" || r.startsWith("bottom-") ? "bottom" : "center";
326
+ }
327
+ function tr({
328
+ target: r,
329
+ targets: n
330
+ }) {
331
+ const i = n.filter((a) => a !== r);
332
+ if (i.length)
333
+ return i.reduce(
334
+ (a, l) => Math.min(a, G(r, l)),
335
+ Number.POSITIVE_INFINITY
336
+ );
337
+ }
338
+ function er({
339
+ closeThreshold: r,
340
+ currentTarget: n,
341
+ surfaceSize: i,
342
+ targets: a
343
+ }) {
344
+ const l = Xe(n.key), f = l === "center" ? Math.min(i.width, i.height) : i.height, y = Math.max(
345
+ M.dismissal.minDistancePx,
346
+ f * r
347
+ );
348
+ if (l !== "center") return y;
349
+ const T = tr({
350
+ target: n,
351
+ targets: a
352
+ });
353
+ return !T || !Number.isFinite(T) ? y : Math.max(y, T * 0.75);
354
+ }
355
+ function rr({
356
+ currentTarget: r,
357
+ currentTranslate: n
358
+ }) {
359
+ switch (Xe(r.key)) {
360
+ case "top":
361
+ return r.y - n.y;
362
+ case "bottom":
363
+ return n.y - r.y;
364
+ case "center":
365
+ return G(r, n);
366
+ }
367
+ }
368
+ function nr({
369
+ closeThreshold: r,
370
+ currentTarget: n,
371
+ currentTranslate: i,
372
+ releaseTarget: a,
373
+ surfaceSize: l,
374
+ targets: f
375
+ }) {
376
+ if (a.key !== n.key) return !1;
377
+ const y = rr({
378
+ currentTarget: n,
379
+ currentTranslate: i
380
+ });
381
+ return y <= 0 ? !1 : y >= er({
382
+ closeThreshold: r,
383
+ currentTarget: n,
384
+ surfaceSize: l,
385
+ targets: f
386
+ });
387
+ }
388
+ function ar({
314
389
  presentationState: r,
315
390
  releaseTranslate: n,
316
391
  visibleTranslate: i
317
392
  }) {
318
393
  return r !== "visible" || Math.abs(n - i) > 1;
319
394
  }
320
- function Ge({
395
+ function or({
321
396
  drag: r,
322
397
  placement: n,
323
398
  snapPositionCount: i
324
399
  }) {
325
- return n === "popup" && r === "content" && i > 0;
400
+ return n === "popup" && (r === "content" || r === "handle") && i > 0;
326
401
  }
327
- function Ke({
402
+ function sr({
328
403
  dismissible: r,
329
404
  peekTranslate: n,
330
405
  sheetHeight: i,
@@ -335,11 +410,11 @@ function Ke({
335
410
  minTranslate: 0
336
411
  };
337
412
  }
338
- function ye(r, n = 1) {
413
+ function we(r, n = 1) {
339
414
  const i = Math.max(n, 1);
340
415
  return r && Math.abs(r.maxTranslate - r.minTranslate) || i;
341
416
  }
342
- function Te({
417
+ function ve({
343
418
  limit: r,
344
419
  viewportSize: n,
345
420
  viewportLimitRatio: i
@@ -347,26 +422,26 @@ function Te({
347
422
  const a = Math.max(r, 0);
348
423
  return n <= 0 ? a : Math.min(a, n * i);
349
424
  }
350
- function qe({
425
+ function ir({
351
426
  minTranslate: r,
352
427
  sheetHeight: n,
353
428
  surfaceMotion: i
354
429
  }) {
355
- const a = i.parentElement?.getBoundingClientRect(), l = a?.top ?? 0, f = a && a.height > 0 ? a.height : window.innerHeight, y = i.getBoundingClientRect(), T = Ht(i), w = y.top - T + r, D = Math.max(w - l, 0), { observedViewportLimitRatio: E } = L.rubberBand;
430
+ const a = i.parentElement?.getBoundingClientRect(), l = a?.top ?? 0, f = a && a.height > 0 ? a.height : window.innerHeight, y = i.getBoundingClientRect(), T = zt(i), D = y.top - T + r, Y = Math.max(D - l, 0), { observedViewportLimitRatio: L } = M.rubberBand;
356
431
  return {
357
- minBoundaryLimit: Te({
358
- limit: D,
432
+ minBoundaryLimit: ve({
433
+ limit: Y,
359
434
  viewportSize: f,
360
- viewportLimitRatio: E.top
435
+ viewportLimitRatio: L.top
361
436
  }),
362
- maxBoundaryLimit: Te({
437
+ maxBoundaryLimit: ve({
363
438
  limit: n,
364
439
  viewportSize: f,
365
- viewportLimitRatio: E.bottom
440
+ viewportLimitRatio: L.bottom
366
441
  })
367
442
  };
368
443
  }
369
- function Je({
444
+ function lr({
370
445
  rubberBand: r,
371
446
  targetTranslate: n,
372
447
  sheetHeight: i,
@@ -375,21 +450,21 @@ function Je({
375
450
  rubberBandLimits: f
376
451
  }) {
377
452
  const y = b(
378
- r ? Nt({
453
+ r ? jt({
379
454
  targetTranslate: n,
380
455
  ...f,
381
456
  ...l
382
457
  }) : n,
383
458
  l.minTranslate - f.minBoundaryLimit,
384
459
  l.maxTranslate + f.maxBoundaryLimit
385
- ), T = Math.max(-y, 0), w = Math.max(y, 0), D = a > 0 ? a : i, E = D > 0 ? 1 - w / Math.max(D, 1) : 0;
460
+ ), T = Math.max(-y, 0), D = Math.max(y, 0), Y = a > 0 ? a : i, L = Y > 0 ? 1 - D / Math.max(Y, 1) : 0;
386
461
  return {
387
462
  translate: y,
388
463
  overshootFillHeight: T,
389
- backdropOpacity: b(E, 0, 1)
464
+ backdropOpacity: b(L, 0, 1)
390
465
  };
391
466
  }
392
- function ar({
467
+ function mr({
393
468
  enabled: r,
394
469
  drag: n,
395
470
  open: i,
@@ -397,21 +472,22 @@ function ar({
397
472
  surfaceMotionRef: l,
398
473
  backdropRef: f,
399
474
  bodyNode: y,
400
- snapHeights: T = Ce,
401
- snapPositions: w = Ie,
402
- defaultSnapPosition: D,
403
- peekHeight: E,
404
- peekFallback: lt,
405
- presentationState: F,
406
- setPresentationState: Mt,
407
- requestClose: dt,
408
- canCloseAttempt: jt,
409
- dismissible: R = !0,
410
- visibleTranslate: N = 0,
411
- closeThreshold: Et = 0.35,
412
- scrollLockTimeout: zt = 500
475
+ snapHeights: T = He,
476
+ snapPositions: D = je,
477
+ defaultSnapPosition: Y,
478
+ peekHeight: L,
479
+ peekFallback: dt,
480
+ presentationState: k,
481
+ setPresentationState: bt,
482
+ requestClose: q,
483
+ canCloseAttempt: _t,
484
+ dismissible: N = !0,
485
+ visibleTranslate: H = 0,
486
+ closeThreshold: ft = 0.35,
487
+ scrollLockTimeout: Rt = 500,
488
+ popupSnapLayoutVersion: Ut = 0
413
489
  }) {
414
- const x = S({
490
+ const w = S({
415
491
  dragging: !1,
416
492
  allowed: !1,
417
493
  chrome: !1,
@@ -430,71 +506,71 @@ function ar({
430
506
  samples: [],
431
507
  pointerId: null,
432
508
  touchId: null
433
- }), U = S(y), Rt = S(!1), _t = S(!1), Pe = S((t) => {
509
+ }), K = S(y), Wt = S(!1), $t = S(!1), Se = S((t) => {
434
510
  t.preventDefault();
435
- }), ft = S(0), Lt = S(!1), H = S(null), C = S(
511
+ }), ht = S(0), kt = S(!1), j = S(null), O = S(
436
512
  null
437
- ), gt = S(null), $ = S(null), j = S(null), bt = S(!1), Ft = S(!1), At = S(!1), G = S(!1), X = Ge({
513
+ ), yt = S(null), _ = S(null), gt = S(0), z = S(null), Ft = S(!1), Ct = S(!1), Bt = S(!1), tt = S(!1), v = or({
438
514
  drag: n,
439
515
  placement: a,
440
- snapPositionCount: w.length
441
- }), Ut = `${D ?? ""}:${w.join("|")}`, Wt = S(w), mt = S(D);
442
- ot(() => {
443
- Wt.current = w, mt.current = D;
444
- }, [D, Ut, w]), ot(() => {
445
- const t = U.current;
446
- t && t !== y && It(t, !1), U.current = y, Rt.current && It(y, !0);
516
+ snapPositionCount: D.length
517
+ }), Gt = `${Y ?? ""}:${D.join("|")}`, Kt = S(D), Tt = S(Y);
518
+ Z(() => {
519
+ Kt.current = D, Tt.current = Y;
520
+ }, [Y, Gt, D]), Z(() => {
521
+ const t = K.current;
522
+ t && t !== y && Ot(t, !1), K.current = y, Wt.current && Ot(y, !0);
447
523
  }, [y]);
448
- const K = p((t) => {
449
- Rt.current = t, It(U.current, t);
450
- }, []), q = p((t) => {
451
- if (_t.current === t) return;
452
- _t.current = t;
453
- const e = Pe.current;
524
+ const et = d((t) => {
525
+ Wt.current = t, Ot(K.current, t);
526
+ }, []), rt = d((t) => {
527
+ if ($t.current === t) return;
528
+ $t.current = t;
529
+ const e = Se.current;
454
530
  if (t) {
455
531
  document.addEventListener("selectstart", e, !0), document.addEventListener("dragstart", e, !0);
456
532
  return;
457
533
  }
458
534
  document.removeEventListener("selectstart", e, !0), document.removeEventListener("dragstart", e, !0);
459
- }, []), ht = p(
535
+ }, []), xt = d(
460
536
  ({ chrome: t, target: e }) => {
461
- const o = be({
537
+ const o = Ie({
462
538
  target: e,
463
539
  chrome: t,
464
- bodyNode: U.current
540
+ bodyNode: K.current
465
541
  });
466
- return K(o), o;
542
+ return et(o), o;
467
543
  },
468
- [K]
469
- ), I = p(() => l.current?.getBoundingClientRect().height ?? window.innerHeight, [l]), $t = p(() => {
470
- if (E !== void 0) return E;
471
- if (lt === "header")
544
+ [et]
545
+ ), V = d(() => l.current?.getBoundingClientRect().height ?? window.innerHeight, [l]), Jt = d(() => {
546
+ if (L !== void 0) return L;
547
+ if (dt === "header")
472
548
  return l.current?.querySelector('[data-oc-part="header"]')?.getBoundingClientRect().height ?? void 0;
473
- }, [lt, E, l]), A = p(() => {
474
- const t = $t();
549
+ }, [dt, L, l]), C = d(() => {
550
+ const t = Jt();
475
551
  if (t === void 0 || t <= 0) return 0;
476
- const e = I();
552
+ const e = V();
477
553
  return b(e - t, 0, e);
478
- }, [$t, I]), Bt = p(
479
- () => F === "peeked" ? A() : N,
480
- [A, F, N]
481
- ), yt = p(() => {
554
+ }, [Jt, V]), It = d(
555
+ () => k === "peeked" ? C() : H,
556
+ [C, k, H]
557
+ ), Pt = d(() => {
482
558
  const t = l.current;
483
- if (!t) return Bt();
484
- const e = st(
559
+ if (!t) return It();
560
+ const e = pt(
485
561
  t.style.getPropertyValue("--oc-modal-translate-y")
486
562
  );
487
563
  if (e !== void 0) return e;
488
- const o = st(
564
+ const o = pt(
489
565
  window.getComputedStyle(t).getPropertyValue("--oc-modal-translate-y")
490
566
  );
491
- return o !== void 0 ? o : Bt();
492
- }, [Bt, l]), Tt = p(() => {
567
+ return o !== void 0 ? o : It();
568
+ }, [It, l]), wt = d(() => {
493
569
  const t = l.current;
494
570
  if (!t) return { x: 0, y: 0 };
495
- const e = st(
571
+ const e = pt(
496
572
  t.style.getPropertyValue("--oc-modal-translate-x")
497
- ), o = st(
573
+ ), o = pt(
498
574
  t.style.getPropertyValue("--oc-modal-translate-y")
499
575
  );
500
576
  if (e !== void 0 || o !== void 0)
@@ -504,33 +580,33 @@ function ar({
504
580
  };
505
581
  const c = window.getComputedStyle(t);
506
582
  return {
507
- x: st(c.getPropertyValue("--oc-modal-translate-x")) ?? 0,
508
- y: st(c.getPropertyValue("--oc-modal-translate-y")) ?? 0
583
+ x: pt(c.getPropertyValue("--oc-modal-translate-x")) ?? 0,
584
+ y: pt(c.getPropertyValue("--oc-modal-translate-y")) ?? 0
509
585
  };
510
- }, [l]), xt = p(() => {
511
- const t = yt(), e = Ht(l.current);
586
+ }, [l]), vt = d(() => {
587
+ const t = Pt(), e = zt(l.current);
512
588
  return Math.abs(e - t) > 1 ? e : t;
513
- }, [yt, l]), J = p(() => {
514
- const t = Tt(), e = de(l.current);
515
- return it(e, t) > 1 ? e : t;
516
- }, [Tt, l]), B = p(
589
+ }, [Pt, l]), nt = d(() => {
590
+ const t = wt(), e = he(l.current);
591
+ return G(e, t) > 1 ? e : t;
592
+ }, [wt, l]), B = d(
517
593
  (t, {
518
594
  active: e,
519
- nextDismissible: o = R,
595
+ nextDismissible: o = N,
520
596
  rubberBand: c = !1
521
597
  }) => {
522
598
  const s = l.current;
523
599
  if (!s) return;
524
- const u = I(), d = s.parentElement, g = A(), m = Ke({
600
+ const u = V(), p = s.parentElement, g = C(), m = sr({
525
601
  dismissible: o,
526
602
  peekTranslate: g,
527
603
  sheetHeight: u,
528
- visibleTranslate: N
529
- }), h = qe({
604
+ visibleTranslate: H
605
+ }), h = ir({
530
606
  minTranslate: m.minTranslate,
531
607
  sheetHeight: u,
532
608
  surfaceMotion: s
533
- }), M = Je({
609
+ }), P = lr({
534
610
  rubberBand: c,
535
611
  targetTranslate: t,
536
612
  sheetHeight: u,
@@ -538,107 +614,109 @@ function ar({
538
614
  bounds: m,
539
615
  rubberBandLimits: h
540
616
  });
541
- x.current.lastTranslate = M.translate, s.style.setProperty(
617
+ w.current.lastTranslate = P.translate, s.style.setProperty(
542
618
  "--oc-modal-translate-y",
543
- `${M.translate}px`
619
+ `${P.translate}px`
544
620
  ), s.style.setProperty(
545
621
  "--_-modal-elevation-shadow-opacity",
546
- String(1 - M.backdropOpacity)
547
- ), s.dataset.ocModalDragging = e ? "true" : "false", d?.style.setProperty(
622
+ String(1 - P.backdropOpacity)
623
+ ), s.dataset.ocModalDragging = e ? "true" : "false", p?.style.setProperty(
548
624
  "--oc-modal-overshoot-fill-height",
549
- `${M.overshootFillHeight}px`
550
- ), d && (d.dataset.ocModalDragging = e ? "true" : "false"), e ? s.style.setProperty("transition", "none") : s.style.removeProperty("transition"), f.current && (f.current.style.setProperty(
625
+ `${P.overshootFillHeight}px`
626
+ ), p && (p.dataset.ocModalDragging = e ? "true" : "false"), e ? s.style.setProperty("transition", "none") : s.style.removeProperty("transition"), f.current && (f.current.style.setProperty(
551
627
  "--oc-modal-backdrop-opacity",
552
- String(M.backdropOpacity)
628
+ String(P.backdropOpacity)
553
629
  ), f.current.style.transition = e ? "none" : "");
554
630
  },
555
631
  [
556
632
  f,
557
- R,
558
- A,
559
- I,
633
+ N,
634
+ C,
635
+ V,
560
636
  l,
561
- N
637
+ H
562
638
  ]
563
- ), Q = p(() => {
564
- const t = l.current, e = Wt.current;
639
+ ), at = d(() => {
640
+ const t = l.current, e = Kt.current;
565
641
  if (!(!t || !e.length))
566
- return Le({
567
- defaultSnapPosition: mt.current,
642
+ return Be({
643
+ defaultSnapPosition: Tt.current,
568
644
  snapPositions: e,
569
645
  surfaceMotion: t
570
646
  });
571
- }, [l]), Z = p(
647
+ }, [l]), R = d(
572
648
  ({ destroy: t = !0 } = {}) => {
573
- t && C.current?.destroy(), C.current = null, gt.current = null;
649
+ t && O.current?.destroy(), O.current = null, yt.current = null;
574
650
  },
575
651
  []
576
- ), Y = p(
652
+ ), E = d(
577
653
  (t, { active: e }) => {
578
654
  const o = l.current;
579
655
  if (!o) return;
580
- const c = Q(), s = c ? o.getBoundingClientRect() : void 0, u = c ? ue(c.targets, "x") : void 0, d = c ? ue(c.targets, "y") : void 0, g = ye(u, s?.width), m = ye(d, s?.height), h = c ? {
581
- x: Nt({
656
+ const c = at(), s = c ? o.getBoundingClientRect() : void 0, u = c ? ge(c.targets, "x") : void 0, p = c ? ge(c.targets, "y") : void 0, g = we(u, s?.width), m = we(p, s?.height), h = c ? {
657
+ x: jt({
582
658
  targetTranslate: t.x,
583
659
  minTranslate: u?.minTranslate ?? 0,
584
660
  maxTranslate: u?.maxTranslate ?? 0,
585
661
  minBoundaryLimit: g,
586
662
  maxBoundaryLimit: g
587
663
  }),
588
- y: Nt({
664
+ y: jt({
589
665
  targetTranslate: t.y,
590
- minTranslate: d?.minTranslate ?? 0,
591
- maxTranslate: d?.maxTranslate ?? 0,
666
+ minTranslate: p?.minTranslate ?? 0,
667
+ maxTranslate: p?.maxTranslate ?? 0,
592
668
  minBoundaryLimit: m,
593
669
  maxBoundaryLimit: m
594
670
  })
595
671
  } : t;
596
- x.current.lastTranslateX = h.x, x.current.lastTranslate = h.y, o.style.setProperty(
672
+ w.current.lastTranslateX = h.x, w.current.lastTranslate = h.y;
673
+ const P = e ? void 0 : t.settledTranslate;
674
+ o.style.setProperty(
597
675
  "--oc-modal-translate-x",
598
- `${h.x}px`
676
+ P?.x ?? `${h.x}px`
599
677
  ), o.style.setProperty(
600
678
  "--oc-modal-translate-y",
601
- `${h.y}px`
679
+ P?.y ?? `${h.y}px`
602
680
  ), o.dataset.ocModalDragging = e ? "true" : "false", o.parentElement && (o.parentElement.dataset.ocModalDragging = e ? "true" : "false"), o.style.transition = e ? "none" : "";
603
681
  },
604
- [Q, l]
605
- ), v = p(() => {
606
- H.current?.destroy(), H.current = null, Z();
607
- }, [Z]), tt = p(
608
- (t, e = R) => {
609
- v(), B(t, {
682
+ [at, l]
683
+ ), X = d(() => {
684
+ j.current?.destroy(), j.current = null, R();
685
+ }, [R]), ot = d(
686
+ (t, e = N) => {
687
+ X(), B(t, {
610
688
  active: !0,
611
689
  nextDismissible: e,
612
690
  rubberBand: !0
613
691
  });
614
692
  },
615
- [B, v, R]
616
- ), Gt = p(() => {
617
- const t = xt(), e = J();
618
- return H.current !== null || C.current !== null ? (v(), a === "popup" && it(e, { x: 0, y: 0 }) > 0.5 ? Y(e, { active: !1 }) : a === "bottom" && Math.abs(t) > 0.5 && B(t, { active: !1 }), { startTranslate: t, startTranslatePoint: e }) : { startTranslate: t, startTranslatePoint: e };
693
+ [B, X, N]
694
+ ), Qt = d(() => {
695
+ const t = vt(), e = nt();
696
+ return j.current !== null || O.current !== null ? (X(), a === "popup" && G(e, { x: 0, y: 0 }) > 0.5 ? E(e, { active: !1 }) : a === "bottom" && Math.abs(t) > 0.5 && B(t, { active: !1 }), { startTranslate: t, startTranslatePoint: e }) : { startTranslate: t, startTranslatePoint: e };
619
697
  }, [
620
- Y,
698
+ E,
621
699
  B,
622
- v,
623
- xt,
624
- J,
700
+ X,
701
+ vt,
702
+ nt,
625
703
  a
626
- ]), P = p(() => {
704
+ ]), x = d(() => {
627
705
  const t = l.current;
628
706
  t && (t.dataset.ocModalDragging = "false", t.style.removeProperty("transition"), t.parentElement && (t.parentElement.dataset.ocModalDragging = "false"), f.current?.style.removeProperty("transition"));
629
- }, [f, l]), Kt = p(() => {
707
+ }, [f, l]), Zt = d(() => {
630
708
  const t = l.current, e = t?.parentElement;
631
- x.current.lastTranslate = 0, t?.style.removeProperty("--oc-modal-translate-y"), t?.style.removeProperty("--_-modal-elevation-shadow-opacity"), e?.style.removeProperty("--oc-modal-overshoot-fill-height"), f.current?.style.removeProperty("--oc-modal-backdrop-opacity"), P();
632
- }, [f, P, l]), qt = p(
709
+ w.current.lastTranslate = 0, t?.style.removeProperty("--oc-modal-translate-y"), t?.style.removeProperty("--_-modal-elevation-shadow-opacity"), e?.style.removeProperty("--oc-modal-overshoot-fill-height"), f.current?.style.removeProperty("--oc-modal-backdrop-opacity"), x();
710
+ }, [f, x, l]), qt = d(
633
711
  ({
634
712
  preserveSnapPosition: t = !1,
635
713
  resetY: e = !0
636
714
  } = {}) => {
637
715
  const o = l.current;
638
- o && (t || ($.current = null), x.current.lastTranslateX = 0, o.style.removeProperty("--oc-modal-translate-x"), e && (x.current.lastTranslate = 0, o.style.removeProperty("--oc-modal-translate-y")), P());
716
+ o && (t || (_.current = null), w.current.lastTranslateX = 0, o.style.removeProperty("--oc-modal-translate-x"), e && (w.current.lastTranslate = 0, o.style.removeProperty("--oc-modal-translate-y")), x());
639
717
  },
640
- [P, l]
641
- ), k = p(
718
+ [x, l]
719
+ ), I = d(
642
720
  (t, {
643
721
  initialVelocity: e = 0,
644
722
  intent: o = "sheet",
@@ -646,23 +724,23 @@ function ar({
646
724
  from: s,
647
725
  onComplete: u
648
726
  } = {}) => {
649
- const d = l.current;
650
- if (!d) return;
651
- v();
652
- const g = s ?? Ht(d);
727
+ const p = l.current;
728
+ if (!p) return;
729
+ X();
730
+ const g = s ?? zt(p);
653
731
  if (Math.abs(g - t) < 0.5) {
654
- B(t, { active: !1 }), P(), u?.();
732
+ B(t, { active: !1 }), x(), u?.();
655
733
  return;
656
734
  }
657
735
  B(g, { active: !0 });
658
- const m = Ct({
659
- element: d,
736
+ const m = Nt({
737
+ element: p,
660
738
  intent: o,
661
739
  phase: c,
662
740
  reduced: "preserve",
663
741
  reducedMotion: !1,
664
742
  property: "transform"
665
- }), h = Vt({
743
+ }), h = Ht({
666
744
  value: g,
667
745
  target: t,
668
746
  velocity: e,
@@ -670,38 +748,38 @@ function ar({
670
748
  epsilon: 0.5,
671
749
  velocityEpsilon: 50,
672
750
  stabilityWindow: 0.02,
673
- onUpdate: (M) => {
674
- B(M, { active: !0 });
751
+ onUpdate: (P) => {
752
+ B(P, { active: !0 });
675
753
  },
676
754
  onComplete: () => {
677
- H.current === h && (H.current = null), B(t, { active: !1 }), P(), u?.();
755
+ j.current === h && (j.current = null), B(t, { active: !1 }), x(), u?.();
678
756
  }
679
757
  });
680
- H.current = h;
758
+ j.current = h;
681
759
  },
682
- [B, v, P, l]
683
- ), _ = p(
760
+ [B, X, x, l]
761
+ ), U = d(
684
762
  (t, {
685
763
  from: e,
686
764
  initialVelocity: o = { x: 0, y: 0 }
687
765
  } = {}) => {
688
766
  const c = l.current;
689
767
  if (!c) return;
690
- v();
691
- const s = e ?? de(c), u = { x: t.x, y: t.y };
692
- if (it(s, u) < 0.5) {
693
- Y(u, { active: !1 }), P();
768
+ X();
769
+ const s = e ?? he(c), u = { x: t.x, y: t.y };
770
+ if (G(s, u) < 0.5) {
771
+ E(t, { active: !1 }), x();
694
772
  return;
695
773
  }
696
- Y(s, { active: !0 });
697
- const g = Ct({
774
+ E(s, { active: !0 });
775
+ const g = Nt({
698
776
  element: c,
699
777
  intent: "gesture",
700
778
  phase: "release",
701
779
  reduced: "preserve",
702
780
  reducedMotion: !1,
703
781
  property: "transform"
704
- }), m = Vt({
782
+ }), m = Ht({
705
783
  value: s,
706
784
  target: u,
707
785
  velocity: o,
@@ -710,79 +788,79 @@ function ar({
710
788
  velocityEpsilon: 50,
711
789
  stabilityWindow: 0.02,
712
790
  onUpdate: (h) => {
713
- Y(h, { active: !0 });
791
+ E(h, { active: !0 });
714
792
  },
715
793
  onComplete: () => {
716
- H.current === m && (H.current = null), Y(u, { active: !1 }), P();
794
+ j.current === m && (j.current = null), E(t, { active: !1 }), x();
717
795
  }
718
796
  });
719
- H.current = m;
797
+ j.current = m;
720
798
  },
721
799
  [
722
- Y,
723
- v,
724
- P,
800
+ E,
801
+ X,
802
+ x,
725
803
  l
726
804
  ]
727
- ), et = p(() => {
728
- const t = C.current;
805
+ ), st = d(() => {
806
+ const t = O.current;
729
807
  if (!t) return null;
730
808
  const e = t.sample();
731
- return Y(e.value, { active: !0 }), e;
732
- }, [Y]), Jt = p(
809
+ return E(e.value, { active: !0 }), e;
810
+ }, [E]), te = d(
733
811
  (t) => {
734
812
  if (!l.current) return null;
735
- v(), Y(t, { active: !0 });
736
- const o = Vt({
813
+ X(), E(t, { active: !0 });
814
+ const o = Ht({
737
815
  value: t,
738
816
  target: t,
739
- spring: ke,
817
+ spring: Ve,
740
818
  autoplay: !1,
741
819
  epsilon: 0.5,
742
820
  velocityEpsilon: 50,
743
821
  stabilityWindow: 0.02,
744
822
  onUpdate: (c) => {
745
- Y(c, { active: !0 });
823
+ E(c, { active: !0 });
746
824
  },
747
825
  onComplete: () => {
748
- const c = gt.current;
749
- !c || C.current !== o || (Z({ destroy: !1 }), Y(c, { active: !1 }), P());
826
+ const c = yt.current;
827
+ !c || O.current !== o || (R({ destroy: !1 }), E(c, { active: !1 }), x());
750
828
  }
751
829
  });
752
- return C.current = o, o;
830
+ return O.current = o, o;
753
831
  },
754
832
  [
755
- Y,
756
- v,
757
- Z,
758
- P,
833
+ E,
834
+ X,
835
+ R,
836
+ x,
759
837
  l
760
838
  ]
761
- ), Qt = p(
839
+ ), ee = d(
762
840
  (t) => {
763
- const e = C.current ?? Jt(J());
764
- e && (gt.current = null, e.setTarget(t));
841
+ const e = O.current ?? te(nt());
842
+ e && (yt.current = null, e.setTarget(t));
765
843
  },
766
- [J, Jt]
767
- ), rt = p(
844
+ [nt, te]
845
+ ), it = d(
768
846
  (t, e) => {
769
- const o = Yt(t, e);
770
- return Qt(o), et(), o;
847
+ const o = Lt(t, e);
848
+ return ee(o), st(), o;
771
849
  },
772
- [et, Qt]
773
- ), Pt = p(
850
+ [st, ee]
851
+ ), Dt = d(
774
852
  (t) => {
775
- const e = l.current, o = C.current;
853
+ const e = l.current, o = O.current;
776
854
  if (!e || !o) {
777
- _(t);
855
+ U(t);
778
856
  return;
779
857
  }
780
- const s = et() ? Tt() : o.value, u = { x: t.x, y: t.y };
781
- if (it(s, u) < 0.5) {
782
- Z(), Y(u, { active: !1 }), P();
858
+ const s = st() ? wt() : o.value, u = { x: t.x, y: t.y };
859
+ if (G(s, u) < 0.5) {
860
+ R(), E(t, { active: !1 }), x();
783
861
  return;
784
862
  }
785
- const d = Ct({
863
+ const p = Nt({
786
864
  element: e,
787
865
  intent: "gesture",
788
866
  phase: "release",
@@ -790,160 +868,196 @@ function ar({
790
868
  reducedMotion: !1,
791
869
  property: "transform"
792
870
  });
793
- gt.current = u, o.setTarget(u, { spring: d.spring });
871
+ yt.current = t, o.setTarget(u, { spring: p.spring });
794
872
  },
795
873
  [
796
- Y,
797
- Z,
798
- P,
799
- Tt,
800
- et,
801
- _,
874
+ E,
875
+ R,
876
+ x,
877
+ wt,
878
+ st,
879
+ U,
802
880
  l
803
881
  ]
804
- ), wt = p(
882
+ ), lt = d(
805
883
  ({
806
884
  key: t,
807
885
  settle: e
808
886
  }) => {
809
- if (x.current.dragging) return !1;
810
- const o = Q();
887
+ if (w.current.dragging) return !1;
888
+ const o = at();
811
889
  if (!o) return !1;
812
890
  const c = (t ? o.targets.find((s) => s.key === t) : void 0) ?? o.defaultTarget;
813
- return $.current = c.key, e ? _(c) : (v(), Y(c, { active: !1 }), P()), !0;
891
+ return _.current = c.key, e ? U(c) : (X(), E(c, { active: !1 }), x()), !0;
814
892
  },
815
893
  [
816
- Y,
817
- v,
818
- P,
819
- Q,
820
- _
894
+ E,
895
+ X,
896
+ x,
897
+ at,
898
+ U
821
899
  ]
822
- ), Zt = p(
900
+ ), re = d(
823
901
  (t, { from: e, initialVelocity: o = 0 }) => {
824
- k(t, {
902
+ I(t, {
825
903
  from: e,
826
904
  initialVelocity: o,
827
905
  onComplete: () => {
828
- dt({ reason: "drag-dismiss" }, { skipAttempt: !0 });
906
+ q({ reason: "drag-dismiss" }, { skipAttempt: !0 });
829
907
  }
830
908
  });
831
909
  },
832
- [dt, k]
910
+ [q, I]
833
911
  );
834
- kt(
912
+ Mt(
835
913
  () => () => {
836
- v(), q(!1), l.current && P();
914
+ X(), rt(!1), l.current && x();
837
915
  },
838
916
  [
839
- v,
840
- P,
841
- q,
917
+ X,
918
+ x,
919
+ rt,
842
920
  l
843
921
  ]
844
- ), ot(() => {
922
+ ), Z(() => {
845
923
  if (!i || !r || a !== "bottom") {
846
- bt.current = i;
924
+ Ft.current = i;
847
925
  return;
848
926
  }
927
+ Ct.current = !0;
928
+ const t = Ft.current;
849
929
  Ft.current = !0;
850
- const t = bt.current;
851
- bt.current = !0;
852
- const e = F === "peeked" ? A() : N;
930
+ const e = k === "peeked" ? C() : H;
853
931
  if (!t) {
854
- const o = I();
855
- B(o, { active: !0 }), k(e, {
932
+ const o = V();
933
+ B(o, { active: !0 }), I(e, {
856
934
  from: o,
857
935
  intent: "sheet",
858
936
  phase: "enter"
859
937
  });
860
938
  return;
861
939
  }
862
- if (F === "peeked") {
863
- k(A());
940
+ if (k === "peeked") {
941
+ I(C());
864
942
  return;
865
943
  }
866
- if (Lt.current) {
867
- Lt.current = !1;
944
+ if (kt.current) {
945
+ kt.current = !1;
868
946
  return;
869
947
  }
870
- k(N);
948
+ I(H);
871
949
  }, [
872
950
  r,
873
- A,
874
- I,
951
+ C,
952
+ V,
875
953
  i,
876
954
  a,
877
- F,
878
- B,
879
955
  k,
880
- N
881
- ]), ot(() => {
882
- a !== "bottom" && Ft.current && (Ft.current = !1, v(), Kt());
883
- }, [v, a, Kt]), ot(() => {
884
- if (!i || !r || !X) {
885
- const c = !i && a === "popup" && G.current, s = i && a !== "popup" && G.current;
886
- G.current && !c && (j.current !== null && (window.cancelAnimationFrame(j.current), j.current = null), v(), qt({
956
+ B,
957
+ I,
958
+ H
959
+ ]), Z(() => {
960
+ a !== "bottom" && Ct.current && (Ct.current = !1, X(), Zt());
961
+ }, [X, a, Zt]), Z(() => {
962
+ if (!i || !r || !v) {
963
+ const c = !i && a === "popup" && tt.current, s = i && a !== "popup" && tt.current;
964
+ tt.current && !c && (z.current !== null && (window.cancelAnimationFrame(z.current), z.current = null), X(), qt({
887
965
  preserveSnapPosition: s
888
- })), G.current && c && (v(), P()), At.current = i && a === "popup", G.current = !1;
966
+ })), tt.current && c && (X(), x()), Bt.current = i && a === "popup", tt.current = !1;
889
967
  return;
890
968
  }
891
- const t = At.current;
892
- At.current = !0, G.current = !0;
969
+ const t = Bt.current;
970
+ Bt.current = !0, tt.current = !0;
893
971
  let e = null;
894
- const o = (c) => wt({
972
+ const o = (c) => lt({
895
973
  key: c,
896
974
  settle: t
897
975
  });
898
976
  return o(
899
- $.current ?? mt.current
977
+ _.current ?? Tt.current
900
978
  ) || (e = window.requestAnimationFrame(() => {
901
979
  e = null, o(
902
- $.current ?? mt.current
980
+ _.current ?? Tt.current
903
981
  );
904
982
  })), () => {
905
983
  e !== null && window.cancelAnimationFrame(e);
906
984
  };
907
985
  }, [
908
- v,
986
+ X,
909
987
  r,
910
- P,
988
+ x,
911
989
  i,
912
990
  a,
913
- Ut,
914
- X,
991
+ Gt,
992
+ v,
915
993
  qt,
916
- wt
917
- ]), ot(() => {
918
- if (!i || !r || !X) return;
994
+ lt
995
+ ]), Z(() => {
996
+ if (!i || !r || !v) return;
919
997
  const t = () => {
920
- x.current.dragging || j.current === null && (j.current = window.requestAnimationFrame(() => {
921
- j.current = null, !x.current.dragging && wt({
922
- key: $.current,
998
+ w.current.dragging || z.current === null && (z.current = window.requestAnimationFrame(() => {
999
+ z.current = null, !w.current.dragging && lt({
1000
+ key: _.current,
923
1001
  settle: !1
924
1002
  });
925
1003
  }));
926
1004
  };
927
1005
  window.addEventListener("resize", t), window.visualViewport?.addEventListener("resize", t);
928
- const e = l.current, o = e?.parentElement, c = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
929
- return c && (e && c.observe(e), o && c.observe(o)), () => {
930
- window.removeEventListener("resize", t), window.visualViewport?.removeEventListener("resize", t), c?.disconnect(), j.current !== null && (window.cancelAnimationFrame(j.current), j.current = null);
1006
+ const e = l.current, o = e?.parentElement, c = typeof ResizeObserver > "u" ? null : new ResizeObserver(t), s = (u) => {
1007
+ e && u.target instanceof Element && e.contains(u.target) && t();
1008
+ };
1009
+ return c && (e && c.observe(e), o && c.observe(o)), e?.addEventListener(
1010
+ "transitionend",
1011
+ s,
1012
+ !0
1013
+ ), e?.addEventListener(
1014
+ "transitioncancel",
1015
+ s,
1016
+ !0
1017
+ ), () => {
1018
+ window.removeEventListener("resize", t), window.visualViewport?.removeEventListener("resize", t), e?.removeEventListener(
1019
+ "transitionend",
1020
+ s,
1021
+ !0
1022
+ ), e?.removeEventListener(
1023
+ "transitioncancel",
1024
+ s,
1025
+ !0
1026
+ ), c?.disconnect(), z.current !== null && (window.cancelAnimationFrame(z.current), z.current = null);
931
1027
  };
932
1028
  }, [
933
1029
  r,
934
1030
  i,
935
- X,
1031
+ v,
936
1032
  l,
937
- wt
1033
+ lt
1034
+ ]), Z(() => {
1035
+ if (Ut <= 0 || !i || !r || !v)
1036
+ return;
1037
+ let t = window.requestAnimationFrame(() => {
1038
+ t = null, lt({
1039
+ key: _.current,
1040
+ settle: !1
1041
+ });
1042
+ });
1043
+ return () => {
1044
+ t !== null && window.cancelAnimationFrame(t);
1045
+ };
1046
+ }, [
1047
+ r,
1048
+ i,
1049
+ v,
1050
+ Ut,
1051
+ lt
938
1052
  ]);
939
- const te = p(
1053
+ const ne = d(
940
1054
  (t, e, o) => {
941
- if (typeof Element > "u" || !(t instanceof Element) || Ot(t)) return !1;
942
- const c = Date.now(), s = e > 0, u = Fe(t, U.current);
943
- return !o && u && s && u.scrollTop > 0 || !o && ft.current && c - ft.current < zt && Math.abs(yt()) <= 1 ? (ft.current = c, !1) : !0;
1055
+ if (typeof Element > "u" || !(t instanceof Element) || Vt(t)) return !1;
1056
+ const c = Date.now(), s = e > 0, u = Ae(t, K.current);
1057
+ return !o && u && s && u.scrollTop > 0 || !o && ht.current && c - ht.current < Rt && Math.abs(Pt()) <= 1 ? (ht.current = c, !1) : !0;
944
1058
  },
945
- [yt, zt]
946
- ), vt = p(
1059
+ [Pt, Rt]
1060
+ ), Xt = d(
947
1061
  ({
948
1062
  chrome: t,
949
1063
  pointerId: e = null,
@@ -952,8 +1066,8 @@ function ar({
952
1066
  startY: s,
953
1067
  touchId: u = null
954
1068
  }) => {
955
- const { startTranslate: d, startTranslatePoint: g } = Gt(), m = ut();
956
- x.current = {
1069
+ const { startTranslate: p, startTranslatePoint: g } = Qt(), m = $();
1070
+ w.current = {
957
1071
  dragging: !0,
958
1072
  allowed: !1,
959
1073
  chrome: t,
@@ -965,9 +1079,9 @@ function ar({
965
1079
  lastX: c,
966
1080
  lastY: s,
967
1081
  startTranslateX: g.x,
968
- startTranslate: d,
1082
+ startTranslate: p,
969
1083
  lastTranslateX: g.x,
970
- lastTranslate: d,
1084
+ lastTranslate: p,
971
1085
  startTime: m,
972
1086
  samples: [
973
1087
  {
@@ -975,23 +1089,23 @@ function ar({
975
1089
  pageX: c,
976
1090
  pageY: s,
977
1091
  translateX: g.x,
978
- translateY: d
1092
+ translateY: p
979
1093
  }
980
1094
  ],
981
1095
  pointerId: e,
982
1096
  touchId: u
983
1097
  };
984
1098
  },
985
- [Gt]
986
- ), nt = p(
1099
+ [Qt]
1100
+ ), ct = d(
987
1101
  (t) => {
988
- t.source === "touch" ? K(!1) : t.source === "pointer" && q(!1), t.dragging = !1, t.allowed = !1, t.closeAllowed = null, t.started = !1, t.source = null, t.startX = 0, t.startY = 0, t.lastX = 0, t.lastY = 0, t.startTranslateX = 0, t.startTranslate = 0, t.lastTranslateX = 0, t.lastTranslate = 0, t.pointerId = null, t.touchId = null;
1102
+ t.source === "touch" ? et(!1) : t.source === "pointer" && rt(!1), t.dragging = !1, t.allowed = !1, t.closeAllowed = null, t.started = !1, t.source = null, t.startX = 0, t.startY = 0, t.lastX = 0, t.lastY = 0, t.startTranslateX = 0, t.startTranslate = 0, t.lastTranslateX = 0, t.lastTranslate = 0, t.pointerId = null, t.touchId = null;
989
1103
  },
990
- [q, K]
991
- ), ee = p(
1104
+ [rt, et]
1105
+ ), ae = d(
992
1106
  (t, e) => {
993
- const o = xt(), c = J();
994
- t.startX = e.x, t.startY = e.y, t.lastX = e.x, t.lastY = e.y, t.startTranslateX = c.x, t.startTranslate = o, t.lastTranslateX = c.x, t.lastTranslate = o, t.startTime = ut(), t.samples = [
1107
+ const o = vt(), c = nt();
1108
+ t.startX = e.x, t.startY = e.y, t.lastX = e.x, t.lastY = e.y, t.startTranslateX = c.x, t.startTranslate = o, t.lastTranslateX = c.x, t.lastTranslate = o, t.startTime = $(), t.samples = [
995
1109
  {
996
1110
  time: t.startTime,
997
1111
  pageX: e.x,
@@ -1001,8 +1115,8 @@ function ar({
1001
1115
  }
1002
1116
  ];
1003
1117
  },
1004
- [xt, J]
1005
- ), re = p(
1118
+ [vt, nt]
1119
+ ), oe = d(
1006
1120
  ({
1007
1121
  currentTranslate: t,
1008
1122
  dismissible: e,
@@ -1010,62 +1124,65 @@ function ar({
1010
1124
  deltaY: c,
1011
1125
  startTranslate: s
1012
1126
  }) => {
1013
- const u = I(), d = A(), g = d > 0, m = u, h = Math.max(
1014
- L.dismissal.minDistancePx,
1015
- (u - d) * Et
1016
- ), M = T.map(
1017
- (V) => b(u - V, 0, u)
1018
- ), z = se(
1019
- M.length ? M : [0]
1020
- ), O = ze({
1127
+ const u = V(), p = C(), g = p > 0, m = u, h = Math.max(
1128
+ M.dismissal.minDistancePx,
1129
+ (u - p) * ft
1130
+ ), P = T.map(
1131
+ (At) => b(u - At, 0, u)
1132
+ ), A = ce(
1133
+ P.length ? P : [0]
1134
+ ), Q = Ke({
1021
1135
  currentTranslate: t,
1022
1136
  releaseVelocity: o
1023
1137
  });
1024
- g && z.push(d);
1025
- const ct = se(z);
1026
- return e && !g && c > 0 && t >= d + h ? m : _e(o) ? ct.length > 1 ? Ne(
1027
- ct,
1138
+ g && A.push(p);
1139
+ const F = ce(A);
1140
+ return e && !g && c > 0 && t >= p + h ? m : Qe(o) ? F.length > 1 ? Re(
1141
+ F,
1028
1142
  s,
1029
1143
  t,
1030
1144
  c > 0 ? "down" : "up",
1031
- O
1032
- ) : 0 : e && t > u * Et && !g ? m : Oe(ct, t);
1145
+ Q
1146
+ ) : 0 : e && t > u * ft && !g ? m : ze(F, t);
1033
1147
  },
1034
- [Et, A, I, T]
1035
- ), we = p(
1148
+ [ft, C, V, T]
1149
+ ), Ye = d(
1036
1150
  (t) => {
1037
- if (!r || a !== "bottom" && !X || n === !1 || t.pointerType === "touch" || Ot(t.target)) return;
1151
+ if (!r || a !== "bottom" && !v || n === !1 || t.pointerType === "touch") return;
1038
1152
  let e = !1;
1039
- if (n === "handle" && t.target instanceof Element && t.target.closest('[data-oc-part="handle"]'))
1153
+ if (n === "handle" && fe(t.target))
1040
1154
  e = !0;
1041
1155
  else if (n === "handle")
1042
1156
  return;
1043
- n === "content" && (e = ce(t.target), !He(t, e)) || (vt({
1157
+ if (!e && Vt(t.target) || n === "content" && (e = de(t.target), !$e(t, e)))
1158
+ return;
1159
+ const o = We(t.target);
1160
+ Xt({
1044
1161
  chrome: e,
1045
1162
  pointerId: t.pointerId,
1046
1163
  source: "pointer",
1047
1164
  startX: t.pageX,
1048
1165
  startY: t.pageY
1049
- }), t.preventDefault(), q(!0), t.currentTarget.setPointerCapture(t.pointerId));
1166
+ }), Ue(t.target) || t.preventDefault(), rt(!0), !o && typeof t.currentTarget.setPointerCapture == "function" && t.currentTarget.setPointerCapture(t.pointerId);
1050
1167
  },
1051
1168
  [
1052
- vt,
1169
+ Xt,
1053
1170
  n,
1054
1171
  r,
1055
1172
  a,
1056
- X,
1057
- q
1173
+ v,
1174
+ rt
1058
1175
  ]
1059
- ), at = p(
1176
+ ), ut = d(
1060
1177
  (t, e) => {
1061
- if (!R) return !1;
1178
+ if (!N) return !1;
1062
1179
  if (e <= 0) return !0;
1063
1180
  if (t.closeAllowed !== null) return t.closeAllowed;
1064
- const o = jt({ reason: "drag-dismiss" });
1181
+ const o = _t({ reason: "drag-dismiss" });
1065
1182
  return t.closeAllowed = o, o;
1066
1183
  },
1067
- [jt, R]
1068
- ), Dt = p(
1184
+ [_t, N]
1185
+ ), St = d(
1069
1186
  ({
1070
1187
  closeAllowed: t,
1071
1188
  currentTranslate: e,
@@ -1073,80 +1190,116 @@ function ar({
1073
1190
  releaseVelocity: c,
1074
1191
  startTranslate: s
1075
1192
  }) => {
1076
- const d = re({
1193
+ const p = oe({
1077
1194
  currentTranslate: e,
1078
- dismissible: R && t !== !1,
1195
+ dismissible: N && t !== !1,
1079
1196
  releaseVelocity: c,
1080
1197
  deltaY: o,
1081
1198
  startTranslate: s
1082
- }), g = I(), m = A();
1083
- if (d >= g - 1) {
1084
- dt({ reason: "drag-dismiss" }, { commit: !1 }) ? Zt(d, {
1199
+ }), g = V(), m = C();
1200
+ if (p >= g - 1) {
1201
+ q({ reason: "drag-dismiss" }, { commit: !1 }) ? re(p, {
1085
1202
  from: e,
1086
1203
  initialVelocity: c
1087
- }) : k(s, {
1204
+ }) : I(s, {
1088
1205
  from: e,
1089
1206
  initialVelocity: c
1090
1207
  });
1091
1208
  return;
1092
1209
  }
1093
- m > 0 && d >= m - 1 ? Mt("peeked") : ($e({
1094
- presentationState: F,
1095
- releaseTranslate: d,
1096
- visibleTranslate: N
1097
- }) && (Lt.current = !0), Mt("visible")), k(d, {
1210
+ m > 0 && p >= m - 1 ? bt("peeked") : (ar({
1211
+ presentationState: k,
1212
+ releaseTranslate: p,
1213
+ visibleTranslate: H
1214
+ }) && (kt.current = !0), bt("visible")), I(p, {
1098
1215
  from: e,
1099
1216
  initialVelocity: c
1100
1217
  });
1101
1218
  },
1102
1219
  [
1103
- Zt,
1104
- R,
1105
- A,
1106
1220
  re,
1107
- I,
1108
- F,
1109
- dt,
1110
- Mt,
1221
+ N,
1222
+ C,
1223
+ oe,
1224
+ V,
1111
1225
  k,
1112
- N
1226
+ q,
1227
+ bt,
1228
+ I,
1229
+ H
1113
1230
  ]
1114
- ), Xt = p(
1115
- ({ currentTranslate: t, releaseVelocity: e }) => {
1116
- const o = Q();
1117
- if (!o) return;
1118
- const c = We({
1119
- currentTranslate: t,
1120
- releaseVelocity: e,
1121
- targets: o.targets
1122
- });
1123
- if ($.current = c.key, C.current) {
1124
- Pt(c);
1231
+ ), Yt = d(
1232
+ ({
1233
+ currentTranslate: t,
1234
+ releaseDelta: e,
1235
+ releaseTranslate: o,
1236
+ releaseVelocity: c
1237
+ }) => {
1238
+ const s = at();
1239
+ if (!s) return;
1240
+ const u = qe({
1241
+ currentTranslate: o,
1242
+ releaseVelocity: c,
1243
+ targets: s.targets
1244
+ }), p = s.targets.find(
1245
+ (P) => P.key === _.current
1246
+ ) ?? s.defaultTarget, m = l.current?.getBoundingClientRect(), h = {
1247
+ x: p.x + e.x,
1248
+ y: p.y + e.y
1249
+ };
1250
+ if (N && m && nr({
1251
+ closeThreshold: ft,
1252
+ currentTarget: p,
1253
+ currentTranslate: h,
1254
+ releaseTarget: u,
1255
+ surfaceSize: {
1256
+ height: m.height,
1257
+ width: m.width
1258
+ },
1259
+ targets: s.targets
1260
+ }) && q({ reason: "drag-dismiss" })) {
1261
+ R(), x();
1262
+ return;
1263
+ }
1264
+ if (_.current = u.key, O.current) {
1265
+ Dt(u);
1125
1266
  return;
1126
1267
  }
1127
- _(c, {
1268
+ U(u, {
1128
1269
  from: t,
1129
- initialVelocity: e
1270
+ initialVelocity: c
1130
1271
  });
1131
1272
  },
1132
- [Q, Pt, _]
1133
- ), ve = p(
1273
+ [
1274
+ R,
1275
+ ft,
1276
+ N,
1277
+ x,
1278
+ at,
1279
+ q,
1280
+ Dt,
1281
+ U,
1282
+ l
1283
+ ]
1284
+ ), Ee = d(
1134
1285
  (t) => {
1135
- const e = x.current;
1136
- if (!e.dragging || e.source !== "pointer" || !r || a !== "bottom" && !X)
1286
+ const e = w.current;
1287
+ if (!e.dragging || e.source !== "pointer" || !r || a !== "bottom" && !v)
1137
1288
  return;
1138
- const o = t.pageX - e.startX, c = t.pageY - e.startY, s = t.pointerType === "touch" ? L.dragStartThresholdPx.touch : L.dragStartThresholdPx.mouse;
1139
- if (!(!e.started && ie({ deltaX: o, deltaY: c, placement: a }) < s)) {
1289
+ const o = t.pageX - e.startX, c = t.pageY - e.startY, s = t.pointerType === "touch" ? M.dragStartThresholdPx.touch : M.dragStartThresholdPx.mouse;
1290
+ if (!(!e.started && ue({ deltaX: o, deltaY: c, placement: a }) < s)) {
1140
1291
  if (!e.allowed) {
1141
- if (a === "bottom" && !te(t.target, c, e.chrome))
1292
+ if (a === "bottom" && !ne(t.target, c, e.chrome))
1142
1293
  return;
1143
1294
  e.allowed = !0, e.started = !0;
1295
+ const u = t.currentTarget;
1296
+ e.pointerId !== null && typeof u.hasPointerCapture == "function" && typeof u.setPointerCapture == "function" && !u.hasPointerCapture(e.pointerId) && u.setPointerCapture(e.pointerId);
1144
1297
  }
1145
1298
  if (t.preventDefault(), e.lastX = t.pageX, e.lastY = t.pageY, a === "popup")
1146
- rt(e, t), fe(e, t);
1299
+ it(e, t), ye(e, t);
1147
1300
  else {
1148
- const u = e.startTranslate + c, d = at(e, c);
1149
- tt(u, d), pt(e, {
1301
+ const u = e.startTranslate + c, p = ut(e, c);
1302
+ ot(u, p), mt(e, {
1150
1303
  pageX: t.pageX,
1151
1304
  pageY: t.pageY,
1152
1305
  translateX: e.lastTranslateX,
@@ -1157,139 +1310,141 @@ function ar({
1157
1310
  },
1158
1311
  [
1159
1312
  r,
1160
- rt,
1161
- at,
1313
+ it,
1314
+ ut,
1162
1315
  a,
1163
- X,
1164
- tt,
1165
- te
1316
+ v,
1317
+ ot,
1318
+ ne
1166
1319
  ]
1167
- ), W = p(
1320
+ ), J = d(
1168
1321
  ({
1169
1322
  currentTarget: t,
1170
1323
  pageX: e,
1171
1324
  pageY: o,
1172
1325
  releaseCapture: c = !0
1173
1326
  }) => {
1174
- const s = x.current;
1175
- if (!s.dragging || s.source !== "pointer" || !r || a !== "bottom" && !X)
1327
+ const s = w.current;
1328
+ if (!s.dragging || s.source !== "pointer" || !r || a !== "bottom" && !v)
1176
1329
  return;
1177
- const u = s.started, d = Number.isFinite(e) ? e : s.lastX, g = Number.isFinite(o) ? o : s.lastY, m = d - s.startX, h = g - s.startY, M = Math.max(ut() - s.startTime, 1);
1178
- let z = {
1330
+ const u = s.started, p = Number.isFinite(e) ? e : s.lastX, g = Number.isFinite(o) ? o : s.lastY, m = p - s.startX, h = g - s.startY, P = Math.max($() - s.startTime, 1);
1331
+ let A = {
1179
1332
  x: s.lastTranslateX,
1180
1333
  y: s.lastTranslate
1181
- };
1182
- const O = s.startTranslate;
1334
+ }, Q = A;
1335
+ const F = s.startTranslate;
1183
1336
  if (u)
1184
1337
  if (a === "popup")
1185
- rt(s, {
1186
- pageX: d,
1338
+ it(s, {
1339
+ pageX: p,
1187
1340
  pageY: g
1188
- }), z = {
1341
+ }), A = {
1189
1342
  x: s.lastTranslateX,
1190
1343
  y: s.lastTranslate
1191
- };
1344
+ }, Q = Lt(s, {
1345
+ pageX: p,
1346
+ pageY: g
1347
+ });
1192
1348
  else {
1193
- const V = s.startTranslate + h, Me = at(s, h);
1194
- tt(V, Me), z = {
1349
+ const W = s.startTranslate + h, Fe = ut(s, h);
1350
+ ot(W, Fe), A = {
1195
1351
  x: s.lastTranslateX,
1196
1352
  y: s.lastTranslate
1197
1353
  };
1198
1354
  }
1199
- const ct = s.closeAllowed;
1355
+ const At = s.closeAllowed;
1200
1356
  if (c && t && s.pointerId !== null && t.hasPointerCapture(s.pointerId) && t.releasePointerCapture(s.pointerId), u) {
1201
- const V = a === "popup" ? Yt(s, {
1202
- pageX: d,
1203
- pageY: g
1204
- }) : {
1357
+ const W = a === "popup" ? Q : {
1205
1358
  x: s.lastTranslateX,
1206
1359
  y: s.lastTranslate
1207
1360
  };
1208
- pt(s, {
1209
- pageX: d,
1361
+ mt(s, {
1362
+ pageX: p,
1210
1363
  pageY: g,
1211
- translateX: V.x,
1212
- translateY: V.y
1364
+ translateX: W.x,
1365
+ translateY: W.y
1213
1366
  });
1214
1367
  }
1215
- if (nt(s), !!u)
1216
- if (a === "popup") {
1217
- const V = me({
1368
+ if (ct(s), !!u)
1369
+ if (gt.current = $() + 500, a === "popup") {
1370
+ const W = xe({
1218
1371
  session: s,
1219
1372
  fallbackDelta: { x: m, y: h },
1220
- fallbackElapsed: M
1373
+ fallbackElapsed: P
1221
1374
  });
1222
- Xt({
1223
- currentTranslate: z,
1224
- releaseVelocity: V
1375
+ Yt({
1376
+ currentTranslate: A,
1377
+ releaseDelta: { x: m, y: h },
1378
+ releaseTranslate: Q,
1379
+ releaseVelocity: W
1225
1380
  });
1226
1381
  } else {
1227
- const V = ge({
1382
+ const W = Te({
1228
1383
  session: s,
1229
1384
  fallbackDeltaY: h,
1230
- fallbackElapsed: M
1385
+ fallbackElapsed: P
1231
1386
  });
1232
- Dt({
1233
- closeAllowed: ct,
1234
- currentTranslate: z.y,
1387
+ St({
1388
+ closeAllowed: At,
1389
+ currentTranslate: A.y,
1235
1390
  deltaY: h,
1236
- releaseVelocity: V,
1237
- startTranslate: O
1391
+ releaseVelocity: W,
1392
+ startTranslate: F
1238
1393
  });
1239
1394
  }
1240
1395
  },
1241
1396
  [
1242
- Dt,
1243
- Xt,
1397
+ St,
1398
+ Yt,
1244
1399
  r,
1245
- rt,
1246
- at,
1400
+ it,
1401
+ ut,
1247
1402
  a,
1248
- X,
1249
- nt,
1250
- tt
1403
+ v,
1404
+ ct,
1405
+ ot
1251
1406
  ]
1252
- ), ne = p(
1407
+ ), se = d(
1253
1408
  (t) => {
1254
- W({
1409
+ J({
1255
1410
  currentTarget: t.currentTarget,
1256
1411
  pageX: t.pageX,
1257
1412
  pageY: t.pageY
1258
1413
  });
1259
1414
  },
1260
- [W]
1261
- ), De = p(
1415
+ [J]
1416
+ ), Me = d(
1262
1417
  (t) => {
1263
- const e = x.current;
1264
- e.pointerId !== null && t.pointerId !== e.pointerId || W({
1418
+ const e = w.current;
1419
+ e.pointerId !== null && t.pointerId !== e.pointerId || J({
1265
1420
  pageX: t.pageX,
1266
1421
  pageY: t.pageY,
1267
1422
  releaseCapture: !1
1268
1423
  });
1269
1424
  },
1270
- [W]
1425
+ [J]
1271
1426
  );
1272
- kt(() => {
1427
+ Mt(() => {
1273
1428
  if (!r) return;
1274
1429
  const t = (s) => {
1275
- const u = x.current;
1276
- !u.dragging || u.source !== "pointer" || "pointerId" in s && u.pointerId !== null && s.pointerId !== u.pointerId || W({
1430
+ const u = w.current;
1431
+ !u.dragging || u.source !== "pointer" || "pointerId" in s && u.pointerId !== null && s.pointerId !== u.pointerId || J({
1277
1432
  pageX: s.pageX,
1278
1433
  pageY: s.pageY,
1279
1434
  releaseCapture: !1
1280
1435
  });
1281
1436
  }, e = () => {
1282
- const s = x.current;
1283
- !s.dragging || s.source !== "pointer" || W({
1437
+ const s = w.current;
1438
+ !s.dragging || s.source !== "pointer" || J({
1284
1439
  pageX: s.lastX,
1285
1440
  pageY: s.lastY,
1286
1441
  releaseCapture: !1
1287
1442
  });
1288
1443
  }, o = (s) => {
1289
- const u = x.current;
1444
+ const u = w.current;
1290
1445
  !u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
1291
1446
  }, c = (s) => {
1292
- const u = x.current;
1447
+ const u = w.current;
1293
1448
  !u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
1294
1449
  };
1295
1450
  return document.addEventListener("pointerout", o, !0), document.addEventListener("mouseout", c, !0), window.addEventListener("pointerup", t, !0), window.addEventListener(
@@ -1311,24 +1466,40 @@ function ar({
1311
1466
  !0
1312
1467
  ), window.removeEventListener("blur", e);
1313
1468
  };
1314
- }, [W, r]);
1315
- const St = p((t) => {
1316
- const e = x.current;
1317
- return e.touchId !== null ? pe(t.changedTouches, e.touchId) ?? pe(t.touches, e.touchId) : t.touches[0] ?? t.changedTouches[0] ?? null;
1318
- }, []), Xe = p(
1469
+ }, [J, r]), Mt(() => {
1470
+ if (!r) return;
1471
+ const t = (e) => {
1472
+ const o = gt.current;
1473
+ if (o <= 0) return;
1474
+ if ($() > o) {
1475
+ gt.current = 0;
1476
+ return;
1477
+ }
1478
+ const c = l.current;
1479
+ c && e.target instanceof Node && c.contains(e.target) && (gt.current = 0, e.preventDefault(), e.stopPropagation());
1480
+ };
1481
+ return document.addEventListener("click", t, !0), () => {
1482
+ document.removeEventListener("click", t, !0);
1483
+ };
1484
+ }, [r, l]);
1485
+ const Et = d((t) => {
1486
+ const e = w.current;
1487
+ return e.touchId !== null ? me(t.changedTouches, e.touchId) ?? me(t.touches, e.touchId) : t.touches[0] ?? t.changedTouches[0] ?? null;
1488
+ }, []), Le = d(
1319
1489
  (t) => {
1320
- if (!r || a !== "bottom" && !X || n === !1 || t.touches.length !== 1 || Ot(t.target)) return;
1490
+ if (!r || a !== "bottom" && !v || n === !1 || t.touches.length !== 1) return;
1321
1491
  let e = !1;
1322
- if (n === "handle" && t.target instanceof Element && t.target.closest('[data-oc-part="handle"]'))
1492
+ if (n === "handle" && fe(t.target))
1323
1493
  e = !0;
1324
1494
  else if (n === "handle")
1325
1495
  return;
1326
- n === "content" && (e = ce(t.target));
1496
+ if (!e && Vt(t.target)) return;
1497
+ n === "content" && (e = de(t.target));
1327
1498
  const o = t.touches[0];
1328
- a === "bottom" && ht({
1499
+ a === "bottom" && xt({
1329
1500
  target: t.target,
1330
1501
  chrome: e
1331
- }), vt({
1502
+ }), Xt({
1332
1503
  chrome: e,
1333
1504
  source: "touch",
1334
1505
  startX: o.pageX,
@@ -1337,50 +1508,50 @@ function ar({
1337
1508
  });
1338
1509
  },
1339
1510
  [
1340
- vt,
1511
+ Xt,
1341
1512
  n,
1342
1513
  r,
1343
1514
  a,
1344
- X,
1345
- ht
1515
+ v,
1516
+ xt
1346
1517
  ]
1347
- ), ae = p(
1518
+ ), ie = d(
1348
1519
  (t) => {
1349
- const e = x.current;
1350
- if (!e.dragging || e.source !== "touch" || !r || a !== "bottom" && !X)
1520
+ const e = w.current;
1521
+ if (!e.dragging || e.source !== "touch" || !r || a !== "bottom" && !v)
1351
1522
  return;
1352
- const o = St(t);
1523
+ const o = Et(t);
1353
1524
  if (!o) return;
1354
- const c = o.pageX - e.startX, s = o.pageY - e.startY, u = ie({
1525
+ const c = o.pageX - e.startX, s = o.pageY - e.startY, u = ue({
1355
1526
  deltaX: c,
1356
1527
  deltaY: s,
1357
1528
  placement: a
1358
- }), d = L.dragStartThresholdPx.touch, g = a === "bottom" ? Ae({
1529
+ }), p = M.dragStartThresholdPx.touch, g = a === "bottom" ? Ne({
1359
1530
  target: t.target,
1360
1531
  deltaY: s,
1361
1532
  chrome: e.chrome,
1362
- bodyNode: U.current
1363
- }) : Be({
1533
+ bodyNode: K.current
1534
+ }) : Oe({
1364
1535
  target: t.target,
1365
- bodyNode: U.current
1536
+ bodyNode: K.current
1366
1537
  });
1367
1538
  if (g.preventDefault) {
1368
- const h = a === "bottom" && Math.abs(c) > Math.abs(s) && Math.abs(s) < d && !e.started && u < d;
1369
- !h && a === "bottom" && ht({
1539
+ const h = a === "bottom" && Math.abs(c) > Math.abs(s) && Math.abs(s) < p && !e.started && u < p;
1540
+ !h && a === "bottom" && xt({
1370
1541
  target: t.target,
1371
1542
  chrome: e.chrome
1372
- }), h || oe(t);
1543
+ }), h || le(t);
1373
1544
  }
1374
1545
  if (g.resetAnchor) {
1375
- K(!1), ee(e, { x: o.pageX, y: o.pageY });
1546
+ et(!1), ae(e, { x: o.pageX, y: o.pageY });
1376
1547
  return;
1377
1548
  }
1378
- if (g.allowDrag && !(!e.started && u < d))
1379
- if (e.allowed || (e.allowed = !0, e.started = !0), g.preventDefault || oe(t), e.lastX = o.pageX, e.lastY = o.pageY, a === "popup")
1380
- rt(e, o), fe(e, o);
1549
+ if (g.allowDrag && !(!e.started && u < p))
1550
+ if (e.allowed || (e.allowed = !0, e.started = !0), g.preventDefault || le(t), e.lastX = o.pageX, e.lastY = o.pageY, a === "popup")
1551
+ it(e, o), ye(e, o);
1381
1552
  else {
1382
- const m = e.startTranslate + s, h = at(e, s);
1383
- tt(m, h), pt(e, {
1553
+ const m = e.startTranslate + s, h = ut(e, s);
1554
+ ot(m, h), mt(e, {
1384
1555
  pageX: o.pageX,
1385
1556
  pageY: o.pageY,
1386
1557
  translateX: e.lastTranslateX,
@@ -1390,21 +1561,21 @@ function ar({
1390
1561
  },
1391
1562
  [
1392
1563
  r,
1393
- rt,
1394
- at,
1395
- St,
1564
+ it,
1565
+ ut,
1566
+ Et,
1396
1567
  a,
1397
- X,
1398
- ee,
1399
- K,
1400
- tt,
1401
- ht
1568
+ v,
1569
+ ae,
1570
+ et,
1571
+ ot,
1572
+ xt
1402
1573
  ]
1403
1574
  );
1404
- kt(() => {
1405
- if (!i || !r || a !== "bottom" && !X || n === !1 || typeof window > "u") return;
1575
+ Mt(() => {
1576
+ if (!i || !r || a !== "bottom" && !v || n === !1 || typeof window > "u") return;
1406
1577
  const t = (e) => {
1407
- ae(e);
1578
+ ie(e);
1408
1579
  };
1409
1580
  return window.addEventListener("touchmove", t, {
1410
1581
  capture: !0,
@@ -1412,71 +1583,75 @@ function ar({
1412
1583
  }), () => {
1413
1584
  window.removeEventListener("touchmove", t, !0);
1414
1585
  };
1415
- }, [n, r, ae, i, a, X]);
1416
- const Se = p(
1586
+ }, [n, r, ie, i, a, v]);
1587
+ const be = d(
1417
1588
  (t) => {
1418
- const e = x.current;
1419
- if (!e.dragging || e.source !== "touch" || !r || a !== "bottom" && !X)
1589
+ const e = w.current;
1590
+ if (!e.dragging || e.source !== "touch" || !r || a !== "bottom" && !v)
1420
1591
  return;
1421
- const o = St(t), c = o?.pageX ?? e.lastX, s = o?.pageY ?? e.lastY, u = e.started, d = e.closeAllowed, g = c - e.startX, m = s - e.startY, h = Math.max(ut() - e.startTime, 1);
1422
- a === "popup" && et();
1423
- const M = {
1592
+ const o = Et(t), c = o?.pageX ?? e.lastX, s = o?.pageY ?? e.lastY, u = e.started, p = e.closeAllowed, g = c - e.startX, m = s - e.startY, h = Math.max($() - e.startTime, 1);
1593
+ a === "popup" && st();
1594
+ const P = {
1424
1595
  x: e.lastTranslateX,
1425
1596
  y: e.lastTranslate
1426
- }, z = e.startTranslate;
1597
+ };
1598
+ let A = P;
1599
+ const Q = e.startTranslate;
1427
1600
  if (u) {
1428
- const O = a === "popup" ? Yt(e, {
1601
+ const F = a === "popup" ? Lt(e, {
1429
1602
  pageX: c,
1430
1603
  pageY: s
1431
1604
  }) : {
1432
1605
  x: e.lastTranslateX,
1433
1606
  y: e.lastTranslate
1434
1607
  };
1435
- pt(e, {
1608
+ A = F, mt(e, {
1436
1609
  pageX: c,
1437
1610
  pageY: s,
1438
- translateX: O.x,
1439
- translateY: O.y
1611
+ translateX: F.x,
1612
+ translateY: F.y
1440
1613
  });
1441
1614
  }
1442
- if (nt(e), !!u)
1443
- if (a === "popup") {
1444
- const O = me({
1615
+ if (ct(e), !!u)
1616
+ if (gt.current = $() + 500, a === "popup") {
1617
+ const F = xe({
1445
1618
  session: e,
1446
1619
  fallbackDelta: { x: g, y: m },
1447
1620
  fallbackElapsed: h
1448
1621
  });
1449
- Xt({
1450
- currentTranslate: M,
1451
- releaseVelocity: O
1622
+ Yt({
1623
+ currentTranslate: P,
1624
+ releaseDelta: { x: g, y: m },
1625
+ releaseTranslate: A,
1626
+ releaseVelocity: F
1452
1627
  });
1453
1628
  } else {
1454
- const O = ge({
1629
+ const F = Te({
1455
1630
  session: e,
1456
1631
  fallbackDeltaY: m,
1457
1632
  fallbackElapsed: h
1458
1633
  });
1459
- Dt({
1460
- closeAllowed: d,
1461
- currentTranslate: M.y,
1634
+ St({
1635
+ closeAllowed: p,
1636
+ currentTranslate: P.y,
1462
1637
  deltaY: m,
1463
- releaseVelocity: O,
1464
- startTranslate: z
1638
+ releaseVelocity: F,
1639
+ startTranslate: Q
1465
1640
  });
1466
1641
  }
1467
1642
  },
1468
1643
  [
1469
- Dt,
1470
- Xt,
1471
- r,
1472
1644
  St,
1645
+ Yt,
1646
+ r,
1647
+ Et,
1473
1648
  a,
1474
- X,
1475
- nt,
1476
- et
1649
+ v,
1650
+ ct,
1651
+ st
1477
1652
  ]
1478
- ), Ye = p(() => {
1479
- const t = x.current;
1653
+ ), ke = d(() => {
1654
+ const t = w.current;
1480
1655
  if (!t.dragging || t.source !== "touch") return;
1481
1656
  const e = t.started, o = t.startTranslate, c = t.lastTranslate, s = {
1482
1657
  x: t.startTranslateX,
@@ -1484,32 +1659,32 @@ function ar({
1484
1659
  }, u = {
1485
1660
  x: t.lastTranslateX,
1486
1661
  y: t.lastTranslate
1487
- }, d = a;
1488
- if (nt(t), !!e) {
1489
- if (d === "popup") {
1490
- C.current ? Pt(s) : _(s, { from: u });
1662
+ }, p = a;
1663
+ if (ct(t), !!e) {
1664
+ if (p === "popup") {
1665
+ O.current ? Dt(s) : U(s, { from: u });
1491
1666
  return;
1492
1667
  }
1493
- k(o, { from: c });
1668
+ I(o, { from: c });
1494
1669
  }
1495
1670
  }, [
1496
1671
  a,
1497
- nt,
1498
- Pt,
1499
- _,
1500
- k
1672
+ ct,
1673
+ Dt,
1674
+ U,
1675
+ I
1501
1676
  ]);
1502
1677
  return {
1503
- onPointerDown: we,
1504
- onPointerMove: ve,
1505
- onPointerUp: ne,
1506
- onPointerCancel: ne,
1507
- onLostPointerCapture: De,
1508
- onTouchStart: Xe,
1509
- onTouchEnd: Se,
1510
- onTouchCancel: Ye
1678
+ onPointerDown: Ye,
1679
+ onPointerMove: Ee,
1680
+ onPointerUp: se,
1681
+ onPointerCancel: se,
1682
+ onLostPointerCapture: Me,
1683
+ onTouchStart: Le,
1684
+ onTouchEnd: be,
1685
+ onTouchCancel: ke
1511
1686
  };
1512
1687
  }
1513
1688
  export {
1514
- ar as useModalDrag
1689
+ mr as useModalDrag
1515
1690
  };