@luciodale/swipe-bar 1.3.4 → 1.3.6

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.
@@ -1,701 +1,805 @@
1
- import Rt, { createContext as Tt, useState as Q, useRef as _, useMemo as Ke, useCallback as Y, useEffect as G, useContext as Et } from "react";
2
- var Re = { exports: {} }, me = {};
3
- /**
4
- * @license React
5
- * react-jsx-runtime.production.js
6
- *
7
- * Copyright (c) Meta Platforms, Inc. and affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- var Be;
13
- function Ot() {
14
- if (Be) return me;
15
- Be = 1;
16
- var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
17
- function r(i, c, o) {
18
- var u = null;
19
- if (o !== void 0 && (u = "" + o), c.key !== void 0 && (u = "" + c.key), "key" in c) {
20
- o = {};
21
- for (var f in c)
22
- f !== "key" && (o[f] = c[f]);
23
- } else o = c;
24
- return c = o.ref, {
1
+ import or, { createContext as sr, useState as te, useRef as L, useMemo as Te, useCallback as E, useEffect as q, useContext as ar, useLayoutEffect as cr } from "react";
2
+ var Re = { exports: {} }, ye = {};
3
+ var qe;
4
+ function lr() {
5
+ if (qe) return ye;
6
+ qe = 1;
7
+ var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
8
+ function r(n, l, c) {
9
+ var d = null;
10
+ if (c !== void 0 && (d = "" + c), l.key !== void 0 && (d = "" + l.key), "key" in l) {
11
+ c = {};
12
+ for (var h in l)
13
+ h !== "key" && (c[h] = l[h]);
14
+ } else c = l;
15
+ return l = c.ref, {
25
16
  $$typeof: e,
26
- type: i,
27
- key: u,
28
- ref: c !== void 0 ? c : null,
29
- props: o
17
+ type: n,
18
+ key: d,
19
+ ref: l !== void 0 ? l : null,
20
+ props: c
30
21
  };
31
22
  }
32
- return me.Fragment = t, me.jsx = r, me.jsxs = r, me;
23
+ return ye.Fragment = t, ye.jsx = r, ye.jsxs = r, ye;
33
24
  }
34
- var be = {};
35
- /**
36
- * @license React
37
- * react-jsx-runtime.development.js
38
- *
39
- * Copyright (c) Meta Platforms, Inc. and affiliates.
40
- *
41
- * This source code is licensed under the MIT license found in the
42
- * LICENSE file in the root directory of this source tree.
43
- */
44
- var We;
45
- function At() {
46
- return We || (We = 1, process.env.NODE_ENV !== "production" && function() {
47
- function e(n) {
48
- if (n == null) return null;
49
- if (typeof n == "function")
50
- return n.$$typeof === q ? null : n.displayName || n.name || null;
51
- if (typeof n == "string") return n;
52
- switch (n) {
53
- case P:
25
+ var ve = {};
26
+ var Qe;
27
+ function ur() {
28
+ return Qe || (Qe = 1, process.env.NODE_ENV !== "production" && (function() {
29
+ function e(a) {
30
+ if (a == null) return null;
31
+ if (typeof a == "function")
32
+ return a.$$typeof === Q ? null : a.displayName || a.name || null;
33
+ if (typeof a == "string") return a;
34
+ switch (a) {
35
+ case w:
54
36
  return "Fragment";
55
- case I:
37
+ case _:
56
38
  return "Profiler";
57
- case L:
39
+ case x:
58
40
  return "StrictMode";
59
41
  case k:
60
42
  return "Suspense";
61
- case v:
43
+ case W:
62
44
  return "SuspenseList";
63
- case M:
45
+ case j:
64
46
  return "Activity";
65
47
  }
66
- if (typeof n == "object")
67
- switch (typeof n.tag == "number" && console.error(
48
+ if (typeof a == "object")
49
+ switch (typeof a.tag == "number" && console.error(
68
50
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
- ), n.$$typeof) {
70
- case p:
51
+ ), a.$$typeof) {
52
+ case u:
71
53
  return "Portal";
72
- case j:
73
- return n.displayName || "Context";
74
- case $:
75
- return (n._context.displayName || "Context") + ".Consumer";
54
+ case Y:
55
+ return a.displayName || "Context";
76
56
  case B:
77
- var m = n.render;
78
- return n = n.displayName, n || (n = m.displayName || m.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
79
- case x:
80
- return m = n.displayName || null, m !== null ? m : e(n.type) || "Memo";
81
- case E:
82
- m = n._payload, n = n._init;
57
+ return (a._context.displayName || "Context") + ".Consumer";
58
+ case H:
59
+ var y = a.render;
60
+ return a = a.displayName, a || (a = y.displayName || y.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
61
+ case X:
62
+ return y = a.displayName || null, y !== null ? y : e(a.type) || "Memo";
63
+ case V:
64
+ y = a._payload, a = a._init;
83
65
  try {
84
- return e(n(m));
66
+ return e(a(y));
85
67
  } catch {
86
68
  }
87
69
  }
88
70
  return null;
89
71
  }
90
- function t(n) {
91
- return "" + n;
72
+ function t(a) {
73
+ return "" + a;
92
74
  }
93
- function r(n) {
75
+ function r(a) {
94
76
  try {
95
- t(n);
96
- var m = !1;
77
+ t(a);
78
+ var y = !1;
97
79
  } catch {
98
- m = !0;
80
+ y = !0;
99
81
  }
100
- if (m) {
101
- m = console;
102
- var T = m.error, R = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
103
- return T.call(
104
- m,
82
+ if (y) {
83
+ y = console;
84
+ var $ = y.error, D = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
85
+ return $.call(
86
+ y,
105
87
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- R
107
- ), t(n);
88
+ D
89
+ ), t(a);
108
90
  }
109
91
  }
110
- function i(n) {
111
- if (n === P) return "<>";
112
- if (typeof n == "object" && n !== null && n.$$typeof === E)
92
+ function n(a) {
93
+ if (a === w) return "<>";
94
+ if (typeof a == "object" && a !== null && a.$$typeof === V)
113
95
  return "<...>";
114
96
  try {
115
- var m = e(n);
116
- return m ? "<" + m + ">" : "<...>";
97
+ var y = e(a);
98
+ return y ? "<" + y + ">" : "<...>";
117
99
  } catch {
118
100
  return "<...>";
119
101
  }
120
102
  }
121
- function c() {
122
- var n = D.A;
123
- return n === null ? null : n.getOwner();
103
+ function l() {
104
+ var a = G.A;
105
+ return a === null ? null : a.getOwner();
124
106
  }
125
- function o() {
107
+ function c() {
126
108
  return Error("react-stack-top-frame");
127
109
  }
128
- function u(n) {
129
- if (V.call(n, "key")) {
130
- var m = Object.getOwnPropertyDescriptor(n, "key").get;
131
- if (m && m.isReactWarning) return !1;
110
+ function d(a) {
111
+ if (b.call(a, "key")) {
112
+ var y = Object.getOwnPropertyDescriptor(a, "key").get;
113
+ if (y && y.isReactWarning) return !1;
132
114
  }
133
- return n.key !== void 0;
115
+ return a.key !== void 0;
134
116
  }
135
- function f(n, m) {
136
- function T() {
137
- N || (N = !0, console.error(
117
+ function h(a, y) {
118
+ function $() {
119
+ F || (F = !0, console.error(
138
120
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
139
- m
121
+ y
140
122
  ));
141
123
  }
142
- T.isReactWarning = !0, Object.defineProperty(n, "key", {
143
- get: T,
124
+ $.isReactWarning = !0, Object.defineProperty(a, "key", {
125
+ get: $,
144
126
  configurable: !0
145
127
  });
146
128
  }
147
- function l() {
148
- var n = e(this.type);
149
- return Z[n] || (Z[n] = !0, console.error(
129
+ function g() {
130
+ var a = e(this.type);
131
+ return U[a] || (U[a] = !0, console.error(
150
132
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
- )), n = this.props.ref, n !== void 0 ? n : null;
133
+ )), a = this.props.ref, a !== void 0 ? a : null;
152
134
  }
153
- function s(n, m, T, R, z, F) {
154
- var X = T.ref;
155
- return n = {
135
+ function p(a, y, $, D, ce, oe) {
136
+ var N = $.ref;
137
+ return a = {
156
138
  $$typeof: C,
157
- type: n,
158
- key: m,
159
- props: T,
160
- _owner: R
161
- }, (X !== void 0 ? X : null) !== null ? Object.defineProperty(n, "ref", {
139
+ type: a,
140
+ key: y,
141
+ props: $,
142
+ _owner: D
143
+ }, (N !== void 0 ? N : null) !== null ? Object.defineProperty(a, "ref", {
162
144
  enumerable: !1,
163
- get: l
164
- }) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
145
+ get: g
146
+ }) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
165
147
  configurable: !1,
166
148
  enumerable: !1,
167
149
  writable: !0,
168
150
  value: 0
169
- }), Object.defineProperty(n, "_debugInfo", {
151
+ }), Object.defineProperty(a, "_debugInfo", {
170
152
  configurable: !1,
171
153
  enumerable: !1,
172
154
  writable: !0,
173
155
  value: null
174
- }), Object.defineProperty(n, "_debugStack", {
156
+ }), Object.defineProperty(a, "_debugStack", {
175
157
  configurable: !1,
176
158
  enumerable: !1,
177
159
  writable: !0,
178
- value: z
179
- }), Object.defineProperty(n, "_debugTask", {
160
+ value: ce
161
+ }), Object.defineProperty(a, "_debugTask", {
180
162
  configurable: !1,
181
163
  enumerable: !1,
182
164
  writable: !0,
183
- value: F
184
- }), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
165
+ value: oe
166
+ }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
185
167
  }
186
- function w(n, m, T, R, z, F) {
187
- var X = m.children;
188
- if (X !== void 0)
189
- if (R)
190
- if (U(X)) {
191
- for (R = 0; R < X.length; R++)
192
- y(X[R]);
193
- Object.freeze && Object.freeze(X);
168
+ function S(a, y, $, D, ce, oe) {
169
+ var N = y.children;
170
+ if (N !== void 0)
171
+ if (D)
172
+ if (M(N)) {
173
+ for (D = 0; D < N.length; D++)
174
+ R(N[D]);
175
+ Object.freeze && Object.freeze(N);
194
176
  } else
195
177
  console.error(
196
178
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
179
  );
198
- else y(X);
199
- if (V.call(m, "key")) {
200
- X = e(n);
201
- var J = Object.keys(m).filter(function(Se) {
180
+ else R(N);
181
+ if (b.call(y, "key")) {
182
+ N = e(a);
183
+ var re = Object.keys(y).filter(function(Se) {
202
184
  return Se !== "key";
203
185
  });
204
- R = 0 < J.length ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}", ae[X + R] || (J = 0 < J.length ? "{" + J.join(": ..., ") + ": ...}" : "{}", console.error(
186
+ D = 0 < re.length ? "{key: someKey, " + re.join(": ..., ") + ": ...}" : "{key: someKey}", Z[N + D] || (re = 0 < re.length ? "{" + re.join(": ..., ") + ": ...}" : "{}", console.error(
205
187
  `A props object containing a "key" prop is being spread into JSX:
206
188
  let props = %s;
207
189
  <%s {...props} />
208
190
  React keys must be passed directly to JSX without using spread:
209
191
  let props = %s;
210
192
  <%s key={someKey} {...props} />`,
211
- R,
212
- X,
213
- J,
214
- X
215
- ), ae[X + R] = !0);
193
+ D,
194
+ N,
195
+ re,
196
+ N
197
+ ), Z[N + D] = !0);
216
198
  }
217
- if (X = null, T !== void 0 && (r(T), X = "" + T), u(m) && (r(m.key), X = "" + m.key), "key" in m) {
218
- T = {};
219
- for (var ge in m)
220
- ge !== "key" && (T[ge] = m[ge]);
221
- } else T = m;
222
- return X && f(
223
- T,
224
- typeof n == "function" ? n.displayName || n.name || "Unknown" : n
225
- ), s(
226
- n,
227
- X,
228
- T,
229
- c(),
230
- z,
231
- F
199
+ if (N = null, $ !== void 0 && (r($), N = "" + $), d(y) && (r(y.key), N = "" + y.key), "key" in y) {
200
+ $ = {};
201
+ for (var le in y)
202
+ le !== "key" && ($[le] = y[le]);
203
+ } else $ = y;
204
+ return N && h(
205
+ $,
206
+ typeof a == "function" ? a.displayName || a.name || "Unknown" : a
207
+ ), p(
208
+ a,
209
+ N,
210
+ $,
211
+ l(),
212
+ ce,
213
+ oe
232
214
  );
233
215
  }
234
- function y(n) {
235
- h(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === E && (n._payload.status === "fulfilled" ? h(n._payload.value) && n._payload.value._store && (n._payload.value._store.validated = 1) : n._store && (n._store.validated = 1));
216
+ function R(a) {
217
+ m(a) ? a._store && (a._store.validated = 1) : typeof a == "object" && a !== null && a.$$typeof === V && (a._payload.status === "fulfilled" ? m(a._payload.value) && a._payload.value._store && (a._payload.value._store.validated = 1) : a._store && (a._store.validated = 1));
236
218
  }
237
- function h(n) {
238
- return typeof n == "object" && n !== null && n.$$typeof === C;
219
+ function m(a) {
220
+ return typeof a == "object" && a !== null && a.$$typeof === C;
239
221
  }
240
- var S = Rt, C = Symbol.for("react.transitional.element"), p = Symbol.for("react.portal"), P = Symbol.for("react.fragment"), L = Symbol.for("react.strict_mode"), I = Symbol.for("react.profiler"), $ = Symbol.for("react.consumer"), j = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), k = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), x = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), M = Symbol.for("react.activity"), q = Symbol.for("react.client.reference"), D = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, U = Array.isArray, H = console.createTask ? console.createTask : function() {
222
+ var T = or, C = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.portal"), w = /* @__PURE__ */ Symbol.for("react.fragment"), x = /* @__PURE__ */ Symbol.for("react.strict_mode"), _ = /* @__PURE__ */ Symbol.for("react.profiler"), B = /* @__PURE__ */ Symbol.for("react.consumer"), Y = /* @__PURE__ */ Symbol.for("react.context"), H = /* @__PURE__ */ Symbol.for("react.forward_ref"), k = /* @__PURE__ */ Symbol.for("react.suspense"), W = /* @__PURE__ */ Symbol.for("react.suspense_list"), X = /* @__PURE__ */ Symbol.for("react.memo"), V = /* @__PURE__ */ Symbol.for("react.lazy"), j = /* @__PURE__ */ Symbol.for("react.activity"), Q = /* @__PURE__ */ Symbol.for("react.client.reference"), G = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, b = Object.prototype.hasOwnProperty, M = Array.isArray, P = console.createTask ? console.createTask : function() {
241
223
  return null;
242
224
  };
243
- S = {
244
- react_stack_bottom_frame: function(n) {
245
- return n();
225
+ T = {
226
+ react_stack_bottom_frame: function(a) {
227
+ return a();
246
228
  }
247
229
  };
248
- var N, Z = {}, oe = S.react_stack_bottom_frame.bind(
249
- S,
250
- o
251
- )(), ne = H(i(o)), ae = {};
252
- be.Fragment = P, be.jsx = function(n, m, T) {
253
- var R = 1e4 > D.recentlyCreatedOwnerStacks++;
254
- return w(
255
- n,
256
- m,
257
- T,
230
+ var F, U = {}, ie = T.react_stack_bottom_frame.bind(
231
+ T,
232
+ c
233
+ )(), A = P(n(c)), Z = {};
234
+ ve.Fragment = w, ve.jsx = function(a, y, $) {
235
+ var D = 1e4 > G.recentlyCreatedOwnerStacks++;
236
+ return S(
237
+ a,
238
+ y,
239
+ $,
258
240
  !1,
259
- R ? Error("react-stack-top-frame") : oe,
260
- R ? H(i(n)) : ne
241
+ D ? Error("react-stack-top-frame") : ie,
242
+ D ? P(n(a)) : A
261
243
  );
262
- }, be.jsxs = function(n, m, T) {
263
- var R = 1e4 > D.recentlyCreatedOwnerStacks++;
264
- return w(
265
- n,
266
- m,
267
- T,
244
+ }, ve.jsxs = function(a, y, $) {
245
+ var D = 1e4 > G.recentlyCreatedOwnerStacks++;
246
+ return S(
247
+ a,
248
+ y,
249
+ $,
268
250
  !0,
269
- R ? Error("react-stack-top-frame") : oe,
270
- R ? H(i(n)) : ne
251
+ D ? Error("react-stack-top-frame") : ie,
252
+ D ? P(n(a)) : A
271
253
  );
272
254
  };
273
- }()), be;
255
+ })()), ve;
274
256
  }
275
- process.env.NODE_ENV === "production" ? Re.exports = Ot() : Re.exports = At();
276
- var O = Re.exports;
277
- const et = Tt(null), ye = (e) => {
257
+ var Je;
258
+ function dr() {
259
+ return Je || (Je = 1, process.env.NODE_ENV === "production" ? Re.exports = lr() : Re.exports = ur()), Re.exports;
260
+ }
261
+ var I = dr();
262
+ const mt = sr(null), Ae = (e) => {
278
263
  throw new Error(`Unhandled sidebar side: ${e}`);
279
- }, we = {
264
+ }, de = {
265
+ isOpen: !1,
266
+ meta: null
267
+ }, Oe = {
280
268
  isOpen: !1,
281
269
  anchorState: "closed",
282
270
  meta: null
283
- }, vr = ({
271
+ }, tn = ({
284
272
  children: e,
285
273
  sidebarWidthPx: t,
286
274
  transitionMs: r,
287
- edgeActivationWidthPx: i,
288
- dragActivationDeltaPx: c,
289
- showOverlay: o,
290
- isAbsolute: u,
291
- overlayBackgroundColor: f,
292
- toggleIconColor: l,
293
- toggleIconSizePx: s,
294
- toggleIconEdgeDistancePx: w,
295
- showToggle: y,
296
- mediaQueryWidth: h,
297
- swipeBarZIndex: S,
275
+ edgeActivationWidthPx: n,
276
+ dragActivationDeltaPx: l,
277
+ showOverlay: c,
278
+ isAbsolute: d,
279
+ overlayBackgroundColor: h,
280
+ toggleIconColor: g,
281
+ toggleIconSizePx: p,
282
+ toggleIconEdgeDistancePx: S,
283
+ showToggle: R,
284
+ mediaQueryWidth: m,
285
+ swipeBarZIndex: T,
298
286
  toggleZIndex: C,
299
- overlayZIndex: p,
300
- fadeContent: P,
301
- fadeContentTransitionMs: L,
302
- closeSidebarOnOverlayClick: I,
303
- resetMetaOnClose: $
287
+ overlayZIndex: u,
288
+ fadeContent: w,
289
+ fadeContentTransitionMs: x,
290
+ closeSidebarOnOverlayClick: _,
291
+ resetMetaOnClose: B
304
292
  }) => {
305
- var Xe, Ye;
306
- const [j, B] = Q(null), [k, v] = Q(!1), [x, E] = Q(!1), [M, q] = Q({}), [D, V] = Q({}), U = _(null), H = _(null), N = _(null), Z = _(null), [oe, ne] = Q(null), [ae, n] = Q(null), [m, T] = Q({}), [R, z] = Q({}), F = _(/* @__PURE__ */ new Map()), X = _(null), J = _([]), ge = ((Xe = m.primary) == null ? void 0 : Xe.isOpen) ?? !1, Se = ((Ye = m.primary) == null ? void 0 : Ye.anchorState) ?? "closed", Le = Ke(
307
- () => Object.values(m).some((d) => d.isOpen),
308
- [m]
309
- ), ce = F.current.get("primary"), ot = (ce == null ? void 0 : ce.sidebarRef) ?? { current: null }, at = (ce == null ? void 0 : ce.toggleRef) ?? { current: null }, st = R.primary ?? {}, [ct, lt] = Q({
310
- sidebarWidthPx: t ?? It,
311
- sidebarHeightPx: je,
312
- transitionMs: r ?? Pt,
313
- edgeActivationWidthPx: i ?? Mt,
314
- dragActivationDeltaPx: c ?? Ct,
315
- showOverlay: o ?? _t,
316
- isAbsolute: u ?? Dt,
317
- overlayBackgroundColor: f ?? tt,
318
- toggleIconColor: l ?? Xt,
319
- toggleIconSizePx: s ?? Yt,
320
- toggleIconEdgeDistancePx: w ?? $t,
321
- showToggle: y ?? Bt,
322
- mediaQueryWidth: h ?? Te,
323
- swipeBarZIndex: S ?? Wt,
324
- toggleZIndex: C ?? jt,
325
- overlayZIndex: p ?? kt,
326
- fadeContent: P ?? Ht,
327
- fadeContentTransitionMs: L ?? Nt,
328
- swipeToOpen: Gt,
329
- swipeToClose: Ut,
330
- midAnchorPoint: Zt,
331
- midAnchorPointPx: je / 3,
293
+ const [Y, H] = te(null), [k, W] = te({}), [X, V] = te({}), j = L(/* @__PURE__ */ new Map()), Q = L(null), G = L([]), [b, M] = te({}), [P, F] = te({}), U = L(/* @__PURE__ */ new Map()), ie = L(null), A = L([]), [Z, a] = te({}), [y, $] = te({}), D = L(/* @__PURE__ */ new Map()), ce = L(null), oe = L([]), N = k.primary?.isOpen ?? !1, re = k.primary?.meta ?? null, le = Te(
294
+ () => Object.values(k).some((o) => o.isOpen),
295
+ [k]
296
+ ), Se = j.current.get("primary"), Rt = Se?.sidebarRef ?? { current: null }, Ot = Se?.toggleRef ?? { current: null }, Tt = X.primary ?? {}, Et = b.primary?.isOpen ?? !1, At = b.primary?.meta ?? null, ke = Te(
297
+ () => Object.values(b).some((o) => o.isOpen),
298
+ [b]
299
+ ), We = U.current.get("primary"), Pt = We?.sidebarRef ?? { current: null }, Mt = We?.toggleRef ?? { current: null }, It = P.primary ?? {}, Ct = Z.primary?.isOpen ?? !1, _t = Z.primary?.anchorState ?? "closed", je = Te(
300
+ () => Object.values(Z).some((o) => o.isOpen),
301
+ [Z]
302
+ ), Fe = D.current.get("primary"), Lt = Fe?.sidebarRef ?? { current: null }, Dt = Fe?.toggleRef ?? { current: null }, Yt = y.primary ?? {}, [Xt, $t] = te({
303
+ sidebarWidthPx: t ?? mr,
304
+ sidebarHeightPx: Ke,
305
+ transitionMs: r ?? fr,
306
+ edgeActivationWidthPx: n ?? gr,
307
+ dragActivationDeltaPx: l ?? hr,
308
+ showOverlay: c ?? pr,
309
+ isAbsolute: d ?? yr,
310
+ overlayBackgroundColor: h ?? pt,
311
+ toggleIconColor: g ?? vr,
312
+ toggleIconSizePx: p ?? Sr,
313
+ toggleIconEdgeDistancePx: S ?? wr,
314
+ showToggle: R ?? xr,
315
+ mediaQueryWidth: m ?? Me,
316
+ swipeBarZIndex: T ?? Rr,
317
+ toggleZIndex: C ?? Or,
318
+ overlayZIndex: u ?? Tr,
319
+ fadeContent: w ?? Pr,
320
+ fadeContentTransitionMs: x ?? Ar,
321
+ swipeToOpen: Mr,
322
+ swipeToClose: Ir,
323
+ midAnchorPoint: Cr,
324
+ midAnchorPointPx: Ke / 3,
332
325
  disabled: !1,
333
- closeSidebarOnOverlayClick: I ?? Lt,
334
- resetMetaOnClose: $ ?? !1
335
- }), ut = Y((d, a) => {
336
- F.current.set(d, a), T((g) => g[d] ? g : { ...g, [d]: { ...we } });
337
- }, []), dt = Y((d) => {
338
- F.current.delete(d), T((a) => {
339
- const g = { ...a };
340
- return delete g[d], g;
341
- }), z((a) => {
342
- const g = { ...a };
343
- return delete g[d], g;
326
+ closeSidebarOnOverlayClick: _ ?? br,
327
+ resetMetaOnClose: B ?? !1
328
+ }), Bt = E((o, s) => {
329
+ j.current.set(o, s), W((i) => i[o] ? i : { ...i, [o]: { ...de } });
330
+ }, []), kt = E((o) => {
331
+ j.current.delete(o), W((s) => {
332
+ const i = { ...s };
333
+ return delete i[o], i;
334
+ }), V((s) => {
335
+ const i = { ...s };
336
+ return delete i[o], i;
344
337
  });
345
- }, []), ft = Y((d) => F.current.get(d), []), gt = Y(
346
- (d, a) => {
347
- z((g) => g[d] === a ? g : { ...g, [d]: a });
338
+ }, []), Wt = E((o) => j.current.get(o), []), jt = E(
339
+ (o, s) => {
340
+ V((i) => i[o] === s ? i : { ...i, [o]: s });
348
341
  },
349
342
  []
350
- ), te = Y((d, a) => {
351
- T((g) => {
352
- const b = g[d] ?? we;
353
- return b.isOpen === a ? g : { ...g, [d]: { ...b, isOpen: a } };
343
+ ), Ft = E((o, s) => {
344
+ U.current.set(o, s), M((i) => i[o] ? i : { ...i, [o]: { ...de } });
345
+ }, []), Nt = E((o) => {
346
+ U.current.delete(o), M((s) => {
347
+ const i = { ...s };
348
+ return delete i[o], i;
349
+ }), F((s) => {
350
+ const i = { ...s };
351
+ return delete i[o], i;
352
+ });
353
+ }, []), Ht = E((o) => U.current.get(o), []), Gt = E(
354
+ (o, s) => {
355
+ F((i) => i[o] === s ? i : { ...i, [o]: s });
356
+ },
357
+ []
358
+ ), Ut = E((o, s) => {
359
+ D.current.set(o, s), a((i) => i[o] ? i : { ...i, [o]: { ...Oe } });
360
+ }, []), Zt = E((o) => {
361
+ D.current.delete(o), a((s) => {
362
+ const i = { ...s };
363
+ return delete i[o], i;
364
+ }), $((s) => {
365
+ const i = { ...s };
366
+ return delete i[o], i;
367
+ });
368
+ }, []), zt = E((o) => D.current.get(o), []), Vt = E(
369
+ (o, s) => {
370
+ $((i) => i[o] === s ? i : { ...i, [o]: s });
371
+ },
372
+ []
373
+ ), we = E((o, s) => {
374
+ W((i) => {
375
+ const f = i[o] ?? de;
376
+ return f.isOpen === s ? i : { ...i, [o]: { ...f, isOpen: s } };
377
+ });
378
+ }, []), me = E((o, s) => {
379
+ W((i) => {
380
+ const f = i[o] ?? de;
381
+ return f.meta === s ? i : { ...i, [o]: { ...f, meta: s } };
382
+ });
383
+ }, []), xe = E((o, s) => {
384
+ M((i) => {
385
+ const f = i[o] ?? de;
386
+ return f.isOpen === s ? i : { ...i, [o]: { ...f, isOpen: s } };
354
387
  });
355
- }, []), re = Y(
356
- (d, a) => {
357
- T((g) => {
358
- const b = g[d] ?? we;
359
- return b.anchorState === a ? g : { ...g, [d]: { ...b, anchorState: a } };
388
+ }, []), pe = E((o, s) => {
389
+ M((i) => {
390
+ const f = i[o] ?? de;
391
+ return f.meta === s ? i : { ...i, [o]: { ...f, meta: s } };
392
+ });
393
+ }, []), K = E((o, s) => {
394
+ a((i) => {
395
+ const f = i[o] ?? Oe;
396
+ return f.isOpen === s ? i : { ...i, [o]: { ...f, isOpen: s } };
397
+ });
398
+ }, []), ee = E(
399
+ (o, s) => {
400
+ a((i) => {
401
+ const f = i[o] ?? Oe;
402
+ return f.anchorState === s ? i : { ...i, [o]: { ...f, anchorState: s } };
360
403
  });
361
404
  },
362
405
  []
363
- ), he = Y((d, a) => {
364
- T((g) => {
365
- const b = g[d] ?? we;
366
- return b.meta === a ? g : { ...g, [d]: { ...b, meta: a } };
406
+ ), be = E((o, s) => {
407
+ a((i) => {
408
+ const f = i[o] ?? Oe;
409
+ return f.meta === s ? i : { ...i, [o]: { ...f, meta: s } };
367
410
  });
368
411
  }, []);
369
- G(() => (k || x || Le ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
412
+ q(() => (le || ke || je ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
370
413
  document.body.style.overflow = "";
371
- }), [k, x, Le]), G(() => {
372
- var d;
373
- if (M.fadeContent === !1) {
374
- const a = (d = U.current) == null ? void 0 : d.firstElementChild;
375
- a && (a.style.opacity = "1");
376
- }
377
- }, [M.fadeContent]), G(() => {
378
- var d;
379
- if (D.fadeContent === !1) {
380
- const a = (d = H.current) == null ? void 0 : d.firstElementChild;
381
- a && (a.style.opacity = "1");
382
- }
383
- }, [D.fadeContent]), G(() => {
384
- var d;
385
- for (const [a, g] of Object.entries(R))
386
- if (g.fadeContent === !1) {
387
- const b = F.current.get(a), A = (d = b == null ? void 0 : b.sidebarRef.current) == null ? void 0 : d.firstElementChild;
388
- A && (A.style.opacity = "1");
414
+ }), [le, ke, je]), q(() => {
415
+ for (const [o, s] of Object.entries(X))
416
+ if (s.fadeContent === !1) {
417
+ const f = j.current.get(o)?.sidebarRef.current?.firstElementChild;
418
+ f && (f.style.opacity = "1");
419
+ }
420
+ }, [X]), q(() => {
421
+ for (const [o, s] of Object.entries(P))
422
+ if (s.fadeContent === !1) {
423
+ const f = U.current.get(o)?.sidebarRef.current?.firstElementChild;
424
+ f && (f.style.opacity = "1");
389
425
  }
390
- }, [R]);
391
- const ht = Y((d) => {
392
- lt((a) => ({ ...a, ...d }));
393
- }, []), le = Y((d, a) => {
394
- const g = d === "left" ? ne : n;
395
- a != null && a.resetMeta ? g(null) : (a == null ? void 0 : a.meta) !== void 0 && g(a.meta);
396
- }, []), ie = Y(
397
- (d, a) => {
398
- a != null && a.resetMeta ? he(d, null) : (a == null ? void 0 : a.meta) !== void 0 && he(d, a.meta);
426
+ }, [P]), q(() => {
427
+ for (const [o, s] of Object.entries(y))
428
+ if (s.fadeContent === !1) {
429
+ const f = D.current.get(o)?.sidebarRef.current?.firstElementChild;
430
+ f && (f.style.opacity = "1");
431
+ }
432
+ }, [y]);
433
+ const qt = E((o) => {
434
+ $t((s) => ({ ...s, ...o }));
435
+ }, []), ue = E(
436
+ (o, s, i) => {
437
+ const f = o === "left" ? me : pe;
438
+ i?.resetMeta ? f(s, null) : i?.meta !== void 0 && f(s, i.meta);
439
+ },
440
+ [me, pe]
441
+ ), ne = E(
442
+ (o, s) => {
443
+ s?.resetMeta ? be(o, null) : s?.meta !== void 0 && be(o, s.meta);
399
444
  },
400
- [he]
401
- ), mt = Y(
402
- (d, a) => {
403
- if (d === "left")
404
- ne(a);
405
- else if (d === "right")
406
- n(a);
407
- else {
408
- const g = a;
409
- he(g.id, g.meta);
445
+ [be]
446
+ ), Qt = E(
447
+ (o, s) => {
448
+ if (o === "left") {
449
+ const i = s;
450
+ i && typeof i == "object" && "id" in i ? me(i.id ?? "primary", i.meta) : me("primary", s);
451
+ } else if (o === "right") {
452
+ const i = s;
453
+ i && typeof i == "object" && "id" in i ? pe(i.id ?? "primary", i.meta) : pe("primary", s);
454
+ } else {
455
+ const i = s;
456
+ be(i.id, i.meta);
410
457
  }
411
458
  },
412
- [he]
413
- ), se = Y((d) => {
414
- const a = J.current, g = a.indexOf(d);
415
- g !== -1 && a.splice(g, 1), a.push(d), B("bottom");
416
- }, []), De = Y((d) => {
417
- const a = J.current, g = a.indexOf(d);
418
- g !== -1 && a.splice(g, 1), T((b) => (Object.entries(b).some(([W, K]) => W !== d && K.isOpen) || B(null), b));
419
- }, []), bt = Y(
420
- (d, a) => {
421
- const g = (b, A, W, K) => {
422
- xe({
423
- side: d,
424
- ref: b,
425
- options: A,
426
- toggleRef: W,
459
+ [me, pe, be]
460
+ ), Ne = E((o) => {
461
+ const s = G.current, i = s.indexOf(o);
462
+ i !== -1 && s.splice(i, 1), s.push(o), H("left");
463
+ }, []), He = E((o) => {
464
+ const s = G.current, i = s.indexOf(o);
465
+ i !== -1 && s.splice(i, 1), W((f) => (Object.entries(f).some(([O, z]) => O !== o && z.isOpen) || H(null), f));
466
+ }, []), Ge = E((o) => {
467
+ const s = A.current, i = s.indexOf(o);
468
+ i !== -1 && s.splice(i, 1), s.push(o), H("right");
469
+ }, []), Ue = E((o) => {
470
+ const s = A.current, i = s.indexOf(o);
471
+ i !== -1 && s.splice(i, 1), M((f) => (Object.entries(f).some(([O, z]) => O !== o && z.isOpen) || H(null), f));
472
+ }, []), se = E((o) => {
473
+ const s = oe.current, i = s.indexOf(o);
474
+ i !== -1 && s.splice(i, 1), s.push(o), H("bottom");
475
+ }, []), Ze = E((o) => {
476
+ const s = oe.current, i = s.indexOf(o);
477
+ i !== -1 && s.splice(i, 1), a((f) => (Object.entries(f).some(([O, z]) => O !== o && z.isOpen) || H(null), f));
478
+ }, []), Jt = E(
479
+ (o, s) => {
480
+ const i = s?.skipTransition ? tt : rt, f = s?.skipTransition ? Nr : nt;
481
+ if (o === "left") {
482
+ const v = s?.id ?? "primary", O = X[v], z = j.current.get(v);
483
+ if (!O || !z || O.disabled) return;
484
+ ue("left", v, s), i({
485
+ side: o,
486
+ ref: z.sidebarRef,
487
+ options: O,
488
+ toggleRef: z.toggleRef,
489
+ afterApply: () => {
490
+ we(v, !0), Ne(v);
491
+ }
492
+ });
493
+ } else if (o === "right") {
494
+ const v = s?.id ?? "primary", O = P[v], z = U.current.get(v);
495
+ if (!O || !z || O.disabled) return;
496
+ ue("right", v, s), i({
497
+ side: o,
498
+ ref: z.sidebarRef,
499
+ options: O,
500
+ toggleRef: z.toggleRef,
427
501
  afterApply: () => {
428
- K(!0), B(d);
502
+ xe(v, !0), Ge(v);
429
503
  }
430
504
  });
431
- };
432
- if (d === "left") {
433
- if (M.disabled) return;
434
- le("left", a), g(U, M, N, v);
435
- } else if (d === "right") {
436
- if (D.disabled) return;
437
- le("right", a), g(H, D, Z, E);
438
- } else if (d === "bottom") {
439
- const b = (a == null ? void 0 : a.id) ?? "primary", A = R[b], W = F.current.get(b);
440
- if (!A || !W || A.disabled) return;
441
- ie(b, a);
442
- const K = A.sidebarHeightPx ?? 0, yt = A.mediaQueryWidth ?? 640, $e = window.innerWidth < yt, xt = $e ? A.midAnchorPointPx ?? 0 : K;
443
- $e && A.midAnchorPoint && !A.swipeToOpen && xt < K ? Ne({
444
- ref: W.sidebarRef,
445
- options: A,
446
- toggleRef: W.toggleRef,
505
+ } else if (o === "bottom") {
506
+ const v = s?.id ?? "primary", O = y[v], z = D.current.get(v);
507
+ if (!O || !z || O.disabled) return;
508
+ ne(v, s);
509
+ const ze = O.sidebarHeightPx ?? 0, nr = O.mediaQueryWidth ?? 640, Ve = window.innerWidth < nr, ir = Ve ? O.midAnchorPointPx ?? 0 : ze;
510
+ Ve && O.midAnchorPoint && !O.swipeToOpen && ir < ze ? f({
511
+ ref: z.sidebarRef,
512
+ options: O,
513
+ toggleRef: z.toggleRef,
447
514
  afterApply: () => {
448
- te(b, !0), re(b, "midAnchor"), se(b);
515
+ K(v, !0), ee(v, "midAnchor"), se(v);
449
516
  }
450
- }) : xe({
451
- side: d,
452
- ref: W.sidebarRef,
453
- options: A,
454
- toggleRef: W.toggleRef,
517
+ }) : i({
518
+ side: o,
519
+ ref: z.sidebarRef,
520
+ options: O,
521
+ toggleRef: z.toggleRef,
455
522
  afterApply: () => {
456
- te(b, !0), re(b, "open"), se(b);
523
+ K(v, !0), ee(v, "open"), se(v);
457
524
  }
458
525
  });
459
526
  } else
460
- ye(d);
527
+ Ae(o);
461
528
  },
462
529
  [
463
- M,
464
- D,
465
- R,
466
- te,
467
- re,
530
+ X,
531
+ P,
532
+ y,
533
+ we,
534
+ xe,
535
+ K,
536
+ ee,
537
+ Ne,
538
+ Ge,
468
539
  se,
469
- le,
470
- ie
540
+ ue,
541
+ ne
471
542
  ]
472
- ), vt = Y(
473
- (d, a) => {
474
- if (d !== "bottom") return;
475
- const g = (a == null ? void 0 : a.id) ?? "primary", b = R[g], A = F.current.get(g);
476
- !b || !A || b.disabled || (ie(g, a), Ne({
477
- ref: A.sidebarRef,
478
- options: b,
479
- toggleRef: A.toggleRef,
543
+ ), Kt = E(
544
+ (o, s) => {
545
+ if (o !== "bottom") return;
546
+ const i = s?.id ?? "primary", f = y[i], v = D.current.get(i);
547
+ !f || !v || f.disabled || (ne(i, s), nt({
548
+ ref: v.sidebarRef,
549
+ options: f,
550
+ toggleRef: v.toggleRef,
480
551
  afterApply: () => {
481
- te(g, !0), re(g, "midAnchor"), se(g);
552
+ K(i, !0), ee(i, "midAnchor"), se(i);
482
553
  }
483
554
  }));
484
555
  },
485
556
  [
486
- R,
487
- te,
488
- re,
557
+ y,
558
+ K,
559
+ ee,
489
560
  se,
490
- ie
561
+ ne
491
562
  ]
492
- ), wt = Y(
493
- (d, a) => {
494
- if (d !== "bottom") return;
495
- const g = (a == null ? void 0 : a.id) ?? "primary", b = R[g], A = F.current.get(g);
496
- !b || !A || b.disabled || (ie(g, a), xe({
497
- side: d,
498
- ref: A.sidebarRef,
499
- options: b,
500
- toggleRef: A.toggleRef,
563
+ ), er = E(
564
+ (o, s) => {
565
+ if (o !== "bottom") return;
566
+ const i = s?.id ?? "primary", f = y[i], v = D.current.get(i);
567
+ if (!f || !v || f.disabled) return;
568
+ ne(i, s), (s?.skipTransition ? tt : rt)({
569
+ side: o,
570
+ ref: v.sidebarRef,
571
+ options: f,
572
+ toggleRef: v.toggleRef,
501
573
  afterApply: () => {
502
- te(g, !0), re(g, "open"), se(g);
574
+ K(i, !0), ee(i, "open"), se(i);
503
575
  }
504
- }));
576
+ });
505
577
  },
506
578
  [
507
- R,
508
- te,
509
- re,
579
+ y,
580
+ K,
581
+ ee,
510
582
  se,
511
- ie
583
+ ne
512
584
  ]
513
- ), pt = Y(
514
- (d, a) => {
515
- const g = (b, A, W, K) => {
516
- Fe({
517
- ref: b,
518
- options: A,
519
- toggleRef: W,
520
- side: d,
585
+ ), tr = E(
586
+ (o, s) => {
587
+ if (o === "left") {
588
+ const i = s?.id ?? "primary", f = X[i], v = j.current.get(i);
589
+ if (!f || !v || f.disabled) return;
590
+ const O = f.resetMetaOnClose && s?.meta === void 0 && s?.resetMeta === void 0 ? { ...s, resetMeta: !0 } : s;
591
+ ue("left", i, O), Pe({
592
+ ref: v.sidebarRef,
593
+ options: f,
594
+ toggleRef: v.toggleRef,
595
+ side: o,
521
596
  afterApply: () => {
522
- K(!1), B(null);
597
+ we(i, !1), He(i);
523
598
  }
524
599
  });
525
- };
526
- if (d === "left") {
527
- if (M.disabled) return;
528
- const b = M.resetMetaOnClose && (a == null ? void 0 : a.meta) === void 0 && (a == null ? void 0 : a.resetMeta) === void 0 ? { ...a, resetMeta: !0 } : a;
529
- le("left", b), g(U, M, N, v);
530
- } else if (d === "right") {
531
- if (D.disabled) return;
532
- const b = D.resetMetaOnClose && (a == null ? void 0 : a.meta) === void 0 && (a == null ? void 0 : a.resetMeta) === void 0 ? { ...a, resetMeta: !0 } : a;
533
- le("right", b), g(H, D, Z, E);
534
- } else if (d === "bottom") {
535
- const b = (a == null ? void 0 : a.id) ?? "primary", A = R[b], W = F.current.get(b);
536
- if (!A || !W || A.disabled) return;
537
- const K = A.resetMetaOnClose && (a == null ? void 0 : a.meta) === void 0 && (a == null ? void 0 : a.resetMeta) === void 0 ? { ...a, resetMeta: !0 } : a;
538
- ie(b, K), Fe({
539
- ref: W.sidebarRef,
540
- options: A,
541
- toggleRef: W.toggleRef,
542
- side: d,
600
+ } else if (o === "right") {
601
+ const i = s?.id ?? "primary", f = P[i], v = U.current.get(i);
602
+ if (!f || !v || f.disabled) return;
603
+ const O = f.resetMetaOnClose && s?.meta === void 0 && s?.resetMeta === void 0 ? { ...s, resetMeta: !0 } : s;
604
+ ue("right", i, O), Pe({
605
+ ref: v.sidebarRef,
606
+ options: f,
607
+ toggleRef: v.toggleRef,
608
+ side: o,
543
609
  afterApply: () => {
544
- te(b, !1), re(b, "closed"), De(b);
610
+ xe(i, !1), Ue(i);
611
+ }
612
+ });
613
+ } else if (o === "bottom") {
614
+ const i = s?.id ?? "primary", f = y[i], v = D.current.get(i);
615
+ if (!f || !v || f.disabled) return;
616
+ const O = f.resetMetaOnClose && s?.meta === void 0 && s?.resetMeta === void 0 ? { ...s, resetMeta: !0 } : s;
617
+ ne(i, O), Pe({
618
+ ref: v.sidebarRef,
619
+ options: f,
620
+ toggleRef: v.toggleRef,
621
+ side: o,
622
+ afterApply: () => {
623
+ K(i, !1), ee(i, "closed"), Ze(i);
545
624
  }
546
625
  });
547
626
  } else
548
- ye(d);
627
+ Ae(o);
549
628
  },
550
629
  [
551
- M,
552
- D,
553
- R,
554
- te,
555
- re,
556
- De,
557
- le,
558
- ie
630
+ X,
631
+ P,
632
+ y,
633
+ we,
634
+ xe,
635
+ K,
636
+ ee,
637
+ He,
638
+ Ue,
639
+ Ze,
640
+ ue,
641
+ ne
559
642
  ]
560
- ), St = Y(
561
- (d, a, g) => {
562
- if (d === "left")
563
- He({
564
- ref: U,
565
- toggleRef: N,
566
- options: M,
567
- translateX: a
643
+ ), rr = E(
644
+ (o, s, i) => {
645
+ if (o === "left") {
646
+ const f = i?.id ?? "primary", v = X[f], O = j.current.get(f);
647
+ if (!v || !O) return;
648
+ it({
649
+ ref: O.sidebarRef,
650
+ toggleRef: O.toggleRef,
651
+ options: v,
652
+ translateX: s
568
653
  });
569
- else if (d === "right")
570
- He({
571
- ref: H,
572
- toggleRef: Z,
573
- options: D,
574
- translateX: a
654
+ } else if (o === "right") {
655
+ const f = i?.id ?? "primary", v = P[f], O = U.current.get(f);
656
+ if (!v || !O) return;
657
+ it({
658
+ ref: O.sidebarRef,
659
+ toggleRef: O.toggleRef,
660
+ options: v,
661
+ translateX: s
575
662
  });
576
- else if (d === "bottom") {
577
- const b = (g == null ? void 0 : g.id) ?? "primary", A = R[b], W = F.current.get(b);
578
- if (!A || !W) return;
579
- or({
580
- ref: W.sidebarRef,
581
- toggleRef: W.toggleRef,
582
- options: A,
583
- translateY: a
663
+ } else if (o === "bottom") {
664
+ const f = i?.id ?? "primary", v = y[f], O = D.current.get(f);
665
+ if (!v || !O) return;
666
+ Hr({
667
+ ref: O.sidebarRef,
668
+ toggleRef: O.toggleRef,
669
+ options: v,
670
+ translateY: s
584
671
  });
585
672
  } else
586
- ye(d);
673
+ Ae(o);
587
674
  },
588
- [M, D, R]
675
+ [X, P, y]
589
676
  );
590
- return /* @__PURE__ */ O.jsx(
591
- et.Provider,
677
+ return /* @__PURE__ */ I.jsx(
678
+ mt.Provider,
592
679
  {
593
680
  value: {
594
- lockedSidebar: j,
595
- setLockedSidebar: B,
596
- leftSidebarRef: U,
597
- rightSidebarRef: H,
598
- isLeftOpen: k,
599
- isRightOpen: x,
681
+ lockedSidebar: Y,
682
+ setLockedSidebar: H,
683
+ // Backwards-compat aliases for primary left
684
+ leftSidebarRef: Rt,
685
+ rightSidebarRef: Pt,
686
+ isLeftOpen: N,
687
+ isRightOpen: Et,
688
+ leftSidebarOptions: Tt,
689
+ rightSidebarOptions: It,
690
+ leftToggleRef: Ot,
691
+ rightToggleRef: Mt,
692
+ leftMeta: re,
693
+ rightMeta: At,
694
+ // Multi-instance left sidebar
695
+ leftSidebars: k,
696
+ leftSidebarOptionsMap: X,
697
+ registerLeftSidebar: Bt,
698
+ unregisterLeftSidebar: kt,
699
+ getLeftSidebarRefs: Wt,
700
+ activeLeftDragIdRef: Q,
701
+ leftFocusStackRef: G,
702
+ // Multi-instance right sidebar
703
+ rightSidebars: b,
704
+ rightSidebarOptionsMap: P,
705
+ registerRightSidebar: Ft,
706
+ unregisterRightSidebar: Nt,
707
+ getRightSidebarRefs: Ht,
708
+ activeRightDragIdRef: ie,
709
+ rightFocusStackRef: A,
600
710
  // Backwards-compat aliases for primary bottom sidebar
601
- isBottomOpen: ge,
602
- bottomAnchorState: Se,
603
- bottomSidebarRef: ot,
604
- bottomToggleRef: at,
605
- bottomSidebarOptions: st,
711
+ isBottomOpen: Ct,
712
+ bottomAnchorState: _t,
713
+ bottomSidebarRef: Lt,
714
+ bottomToggleRef: Dt,
715
+ bottomSidebarOptions: Yt,
606
716
  // Multi-instance bottom sidebar
607
- bottomSidebars: m,
608
- bottomSidebarOptionsMap: R,
609
- registerBottomSidebar: ut,
610
- unregisterBottomSidebar: dt,
611
- getBottomSidebarRefs: ft,
612
- activeBottomDragIdRef: X,
613
- bottomFocusStackRef: J,
717
+ bottomSidebars: Z,
718
+ bottomSidebarOptionsMap: y,
719
+ registerBottomSidebar: Ut,
720
+ unregisterBottomSidebar: Zt,
721
+ getBottomSidebarRefs: zt,
722
+ activeBottomDragIdRef: ce,
723
+ bottomFocusStackRef: oe,
614
724
  // Functions
615
- openSidebar: bt,
616
- openSidebarFully: wt,
617
- openSidebarToMidAnchor: vt,
618
- closeSidebar: pt,
619
- dragSidebar: St,
620
- globalOptions: ct,
621
- setGlobalOptions: ht,
622
- leftSidebarOptions: M,
623
- rightSidebarOptions: D,
624
- setLeftSidebarOptions: q,
625
- setRightSidebarOptions: V,
626
- setBottomSidebarOptionsById: gt,
627
- leftToggleRef: N,
628
- rightToggleRef: Z,
629
- leftMeta: oe,
630
- rightMeta: ae,
631
- setMeta: mt
725
+ openSidebar: Jt,
726
+ openSidebarFully: er,
727
+ openSidebarToMidAnchor: Kt,
728
+ closeSidebar: tr,
729
+ dragSidebar: rr,
730
+ globalOptions: Xt,
731
+ setGlobalOptions: qt,
732
+ setLeftSidebarOptionsById: jt,
733
+ setRightSidebarOptionsById: Gt,
734
+ setBottomSidebarOptionsById: Vt,
735
+ setMeta: Qt
632
736
  },
633
737
  children: e
634
738
  }
635
739
  );
636
740
  };
637
- function ee() {
638
- const e = Et(et);
741
+ function J() {
742
+ const e = ar(mt);
639
743
  if (!e)
640
744
  throw new Error("useSwipeBarContext must be used within SwipeBarProvider");
641
745
  return e;
642
746
  }
643
- const Pt = 300, Mt = 40, Ct = 20, It = 320, je = window.innerHeight, _t = !0, Lt = !0, Dt = !1, tt = "rgba(0, 0, 0, 0.5)", Ee = "rgb(36,36,36)", Xt = "white", Yt = 40, $t = 40, Bt = !0, Te = 640, Wt = 30, jt = 15, kt = 20, ke = 0.6, Ft = 200, Nt = 100, Ht = !1, Gt = !0, Ut = !0, Zt = !1, ue = "cubic-bezier(0.22, 1, 0.36, 1)", rt = {
747
+ const fr = 300, gr = 40, hr = 20, mr = 320, Ke = window.innerHeight, pr = !0, br = !0, yr = !1, pt = "rgba(0, 0, 0, 0.5)", Ie = "rgb(36,36,36)", vr = "white", Sr = 40, wr = 40, xr = !0, Me = 640, Rr = 30, Or = 15, Tr = 20, et = 0.6, Er = 200, Ar = 100, Pr = !1, Mr = !0, Ir = !0, Cr = !1, fe = "cubic-bezier(0.22, 1, 0.36, 1)", bt = {
644
748
  width: 0,
645
749
  top: 0,
646
750
  bottom: 0,
647
751
  flexShrink: 0,
648
752
  overflowX: "hidden",
649
753
  willChange: "transform"
650
- }, zt = {
754
+ }, _r = {
651
755
  transform: "translateX(-100%)"
652
- }, qt = {
756
+ }, Lr = {
653
757
  transform: "translateX(100%)"
654
- }, Vt = {
758
+ }, Dr = {
655
759
  position: "fixed",
656
760
  left: 0,
657
761
  top: 0,
658
762
  bottom: 0
659
- }, Qt = {
763
+ }, Yr = {
660
764
  position: "fixed",
661
765
  right: 0,
662
766
  top: 0,
663
767
  bottom: 0
664
- }, Jt = {
768
+ }, Xr = {
665
769
  height: 0,
666
770
  left: 0,
667
771
  right: 0,
668
772
  flexShrink: 0,
669
773
  overflowY: "hidden",
670
774
  willChange: "transform"
671
- }, Kt = {
775
+ }, $r = {
672
776
  transform: "translateY(100%)"
673
- }, er = {
777
+ }, Br = {
674
778
  position: "fixed",
675
779
  bottom: 0,
676
780
  left: 0,
677
781
  right: 0
678
- }, tr = {
782
+ }, kr = {
679
783
  position: "fixed",
680
784
  top: 0,
681
785
  left: 0,
682
786
  width: "100%",
683
787
  height: "100%",
684
- backgroundColor: tt,
788
+ backgroundColor: pt,
685
789
  transitionProperty: "opacity",
686
790
  pointerEvents: "none",
687
791
  opacity: 0
688
- }, rr = {
792
+ }, Wr = {
689
793
  opacity: 1,
690
794
  pointerEvents: "auto"
691
- }, nt = {
795
+ }, yt = {
692
796
  position: "fixed",
693
797
  top: "50%",
694
798
  transform: "translateY(-50%)",
695
799
  width: "1px",
696
800
  display: "flex",
697
801
  justifyContent: "center"
698
- }, nr = {
802
+ }, jr = {
699
803
  position: "fixed",
700
804
  bottom: 0,
701
805
  left: "50%",
@@ -703,147 +807,170 @@ const Pt = 300, Mt = 40, Ct = 20, It = 320, je = window.innerHeight, _t = !0, Lt
703
807
  height: "1px",
704
808
  display: "flex",
705
809
  alignItems: "center"
706
- }, ir = {
810
+ }, Fr = {
707
811
  position: "relative",
708
812
  cursor: "pointer",
709
813
  display: "flex",
710
814
  height: "72px",
711
815
  alignItems: "center",
712
816
  justifyContent: "center"
713
- }, Oe = (e) => {
817
+ }, Ce = (e) => {
714
818
  throw new Error(`Unhandled sidebar side: ${e}`);
715
- }, ve = (e) => {
716
- var t;
717
- return (t = e.current) == null ? void 0 : t.firstElementChild;
718
- }, xe = ({
819
+ }, ae = (e) => e.current?.firstElementChild, vt = (e, t) => e === "left" || e === "right" ? { dimension: "width", sizePx: t.sidebarWidthPx } : e === "bottom" ? { dimension: "height", sizePx: t.sidebarHeightPx } : Ce(e), St = (e, t, r) => {
820
+ !e.current || !r || (e.current.style.opacity = "1", t === "left" ? e.current.style.transform = `translateY(-50%) translateX(${r}px)` : t === "right" ? e.current.style.transform = `translateY(-50%) translateX(-${r}px)` : t === "bottom" && (e.current.style.transform = `translateX(-50%) translateY(-${r}px)`));
821
+ }, tt = ({
822
+ ref: e,
823
+ side: t,
824
+ options: r,
825
+ toggleRef: n,
826
+ afterApply: l
827
+ }) => {
828
+ if (!e.current) return;
829
+ const c = ae(e), { dimension: d, sizePx: h } = vt(t, r);
830
+ c && h && (c.style[t === "bottom" ? "minHeight" : "minWidth"] = `${h}px`), e.current.style.transition = "none", e.current.style.transform = t === "bottom" ? "translateY(0px)" : "translateX(0px)", e.current.style[d] = `${h}px`, c && (c.style.opacity = "1"), St(n, t, h), l();
831
+ }, rt = ({
719
832
  ref: e,
720
833
  side: t,
721
834
  options: r,
722
- toggleRef: i,
723
- afterApply: c
835
+ toggleRef: n,
836
+ afterApply: l
724
837
  }) => {
725
- const o = ve(e), u = r.transitionMs ? r.transitionMs / 2 : 0;
726
- o && r.fadeContent && (o.style.opacity = "0");
727
- let f, l;
728
- t === "left" || t === "right" ? (f = "width", l = r.sidebarWidthPx, o && l && (o.style.minWidth = `${l}px`)) : t === "bottom" ? (f = "height", l = r.sidebarHeightPx, o && l && (o.style.minHeight = `${l}px`)) : Oe(t), requestAnimationFrame(() => {
838
+ const c = ae(e), { dimension: d, sizePx: h } = vt(t, r);
839
+ c && h && (c.style[t === "bottom" ? "minHeight" : "minWidth"] = `${h}px`);
840
+ const g = r.transitionMs ? r.transitionMs / 2 : 0;
841
+ c && r.fadeContent && (c.style.opacity = "0"), requestAnimationFrame(() => {
729
842
  if (!e.current) return;
730
- const s = `transform ${r.transitionMs}ms ${ue}`, w = r.isAbsolute ? "" : `, ${f} ${r.transitionMs}ms ${ue}`;
731
- e.current.style.transition = `${s}${w}`, o && r.fadeContent && (o.style.transition = `opacity ${r.fadeContentTransitionMs}ms ease`), requestAnimationFrame(() => {
843
+ const p = `transform ${r.transitionMs}ms ${fe}`, S = r.isAbsolute ? "" : `, ${d} ${r.transitionMs}ms ${fe}`;
844
+ e.current.style.transition = `${p}${S}`, c && r.fadeContent && (c.style.transition = `opacity ${r.fadeContentTransitionMs}ms ease`), requestAnimationFrame(() => {
732
845
  if (e.current) {
733
846
  if (e.current.style.transform = t === "bottom" ? "translateY(0px)" : "translateX(0px)", !r.isAbsolute)
734
- e.current.style[f] = `${l}px`;
735
- else if (e.current.style[f] !== `${l}px`) {
736
- const y = e.current.style.transition;
737
- e.current.style.transition = s, e.current.style[f] = `${l}px`, e.current.style.transition = y;
847
+ e.current.style[d] = `${h}px`;
848
+ else if (e.current.style[d] !== `${h}px`) {
849
+ const R = e.current.style.transition;
850
+ e.current.style.transition = p, e.current.style[d] = `${h}px`, e.current.style.transition = R;
738
851
  }
739
- i.current && l && (i.current.style.opacity = "1", t === "left" ? i.current.style.transform = `translateY(-50%) translateX(${l}px)` : t === "right" ? i.current.style.transform = `translateY(-50%) translateX(-${l}px)` : t === "bottom" && (i.current.style.transform = `translateX(-50%) translateY(-${l}px)`)), o && r.fadeContent && setTimeout(() => {
740
- o.style.opacity = "1";
741
- }, u), c();
852
+ St(n, t, h), c && r.fadeContent && setTimeout(() => {
853
+ c.style.opacity = "1";
854
+ }, g), l();
742
855
  }
743
856
  });
744
857
  }), setTimeout(() => {
745
858
  }, 0);
746
- }, Fe = ({
859
+ }, Pe = ({
747
860
  ref: e,
748
861
  options: t,
749
862
  side: r,
750
- toggleRef: i,
751
- afterApply: c
863
+ toggleRef: n,
864
+ afterApply: l
752
865
  }) => {
753
- const o = ve(e);
754
- let u;
755
- r === "left" || r === "right" ? (u = "width", o && t.sidebarWidthPx && (o.style.minWidth = `${t.sidebarWidthPx}px`)) : r === "bottom" ? (u = "height", o && t.sidebarHeightPx && (o.style.minHeight = `${t.sidebarHeightPx}px`)) : Oe(r), requestAnimationFrame(() => {
866
+ const c = ae(e);
867
+ let d;
868
+ r === "left" || r === "right" ? (d = "width", c && t.sidebarWidthPx && (c.style.minWidth = `${t.sidebarWidthPx}px`)) : r === "bottom" ? (d = "height", c && t.sidebarHeightPx && (c.style.minHeight = `${t.sidebarHeightPx}px`)) : Ce(r), requestAnimationFrame(() => {
756
869
  if (!e.current) return;
757
- const f = `transform ${t.transitionMs}ms ${ue}`, l = t.isAbsolute ? "" : `, ${u} ${t.transitionMs}ms ${ue}`;
758
- e.current.style.transition = `${f}${l}`, o && t.fadeContent && (o.style.transition = `opacity ${t.fadeContentTransitionMs}ms ease`), requestAnimationFrame(() => {
759
- e.current && (r === "left" ? (e.current.style.transform = "translateX(-100%)", t.isAbsolute || (e.current.style.width = "0px")) : r === "right" ? (e.current.style.transform = "translateX(100%)", t.isAbsolute || (e.current.style.width = "0px")) : r === "bottom" && (e.current.style.transform = "translateY(100%)", t.isAbsolute || (e.current.style.height = "0px")), i.current && (i.current.style.opacity = "1", r === "left" || r === "right" ? i.current.style.transform = "translateY(-50%)" : r === "bottom" && (i.current.style.transform = "translateX(-50%)")), o && t.fadeContent && (o.style.opacity = "0"), c());
870
+ const h = `transform ${t.transitionMs}ms ${fe}`, g = t.isAbsolute ? "" : `, ${d} ${t.transitionMs}ms ${fe}`;
871
+ e.current.style.transition = `${h}${g}`, c && t.fadeContent && (c.style.transition = `opacity ${t.fadeContentTransitionMs}ms ease`), requestAnimationFrame(() => {
872
+ e.current && (r === "left" ? (e.current.style.transform = "translateX(-100%)", t.isAbsolute || (e.current.style.width = "0px")) : r === "right" ? (e.current.style.transform = "translateX(100%)", t.isAbsolute || (e.current.style.width = "0px")) : r === "bottom" && (e.current.style.transform = "translateY(100%)", t.isAbsolute || (e.current.style.height = "0px")), n.current && (n.current.style.opacity = "1", r === "left" || r === "right" ? n.current.style.transform = "translateY(-50%)" : r === "bottom" && (n.current.style.transform = "translateX(-50%)")), c && t.fadeContent && (c.style.opacity = "0"), l());
760
873
  });
761
874
  });
762
- }, Ne = ({
875
+ }, wt = (e) => {
876
+ const t = e.midAnchorPointPx ?? 0, r = e.sidebarHeightPx ?? 0;
877
+ return { midAnchorPx: t, sidebarHeightPx: r, translateY: r - t };
878
+ }, Nr = ({
879
+ ref: e,
880
+ options: t,
881
+ toggleRef: r,
882
+ afterApply: n
883
+ }) => {
884
+ if (!e.current) return;
885
+ const l = ae(e), { midAnchorPx: c, sidebarHeightPx: d, translateY: h } = wt(t);
886
+ l && t.midAnchorPointPx && (l.style.minHeight = `${d}px`), e.current.style.transition = "none", e.current.style.transform = `translateY(${h}px)`, e.current.style.height = `${d}px`, l && (l.style.opacity = "1"), r.current && (r.current.style.opacity = "1", r.current.style.transform = `translateX(-50%) translateY(-${c}px)`), n();
887
+ }, nt = ({
763
888
  ref: e,
764
889
  options: t,
765
890
  toggleRef: r,
766
- afterApply: i
891
+ afterApply: n
767
892
  }) => {
768
- const c = ve(e), o = t.transitionMs ? t.transitionMs / 2 : 0;
769
- c && t.fadeContent && (c.style.opacity = "0"), c && t.midAnchorPointPx && (c.style.minHeight = `${t.sidebarHeightPx}px`), requestAnimationFrame(() => {
893
+ const l = ae(e), { midAnchorPx: c, sidebarHeightPx: d, translateY: h } = wt(t);
894
+ l && t.midAnchorPointPx && (l.style.minHeight = `${d}px`);
895
+ const g = t.transitionMs ? t.transitionMs / 2 : 0;
896
+ l && t.fadeContent && (l.style.opacity = "0"), requestAnimationFrame(() => {
770
897
  if (!e.current) return;
771
- const u = `transform ${t.transitionMs}ms ${ue}`, f = t.isAbsolute ? "" : `, height ${t.transitionMs}ms ${ue}`;
772
- e.current.style.transition = `${u}${f}`, c && t.fadeContent && (c.style.transition = `opacity ${t.fadeContentTransitionMs}ms ease`), requestAnimationFrame(() => {
773
- if (!e.current) return;
774
- const l = t.midAnchorPointPx ?? 0, s = t.sidebarHeightPx ?? 0, w = s - l;
775
- if (e.current.style.transform = `translateY(${w}px)`, !t.isAbsolute)
776
- e.current.style.height = `${s}px`;
777
- else if (e.current.style.height !== `${s}px`) {
778
- const y = e.current.style.transition;
779
- e.current.style.transition = u, e.current.style.height = `${s}px`, e.current.style.transition = y;
898
+ const p = `transform ${t.transitionMs}ms ${fe}`, S = t.isAbsolute ? "" : `, height ${t.transitionMs}ms ${fe}`;
899
+ e.current.style.transition = `${p}${S}`, l && t.fadeContent && (l.style.transition = `opacity ${t.fadeContentTransitionMs}ms ease`), requestAnimationFrame(() => {
900
+ if (e.current) {
901
+ if (e.current.style.transform = `translateY(${h}px)`, !t.isAbsolute)
902
+ e.current.style.height = `${d}px`;
903
+ else if (e.current.style.height !== `${d}px`) {
904
+ const R = e.current.style.transition;
905
+ e.current.style.transition = p, e.current.style.height = `${d}px`, e.current.style.transition = R;
906
+ }
907
+ r.current && (r.current.style.opacity = "1", r.current.style.transform = `translateX(-50%) translateY(-${c}px)`), l && t.fadeContent && setTimeout(() => {
908
+ l.style.opacity = "1";
909
+ }, g), n();
780
910
  }
781
- r.current && (r.current.style.opacity = "1", r.current.style.transform = `translateX(-50%) translateY(-${l}px)`), c && t.fadeContent && setTimeout(() => {
782
- c.style.opacity = "1";
783
- }, o), i();
784
911
  });
785
912
  }), setTimeout(() => {
786
913
  }, 0);
787
- }, He = ({
914
+ }, it = ({
788
915
  ref: e,
789
916
  toggleRef: t,
790
917
  options: r,
791
- translateX: i
918
+ translateX: n
792
919
  }) => {
793
- !e.current || i === null || (e.current.style.transition = "none", requestAnimationFrame(() => {
794
- const c = ve(e);
920
+ !e.current || n === null || (e.current.style.transition = "none", requestAnimationFrame(() => {
921
+ const l = ae(e);
795
922
  if (e.current) {
796
- if (c && r.fadeContent && (c.style.opacity = "0"), c && r.sidebarWidthPx && (c.style.minWidth = `${r.sidebarWidthPx}px`), !r.isAbsolute) {
797
- const o = `${r.sidebarWidthPx}px`;
798
- e.current.style.width !== o && (e.current.style.width = o);
923
+ if (l && r.fadeContent && (l.style.opacity = "0"), l && r.sidebarWidthPx && (l.style.minWidth = `${r.sidebarWidthPx}px`), !r.isAbsolute) {
924
+ const c = `${r.sidebarWidthPx}px`;
925
+ e.current.style.width !== c && (e.current.style.width = c);
799
926
  }
800
- e.current.style.transform = `translateX(${i}px)`, t.current && (t.current.style.opacity = "0", t.current.style.transform = `translateY(-50%) translateX(${i}px)`);
927
+ e.current.style.transform = `translateX(${n}px)`, t.current && (t.current.style.opacity = "0", t.current.style.transform = `translateY(-50%) translateX(${n}px)`);
801
928
  }
802
929
  }));
803
- }, or = ({
930
+ }, Hr = ({
804
931
  ref: e,
805
932
  toggleRef: t,
806
933
  options: r,
807
- translateY: i
934
+ translateY: n
808
935
  }) => {
809
- !e.current || i === null || (e.current.style.transition = "none", requestAnimationFrame(() => {
810
- const c = ve(e);
936
+ !e.current || n === null || (e.current.style.transition = "none", requestAnimationFrame(() => {
937
+ const l = ae(e);
811
938
  if (e.current) {
812
- if (c && r.fadeContent && (c.style.opacity = "0"), c && r.sidebarHeightPx && (c.style.minHeight = `${r.sidebarHeightPx}px`), !r.isAbsolute) {
813
- const o = `${r.sidebarHeightPx}px`;
814
- e.current.style.height !== o && (e.current.style.height = o);
939
+ if (l && r.fadeContent && (l.style.opacity = "0"), l && r.sidebarHeightPx && (l.style.minHeight = `${r.sidebarHeightPx}px`), !r.isAbsolute) {
940
+ const c = `${r.sidebarHeightPx}px`;
941
+ e.current.style.height !== c && (e.current.style.height = c);
815
942
  }
816
- e.current.style.transform = `translateY(${i}px)`, t.current && (t.current.style.opacity = "0", t.current.style.transform = `translateX(-50%) translateY(${i}px)`);
943
+ e.current.style.transform = `translateY(${n}px)`, t.current && (t.current.style.opacity = "0", t.current.style.transform = `translateX(-50%) translateY(${n}px)`);
817
944
  }
818
945
  }));
819
- }, pe = ({ refs: e, clientX: t, clientY: r, touchId: i, isMouse: c }) => {
946
+ }, Ee = ({ refs: e, clientX: t, clientY: r, touchId: n, isMouse: l }) => {
820
947
  e.draggingRef.current = {
821
948
  startX: t,
822
949
  startY: r,
823
- activeTouchId: i,
824
- isMouse: c,
950
+ activeTouchId: n,
951
+ isMouse: l,
825
952
  isActivated: !1
826
953
  }, e.currentXRef.current = t, e.prevXRef.current = t;
827
- }, Ge = ({
954
+ }, ot = ({
828
955
  refs: e,
829
956
  clientX: t,
830
957
  clientY: r,
831
- touchId: i,
832
- isMouse: c
958
+ touchId: n,
959
+ isMouse: l
833
960
  }) => {
834
961
  e.draggingRef.current = {
835
962
  startX: t,
836
963
  startY: r,
837
- activeTouchId: i,
838
- isMouse: c,
964
+ activeTouchId: n,
965
+ isMouse: l,
839
966
  isActivated: !1
840
967
  }, e.currentYRef.current = r, e.prevYRef.current = r;
841
- }, it = ({ refs: e, dragSidebar: t, onDeactivate: r }) => {
968
+ }, xt = ({ refs: e, dragSidebar: t, onDeactivate: r }) => {
842
969
  e.draggingRef.current = null, e.currentXRef.current = null, e.prevXRef.current = null, t(null), r();
843
- }, ar = ({ refs: e, dragSidebar: t, onDeactivate: r }) => {
970
+ }, Gr = ({ refs: e, dragSidebar: t, onDeactivate: r }) => {
844
971
  e.draggingRef.current = null, e.currentYRef.current = null, e.prevYRef.current = null, t(null);
845
- }, de = (e) => e instanceof Element ? !!e.closest("input, textarea, [contenteditable='true']") : !1;
846
- function Ue(e) {
972
+ }, ge = (e) => e instanceof Element ? !!e.closest("input, textarea, [contenteditable='true']") : !1;
973
+ function st(e) {
847
974
  let t = e instanceof HTMLElement ? e : null;
848
975
  for (; t; ) {
849
976
  const r = getComputedStyle(t);
@@ -853,164 +980,164 @@ function Ue(e) {
853
980
  }
854
981
  return null;
855
982
  }
856
- const Ae = (e, t) => {
983
+ const _e = (e, t) => {
857
984
  for (let r = 0; r < e.length; r++) {
858
- const i = e[r];
859
- if (t == null || i.identifier === t)
860
- return i;
985
+ const n = e[r];
986
+ if (t == null || n.identifier === t)
987
+ return n;
861
988
  }
862
989
  return null;
863
- }, Pe = (e, t) => {
990
+ }, Le = (e, t) => {
864
991
  for (let r = 0; r < e.length; r++)
865
992
  if (e[r].identifier === t)
866
993
  return !0;
867
994
  return !1;
868
- }, Me = (e, t, r) => {
995
+ }, De = (e, t, r) => {
869
996
  const {
870
- globalOptions: i,
871
- setLeftSidebarOptions: c,
872
- setRightSidebarOptions: o,
873
- setBottomSidebarOptionsById: u
874
- } = ee(), {
875
- sidebarWidthPx: f,
876
- sidebarHeightPx: l,
877
- transitionMs: s,
878
- edgeActivationWidthPx: w,
879
- dragActivationDeltaPx: y,
880
- showOverlay: h,
881
- isAbsolute: S,
997
+ globalOptions: n,
998
+ setLeftSidebarOptionsById: l,
999
+ setRightSidebarOptionsById: c,
1000
+ setBottomSidebarOptionsById: d
1001
+ } = J(), {
1002
+ sidebarWidthPx: h,
1003
+ sidebarHeightPx: g,
1004
+ transitionMs: p,
1005
+ edgeActivationWidthPx: S,
1006
+ dragActivationDeltaPx: R,
1007
+ showOverlay: m,
1008
+ isAbsolute: T,
882
1009
  overlayBackgroundColor: C,
883
- toggleIconColor: p,
884
- toggleIconSizePx: P,
885
- toggleIconEdgeDistancePx: L,
886
- showToggle: I,
887
- mediaQueryWidth: $,
888
- swipeBarZIndex: j,
889
- toggleZIndex: B,
1010
+ toggleIconColor: u,
1011
+ toggleIconSizePx: w,
1012
+ toggleIconEdgeDistancePx: x,
1013
+ showToggle: _,
1014
+ mediaQueryWidth: B,
1015
+ swipeBarZIndex: Y,
1016
+ toggleZIndex: H,
890
1017
  overlayZIndex: k,
891
- fadeContent: v,
892
- fadeContentTransitionMs: x,
893
- swipeToOpen: E,
894
- swipeToClose: M,
895
- midAnchorPoint: q,
896
- midAnchorPointPx: D,
897
- disabled: V,
898
- closeSidebarOnOverlayClick: U,
899
- resetMetaOnClose: H
900
- } = t, N = Ke(() => {
901
- const Z = l ?? i.sidebarHeightPx;
1018
+ fadeContent: W,
1019
+ fadeContentTransitionMs: X,
1020
+ swipeToOpen: V,
1021
+ swipeToClose: j,
1022
+ midAnchorPoint: Q,
1023
+ midAnchorPointPx: G,
1024
+ disabled: b,
1025
+ closeSidebarOnOverlayClick: M,
1026
+ resetMetaOnClose: P
1027
+ } = t, F = Te(() => {
1028
+ const U = g ?? n.sidebarHeightPx;
902
1029
  return {
903
- sidebarWidthPx: f ?? i.sidebarWidthPx,
904
- sidebarHeightPx: Z,
905
- transitionMs: s ?? i.transitionMs,
906
- edgeActivationWidthPx: w ?? i.edgeActivationWidthPx,
907
- dragActivationDeltaPx: y ?? i.dragActivationDeltaPx,
908
- showOverlay: h ?? i.showOverlay,
909
- isAbsolute: S ?? i.isAbsolute,
910
- overlayBackgroundColor: C ?? i.overlayBackgroundColor,
911
- toggleIconColor: p ?? i.toggleIconColor,
912
- toggleIconSizePx: P ?? i.toggleIconSizePx,
913
- toggleIconEdgeDistancePx: L ?? i.toggleIconEdgeDistancePx,
914
- showToggle: I ?? i.showToggle,
915
- mediaQueryWidth: $ ?? i.mediaQueryWidth,
916
- swipeBarZIndex: j ?? i.swipeBarZIndex,
917
- toggleZIndex: B ?? i.toggleZIndex,
918
- overlayZIndex: k ?? i.overlayZIndex,
919
- fadeContent: v ?? i.fadeContent,
920
- fadeContentTransitionMs: x ?? i.fadeContentTransitionMs,
921
- swipeToOpen: E ?? i.swipeToOpen,
922
- swipeToClose: M ?? i.swipeToClose,
923
- midAnchorPoint: q ?? i.midAnchorPoint,
924
- midAnchorPointPx: D ?? i.midAnchorPointPx ?? Math.floor(Z / 3),
925
- disabled: V ?? i.disabled,
926
- closeSidebarOnOverlayClick: U ?? i.closeSidebarOnOverlayClick,
927
- resetMetaOnClose: H ?? i.resetMetaOnClose
1030
+ sidebarWidthPx: h ?? n.sidebarWidthPx,
1031
+ sidebarHeightPx: U,
1032
+ transitionMs: p ?? n.transitionMs,
1033
+ edgeActivationWidthPx: S ?? n.edgeActivationWidthPx,
1034
+ dragActivationDeltaPx: R ?? n.dragActivationDeltaPx,
1035
+ showOverlay: m ?? n.showOverlay,
1036
+ isAbsolute: T ?? n.isAbsolute,
1037
+ overlayBackgroundColor: C ?? n.overlayBackgroundColor,
1038
+ toggleIconColor: u ?? n.toggleIconColor,
1039
+ toggleIconSizePx: w ?? n.toggleIconSizePx,
1040
+ toggleIconEdgeDistancePx: x ?? n.toggleIconEdgeDistancePx,
1041
+ showToggle: _ ?? n.showToggle,
1042
+ mediaQueryWidth: B ?? n.mediaQueryWidth,
1043
+ swipeBarZIndex: Y ?? n.swipeBarZIndex,
1044
+ toggleZIndex: H ?? n.toggleZIndex,
1045
+ overlayZIndex: k ?? n.overlayZIndex,
1046
+ fadeContent: W ?? n.fadeContent,
1047
+ fadeContentTransitionMs: X ?? n.fadeContentTransitionMs,
1048
+ swipeToOpen: V ?? n.swipeToOpen,
1049
+ swipeToClose: j ?? n.swipeToClose,
1050
+ midAnchorPoint: Q ?? n.midAnchorPoint,
1051
+ midAnchorPointPx: G ?? n.midAnchorPointPx ?? Math.floor(U / 3),
1052
+ disabled: b ?? n.disabled,
1053
+ closeSidebarOnOverlayClick: M ?? n.closeSidebarOnOverlayClick,
1054
+ resetMetaOnClose: P ?? n.resetMetaOnClose
928
1055
  };
929
1056
  }, [
930
- f,
931
- l,
932
- s,
933
- w,
934
- y,
935
1057
  h,
1058
+ g,
1059
+ p,
936
1060
  S,
1061
+ R,
1062
+ m,
1063
+ T,
937
1064
  C,
938
- p,
939
- P,
940
- L,
941
- I,
942
- i,
943
- $,
944
- j,
1065
+ u,
1066
+ w,
1067
+ x,
1068
+ _,
1069
+ n,
945
1070
  B,
1071
+ Y,
1072
+ H,
946
1073
  k,
947
- v,
948
- x,
949
- E,
950
- M,
951
- q,
952
- D,
1074
+ W,
1075
+ X,
953
1076
  V,
954
- U,
955
- H
1077
+ j,
1078
+ Q,
1079
+ G,
1080
+ b,
1081
+ M,
1082
+ P
956
1083
  ]);
957
- return G(() => {
958
- e === "left" ? c(N) : e === "right" ? o(N) : e === "bottom" ? u(r ?? "primary", N) : Oe(e);
1084
+ return q(() => {
1085
+ e === "left" ? l(r ?? "primary", F) : e === "right" ? c(r ?? "primary", F) : e === "bottom" ? d(r ?? "primary", F) : Ce(e);
959
1086
  }, [
960
1087
  e,
961
1088
  r,
962
- N,
1089
+ F,
1090
+ l,
963
1091
  c,
964
- o,
965
- u
966
- ]), N;
1092
+ d
1093
+ ]), F;
967
1094
  };
968
- function Ce({
1095
+ function Ye({
969
1096
  isCollapsed: e,
970
1097
  setCollapsed: t,
971
1098
  closeSidebarOnClick: r = !0,
972
- transitionMs: i,
973
- overlayBackgroundColor: c,
974
- overlayZIndex: o
1099
+ transitionMs: n,
1100
+ overlayBackgroundColor: l,
1101
+ overlayZIndex: c
975
1102
  }) {
976
- return /* @__PURE__ */ O.jsx(
1103
+ return /* @__PURE__ */ I.jsx(
977
1104
  "div",
978
1105
  {
979
1106
  "aria-hidden": "true",
980
1107
  style: {
981
- transitionDuration: `${i}ms`,
982
- ...tr,
983
- ...e ? {} : rr,
984
- ...c ? { backgroundColor: c } : {},
985
- zIndex: o
1108
+ transitionDuration: `${n}ms`,
1109
+ ...kr,
1110
+ ...e ? {} : Wr,
1111
+ ...l ? { backgroundColor: l } : {},
1112
+ zIndex: c
986
1113
  },
987
- onMouseDown: (u) => {
988
- r && (u.stopPropagation(), t());
1114
+ onMouseDown: (d) => {
1115
+ r && (d.stopPropagation(), t());
989
1116
  }
990
1117
  }
991
1118
  );
992
1119
  }
993
- function Ie({ size: e, color: t }) {
994
- const r = _(null);
995
- return G(() => {
996
- const i = () => {
1120
+ function Xe({ size: e, color: t }) {
1121
+ const r = L(null);
1122
+ return q(() => {
1123
+ const n = () => {
997
1124
  r.current && (r.current.style.opacity = "1");
998
- }, c = () => {
999
- r.current && (r.current.style.opacity = `${ke}`);
1125
+ }, l = () => {
1126
+ r.current && (r.current.style.opacity = `${et}`);
1000
1127
  };
1001
- r.current && (r.current.addEventListener("mouseenter", i), r.current.addEventListener("mouseleave", c));
1002
- }, []), /* @__PURE__ */ O.jsx(
1128
+ r.current && (r.current.addEventListener("mouseenter", n), r.current.addEventListener("mouseleave", l));
1129
+ }, []), /* @__PURE__ */ I.jsx(
1003
1130
  "div",
1004
1131
  {
1005
1132
  style: {
1006
- ...ir
1133
+ ...Fr
1007
1134
  },
1008
- children: /* @__PURE__ */ O.jsxs(
1135
+ children: /* @__PURE__ */ I.jsxs(
1009
1136
  "svg",
1010
1137
  {
1011
1138
  style: {
1012
- transition: `opacity ${Ft}ms ease`,
1013
- opacity: `${ke}`
1139
+ transition: `opacity ${Er}ms ease`,
1140
+ opacity: `${et}`
1014
1141
  },
1015
1142
  ref: r,
1016
1143
  "aria-hidden": "true",
@@ -1019,8 +1146,8 @@ function Ie({ size: e, color: t }) {
1019
1146
  xmlns: "http://www.w3.org/2000/svg",
1020
1147
  width: e,
1021
1148
  children: [
1022
- /* @__PURE__ */ O.jsx("g", { strokeWidth: "0" }),
1023
- /* @__PURE__ */ O.jsx("g", { strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ O.jsx("g", { children: /* @__PURE__ */ O.jsx(
1149
+ /* @__PURE__ */ I.jsx("g", { strokeWidth: "0" }),
1150
+ /* @__PURE__ */ I.jsx("g", { strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ I.jsx("g", { children: /* @__PURE__ */ I.jsx(
1024
1151
  "path",
1025
1152
  {
1026
1153
  clipRule: "evenodd",
@@ -1035,426 +1162,446 @@ function Ie({ size: e, color: t }) {
1035
1162
  }
1036
1163
  );
1037
1164
  }
1038
- function sr({
1165
+ function Ur({
1039
1166
  id: e,
1040
1167
  toggleRef: t,
1041
1168
  options: r,
1042
- showToggle: i = !0,
1043
- ToggleComponent: c
1169
+ showToggle: n = !0,
1170
+ ToggleComponent: l
1044
1171
  }) {
1045
- var s;
1046
- const { openSidebar: o, closeSidebar: u, bottomSidebars: f } = ee(), l = ((s = f[e]) == null ? void 0 : s.isOpen) ?? !1;
1047
- return i ? /* @__PURE__ */ O.jsx(
1172
+ const { openSidebar: c, closeSidebar: d, bottomSidebars: h } = J(), g = h[e]?.isOpen ?? !1;
1173
+ return n ? /* @__PURE__ */ I.jsx(
1048
1174
  "div",
1049
1175
  {
1050
1176
  ref: t,
1051
1177
  style: {
1052
- ...nr,
1178
+ ...jr,
1053
1179
  transition: `transform ${r.transitionMs}ms ease, opacity ${r.transitionMs}ms ease`,
1054
1180
  zIndex: r.toggleZIndex
1055
1181
  },
1056
- children: (!l || l && !r.showOverlay) && /* @__PURE__ */ O.jsx(
1182
+ children: (!g || g && !r.showOverlay) && /* @__PURE__ */ I.jsx(
1057
1183
  "button",
1058
1184
  {
1059
1185
  type: "button",
1060
- "aria-expanded": l,
1186
+ "aria-expanded": g,
1061
1187
  "aria-controls": `swipebar-bottom-${e}`,
1062
- "aria-label": l ? "Close bottom sidebar" : "Open bottom sidebar",
1188
+ "aria-label": g ? "Close bottom sidebar" : "Open bottom sidebar",
1063
1189
  onClick: () => {
1064
- r.disabled || (l ? u("bottom", { id: e }) : o("bottom", { id: e }));
1190
+ r.disabled || (g ? d("bottom", { id: e }) : c("bottom", { id: e }));
1065
1191
  },
1066
1192
  disabled: r.disabled,
1067
1193
  style: {
1068
1194
  marginBottom: `${r.toggleIconEdgeDistancePx}px`,
1069
1195
  // Rotate icon: -90deg points up when closed, 90deg points down when open
1070
- transform: l ? "rotate(90deg)" : "rotate(-90deg)"
1196
+ transform: g ? "rotate(90deg)" : "rotate(-90deg)"
1071
1197
  },
1072
- children: c ?? /* @__PURE__ */ O.jsx(Ie, { size: r.toggleIconSizePx, color: r.toggleIconColor })
1198
+ children: l ?? /* @__PURE__ */ I.jsx(Xe, { size: r.toggleIconSizePx, color: r.toggleIconColor })
1073
1199
  }
1074
1200
  )
1075
1201
  }
1076
1202
  ) : null;
1077
1203
  }
1078
- const cr = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
1079
- function lr(e) {
1080
- return Array.from(e.querySelectorAll(cr)).filter(
1204
+ function $e({ defaultOpen: e, optionsReady: t, onOpen: r }) {
1205
+ const n = L(!1);
1206
+ return cr(() => {
1207
+ e && (document.body.style.overflow = "hidden");
1208
+ }, [e]), q(() => {
1209
+ e && !n.current && t && (n.current = !0, r());
1210
+ }, [e, r, t]), { forceOverlayVisible: !!e && !n.current };
1211
+ }
1212
+ const Zr = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])', at = { preventScroll: !0, focusVisible: !1 };
1213
+ function ct(e) {
1214
+ return Array.from(e.querySelectorAll(Zr)).filter(
1081
1215
  (t) => !t.closest("[inert]")
1082
1216
  );
1083
1217
  }
1084
- function _e({
1218
+ function Be({
1085
1219
  sidebarRef: e,
1086
1220
  triggerRef: t,
1087
1221
  isOpen: r,
1088
- onClose: i,
1089
- transitionMs: c
1222
+ onClose: n,
1223
+ transitionMs: l
1090
1224
  }) {
1091
- const o = _(null);
1092
- G(() => {
1093
- var f;
1225
+ const c = L(null);
1226
+ q(() => {
1094
1227
  if (r) {
1095
- o.current = document.activeElement;
1096
- const l = setTimeout(() => {
1097
- e.current && (e.current.setAttribute("tabindex", "-1"), e.current.focus());
1098
- }, c);
1099
- return () => clearTimeout(l);
1228
+ c.current = document.activeElement;
1229
+ const h = setTimeout(() => {
1230
+ if (!e.current) return;
1231
+ const g = at, p = ct(e.current);
1232
+ p.length > 0 ? p[0].focus(g) : (e.current.setAttribute("tabindex", "-1"), e.current.focus(g));
1233
+ }, l);
1234
+ return () => clearTimeout(h);
1100
1235
  }
1101
- const u = o.current;
1102
- if (u) {
1103
- const l = ((f = t.current) == null ? void 0 : f.querySelector("button")) ?? u;
1236
+ const d = c.current;
1237
+ if (d) {
1238
+ const h = t.current?.querySelector("button") ?? d;
1104
1239
  requestAnimationFrame(() => {
1105
- l.focus();
1106
- }), o.current = null;
1240
+ h.focus(at);
1241
+ }), c.current = null;
1107
1242
  }
1108
- }, [r, e, t, c]), G(() => {
1243
+ }, [r, e, t, l]), q(() => {
1109
1244
  if (!r) return;
1110
- function u(f) {
1111
- if (f.key === "Escape") {
1245
+ function d(h) {
1246
+ if (h.key === "Escape") {
1112
1247
  if (!e.current) return;
1113
- e.current.contains(document.activeElement) && (f.preventDefault(), i());
1248
+ e.current.contains(document.activeElement) && (h.preventDefault(), n());
1114
1249
  return;
1115
1250
  }
1116
- if (f.key !== "Tab" || !e.current) return;
1117
- const l = lr(e.current);
1118
- if (l.length === 0) return;
1119
- const s = l[0], w = l[l.length - 1];
1120
- f.shiftKey ? document.activeElement === s && (f.preventDefault(), w.focus()) : document.activeElement === w && (f.preventDefault(), s.focus());
1251
+ if (h.key !== "Tab" || !e.current) return;
1252
+ const g = ct(e.current);
1253
+ if (g.length === 0) return;
1254
+ const p = g[0], S = g[g.length - 1];
1255
+ h.shiftKey ? document.activeElement === p && (h.preventDefault(), S.focus()) : document.activeElement === S && (h.preventDefault(), p.focus());
1121
1256
  }
1122
- return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
1123
- }, [r, e, i]);
1257
+ return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
1258
+ }, [r, e, n]);
1124
1259
  }
1125
- function fe(e = Te) {
1126
- const t = `(max-width: ${Math.min(e, Te)}px)`, r = () => typeof window > "u" || typeof window.matchMedia > "u" ? !1 : window.matchMedia(t).matches, [i, c] = Q(r);
1127
- return G(() => {
1260
+ function he(e = Me) {
1261
+ const t = `(max-width: ${Math.min(e, Me)}px)`, r = () => typeof window > "u" || typeof window.matchMedia > "u" ? !1 : window.matchMedia(t).matches, [n, l] = te(r);
1262
+ return q(() => {
1128
1263
  if (typeof window > "u" || typeof window.matchMedia > "u")
1129
1264
  return;
1130
- const o = window.matchMedia(t), u = () => c(o.matches);
1131
- return u(), o.addEventListener("change", u), () => o.removeEventListener("change", u);
1132
- }, [t]), i;
1265
+ const c = window.matchMedia(t), d = () => l(c.matches);
1266
+ return d(), c.addEventListener("change", d), () => c.removeEventListener("change", d);
1267
+ }, [t]), n;
1133
1268
  }
1134
- const Ze = ({
1269
+ const lt = ({
1135
1270
  refs: e,
1136
1271
  callbacks: t,
1137
1272
  currentY: r,
1138
- preventDefault: i,
1139
- lockPane: c,
1140
- options: o,
1141
- scrollableAncestor: u,
1142
- initialScrollTop: f
1273
+ preventDefault: n,
1274
+ lockPane: l,
1275
+ options: c,
1276
+ scrollableAncestor: d,
1277
+ initialScrollTop: h
1143
1278
  }) => {
1144
1279
  if (!e.draggingRef.current) return;
1145
- const l = r - e.draggingRef.current.startY;
1146
- if (!e.draggingRef.current.isActivated && Math.abs(l) >= o.dragActivationDeltaPx) {
1147
- if (u && t.getIsOpen()) {
1148
- if (u.scrollTop !== f) {
1280
+ const g = r - e.draggingRef.current.startY;
1281
+ if (!e.draggingRef.current.isActivated && Math.abs(g) >= c.dragActivationDeltaPx) {
1282
+ if (d && t.getIsOpen()) {
1283
+ if (d.scrollTop !== h) {
1149
1284
  e.draggingRef.current = null, t.dragSidebar(null);
1150
1285
  return;
1151
1286
  }
1152
- const { scrollTop: p, scrollHeight: P, clientHeight: L } = u, I = p > 1, $ = p + L < P - 1;
1153
- if (l > 0 && I || l < 0 && $) {
1287
+ const { scrollTop: u, scrollHeight: w, clientHeight: x } = d, _ = u > 1, B = u + x < w - 1;
1288
+ if (g > 0 && _ || g < 0 && B) {
1154
1289
  e.draggingRef.current = null, t.dragSidebar(null);
1155
1290
  return;
1156
1291
  }
1157
1292
  }
1158
- e.draggingRef.current.isActivated = !0, c();
1293
+ e.draggingRef.current.isActivated = !0, l();
1159
1294
  }
1160
1295
  if (!e.draggingRef.current.isActivated) return;
1161
1296
  e.prevYRef.current = e.currentYRef.current, e.currentYRef.current = r;
1162
- const s = t.getIsOpen(), w = window.innerHeight;
1163
- let y = !1;
1164
- if ((s || e.draggingRef.current.startY >= w - o.edgeActivationWidthPx) && (y = !0), !y) {
1297
+ const p = t.getIsOpen(), S = window.innerHeight;
1298
+ let R = !1;
1299
+ if ((p || e.draggingRef.current.startY >= S - c.edgeActivationWidthPx) && (R = !0), !R) {
1165
1300
  e.draggingRef.current = null, t.dragSidebar(null);
1166
1301
  return;
1167
1302
  }
1168
- i();
1169
- const h = o.sidebarHeightPx, S = o.midAnchorPointPx, C = o.midAnchorPoint && !o.swipeToOpen && S < h;
1170
- if (s)
1303
+ n();
1304
+ const m = c.sidebarHeightPx, T = c.midAnchorPointPx, C = c.midAnchorPoint && !c.swipeToOpen && T < m;
1305
+ if (p)
1171
1306
  if (C) {
1172
- const p = t.getBottomAnchorState();
1173
- if (p === "open") {
1174
- const P = Math.max(
1307
+ const u = t.getBottomAnchorState();
1308
+ if (u === "open") {
1309
+ const w = Math.max(
1175
1310
  0,
1176
- Math.min(h, l - o.dragActivationDeltaPx)
1311
+ Math.min(m, g - c.dragActivationDeltaPx)
1177
1312
  );
1178
- t.dragSidebar(P);
1179
- } else if (p === "midAnchor") {
1180
- const P = h - S, L = Math.max(
1313
+ t.dragSidebar(w);
1314
+ } else if (u === "midAnchor") {
1315
+ const w = m - T, x = Math.max(
1181
1316
  0,
1182
1317
  Math.min(
1183
- h,
1184
- P + l - o.dragActivationDeltaPx
1318
+ m,
1319
+ w + g - c.dragActivationDeltaPx
1185
1320
  )
1186
1321
  );
1187
- t.dragSidebar(L);
1322
+ t.dragSidebar(x);
1188
1323
  }
1189
1324
  } else {
1190
- const p = Math.max(
1325
+ const u = Math.max(
1191
1326
  0,
1192
- Math.min(h, l - o.dragActivationDeltaPx)
1327
+ Math.min(m, g - c.dragActivationDeltaPx)
1193
1328
  );
1194
- t.dragSidebar(p);
1329
+ t.dragSidebar(u);
1195
1330
  }
1196
- else if (e.draggingRef.current.startY >= w - o.edgeActivationWidthPx)
1331
+ else if (e.draggingRef.current.startY >= S - c.edgeActivationWidthPx)
1197
1332
  if (C) {
1198
- const p = h - S, P = Math.max(
1199
- p,
1333
+ const u = m - T, w = Math.max(
1334
+ u,
1200
1335
  Math.min(
1201
- h,
1202
- h + l + o.dragActivationDeltaPx
1336
+ m,
1337
+ m + g + c.dragActivationDeltaPx
1203
1338
  )
1204
1339
  );
1205
- t.dragSidebar(P);
1340
+ t.dragSidebar(w);
1206
1341
  } else {
1207
- const p = Math.max(
1342
+ const u = Math.max(
1208
1343
  0,
1209
1344
  Math.min(
1210
- h,
1211
- h + l + o.dragActivationDeltaPx
1345
+ m,
1346
+ m + g + c.dragActivationDeltaPx
1212
1347
  )
1213
1348
  );
1214
- t.dragSidebar(p);
1349
+ t.dragSidebar(u);
1215
1350
  }
1216
- }, ze = ({
1351
+ }, ut = ({
1217
1352
  refs: e,
1218
1353
  callbacks: t,
1219
1354
  options: r,
1220
- onDragEnd: i
1355
+ onDragEnd: n
1221
1356
  }) => {
1222
1357
  if (!e.draggingRef.current) return;
1223
1358
  if (!e.draggingRef.current.isActivated) {
1224
1359
  e.draggingRef.current = null, e.currentYRef.current = null, e.prevYRef.current = null;
1225
1360
  return;
1226
1361
  }
1227
- const c = e.currentYRef.current ?? e.draggingRef.current.startY, o = e.prevYRef.current ?? e.draggingRef.current.startY, u = e.draggingRef.current.startY, f = t.getIsOpen(), l = window.innerHeight;
1228
- e.draggingRef.current = null, e.currentYRef.current = null, e.prevYRef.current = null, i();
1229
- const s = c < o, w = c >= o, y = u >= l - r.edgeActivationWidthPx, h = r.midAnchorPointPx, S = r.sidebarHeightPx, C = r.midAnchorPoint && !r.swipeToOpen && h < S;
1230
- if (f)
1362
+ const l = e.currentYRef.current ?? e.draggingRef.current.startY, c = e.prevYRef.current ?? e.draggingRef.current.startY, d = e.draggingRef.current.startY, h = t.getIsOpen(), g = window.innerHeight;
1363
+ e.draggingRef.current = null, e.currentYRef.current = null, e.prevYRef.current = null, n();
1364
+ const p = l < c, S = l >= c, R = d >= g - r.edgeActivationWidthPx, m = r.midAnchorPointPx, T = r.sidebarHeightPx, C = r.midAnchorPoint && !r.swipeToOpen && m < T;
1365
+ if (h)
1231
1366
  if (C) {
1232
- const p = t.getBottomAnchorState(), P = S - h;
1233
- if (p === "open") {
1234
- const L = Math.max(0, c - u);
1235
- w ? L > P ? t.closeSidebar() : t.openToMidAnchor() : L < P ? t.openSidebarFully() : t.closeSidebar(), t.dragSidebar(null);
1236
- } else if (p === "midAnchor") {
1237
- const L = S - h, I = Math.max(
1367
+ const u = t.getBottomAnchorState(), w = T - m;
1368
+ if (u === "open") {
1369
+ const x = Math.max(0, l - d);
1370
+ S ? x > w ? t.closeSidebar() : t.openToMidAnchor() : x < w ? t.openSidebarFully() : t.closeSidebar(), t.dragSidebar(null);
1371
+ } else if (u === "midAnchor") {
1372
+ const x = T - m, _ = Math.max(
1238
1373
  0,
1239
- Math.min(S, L + (c - u))
1374
+ Math.min(T, x + (l - d))
1240
1375
  );
1241
- s ? I < P ? t.openSidebarFully() : t.openToMidAnchor() : t.closeSidebar(), t.dragSidebar(null);
1376
+ p ? _ < w ? t.openSidebarFully() : t.openToMidAnchor() : t.closeSidebar(), t.dragSidebar(null);
1242
1377
  }
1243
1378
  } else
1244
- w ? t.closeSidebar() : t.openSidebar(), t.dragSidebar(null);
1245
- else y && s ? (C ? t.openToMidAnchor() : t.openSidebar(), t.dragSidebar(null)) : (t.closeSidebar(), t.dragSidebar(null));
1379
+ S ? t.closeSidebar() : t.openSidebar(), t.dragSidebar(null);
1380
+ else R && p ? (C ? t.openToMidAnchor() : t.openSidebar(), t.dragSidebar(null)) : (t.closeSidebar(), t.dragSidebar(null));
1246
1381
  };
1247
- function ur(e, t) {
1248
- var k, v;
1249
- const r = fe(e.mediaQueryWidth), {
1250
- lockedSidebar: i,
1251
- setLockedSidebar: c,
1252
- bottomSidebars: o,
1253
- openSidebar: u,
1254
- openSidebarFully: f,
1255
- closeSidebar: l,
1256
- dragSidebar: s,
1257
- openSidebarToMidAnchor: w,
1258
- activeBottomDragIdRef: y,
1259
- bottomFocusStackRef: h
1260
- } = ee(), S = ((k = o[t]) == null ? void 0 : k.isOpen) ?? !1, C = ((v = o[t]) == null ? void 0 : v.anchorState) ?? "closed", p = _(null), P = _(null), L = _(null), I = _(null), $ = _(0), j = _(null), B = _(C);
1261
- G(() => {
1262
- B.current = C;
1263
- }, [C]), G(() => {
1264
- if (!r || i && i !== "bottom" || e.disabled) return;
1265
- const x = {
1266
- getIsOpen: () => S,
1267
- openSidebar: () => u("bottom", { id: t }),
1268
- openSidebarFully: () => f("bottom", { id: t }),
1269
- closeSidebar: () => l("bottom", { id: t }),
1270
- dragSidebar: (n) => s("bottom", n, { id: t }),
1271
- getBottomAnchorState: () => B.current,
1272
- openToMidAnchor: () => w("bottom", { id: t })
1273
- }, E = {
1274
- draggingRef: p,
1275
- currentYRef: P,
1276
- prevYRef: L
1277
- }, M = () => y.current !== null && y.current !== t, q = () => {
1278
- const n = h.current;
1279
- return n.length === 0 ? !0 : n[n.length - 1] === t;
1280
- }, D = () => {
1281
- if (M()) {
1282
- p.current = null;
1382
+ function zr(e, t) {
1383
+ const r = he(e.mediaQueryWidth), {
1384
+ lockedSidebar: n,
1385
+ setLockedSidebar: l,
1386
+ bottomSidebars: c,
1387
+ openSidebar: d,
1388
+ openSidebarFully: h,
1389
+ closeSidebar: g,
1390
+ dragSidebar: p,
1391
+ openSidebarToMidAnchor: S,
1392
+ activeBottomDragIdRef: R,
1393
+ bottomFocusStackRef: m
1394
+ } = J(), T = c[t]?.isOpen ?? !1, C = c[t]?.anchorState ?? "closed", u = L(null), w = L(null), x = L(null), _ = L(null), B = L(0), Y = L(null), H = L(C);
1395
+ q(() => {
1396
+ H.current = C;
1397
+ }, [C]), q(() => {
1398
+ if (!r || n && n !== "bottom" || e.disabled) return;
1399
+ const k = {
1400
+ getIsOpen: () => T,
1401
+ openSidebar: () => d("bottom", { id: t }),
1402
+ openSidebarFully: () => h("bottom", { id: t }),
1403
+ closeSidebar: () => g("bottom", { id: t }),
1404
+ dragSidebar: (A) => p("bottom", A, { id: t }),
1405
+ getBottomAnchorState: () => H.current,
1406
+ openToMidAnchor: () => S("bottom", { id: t })
1407
+ }, W = {
1408
+ draggingRef: u,
1409
+ currentYRef: w,
1410
+ prevYRef: x
1411
+ }, X = () => R.current !== null && R.current !== t, V = () => {
1412
+ const A = m.current;
1413
+ return A.length === 0 ? !0 : A[A.length - 1] === t;
1414
+ }, j = () => {
1415
+ if (X()) {
1416
+ u.current = null;
1283
1417
  return;
1284
1418
  }
1285
- y.current = t, c("bottom");
1286
- const n = I.current;
1287
- n && (j.current = n.style.overflowY, n.style.overflowY = "hidden");
1288
- }, V = () => {
1289
- y.current === t && (y.current = null);
1290
- const n = I.current;
1291
- n && j.current !== null && (n.style.overflowY = j.current, j.current = null);
1419
+ R.current = t, l("bottom");
1420
+ const A = _.current;
1421
+ A && (Y.current = A.style.overflowY, A.style.overflowY = "hidden");
1422
+ }, Q = () => {
1423
+ R.current === t && (R.current = null);
1424
+ const A = _.current;
1425
+ A && Y.current !== null && (A.style.overflowY = Y.current, Y.current = null);
1292
1426
  };
1293
- function U(n) {
1294
- var F;
1295
- if (i && i !== "bottom" || M() || !q() || de(n.target) || n.changedTouches.length === 0) return;
1296
- const m = n.changedTouches[0], T = window.innerHeight, R = x.getIsOpen(), z = m.clientY >= T - e.edgeActivationWidthPx;
1297
- R && !e.swipeToClose || !R && !e.swipeToOpen || (R || z) && (I.current = Ue(n.target), $.current = ((F = I.current) == null ? void 0 : F.scrollTop) ?? 0, Ge({
1298
- refs: E,
1299
- clientX: m.clientX,
1300
- clientY: m.clientY,
1301
- touchId: m.identifier,
1427
+ function G(A) {
1428
+ if (n && n !== "bottom" || X() || !V() || ge(A.target) || A.changedTouches.length === 0) return;
1429
+ const Z = A.changedTouches[0], a = window.innerHeight, y = k.getIsOpen(), $ = Z.clientY >= a - e.edgeActivationWidthPx;
1430
+ y && !e.swipeToClose || !y && !e.swipeToOpen || (y || $) && (_.current = st(A.target), B.current = _.current?.scrollTop ?? 0, ot({
1431
+ refs: W,
1432
+ clientX: Z.clientX,
1433
+ clientY: Z.clientY,
1434
+ touchId: Z.identifier,
1302
1435
  isMouse: !1
1303
1436
  }));
1304
1437
  }
1305
- function H(n) {
1306
- if (i && i !== "bottom") return;
1307
- if (M()) {
1308
- p.current = null;
1438
+ function b(A) {
1439
+ if (n && n !== "bottom") return;
1440
+ if (X()) {
1441
+ u.current = null;
1309
1442
  return;
1310
1443
  }
1311
- if (!p.current || p.current.isMouse) return;
1312
- const m = p.current.activeTouchId, T = Ae(n.changedTouches, m);
1313
- T && Ze({
1314
- refs: E,
1315
- callbacks: x,
1316
- currentY: T.clientY,
1317
- preventDefault: () => n.preventDefault(),
1318
- lockPane: D,
1444
+ if (!u.current || u.current.isMouse) return;
1445
+ const Z = u.current.activeTouchId, a = _e(A.changedTouches, Z);
1446
+ a && lt({
1447
+ refs: W,
1448
+ callbacks: k,
1449
+ currentY: a.clientY,
1450
+ preventDefault: () => A.preventDefault(),
1451
+ lockPane: j,
1319
1452
  options: e,
1320
- scrollableAncestor: I.current,
1321
- initialScrollTop: $.current
1453
+ scrollableAncestor: _.current,
1454
+ initialScrollTop: B.current
1322
1455
  });
1323
1456
  }
1324
- function N(n) {
1325
- if (i && i !== "bottom" || !p.current || p.current.isMouse) return;
1326
- const m = p.current.activeTouchId;
1327
- Pe(n.changedTouches, m) && ze({
1328
- refs: E,
1329
- callbacks: x,
1457
+ function M(A) {
1458
+ if (n && n !== "bottom" || !u.current || u.current.isMouse) return;
1459
+ const Z = u.current.activeTouchId;
1460
+ Le(A.changedTouches, Z) && ut({
1461
+ refs: W,
1462
+ callbacks: k,
1330
1463
  options: e,
1331
- onDragEnd: V
1464
+ onDragEnd: Q
1332
1465
  });
1333
1466
  }
1334
- function Z() {
1335
- i && i !== "bottom" || !p.current || p.current.isMouse || (V(), ar({
1336
- refs: E,
1337
- dragSidebar: x.dragSidebar,
1467
+ function P() {
1468
+ n && n !== "bottom" || !u.current || u.current.isMouse || (Q(), Gr({
1469
+ refs: W,
1470
+ dragSidebar: k.dragSidebar,
1338
1471
  onDeactivate: () => {
1339
1472
  }
1340
1473
  }));
1341
1474
  }
1342
- function oe(n) {
1343
- var z;
1344
- if (i && i !== "bottom" || M() || !q() || de(n.target) || n.button !== 0) return;
1345
- const m = window.innerHeight, T = x.getIsOpen(), R = n.clientY >= m - e.edgeActivationWidthPx;
1346
- T && !e.swipeToClose || !T && !e.swipeToOpen || (T || R) && (I.current = Ue(n.target), $.current = ((z = I.current) == null ? void 0 : z.scrollTop) ?? 0, Ge({
1347
- refs: E,
1348
- clientX: n.clientX,
1349
- clientY: n.clientY,
1475
+ function F(A) {
1476
+ if (n && n !== "bottom" || X() || !V() || ge(A.target) || A.button !== 0) return;
1477
+ const Z = window.innerHeight, a = k.getIsOpen(), y = A.clientY >= Z - e.edgeActivationWidthPx;
1478
+ a && !e.swipeToClose || !a && !e.swipeToOpen || (a || y) && (_.current = st(A.target), B.current = _.current?.scrollTop ?? 0, ot({
1479
+ refs: W,
1480
+ clientX: A.clientX,
1481
+ clientY: A.clientY,
1350
1482
  touchId: null,
1351
1483
  isMouse: !0
1352
1484
  }));
1353
1485
  }
1354
- function ne(n) {
1355
- if (!(i && i !== "bottom")) {
1356
- if (M()) {
1357
- p.current = null;
1486
+ function U(A) {
1487
+ if (!(n && n !== "bottom")) {
1488
+ if (X()) {
1489
+ u.current = null;
1358
1490
  return;
1359
1491
  }
1360
- !p.current || !p.current.isMouse || Ze({
1361
- refs: E,
1362
- callbacks: x,
1363
- currentY: n.clientY,
1364
- preventDefault: () => n.preventDefault(),
1365
- lockPane: D,
1492
+ !u.current || !u.current.isMouse || lt({
1493
+ refs: W,
1494
+ callbacks: k,
1495
+ currentY: A.clientY,
1496
+ preventDefault: () => A.preventDefault(),
1497
+ lockPane: j,
1366
1498
  options: e,
1367
- scrollableAncestor: I.current,
1368
- initialScrollTop: $.current
1499
+ scrollableAncestor: _.current,
1500
+ initialScrollTop: B.current
1369
1501
  });
1370
1502
  }
1371
1503
  }
1372
- function ae() {
1373
- i && i !== "bottom" || !p.current || !p.current.isMouse || ze({
1374
- refs: E,
1375
- callbacks: x,
1504
+ function ie() {
1505
+ n && n !== "bottom" || !u.current || !u.current.isMouse || ut({
1506
+ refs: W,
1507
+ callbacks: k,
1376
1508
  options: e,
1377
- onDragEnd: V
1509
+ onDragEnd: Q
1378
1510
  });
1379
1511
  }
1380
- return window.addEventListener("touchstart", U, { passive: !0 }), window.addEventListener("touchmove", H, { passive: !1 }), window.addEventListener("touchend", N, { passive: !0 }), window.addEventListener("touchcancel", Z, { passive: !0 }), window.addEventListener("mousedown", oe, { passive: !0 }), window.addEventListener("mousemove", ne, { passive: !1 }), window.addEventListener("mouseup", ae, { passive: !0 }), () => {
1381
- window.removeEventListener("touchstart", U), window.removeEventListener("touchmove", H), window.removeEventListener("touchend", N), window.removeEventListener("touchcancel", Z), window.removeEventListener("mousedown", oe), window.removeEventListener("mousemove", ne), window.removeEventListener("mouseup", ae);
1512
+ return window.addEventListener("touchstart", G, { passive: !0 }), window.addEventListener("touchmove", b, { passive: !1 }), window.addEventListener("touchend", M, { passive: !0 }), window.addEventListener("touchcancel", P, { passive: !0 }), window.addEventListener("mousedown", F, { passive: !0 }), window.addEventListener("mousemove", U, { passive: !1 }), window.addEventListener("mouseup", ie, { passive: !0 }), () => {
1513
+ window.removeEventListener("touchstart", G), window.removeEventListener("touchmove", b), window.removeEventListener("touchend", M), window.removeEventListener("touchcancel", P), window.removeEventListener("mousedown", F), window.removeEventListener("mousemove", U), window.removeEventListener("mouseup", ie);
1382
1514
  };
1383
1515
  }, [
1384
1516
  t,
1385
1517
  r,
1386
- S,
1387
- u,
1388
- f,
1518
+ T,
1519
+ d,
1520
+ h,
1521
+ g,
1522
+ p,
1523
+ n,
1389
1524
  l,
1390
- s,
1391
- i,
1392
- c,
1393
1525
  e,
1394
- w,
1395
- y,
1396
- h
1526
+ S,
1527
+ R,
1528
+ m
1397
1529
  ]);
1398
1530
  }
1399
- function wr({
1531
+ function rn({
1400
1532
  id: e = "primary",
1401
1533
  className: t,
1402
1534
  children: r,
1403
- ToggleComponent: i,
1404
- ariaLabel: c,
1405
- ...o
1535
+ ToggleComponent: n,
1536
+ ariaLabel: l,
1537
+ defaultOpen: c,
1538
+ ...d
1406
1539
  }) {
1407
- var P;
1408
- if ((r == null ? void 0 : r.type) === O.Fragment)
1540
+ if (r?.type === I.Fragment)
1409
1541
  throw new Error("Fragments is not allowed in SwipeBarBottom");
1410
- const { bottomSidebars: u, closeSidebar: f, registerBottomSidebar: l, unregisterBottomSidebar: s } = ee(), w = _(null), y = _(null);
1411
- G(() => (l(e, { sidebarRef: w, toggleRef: y }), () => s(e)), [e, l, s]);
1412
- const h = Me("bottom", o, e), S = fe(h.mediaQueryWidth);
1413
- ur(h, e);
1414
- const C = ((P = u[e]) == null ? void 0 : P.isOpen) ?? !1, p = Y(() => f("bottom", { id: e }), [f, e]);
1415
- return _e({
1416
- sidebarRef: w,
1417
- triggerRef: y,
1418
- isOpen: C,
1419
- onClose: p,
1420
- transitionMs: h.transitionMs
1421
- }), /* @__PURE__ */ O.jsxs(O.Fragment, { children: [
1422
- h.showOverlay && /* @__PURE__ */ O.jsx(
1423
- Ce,
1542
+ const {
1543
+ bottomSidebars: h,
1544
+ bottomSidebarOptionsMap: g,
1545
+ closeSidebar: p,
1546
+ openSidebarFully: S,
1547
+ registerBottomSidebar: R,
1548
+ unregisterBottomSidebar: m
1549
+ } = J(), T = L(null), C = L(null);
1550
+ q(() => (R(e, { sidebarRef: T, toggleRef: C }), () => m(e)), [e, R, m]);
1551
+ const u = De("bottom", d, e), w = he(u.mediaQueryWidth);
1552
+ zr(u, e);
1553
+ const x = h[e]?.isOpen ?? !1, _ = E(
1554
+ () => S("bottom", { id: e, skipTransition: !0 }),
1555
+ [S, e]
1556
+ ), { forceOverlayVisible: B } = $e({
1557
+ defaultOpen: c,
1558
+ optionsReady: !!g[e],
1559
+ onOpen: _
1560
+ }), Y = E(() => p("bottom", { id: e }), [p, e]);
1561
+ return Be({
1562
+ sidebarRef: T,
1563
+ triggerRef: C,
1564
+ isOpen: x,
1565
+ onClose: Y,
1566
+ transitionMs: u.transitionMs
1567
+ }), /* @__PURE__ */ I.jsxs(I.Fragment, { children: [
1568
+ u.showOverlay && /* @__PURE__ */ I.jsx(
1569
+ Ye,
1424
1570
  {
1425
- isCollapsed: !C,
1426
- setCollapsed: () => f("bottom", { id: e }),
1427
- closeSidebarOnClick: h.closeSidebarOnOverlayClick,
1428
- transitionMs: h.transitionMs,
1429
- overlayBackgroundColor: h.overlayBackgroundColor,
1430
- overlayZIndex: h.overlayZIndex
1571
+ isCollapsed: !x && !B,
1572
+ setCollapsed: () => p("bottom", { id: e }),
1573
+ closeSidebarOnClick: u.closeSidebarOnOverlayClick,
1574
+ transitionMs: u.transitionMs,
1575
+ overlayBackgroundColor: u.overlayBackgroundColor,
1576
+ overlayZIndex: u.overlayZIndex
1431
1577
  }
1432
1578
  ),
1433
- /* @__PURE__ */ O.jsx(
1434
- sr,
1579
+ /* @__PURE__ */ I.jsx(
1580
+ Ur,
1435
1581
  {
1436
1582
  id: e,
1437
- toggleRef: y,
1438
- options: h,
1439
- showToggle: h.showToggle,
1440
- ToggleComponent: i
1583
+ toggleRef: C,
1584
+ options: u,
1585
+ showToggle: u.showToggle,
1586
+ ToggleComponent: n
1441
1587
  }
1442
1588
  ),
1443
- /* @__PURE__ */ O.jsx(
1589
+ /* @__PURE__ */ I.jsx(
1444
1590
  "div",
1445
1591
  {
1446
- ref: w,
1592
+ ref: T,
1447
1593
  id: `swipebar-bottom-${e}`,
1448
1594
  role: "dialog",
1449
- "aria-modal": C,
1450
- "aria-label": c ?? "Bottom sidebar",
1451
- inert: !C,
1595
+ "aria-modal": x,
1596
+ "aria-label": l ?? "Bottom sidebar",
1597
+ inert: !x,
1452
1598
  style: {
1453
- ...Jt,
1454
- ...Kt,
1455
- ...h.isAbsolute || S ? er : {},
1456
- ...t ? {} : { backgroundColor: Ee },
1457
- zIndex: h.swipeBarZIndex
1599
+ ...Xr,
1600
+ ...$r,
1601
+ ...u.isAbsolute || w ? Br : {},
1602
+ ...t ? {} : { backgroundColor: Ie },
1603
+ zIndex: u.swipeBarZIndex,
1604
+ ...c ? { transform: "translateY(0px)", height: `${u.sidebarHeightPx}px` } : {}
1458
1605
  },
1459
1606
  className: t,
1460
1607
  children: r
@@ -1462,507 +1609,615 @@ function wr({
1462
1609
  )
1463
1610
  ] });
1464
1611
  }
1465
- function dr({ options: e, showToggle: t = !0, ToggleComponent: r }) {
1466
- const { openSidebar: i, leftToggleRef: c, isLeftOpen: o, closeSidebar: u } = ee();
1467
- return t ? /* @__PURE__ */ O.jsx(
1612
+ function Vr({
1613
+ id: e,
1614
+ toggleRef: t,
1615
+ options: r,
1616
+ showToggle: n = !0,
1617
+ ToggleComponent: l
1618
+ }) {
1619
+ const { openSidebar: c, closeSidebar: d, leftSidebars: h } = J(), g = h[e]?.isOpen ?? !1;
1620
+ return n ? /* @__PURE__ */ I.jsx(
1468
1621
  "div",
1469
1622
  {
1470
- ref: c,
1623
+ ref: t,
1471
1624
  style: {
1472
- ...nt,
1473
- transition: `transform ${e.transitionMs}ms ease, opacity ${e.transitionMs}ms ease`,
1625
+ ...yt,
1626
+ transition: `transform ${r.transitionMs}ms ease, opacity ${r.transitionMs}ms ease`,
1474
1627
  left: 0,
1475
- zIndex: e.toggleZIndex
1628
+ zIndex: r.toggleZIndex
1476
1629
  },
1477
- children: (!o || o && !e.showOverlay) && /* @__PURE__ */ O.jsx(
1630
+ children: (!g || g && !r.showOverlay) && /* @__PURE__ */ I.jsx(
1478
1631
  "button",
1479
1632
  {
1480
1633
  type: "button",
1481
- "aria-expanded": o,
1482
- "aria-controls": "swipebar-left",
1483
- "aria-label": o ? "Close left sidebar" : "Open left sidebar",
1634
+ "aria-expanded": g,
1635
+ "aria-controls": `swipebar-left-${e}`,
1636
+ "aria-label": g ? "Close left sidebar" : "Open left sidebar",
1484
1637
  onClick: () => {
1485
- e.disabled || (o ? u("left") : i("left"));
1638
+ r.disabled || (g ? d("left", { id: e }) : c("left", { id: e }));
1486
1639
  },
1487
- disabled: e.disabled,
1640
+ disabled: r.disabled,
1488
1641
  style: {
1489
- marginLeft: `${e.toggleIconEdgeDistancePx}px`,
1490
- ...o ? { transform: "rotate(180deg)" } : {}
1642
+ marginLeft: `${r.toggleIconEdgeDistancePx}px`,
1643
+ ...g ? { transform: "rotate(180deg)" } : {}
1491
1644
  },
1492
- children: r ?? /* @__PURE__ */ O.jsx(Ie, { size: e.toggleIconSizePx, color: e.toggleIconColor })
1645
+ children: l ?? /* @__PURE__ */ I.jsx(Xe, { size: r.toggleIconSizePx, color: r.toggleIconColor })
1493
1646
  }
1494
1647
  )
1495
1648
  }
1496
1649
  ) : null;
1497
1650
  }
1498
- const qe = ({
1651
+ const dt = ({
1499
1652
  refs: e,
1500
1653
  callbacks: t,
1501
1654
  currentX: r,
1502
- preventDefault: i,
1503
- lockPane: c,
1504
- options: o
1655
+ preventDefault: n,
1656
+ lockPane: l,
1657
+ options: c
1505
1658
  }) => {
1506
1659
  if (!e.draggingRef.current) return;
1507
- const u = r - e.draggingRef.current.startX;
1508
- if (!e.draggingRef.current.isActivated && Math.abs(u) >= o.dragActivationDeltaPx && (e.draggingRef.current.isActivated = !0, c()), !e.draggingRef.current.isActivated) return;
1660
+ const d = r - e.draggingRef.current.startX;
1661
+ if (!e.draggingRef.current.isActivated && Math.abs(d) >= c.dragActivationDeltaPx && (e.draggingRef.current.isActivated = !0, l()), !e.draggingRef.current.isActivated) return;
1509
1662
  e.prevXRef.current = e.currentXRef.current, e.currentXRef.current = r;
1510
- const f = t.getIsOpen();
1511
- let l = !1;
1512
- if ((f || e.draggingRef.current.startX <= o.edgeActivationWidthPx) && (l = !0), !l) {
1663
+ const h = t.getIsOpen();
1664
+ let g = !1;
1665
+ if ((h || e.draggingRef.current.startX <= c.edgeActivationWidthPx) && (g = !0), !g) {
1513
1666
  e.draggingRef.current = null, t.dragSidebar(null);
1514
1667
  return;
1515
1668
  }
1516
- i();
1517
- const s = o.sidebarWidthPx;
1518
- if (f) {
1519
- const w = Math.min(
1669
+ n();
1670
+ const p = c.sidebarWidthPx;
1671
+ if (h) {
1672
+ const S = Math.min(
1520
1673
  0,
1521
- Math.max(-s, u + o.dragActivationDeltaPx)
1674
+ Math.max(-p, d + c.dragActivationDeltaPx)
1522
1675
  );
1523
- t.dragSidebar(w);
1524
- } else if (e.draggingRef.current.startX <= o.edgeActivationWidthPx) {
1525
- const w = Math.min(
1676
+ t.dragSidebar(S);
1677
+ } else if (e.draggingRef.current.startX <= c.edgeActivationWidthPx) {
1678
+ const S = Math.min(
1526
1679
  0,
1527
1680
  Math.max(
1528
- -s,
1529
- -s + u - o.dragActivationDeltaPx
1681
+ -p,
1682
+ -p + d - c.dragActivationDeltaPx
1530
1683
  )
1531
1684
  );
1532
- t.dragSidebar(w);
1685
+ t.dragSidebar(S);
1533
1686
  }
1534
- }, Ve = ({ refs: e, callbacks: t, options: r }) => {
1687
+ }, ft = ({ refs: e, callbacks: t, options: r }) => {
1535
1688
  if (!e.draggingRef.current) return;
1536
1689
  if (!e.draggingRef.current.isActivated) {
1537
1690
  e.draggingRef.current = null, e.currentXRef.current = null, e.prevXRef.current = null;
1538
1691
  return;
1539
1692
  }
1540
- const i = e.currentXRef.current ?? e.draggingRef.current.startX, c = e.prevXRef.current ?? e.draggingRef.current.startX, o = e.draggingRef.current.startX, u = t.getIsOpen();
1693
+ const n = e.currentXRef.current ?? e.draggingRef.current.startX, l = e.prevXRef.current ?? e.draggingRef.current.startX, c = e.draggingRef.current.startX, d = t.getIsOpen();
1541
1694
  e.draggingRef.current = null, e.currentXRef.current = null, e.prevXRef.current = null;
1542
- const f = i >= c, l = i < c, s = o <= r.edgeActivationWidthPx;
1543
- u ? (l ? t.closeSidebar() : t.openSidebar(), t.dragSidebar(null)) : s && f ? (t.openSidebar(), t.dragSidebar(null)) : (t.closeSidebar(), t.dragSidebar(null));
1695
+ const h = n >= l, g = n < l, p = c <= r.edgeActivationWidthPx;
1696
+ d ? (g ? t.closeSidebar() : t.openSidebar(), t.dragSidebar(null)) : p && h ? (t.openSidebar(), t.dragSidebar(null)) : (t.closeSidebar(), t.dragSidebar(null));
1544
1697
  };
1545
- function fr(e) {
1546
- const t = fe(e.mediaQueryWidth), {
1547
- lockedSidebar: r,
1548
- setLockedSidebar: i,
1549
- isLeftOpen: c,
1550
- openSidebar: o,
1551
- closeSidebar: u,
1552
- dragSidebar: f,
1553
- leftSidebarRef: l
1554
- } = ee(), s = _(null), w = _(null), y = _(null);
1555
- G(() => {
1556
- if (!t || r && r !== "left" || e.disabled) return;
1557
- const h = {
1558
- getIsOpen: () => c,
1559
- openSidebar: () => o("left"),
1560
- closeSidebar: () => u("left"),
1561
- dragSidebar: (v) => f("left", v)
1562
- }, S = {
1563
- draggingRef: s,
1564
- currentXRef: w,
1565
- prevXRef: y
1566
- }, C = () => i("left"), p = () => i(null);
1567
- function P(v) {
1568
- if (r && r !== "left" || de(v.target) || v.changedTouches.length === 0) return;
1569
- const x = v.changedTouches[0], E = h.getIsOpen(), M = x.clientX <= e.edgeActivationWidthPx;
1570
- E && !e.swipeToClose || !E && !e.swipeToOpen || (E || M) && pe({
1571
- refs: S,
1572
- clientX: x.clientX,
1573
- clientY: x.clientY,
1574
- touchId: x.identifier,
1698
+ function qr(e, t) {
1699
+ const r = he(e.mediaQueryWidth), {
1700
+ lockedSidebar: n,
1701
+ setLockedSidebar: l,
1702
+ leftSidebars: c,
1703
+ openSidebar: d,
1704
+ closeSidebar: h,
1705
+ dragSidebar: g,
1706
+ activeLeftDragIdRef: p,
1707
+ leftFocusStackRef: S
1708
+ } = J(), R = c[t]?.isOpen ?? !1, m = L(null), T = L(null), C = L(null);
1709
+ q(() => {
1710
+ if (!r || n && n !== "left" || e.disabled) return;
1711
+ const u = {
1712
+ getIsOpen: () => R,
1713
+ openSidebar: () => d("left", { id: t }),
1714
+ closeSidebar: () => h("left", { id: t }),
1715
+ dragSidebar: (b) => g("left", b, { id: t })
1716
+ }, w = {
1717
+ draggingRef: m,
1718
+ currentXRef: T,
1719
+ prevXRef: C
1720
+ }, x = () => p.current !== null && p.current !== t, _ = () => {
1721
+ const b = S.current;
1722
+ return b.length === 0 ? !0 : b[b.length - 1] === t;
1723
+ }, B = () => {
1724
+ if (x()) {
1725
+ m.current = null;
1726
+ return;
1727
+ }
1728
+ p.current = t, l("left");
1729
+ }, Y = () => {
1730
+ p.current === t && (p.current = null);
1731
+ }, H = () => {
1732
+ Y(), l(null);
1733
+ };
1734
+ function k(b) {
1735
+ if (n && n !== "left" || x() || !_() || ge(b.target) || b.changedTouches.length === 0) return;
1736
+ const M = b.changedTouches[0], P = u.getIsOpen(), F = M.clientX <= e.edgeActivationWidthPx;
1737
+ P && !e.swipeToClose || !P && !e.swipeToOpen || (P || F) && Ee({
1738
+ refs: w,
1739
+ clientX: M.clientX,
1740
+ clientY: M.clientY,
1741
+ touchId: M.identifier,
1575
1742
  isMouse: !1
1576
1743
  });
1577
1744
  }
1578
- function L(v) {
1579
- if (r && r !== "left" || !s.current || s.current.isMouse) return;
1580
- const x = s.current.activeTouchId, E = Ae(v.changedTouches, x);
1581
- E && qe({
1582
- refs: S,
1583
- callbacks: h,
1584
- currentX: E.clientX,
1585
- preventDefault: () => v.preventDefault(),
1586
- lockPane: C,
1745
+ function W(b) {
1746
+ if (n && n !== "left") return;
1747
+ if (x()) {
1748
+ m.current = null;
1749
+ return;
1750
+ }
1751
+ if (!m.current || m.current.isMouse) return;
1752
+ const M = m.current.activeTouchId, P = _e(b.changedTouches, M);
1753
+ P && dt({
1754
+ refs: w,
1755
+ callbacks: u,
1756
+ currentX: P.clientX,
1757
+ preventDefault: () => b.preventDefault(),
1758
+ lockPane: B,
1587
1759
  options: e
1588
1760
  });
1589
1761
  }
1590
- function I(v) {
1591
- if (r && r !== "left" || !s.current || s.current.isMouse) return;
1592
- const x = s.current.activeTouchId;
1593
- Pe(v.changedTouches, x) && Ve({
1594
- refs: S,
1595
- callbacks: h,
1762
+ function X(b) {
1763
+ if (n && n !== "left" || !m.current || m.current.isMouse) return;
1764
+ const M = m.current.activeTouchId;
1765
+ Le(b.changedTouches, M) && (Y(), ft({
1766
+ refs: w,
1767
+ callbacks: u,
1596
1768
  options: e
1597
- });
1769
+ }));
1598
1770
  }
1599
- function $() {
1600
- r && r !== "left" || !s.current || s.current.isMouse || it({
1601
- refs: S,
1602
- dragSidebar: h.dragSidebar,
1603
- onDeactivate: p
1604
- });
1771
+ function V() {
1772
+ n && n !== "left" || !m.current || m.current.isMouse || (Y(), xt({
1773
+ refs: w,
1774
+ dragSidebar: u.dragSidebar,
1775
+ onDeactivate: H
1776
+ }));
1605
1777
  }
1606
- function j(v) {
1607
- if (r && r !== "left" || de(v.target) || v.button !== 0) return;
1608
- const x = h.getIsOpen(), E = v.clientX <= e.edgeActivationWidthPx;
1609
- x && !e.swipeToClose || !x && !e.swipeToOpen || (x || E) && pe({
1610
- refs: S,
1611
- clientX: v.clientX,
1612
- clientY: v.clientY,
1778
+ function j(b) {
1779
+ if (n && n !== "left" || x() || !_() || ge(b.target) || b.button !== 0) return;
1780
+ const M = u.getIsOpen(), P = b.clientX <= e.edgeActivationWidthPx;
1781
+ M && !e.swipeToClose || !M && !e.swipeToOpen || (M || P) && Ee({
1782
+ refs: w,
1783
+ clientX: b.clientX,
1784
+ clientY: b.clientY,
1613
1785
  touchId: null,
1614
1786
  isMouse: !0
1615
1787
  });
1616
1788
  }
1617
- function B(v) {
1618
- r && r !== "left" || !s.current || !s.current.isMouse || qe({
1619
- refs: S,
1620
- callbacks: h,
1621
- currentX: v.clientX,
1622
- preventDefault: () => v.preventDefault(),
1623
- lockPane: C,
1624
- options: e
1625
- });
1789
+ function Q(b) {
1790
+ if (!(n && n !== "left")) {
1791
+ if (x()) {
1792
+ m.current = null;
1793
+ return;
1794
+ }
1795
+ !m.current || !m.current.isMouse || dt({
1796
+ refs: w,
1797
+ callbacks: u,
1798
+ currentX: b.clientX,
1799
+ preventDefault: () => b.preventDefault(),
1800
+ lockPane: B,
1801
+ options: e
1802
+ });
1803
+ }
1626
1804
  }
1627
- function k() {
1628
- r && r !== "left" || !s.current || !s.current.isMouse || Ve({
1629
- refs: S,
1630
- callbacks: h,
1805
+ function G() {
1806
+ n && n !== "left" || !m.current || !m.current.isMouse || (Y(), ft({
1807
+ refs: w,
1808
+ callbacks: u,
1631
1809
  options: e
1632
- });
1810
+ }));
1633
1811
  }
1634
- return window.addEventListener("touchstart", P, { passive: !0 }), window.addEventListener("touchmove", L, { passive: !1 }), window.addEventListener("touchend", I, { passive: !0 }), window.addEventListener("touchcancel", $, { passive: !0 }), window.addEventListener("mousedown", j, { passive: !0 }), window.addEventListener("mousemove", B, { passive: !1 }), window.addEventListener("mouseup", k, { passive: !0 }), () => {
1635
- window.removeEventListener("touchstart", P), window.removeEventListener("touchmove", L), window.removeEventListener("touchend", I), window.removeEventListener("touchcancel", $), window.removeEventListener("mousedown", j), window.removeEventListener("mousemove", B), window.removeEventListener("mouseup", k);
1812
+ return window.addEventListener("touchstart", k, { passive: !0 }), window.addEventListener("touchmove", W, { passive: !1 }), window.addEventListener("touchend", X, { passive: !0 }), window.addEventListener("touchcancel", V, { passive: !0 }), window.addEventListener("mousedown", j, { passive: !0 }), window.addEventListener("mousemove", Q, { passive: !1 }), window.addEventListener("mouseup", G, { passive: !0 }), () => {
1813
+ window.removeEventListener("touchstart", k), window.removeEventListener("touchmove", W), window.removeEventListener("touchend", X), window.removeEventListener("touchcancel", V), window.removeEventListener("mousedown", j), window.removeEventListener("mousemove", Q), window.removeEventListener("mouseup", G);
1636
1814
  };
1637
1815
  }, [
1638
1816
  t,
1639
- c,
1640
- o,
1641
- u,
1642
- f,
1643
1817
  r,
1644
- i,
1818
+ R,
1819
+ d,
1820
+ h,
1821
+ g,
1822
+ n,
1645
1823
  l,
1646
- e
1824
+ e,
1825
+ p,
1826
+ S
1647
1827
  ]);
1648
1828
  }
1649
- function pr({
1650
- className: e,
1651
- children: t,
1652
- ToggleComponent: r,
1653
- ariaLabel: i,
1654
- ...c
1829
+ function nn({
1830
+ id: e = "primary",
1831
+ className: t,
1832
+ children: r,
1833
+ ToggleComponent: n,
1834
+ ariaLabel: l,
1835
+ defaultOpen: c,
1836
+ ...d
1655
1837
  }) {
1656
- if ((t == null ? void 0 : t.type) === O.Fragment)
1838
+ if (r?.type === I.Fragment)
1657
1839
  throw new Error("Fragments is not allowed in SwipeBarLeft");
1658
- const { isLeftOpen: o, closeSidebar: u, leftSidebarRef: f, leftToggleRef: l } = ee(), s = Me("left", c), w = fe(s.mediaQueryWidth);
1659
- fr(s);
1660
- const y = Y(() => u("left"), [u]);
1661
- return _e({
1662
- sidebarRef: f,
1663
- triggerRef: l,
1664
- isOpen: o,
1665
- onClose: y,
1666
- transitionMs: s.transitionMs
1667
- }), /* @__PURE__ */ O.jsxs(O.Fragment, { children: [
1668
- s.showOverlay && /* @__PURE__ */ O.jsx(
1669
- Ce,
1840
+ const {
1841
+ leftSidebars: h,
1842
+ leftSidebarOptionsMap: g,
1843
+ closeSidebar: p,
1844
+ openSidebar: S,
1845
+ registerLeftSidebar: R,
1846
+ unregisterLeftSidebar: m
1847
+ } = J(), T = L(null), C = L(null);
1848
+ q(() => (R(e, { sidebarRef: T, toggleRef: C }), () => m(e)), [e, R, m]);
1849
+ const u = De("left", d, e), w = he(u.mediaQueryWidth);
1850
+ qr(u, e);
1851
+ const x = h[e]?.isOpen ?? !1, _ = E(
1852
+ () => S("left", { id: e, skipTransition: !0 }),
1853
+ [S, e]
1854
+ ), { forceOverlayVisible: B } = $e({
1855
+ defaultOpen: c,
1856
+ optionsReady: !!g[e],
1857
+ onOpen: _
1858
+ }), Y = E(() => p("left", { id: e }), [p, e]);
1859
+ return Be({
1860
+ sidebarRef: T,
1861
+ triggerRef: C,
1862
+ isOpen: x,
1863
+ onClose: Y,
1864
+ transitionMs: u.transitionMs
1865
+ }), /* @__PURE__ */ I.jsxs(I.Fragment, { children: [
1866
+ u.showOverlay && /* @__PURE__ */ I.jsx(
1867
+ Ye,
1670
1868
  {
1671
- isCollapsed: !o,
1672
- setCollapsed: () => u("left"),
1673
- closeSidebarOnClick: s.closeSidebarOnOverlayClick,
1674
- transitionMs: s.transitionMs,
1675
- overlayBackgroundColor: s.overlayBackgroundColor,
1676
- overlayZIndex: s.overlayZIndex
1869
+ isCollapsed: !x && !B,
1870
+ setCollapsed: () => p("left", { id: e }),
1871
+ closeSidebarOnClick: u.closeSidebarOnOverlayClick,
1872
+ transitionMs: u.transitionMs,
1873
+ overlayBackgroundColor: u.overlayBackgroundColor,
1874
+ overlayZIndex: u.overlayZIndex
1677
1875
  }
1678
1876
  ),
1679
- /* @__PURE__ */ O.jsx(
1680
- dr,
1877
+ /* @__PURE__ */ I.jsx(
1878
+ Vr,
1681
1879
  {
1682
- options: s,
1683
- showToggle: s.showToggle,
1684
- ToggleComponent: r
1880
+ id: e,
1881
+ toggleRef: C,
1882
+ options: u,
1883
+ showToggle: u.showToggle,
1884
+ ToggleComponent: n
1685
1885
  }
1686
1886
  ),
1687
- /* @__PURE__ */ O.jsx(
1887
+ /* @__PURE__ */ I.jsx(
1688
1888
  "div",
1689
1889
  {
1690
- ref: f,
1691
- id: "swipebar-left",
1890
+ ref: T,
1891
+ id: `swipebar-left-${e}`,
1692
1892
  role: "dialog",
1693
- "aria-modal": o,
1694
- "aria-label": i ?? "Left sidebar",
1695
- inert: !o,
1893
+ "aria-modal": x,
1894
+ "aria-label": l ?? "Left sidebar",
1895
+ inert: !x,
1696
1896
  style: {
1697
- ...rt,
1698
- ...zt,
1699
- ...s.isAbsolute || w ? Vt : {},
1700
- ...e ? {} : { backgroundColor: Ee },
1701
- zIndex: s.swipeBarZIndex
1897
+ ...bt,
1898
+ ..._r,
1899
+ ...u.isAbsolute || w ? Dr : {},
1900
+ ...t ? {} : { backgroundColor: Ie },
1901
+ zIndex: u.swipeBarZIndex,
1902
+ ...c ? { transform: "translateX(0px)", width: `${u.sidebarWidthPx}px` } : {}
1702
1903
  },
1703
- className: e,
1704
- children: t
1904
+ className: t,
1905
+ children: r
1705
1906
  }
1706
1907
  )
1707
1908
  ] });
1708
1909
  }
1709
- function gr({ options: e, showToggle: t = !0, ToggleComponent: r }) {
1710
- const { openSidebar: i, rightToggleRef: c, isRightOpen: o, closeSidebar: u } = ee();
1711
- return t ? (
1910
+ function Qr({
1911
+ id: e,
1912
+ toggleRef: t,
1913
+ options: r,
1914
+ showToggle: n = !0,
1915
+ ToggleComponent: l
1916
+ }) {
1917
+ const { openSidebar: c, closeSidebar: d, rightSidebars: h } = J(), g = h[e]?.isOpen ?? !1;
1918
+ return n ? (
1712
1919
  // 1px wide container
1713
- /* @__PURE__ */ O.jsx(
1920
+ /* @__PURE__ */ I.jsx(
1714
1921
  "div",
1715
1922
  {
1716
- ref: c,
1923
+ ref: t,
1717
1924
  style: {
1718
- ...nt,
1719
- transition: `transform ${e.transitionMs}ms ease, opacity ${e.transitionMs}ms ease`,
1925
+ ...yt,
1926
+ transition: `transform ${r.transitionMs}ms ease, opacity ${r.transitionMs}ms ease`,
1720
1927
  right: 0,
1721
- zIndex: e.toggleZIndex
1928
+ zIndex: r.toggleZIndex
1722
1929
  },
1723
- children: (!o || o && !e.showOverlay) && /* @__PURE__ */ O.jsx(
1930
+ children: (!g || g && !r.showOverlay) && /* @__PURE__ */ I.jsx(
1724
1931
  "button",
1725
1932
  {
1726
1933
  type: "button",
1727
- "aria-expanded": o,
1728
- "aria-controls": "swipebar-right",
1729
- "aria-label": o ? "Close right sidebar" : "Open right sidebar",
1934
+ "aria-expanded": g,
1935
+ "aria-controls": `swipebar-right-${e}`,
1936
+ "aria-label": g ? "Close right sidebar" : "Open right sidebar",
1730
1937
  onClick: () => {
1731
- e.disabled || (o ? u("right") : i("right"));
1938
+ r.disabled || (g ? d("right", { id: e }) : c("right", { id: e }));
1732
1939
  },
1733
- disabled: e.disabled,
1940
+ disabled: r.disabled,
1734
1941
  style: {
1735
- marginRight: `${e.toggleIconEdgeDistancePx}px`,
1942
+ marginRight: `${r.toggleIconEdgeDistancePx}px`,
1736
1943
  // reverse because we are using the same icon for both left and right
1737
- ...o ? {} : { transform: "rotate(180deg)" }
1944
+ ...g ? {} : { transform: "rotate(180deg)" }
1738
1945
  },
1739
- children: r ?? /* @__PURE__ */ O.jsx(Ie, { size: e.toggleIconSizePx, color: e.toggleIconColor })
1946
+ children: l ?? /* @__PURE__ */ I.jsx(Xe, { size: r.toggleIconSizePx, color: r.toggleIconColor })
1740
1947
  }
1741
1948
  )
1742
1949
  }
1743
1950
  )
1744
1951
  ) : null;
1745
1952
  }
1746
- const Qe = ({
1953
+ const gt = ({
1747
1954
  refs: e,
1748
1955
  callbacks: t,
1749
1956
  currentX: r,
1750
- preventDefault: i,
1751
- lockPane: c,
1752
- options: o
1957
+ preventDefault: n,
1958
+ lockPane: l,
1959
+ options: c
1753
1960
  }) => {
1754
1961
  if (!e.draggingRef.current) return;
1755
- const u = window.innerWidth, f = r - e.draggingRef.current.startX, l = e.draggingRef.current.startX >= u - o.edgeActivationWidthPx, s = e.draggingRef.current.isActivated;
1756
- if (!s && Math.abs(f) >= o.dragActivationDeltaPx && (e.draggingRef.current.isActivated = !0, c()), !s) return;
1962
+ const d = window.innerWidth, h = r - e.draggingRef.current.startX, g = e.draggingRef.current.startX >= d - c.edgeActivationWidthPx, p = e.draggingRef.current.isActivated;
1963
+ if (!p && Math.abs(h) >= c.dragActivationDeltaPx && (e.draggingRef.current.isActivated = !0, l()), !p) return;
1757
1964
  e.prevXRef.current = e.currentXRef.current, e.currentXRef.current = r;
1758
- const w = t.getIsOpen();
1759
- let y = !1;
1760
- if ((w || l) && (y = !0), !y) {
1965
+ const S = t.getIsOpen();
1966
+ let R = !1;
1967
+ if ((S || g) && (R = !0), !R) {
1761
1968
  e.draggingRef.current = null, t.dragSidebar(null);
1762
1969
  return;
1763
1970
  }
1764
- i();
1765
- const h = o.sidebarWidthPx;
1766
- if (w) {
1767
- const S = Math.max(
1971
+ n();
1972
+ const m = c.sidebarWidthPx;
1973
+ if (S) {
1974
+ const T = Math.max(
1768
1975
  0,
1769
- Math.min(h, f - o.dragActivationDeltaPx)
1976
+ Math.min(m, h - c.dragActivationDeltaPx)
1770
1977
  );
1771
- t.dragSidebar(S);
1978
+ t.dragSidebar(T);
1772
1979
  } else {
1773
- const S = Math.max(
1980
+ const T = Math.max(
1774
1981
  0,
1775
1982
  Math.min(
1776
- h,
1777
- h + f + o.dragActivationDeltaPx
1983
+ m,
1984
+ m + h + c.dragActivationDeltaPx
1778
1985
  )
1779
1986
  );
1780
- t.dragSidebar(S);
1987
+ t.dragSidebar(T);
1781
1988
  }
1782
- }, Je = ({ refs: e, callbacks: t, options: r }) => {
1989
+ }, ht = ({ refs: e, callbacks: t, options: r }) => {
1783
1990
  if (!e.draggingRef.current) return;
1784
1991
  if (!e.draggingRef.current.isActivated) {
1785
1992
  e.draggingRef.current = null, e.currentXRef.current = null, e.prevXRef.current = null;
1786
1993
  return;
1787
1994
  }
1788
- const i = e.currentXRef.current ?? e.draggingRef.current.startX, c = e.prevXRef.current ?? e.draggingRef.current.startX, o = e.draggingRef.current.startX, u = t.getIsOpen(), f = window.innerWidth;
1995
+ const n = e.currentXRef.current ?? e.draggingRef.current.startX, l = e.prevXRef.current ?? e.draggingRef.current.startX, c = e.draggingRef.current.startX, d = t.getIsOpen(), h = window.innerWidth;
1789
1996
  e.draggingRef.current = null, e.currentXRef.current = null, e.prevXRef.current = null;
1790
- const l = i > c, s = i < c, w = o >= f - r.edgeActivationWidthPx;
1791
- u ? (l ? t.closeSidebar() : t.openSidebar(), t.dragSidebar(null)) : w && s ? (t.openSidebar(), t.dragSidebar(null)) : (t.closeSidebar(), t.dragSidebar(null));
1997
+ const g = n > l, p = n < l, S = c >= h - r.edgeActivationWidthPx;
1998
+ d ? (g ? t.closeSidebar() : t.openSidebar(), t.dragSidebar(null)) : S && p ? (t.openSidebar(), t.dragSidebar(null)) : (t.closeSidebar(), t.dragSidebar(null));
1792
1999
  };
1793
- function hr(e) {
1794
- const t = fe(e.mediaQueryWidth), {
1795
- lockedSidebar: r,
1796
- setLockedSidebar: i,
1797
- isRightOpen: c,
1798
- openSidebar: o,
1799
- closeSidebar: u,
1800
- dragSidebar: f,
1801
- rightSidebarRef: l
1802
- } = ee(), s = _(null), w = _(null), y = _(null);
1803
- G(() => {
1804
- if (!t || r && r !== "right" || e.disabled) return;
1805
- const h = {
1806
- getIsOpen: () => c,
1807
- openSidebar: () => o("right"),
1808
- closeSidebar: () => u("right"),
1809
- dragSidebar: (v) => f("right", v)
1810
- }, S = {
1811
- draggingRef: s,
1812
- currentXRef: w,
1813
- prevXRef: y
1814
- }, C = () => i("right"), p = () => i(null);
1815
- function P(v) {
1816
- if (r && r !== "right" || de(v.target) || v.changedTouches.length === 0) return;
1817
- const x = v.changedTouches[0], E = window.innerWidth, M = h.getIsOpen(), q = x.clientX >= E - e.edgeActivationWidthPx;
1818
- M && !e.swipeToClose || !M && !e.swipeToOpen || (M || q) && pe({
1819
- refs: S,
1820
- clientX: x.clientX,
1821
- clientY: x.clientY,
1822
- touchId: x.identifier,
2000
+ function Jr(e, t) {
2001
+ const r = he(e.mediaQueryWidth), {
2002
+ lockedSidebar: n,
2003
+ setLockedSidebar: l,
2004
+ rightSidebars: c,
2005
+ openSidebar: d,
2006
+ closeSidebar: h,
2007
+ dragSidebar: g,
2008
+ activeRightDragIdRef: p,
2009
+ rightFocusStackRef: S
2010
+ } = J(), R = c[t]?.isOpen ?? !1, m = L(null), T = L(null), C = L(null);
2011
+ q(() => {
2012
+ if (!r || n && n !== "right" || e.disabled) return;
2013
+ const u = {
2014
+ getIsOpen: () => R,
2015
+ openSidebar: () => d("right", { id: t }),
2016
+ closeSidebar: () => h("right", { id: t }),
2017
+ dragSidebar: (b) => g("right", b, { id: t })
2018
+ }, w = {
2019
+ draggingRef: m,
2020
+ currentXRef: T,
2021
+ prevXRef: C
2022
+ }, x = () => p.current !== null && p.current !== t, _ = () => {
2023
+ const b = S.current;
2024
+ return b.length === 0 ? !0 : b[b.length - 1] === t;
2025
+ }, B = () => {
2026
+ if (x()) {
2027
+ m.current = null;
2028
+ return;
2029
+ }
2030
+ p.current = t, l("right");
2031
+ }, Y = () => {
2032
+ p.current === t && (p.current = null);
2033
+ }, H = () => {
2034
+ Y(), l(null);
2035
+ };
2036
+ function k(b) {
2037
+ if (n && n !== "right" || x() || !_() || ge(b.target) || b.changedTouches.length === 0) return;
2038
+ const M = b.changedTouches[0], P = window.innerWidth, F = u.getIsOpen(), U = M.clientX >= P - e.edgeActivationWidthPx;
2039
+ F && !e.swipeToClose || !F && !e.swipeToOpen || (F || U) && Ee({
2040
+ refs: w,
2041
+ clientX: M.clientX,
2042
+ clientY: M.clientY,
2043
+ touchId: M.identifier,
1823
2044
  isMouse: !1
1824
2045
  });
1825
2046
  }
1826
- function L(v) {
1827
- if (r && r !== "right" || !s.current || s.current.isMouse) return;
1828
- const x = s.current.activeTouchId, E = Ae(v.changedTouches, x);
1829
- E && Qe({
1830
- refs: S,
1831
- callbacks: h,
1832
- currentX: E.clientX,
1833
- preventDefault: () => v.preventDefault(),
1834
- lockPane: C,
2047
+ function W(b) {
2048
+ if (n && n !== "right") return;
2049
+ if (x()) {
2050
+ m.current = null;
2051
+ return;
2052
+ }
2053
+ if (!m.current || m.current.isMouse) return;
2054
+ const M = m.current.activeTouchId, P = _e(b.changedTouches, M);
2055
+ P && gt({
2056
+ refs: w,
2057
+ callbacks: u,
2058
+ currentX: P.clientX,
2059
+ preventDefault: () => b.preventDefault(),
2060
+ lockPane: B,
1835
2061
  options: e
1836
2062
  });
1837
2063
  }
1838
- function I(v) {
1839
- if (r && r !== "right" || !s.current || s.current.isMouse) return;
1840
- const x = s.current.activeTouchId;
1841
- Pe(v.changedTouches, x) && Je({
1842
- refs: S,
1843
- callbacks: h,
2064
+ function X(b) {
2065
+ if (n && n !== "right" || !m.current || m.current.isMouse) return;
2066
+ const M = m.current.activeTouchId;
2067
+ Le(b.changedTouches, M) && (Y(), ht({
2068
+ refs: w,
2069
+ callbacks: u,
1844
2070
  options: e
1845
- });
2071
+ }));
1846
2072
  }
1847
- function $() {
1848
- r && r !== "right" || !s.current || s.current.isMouse || it({
1849
- refs: S,
1850
- dragSidebar: h.dragSidebar,
1851
- onDeactivate: p
1852
- });
2073
+ function V() {
2074
+ n && n !== "right" || !m.current || m.current.isMouse || (Y(), xt({
2075
+ refs: w,
2076
+ dragSidebar: u.dragSidebar,
2077
+ onDeactivate: H
2078
+ }));
1853
2079
  }
1854
- function j(v) {
1855
- if (r && r !== "right" || de(v.target) || v.button !== 0) return;
1856
- const x = window.innerWidth, E = h.getIsOpen(), M = v.clientX >= x - e.edgeActivationWidthPx;
1857
- E && !e.swipeToClose || !E && !e.swipeToOpen || (E || M) && pe({
1858
- refs: S,
1859
- clientX: v.clientX,
1860
- clientY: v.clientY,
2080
+ function j(b) {
2081
+ if (n && n !== "right" || x() || !_() || ge(b.target) || b.button !== 0) return;
2082
+ const M = window.innerWidth, P = u.getIsOpen(), F = b.clientX >= M - e.edgeActivationWidthPx;
2083
+ P && !e.swipeToClose || !P && !e.swipeToOpen || (P || F) && Ee({
2084
+ refs: w,
2085
+ clientX: b.clientX,
2086
+ clientY: b.clientY,
1861
2087
  touchId: null,
1862
2088
  isMouse: !0
1863
2089
  });
1864
2090
  }
1865
- function B(v) {
1866
- r && r !== "right" || !s.current || !s.current.isMouse || Qe({
1867
- refs: S,
1868
- callbacks: h,
1869
- currentX: v.clientX,
1870
- preventDefault: () => v.preventDefault(),
1871
- lockPane: C,
1872
- options: e
1873
- });
2091
+ function Q(b) {
2092
+ if (!(n && n !== "right")) {
2093
+ if (x()) {
2094
+ m.current = null;
2095
+ return;
2096
+ }
2097
+ !m.current || !m.current.isMouse || gt({
2098
+ refs: w,
2099
+ callbacks: u,
2100
+ currentX: b.clientX,
2101
+ preventDefault: () => b.preventDefault(),
2102
+ lockPane: B,
2103
+ options: e
2104
+ });
2105
+ }
1874
2106
  }
1875
- function k() {
1876
- r && r !== "right" || !s.current || !s.current.isMouse || Je({
1877
- refs: S,
1878
- callbacks: h,
2107
+ function G() {
2108
+ n && n !== "right" || !m.current || !m.current.isMouse || (Y(), ht({
2109
+ refs: w,
2110
+ callbacks: u,
1879
2111
  options: e
1880
- });
2112
+ }));
1881
2113
  }
1882
- return window.addEventListener("touchstart", P, { passive: !0 }), window.addEventListener("touchmove", L, { passive: !1 }), window.addEventListener("touchend", I, { passive: !0 }), window.addEventListener("touchcancel", $, { passive: !0 }), window.addEventListener("mousedown", j, { passive: !0 }), window.addEventListener("mousemove", B, { passive: !1 }), window.addEventListener("mouseup", k, { passive: !0 }), () => {
1883
- window.removeEventListener("touchstart", P), window.removeEventListener("touchmove", L), window.removeEventListener("touchend", I), window.removeEventListener("touchcancel", $), window.removeEventListener("mousedown", j), window.removeEventListener("mousemove", B), window.removeEventListener("mouseup", k);
2114
+ return window.addEventListener("touchstart", k, { passive: !0 }), window.addEventListener("touchmove", W, { passive: !1 }), window.addEventListener("touchend", X, { passive: !0 }), window.addEventListener("touchcancel", V, { passive: !0 }), window.addEventListener("mousedown", j, { passive: !0 }), window.addEventListener("mousemove", Q, { passive: !1 }), window.addEventListener("mouseup", G, { passive: !0 }), () => {
2115
+ window.removeEventListener("touchstart", k), window.removeEventListener("touchmove", W), window.removeEventListener("touchend", X), window.removeEventListener("touchcancel", V), window.removeEventListener("mousedown", j), window.removeEventListener("mousemove", Q), window.removeEventListener("mouseup", G);
1884
2116
  };
1885
2117
  }, [
1886
2118
  t,
1887
- c,
1888
- o,
1889
- u,
1890
- f,
1891
2119
  r,
1892
- i,
2120
+ R,
2121
+ d,
2122
+ h,
2123
+ g,
2124
+ n,
1893
2125
  l,
1894
- e
2126
+ e,
2127
+ p,
2128
+ S
1895
2129
  ]);
1896
2130
  }
1897
- function Sr({
1898
- className: e,
1899
- children: t,
1900
- ToggleComponent: r,
1901
- ariaLabel: i,
1902
- ...c
2131
+ function on({
2132
+ id: e = "primary",
2133
+ className: t,
2134
+ children: r,
2135
+ ToggleComponent: n,
2136
+ ariaLabel: l,
2137
+ defaultOpen: c,
2138
+ ...d
1903
2139
  }) {
1904
- if ((t == null ? void 0 : t.type) === O.Fragment)
2140
+ if (r?.type === I.Fragment)
1905
2141
  throw new Error("Fragments is not allowed in SwipeBarRight");
1906
- const { isRightOpen: o, closeSidebar: u, rightSidebarRef: f, rightToggleRef: l } = ee(), s = Me("right", c), w = fe(s.mediaQueryWidth);
1907
- hr(s);
1908
- const y = Y(() => u("right"), [u]);
1909
- return _e({
1910
- sidebarRef: f,
1911
- triggerRef: l,
1912
- isOpen: o,
1913
- onClose: y,
1914
- transitionMs: s.transitionMs
1915
- }), /* @__PURE__ */ O.jsxs(O.Fragment, { children: [
1916
- s.showOverlay && /* @__PURE__ */ O.jsx(
1917
- Ce,
2142
+ const {
2143
+ rightSidebars: h,
2144
+ rightSidebarOptionsMap: g,
2145
+ closeSidebar: p,
2146
+ openSidebar: S,
2147
+ registerRightSidebar: R,
2148
+ unregisterRightSidebar: m
2149
+ } = J(), T = L(null), C = L(null);
2150
+ q(() => (R(e, { sidebarRef: T, toggleRef: C }), () => m(e)), [e, R, m]);
2151
+ const u = De("right", d, e), w = he(u.mediaQueryWidth);
2152
+ Jr(u, e);
2153
+ const x = h[e]?.isOpen ?? !1, _ = E(
2154
+ () => S("right", { id: e, skipTransition: !0 }),
2155
+ [S, e]
2156
+ ), { forceOverlayVisible: B } = $e({
2157
+ defaultOpen: c,
2158
+ optionsReady: !!g[e],
2159
+ onOpen: _
2160
+ }), Y = E(() => p("right", { id: e }), [p, e]);
2161
+ return Be({
2162
+ sidebarRef: T,
2163
+ triggerRef: C,
2164
+ isOpen: x,
2165
+ onClose: Y,
2166
+ transitionMs: u.transitionMs
2167
+ }), /* @__PURE__ */ I.jsxs(I.Fragment, { children: [
2168
+ u.showOverlay && /* @__PURE__ */ I.jsx(
2169
+ Ye,
1918
2170
  {
1919
- isCollapsed: !o,
1920
- setCollapsed: () => u("right"),
1921
- closeSidebarOnClick: s.closeSidebarOnOverlayClick,
1922
- transitionMs: s.transitionMs,
1923
- overlayBackgroundColor: s.overlayBackgroundColor,
1924
- overlayZIndex: s.overlayZIndex
2171
+ isCollapsed: !x && !B,
2172
+ setCollapsed: () => p("right", { id: e }),
2173
+ closeSidebarOnClick: u.closeSidebarOnOverlayClick,
2174
+ transitionMs: u.transitionMs,
2175
+ overlayBackgroundColor: u.overlayBackgroundColor,
2176
+ overlayZIndex: u.overlayZIndex
1925
2177
  }
1926
2178
  ),
1927
- /* @__PURE__ */ O.jsx(
1928
- gr,
2179
+ /* @__PURE__ */ I.jsx(
2180
+ Qr,
1929
2181
  {
1930
- options: s,
1931
- showToggle: s.showToggle,
1932
- ToggleComponent: r
2182
+ id: e,
2183
+ toggleRef: C,
2184
+ options: u,
2185
+ showToggle: u.showToggle,
2186
+ ToggleComponent: n
1933
2187
  }
1934
2188
  ),
1935
- /* @__PURE__ */ O.jsx(
2189
+ /* @__PURE__ */ I.jsx(
1936
2190
  "div",
1937
2191
  {
1938
- ref: f,
1939
- id: "swipebar-right",
2192
+ ref: T,
2193
+ id: `swipebar-right-${e}`,
1940
2194
  role: "dialog",
1941
- "aria-modal": o,
1942
- "aria-label": i ?? "Right sidebar",
1943
- inert: !o,
2195
+ "aria-modal": x,
2196
+ "aria-label": l ?? "Right sidebar",
2197
+ inert: !x,
1944
2198
  style: {
1945
- ...rt,
1946
- ...qt,
1947
- ...s.isAbsolute || w ? Qt : {},
1948
- ...e ? {} : { backgroundColor: Ee },
1949
- zIndex: s.swipeBarZIndex
2199
+ ...bt,
2200
+ ...Lr,
2201
+ ...u.isAbsolute || w ? Yr : {},
2202
+ ...t ? {} : { backgroundColor: Ie },
2203
+ zIndex: u.swipeBarZIndex,
2204
+ ...c ? { transform: "translateX(0px)", width: `${u.sidebarWidthPx}px` } : {}
1950
2205
  },
1951
- className: e,
1952
- children: t
2206
+ className: t,
2207
+ children: r
1953
2208
  }
1954
2209
  )
1955
2210
  ] });
1956
2211
  }
1957
2212
  export {
1958
- Ce as Overlay,
1959
- wr as SwipeBarBottom,
1960
- pr as SwipeBarLeft,
1961
- vr as SwipeBarProvider,
1962
- Sr as SwipeBarRight,
1963
- sr as ToggleBottom,
1964
- dr as ToggleLeft,
1965
- gr as ToggleRight,
1966
- fe as useMediaQuery,
1967
- ee as useSwipeBarContext
2213
+ Ye as Overlay,
2214
+ rn as SwipeBarBottom,
2215
+ nn as SwipeBarLeft,
2216
+ tn as SwipeBarProvider,
2217
+ on as SwipeBarRight,
2218
+ Ur as ToggleBottom,
2219
+ Vr as ToggleLeft,
2220
+ Qr as ToggleRight,
2221
+ he as useMediaQuery,
2222
+ J as useSwipeBarContext
1968
2223
  };