@levo-so/react 0.1.65 → 0.1.71

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.
package/dist/index.js CHANGED
@@ -1,967 +1,351 @@
1
1
  "use client";
2
- import * as D from "react";
3
- import I, { createContext as ot, useContext as ge, useState as N, useEffect as k, useRef as H, useCallback as ee, useMemo as me } from "react";
4
- import { clsx as st } from "clsx";
5
- import { twMerge as Pe } from "tailwind-merge";
6
- import { getLevoError as U } from "@levo-so/core";
7
- import { usePageLifecycle as it, LifecycleState as ke } from "use-page-lifecycle";
8
- import { Slot as at, Dialog as j, Tabs as W, Tooltip as z } from "radix-ui";
9
- import { cva as ct } from "class-variance-authority";
10
- import { X as lt } from "lucide-react";
11
- import { Toaster as ut, toast as de } from "sonner";
12
- import { toast as In } from "sonner";
13
- var K = { exports: {} }, G = {};
14
- var _e;
15
- function dt() {
16
- if (_e) return G;
17
- _e = 1;
2
+ import * as _ from "react";
3
+ import R, { createContext as Le, useContext as K, useState as P, useEffect as O, useMemo as fe, useRef as me, useCallback as X } from "react";
4
+ import { clsx as Ie } from "clsx";
5
+ import { twMerge as pe } from "tailwind-merge";
6
+ import { Slot as De, Dialog as y, Tabs as k, Tooltip as A } from "radix-ui";
7
+ import { cva as $e } from "class-variance-authority";
8
+ import { X as We } from "lucide-react";
9
+ import { Toaster as Me, toast as q } from "sonner";
10
+ import { toast as nr } from "sonner";
11
+ import { getLevoError as ge } from "@levo-so/core";
12
+ var M = { exports: {} }, I = {};
13
+ var ie;
14
+ function Be() {
15
+ if (ie) return I;
16
+ ie = 1;
18
17
  var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
19
- function r(n, o, i) {
18
+ function r(n, s, a) {
20
19
  var l = null;
21
- if (i !== void 0 && (l = "" + i), o.key !== void 0 && (l = "" + o.key), "key" in o) {
22
- i = {};
23
- for (var c in o)
24
- c !== "key" && (i[c] = o[c]);
25
- } else i = o;
26
- return o = i.ref, {
20
+ if (a !== void 0 && (l = "" + a), s.key !== void 0 && (l = "" + s.key), "key" in s) {
21
+ a = {};
22
+ for (var u in s)
23
+ u !== "key" && (a[u] = s[u]);
24
+ } else a = s;
25
+ return s = a.ref, {
27
26
  $$typeof: e,
28
27
  type: n,
29
28
  key: l,
30
- ref: o !== void 0 ? o : null,
31
- props: i
29
+ ref: s !== void 0 ? s : null,
30
+ props: a
32
31
  };
33
32
  }
34
- return G.Fragment = t, G.jsx = r, G.jsxs = r, G;
35
- }
36
- var X = {};
37
- var Se;
38
- function ft() {
39
- return Se || (Se = 1, process.env.NODE_ENV !== "production" && function() {
40
- function e(s) {
41
- if (s == null) return null;
42
- if (typeof s == "function")
43
- return s.$$typeof === tt ? null : s.displayName || s.name || null;
44
- if (typeof s == "string") return s;
45
- switch (s) {
46
- case x:
33
+ return I.Fragment = t, I.jsx = r, I.jsxs = r, I;
34
+ }
35
+ var D = {};
36
+ var ce;
37
+ function Fe() {
38
+ return ce || (ce = 1, process.env.NODE_ENV !== "production" && (function() {
39
+ function e(o) {
40
+ if (o == null) return null;
41
+ if (typeof o == "function")
42
+ return o.$$typeof === Ce ? null : o.displayName || o.name || null;
43
+ if (typeof o == "string") return o;
44
+ switch (o) {
45
+ case N:
47
46
  return "Fragment";
48
- case w:
47
+ case h:
49
48
  return "Profiler";
50
- case C:
49
+ case L:
51
50
  return "StrictMode";
52
- case v:
51
+ case _e:
53
52
  return "Suspense";
54
- case L:
53
+ case Ne:
55
54
  return "SuspenseList";
56
- case et:
55
+ case ke:
57
56
  return "Activity";
58
57
  }
59
- if (typeof s == "object")
60
- switch (typeof s.tag == "number" && console.error(
58
+ if (typeof o == "object")
59
+ switch (typeof o.tag == "number" && console.error(
61
60
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
62
- ), s.$$typeof) {
63
- case O:
61
+ ), o.$$typeof) {
62
+ case C:
64
63
  return "Portal";
65
- case P:
66
- return s.displayName || "Context";
67
- case _:
68
- return (s._context.displayName || "Context") + ".Consumer";
69
- case M:
70
- var f = s.render;
71
- return s = s.displayName, s || (s = f.displayName || f.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
72
- case A:
73
- return f = s.displayName || null, f !== null ? f : e(s.type) || "Memo";
74
- case F:
75
- f = s._payload, s = s._init;
64
+ case $:
65
+ return o.displayName || "Context";
66
+ case x:
67
+ return (o._context.displayName || "Context") + ".Consumer";
68
+ case Re:
69
+ var i = o.render;
70
+ return o = o.displayName, o || (o = i.displayName || i.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
71
+ case Pe:
72
+ return i = o.displayName || null, i !== null ? i : e(o.type) || "Memo";
73
+ case Y:
74
+ i = o._payload, o = o._init;
76
75
  try {
77
- return e(s(f));
76
+ return e(o(i));
78
77
  } catch {
79
78
  }
80
79
  }
81
80
  return null;
82
81
  }
83
- function t(s) {
84
- return "" + s;
82
+ function t(o) {
83
+ return "" + o;
85
84
  }
86
- function r(s) {
85
+ function r(o) {
87
86
  try {
88
- t(s);
89
- var f = !1;
87
+ t(o);
88
+ var i = !1;
90
89
  } catch {
91
- f = !0;
90
+ i = !0;
92
91
  }
93
- if (f) {
94
- f = console;
95
- var y = f.error, T = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
96
- return y.call(
97
- f,
92
+ if (i) {
93
+ i = console;
94
+ var m = i.error, g = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
95
+ return m.call(
96
+ i,
98
97
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
99
- T
100
- ), t(s);
98
+ g
99
+ ), t(o);
101
100
  }
102
101
  }
103
- function n(s) {
104
- if (s === x) return "<>";
105
- if (typeof s == "object" && s !== null && s.$$typeof === F)
102
+ function n(o) {
103
+ if (o === N) return "<>";
104
+ if (typeof o == "object" && o !== null && o.$$typeof === Y)
106
105
  return "<...>";
107
106
  try {
108
- var f = e(s);
109
- return f ? "<" + f + ">" : "<...>";
107
+ var i = e(o);
108
+ return i ? "<" + i + ">" : "<...>";
110
109
  } catch {
111
110
  return "<...>";
112
111
  }
113
112
  }
114
- function o() {
115
- var s = se.A;
116
- return s === null ? null : s.getOwner();
113
+ function s() {
114
+ var o = V.A;
115
+ return o === null ? null : o.getOwner();
117
116
  }
118
- function i() {
117
+ function a() {
119
118
  return Error("react-stack-top-frame");
120
119
  }
121
- function l(s) {
122
- if (ve.call(s, "key")) {
123
- var f = Object.getOwnPropertyDescriptor(s, "key").get;
124
- if (f && f.isReactWarning) return !1;
120
+ function l(o) {
121
+ if (te.call(o, "key")) {
122
+ var i = Object.getOwnPropertyDescriptor(o, "key").get;
123
+ if (i && i.isReactWarning) return !1;
125
124
  }
126
- return s.key !== void 0;
125
+ return o.key !== void 0;
127
126
  }
128
- function c(s, f) {
129
- function y() {
130
- ye || (ye = !0, console.error(
127
+ function u(o, i) {
128
+ function m() {
129
+ re || (re = !0, console.error(
131
130
  "%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)",
132
- f
131
+ i
133
132
  ));
134
133
  }
135
- y.isReactWarning = !0, Object.defineProperty(s, "key", {
136
- get: y,
134
+ m.isReactWarning = !0, Object.defineProperty(o, "key", {
135
+ get: m,
137
136
  configurable: !0
138
137
  });
139
138
  }
140
- function a() {
141
- var s = e(this.type);
142
- return we[s] || (we[s] = !0, console.error(
139
+ function f() {
140
+ var o = e(this.type);
141
+ return oe[o] || (oe[o] = !0, console.error(
143
142
  "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."
144
- )), s = this.props.ref, s !== void 0 ? s : null;
143
+ )), o = this.props.ref, o !== void 0 ? o : null;
145
144
  }
146
- function d(s, f, y, T, q, ae) {
147
- var E = y.ref;
148
- return s = {
149
- $$typeof: h,
150
- type: s,
151
- key: f,
152
- props: y,
153
- _owner: T
154
- }, (E !== void 0 ? E : null) !== null ? Object.defineProperty(s, "ref", {
145
+ function b(o, i, m, g, W, H) {
146
+ var v = m.ref;
147
+ return o = {
148
+ $$typeof: E,
149
+ type: o,
150
+ key: i,
151
+ props: m,
152
+ _owner: g
153
+ }, (v !== void 0 ? v : null) !== null ? Object.defineProperty(o, "ref", {
155
154
  enumerable: !1,
156
- get: a
157
- }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
155
+ get: f
156
+ }) : Object.defineProperty(o, "ref", { enumerable: !1, value: null }), o._store = {}, Object.defineProperty(o._store, "validated", {
158
157
  configurable: !1,
159
158
  enumerable: !1,
160
159
  writable: !0,
161
160
  value: 0
162
- }), Object.defineProperty(s, "_debugInfo", {
161
+ }), Object.defineProperty(o, "_debugInfo", {
163
162
  configurable: !1,
164
163
  enumerable: !1,
165
164
  writable: !0,
166
165
  value: null
167
- }), Object.defineProperty(s, "_debugStack", {
166
+ }), Object.defineProperty(o, "_debugStack", {
168
167
  configurable: !1,
169
168
  enumerable: !1,
170
169
  writable: !0,
171
- value: q
172
- }), Object.defineProperty(s, "_debugTask", {
170
+ value: W
171
+ }), Object.defineProperty(o, "_debugTask", {
173
172
  configurable: !1,
174
173
  enumerable: !1,
175
174
  writable: !0,
176
- value: ae
177
- }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
175
+ value: H
176
+ }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
178
177
  }
179
- function p(s, f, y, T, q, ae) {
180
- var E = f.children;
181
- if (E !== void 0)
182
- if (T)
183
- if (rt(E)) {
184
- for (T = 0; T < E.length; T++)
185
- u(E[T]);
186
- Object.freeze && Object.freeze(E);
178
+ function p(o, i, m, g, W, H) {
179
+ var v = i.children;
180
+ if (v !== void 0)
181
+ if (g)
182
+ if (Se(v)) {
183
+ for (g = 0; g < v.length; g++)
184
+ d(v[g]);
185
+ Object.freeze && Object.freeze(v);
187
186
  } else
188
187
  console.error(
189
188
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
190
189
  );
191
- else u(E);
192
- if (ve.call(f, "key")) {
193
- E = e(s);
194
- var B = Object.keys(f).filter(function(nt) {
195
- return nt !== "key";
190
+ else d(v);
191
+ if (te.call(i, "key")) {
192
+ v = e(o);
193
+ var S = Object.keys(i).filter(function(Ae) {
194
+ return Ae !== "key";
196
195
  });
197
- T = 0 < B.length ? "{key: someKey, " + B.join(": ..., ") + ": ...}" : "{key: someKey}", Ee[E + T] || (B = 0 < B.length ? "{" + B.join(": ..., ") + ": ...}" : "{}", console.error(
196
+ g = 0 < S.length ? "{key: someKey, " + S.join(": ..., ") + ": ...}" : "{key: someKey}", ae[v + g] || (S = 0 < S.length ? "{" + S.join(": ..., ") + ": ...}" : "{}", console.error(
198
197
  `A props object containing a "key" prop is being spread into JSX:
199
198
  let props = %s;
200
199
  <%s {...props} />
201
200
  React keys must be passed directly to JSX without using spread:
202
201
  let props = %s;
203
202
  <%s key={someKey} {...props} />`,
204
- T,
205
- E,
206
- B,
207
- E
208
- ), Ee[E + T] = !0);
203
+ g,
204
+ v,
205
+ S,
206
+ v
207
+ ), ae[v + g] = !0);
209
208
  }
210
- if (E = null, y !== void 0 && (r(y), E = "" + y), l(f) && (r(f.key), E = "" + f.key), "key" in f) {
211
- y = {};
212
- for (var ce in f)
213
- ce !== "key" && (y[ce] = f[ce]);
214
- } else y = f;
215
- return E && c(
216
- y,
217
- typeof s == "function" ? s.displayName || s.name || "Unknown" : s
218
- ), d(
219
- s,
220
- E,
221
- y,
222
- o(),
223
- q,
224
- ae
209
+ if (v = null, m !== void 0 && (r(m), v = "" + m), l(i) && (r(i.key), v = "" + i.key), "key" in i) {
210
+ m = {};
211
+ for (var J in i)
212
+ J !== "key" && (m[J] = i[J]);
213
+ } else m = i;
214
+ return v && u(
215
+ m,
216
+ typeof o == "function" ? o.displayName || o.name || "Unknown" : o
217
+ ), b(
218
+ o,
219
+ v,
220
+ m,
221
+ s(),
222
+ W,
223
+ H
225
224
  );
226
225
  }
227
- function u(s) {
228
- m(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === F && (s._payload.status === "fulfilled" ? m(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
226
+ function d(o) {
227
+ T(o) ? o._store && (o._store.validated = 1) : typeof o == "object" && o !== null && o.$$typeof === Y && (o._payload.status === "fulfilled" ? T(o._payload.value) && o._payload.value._store && (o._payload.value._store.validated = 1) : o._store && (o._store.validated = 1));
229
228
  }
230
- function m(s) {
231
- return typeof s == "object" && s !== null && s.$$typeof === h;
229
+ function T(o) {
230
+ return typeof o == "object" && o !== null && o.$$typeof === E;
232
231
  }
233
- var b = I, h = Symbol.for("react.transitional.element"), O = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), w = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), P = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), L = Symbol.for("react.suspense_list"), A = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), et = Symbol.for("react.activity"), tt = Symbol.for("react.client.reference"), se = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ve = Object.prototype.hasOwnProperty, rt = Array.isArray, ie = console.createTask ? console.createTask : function() {
232
+ var w = R, E = Symbol.for("react.transitional.element"), C = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), L = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), Re = Symbol.for("react.forward_ref"), _e = Symbol.for("react.suspense"), Ne = Symbol.for("react.suspense_list"), Pe = Symbol.for("react.memo"), Y = Symbol.for("react.lazy"), ke = Symbol.for("react.activity"), Ce = Symbol.for("react.client.reference"), V = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, te = Object.prototype.hasOwnProperty, Se = Array.isArray, G = console.createTask ? console.createTask : function() {
234
233
  return null;
235
234
  };
236
- b = {
237
- react_stack_bottom_frame: function(s) {
238
- return s();
235
+ w = {
236
+ react_stack_bottom_frame: function(o) {
237
+ return o();
239
238
  }
240
239
  };
241
- var ye, we = {}, xe = b.react_stack_bottom_frame.bind(
242
- b,
243
- i
244
- )(), Te = ie(n(i)), Ee = {};
245
- X.Fragment = x, X.jsx = function(s, f, y) {
246
- var T = 1e4 > se.recentlyCreatedOwnerStacks++;
240
+ var re, oe = {}, ne = w.react_stack_bottom_frame.bind(
241
+ w,
242
+ a
243
+ )(), se = G(n(a)), ae = {};
244
+ D.Fragment = N, D.jsx = function(o, i, m) {
245
+ var g = 1e4 > V.recentlyCreatedOwnerStacks++;
247
246
  return p(
248
- s,
249
- f,
250
- y,
247
+ o,
248
+ i,
249
+ m,
251
250
  !1,
252
- T ? Error("react-stack-top-frame") : xe,
253
- T ? ie(n(s)) : Te
251
+ g ? Error("react-stack-top-frame") : ne,
252
+ g ? G(n(o)) : se
254
253
  );
255
- }, X.jsxs = function(s, f, y) {
256
- var T = 1e4 > se.recentlyCreatedOwnerStacks++;
254
+ }, D.jsxs = function(o, i, m) {
255
+ var g = 1e4 > V.recentlyCreatedOwnerStacks++;
257
256
  return p(
258
- s,
259
- f,
260
- y,
257
+ o,
258
+ i,
259
+ m,
261
260
  !0,
262
- T ? Error("react-stack-top-frame") : xe,
263
- T ? ie(n(s)) : Te
261
+ g ? Error("react-stack-top-frame") : ne,
262
+ g ? G(n(o)) : se
264
263
  );
265
264
  };
266
- }()), X;
265
+ })()), D;
267
266
  }
268
- var Oe;
269
- function gt() {
270
- return Oe || (Oe = 1, process.env.NODE_ENV === "production" ? K.exports = dt() : K.exports = ft()), K.exports;
267
+ var le;
268
+ function ze() {
269
+ return le || (le = 1, process.env.NODE_ENV === "production" ? M.exports = Be() : M.exports = Fe()), M.exports;
271
270
  }
272
- var g = gt();
273
- const pe = ot({
271
+ var c = ze();
272
+ const Z = Le({
274
273
  client: null,
275
274
  insights: null
276
- }), mn = ({ children: e, client: t, insights: r = null }) => /* @__PURE__ */ g.jsx(pe.Provider, { value: { client: t, insights: r }, children: e }), V = () => {
277
- const e = ge(pe);
275
+ }), $t = ({ children: e, client: t, insights: r = null }) => /* @__PURE__ */ c.jsx(Z.Provider, { value: { client: t, insights: r }, children: e }), Q = () => {
276
+ const e = K(Z);
278
277
  if (!e.client)
279
278
  throw new Error(
280
279
  "useLevo must be used within a LevoProvider. Please ensure you have wrapped your component tree with LevoProvider."
281
280
  );
282
281
  return e.client;
283
- }, $ = () => ge(pe).insights, pn = ({ id: e, properties: t = {} }) => {
284
- const r = $(), [n, o] = N(!1);
285
- return k(() => {
282
+ }, ee = () => K(Z).insights, Wt = ({ id: e, properties: t = {} }) => {
283
+ const r = ee(), [n, s] = P(!1);
284
+ return O(() => {
286
285
  if (n || typeof r?.track != "function") return;
287
- const i = document.getElementById(e);
288
- if (!i) return;
286
+ const a = document.getElementById(e);
287
+ if (!a) return;
289
288
  const l = () => {
290
289
  n || (r?.track("block.view", {
291
290
  ...t,
292
291
  resource: "block",
293
292
  identifier: e
294
- }), o(!0));
293
+ }), s(!0));
295
294
  };
296
- if (((d) => {
297
- const p = d.getBoundingClientRect();
295
+ if (((b) => {
296
+ const p = b.getBoundingClientRect();
298
297
  return p.top >= 0 && p.left >= 0 && p.bottom <= (window.innerHeight || document.documentElement.clientHeight) && p.right <= (window.innerWidth || document.documentElement.clientWidth);
299
- })(i)) {
298
+ })(a)) {
300
299
  l();
301
300
  return;
302
301
  }
303
- const a = new IntersectionObserver(
304
- (d) => {
305
- d.forEach((p) => {
306
- p.isIntersecting && (l(), a.disconnect());
302
+ const f = new IntersectionObserver(
303
+ (b) => {
304
+ b.forEach((p) => {
305
+ p.isIntersecting && (l(), f.disconnect());
307
306
  });
308
307
  },
309
308
  { threshold: 0 }
310
309
  );
311
- return a.observe(i), () => {
312
- a.disconnect();
310
+ return f.observe(a), () => {
311
+ f.disconnect();
313
312
  };
314
313
  }, [r, e, t, n]), null;
315
- }, bn = ({ event: e, properties: t }) => {
316
- const r = $();
317
- return k(() => {
318
- r?.instance && r?.track(e, t);
314
+ }, Mt = ({ event: e, properties: t }) => {
315
+ const r = ee();
316
+ return O(() => {
317
+ r?.track(e, t);
319
318
  }, [r, e, t]), null;
320
- }, mt = ({ id: e }) => {
321
- const { logger: t } = V(), r = $(), n = H(!1), o = ee(
322
- (l) => {
323
- if (!n.current) {
324
- n.current = !0;
325
- try {
326
- r?.bounce({
327
- resource: "page",
328
- identifier: e,
329
- ...l
330
- });
331
- } catch (c) {
332
- t?.error("Failed to send bounce event", U(c));
333
- }
334
- }
335
- },
336
- [r, e, t]
337
- );
338
- k(() => {
339
- n.current = !1;
340
- const l = () => {
341
- const c = performance.getEntriesByType("navigation")?.[0];
342
- let a = !1;
343
- if (c)
344
- c.type === "navigate" && (a = !0);
345
- else
346
- try {
347
- const d = document.activeElement;
348
- d?.tagName === "A" && d.href && new URL(d.href).origin !== window.location.origin && (a = !0);
349
- } catch {
350
- }
351
- o({
352
- is_navigating_away: a,
353
- navigation_type: c?.type,
354
- trigger: "beforeunload"
355
- });
356
- };
357
- return window.addEventListener("beforeunload", l), () => {
358
- window.removeEventListener("beforeunload", l);
359
- };
360
- }, [o]);
361
- const [i] = it();
362
- k(() => {
363
- (i === ke.FROZEN || i === ke.TERMINATED) && o({
364
- state: i,
365
- trigger: "lifecycle"
366
- });
367
- }, [i, o]);
368
- }, pt = () => {
369
- const e = $(), [t, r] = N(null);
370
- return k(() => {
371
- if (!e) return;
372
- let n = sessionStorage.getItem(e.storage_keys.current_tab);
373
- const o = JSON.parse(localStorage.getItem(e.storage_keys.all_tabs) || "[]");
374
- n && o.includes(n) && (n = null), n || (n = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, sessionStorage.setItem(e.storage_keys.current_tab, n)), o.includes(n) || (o.push(n), localStorage.setItem(e.storage_keys.all_tabs, JSON.stringify(o))), r(n);
375
- const i = () => {
376
- const l = o.filter((c) => c !== n);
377
- localStorage.setItem(e.storage_keys.all_tabs, JSON.stringify(l));
378
- };
379
- return window.addEventListener("beforeunload", i), () => {
380
- window.removeEventListener("beforeunload", i);
381
- };
382
- }, [e]), t;
383
- }, bt = ({
384
- id: e,
385
- properties: t = {},
386
- href: r
387
- }) => {
388
- const n = V(), o = $();
389
- k(() => {
390
- (() => {
391
- o?.insightsUrl && n.workspace && r && (o?.instance ? o.instance.page({
392
- resource: "page",
393
- identifier: e
394
- }) : o?.initiate({
395
- ...t,
396
- id: e,
397
- created_at: (/* @__PURE__ */ new Date()).toISOString()
398
- }));
399
- })();
400
- }, [o, n?.workspace, r]);
401
- }, ht = () => {
402
- const e = $(), [t, r] = N(0);
403
- return k(() => {
404
- if (!e) return;
405
- const n = Number(localStorage.getItem(e?.storage_keys.open_tabs)) || 0;
406
- r(n), localStorage.setItem(e?.storage_keys.open_tabs, (n + 1).toString());
407
- const o = (l) => {
408
- l.key === e?.storage_keys.open_tabs && r(Number(l.newValue) || 0);
409
- };
410
- window.addEventListener("storage", o);
411
- const i = () => {
412
- const l = Number(localStorage.getItem(e?.storage_keys.open_tabs)) || 0;
413
- l > 0 && localStorage.setItem(e?.storage_keys.open_tabs, (l - 1).toString());
414
- };
415
- return window.addEventListener("beforeunload", i), () => {
416
- window.removeEventListener("storage", o), window.removeEventListener("beforeunload", i);
417
- };
418
- }, [e]), t;
419
- };
420
- function fe(e) {
421
- var t = typeof e;
422
- return e != null && (t == "object" || t == "function");
423
- }
424
- var vt = typeof global == "object" && global && global.Object === Object && global, yt = typeof self == "object" && self && self.Object === Object && self, Ae = vt || yt || Function("return this")(), le = function() {
425
- return Ae.Date.now();
426
- }, wt = /\s/;
427
- function xt(e) {
428
- for (var t = e.length; t-- && wt.test(e.charAt(t)); )
429
- ;
430
- return t;
431
- }
432
- var Tt = /^\s+/;
433
- function Et(e) {
434
- return e && e.slice(0, xt(e) + 1).replace(Tt, "");
435
- }
436
- var te = Ae.Symbol, Ie = Object.prototype, kt = Ie.hasOwnProperty, _t = Ie.toString, J = te ? te.toStringTag : void 0;
437
- function St(e) {
438
- var t = kt.call(e, J), r = e[J];
439
- try {
440
- e[J] = void 0;
441
- var n = !0;
442
- } catch {
443
- }
444
- var o = _t.call(e);
445
- return n && (t ? e[J] = r : delete e[J]), o;
446
- }
447
- var Ot = Object.prototype, Nt = Ot.toString;
448
- function jt(e) {
449
- return Nt.call(e);
450
- }
451
- var Ct = "[object Null]", Rt = "[object Undefined]", Ne = te ? te.toStringTag : void 0;
452
- function Lt(e) {
453
- return e == null ? e === void 0 ? Rt : Ct : Ne && Ne in Object(e) ? St(e) : jt(e);
454
- }
455
- function Pt(e) {
456
- return e != null && typeof e == "object";
457
- }
458
- var At = "[object Symbol]";
459
- function It(e) {
460
- return typeof e == "symbol" || Pt(e) && Lt(e) == At;
461
- }
462
- var je = NaN, Dt = /^[-+]0x[0-9a-f]+$/i, $t = /^0b[01]+$/i, Mt = /^0o[0-7]+$/i, Wt = parseInt;
463
- function Ce(e) {
464
- if (typeof e == "number")
465
- return e;
466
- if (It(e))
467
- return je;
468
- if (fe(e)) {
469
- var t = typeof e.valueOf == "function" ? e.valueOf() : e;
470
- e = fe(t) ? t + "" : t;
471
- }
472
- if (typeof e != "string")
473
- return e === 0 ? e : +e;
474
- e = Et(e);
475
- var r = $t.test(e);
476
- return r || Mt.test(e) ? Wt(e.slice(2), r ? 2 : 8) : Dt.test(e) ? je : +e;
477
- }
478
- var Ft = "Expected a function", Bt = Math.max, Ut = Math.min;
479
- function Yt(e, t, r) {
480
- var n, o, i, l, c, a, d = 0, p = !1, u = !1, m = !0;
481
- if (typeof e != "function")
482
- throw new TypeError(Ft);
483
- t = Ce(t) || 0, fe(r) && (p = !!r.leading, u = "maxWait" in r, i = u ? Bt(Ce(r.maxWait) || 0, t) : i, m = "trailing" in r ? !!r.trailing : m);
484
- function b(v) {
485
- var L = n, A = o;
486
- return n = o = void 0, d = v, l = e.apply(A, L), l;
487
- }
488
- function h(v) {
489
- return d = v, c = setTimeout(C, t), p ? b(v) : l;
490
- }
491
- function O(v) {
492
- var L = v - a, A = v - d, F = t - L;
493
- return u ? Ut(F, i - A) : F;
494
- }
495
- function x(v) {
496
- var L = v - a, A = v - d;
497
- return a === void 0 || L >= t || L < 0 || u && A >= i;
498
- }
499
- function C() {
500
- var v = le();
501
- if (x(v))
502
- return w(v);
503
- c = setTimeout(C, O(v));
504
- }
505
- function w(v) {
506
- return c = void 0, m && n ? b(v) : (n = o = void 0, l);
507
- }
508
- function _() {
509
- c !== void 0 && clearTimeout(c), d = 0, n = a = o = c = void 0;
510
- }
511
- function P() {
512
- return c === void 0 ? l : w(le());
513
- }
514
- function M() {
515
- var v = le(), L = x(v);
516
- if (n = arguments, o = this, a = v, L) {
517
- if (c === void 0)
518
- return h(a);
519
- if (u)
520
- return clearTimeout(c), c = setTimeout(C, t), b(a);
521
- }
522
- return c === void 0 && (c = setTimeout(C, t)), l;
523
- }
524
- return M.cancel = _, M.flush = P, M;
525
- }
526
- const Ht = () => {
527
- const [e, t] = N(0), [r, n] = N("read"), [o, i] = N("down"), l = H({
528
- prevMilestone: 0,
529
- prevScrollY: 0,
530
- prevTime: Date.now()
531
- }), c = H({ setDepth: t, setSpeedCategory: n, setDirection: i });
532
- c.current = { setDepth: t, setSpeedCategory: n, setDirection: i };
533
- const a = me(
534
- () => Yt(() => {
535
- const d = window.scrollY, p = document.documentElement.scrollHeight, u = window.innerHeight, m = p - u;
536
- if (m <= 0) return;
537
- const b = Math.round(d / m * 100), h = Math.max(0, Math.min(100, b)), O = Math.floor(h / 5) * 5, { prevMilestone: x, prevScrollY: C, prevTime: w } = l.current, _ = O > x ? "down" : "up";
538
- if (O === x)
539
- return;
540
- const P = Date.now(), M = (P - w) / 1e3, v = Math.abs(d - C), A = (M > 0 ? v / M : 0) > 300 ? "scan" : "read";
541
- l.current = {
542
- prevMilestone: O,
543
- prevScrollY: d,
544
- prevTime: P
545
- }, c.current.setDepth(O), c.current.setSpeedCategory(A), c.current.setDirection(_);
546
- }, 250),
547
- []
548
- );
549
- return k(() => (window.addEventListener("scroll", a), () => {
550
- window.removeEventListener("scroll", a), a.cancel();
551
- }), [a]), { depth: e, speedCategory: r, direction: o };
552
- }, re = (e) => Object.prototype.toString.call(e) == "[object String]", zt = (e, t) => e.indexOf(t) !== -1, Y = (e) => e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), De = (e) => e === void 0, Vt = (e) => e === null, $e = (e) => De(e) || Vt(e), Me = (e) => !!e && e?.nodeType === 3;
553
- function Gt(e) {
554
- return !!e && e?.nodeType === 1;
555
- }
556
- function Xt(e, t) {
557
- return !!e && !!e?.tagName && e?.tagName.toLowerCase() === t.toLowerCase();
558
- }
559
- function Jt(e) {
560
- return e ? Y(e).split(/\s+/) : [];
561
- }
562
- function qt(e) {
563
- let t = "";
564
- switch (typeof e?.className) {
565
- case "string":
566
- t = e?.className;
567
- break;
568
- // TODO: when is this ever used?
569
- case "object":
570
- t = (e?.className && "baseVal" in e?.className ? (e?.className).baseVal : null) || e?.getAttribute("class") || "";
571
- break;
572
- default:
573
- t = "";
574
- }
575
- return Jt(t);
576
- }
577
- const S = (e, t = 255) => $e(e) ? "" : Y(e).split(/(\s+)/).filter((r) => he(r)).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, t), We = ["span", "strong", "em", "i", "b", "mark", "code", "small", "sub", "sup", "label"], be = (e) => {
578
- let t = "";
579
- if (er(e) && e?.childNodes && e?.childNodes.length) {
580
- for (const r of e?.childNodes)
581
- Me(r) && r.textContent && (t += S(r.textContent) ?? "");
582
- if (!Y(t)) {
583
- const r = e.querySelectorAll(We.join(", "));
584
- for (const n of r) {
585
- const o = n.textContent;
586
- o && (t += `${S(o)} `);
587
- }
588
- }
589
- if (!Y(t) && e instanceof HTMLElement) {
590
- const r = e.innerText;
591
- r && (t = S(r.substring(0, 500)));
592
- }
593
- }
594
- return Y(t);
595
- }, Kt = (e) => De(e.target) ? e?.srcElement || null : e?.target?.shadowRoot ? e?.composedPath()?.[0] || null : e?.target || null, Zt = (e, t) => {
596
- if (!window || !e || Xt(e, "html") || !Gt(e))
597
- return !1;
598
- const r = window.getComputedStyle(e);
599
- if (r && r.getPropertyValue("cursor") === "pointer" && t.type === "click")
600
- return !0;
601
- switch (e?.tagName.toLowerCase()) {
602
- case "html":
603
- return !1;
604
- case "form":
605
- return t.type === "submit";
606
- case "input":
607
- case "select":
608
- case "textarea":
609
- return ["change", "click"].includes(t.type);
610
- default:
611
- return t.type === "click";
612
- }
613
- }, Qt = /* @__PURE__ */ new Set([
614
- "password",
615
- "passwd",
616
- "pwd",
617
- "creditcard",
618
- "cardnumber",
619
- "ccnum",
620
- "ccnumber",
621
- "cvv",
622
- "cvc",
623
- "csc",
624
- "securitycode",
625
- "ssn",
626
- "socialsecurity",
627
- "routingnumber",
628
- "accountnumber",
629
- "bankaccount",
630
- "secretkey",
631
- "apikey",
632
- "accesstoken"
633
- ]);
634
- function er(e) {
635
- if (zt(qt(e), "ph-include"))
636
- return !0;
637
- const t = e.type || "";
638
- if (re(t))
639
- switch (t.toLowerCase()) {
640
- case "hidden":
641
- return !1;
642
- case "password":
643
- return !1;
644
- }
645
- const r = e.name || e?.id || "";
646
- if (re(r)) {
647
- const n = r.toLowerCase().replace(/[^a-z]/g, "");
648
- if (Qt.has(n))
649
- return !1;
650
- }
651
- return !0;
652
- }
653
- const Fe = "(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})", tr = new RegExp(`^(?:${Fe})$`), rr = new RegExp(Fe), Be = "\\d{3}-?\\d{2}-?\\d{4}", nr = new RegExp(`^(${Be})$`), or = new RegExp(`(${Be})`), he = (e, t = !0) => !($e(e) || re(e) && (e = Y(e), (t ? tr : rr).test((e || "").replace(/[- ]/g, "")) || (t ? nr : or).test(e))), sr = (e) => re(e) ? e.substring(0, 10) === "_ngcontent" || e.substring(0, 7) === "_nghost" : !1, ir = (e) => {
654
- let t = be(e);
655
- return t = `${t} ${Ue(e)}`.trim(), he(t) ? t : "";
656
- };
657
- function Ue(e) {
658
- let t = "";
659
- if (e?.childNodes.length)
660
- for (const r of e.childNodes) {
661
- const n = r.tagName?.toLowerCase();
662
- if (r && n && We.includes(n))
663
- try {
664
- const o = be(r);
665
- t = `${t} ${o}`.trim(), r?.childNodes.length && (t = `${t} ${Ue(r)}`.trim());
666
- } catch {
667
- }
668
- }
669
- return t;
670
- }
671
- const ar = (e) => {
672
- const t = e.tagName?.toLowerCase(), r = t === "a" || t === "button" ? ir(e) : be(e);
673
- if (r) return { text: r, source: "text" };
674
- const n = e.getAttribute("aria-label");
675
- if (n) return { text: S(n), source: "aria-label" };
676
- const o = e.getAttribute("title");
677
- if (o) return { text: S(o), source: "title" };
678
- const i = e.getAttribute("data-track-label");
679
- if (i) return { text: S(i), source: "data-track-label" };
680
- const l = e.querySelector("img[alt], svg[aria-label]");
681
- if (l) {
682
- const a = l.getAttribute("alt") || l.getAttribute("aria-label");
683
- if (a) return { text: S(a), source: "alt" };
684
- }
685
- const c = e.getAttribute("placeholder");
686
- if (c) return { text: S(c), source: "placeholder" };
687
- if (e instanceof HTMLElement && e.innerText) {
688
- const a = e.innerText.substring(0, 500);
689
- if (a.trim())
690
- return { text: S(a), source: "innerText" };
691
- }
692
- return { text: "", source: "none" };
693
- }, cr = ["input", "textarea", "select"], Ye = (e) => {
694
- const t = e?.tagName?.toLowerCase(), r = {
695
- element: t
696
- }, n = ar(e);
697
- r.text = n.text, r.text_source = n.source;
698
- const o = e.getAttribute("aria-label");
699
- o && (r.aria_label = S(o));
700
- const i = e.getAttribute("role");
701
- i && (r.role = i);
702
- const l = {};
703
- for (const a of e.attributes)
704
- (a.name.startsWith("data-track-") || a.name.startsWith("data-analytics-")) && (l[a.name] = S(a.value));
705
- Object.keys(l).length && (r.tracking_data = l);
706
- const c = Array.from(e.attributes).reduce(
707
- (a, d) => {
708
- if (he(d.value) && !sr(d.name)) {
709
- if (d.name === "class" || d.name.startsWith("data-track-") || d.name.startsWith("data-analytics-"))
710
- return a;
711
- a[d.name] = typeof d?.value == "string" ? S(d.value) : d.value;
712
- }
713
- return a;
714
- },
715
- {}
716
- );
717
- if (r.attributes = c, cr.includes(t) || e?.getAttribute("contenteditable") === "true") {
718
- let a;
719
- e.matches('input[type="checkbox"], input[type="radio"]') ? a = e.checked : e.matches("input, select, textarea") && !e.matches('input[type="password"]') && (a = e.value), a !== void 0 && (r.value = typeof a == "string" || a === null ? S(a, 1024) : a);
720
- let d = "";
721
- r?.attributes.id && (d = S(
722
- document.querySelector(`label[for="${r?.attributes.id}"]`)?.textContent?.trim() || ""
723
- ));
724
- const p = e.closest("label");
725
- d || (d = S(p?.textContent?.trim() || "")), d && (r.label = d);
726
- }
727
- return r;
728
- }, lr = (e, t) => {
729
- let r = Kt(e);
730
- Me(r) && (r = r.parentNode || null);
731
- const n = ["copy", "cut"].includes(t);
732
- if (r && (n || Zt(r, e))) {
733
- const o = Ye(r);
734
- if (n) {
735
- const i = S(window?.getSelection()?.toString()), l = e?.type || "clipboard";
736
- o.copy_text = i ?? "", o.copy_type = l;
737
- }
738
- return o;
739
- }
740
- return null;
741
- }, ur = () => {
742
- const e = $();
743
- k(() => {
744
- let t;
745
- const r = () => {
746
- clearTimeout(t), t = setTimeout(() => {
747
- const n = window.getSelection();
748
- if (n && n?.rangeCount > 0) {
749
- const o = n?.toString();
750
- o && e?.track("page.selection", {
751
- text: S(o)
752
- });
753
- }
754
- }, 1e3);
755
- };
756
- return document.addEventListener("selectionchange", r), () => {
757
- clearTimeout(t), document.removeEventListener("selectionchange", r);
758
- };
759
- }, []);
760
- }, dr = 30, fr = 1e3, gr = 3;
761
- class mr {
762
- clicks;
763
- constructor() {
764
- this.clicks = [];
765
- }
766
- /**
767
- * Check if the current click is part of a rage click sequence.
768
- * Returns true for 3+ consecutive clicks within threshold.
769
- */
770
- isRageClick(t, r, n) {
771
- const o = this.clicks[this.clicks.length - 1];
772
- if (o && Math.abs(t - o.x) + Math.abs(r - o.y) < dr && n - o.timestamp < fr) {
773
- if (this.clicks.push({ x: t, y: r, timestamp: n }), this.clicks.length >= gr)
774
- return !0;
775
- } else
776
- this.clicks = [{ x: t, y: r, timestamp: n }];
777
- return !1;
778
- }
779
- /**
780
- * Reset the click sequence (useful for testing)
781
- */
782
- reset() {
783
- this.clicks = [];
784
- }
785
- }
786
- const pr = new mr(), br = (e) => {
787
- let t = e, r = 0;
788
- for (; t && r < 10; ) {
789
- const n = t.getAttribute?.("href");
790
- if (n)
791
- return n;
792
- t = t.parentElement, r++;
793
- }
794
- return null;
795
- }, ue = (e) => {
796
- const t = e.closest("a[href]"), r = t?.getAttribute("href") || br(e);
797
- if (!r) return { type: null, href: null };
798
- if (t?.hasAttribute("download"))
799
- return { type: "download", href: r };
800
- if (r.startsWith("tel:")) return { type: "tel", href: r };
801
- if (r.startsWith("mailto:")) return { type: "mailto", href: r };
802
- if (r.startsWith("#")) return { type: "anchor", href: r };
803
- try {
804
- return {
805
- type: new URL(r, window.location.origin).origin === window.location.origin ? "internal" : "external",
806
- href: r
807
- };
808
- } catch {
809
- return { type: "internal", href: r };
810
- }
811
- }, hr = () => {
812
- const e = $(), { workspace: t, logger: r } = V(), n = H(0);
813
- k(() => {
814
- let o = null;
815
- const i = (u, m = !1) => {
816
- const b = u.target, h = "clientX" in u ? u.clientX : u.changedTouches?.[0]?.clientX ?? 0, O = "clientY" in u ? u.clientY : u.changedTouches?.[0]?.clientY ?? 0;
817
- let x = {
818
- hostname: window.location.hostname,
819
- pathname: window.location.pathname,
820
- page_title: document.title,
821
- url: window.location.href,
822
- created_at: (/* @__PURE__ */ new Date()).toISOString(),
823
- event_type: m ? "dblclick" : "click",
824
- button_type: "button" in u ? u.button : 0
825
- };
826
- return b instanceof HTMLElement && (x.rage_click = pr?.isRageClick(h, O, Date.now()), x = {
827
- ...x,
828
- ...Ye(b)
829
- }), x;
830
- }, l = (u, m) => {
831
- try {
832
- if (Date.now() - n.current < 300) return;
833
- const b = i(u);
834
- if (!e?.insightsUrl || !t) {
835
- r?.warn("Cannot track navigation click: missing insightsUrl or workspace");
836
- return;
837
- }
838
- e?.track("page.click", {
839
- ...b,
840
- href: m.href || void 0,
841
- link_type: m.type,
842
- is_navigation: !0
843
- });
844
- } catch (b) {
845
- r?.error("Failed to track navigation click", U(b));
846
- }
847
- }, c = (u, m = !1) => {
848
- try {
849
- if (!(u.target instanceof HTMLElement) || Date.now() - n.current < 300) return;
850
- const b = i(u, m), h = ue(u.target);
851
- e?.track("page.click", {
852
- ...b,
853
- href: h.href || void 0,
854
- link_type: h.type || void 0
855
- });
856
- } catch (b) {
857
- r?.error("Failed to track click", U(b));
858
- }
859
- }, a = (u) => {
860
- if (!(u.target instanceof HTMLElement)) return;
861
- const m = ue(u.target);
862
- if (m.type === "external" || m.type === "download") {
863
- l(u, m);
864
- return;
865
- }
866
- if (o) {
867
- clearTimeout(o), o = null;
868
- return;
869
- }
870
- o = setTimeout(() => {
871
- c(u, !1), o = null;
872
- }, 250);
873
- }, d = (u) => {
874
- o && (clearTimeout(o), o = null), c(u, !0);
875
- }, p = (u) => {
876
- try {
877
- if (!(u.target instanceof HTMLElement)) return;
878
- n.current = Date.now();
879
- const m = ue(u.target);
880
- if (m.type === "external" || m.type === "download") {
881
- const h = i(u);
882
- e?.track("page.click", {
883
- ...h,
884
- href: m.href || void 0,
885
- link_type: m.type,
886
- is_navigation: !0,
887
- is_touch: !0
888
- });
889
- return;
890
- }
891
- const b = i(u);
892
- e?.track("page.click", {
893
- ...b,
894
- href: m.href || void 0,
895
- link_type: m.type || void 0,
896
- is_touch: !0
897
- });
898
- } catch (m) {
899
- r?.error("Failed to track touch", U(m));
900
- }
901
- };
902
- return document.addEventListener("click", a), document.addEventListener("dblclick", d), document.addEventListener("touchend", p, { passive: !0 }), () => {
903
- document.removeEventListener("click", a), document.removeEventListener("dblclick", d), document.removeEventListener("touchend", p), o && clearTimeout(o);
904
- };
905
- }, [e, t, r]);
906
- }, hn = ({ id: e, properties: t = {} }) => {
907
- const r = typeof window < "u" ? window.location.href : "", n = V(), o = $();
908
- k(() => {
909
- n && typeof window < "u" && (window.levo_client = n);
910
- }, [n]), k(() => {
911
- o && typeof window < "u" && (window.levo_insights = o);
912
- }, []), ht(), pt(), hr();
913
- const i = Ht();
914
- return k(() => {
915
- o?.instance && o?.track("page.scroll", {
916
- resource: "page",
917
- identifier: e,
918
- percent: i.depth,
919
- speed_category: i.speedCategory
319
+ }, Bt = ({ id: e }) => {
320
+ const t = Q(), r = ee();
321
+ return O(() => {
322
+ t && typeof window < "u" && (window.levo_client = t);
323
+ }, [t]), O(() => {
324
+ r && typeof window < "u" && (window.levo_insights = r);
325
+ }, [r]), O(() => {
326
+ r && e && r.init({
327
+ pageId: e
920
328
  });
921
- }, [o, i.depth, i.speedCategory, e]), ur(), bt({
922
- href: r,
923
- id: e,
924
- properties: t
925
- }), mt({ id: e }), k(() => {
926
- const l = {
927
- change: "form.change",
928
- submit: "form.submit",
929
- copy: "page.copy",
930
- cut: "page.copy"
931
- }, c = (d) => (p) => {
932
- const u = lr(p, d);
933
- u && l[d] && o?.track(l[d], u);
934
- }, a = {
935
- change: c("change"),
936
- copy: c("copy"),
937
- cut: c("cut"),
938
- submit: c("submit")
939
- };
940
- return document.addEventListener("change", a.change), document.addEventListener("copy", a.copy), document.addEventListener("cut", a.cut), document.addEventListener("submit", a.submit), () => {
941
- document.removeEventListener("change", a.change), document.removeEventListener("copy", a.copy), document.removeEventListener("cut", a.cut), document.removeEventListener("submit", a.submit);
942
- };
943
- }, []), (!o?.insightsUrl || !n.workspace || !n.workspace.startsWith("W")) && console.error(
944
- "[@levo-so/react] The utility could not be initialized, due to missing workspace, or endpoint for insights."
945
- ), null;
329
+ }, [r, e]), null;
946
330
  };
947
- var He = {
331
+ var ve = {
948
332
  color: void 0,
949
333
  size: void 0,
950
334
  className: void 0,
951
335
  style: void 0,
952
336
  attr: void 0
953
- }, Re = I.createContext && /* @__PURE__ */ I.createContext(He), vr = ["attr", "size", "title"];
954
- function yr(e, t) {
337
+ }, ue = R.createContext && /* @__PURE__ */ R.createContext(ve), Ue = ["attr", "size", "title"];
338
+ function Ye(e, t) {
955
339
  if (e == null) return {};
956
- var r = wr(e, t), n, o;
340
+ var r = Ve(e, t), n, s;
957
341
  if (Object.getOwnPropertySymbols) {
958
- var i = Object.getOwnPropertySymbols(e);
959
- for (o = 0; o < i.length; o++)
960
- n = i[o], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
342
+ var a = Object.getOwnPropertySymbols(e);
343
+ for (s = 0; s < a.length; s++)
344
+ n = a[s], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
961
345
  }
962
346
  return r;
963
347
  }
964
- function wr(e, t) {
348
+ function Ve(e, t) {
965
349
  if (e == null) return {};
966
350
  var r = {};
967
351
  for (var n in e)
@@ -971,45 +355,45 @@ function wr(e, t) {
971
355
  }
972
356
  return r;
973
357
  }
974
- function ne() {
975
- return ne = Object.assign ? Object.assign.bind() : function(e) {
358
+ function z() {
359
+ return z = Object.assign ? Object.assign.bind() : function(e) {
976
360
  for (var t = 1; t < arguments.length; t++) {
977
361
  var r = arguments[t];
978
362
  for (var n in r)
979
363
  Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
980
364
  }
981
365
  return e;
982
- }, ne.apply(this, arguments);
366
+ }, z.apply(this, arguments);
983
367
  }
984
- function Le(e, t) {
368
+ function de(e, t) {
985
369
  var r = Object.keys(e);
986
370
  if (Object.getOwnPropertySymbols) {
987
371
  var n = Object.getOwnPropertySymbols(e);
988
- t && (n = n.filter(function(o) {
989
- return Object.getOwnPropertyDescriptor(e, o).enumerable;
372
+ t && (n = n.filter(function(s) {
373
+ return Object.getOwnPropertyDescriptor(e, s).enumerable;
990
374
  })), r.push.apply(r, n);
991
375
  }
992
376
  return r;
993
377
  }
994
- function oe(e) {
378
+ function U(e) {
995
379
  for (var t = 1; t < arguments.length; t++) {
996
380
  var r = arguments[t] != null ? arguments[t] : {};
997
- t % 2 ? Le(Object(r), !0).forEach(function(n) {
998
- xr(e, n, r[n]);
999
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Le(Object(r)).forEach(function(n) {
381
+ t % 2 ? de(Object(r), !0).forEach(function(n) {
382
+ Ge(e, n, r[n]);
383
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : de(Object(r)).forEach(function(n) {
1000
384
  Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
1001
385
  });
1002
386
  }
1003
387
  return e;
1004
388
  }
1005
- function xr(e, t, r) {
1006
- return t = Tr(t), t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
389
+ function Ge(e, t, r) {
390
+ return t = He(t), t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
1007
391
  }
1008
- function Tr(e) {
1009
- var t = Er(e, "string");
392
+ function He(e) {
393
+ var t = Je(e, "string");
1010
394
  return typeof t == "symbol" ? t : t + "";
1011
395
  }
1012
- function Er(e, t) {
396
+ function Je(e, t) {
1013
397
  if (typeof e != "object" || !e) return e;
1014
398
  var r = e[Symbol.toPrimitive];
1015
399
  if (r !== void 0) {
@@ -1019,43 +403,43 @@ function Er(e, t) {
1019
403
  }
1020
404
  return (t === "string" ? String : Number)(e);
1021
405
  }
1022
- function ze(e) {
1023
- return e && e.map((t, r) => /* @__PURE__ */ I.createElement(t.tag, oe({
406
+ function be(e) {
407
+ return e && e.map((t, r) => /* @__PURE__ */ R.createElement(t.tag, U({
1024
408
  key: r
1025
- }, t.attr), ze(t.child)));
409
+ }, t.attr), be(t.child)));
1026
410
  }
1027
- function kr(e) {
1028
- return (t) => /* @__PURE__ */ I.createElement(_r, ne({
1029
- attr: oe({}, e.attr)
1030
- }, t), ze(e.child));
411
+ function Xe(e) {
412
+ return (t) => /* @__PURE__ */ R.createElement(qe, z({
413
+ attr: U({}, e.attr)
414
+ }, t), be(e.child));
1031
415
  }
1032
- function _r(e) {
416
+ function qe(e) {
1033
417
  var t = (r) => {
1034
418
  var {
1035
419
  attr: n,
1036
- size: o,
1037
- title: i
1038
- } = e, l = yr(e, vr), c = o || r.size || "1em", a;
1039
- return r.className && (a = r.className), e.className && (a = (a ? a + " " : "") + e.className), /* @__PURE__ */ I.createElement("svg", ne({
420
+ size: s,
421
+ title: a
422
+ } = e, l = Ye(e, Ue), u = s || r.size || "1em", f;
423
+ return r.className && (f = r.className), e.className && (f = (f ? f + " " : "") + e.className), /* @__PURE__ */ R.createElement("svg", z({
1040
424
  stroke: "currentColor",
1041
425
  fill: "currentColor",
1042
426
  strokeWidth: "0"
1043
427
  }, r.attr, n, l, {
1044
- className: a,
1045
- style: oe(oe({
428
+ className: f,
429
+ style: U(U({
1046
430
  color: e.color || r.color
1047
431
  }, r.style), e.style),
1048
- height: c,
1049
- width: c,
432
+ height: u,
433
+ width: u,
1050
434
  xmlns: "http://www.w3.org/2000/svg"
1051
- }), i && /* @__PURE__ */ I.createElement("title", null, i), e.children);
435
+ }), a && /* @__PURE__ */ R.createElement("title", null, a), e.children);
1052
436
  };
1053
- return Re !== void 0 ? /* @__PURE__ */ I.createElement(Re.Consumer, null, (r) => t(r)) : t(He);
437
+ return ue !== void 0 ? /* @__PURE__ */ R.createElement(ue.Consumer, null, (r) => t(r)) : t(ve);
1054
438
  }
1055
- function Ve(e) {
1056
- return kr({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M12 22c5.421 0 10-4.579 10-10h-2c0 4.337-3.663 8-8 8s-8-3.663-8-8c0-4.336 3.663-8 8-8V2C6.579 2 2 6.58 2 12c0 5.421 4.579 10 10 10z" }, child: [] }] })(e);
439
+ function he(e) {
440
+ return Xe({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M12 22c5.421 0 10-4.579 10-10h-2c0 4.337-3.663 8-8 8s-8-3.663-8-8c0-4.336 3.663-8 8-8V2C6.579 2 2 6.58 2 12c0 5.421 4.579 10 10 10z" }, child: [] }] })(e);
1057
441
  }
1058
- const R = (...e) => Pe(st(e)), Sr = ct(
442
+ const j = (...e) => pe(Ie(e)), Ke = $e(
1059
443
  "inline-flex items-center justify-center font-medium text-sm ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
1060
444
  {
1061
445
  variants: {
@@ -1090,118 +474,118 @@ const R = (...e) => Pe(st(e)), Sr = ct(
1090
474
  rounded: "default"
1091
475
  }
1092
476
  }
1093
- ), Or = D.forwardRef(
477
+ ), Ze = _.forwardRef(
1094
478
  ({
1095
479
  className: e,
1096
480
  variant: t,
1097
481
  size: r,
1098
482
  rounded: n,
1099
- asChild: o = !1,
1100
- isLoading: i = !1,
483
+ asChild: s = !1,
484
+ isLoading: a = !1,
1101
485
  loadingText: l,
1102
- disabled: c,
1103
- ...a
1104
- }, d) => {
1105
- const p = o ? at.Root : "button";
1106
- return /* @__PURE__ */ g.jsx(
486
+ disabled: u,
487
+ ...f
488
+ }, b) => {
489
+ const p = s ? De.Root : "button";
490
+ return /* @__PURE__ */ c.jsx(
1107
491
  p,
1108
492
  {
1109
- className: R(Sr({ variant: t, size: r, rounded: n, className: e })),
1110
- ref: d,
1111
- disabled: c || i,
493
+ className: j(Ke({ variant: t, size: r, rounded: n, className: e })),
494
+ ref: b,
495
+ disabled: u || a,
1112
496
  type: "button",
1113
- ...a,
1114
- children: i ? /* @__PURE__ */ g.jsxs(g.Fragment, { children: [
1115
- /* @__PURE__ */ g.jsx(Ve, { className: Pe("h-4 w-4 animate-spin", l ? "mr-2" : "") }),
497
+ ...f,
498
+ children: a ? /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
499
+ /* @__PURE__ */ c.jsx(he, { className: pe("h-4 w-4 animate-spin", l ? "mr-2" : "") }),
1116
500
  l
1117
- ] }) : a.children
501
+ ] }) : f.children
1118
502
  }
1119
503
  );
1120
504
  }
1121
505
  );
1122
- Or.displayName = "Button";
1123
- const Nr = j.Root, vn = j.Trigger, jr = j.Portal, yn = j.Close, Ge = D.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1124
- j.Overlay,
506
+ Ze.displayName = "Button";
507
+ const Qe = y.Root, Ft = y.Trigger, et = y.Portal, zt = y.Close, xe = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c.jsx(
508
+ y.Overlay,
1125
509
  {
1126
510
  ref: r,
1127
- className: R(
511
+ className: j(
1128
512
  "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 grid max-h-screen place-items-center overflow-y-auto bg-background/80 py-10 backdrop-blur-sm data-[state=closed]:animate-out data-[state=open]:animate-in",
1129
513
  e
1130
514
  ),
1131
515
  ...t
1132
516
  }
1133
517
  ));
1134
- Ge.displayName = j.Overlay.displayName;
1135
- const Xe = D.forwardRef(({ className: e, children: t, container: r, hideCloseButton: n, overlayStyles: o, ...i }, l) => /* @__PURE__ */ g.jsx(jr, { container: r, children: /* @__PURE__ */ g.jsx(Ge, { className: o, children: /* @__PURE__ */ g.jsxs(
1136
- j.Content,
518
+ xe.displayName = y.Overlay.displayName;
519
+ const we = _.forwardRef(({ className: e, children: t, container: r, hideCloseButton: n, overlayStyles: s, ...a }, l) => /* @__PURE__ */ c.jsx(et, { container: r, children: /* @__PURE__ */ c.jsx(xe, { className: s, children: /* @__PURE__ */ c.jsxs(
520
+ y.Content,
1137
521
  {
1138
522
  ref: l,
1139
- className: R(
523
+ className: j(
1140
524
  "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-50 grid w-full max-w-lg gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:rounded-lg",
1141
525
  e
1142
526
  ),
1143
- ...i,
527
+ ...a,
1144
528
  children: [
1145
529
  t,
1146
- !n && /* @__PURE__ */ g.jsxs(
1147
- j.Close,
530
+ !n && /* @__PURE__ */ c.jsxs(
531
+ y.Close,
1148
532
  {
1149
533
  type: "button",
1150
534
  className: "absolute top-4 right-4 rounded-sm p-1 opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
1151
535
  children: [
1152
- /* @__PURE__ */ g.jsx(lt, { className: "h-4 w-4" }),
1153
- /* @__PURE__ */ g.jsx("span", { className: "sr-only", children: "Close" })
536
+ /* @__PURE__ */ c.jsx(We, { className: "h-4 w-4" }),
537
+ /* @__PURE__ */ c.jsx("span", { className: "sr-only", children: "Close" })
1154
538
  ]
1155
539
  }
1156
540
  )
1157
541
  ]
1158
542
  }
1159
543
  ) }) }));
1160
- Xe.displayName = j.Content.displayName;
1161
- const Je = ({ className: e, ...t }) => /* @__PURE__ */ g.jsx("div", { className: R("flex flex-col space-y-1.5 text-center sm:text-left", e), ...t });
1162
- Je.displayName = "DialogHeader";
1163
- const Cr = ({ className: e, ...t }) => /* @__PURE__ */ g.jsx(
544
+ we.displayName = y.Content.displayName;
545
+ const ye = ({ className: e, ...t }) => /* @__PURE__ */ c.jsx("div", { className: j("flex flex-col space-y-1.5 text-center sm:text-left", e), ...t });
546
+ ye.displayName = "DialogHeader";
547
+ const tt = ({ className: e, ...t }) => /* @__PURE__ */ c.jsx(
1164
548
  "div",
1165
549
  {
1166
- className: R("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
550
+ className: j("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
1167
551
  ...t
1168
552
  }
1169
553
  );
1170
- Cr.displayName = "DialogFooter";
1171
- const qe = D.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1172
- j.Title,
554
+ tt.displayName = "DialogFooter";
555
+ const Ee = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c.jsx(
556
+ y.Title,
1173
557
  {
1174
558
  ref: r,
1175
- className: R("font-semibold text-lg leading-none tracking-tight", e),
559
+ className: j("font-semibold text-lg leading-none tracking-tight", e),
1176
560
  ...t
1177
561
  }
1178
562
  ));
1179
- qe.displayName = j.Title.displayName;
1180
- const Ke = D.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1181
- j.Description,
563
+ Ee.displayName = y.Title.displayName;
564
+ const je = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c.jsx(
565
+ y.Description,
1182
566
  {
1183
567
  ref: r,
1184
- className: R("text-muted-foreground text-sm", e),
568
+ className: j("text-muted-foreground text-sm", e),
1185
569
  ...t
1186
570
  }
1187
571
  ));
1188
- Ke.displayName = j.Description.displayName;
1189
- const wn = ({
572
+ je.displayName = y.Description.displayName;
573
+ const Ut = ({
1190
574
  isOpen: e,
1191
575
  onClose: t,
1192
576
  children: r,
1193
577
  title: n,
1194
- description: o = "",
1195
- contentClassName: i,
578
+ description: s = "",
579
+ contentClassName: a,
1196
580
  modal: l = !0
1197
- }) => /* @__PURE__ */ g.jsx(Nr, { open: e, onOpenChange: t, modal: l, children: /* @__PURE__ */ g.jsxs(Xe, { className: i, children: [
1198
- n && /* @__PURE__ */ g.jsxs(Je, { className: "flex-1 font-medium", children: [
1199
- /* @__PURE__ */ g.jsx(qe, { children: n }),
1200
- /* @__PURE__ */ g.jsx(Ke, { children: o })
581
+ }) => /* @__PURE__ */ c.jsx(Qe, { open: e, onOpenChange: t, modal: l, children: /* @__PURE__ */ c.jsxs(we, { className: a, children: [
582
+ n && /* @__PURE__ */ c.jsxs(ye, { className: "flex-1 font-medium", children: [
583
+ /* @__PURE__ */ c.jsx(Ee, { children: n }),
584
+ /* @__PURE__ */ c.jsx(je, { children: s })
1201
585
  ] }),
1202
- /* @__PURE__ */ g.jsx("div", { className: "w-full", children: r })
1203
- ] }) }), xn = ({ ...e }) => /* @__PURE__ */ g.jsx(
1204
- ut,
586
+ /* @__PURE__ */ c.jsx("div", { className: "w-full", children: r })
587
+ ] }) }), Yt = ({ ...e }) => /* @__PURE__ */ c.jsx(
588
+ Me,
1205
589
  {
1206
590
  closeButton: !0,
1207
591
  richColors: !0,
@@ -1216,37 +600,37 @@ const wn = ({
1216
600
  },
1217
601
  ...e
1218
602
  }
1219
- ), Rr = (e, t = "Error", r = {}) => {
1220
- de.error(t, {
603
+ ), rt = (e, t = "Error", r = {}) => {
604
+ q.error(t, {
1221
605
  description: e,
1222
606
  duration: 4e3,
1223
607
  position: "bottom-right",
1224
608
  ...r
1225
609
  });
1226
- }, Tn = (e, t = "Success", r = {}) => {
1227
- r?.id && de.dismiss(r?.id), de.success(t, {
610
+ }, Vt = (e, t = "Success", r = {}) => {
611
+ r?.id && q.dismiss(r?.id), q.success(t, {
1228
612
  description: e,
1229
613
  duration: 4e3,
1230
614
  position: "bottom-right",
1231
615
  ...r
1232
616
  });
1233
- }, Lr = ({ className: e }) => /* @__PURE__ */ g.jsx(Ve, { className: R("h-8 w-8 animate-spin font-light", e) }), En = W.Root, Pr = D.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1234
- W.List,
617
+ }, ot = ({ className: e }) => /* @__PURE__ */ c.jsx(he, { className: j("h-8 w-8 animate-spin font-light", e) }), Gt = k.Root, nt = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c.jsx(
618
+ k.List,
1235
619
  {
1236
620
  ref: r,
1237
- className: R(
621
+ className: j(
1238
622
  "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
1239
623
  e
1240
624
  ),
1241
625
  ...t
1242
626
  }
1243
627
  ));
1244
- Pr.displayName = W.List.displayName;
1245
- const Ar = D.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1246
- W.Trigger,
628
+ nt.displayName = k.List.displayName;
629
+ const st = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c.jsx(
630
+ k.Trigger,
1247
631
  {
1248
632
  ref: r,
1249
- className: R(
633
+ className: j(
1250
634
  "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
1251
635
  e
1252
636
  ),
@@ -1254,36 +638,36 @@ const Ar = D.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1254
638
  ...t
1255
639
  }
1256
640
  ));
1257
- Ar.displayName = W.Trigger.displayName;
1258
- const Ir = D.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1259
- W.Content,
641
+ st.displayName = k.Trigger.displayName;
642
+ const at = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c.jsx(
643
+ k.Content,
1260
644
  {
1261
645
  ref: r,
1262
- className: R(
646
+ className: j(
1263
647
  "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1264
648
  e
1265
649
  ),
1266
650
  ...t
1267
651
  }
1268
652
  ));
1269
- Ir.displayName = W.Content.displayName;
1270
- const kn = z.Provider, Dr = z.Root, $r = z.Trigger, Mr = z.Portal, Ze = D.forwardRef(({ className: e, sideOffset: t = 4, ...r }, n) => /* @__PURE__ */ g.jsx(
1271
- z.Content,
653
+ at.displayName = k.Content.displayName;
654
+ const Ht = A.Provider, it = A.Root, ct = A.Trigger, lt = A.Portal, Oe = _.forwardRef(({ className: e, sideOffset: t = 4, ...r }, n) => /* @__PURE__ */ c.jsx(
655
+ A.Content,
1272
656
  {
1273
657
  ref: n,
1274
658
  sideOffset: t,
1275
- className: R(
659
+ className: j(
1276
660
  "fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 animate-in overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-popover-foreground text-xs shadow-md data-[state=closed]:animate-out",
1277
661
  e
1278
662
  ),
1279
663
  ...r
1280
664
  }
1281
665
  ));
1282
- Ze.displayName = z.Content.displayName;
1283
- const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, contentProps: o = {}, side: i }) => /* @__PURE__ */ g.jsxs(Dr, { children: [
1284
- t && /* @__PURE__ */ g.jsx(Mr, { children: /* @__PURE__ */ g.jsx(Ze, { side: i, className: r, ...o, children: t }) }),
1285
- /* @__PURE__ */ g.jsx($r, { asChild: n, children: e })
1286
- ] }), Wr = [
666
+ Oe.displayName = A.Content.displayName;
667
+ const Jt = ({ children: e, label: t, labelClassName: r, asChild: n = !0, contentProps: s = {}, side: a }) => /* @__PURE__ */ c.jsxs(it, { children: [
668
+ t && /* @__PURE__ */ c.jsx(lt, { children: /* @__PURE__ */ c.jsx(Oe, { side: a, className: r, ...s, children: t }) }),
669
+ /* @__PURE__ */ c.jsx(ct, { asChild: n, children: e })
670
+ ] }), ut = [
1287
671
  "pdf",
1288
672
  "txt",
1289
673
  "xml",
@@ -1297,7 +681,7 @@ const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1297
681
  "odp",
1298
682
  "ppt",
1299
683
  "pptx"
1300
- ], Fr = ["svg", "png", "jpg", "jpeg", "gif", "webp", "avif"], Br = ["mp4", "ogv", "webm"], Ur = ["mp3", "ogg", "opus"], Yr = {
684
+ ], dt = ["svg", "png", "jpg", "jpeg", "gif", "webp", "avif"], ft = ["mp4", "ogv", "webm"], mt = ["mp3", "ogg", "opus"], pt = {
1301
685
  "application/xml": [".xml"],
1302
686
  "text/plain": [".txt"],
1303
687
  "application/pdf": [".pdf"],
@@ -1306,7 +690,7 @@ const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1306
690
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
1307
691
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
1308
692
  "text/csv": [".csv"]
1309
- }, Hr = {
693
+ }, gt = {
1310
694
  "image/jpeg": [".jpeg", ".jpg"],
1311
695
  "image/jpg": [".jpg"],
1312
696
  "image/png": [".png"],
@@ -1315,35 +699,35 @@ const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1315
699
  "image/svg+xml": [".svg"],
1316
700
  "image/webp": [".webp"],
1317
701
  "image/avif": [".avif"]
1318
- }, zr = {
702
+ }, vt = {
1319
703
  "video/mp4": [".mp4"],
1320
704
  "video/mpeg": [".mpeg"],
1321
705
  "video/webm": [".webm"]
1322
- }, Vr = {
706
+ }, bt = {
1323
707
  "audio/mpeg": [".mp3"],
1324
708
  "audio/ogg": [".oga"],
1325
709
  "audio/opus": [".opus"]
1326
- }, Z = {
1327
- audio: Vr,
1328
- document: Yr,
1329
- image: Hr,
1330
- video: zr
1331
- }, Q = {
1332
- audio: Ur,
1333
- document: Wr,
1334
- image: Fr,
1335
- video: Br
1336
- }, Sn = [
1337
- ...Q.audio,
1338
- ...Q.document,
1339
- ...Q.image,
1340
- ...Q.video
1341
- ], On = {
1342
- ...Z.audio,
1343
- ...Z.document,
1344
- ...Z.image,
1345
- ...Z.video
1346
- }, Qe = I.createContext({
710
+ }, B = {
711
+ audio: bt,
712
+ document: pt,
713
+ image: gt,
714
+ video: vt
715
+ }, F = {
716
+ audio: mt,
717
+ document: ut,
718
+ image: dt,
719
+ video: ft
720
+ }, Xt = [
721
+ ...F.audio,
722
+ ...F.document,
723
+ ...F.image,
724
+ ...F.video
725
+ ], qt = {
726
+ ...B.audio,
727
+ ...B.document,
728
+ ...B.image,
729
+ ...B.video
730
+ }, Te = R.createContext({
1347
731
  urls: null,
1348
732
  title: "",
1349
733
  isLoading: !1,
@@ -1351,62 +735,62 @@ const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1351
735
  },
1352
736
  onError: () => {
1353
737
  }
1354
- }), Gr = ({ title: e, onSuccess: t, onError: r, children: n }) => {
1355
- const o = V(), i = typeof window < "u" ? window.location.href : "", [l, c] = N(null), [a, d] = N(!1);
1356
- k(() => {
1357
- o.membership && (d(!0), o.membership?.getOAuthURL().then((u) => {
1358
- c(u);
1359
- }).catch((u) => {
738
+ }), ht = ({ title: e, onSuccess: t, onError: r, children: n }) => {
739
+ const s = Q(), a = typeof window < "u" ? window.location.href : "", [l, u] = P(null), [f, b] = P(!1);
740
+ O(() => {
741
+ s.membership && (b(!0), s.membership?.getOAuthURL().then((d) => {
742
+ u(d);
743
+ }).catch((d) => {
1360
744
  r({
1361
- code: u?.code || "SOMETHING_WENT_WRONG",
1362
- message: u?.message || "We could not connect with our service for your sign-in."
745
+ code: d?.code || "SOMETHING_WENT_WRONG",
746
+ message: d?.message || "We could not connect with our service for your sign-in."
1363
747
  });
1364
748
  }).finally(() => {
1365
- d(!1);
749
+ b(!1);
1366
750
  }));
1367
751
  }, []);
1368
- const p = me(
1369
- () => ({ title: e, urls: l, isLoading: a, onSuccess: t, onError: r }),
1370
- [e, l, t, r, a]
752
+ const p = fe(
753
+ () => ({ title: e, urls: l, isLoading: f, onSuccess: t, onError: r }),
754
+ [e, l, t, r, f]
1371
755
  );
1372
- return k(() => {
1373
- if (l && i) {
1374
- const u = {}, m = Object.keys(l);
1375
- for (const b of m)
756
+ return O(() => {
757
+ if (l && a) {
758
+ const d = {}, T = Object.keys(l);
759
+ for (const w of T)
1376
760
  try {
1377
- const h = l[b];
1378
- if (h) {
1379
- const O = new URL(h), x = O.searchParams;
1380
- x.set("redirect_uri", i);
1381
- const C = o.pageContext;
1382
- C && x.set("page_context", JSON.stringify(C)), u[b] = O.toString();
761
+ const E = l[w];
762
+ if (E) {
763
+ const C = new URL(E), N = C.searchParams;
764
+ N.set("redirect_uri", a);
765
+ const L = s.pageContext;
766
+ L && N.set("page_context", JSON.stringify(L)), d[w] = C.toString();
1383
767
  }
1384
768
  } catch {
1385
769
  }
1386
- c(u);
770
+ u(d);
1387
771
  }
1388
- }, [i]), /* @__PURE__ */ g.jsx(Qe.Provider, { value: p, children: n });
1389
- }, Xr = () => ge(Qe), Jr = ({ url: e, title: t, height: r, width: n }) => {
1390
- const o = window.screenX + (window.outerWidth - n) / 2, i = window.screenY + (window.outerHeight - r) / 2.5;
772
+ }, [a]), /* @__PURE__ */ c.jsx(Te.Provider, { value: p, children: n });
773
+ }, xt = () => K(Te), wt = ({ url: e, title: t, height: r, width: n }) => {
774
+ const s = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - r) / 2.5;
1391
775
  return window.open(
1392
776
  e,
1393
777
  t,
1394
- `width=${n},height=${r},left=${o},top=${i}`
778
+ `width=${n},height=${r},left=${s},top=${a}`
1395
779
  );
1396
- }, qr = ({
780
+ }, yt = ({
1397
781
  title: e = "",
1398
782
  width: t = 500,
1399
783
  height: r = 500,
1400
784
  url: n,
1401
- children: o,
1402
- onCode: i,
785
+ children: s,
786
+ onCode: a,
1403
787
  onClose: l
1404
788
  }) => {
1405
- const [c, a] = N(), d = H(void 0), p = () => {
1406
- window.clearInterval(d.current);
1407
- }, u = () => {
1408
- a(
1409
- Jr({
789
+ const [u, f] = P(), b = me(void 0), p = () => {
790
+ window.clearInterval(b.current);
791
+ }, d = () => {
792
+ f(
793
+ wt({
1410
794
  url: n,
1411
795
  title: e,
1412
796
  width: t,
@@ -1414,107 +798,107 @@ const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1414
798
  })
1415
799
  );
1416
800
  };
1417
- return k(() => (c && (d.current = window.setInterval(() => {
801
+ return O(() => (u && (b.current = window.setInterval(() => {
1418
802
  try {
1419
- const m = c.location.href, b = new URL(m).searchParams, h = b.get("code");
1420
- if (!h)
803
+ const T = u.location.href, w = new URL(T).searchParams, E = w.get("code");
804
+ if (!E)
1421
805
  return;
1422
- i(h, b), p(), c.close();
806
+ a(E, w), p(), u.close();
1423
807
  } catch {
1424
808
  } finally {
1425
- (!c || c.closed) && (l(), p());
809
+ (!u || u.closed) && (l(), p());
1426
810
  }
1427
811
  }, 700)), () => {
1428
- c && c.close(), l && l();
1429
- }), [c]), /* @__PURE__ */ g.jsx(
812
+ u && u.close(), l && l();
813
+ }), [u]), /* @__PURE__ */ c.jsx(
1430
814
  "div",
1431
815
  {
1432
816
  onClick: () => {
1433
- u();
817
+ d();
1434
818
  },
1435
- children: o
819
+ children: s
1436
820
  }
1437
821
  );
1438
- }, Kr = ({
822
+ }, Et = ({
1439
823
  title: e = "Levo",
1440
824
  url: t,
1441
825
  children: r,
1442
826
  onSuccess: n,
1443
- onError: o,
1444
- width: i = 500,
827
+ onError: s,
828
+ width: a = 500,
1445
829
  height: l = 700
1446
830
  }) => {
1447
- const c = ee((a, d) => {
1448
- a.toLowerCase() === "success" ? n(d) : o(d);
831
+ const u = X((f, b) => {
832
+ f.toLowerCase() === "success" ? n(b) : s(b);
1449
833
  }, []);
1450
- return /* @__PURE__ */ g.jsx(
1451
- qr,
834
+ return /* @__PURE__ */ c.jsx(
835
+ yt,
1452
836
  {
1453
837
  title: e,
1454
- width: i,
838
+ width: a,
1455
839
  height: l,
1456
840
  onClose: () => {
1457
841
  },
1458
842
  url: t,
1459
- onCode: c,
843
+ onCode: u,
1460
844
  children: r
1461
845
  }
1462
846
  );
1463
- }, Zr = ({ children: e, provider: t }) => {
1464
- const { title: r, urls: n, isLoading: o, onSuccess: i, onError: l } = Xr(), c = n?.[t];
1465
- return c ? /* @__PURE__ */ g.jsx(Kr, { title: r, provider: t, url: c, onSuccess: i, onError: l, children: o ? /* @__PURE__ */ g.jsx("div", { className: "w-full items-center justify-center", children: /* @__PURE__ */ g.jsx(Lr, { className: "h-5 w-5 bg-brand" }) }) : e }) : null;
1466
- }, Qr = ({ url: e, title: t, height: r, width: n }) => {
1467
- const o = window.screenX + (window.outerWidth - n) / 2, i = window.screenY + (window.outerHeight - r) / 2.5;
847
+ }, jt = ({ children: e, provider: t }) => {
848
+ const { title: r, urls: n, isLoading: s, onSuccess: a, onError: l } = xt(), u = n?.[t];
849
+ return u ? /* @__PURE__ */ c.jsx(Et, { title: r, provider: t, url: u, onSuccess: a, onError: l, children: s ? /* @__PURE__ */ c.jsx("div", { className: "w-full items-center justify-center", children: /* @__PURE__ */ c.jsx(ot, { className: "h-5 w-5 bg-brand" }) }) : e }) : null;
850
+ }, Ot = ({ url: e, title: t, height: r, width: n }) => {
851
+ const s = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - r) / 2.5;
1468
852
  return window.open(
1469
853
  e,
1470
854
  t,
1471
- `width=${n},height=${r},left=${o},top=${i}`
855
+ `width=${n},height=${r},left=${s},top=${a}`
1472
856
  );
1473
- }, Nn = ({
857
+ }, Kt = ({
1474
858
  title: e = "Levo",
1475
859
  width: t = 500,
1476
860
  height: r = 700,
1477
861
  onSuccess: n
1478
862
  }) => {
1479
- const o = V(), [i, l] = N(!1), [c, a] = N(null), [d, p] = N(null), [u, m] = N(), b = H(void 0), h = () => {
1480
- window.clearInterval(b.current);
1481
- }, O = ee((w, _) => {
1482
- w.toLowerCase() === "success" ? (p(null), n(_)) : p(_);
863
+ const s = Q(), [a, l] = P(!1), [u, f] = P(null), [b, p] = P(null), [d, T] = P(), w = me(void 0), E = () => {
864
+ window.clearInterval(w.current);
865
+ }, C = X((h, x) => {
866
+ h.toLowerCase() === "success" ? (p(null), n(x)) : p(x);
1483
867
  }, []);
1484
- k(() => {
1485
- o.membership && (l(!0), o.membership?.getOAuthURL().then((w) => {
1486
- if (w)
1487
- return a(w), w;
868
+ O(() => {
869
+ s.membership && (l(!0), s.membership?.getOAuthURL().then((h) => {
870
+ if (h)
871
+ return f(h), h;
1488
872
  throw new Error();
1489
- }).catch((w) => {
1490
- const _ = U(w);
1491
- o.logger?.error("Failed to get OAuth URL", _.message), p({
1492
- code: _?.code || "SOMETHING_WENT_WRONG",
1493
- message: _?.message || "We could not connect with our service for your sign-in."
873
+ }).catch((h) => {
874
+ const x = ge(h);
875
+ s.logger?.error("Failed to get OAuth URL", x.message), p({
876
+ code: x?.code || "SOMETHING_WENT_WRONG",
877
+ message: x?.message || "We could not connect with our service for your sign-in."
1494
878
  });
1495
879
  }).finally(() => {
1496
880
  l(!1);
1497
881
  }));
1498
- }, []), k(() => (u && (b.current = window.setInterval(() => {
882
+ }, []), O(() => (d && (w.current = window.setInterval(() => {
1499
883
  try {
1500
- const w = u.location.href, _ = new URL(w).searchParams, P = _.get("code");
1501
- if (!P)
884
+ const h = d.location.href, x = new URL(h).searchParams, $ = x.get("code");
885
+ if (!$)
1502
886
  return;
1503
- O(P, _), h(), u.close();
887
+ C($, x), E(), d.close();
1504
888
  } catch {
1505
889
  } finally {
1506
- (!u || u.closed) && (h(), p(null));
890
+ (!d || d.closed) && (E(), p(null));
1507
891
  }
1508
892
  }, 700)), () => {
1509
- u && u.close();
1510
- }), [u]);
1511
- const x = ee(
1512
- (w) => {
1513
- if (w && c !== null) {
1514
- const _ = c?.[w];
1515
- _ && (u && u.close(), m(
1516
- Qr({
1517
- url: _,
893
+ d && d.close();
894
+ }), [d]);
895
+ const N = X(
896
+ (h) => {
897
+ if (h && u !== null) {
898
+ const x = u?.[h];
899
+ x && (d && d.close(), T(
900
+ Ot({
901
+ url: x,
1518
902
  title: e,
1519
903
  width: t,
1520
904
  height: r
@@ -1522,86 +906,86 @@ const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1522
906
  ));
1523
907
  }
1524
908
  },
1525
- [c, u]
909
+ [u, d]
1526
910
  );
1527
911
  return {
1528
- providers: me(() => c !== null ? Object.keys(c).filter(
1529
- (w) => !!c[w]
1530
- ) : [], [c]),
1531
- isLoading: i,
1532
- error: d,
1533
- launchPopup: x
912
+ providers: fe(() => u !== null ? Object.keys(u).filter(
913
+ (h) => !!u[h]
914
+ ) : [], [u]),
915
+ isLoading: a,
916
+ error: b,
917
+ launchPopup: N
1534
918
  };
1535
919
  };
1536
- class jn {
1537
- static Container = Gr;
1538
- static Button = Zr;
920
+ class Zt {
921
+ static Container = ht;
922
+ static Button = jt;
1539
923
  }
1540
- const Cn = (e, t = 2) => {
924
+ const Qt = (e, t = 2) => {
1541
925
  if (e === 0) return "0 B";
1542
- const r = 1024, n = t < 0 ? 0 : t, o = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], i = Math.floor(Math.log(e) / Math.log(r));
1543
- return `${Number.parseFloat((e / r ** i).toFixed(n))} ${o[i]}`;
1544
- }, Rn = (e) => {
1545
- const t = U(e);
1546
- return t?.code === "REQUEST_TIMEOUT" || t?.code === "NETWORK_ERROR" || t?.status === 408 || t?.status === 0 || Rr(t?.message || "", t?.title || "Error", {
926
+ const r = 1024, n = t < 0 ? 0 : t, s = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], a = Math.floor(Math.log(e) / Math.log(r));
927
+ return `${Number.parseFloat((e / r ** a).toFixed(n))} ${s[a]}`;
928
+ }, er = (e) => {
929
+ const t = ge(e);
930
+ return t?.code === "REQUEST_TIMEOUT" || t?.code === "NETWORK_ERROR" || t?.status === 408 || t?.status === 0 || rt(t?.message || "", t?.title || "Error", {
1547
931
  id: `${t?.title || ""}-${t?.message || ""}`
1548
932
  }), t;
1549
- }, en = (e) => e instanceof Date, tn = (e) => e == null, rn = (e) => typeof e == "object", nn = (e) => !tn(e) && !Array.isArray(e) && rn(e) && !en(e), Ln = (e) => nn(e) && !Object.keys(e).length;
933
+ }, Tt = (e) => e instanceof Date, Rt = (e) => e == null, _t = (e) => typeof e == "object", Nt = (e) => !Rt(e) && !Array.isArray(e) && _t(e) && !Tt(e), tr = (e) => Nt(e) && !Object.keys(e).length;
1550
934
  export {
1551
- Or as Button,
1552
- Nr as Dialog,
1553
- yn as DialogClose,
1554
- Xe as DialogContent,
1555
- Ke as DialogDescription,
1556
- Cr as DialogFooter,
1557
- Je as DialogHeader,
1558
- Ge as DialogOverlay,
1559
- jr as DialogPortal,
1560
- qe as DialogTitle,
1561
- vn as DialogTrigger,
1562
- wn as DialogWrapper,
1563
- pn as LevoInsightsBlock,
1564
- bn as LevoInsightsComponent,
1565
- hn as LevoInsightsPage,
1566
- jn as LevoOAuth,
1567
- mn as LevoProvider,
1568
- _n as SimpleTooltipWrapper,
1569
- Lr as Spinner,
1570
- En as Tabs,
1571
- Ir as TabsContent,
1572
- Pr as TabsList,
1573
- Ar as TabsTrigger,
1574
- xn as Toaster,
1575
- Dr as Tooltip,
1576
- Ze as TooltipContent,
1577
- Mr as TooltipPortal,
1578
- kn as TooltipProvider,
1579
- $r as TooltipTrigger,
1580
- Sn as allMediaFileExtensions,
1581
- On as allMediaMimetypes,
1582
- Ur as audioFileExtensions,
1583
- Vr as audioMimetype,
1584
- Sr as buttonVariants,
1585
- Cn as byteToSize,
1586
- R as cn,
1587
- Wr as documentFileExtensions,
1588
- Yr as documentMimetype,
1589
- Rn as errorHandler,
1590
- Rr as errorToast,
1591
- Fr as imageFileExtensions,
1592
- Hr as imageMimetype,
1593
- en as isDateObject,
1594
- Ln as isEmptyObject,
1595
- tn as isNullOrUndefined,
1596
- nn as isObject,
1597
- rn as isObjectType,
1598
- Q as mediaExtensionsByKind,
1599
- Z as mediaMimetypeByKind,
1600
- Tn as successToast,
1601
- In as toast,
1602
- V as useLevo,
1603
- $ as useLevoInsights,
1604
- Nn as useLevoOAuth,
1605
- Br as videoFileExtensions,
1606
- zr as videoMimetype
935
+ Ze as Button,
936
+ Qe as Dialog,
937
+ zt as DialogClose,
938
+ we as DialogContent,
939
+ je as DialogDescription,
940
+ tt as DialogFooter,
941
+ ye as DialogHeader,
942
+ xe as DialogOverlay,
943
+ et as DialogPortal,
944
+ Ee as DialogTitle,
945
+ Ft as DialogTrigger,
946
+ Ut as DialogWrapper,
947
+ Wt as LevoInsightsBlock,
948
+ Mt as LevoInsightsComponent,
949
+ Bt as LevoInsightsPage,
950
+ Zt as LevoOAuth,
951
+ $t as LevoProvider,
952
+ Jt as SimpleTooltipWrapper,
953
+ ot as Spinner,
954
+ Gt as Tabs,
955
+ at as TabsContent,
956
+ nt as TabsList,
957
+ st as TabsTrigger,
958
+ Yt as Toaster,
959
+ it as Tooltip,
960
+ Oe as TooltipContent,
961
+ lt as TooltipPortal,
962
+ Ht as TooltipProvider,
963
+ ct as TooltipTrigger,
964
+ Xt as allMediaFileExtensions,
965
+ qt as allMediaMimetypes,
966
+ mt as audioFileExtensions,
967
+ bt as audioMimetype,
968
+ Ke as buttonVariants,
969
+ Qt as byteToSize,
970
+ j as cn,
971
+ ut as documentFileExtensions,
972
+ pt as documentMimetype,
973
+ er as errorHandler,
974
+ rt as errorToast,
975
+ dt as imageFileExtensions,
976
+ gt as imageMimetype,
977
+ Tt as isDateObject,
978
+ tr as isEmptyObject,
979
+ Rt as isNullOrUndefined,
980
+ Nt as isObject,
981
+ _t as isObjectType,
982
+ F as mediaExtensionsByKind,
983
+ B as mediaMimetypeByKind,
984
+ Vt as successToast,
985
+ nr as toast,
986
+ Q as useLevo,
987
+ ee as useLevoInsights,
988
+ Kt as useLevoOAuth,
989
+ ft as videoFileExtensions,
990
+ vt as videoMimetype
1607
991
  };