@trailguide/core 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,20 @@
1
- var Wt = Object.defineProperty;
2
- var Mt = (t, e, n) => e in t ? Wt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var I = (t, e, n) => Mt(t, typeof e != "symbol" ? e + "" : e, n);
4
- const J = Math.min, X = Math.max, nt = Math.round, k = (t) => ({
1
+ var Nt = Object.defineProperty;
2
+ var Vt = (t, e, n) => e in t ? Nt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var k = (t, e, n) => Vt(t, typeof e != "symbol" ? e + "" : e, n);
4
+ const U = Math.min, z = Math.max, nt = Math.round, R = (t) => ({
5
5
  x: t,
6
6
  y: t
7
- }), qt = {
7
+ }), Wt = {
8
8
  left: "right",
9
9
  right: "left",
10
10
  bottom: "top",
11
11
  top: "bottom"
12
- }, _t = {
12
+ }, Ht = {
13
13
  start: "end",
14
14
  end: "start"
15
15
  };
16
- function ut(t, e, n) {
17
- return X(t, J(e, n));
16
+ function dt(t, e, n) {
17
+ return z(t, U(e, n));
18
18
  }
19
19
  function Z(t, e) {
20
20
  return typeof t == "function" ? t(e) : t;
@@ -25,54 +25,54 @@ function H(t) {
25
25
  function tt(t) {
26
26
  return t.split("-")[1];
27
27
  }
28
- function Et(t) {
28
+ function Tt(t) {
29
29
  return t === "x" ? "y" : "x";
30
30
  }
31
- function pt(t) {
31
+ function gt(t) {
32
32
  return t === "y" ? "height" : "width";
33
33
  }
34
- const Ht = /* @__PURE__ */ new Set(["top", "bottom"]);
35
- function V(t) {
36
- return Ht.has(H(t)) ? "y" : "x";
34
+ const zt = /* @__PURE__ */ new Set(["top", "bottom"]);
35
+ function _(t) {
36
+ return zt.has(H(t)) ? "y" : "x";
37
37
  }
38
- function gt(t) {
39
- return Et(V(t));
38
+ function mt(t) {
39
+ return Tt(_(t));
40
40
  }
41
41
  function Xt(t, e, n) {
42
42
  n === void 0 && (n = !1);
43
- const i = tt(t), o = gt(t), s = pt(o);
43
+ const i = tt(t), o = mt(t), s = gt(o);
44
44
  let r = o === "x" ? i === (n ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
45
45
  return e.reference[s] > e.floating[s] && (r = ot(r)), [r, ot(r)];
46
46
  }
47
47
  function jt(t) {
48
48
  const e = ot(t);
49
- return [dt(t), e, dt(e)];
49
+ return [ht(t), e, ht(e)];
50
50
  }
51
- function dt(t) {
52
- return t.replace(/start|end/g, (e) => _t[e]);
51
+ function ht(t) {
52
+ return t.replace(/start|end/g, (e) => Ht[e]);
53
53
  }
54
- const yt = ["left", "right"], xt = ["right", "left"], Yt = ["top", "bottom"], zt = ["bottom", "top"];
55
- function Kt(t, e, n) {
54
+ const xt = ["left", "right"], bt = ["right", "left"], Yt = ["top", "bottom"], Kt = ["bottom", "top"];
55
+ function Gt(t, e, n) {
56
56
  switch (t) {
57
57
  case "top":
58
58
  case "bottom":
59
- return n ? e ? xt : yt : e ? yt : xt;
59
+ return n ? e ? bt : xt : e ? xt : bt;
60
60
  case "left":
61
61
  case "right":
62
- return e ? Yt : zt;
62
+ return e ? Yt : Kt;
63
63
  default:
64
64
  return [];
65
65
  }
66
66
  }
67
- function Ut(t, e, n, i) {
67
+ function Jt(t, e, n, i) {
68
68
  const o = tt(t);
69
- let s = Kt(H(t), n === "start", i);
70
- return o && (s = s.map((r) => r + "-" + o), e && (s = s.concat(s.map(dt)))), s;
69
+ let s = Gt(H(t), n === "start", i);
70
+ return o && (s = s.map((r) => r + "-" + o), e && (s = s.concat(s.map(ht)))), s;
71
71
  }
72
72
  function ot(t) {
73
- return t.replace(/left|right|bottom|top/g, (e) => qt[e]);
73
+ return t.replace(/left|right|bottom|top/g, (e) => Wt[e]);
74
74
  }
75
- function Gt(t) {
75
+ function Ut(t) {
76
76
  return {
77
77
  top: 0,
78
78
  right: 0,
@@ -81,8 +81,8 @@ function Gt(t) {
81
81
  ...t
82
82
  };
83
83
  }
84
- function Tt(t) {
85
- return typeof t != "number" ? Gt(t) : {
84
+ function Ot(t) {
85
+ return typeof t != "number" ? Ut(t) : {
86
86
  top: t,
87
87
  right: t,
88
88
  bottom: t,
@@ -112,50 +112,50 @@ function vt(t, e, n) {
112
112
  reference: i,
113
113
  floating: o
114
114
  } = t;
115
- const s = V(e), r = gt(e), l = pt(r), c = H(e), a = s === "y", d = i.x + i.width / 2 - o.width / 2, u = i.y + i.height / 2 - o.height / 2, p = i[l] / 2 - o[l] / 2;
116
- let f;
115
+ const s = _(e), r = mt(e), l = gt(r), c = H(e), a = s === "y", d = i.x + i.width / 2 - o.width / 2, f = i.y + i.height / 2 - o.height / 2, h = i[l] / 2 - o[l] / 2;
116
+ let u;
117
117
  switch (c) {
118
118
  case "top":
119
- f = {
119
+ u = {
120
120
  x: d,
121
121
  y: i.y - o.height
122
122
  };
123
123
  break;
124
124
  case "bottom":
125
- f = {
125
+ u = {
126
126
  x: d,
127
127
  y: i.y + i.height
128
128
  };
129
129
  break;
130
130
  case "right":
131
- f = {
131
+ u = {
132
132
  x: i.x + i.width,
133
- y: u
133
+ y: f
134
134
  };
135
135
  break;
136
136
  case "left":
137
- f = {
137
+ u = {
138
138
  x: i.x - o.width,
139
- y: u
139
+ y: f
140
140
  };
141
141
  break;
142
142
  default:
143
- f = {
143
+ u = {
144
144
  x: i.x,
145
145
  y: i.y
146
146
  };
147
147
  }
148
148
  switch (tt(e)) {
149
149
  case "start":
150
- f[r] -= p * (n && a ? -1 : 1);
150
+ u[r] -= h * (n && a ? -1 : 1);
151
151
  break;
152
152
  case "end":
153
- f[r] += p * (n && a ? -1 : 1);
153
+ u[r] += h * (n && a ? -1 : 1);
154
154
  break;
155
155
  }
156
- return f;
156
+ return u;
157
157
  }
158
- async function Jt(t, e) {
158
+ async function Qt(t, e) {
159
159
  var n;
160
160
  e === void 0 && (e = {});
161
161
  const {
@@ -168,15 +168,15 @@ async function Jt(t, e) {
168
168
  } = t, {
169
169
  boundary: a = "clippingAncestors",
170
170
  rootBoundary: d = "viewport",
171
- elementContext: u = "floating",
172
- altBoundary: p = !1,
173
- padding: f = 0
174
- } = Z(e, t), h = Tt(f), m = l[p ? u === "floating" ? "reference" : "floating" : u], w = st(await s.getClippingRect({
171
+ elementContext: f = "floating",
172
+ altBoundary: h = !1,
173
+ padding: u = 0
174
+ } = Z(e, t), p = Ot(u), m = l[h ? f === "floating" ? "reference" : "floating" : f], y = st(await s.getClippingRect({
175
175
  element: (n = await (s.isElement == null ? void 0 : s.isElement(m))) == null || n ? m : m.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(l.floating)),
176
176
  boundary: a,
177
177
  rootBoundary: d,
178
178
  strategy: c
179
- })), y = u === "floating" ? {
179
+ })), w = f === "floating" ? {
180
180
  x: i,
181
181
  y: o,
182
182
  width: r.floating.width,
@@ -189,18 +189,18 @@ async function Jt(t, e) {
189
189
  y: 1
190
190
  }, E = st(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
191
191
  elements: l,
192
- rect: y,
192
+ rect: w,
193
193
  offsetParent: x,
194
194
  strategy: c
195
- }) : y);
195
+ }) : w);
196
196
  return {
197
- top: (w.top - E.top + h.top) / v.y,
198
- bottom: (E.bottom - w.bottom + h.bottom) / v.y,
199
- left: (w.left - E.left + h.left) / v.x,
200
- right: (E.right - w.right + h.right) / v.x
197
+ top: (y.top - E.top + p.top) / v.y,
198
+ bottom: (E.bottom - y.bottom + p.bottom) / v.y,
199
+ left: (y.left - E.left + p.left) / v.x,
200
+ right: (E.right - y.right + p.right) / v.x
201
201
  };
202
202
  }
203
- const Qt = async (t, e, n) => {
203
+ const Zt = async (t, e, n) => {
204
204
  const {
205
205
  placement: i = "bottom",
206
206
  strategy: o = "absolute",
@@ -213,58 +213,58 @@ const Qt = async (t, e, n) => {
213
213
  strategy: o
214
214
  }), {
215
215
  x: d,
216
- y: u
217
- } = vt(a, i, c), p = i, f = {}, h = 0;
216
+ y: f
217
+ } = vt(a, i, c), h = i, u = {}, p = 0;
218
218
  for (let m = 0; m < l.length; m++) {
219
219
  var g;
220
220
  const {
221
- name: w,
222
- fn: y
221
+ name: y,
222
+ fn: w
223
223
  } = l[m], {
224
224
  x,
225
225
  y: v,
226
226
  data: E,
227
227
  reset: A
228
- } = await y({
228
+ } = await w({
229
229
  x: d,
230
- y: u,
230
+ y: f,
231
231
  initialPlacement: i,
232
- placement: p,
232
+ placement: h,
233
233
  strategy: o,
234
- middlewareData: f,
234
+ middlewareData: u,
235
235
  rects: a,
236
236
  platform: {
237
237
  ...r,
238
- detectOverflow: (g = r.detectOverflow) != null ? g : Jt
238
+ detectOverflow: (g = r.detectOverflow) != null ? g : Qt
239
239
  },
240
240
  elements: {
241
241
  reference: t,
242
242
  floating: e
243
243
  }
244
244
  });
245
- d = x ?? d, u = v ?? u, f = {
246
- ...f,
247
- [w]: {
248
- ...f[w],
245
+ d = x ?? d, f = v ?? f, u = {
246
+ ...u,
247
+ [y]: {
248
+ ...u[y],
249
249
  ...E
250
250
  }
251
- }, A && h <= 50 && (h++, typeof A == "object" && (A.placement && (p = A.placement), A.rects && (a = A.rects === !0 ? await r.getElementRects({
251
+ }, A && p <= 50 && (p++, typeof A == "object" && (A.placement && (h = A.placement), A.rects && (a = A.rects === !0 ? await r.getElementRects({
252
252
  reference: t,
253
253
  floating: e,
254
254
  strategy: o
255
255
  }) : A.rects), {
256
256
  x: d,
257
- y: u
258
- } = vt(a, p, c)), m = -1);
257
+ y: f
258
+ } = vt(a, h, c)), m = -1);
259
259
  }
260
260
  return {
261
261
  x: d,
262
- y: u,
263
- placement: p,
262
+ y: f,
263
+ placement: h,
264
264
  strategy: o,
265
- middlewareData: f
265
+ middlewareData: u
266
266
  };
267
- }, Zt = (t) => ({
267
+ }, te = (t) => ({
268
268
  name: "arrow",
269
269
  options: t,
270
270
  async fn(e) {
@@ -282,18 +282,18 @@ const Qt = async (t, e, n) => {
282
282
  } = Z(t, e) || {};
283
283
  if (a == null)
284
284
  return {};
285
- const u = Tt(d), p = {
285
+ const f = Ot(d), h = {
286
286
  x: n,
287
287
  y: i
288
- }, f = gt(o), h = pt(f), g = await r.getDimensions(a), m = f === "y", w = m ? "top" : "left", y = m ? "bottom" : "right", x = m ? "clientHeight" : "clientWidth", v = s.reference[h] + s.reference[f] - p[f] - s.floating[h], E = p[f] - s.reference[f], A = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a));
289
- let W = A ? A[x] : 0;
290
- (!W || !await (r.isElement == null ? void 0 : r.isElement(A))) && (W = l.floating[x] || s.floating[h]);
291
- const K = v / 2 - E / 2, M = W / 2 - g[h] / 2 - 1, P = J(u[w], M), U = J(u[y], M), q = P, G = W - g[h] - U, S = W / 2 - g[h] / 2 + K, _ = ut(q, S, G), D = !c.arrow && tt(o) != null && S !== _ && s.reference[h] / 2 - (S < q ? P : U) - g[h] / 2 < 0, T = D ? S < q ? S - q : S - G : 0;
288
+ }, u = mt(o), p = gt(u), g = await r.getDimensions(a), m = u === "y", y = m ? "top" : "left", w = m ? "bottom" : "right", x = m ? "clientHeight" : "clientWidth", v = s.reference[p] + s.reference[u] - h[u] - s.floating[p], E = h[u] - s.reference[u], A = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a));
289
+ let M = A ? A[x] : 0;
290
+ (!M || !await (r.isElement == null ? void 0 : r.isElement(A))) && (M = l.floating[x] || s.floating[p]);
291
+ const K = v / 2 - E / 2, N = M / 2 - g[p] / 2 - 1, P = U(f[y], N), G = U(f[w], N), V = P, J = M - g[p] - G, S = M / 2 - g[p] / 2 + K, W = dt(V, S, J), D = !c.arrow && tt(o) != null && S !== W && s.reference[p] / 2 - (S < V ? P : G) - g[p] / 2 < 0, T = D ? S < V ? S - V : S - J : 0;
292
292
  return {
293
- [f]: p[f] + T,
293
+ [u]: h[u] + T,
294
294
  data: {
295
- [f]: _,
296
- centerOffset: S - _ - T,
295
+ [u]: W,
296
+ centerOffset: S - W - T,
297
297
  ...D && {
298
298
  alignmentOffset: T
299
299
  }
@@ -301,7 +301,7 @@ const Qt = async (t, e, n) => {
301
301
  reset: D
302
302
  };
303
303
  }
304
- }), te = function(t) {
304
+ }), ee = function(t) {
305
305
  return t === void 0 && (t = {}), {
306
306
  name: "flip",
307
307
  options: t,
@@ -316,55 +316,55 @@ const Qt = async (t, e, n) => {
316
316
  elements: a
317
317
  } = e, {
318
318
  mainAxis: d = !0,
319
- crossAxis: u = !0,
320
- fallbackPlacements: p,
321
- fallbackStrategy: f = "bestFit",
322
- fallbackAxisSideDirection: h = "none",
319
+ crossAxis: f = !0,
320
+ fallbackPlacements: h,
321
+ fallbackStrategy: u = "bestFit",
322
+ fallbackAxisSideDirection: p = "none",
323
323
  flipAlignment: g = !0,
324
324
  ...m
325
325
  } = Z(t, e);
326
326
  if ((n = s.arrow) != null && n.alignmentOffset)
327
327
  return {};
328
- const w = H(o), y = V(l), x = H(l) === l, v = await (c.isRTL == null ? void 0 : c.isRTL(a.floating)), E = p || (x || !g ? [ot(l)] : jt(l)), A = h !== "none";
329
- !p && A && E.push(...Ut(l, g, h, v));
330
- const W = [l, ...E], K = await c.detectOverflow(e, m), M = [];
328
+ const y = H(o), w = _(l), x = H(l) === l, v = await (c.isRTL == null ? void 0 : c.isRTL(a.floating)), E = h || (x || !g ? [ot(l)] : jt(l)), A = p !== "none";
329
+ !h && A && E.push(...Jt(l, g, p, v));
330
+ const M = [l, ...E], K = await c.detectOverflow(e, m), N = [];
331
331
  let P = ((i = s.flip) == null ? void 0 : i.overflows) || [];
332
- if (d && M.push(K[w]), u) {
332
+ if (d && N.push(K[y]), f) {
333
333
  const S = Xt(o, r, v);
334
- M.push(K[S[0]], K[S[1]]);
334
+ N.push(K[S[0]], K[S[1]]);
335
335
  }
336
336
  if (P = [...P, {
337
337
  placement: o,
338
- overflows: M
339
- }], !M.every((S) => S <= 0)) {
340
- var U, q;
341
- const S = (((U = s.flip) == null ? void 0 : U.index) || 0) + 1, _ = W[S];
342
- if (_ && (!(u === "alignment" ? y !== V(_) : !1) || // We leave the current main axis only if every placement on that axis
338
+ overflows: N
339
+ }], !N.every((S) => S <= 0)) {
340
+ var G, V;
341
+ const S = (((G = s.flip) == null ? void 0 : G.index) || 0) + 1, W = M[S];
342
+ if (W && (!(f === "alignment" ? w !== _(W) : !1) || // We leave the current main axis only if every placement on that axis
343
343
  // overflows the main axis.
344
- P.every((O) => V(O.placement) === y ? O.overflows[0] > 0 : !0)))
344
+ P.every((O) => _(O.placement) === w ? O.overflows[0] > 0 : !0)))
345
345
  return {
346
346
  data: {
347
347
  index: S,
348
348
  overflows: P
349
349
  },
350
350
  reset: {
351
- placement: _
351
+ placement: W
352
352
  }
353
353
  };
354
- let D = (q = P.filter((T) => T.overflows[0] <= 0).sort((T, O) => T.overflows[1] - O.overflows[1])[0]) == null ? void 0 : q.placement;
354
+ let D = (V = P.filter((T) => T.overflows[0] <= 0).sort((T, O) => T.overflows[1] - O.overflows[1])[0]) == null ? void 0 : V.placement;
355
355
  if (!D)
356
- switch (f) {
356
+ switch (u) {
357
357
  case "bestFit": {
358
- var G;
359
- const T = (G = P.filter((O) => {
358
+ var J;
359
+ const T = (J = P.filter((O) => {
360
360
  if (A) {
361
- const B = V(O.placement);
362
- return B === y || // Create a bias to the `y` side axis due to horizontal
361
+ const B = _(O.placement);
362
+ return B === w || // Create a bias to the `y` side axis due to horizontal
363
363
  // reading directions favoring greater width.
364
364
  B === "y";
365
365
  }
366
366
  return !0;
367
- }).map((O) => [O.placement, O.overflows.filter((B) => B > 0).reduce((B, Nt) => B + Nt, 0)]).sort((O, B) => O[1] - B[1])[0]) == null ? void 0 : G[0];
367
+ }).map((O) => [O.placement, O.overflows.filter((B) => B > 0).reduce((B, Mt) => B + Mt, 0)]).sort((O, B) => O[1] - B[1])[0]) == null ? void 0 : J[0];
368
368
  T && (D = T);
369
369
  break;
370
370
  }
@@ -382,35 +382,35 @@ const Qt = async (t, e, n) => {
382
382
  return {};
383
383
  }
384
384
  };
385
- }, ee = /* @__PURE__ */ new Set(["left", "top"]);
386
- async function ie(t, e) {
385
+ }, ie = /* @__PURE__ */ new Set(["left", "top"]);
386
+ async function ne(t, e) {
387
387
  const {
388
388
  placement: n,
389
389
  platform: i,
390
390
  elements: o
391
- } = t, s = await (i.isRTL == null ? void 0 : i.isRTL(o.floating)), r = H(n), l = tt(n), c = V(n) === "y", a = ee.has(r) ? -1 : 1, d = s && c ? -1 : 1, u = Z(e, t);
391
+ } = t, s = await (i.isRTL == null ? void 0 : i.isRTL(o.floating)), r = H(n), l = tt(n), c = _(n) === "y", a = ie.has(r) ? -1 : 1, d = s && c ? -1 : 1, f = Z(e, t);
392
392
  let {
393
- mainAxis: p,
394
- crossAxis: f,
395
- alignmentAxis: h
396
- } = typeof u == "number" ? {
397
- mainAxis: u,
393
+ mainAxis: h,
394
+ crossAxis: u,
395
+ alignmentAxis: p
396
+ } = typeof f == "number" ? {
397
+ mainAxis: f,
398
398
  crossAxis: 0,
399
399
  alignmentAxis: null
400
400
  } : {
401
- mainAxis: u.mainAxis || 0,
402
- crossAxis: u.crossAxis || 0,
403
- alignmentAxis: u.alignmentAxis
401
+ mainAxis: f.mainAxis || 0,
402
+ crossAxis: f.crossAxis || 0,
403
+ alignmentAxis: f.alignmentAxis
404
404
  };
405
- return l && typeof h == "number" && (f = l === "end" ? h * -1 : h), c ? {
406
- x: f * d,
407
- y: p * a
405
+ return l && typeof p == "number" && (u = l === "end" ? p * -1 : p), c ? {
406
+ x: u * d,
407
+ y: h * a
408
408
  } : {
409
- x: p * a,
410
- y: f * d
409
+ x: h * a,
410
+ y: u * d
411
411
  };
412
412
  }
413
- const ne = function(t) {
413
+ const oe = function(t) {
414
414
  return t === void 0 && (t = 0), {
415
415
  name: "offset",
416
416
  options: t,
@@ -421,7 +421,7 @@ const ne = function(t) {
421
421
  y: s,
422
422
  placement: r,
423
423
  middlewareData: l
424
- } = e, c = await ie(e, t);
424
+ } = e, c = await ne(e, t);
425
425
  return r === ((n = l.offset) == null ? void 0 : n.placement) && (i = l.arrow) != null && i.alignmentOffset ? {} : {
426
426
  x: o + c.x,
427
427
  y: s + c.y,
@@ -432,7 +432,7 @@ const ne = function(t) {
432
432
  };
433
433
  }
434
434
  };
435
- }, oe = function(t) {
435
+ }, se = function(t) {
436
436
  return t === void 0 && (t = {}), {
437
437
  name: "shift",
438
438
  options: t,
@@ -446,13 +446,13 @@ const ne = function(t) {
446
446
  mainAxis: r = !0,
447
447
  crossAxis: l = !1,
448
448
  limiter: c = {
449
- fn: (w) => {
449
+ fn: (y) => {
450
450
  let {
451
- x: y,
451
+ x: w,
452
452
  y: x
453
- } = w;
453
+ } = y;
454
454
  return {
455
- x: y,
455
+ x: w,
456
456
  y: x
457
457
  };
458
458
  }
@@ -461,20 +461,20 @@ const ne = function(t) {
461
461
  } = Z(t, e), d = {
462
462
  x: n,
463
463
  y: i
464
- }, u = await s.detectOverflow(e, a), p = V(H(o)), f = Et(p);
465
- let h = d[f], g = d[p];
464
+ }, f = await s.detectOverflow(e, a), h = _(H(o)), u = Tt(h);
465
+ let p = d[u], g = d[h];
466
466
  if (r) {
467
- const w = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right", x = h + u[w], v = h - u[y];
468
- h = ut(x, h, v);
467
+ const y = u === "y" ? "top" : "left", w = u === "y" ? "bottom" : "right", x = p + f[y], v = p - f[w];
468
+ p = dt(x, p, v);
469
469
  }
470
470
  if (l) {
471
- const w = p === "y" ? "top" : "left", y = p === "y" ? "bottom" : "right", x = g + u[w], v = g - u[y];
472
- g = ut(x, g, v);
471
+ const y = h === "y" ? "top" : "left", w = h === "y" ? "bottom" : "right", x = g + f[y], v = g - f[w];
472
+ g = dt(x, g, v);
473
473
  }
474
474
  const m = c.fn({
475
475
  ...e,
476
- [f]: h,
477
- [p]: g
476
+ [u]: p,
477
+ [h]: g
478
478
  });
479
479
  return {
480
480
  ...m,
@@ -482,8 +482,8 @@ const ne = function(t) {
482
482
  x: m.x - n,
483
483
  y: m.y - i,
484
484
  enabled: {
485
- [f]: r,
486
- [p]: l
485
+ [u]: r,
486
+ [h]: l
487
487
  }
488
488
  }
489
489
  };
@@ -493,8 +493,8 @@ const ne = function(t) {
493
493
  function rt() {
494
494
  return typeof window < "u";
495
495
  }
496
- function z(t) {
497
- return Ot(t) ? (t.nodeName || "").toLowerCase() : "#document";
496
+ function Y(t) {
497
+ return kt(t) ? (t.nodeName || "").toLowerCase() : "#document";
498
498
  }
499
499
  function C(t) {
500
500
  var e;
@@ -502,37 +502,37 @@ function C(t) {
502
502
  }
503
503
  function F(t) {
504
504
  var e;
505
- return (e = (Ot(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
505
+ return (e = (kt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
506
506
  }
507
- function Ot(t) {
507
+ function kt(t) {
508
508
  return rt() ? t instanceof Node || t instanceof C(t).Node : !1;
509
509
  }
510
- function R(t) {
510
+ function L(t) {
511
511
  return rt() ? t instanceof Element || t instanceof C(t).Element : !1;
512
512
  }
513
- function $(t) {
513
+ function I(t) {
514
514
  return rt() ? t instanceof HTMLElement || t instanceof C(t).HTMLElement : !1;
515
515
  }
516
- function bt(t) {
516
+ function St(t) {
517
517
  return !rt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof C(t).ShadowRoot;
518
518
  }
519
- const se = /* @__PURE__ */ new Set(["inline", "contents"]);
519
+ const re = /* @__PURE__ */ new Set(["inline", "contents"]);
520
520
  function et(t) {
521
521
  const {
522
522
  overflow: e,
523
523
  overflowX: n,
524
524
  overflowY: i,
525
525
  display: o
526
- } = L(t);
527
- return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !se.has(o);
526
+ } = $(t);
527
+ return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !re.has(o);
528
528
  }
529
- const re = /* @__PURE__ */ new Set(["table", "td", "th"]);
530
- function le(t) {
531
- return re.has(z(t));
529
+ const le = /* @__PURE__ */ new Set(["table", "td", "th"]);
530
+ function ce(t) {
531
+ return le.has(Y(t));
532
532
  }
533
- const ce = [":popover-open", ":modal"];
533
+ const ae = [":popover-open", ":modal"];
534
534
  function lt(t) {
535
- return ce.some((e) => {
535
+ return ae.some((e) => {
536
536
  try {
537
537
  return t.matches(e);
538
538
  } catch {
@@ -540,34 +540,34 @@ function lt(t) {
540
540
  }
541
541
  });
542
542
  }
543
- const ae = ["transform", "translate", "scale", "rotate", "perspective"], fe = ["transform", "translate", "scale", "rotate", "perspective", "filter"], ue = ["paint", "layout", "strict", "content"];
544
- function mt(t) {
545
- const e = wt(), n = R(t) ? L(t) : t;
546
- return ae.some((i) => n[i] ? n[i] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || fe.some((i) => (n.willChange || "").includes(i)) || ue.some((i) => (n.contain || "").includes(i));
543
+ const fe = ["transform", "translate", "scale", "rotate", "perspective"], ue = ["transform", "translate", "scale", "rotate", "perspective", "filter"], de = ["paint", "layout", "strict", "content"];
544
+ function yt(t) {
545
+ const e = wt(), n = L(t) ? $(t) : t;
546
+ return fe.some((i) => n[i] ? n[i] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || ue.some((i) => (n.willChange || "").includes(i)) || de.some((i) => (n.contain || "").includes(i));
547
547
  }
548
- function de(t) {
549
- let e = N(t);
550
- for (; $(e) && !Y(e); ) {
551
- if (mt(e))
548
+ function he(t) {
549
+ let e = q(t);
550
+ for (; I(e) && !j(e); ) {
551
+ if (yt(e))
552
552
  return e;
553
553
  if (lt(e))
554
554
  return null;
555
- e = N(e);
555
+ e = q(e);
556
556
  }
557
557
  return null;
558
558
  }
559
559
  function wt() {
560
560
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
561
561
  }
562
- const he = /* @__PURE__ */ new Set(["html", "body", "#document"]);
563
- function Y(t) {
564
- return he.has(z(t));
562
+ const pe = /* @__PURE__ */ new Set(["html", "body", "#document"]);
563
+ function j(t) {
564
+ return pe.has(Y(t));
565
565
  }
566
- function L(t) {
566
+ function $(t) {
567
567
  return C(t).getComputedStyle(t);
568
568
  }
569
569
  function ct(t) {
570
- return R(t) ? {
570
+ return L(t) ? {
571
571
  scrollLeft: t.scrollLeft,
572
572
  scrollTop: t.scrollTop
573
573
  } : {
@@ -575,88 +575,88 @@ function ct(t) {
575
575
  scrollTop: t.scrollY
576
576
  };
577
577
  }
578
- function N(t) {
579
- if (z(t) === "html")
578
+ function q(t) {
579
+ if (Y(t) === "html")
580
580
  return t;
581
581
  const e = (
582
582
  // Step into the shadow DOM of the parent of a slotted node.
583
583
  t.assignedSlot || // DOM Element detected.
584
584
  t.parentNode || // ShadowRoot detected.
585
- bt(t) && t.host || // Fallback.
585
+ St(t) && t.host || // Fallback.
586
586
  F(t)
587
587
  );
588
- return bt(e) ? e.host : e;
588
+ return St(e) ? e.host : e;
589
589
  }
590
- function Rt(t) {
591
- const e = N(t);
592
- return Y(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : $(e) && et(e) ? e : Rt(e);
590
+ function Lt(t) {
591
+ const e = q(t);
592
+ return j(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : I(e) && et(e) ? e : Lt(e);
593
593
  }
594
- function Lt(t, e, n) {
594
+ function $t(t, e, n) {
595
595
  var i;
596
596
  e === void 0 && (e = []);
597
- const o = Rt(t), s = o === ((i = t.ownerDocument) == null ? void 0 : i.body), r = C(o);
598
- return s ? (ht(r), e.concat(r, r.visualViewport || [], et(o) ? o : [], [])) : e.concat(o, Lt(o, []));
597
+ const o = Lt(t), s = o === ((i = t.ownerDocument) == null ? void 0 : i.body), r = C(o);
598
+ return s ? (pt(r), e.concat(r, r.visualViewport || [], et(o) ? o : [], [])) : e.concat(o, $t(o, []));
599
599
  }
600
- function ht(t) {
600
+ function pt(t) {
601
601
  return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
602
602
  }
603
- function kt(t) {
604
- const e = L(t);
603
+ function Rt(t) {
604
+ const e = $(t);
605
605
  let n = parseFloat(e.width) || 0, i = parseFloat(e.height) || 0;
606
- const o = $(t), s = o ? t.offsetWidth : n, r = o ? t.offsetHeight : i, l = nt(n) !== s || nt(i) !== r;
606
+ const o = I(t), s = o ? t.offsetWidth : n, r = o ? t.offsetHeight : i, l = nt(n) !== s || nt(i) !== r;
607
607
  return l && (n = s, i = r), {
608
608
  width: n,
609
609
  height: i,
610
610
  $: l
611
611
  };
612
612
  }
613
- function $t(t) {
614
- return R(t) ? t : t.contextElement;
613
+ function It(t) {
614
+ return L(t) ? t : t.contextElement;
615
615
  }
616
- function j(t) {
617
- const e = $t(t);
618
- if (!$(e))
619
- return k(1);
616
+ function X(t) {
617
+ const e = It(t);
618
+ if (!I(e))
619
+ return R(1);
620
620
  const n = e.getBoundingClientRect(), {
621
621
  width: i,
622
622
  height: o,
623
623
  $: s
624
- } = kt(e);
624
+ } = Rt(e);
625
625
  let r = (s ? nt(n.width) : n.width) / i, l = (s ? nt(n.height) : n.height) / o;
626
626
  return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
627
627
  x: r,
628
628
  y: l
629
629
  };
630
630
  }
631
- const pe = /* @__PURE__ */ k(0);
631
+ const ge = /* @__PURE__ */ R(0);
632
632
  function Pt(t) {
633
633
  const e = C(t);
634
- return !wt() || !e.visualViewport ? pe : {
634
+ return !wt() || !e.visualViewport ? ge : {
635
635
  x: e.visualViewport.offsetLeft,
636
636
  y: e.visualViewport.offsetTop
637
637
  };
638
638
  }
639
- function ge(t, e, n) {
639
+ function me(t, e, n) {
640
640
  return e === void 0 && (e = !1), !n || e && n !== C(t) ? !1 : e;
641
641
  }
642
642
  function Q(t, e, n, i) {
643
643
  e === void 0 && (e = !1), n === void 0 && (n = !1);
644
- const o = t.getBoundingClientRect(), s = $t(t);
645
- let r = k(1);
646
- e && (i ? R(i) && (r = j(i)) : r = j(t));
647
- const l = ge(s, n, i) ? Pt(s) : k(0);
648
- let c = (o.left + l.x) / r.x, a = (o.top + l.y) / r.y, d = o.width / r.x, u = o.height / r.y;
644
+ const o = t.getBoundingClientRect(), s = It(t);
645
+ let r = R(1);
646
+ e && (i ? L(i) && (r = X(i)) : r = X(t));
647
+ const l = me(s, n, i) ? Pt(s) : R(0);
648
+ let c = (o.left + l.x) / r.x, a = (o.top + l.y) / r.y, d = o.width / r.x, f = o.height / r.y;
649
649
  if (s) {
650
- const p = C(s), f = i && R(i) ? C(i) : i;
651
- let h = p, g = ht(h);
652
- for (; g && i && f !== h; ) {
653
- const m = j(g), w = g.getBoundingClientRect(), y = L(g), x = w.left + (g.clientLeft + parseFloat(y.paddingLeft)) * m.x, v = w.top + (g.clientTop + parseFloat(y.paddingTop)) * m.y;
654
- c *= m.x, a *= m.y, d *= m.x, u *= m.y, c += x, a += v, h = C(g), g = ht(h);
650
+ const h = C(s), u = i && L(i) ? C(i) : i;
651
+ let p = h, g = pt(p);
652
+ for (; g && i && u !== p; ) {
653
+ const m = X(g), y = g.getBoundingClientRect(), w = $(g), x = y.left + (g.clientLeft + parseFloat(w.paddingLeft)) * m.x, v = y.top + (g.clientTop + parseFloat(w.paddingTop)) * m.y;
654
+ c *= m.x, a *= m.y, d *= m.x, f *= m.y, c += x, a += v, p = C(g), g = pt(p);
655
655
  }
656
656
  }
657
657
  return st({
658
658
  width: d,
659
- height: u,
659
+ height: f,
660
660
  x: c,
661
661
  y: a
662
662
  });
@@ -672,7 +672,7 @@ function Dt(t, e) {
672
672
  y: o
673
673
  };
674
674
  }
675
- function me(t) {
675
+ function ye(t) {
676
676
  let {
677
677
  elements: e,
678
678
  rect: n,
@@ -685,36 +685,36 @@ function me(t) {
685
685
  let c = {
686
686
  scrollLeft: 0,
687
687
  scrollTop: 0
688
- }, a = k(1);
689
- const d = k(0), u = $(i);
690
- if ((u || !u && !s) && ((z(i) !== "body" || et(r)) && (c = ct(i)), $(i))) {
691
- const f = Q(i);
692
- a = j(i), d.x = f.x + i.clientLeft, d.y = f.y + i.clientTop;
688
+ }, a = R(1);
689
+ const d = R(0), f = I(i);
690
+ if ((f || !f && !s) && ((Y(i) !== "body" || et(r)) && (c = ct(i)), I(i))) {
691
+ const u = Q(i);
692
+ a = X(i), d.x = u.x + i.clientLeft, d.y = u.y + i.clientTop;
693
693
  }
694
- const p = r && !u && !s ? Dt(r, c) : k(0);
694
+ const h = r && !f && !s ? Dt(r, c) : R(0);
695
695
  return {
696
696
  width: n.width * a.x,
697
697
  height: n.height * a.y,
698
- x: n.x * a.x - c.scrollLeft * a.x + d.x + p.x,
699
- y: n.y * a.y - c.scrollTop * a.y + d.y + p.y
698
+ x: n.x * a.x - c.scrollLeft * a.x + d.x + h.x,
699
+ y: n.y * a.y - c.scrollTop * a.y + d.y + h.y
700
700
  };
701
701
  }
702
702
  function we(t) {
703
703
  return Array.from(t.getClientRects());
704
704
  }
705
- function ye(t) {
706
- const e = F(t), n = ct(t), i = t.ownerDocument.body, o = X(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), s = X(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight);
705
+ function xe(t) {
706
+ const e = F(t), n = ct(t), i = t.ownerDocument.body, o = z(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), s = z(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight);
707
707
  let r = -n.scrollLeft + at(t);
708
708
  const l = -n.scrollTop;
709
- return L(i).direction === "rtl" && (r += X(e.clientWidth, i.clientWidth) - o), {
709
+ return $(i).direction === "rtl" && (r += z(e.clientWidth, i.clientWidth) - o), {
710
710
  width: o,
711
711
  height: s,
712
712
  x: r,
713
713
  y: l
714
714
  };
715
715
  }
716
- const St = 25;
717
- function xe(t, e) {
716
+ const At = 25;
717
+ function be(t, e) {
718
718
  const n = C(t), i = F(t), o = n.visualViewport;
719
719
  let s = i.clientWidth, r = i.clientHeight, l = 0, c = 0;
720
720
  if (o) {
@@ -724,9 +724,9 @@ function xe(t, e) {
724
724
  }
725
725
  const a = at(i);
726
726
  if (a <= 0) {
727
- const d = i.ownerDocument, u = d.body, p = getComputedStyle(u), f = d.compatMode === "CSS1Compat" && parseFloat(p.marginLeft) + parseFloat(p.marginRight) || 0, h = Math.abs(i.clientWidth - u.clientWidth - f);
728
- h <= St && (s -= h);
729
- } else a <= St && (s += a);
727
+ const d = i.ownerDocument, f = d.body, h = getComputedStyle(f), u = d.compatMode === "CSS1Compat" && parseFloat(h.marginLeft) + parseFloat(h.marginRight) || 0, p = Math.abs(i.clientWidth - f.clientWidth - u);
728
+ p <= At && (s -= p);
729
+ } else a <= At && (s += a);
730
730
  return {
731
731
  width: s,
732
732
  height: r,
@@ -735,8 +735,8 @@ function xe(t, e) {
735
735
  };
736
736
  }
737
737
  const ve = /* @__PURE__ */ new Set(["absolute", "fixed"]);
738
- function be(t, e) {
739
- const n = Q(t, !0, e === "fixed"), i = n.top + t.clientTop, o = n.left + t.clientLeft, s = $(t) ? j(t) : k(1), r = t.clientWidth * s.x, l = t.clientHeight * s.y, c = o * s.x, a = i * s.y;
738
+ function Se(t, e) {
739
+ const n = Q(t, !0, e === "fixed"), i = n.top + t.clientTop, o = n.left + t.clientLeft, s = I(t) ? X(t) : R(1), r = t.clientWidth * s.x, l = t.clientHeight * s.y, c = o * s.x, a = i * s.y;
740
740
  return {
741
741
  width: r,
742
742
  height: l,
@@ -744,14 +744,14 @@ function be(t, e) {
744
744
  y: a
745
745
  };
746
746
  }
747
- function At(t, e, n) {
747
+ function Ct(t, e, n) {
748
748
  let i;
749
749
  if (e === "viewport")
750
- i = xe(t, n);
750
+ i = be(t, n);
751
751
  else if (e === "document")
752
- i = ye(F(t));
753
- else if (R(e))
754
- i = be(e, n);
752
+ i = xe(F(t));
753
+ else if (L(e))
754
+ i = Se(e, n);
755
755
  else {
756
756
  const o = Pt(t);
757
757
  i = {
@@ -763,34 +763,34 @@ function At(t, e, n) {
763
763
  }
764
764
  return st(i);
765
765
  }
766
- function It(t, e) {
767
- const n = N(t);
768
- return n === e || !R(n) || Y(n) ? !1 : L(n).position === "fixed" || It(n, e);
766
+ function Ft(t, e) {
767
+ const n = q(t);
768
+ return n === e || !L(n) || j(n) ? !1 : $(n).position === "fixed" || Ft(n, e);
769
769
  }
770
- function Se(t, e) {
770
+ function Ae(t, e) {
771
771
  const n = e.get(t);
772
772
  if (n)
773
773
  return n;
774
- let i = Lt(t, []).filter((l) => R(l) && z(l) !== "body"), o = null;
775
- const s = L(t).position === "fixed";
776
- let r = s ? N(t) : t;
777
- for (; R(r) && !Y(r); ) {
778
- const l = L(r), c = mt(r);
779
- !c && l.position === "fixed" && (o = null), (s ? !c && !o : !c && l.position === "static" && !!o && ve.has(o.position) || et(r) && !c && It(t, r)) ? i = i.filter((d) => d !== r) : o = l, r = N(r);
774
+ let i = $t(t, []).filter((l) => L(l) && Y(l) !== "body"), o = null;
775
+ const s = $(t).position === "fixed";
776
+ let r = s ? q(t) : t;
777
+ for (; L(r) && !j(r); ) {
778
+ const l = $(r), c = yt(r);
779
+ !c && l.position === "fixed" && (o = null), (s ? !c && !o : !c && l.position === "static" && !!o && ve.has(o.position) || et(r) && !c && Ft(t, r)) ? i = i.filter((d) => d !== r) : o = l, r = q(r);
780
780
  }
781
781
  return e.set(t, i), i;
782
782
  }
783
- function Ae(t) {
783
+ function Ce(t) {
784
784
  let {
785
785
  element: e,
786
786
  boundary: n,
787
787
  rootBoundary: i,
788
788
  strategy: o
789
789
  } = t;
790
- const r = [...n === "clippingAncestors" ? lt(e) ? [] : Se(e, this._c) : [].concat(n), i], l = r[0], c = r.reduce((a, d) => {
791
- const u = At(e, d, o);
792
- return a.top = X(u.top, a.top), a.right = J(u.right, a.right), a.bottom = J(u.bottom, a.bottom), a.left = X(u.left, a.left), a;
793
- }, At(e, l, o));
790
+ const r = [...n === "clippingAncestors" ? lt(e) ? [] : Ae(e, this._c) : [].concat(n), i], l = r[0], c = r.reduce((a, d) => {
791
+ const f = Ct(e, d, o);
792
+ return a.top = z(f.top, a.top), a.right = U(f.right, a.right), a.bottom = U(f.bottom, a.bottom), a.left = z(f.left, a.left), a;
793
+ }, Ct(e, l, o));
794
794
  return {
795
795
  width: c.right - c.left,
796
796
  height: c.bottom - c.top,
@@ -798,73 +798,73 @@ function Ae(t) {
798
798
  y: c.top
799
799
  };
800
800
  }
801
- function Ce(t) {
801
+ function Ee(t) {
802
802
  const {
803
803
  width: e,
804
804
  height: n
805
- } = kt(t);
805
+ } = Rt(t);
806
806
  return {
807
807
  width: e,
808
808
  height: n
809
809
  };
810
810
  }
811
- function Ee(t, e, n) {
812
- const i = $(e), o = F(e), s = n === "fixed", r = Q(t, !0, s, e);
811
+ function Te(t, e, n) {
812
+ const i = I(e), o = F(e), s = n === "fixed", r = Q(t, !0, s, e);
813
813
  let l = {
814
814
  scrollLeft: 0,
815
815
  scrollTop: 0
816
816
  };
817
- const c = k(0);
817
+ const c = R(0);
818
818
  function a() {
819
819
  c.x = at(o);
820
820
  }
821
821
  if (i || !i && !s)
822
- if ((z(e) !== "body" || et(o)) && (l = ct(e)), i) {
823
- const f = Q(e, !0, s, e);
824
- c.x = f.x + e.clientLeft, c.y = f.y + e.clientTop;
822
+ if ((Y(e) !== "body" || et(o)) && (l = ct(e)), i) {
823
+ const u = Q(e, !0, s, e);
824
+ c.x = u.x + e.clientLeft, c.y = u.y + e.clientTop;
825
825
  } else o && a();
826
826
  s && !i && o && a();
827
- const d = o && !i && !s ? Dt(o, l) : k(0), u = r.left + l.scrollLeft - c.x - d.x, p = r.top + l.scrollTop - c.y - d.y;
827
+ const d = o && !i && !s ? Dt(o, l) : R(0), f = r.left + l.scrollLeft - c.x - d.x, h = r.top + l.scrollTop - c.y - d.y;
828
828
  return {
829
- x: u,
830
- y: p,
829
+ x: f,
830
+ y: h,
831
831
  width: r.width,
832
832
  height: r.height
833
833
  };
834
834
  }
835
835
  function ft(t) {
836
- return L(t).position === "static";
836
+ return $(t).position === "static";
837
837
  }
838
- function Ct(t, e) {
839
- if (!$(t) || L(t).position === "fixed")
838
+ function Et(t, e) {
839
+ if (!I(t) || $(t).position === "fixed")
840
840
  return null;
841
841
  if (e)
842
842
  return e(t);
843
843
  let n = t.offsetParent;
844
844
  return F(t) === n && (n = n.ownerDocument.body), n;
845
845
  }
846
- function Ft(t, e) {
846
+ function Bt(t, e) {
847
847
  const n = C(t);
848
848
  if (lt(t))
849
849
  return n;
850
- if (!$(t)) {
851
- let o = N(t);
852
- for (; o && !Y(o); ) {
853
- if (R(o) && !ft(o))
850
+ if (!I(t)) {
851
+ let o = q(t);
852
+ for (; o && !j(o); ) {
853
+ if (L(o) && !ft(o))
854
854
  return o;
855
- o = N(o);
855
+ o = q(o);
856
856
  }
857
857
  return n;
858
858
  }
859
- let i = Ct(t, e);
860
- for (; i && le(i) && ft(i); )
861
- i = Ct(i, e);
862
- return i && Y(i) && ft(i) && !mt(i) ? n : i || de(t) || n;
859
+ let i = Et(t, e);
860
+ for (; i && ce(i) && ft(i); )
861
+ i = Et(i, e);
862
+ return i && j(i) && ft(i) && !yt(i) ? n : i || he(t) || n;
863
863
  }
864
- const Te = async function(t) {
865
- const e = this.getOffsetParent || Ft, n = this.getDimensions, i = await n(t.floating);
864
+ const Oe = async function(t) {
865
+ const e = this.getOffsetParent || Bt, n = this.getDimensions, i = await n(t.floating);
866
866
  return {
867
- reference: Ee(t.reference, await e(t.floating), t.strategy),
867
+ reference: Te(t.reference, await e(t.floating), t.strategy),
868
868
  floating: {
869
869
  x: 0,
870
870
  y: 0,
@@ -873,105 +873,137 @@ const Te = async function(t) {
873
873
  }
874
874
  };
875
875
  };
876
- function Oe(t) {
877
- return L(t).direction === "rtl";
876
+ function ke(t) {
877
+ return $(t).direction === "rtl";
878
878
  }
879
- const Re = {
880
- convertOffsetParentRelativeRectToViewportRelativeRect: me,
879
+ const Le = {
880
+ convertOffsetParentRelativeRectToViewportRelativeRect: ye,
881
881
  getDocumentElement: F,
882
- getClippingRect: Ae,
883
- getOffsetParent: Ft,
884
- getElementRects: Te,
882
+ getClippingRect: Ce,
883
+ getOffsetParent: Bt,
884
+ getElementRects: Oe,
885
885
  getClientRects: we,
886
- getDimensions: Ce,
887
- getScale: j,
888
- isElement: R,
889
- isRTL: Oe
890
- }, Le = ne, ke = oe, $e = te, Pe = Zt, De = (t, e, n) => {
886
+ getDimensions: Ee,
887
+ getScale: X,
888
+ isElement: L,
889
+ isRTL: ke
890
+ }, $e = oe, Re = se, Ie = ee, Pe = te, De = (t, e, n) => {
891
891
  const i = /* @__PURE__ */ new Map(), o = {
892
- platform: Re,
892
+ platform: Le,
893
893
  ...n
894
894
  }, s = {
895
895
  ...o.platform,
896
896
  _c: i
897
897
  };
898
- return Qt(t, e, {
898
+ return Zt(t, e, {
899
899
  ...o,
900
900
  platform: s
901
901
  });
902
902
  };
903
- function Bt(t) {
903
+ function _t(t) {
904
904
  try {
905
905
  return document.querySelector(t);
906
906
  } catch {
907
907
  return console.warn(`[Trailguide] Invalid selector: ${t}`), null;
908
908
  }
909
909
  }
910
- function Vt(t) {
910
+ function qt(t) {
911
911
  const e = t.getBoundingClientRect(), n = window.getComputedStyle(t);
912
912
  return e.width > 0 && e.height > 0 && n.visibility !== "hidden" && n.display !== "none" && n.opacity !== "0";
913
913
  }
914
- function Ie(t) {
914
+ function Fe(t) {
915
915
  t.scrollIntoView({
916
916
  behavior: "smooth",
917
917
  block: "center",
918
918
  inline: "center"
919
919
  });
920
920
  }
921
+ function Be(t) {
922
+ const e = document.createElement("div");
923
+ return e.textContent = t, e.innerHTML;
924
+ }
921
925
  function it(t, e, n) {
922
926
  const i = document.createElement(t);
923
927
  return e && (i.className = e), n && n.appendChild(i), i;
924
928
  }
925
- class Fe {
929
+ function _e() {
930
+ return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
931
+ }
932
+ let ut = null;
933
+ function qe() {
934
+ return ut || (ut = _e()), ut;
935
+ }
936
+ async function Me(t, e) {
937
+ if (!t.endpoint) return;
938
+ const n = {
939
+ ...e,
940
+ user_id: t.userId,
941
+ session_id: qe(),
942
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
943
+ };
944
+ try {
945
+ const i = await fetch(t.endpoint, {
946
+ method: "POST",
947
+ headers: { "Content-Type": "application/json" },
948
+ body: JSON.stringify(n)
949
+ });
950
+ t.debug && (i.ok ? console.log("[Trailguide Analytics]", n) : console.error(`[Trailguide Analytics] Server error: ${i.status}`));
951
+ } catch (i) {
952
+ t.debug && console.error("[Trailguide Analytics] Failed:", i);
953
+ }
954
+ }
955
+ class Ne {
926
956
  constructor(e = {}) {
927
- I(this, "trail", null);
928
- I(this, "currentStepIndex", 0);
929
- I(this, "isActive", !1);
930
- I(this, "options", {});
957
+ k(this, "trail", null);
958
+ k(this, "currentStepIndex", 0);
959
+ k(this, "isActive", !1);
960
+ k(this, "options", {});
931
961
  // DOM elements
932
- I(this, "overlay", null);
933
- I(this, "tooltip", null);
934
- I(this, "arrowEl", null);
962
+ k(this, "overlay", null);
963
+ k(this, "tooltip", null);
964
+ k(this, "arrowEl", null);
935
965
  // Cleanup functions
936
- I(this, "cleanupFns", []);
966
+ k(this, "cleanupFns", []);
967
+ k(this, "stepCleanupFns", []);
968
+ k(this, "instanceId", `trailguide-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`);
937
969
  this.options = e;
938
970
  }
939
971
  start(e) {
940
- this.trail = e, this.currentStepIndex = 0, this.isActive = !0, this.createOverlay(), this.showStep(), this.bindKeyboard();
972
+ this.trail = e, this.currentStepIndex = 0, this.isActive = !0, this.createOverlay(), this.showStep(), this.bindKeyboard(), this.emitAnalytics("trail_started");
941
973
  }
942
974
  stop() {
943
975
  this.isActive = !1, this.cleanup();
944
976
  }
945
977
  next() {
946
- !this.trail || !this.isActive || (this.currentStepIndex < this.trail.steps.length - 1 ? (this.currentStepIndex++, this.showStep()) : this.complete());
978
+ !this.trail || !this.isActive || (this.emitAnalytics("step_completed"), this.currentStepIndex < this.trail.steps.length - 1 ? (this.currentStepIndex++, this.showStep()) : this.complete());
947
979
  }
948
980
  prev() {
949
981
  !this.trail || !this.isActive || this.currentStepIndex > 0 && (this.currentStepIndex--, this.showStep());
950
982
  }
951
983
  skip() {
952
984
  var e, n;
953
- this.isActive = !1, this.cleanup(), (n = (e = this.options).onSkip) == null || n.call(e);
985
+ this.emitAnalytics("trail_skipped"), this.isActive = !1, this.cleanup(), (n = (e = this.options).onSkip) == null || n.call(e);
954
986
  }
955
987
  goToStep(e) {
956
988
  !this.trail || !this.isActive || e >= 0 && e < this.trail.steps.length && (this.currentStepIndex = e, this.showStep());
957
989
  }
958
990
  complete() {
959
991
  var e, n;
960
- this.isActive = !1, this.cleanup(), (n = (e = this.options).onComplete) == null || n.call(e);
992
+ this.emitAnalytics("trail_completed"), this.isActive = !1, this.cleanup(), (n = (e = this.options).onComplete) == null || n.call(e);
961
993
  }
962
994
  createOverlay() {
963
- var n, i, o;
995
+ var i, o, s;
964
996
  this.overlay = it("div", "trailguide-overlay"), document.body.appendChild(this.overlay);
965
- const e = it("div", "trailguide-spotlight", this.overlay);
997
+ const e = it("div", "trailguide-spotlight", this.overlay), n = `${this.instanceId}-mask`;
966
998
  e.innerHTML = `
967
999
  <svg width="100%" height="100%">
968
1000
  <defs>
969
- <mask id="trailguide-mask">
1001
+ <mask id="${n}">
970
1002
  <rect x="0" y="0" width="100%" height="100%" fill="white" />
971
1003
  <rect class="trailguide-cutout" rx="4" fill="black" />
972
1004
  </mask>
973
1005
  </defs>
974
- <rect x="0" y="0" width="100%" height="100%" fill="rgba(0,0,0,0.5)" mask="url(#trailguide-mask)" />
1006
+ <rect x="0" y="0" width="100%" height="100%" mask="url(#${n})" />
975
1007
  </svg>
976
1008
  `, it("div", "trailguide-highlight", this.overlay), this.tooltip = it("div", "trailguide-tooltip"), this.tooltip.innerHTML = `
977
1009
  <div class="trailguide-tooltip-content">
@@ -989,22 +1021,37 @@ class Fe {
989
1021
  </div>
990
1022
  <div class="trailguide-tooltip-arrow"></div>
991
1023
  </div>
992
- `, document.body.appendChild(this.tooltip), this.arrowEl = this.tooltip.querySelector(".trailguide-tooltip-arrow"), (n = this.tooltip.querySelector(".trailguide-tooltip-close")) == null || n.addEventListener("click", () => this.skip()), (i = this.tooltip.querySelector(".trailguide-btn-prev")) == null || i.addEventListener("click", () => this.prev()), (o = this.tooltip.querySelector(".trailguide-btn-next")) == null || o.addEventListener("click", () => this.next());
1024
+ `, document.body.appendChild(this.tooltip), this.arrowEl = this.tooltip.querySelector(".trailguide-tooltip-arrow"), (i = this.tooltip.querySelector(".trailguide-tooltip-close")) == null || i.addEventListener("click", () => this.skip()), (o = this.tooltip.querySelector(".trailguide-btn-prev")) == null || o.addEventListener("click", () => this.prev()), (s = this.tooltip.querySelector(".trailguide-btn-next")) == null || s.addEventListener("click", () => this.next());
993
1025
  }
994
1026
  showStep() {
995
1027
  if (!this.trail || !this.overlay || !this.tooltip) return;
996
- const e = this.trail.steps[this.currentStepIndex];
997
- if (!e) return;
998
- const n = Bt(e.target);
999
- if (!n || !Vt(n)) {
1000
- console.warn(`[Trailguide] Target not found or not visible: ${e.target}`);
1028
+ this.stepCleanupFns.forEach((s) => s()), this.stepCleanupFns = [], this.tooltip.style.transform = "";
1029
+ const e = this.overlay.querySelector(".trailguide-spotlight"), n = this.overlay.querySelector(".trailguide-highlight");
1030
+ e && (e.style.display = ""), n && (n.style.display = "");
1031
+ const i = this.trail.steps[this.currentStepIndex];
1032
+ if (!i) return;
1033
+ this.emitAnalytics("step_viewed");
1034
+ const o = _t(i.target);
1035
+ if (!o || !qt(o)) {
1036
+ console.warn(`[Trailguide] Target not found or not visible: ${i.target}`), this.showErrorState(i);
1001
1037
  return;
1002
1038
  }
1003
- Ie(n), setTimeout(() => {
1004
- var i, o;
1005
- this.updateSpotlight(n), this.updateTooltip(e, n), (o = (i = this.options).onStepChange) == null || o.call(i, e, this.currentStepIndex);
1039
+ Fe(o), setTimeout(() => {
1040
+ var s, r;
1041
+ this.updateSpotlight(o), this.updateTooltip(i, o), (r = (s = this.options).onStepChange) == null || r.call(s, i, this.currentStepIndex);
1006
1042
  }, 100);
1007
1043
  }
1044
+ showErrorState(e) {
1045
+ var f, h;
1046
+ if (!this.tooltip || !this.trail) return;
1047
+ const n = (f = this.overlay) == null ? void 0 : f.querySelector(".trailguide-spotlight"), i = (h = this.overlay) == null ? void 0 : h.querySelector(".trailguide-highlight");
1048
+ n && (n.style.display = "none"), i && (i.style.display = "none");
1049
+ const o = this.tooltip.querySelector(".trailguide-tooltip-title"), s = this.tooltip.querySelector(".trailguide-tooltip-body"), r = this.tooltip.querySelector(".trailguide-tooltip-progress"), l = this.tooltip.querySelector(".trailguide-btn-prev"), c = this.tooltip.querySelector(".trailguide-btn-next"), a = this.currentStepIndex === 0, d = this.currentStepIndex === this.trail.steps.length - 1;
1050
+ o && (o.textContent = "Element Not Found"), s && (s.innerHTML = `
1051
+ <p style="color: #ef4444; margin: 0 0 8px 0;">Could not find: <code style="background: #fee2e2; padding: 2px 6px; border-radius: 4px; font-size: 12px;">${Be(e.target)}</code></p>
1052
+ <p style="margin: 0; font-size: 13px; color: #6b7280;">The target element doesn't exist on this page. Press <kbd style="background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 11px;">Esc</kbd> to close or skip to the next step.</p>
1053
+ `), r && (r.textContent = `${this.currentStepIndex + 1} of ${this.trail.steps.length}`), l && (l.style.display = a ? "none" : "block"), c && (c.textContent = d ? "Close" : "Skip Step"), this.tooltip.style.left = "50%", this.tooltip.style.top = "50%", this.tooltip.style.transform = "translate(-50%, -50%)";
1054
+ }
1008
1055
  updateSpotlight(e) {
1009
1056
  if (!this.overlay) return;
1010
1057
  const n = e.getBoundingClientRect(), i = 8, o = this.overlay.querySelector(".trailguide-cutout");
@@ -1016,7 +1063,7 @@ class Fe {
1016
1063
  const l = e.getBoundingClientRect();
1017
1064
  o && (o.setAttribute("x", String(l.left - i)), o.setAttribute("y", String(l.top - i)), o.setAttribute("width", String(l.width + i * 2)), o.setAttribute("height", String(l.height + i * 2))), s && (s.style.top = `${l.top - i}px`, s.style.left = `${l.left - i}px`, s.style.width = `${l.width + i * 2}px`, s.style.height = `${l.height + i * 2}px`);
1018
1065
  };
1019
- window.addEventListener("scroll", r, !0), window.addEventListener("resize", r), this.cleanupFns.push(() => {
1066
+ window.addEventListener("scroll", r, !0), window.addEventListener("resize", r), this.stepCleanupFns.push(() => {
1020
1067
  window.removeEventListener("scroll", r, !0), window.removeEventListener("resize", r);
1021
1068
  });
1022
1069
  }
@@ -1024,18 +1071,18 @@ class Fe {
1024
1071
  if (!this.tooltip || !this.trail || !this.arrowEl) return;
1025
1072
  const i = this.currentStepIndex === 0, o = this.currentStepIndex === this.trail.steps.length - 1, s = this.tooltip.querySelector(".trailguide-tooltip-title"), r = this.tooltip.querySelector(".trailguide-tooltip-body"), l = this.tooltip.querySelector(".trailguide-tooltip-progress"), c = this.tooltip.querySelector(".trailguide-btn-prev"), a = this.tooltip.querySelector(".trailguide-btn-next");
1026
1073
  s && (s.textContent = e.title), r && (r.textContent = e.content), l && (l.textContent = `${this.currentStepIndex + 1} of ${this.trail.steps.length}`), c && (c.style.display = i ? "none" : "block"), a && (a.textContent = o ? "Finish" : "Next");
1027
- const { x: d, y: u, middlewareData: p } = await De(n, this.tooltip, {
1074
+ const { x: d, y: f, placement: h, middlewareData: u } = await De(n, this.tooltip, {
1028
1075
  placement: e.placement,
1029
1076
  middleware: [
1030
- Le(12),
1031
- $e(),
1032
- ke({ padding: 8 }),
1077
+ $e(12),
1078
+ Ie(),
1079
+ Re({ padding: 8 }),
1033
1080
  Pe({ element: this.arrowEl })
1034
1081
  ]
1035
1082
  });
1036
- if (this.tooltip.style.left = `${d}px`, this.tooltip.style.top = `${u}px`, p.arrow && this.arrowEl) {
1037
- const { x: f, y: h } = p.arrow;
1038
- this.arrowEl.style.left = f != null ? `${f}px` : "", this.arrowEl.style.top = h != null ? `${h}px` : "";
1083
+ if (this.tooltip.style.left = `${d}px`, this.tooltip.style.top = `${f}px`, this.tooltip.dataset.placement = h, u.arrow && this.arrowEl) {
1084
+ const { x: p, y: g } = u.arrow;
1085
+ this.arrowEl.style.left = p != null ? `${p}px` : "", this.arrowEl.style.top = g != null ? `${g}px` : "";
1039
1086
  }
1040
1087
  }
1041
1088
  bindKeyboard() {
@@ -1058,26 +1105,77 @@ class Fe {
1058
1105
  }
1059
1106
  cleanup() {
1060
1107
  var e, n;
1061
- this.cleanupFns.forEach((i) => i()), this.cleanupFns = [], (e = this.overlay) == null || e.remove(), (n = this.tooltip) == null || n.remove(), this.overlay = null, this.tooltip = null;
1108
+ this.stepCleanupFns.forEach((i) => i()), this.stepCleanupFns = [], this.cleanupFns.forEach((i) => i()), this.cleanupFns = [], (e = this.overlay) == null || e.remove(), (n = this.tooltip) == null || n.remove(), this.overlay = null, this.tooltip = null, this.arrowEl = null;
1109
+ }
1110
+ emitAnalytics(e) {
1111
+ if (!this.options.analytics || !this.trail) return;
1112
+ const n = this.trail.steps[this.currentStepIndex], i = this.options.analytics.trailId || this.trail.id;
1113
+ Me(this.options.analytics, {
1114
+ event_type: e,
1115
+ trail_id: i,
1116
+ step_id: n == null ? void 0 : n.id,
1117
+ step_index: this.currentStepIndex
1118
+ });
1062
1119
  }
1063
1120
  }
1064
1121
  let b = null;
1065
- function Ne(t, e) {
1066
- return b && b.stop(), b = new Fe(e), b.start(t), b;
1122
+ function He(t, e) {
1123
+ return b && b.stop(), b = new Ne(e), b.start(t), b;
1067
1124
  }
1068
- function We() {
1069
- b == null || b.stop();
1125
+ function ze() {
1126
+ b == null || b.stop(), b = null;
1070
1127
  }
1071
- function Me() {
1128
+ function Xe() {
1072
1129
  b == null || b.next();
1073
1130
  }
1074
- function qe() {
1131
+ function je() {
1075
1132
  b == null || b.prev();
1076
1133
  }
1077
- function _e() {
1078
- b == null || b.skip();
1079
- }
1080
- function He(t) {
1134
+ function Ye() {
1135
+ b == null || b.skip(), b = null;
1136
+ }
1137
+ const Ke = {
1138
+ // Backgrounds
1139
+ bgBase: "#0f172a",
1140
+ bgCard: "#1e293b",
1141
+ bgGlass: "rgba(255,255,255,0.06)",
1142
+ bgInput: "rgba(255,255,255,0.03)",
1143
+ // Text
1144
+ textPrimary: "#f8fafc",
1145
+ textSecondary: "#e2e8f0",
1146
+ textTertiary: "#cbd5e1",
1147
+ textMuted: "#94a3b8",
1148
+ textFaint: "#64748b",
1149
+ // Borders
1150
+ borderSubtle: "rgba(255,255,255,0.06)",
1151
+ borderPanel: "rgba(255,255,255,0.08)",
1152
+ borderControl: "rgba(255,255,255,0.1)",
1153
+ // Brand / accent
1154
+ accent: "#1a91a2",
1155
+ accentBg: "rgba(26,145,162,0.15)",
1156
+ accentBorder: "rgba(26,145,162,0.3)",
1157
+ // Error / recording
1158
+ error: "#ef4444",
1159
+ errorBg: "rgba(239,68,68,0.1)",
1160
+ errorBorder: "rgba(239,68,68,0.3)",
1161
+ errorLight: "rgba(248,113,113,0.1)",
1162
+ errorText: "#fca5a5",
1163
+ // Success
1164
+ success: "#10b981",
1165
+ successBg: "rgba(16,185,129,0.1)",
1166
+ successBorder: "rgba(16,185,129,0.3)",
1167
+ successText: "#6ee7b7",
1168
+ // Warning
1169
+ warningBg: "rgba(234,179,8,0.1)",
1170
+ // Disabled
1171
+ disabled: "#9ca3af",
1172
+ disabledBg: "#4b5563",
1173
+ // Shadows
1174
+ shadowLight: "0 4px 12px rgba(0,0,0,0.15)",
1175
+ shadowMedium: "0 4px 20px rgba(0,0,0,0.4)",
1176
+ shadowOverlay: "rgba(0,0,0,0.3)"
1177
+ };
1178
+ function Ge(t) {
1081
1179
  const e = [], n = [];
1082
1180
  return t.id || e.push({
1083
1181
  stepId: "",
@@ -1104,8 +1202,8 @@ function He(t) {
1104
1202
  });
1105
1203
  return;
1106
1204
  }
1107
- const s = Bt(i.target);
1108
- s ? Vt(s) || n.push({
1205
+ const s = _t(i.target);
1206
+ s ? qt(s) || n.push({
1109
1207
  stepId: i.id,
1110
1208
  stepIndex: o,
1111
1209
  type: "hidden_target",
@@ -1117,7 +1215,7 @@ function He(t) {
1117
1215
  type: "missing_target",
1118
1216
  message: `Step ${o + 1} ("${i.title}"): Target element not found`,
1119
1217
  selector: i.target
1120
- }), i.target && Be(i.target) && n.push({
1218
+ }), i.target && Ve(i.target) && n.push({
1121
1219
  stepId: i.id,
1122
1220
  stepIndex: o,
1123
1221
  type: "unstable_selector",
@@ -1130,10 +1228,10 @@ function He(t) {
1130
1228
  warnings: n
1131
1229
  });
1132
1230
  }
1133
- function Be(t) {
1231
+ function Ve(t) {
1134
1232
  return t.startsWith("#") || t.includes("[data-") ? !1 : !!(t.includes(":nth-child") || t.includes(":nth-of-type") || /^\.[a-z]+-[a-z0-9]+$/i.test(t));
1135
1233
  }
1136
- function Xe(t) {
1234
+ function Je(t) {
1137
1235
  if (t.valid && t.warnings.length === 0) {
1138
1236
  console.log("%c✓ Trail validation passed", "color: green; font-weight: bold");
1139
1237
  return;
@@ -1145,15 +1243,16 @@ function Xe(t) {
1145
1243
  }), console.groupEnd());
1146
1244
  }
1147
1245
  export {
1148
- Fe as Trailguide,
1149
- Bt as findElement,
1150
- Vt as isElementVisible,
1151
- Xe as logValidationResults,
1152
- Me as next,
1153
- qe as prev,
1154
- Ie as scrollToElement,
1155
- _e as skip,
1156
- Ne as start,
1157
- We as stop,
1158
- He as validateTrail
1246
+ Ne as Trailguide,
1247
+ _t as findElement,
1248
+ qt as isElementVisible,
1249
+ Je as logValidationResults,
1250
+ Xe as next,
1251
+ je as prev,
1252
+ Fe as scrollToElement,
1253
+ Ye as skip,
1254
+ He as start,
1255
+ ze as stop,
1256
+ Ke as theme,
1257
+ Ge as validateTrail
1159
1258
  };