@levo-so/react 0.1.65 → 0.1.76

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,343 @@
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 De } from "clsx";
5
+ import { twMerge as pe } from "tailwind-merge";
6
+ import { Slot as Ie, 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 Me } from "lucide-react";
9
+ import { Toaster as We, toast as q } from "sonner";
10
+ import { toast as nr } from "sonner";
11
+ import { getLevoError as ge } from "@levo-so/core";
12
+ var W = { exports: {} }, D = {};
13
+ var ie;
14
+ function Be() {
15
+ if (ie) return D;
16
+ ie = 1;
18
17
  var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
19
- function r(n, o, i) {
20
- 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, {
18
+ function r(n, s, a) {
19
+ var u = null;
20
+ if (a !== void 0 && (u = "" + a), s.key !== void 0 && (u = "" + s.key), "key" in s) {
21
+ a = {};
22
+ for (var i in s)
23
+ i !== "key" && (a[i] = s[i]);
24
+ } else a = s;
25
+ return s = a.ref, {
27
26
  $$typeof: e,
28
27
  type: n,
29
- key: l,
30
- ref: o !== void 0 ? o : null,
31
- props: i
28
+ key: u,
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 D.Fragment = t, D.jsx = r, D.jsxs = r, D;
34
+ }
35
+ var I = {};
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 b:
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 c = o.render;
70
+ return o = o.displayName, o || (o = c.displayName || c.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
71
+ case Pe:
72
+ return c = o.displayName || null, c !== null ? c : e(o.type) || "Memo";
73
+ case Y:
74
+ c = o._payload, o = o._init;
76
75
  try {
77
- return e(s(f));
76
+ return e(o(c));
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 c = !1;
90
89
  } catch {
91
- f = !0;
90
+ c = !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 (c) {
93
+ c = console;
94
+ var f = c.error, p = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
95
+ return f.call(
96
+ c,
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
+ p
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 c = e(o);
108
+ return c ? "<" + c + ">" : "<...>";
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 = G.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 u(o) {
121
+ if (te.call(o, "key")) {
122
+ var c = Object.getOwnPropertyDescriptor(o, "key").get;
123
+ if (c && c.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 i(o, c) {
128
+ function f() {
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
+ c
133
132
  ));
134
133
  }
135
- y.isReactWarning = !0, Object.defineProperty(s, "key", {
136
- get: y,
134
+ f.isReactWarning = !0, Object.defineProperty(o, "key", {
135
+ get: f,
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 m() {
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 v(o, c, f, p, M, H) {
146
+ var g = f.ref;
147
+ return o = {
148
+ $$typeof: E,
149
+ type: o,
150
+ key: c,
151
+ props: f,
152
+ _owner: p
153
+ }, (g !== void 0 ? g : 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: m
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: M
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 h(o, c, f, p, M, H) {
179
+ var g = c.children;
180
+ if (g !== void 0)
181
+ if (p)
182
+ if (Se(g)) {
183
+ for (p = 0; p < g.length; p++)
184
+ d(g[p]);
185
+ Object.freeze && Object.freeze(g);
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(g);
191
+ if (te.call(c, "key")) {
192
+ g = e(o);
193
+ var S = Object.keys(c).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
+ p = 0 < S.length ? "{key: someKey, " + S.join(": ..., ") + ": ...}" : "{key: someKey}", ae[g + p] || (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
+ p,
204
+ g,
205
+ S,
206
+ g
207
+ ), ae[g + p] = !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 (g = null, f !== void 0 && (r(f), g = "" + f), u(c) && (r(c.key), g = "" + c.key), "key" in c) {
210
+ f = {};
211
+ for (var J in c)
212
+ J !== "key" && (f[J] = c[J]);
213
+ } else f = c;
214
+ return g && i(
215
+ f,
216
+ typeof o == "function" ? o.displayName || o.name || "Unknown" : o
217
+ ), v(
218
+ o,
219
+ g,
220
+ f,
221
+ s(),
222
+ M,
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"), b = 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"), G = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, te = Object.prototype.hasOwnProperty, Se = Array.isArray, V = 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++;
247
- return p(
248
- s,
240
+ var re, oe = {}, ne = w.react_stack_bottom_frame.bind(
241
+ w,
242
+ a
243
+ )(), se = V(n(a)), ae = {};
244
+ I.Fragment = N, I.jsx = function(o, c, f) {
245
+ var p = 1e4 > G.recentlyCreatedOwnerStacks++;
246
+ return h(
247
+ o,
248
+ c,
249
249
  f,
250
- y,
251
250
  !1,
252
- T ? Error("react-stack-top-frame") : xe,
253
- T ? ie(n(s)) : Te
251
+ p ? Error("react-stack-top-frame") : ne,
252
+ p ? V(n(o)) : se
254
253
  );
255
- }, X.jsxs = function(s, f, y) {
256
- var T = 1e4 > se.recentlyCreatedOwnerStacks++;
257
- return p(
258
- s,
254
+ }, I.jsxs = function(o, c, f) {
255
+ var p = 1e4 > G.recentlyCreatedOwnerStacks++;
256
+ return h(
257
+ o,
258
+ c,
259
259
  f,
260
- y,
261
260
  !0,
262
- T ? Error("react-stack-top-frame") : xe,
263
- T ? ie(n(s)) : Te
261
+ p ? Error("react-stack-top-frame") : ne,
262
+ p ? V(n(o)) : se
264
263
  );
265
264
  };
266
- }()), X;
265
+ })()), I;
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" ? W.exports = Be() : W.exports = Fe()), W.exports;
271
270
  }
272
- var g = gt();
273
- const pe = ot({
271
+ var l = 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__ */ l.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, Mt = ({ 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;
289
- const l = () => {
286
+ const a = document.getElementById(e);
287
+ if (!a) return;
288
+ const u = () => {
290
289
  n || (r?.track("block.view", {
291
290
  ...t,
292
291
  resource: "block",
293
292
  identifier: e
294
- }), o(!0));
295
- };
296
- if (((d) => {
297
- const p = d.getBoundingClientRect();
298
- return p.top >= 0 && p.left >= 0 && p.bottom <= (window.innerHeight || document.documentElement.clientHeight) && p.right <= (window.innerWidth || document.documentElement.clientWidth);
299
- })(i)) {
300
- l();
301
- return;
302
- }
303
- const a = new IntersectionObserver(
304
- (d) => {
305
- d.forEach((p) => {
306
- p.isIntersecting && (l(), a.disconnect());
293
+ }), s(!0));
294
+ }, i = new IntersectionObserver(
295
+ (m) => {
296
+ m.forEach((v) => {
297
+ v.isIntersecting && (u(), i.disconnect());
307
298
  });
308
299
  },
309
300
  { threshold: 0 }
310
301
  );
311
- return a.observe(i), () => {
312
- a.disconnect();
302
+ return i.observe(a), () => {
303
+ i.disconnect();
313
304
  };
314
305
  }, [r, e, t, n]), null;
315
- }, bn = ({ event: e, properties: t }) => {
316
- const r = $();
317
- return k(() => {
318
- r?.instance && r?.track(e, t);
306
+ }, Wt = ({ event: e, properties: t }) => {
307
+ const r = ee();
308
+ return O(() => {
309
+ r?.track(e, t);
319
310
  }, [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"
311
+ }, Bt = ({ id: e }) => {
312
+ const t = Q(), r = ee();
313
+ return O(() => {
314
+ t && typeof window < "u" && (window.levo_client = t);
315
+ }, [t]), O(() => {
316
+ r && typeof window < "u" && (window.levo_insights = r);
317
+ }, [r]), O(() => {
318
+ r && e && r.init({
319
+ pageId: e
366
320
  });
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;
321
+ }, [r, e]), null;
419
322
  };
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
920
- });
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;
946
- };
947
- var He = {
323
+ var ve = {
948
324
  color: void 0,
949
325
  size: void 0,
950
326
  className: void 0,
951
327
  style: void 0,
952
328
  attr: void 0
953
- }, Re = I.createContext && /* @__PURE__ */ I.createContext(He), vr = ["attr", "size", "title"];
954
- function yr(e, t) {
329
+ }, ue = R.createContext && /* @__PURE__ */ R.createContext(ve), Ue = ["attr", "size", "title"];
330
+ function Ye(e, t) {
955
331
  if (e == null) return {};
956
- var r = wr(e, t), n, o;
332
+ var r = Ge(e, t), n, s;
957
333
  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]);
334
+ var a = Object.getOwnPropertySymbols(e);
335
+ for (s = 0; s < a.length; s++)
336
+ n = a[s], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
961
337
  }
962
338
  return r;
963
339
  }
964
- function wr(e, t) {
340
+ function Ge(e, t) {
965
341
  if (e == null) return {};
966
342
  var r = {};
967
343
  for (var n in e)
@@ -971,45 +347,45 @@ function wr(e, t) {
971
347
  }
972
348
  return r;
973
349
  }
974
- function ne() {
975
- return ne = Object.assign ? Object.assign.bind() : function(e) {
350
+ function z() {
351
+ return z = Object.assign ? Object.assign.bind() : function(e) {
976
352
  for (var t = 1; t < arguments.length; t++) {
977
353
  var r = arguments[t];
978
354
  for (var n in r)
979
355
  Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
980
356
  }
981
357
  return e;
982
- }, ne.apply(this, arguments);
358
+ }, z.apply(this, arguments);
983
359
  }
984
- function Le(e, t) {
360
+ function de(e, t) {
985
361
  var r = Object.keys(e);
986
362
  if (Object.getOwnPropertySymbols) {
987
363
  var n = Object.getOwnPropertySymbols(e);
988
- t && (n = n.filter(function(o) {
989
- return Object.getOwnPropertyDescriptor(e, o).enumerable;
364
+ t && (n = n.filter(function(s) {
365
+ return Object.getOwnPropertyDescriptor(e, s).enumerable;
990
366
  })), r.push.apply(r, n);
991
367
  }
992
368
  return r;
993
369
  }
994
- function oe(e) {
370
+ function U(e) {
995
371
  for (var t = 1; t < arguments.length; t++) {
996
372
  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) {
373
+ t % 2 ? de(Object(r), !0).forEach(function(n) {
374
+ Ve(e, n, r[n]);
375
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : de(Object(r)).forEach(function(n) {
1000
376
  Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
1001
377
  });
1002
378
  }
1003
379
  return e;
1004
380
  }
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;
381
+ function Ve(e, t, r) {
382
+ return t = He(t), t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
1007
383
  }
1008
- function Tr(e) {
1009
- var t = Er(e, "string");
384
+ function He(e) {
385
+ var t = Je(e, "string");
1010
386
  return typeof t == "symbol" ? t : t + "";
1011
387
  }
1012
- function Er(e, t) {
388
+ function Je(e, t) {
1013
389
  if (typeof e != "object" || !e) return e;
1014
390
  var r = e[Symbol.toPrimitive];
1015
391
  if (r !== void 0) {
@@ -1019,43 +395,43 @@ function Er(e, t) {
1019
395
  }
1020
396
  return (t === "string" ? String : Number)(e);
1021
397
  }
1022
- function ze(e) {
1023
- return e && e.map((t, r) => /* @__PURE__ */ I.createElement(t.tag, oe({
398
+ function be(e) {
399
+ return e && e.map((t, r) => /* @__PURE__ */ R.createElement(t.tag, U({
1024
400
  key: r
1025
- }, t.attr), ze(t.child)));
401
+ }, t.attr), be(t.child)));
1026
402
  }
1027
- function kr(e) {
1028
- return (t) => /* @__PURE__ */ I.createElement(_r, ne({
1029
- attr: oe({}, e.attr)
1030
- }, t), ze(e.child));
403
+ function Xe(e) {
404
+ return (t) => /* @__PURE__ */ R.createElement(qe, z({
405
+ attr: U({}, e.attr)
406
+ }, t), be(e.child));
1031
407
  }
1032
- function _r(e) {
408
+ function qe(e) {
1033
409
  var t = (r) => {
1034
410
  var {
1035
411
  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({
412
+ size: s,
413
+ title: a
414
+ } = e, u = Ye(e, Ue), i = s || r.size || "1em", m;
415
+ return r.className && (m = r.className), e.className && (m = (m ? m + " " : "") + e.className), /* @__PURE__ */ R.createElement("svg", z({
1040
416
  stroke: "currentColor",
1041
417
  fill: "currentColor",
1042
418
  strokeWidth: "0"
1043
- }, r.attr, n, l, {
1044
- className: a,
1045
- style: oe(oe({
419
+ }, r.attr, n, u, {
420
+ className: m,
421
+ style: U(U({
1046
422
  color: e.color || r.color
1047
423
  }, r.style), e.style),
1048
- height: c,
1049
- width: c,
424
+ height: i,
425
+ width: i,
1050
426
  xmlns: "http://www.w3.org/2000/svg"
1051
- }), i && /* @__PURE__ */ I.createElement("title", null, i), e.children);
427
+ }), a && /* @__PURE__ */ R.createElement("title", null, a), e.children);
1052
428
  };
1053
- return Re !== void 0 ? /* @__PURE__ */ I.createElement(Re.Consumer, null, (r) => t(r)) : t(He);
429
+ return ue !== void 0 ? /* @__PURE__ */ R.createElement(ue.Consumer, null, (r) => t(r)) : t(ve);
1054
430
  }
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);
431
+ function he(e) {
432
+ 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
433
  }
1058
- const R = (...e) => Pe(st(e)), Sr = ct(
434
+ const j = (...e) => pe(De(e)), Ke = $e(
1059
435
  "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
436
  {
1061
437
  variants: {
@@ -1090,118 +466,118 @@ const R = (...e) => Pe(st(e)), Sr = ct(
1090
466
  rounded: "default"
1091
467
  }
1092
468
  }
1093
- ), Or = D.forwardRef(
469
+ ), Ze = _.forwardRef(
1094
470
  ({
1095
471
  className: e,
1096
472
  variant: t,
1097
473
  size: r,
1098
474
  rounded: n,
1099
- asChild: o = !1,
1100
- isLoading: i = !1,
1101
- loadingText: l,
1102
- disabled: c,
1103
- ...a
1104
- }, d) => {
1105
- const p = o ? at.Root : "button";
1106
- return /* @__PURE__ */ g.jsx(
1107
- p,
475
+ asChild: s = !1,
476
+ isLoading: a = !1,
477
+ loadingText: u,
478
+ disabled: i,
479
+ ...m
480
+ }, v) => {
481
+ const h = s ? Ie.Root : "button";
482
+ return /* @__PURE__ */ l.jsx(
483
+ h,
1108
484
  {
1109
- className: R(Sr({ variant: t, size: r, rounded: n, className: e })),
1110
- ref: d,
1111
- disabled: c || i,
485
+ className: j(Ke({ variant: t, size: r, rounded: n, className: e })),
486
+ ref: v,
487
+ disabled: i || a,
1112
488
  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" : "") }),
1116
- l
1117
- ] }) : a.children
489
+ ...m,
490
+ children: a ? /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
491
+ /* @__PURE__ */ l.jsx(he, { className: pe("h-4 w-4 animate-spin", u ? "mr-2" : "") }),
492
+ u
493
+ ] }) : m.children
1118
494
  }
1119
495
  );
1120
496
  }
1121
497
  );
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,
498
+ Ze.displayName = "Button";
499
+ const Qe = y.Root, Ft = y.Trigger, et = y.Portal, zt = y.Close, xe = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ l.jsx(
500
+ y.Overlay,
1125
501
  {
1126
502
  ref: r,
1127
- className: R(
503
+ className: j(
1128
504
  "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
505
  e
1130
506
  ),
1131
507
  ...t
1132
508
  }
1133
509
  ));
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,
510
+ xe.displayName = y.Overlay.displayName;
511
+ const we = _.forwardRef(({ className: e, children: t, container: r, hideCloseButton: n, overlayStyles: s, ...a }, u) => /* @__PURE__ */ l.jsx(et, { container: r, children: /* @__PURE__ */ l.jsx(xe, { className: s, children: /* @__PURE__ */ l.jsxs(
512
+ y.Content,
1137
513
  {
1138
- ref: l,
1139
- className: R(
514
+ ref: u,
515
+ className: j(
1140
516
  "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
517
  e
1142
518
  ),
1143
- ...i,
519
+ ...a,
1144
520
  children: [
1145
521
  t,
1146
- !n && /* @__PURE__ */ g.jsxs(
1147
- j.Close,
522
+ !n && /* @__PURE__ */ l.jsxs(
523
+ y.Close,
1148
524
  {
1149
525
  type: "button",
1150
526
  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
527
  children: [
1152
- /* @__PURE__ */ g.jsx(lt, { className: "h-4 w-4" }),
1153
- /* @__PURE__ */ g.jsx("span", { className: "sr-only", children: "Close" })
528
+ /* @__PURE__ */ l.jsx(Me, { className: "h-4 w-4" }),
529
+ /* @__PURE__ */ l.jsx("span", { className: "sr-only", children: "Close" })
1154
530
  ]
1155
531
  }
1156
532
  )
1157
533
  ]
1158
534
  }
1159
535
  ) }) }));
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(
536
+ we.displayName = y.Content.displayName;
537
+ const ye = ({ className: e, ...t }) => /* @__PURE__ */ l.jsx("div", { className: j("flex flex-col space-y-1.5 text-center sm:text-left", e), ...t });
538
+ ye.displayName = "DialogHeader";
539
+ const tt = ({ className: e, ...t }) => /* @__PURE__ */ l.jsx(
1164
540
  "div",
1165
541
  {
1166
- className: R("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
542
+ className: j("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
1167
543
  ...t
1168
544
  }
1169
545
  );
1170
- Cr.displayName = "DialogFooter";
1171
- const qe = D.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1172
- j.Title,
546
+ tt.displayName = "DialogFooter";
547
+ const Ee = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ l.jsx(
548
+ y.Title,
1173
549
  {
1174
550
  ref: r,
1175
- className: R("font-semibold text-lg leading-none tracking-tight", e),
551
+ className: j("font-semibold text-lg leading-none tracking-tight", e),
1176
552
  ...t
1177
553
  }
1178
554
  ));
1179
- qe.displayName = j.Title.displayName;
1180
- const Ke = D.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1181
- j.Description,
555
+ Ee.displayName = y.Title.displayName;
556
+ const je = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ l.jsx(
557
+ y.Description,
1182
558
  {
1183
559
  ref: r,
1184
- className: R("text-muted-foreground text-sm", e),
560
+ className: j("text-muted-foreground text-sm", e),
1185
561
  ...t
1186
562
  }
1187
563
  ));
1188
- Ke.displayName = j.Description.displayName;
1189
- const wn = ({
564
+ je.displayName = y.Description.displayName;
565
+ const Ut = ({
1190
566
  isOpen: e,
1191
567
  onClose: t,
1192
568
  children: r,
1193
569
  title: n,
1194
- description: o = "",
1195
- contentClassName: i,
1196
- 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 })
570
+ description: s = "",
571
+ contentClassName: a,
572
+ modal: u = !0
573
+ }) => /* @__PURE__ */ l.jsx(Qe, { open: e, onOpenChange: t, modal: u, children: /* @__PURE__ */ l.jsxs(we, { className: a, children: [
574
+ n && /* @__PURE__ */ l.jsxs(ye, { className: "flex-1 font-medium", children: [
575
+ /* @__PURE__ */ l.jsx(Ee, { children: n }),
576
+ /* @__PURE__ */ l.jsx(je, { children: s })
1201
577
  ] }),
1202
- /* @__PURE__ */ g.jsx("div", { className: "w-full", children: r })
1203
- ] }) }), xn = ({ ...e }) => /* @__PURE__ */ g.jsx(
1204
- ut,
578
+ /* @__PURE__ */ l.jsx("div", { className: "w-full", children: r })
579
+ ] }) }), Yt = ({ ...e }) => /* @__PURE__ */ l.jsx(
580
+ We,
1205
581
  {
1206
582
  closeButton: !0,
1207
583
  richColors: !0,
@@ -1216,37 +592,37 @@ const wn = ({
1216
592
  },
1217
593
  ...e
1218
594
  }
1219
- ), Rr = (e, t = "Error", r = {}) => {
1220
- de.error(t, {
595
+ ), rt = (e, t = "Error", r = {}) => {
596
+ q.error(t, {
1221
597
  description: e,
1222
598
  duration: 4e3,
1223
599
  position: "bottom-right",
1224
600
  ...r
1225
601
  });
1226
- }, Tn = (e, t = "Success", r = {}) => {
1227
- r?.id && de.dismiss(r?.id), de.success(t, {
602
+ }, Gt = (e, t = "Success", r = {}) => {
603
+ r?.id && q.dismiss(r?.id), q.success(t, {
1228
604
  description: e,
1229
605
  duration: 4e3,
1230
606
  position: "bottom-right",
1231
607
  ...r
1232
608
  });
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,
609
+ }, ot = ({ className: e }) => /* @__PURE__ */ l.jsx(he, { className: j("h-8 w-8 animate-spin font-light", e) }), Vt = k.Root, nt = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ l.jsx(
610
+ k.List,
1235
611
  {
1236
612
  ref: r,
1237
- className: R(
613
+ className: j(
1238
614
  "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
1239
615
  e
1240
616
  ),
1241
617
  ...t
1242
618
  }
1243
619
  ));
1244
- Pr.displayName = W.List.displayName;
1245
- const Ar = D.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1246
- W.Trigger,
620
+ nt.displayName = k.List.displayName;
621
+ const st = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ l.jsx(
622
+ k.Trigger,
1247
623
  {
1248
624
  ref: r,
1249
- className: R(
625
+ className: j(
1250
626
  "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
627
  e
1252
628
  ),
@@ -1254,36 +630,36 @@ const Ar = D.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1254
630
  ...t
1255
631
  }
1256
632
  ));
1257
- Ar.displayName = W.Trigger.displayName;
1258
- const Ir = D.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ g.jsx(
1259
- W.Content,
633
+ st.displayName = k.Trigger.displayName;
634
+ const at = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ l.jsx(
635
+ k.Content,
1260
636
  {
1261
637
  ref: r,
1262
- className: R(
638
+ className: j(
1263
639
  "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1264
640
  e
1265
641
  ),
1266
642
  ...t
1267
643
  }
1268
644
  ));
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,
645
+ at.displayName = k.Content.displayName;
646
+ const Ht = A.Provider, it = A.Root, ct = A.Trigger, lt = A.Portal, Oe = _.forwardRef(({ className: e, sideOffset: t = 4, ...r }, n) => /* @__PURE__ */ l.jsx(
647
+ A.Content,
1272
648
  {
1273
649
  ref: n,
1274
650
  sideOffset: t,
1275
- className: R(
651
+ className: j(
1276
652
  "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
653
  e
1278
654
  ),
1279
655
  ...r
1280
656
  }
1281
657
  ));
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 = [
658
+ Oe.displayName = A.Content.displayName;
659
+ const Jt = ({ children: e, label: t, labelClassName: r, asChild: n = !0, contentProps: s = {}, side: a }) => /* @__PURE__ */ l.jsxs(it, { children: [
660
+ t && /* @__PURE__ */ l.jsx(lt, { children: /* @__PURE__ */ l.jsx(Oe, { side: a, className: r, ...s, children: t }) }),
661
+ /* @__PURE__ */ l.jsx(ct, { asChild: n, children: e })
662
+ ] }), ut = [
1287
663
  "pdf",
1288
664
  "txt",
1289
665
  "xml",
@@ -1297,7 +673,7 @@ const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1297
673
  "odp",
1298
674
  "ppt",
1299
675
  "pptx"
1300
- ], Fr = ["svg", "png", "jpg", "jpeg", "gif", "webp", "avif"], Br = ["mp4", "ogv", "webm"], Ur = ["mp3", "ogg", "opus"], Yr = {
676
+ ], dt = ["svg", "png", "jpg", "jpeg", "gif", "webp", "avif"], ft = ["mp4", "ogv", "webm"], mt = ["mp3", "ogg", "opus"], pt = {
1301
677
  "application/xml": [".xml"],
1302
678
  "text/plain": [".txt"],
1303
679
  "application/pdf": [".pdf"],
@@ -1306,7 +682,7 @@ const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1306
682
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
1307
683
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
1308
684
  "text/csv": [".csv"]
1309
- }, Hr = {
685
+ }, gt = {
1310
686
  "image/jpeg": [".jpeg", ".jpg"],
1311
687
  "image/jpg": [".jpg"],
1312
688
  "image/png": [".png"],
@@ -1315,35 +691,35 @@ const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1315
691
  "image/svg+xml": [".svg"],
1316
692
  "image/webp": [".webp"],
1317
693
  "image/avif": [".avif"]
1318
- }, zr = {
694
+ }, vt = {
1319
695
  "video/mp4": [".mp4"],
1320
696
  "video/mpeg": [".mpeg"],
1321
697
  "video/webm": [".webm"]
1322
- }, Vr = {
698
+ }, bt = {
1323
699
  "audio/mpeg": [".mp3"],
1324
700
  "audio/ogg": [".oga"],
1325
701
  "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({
702
+ }, B = {
703
+ audio: bt,
704
+ document: pt,
705
+ image: gt,
706
+ video: vt
707
+ }, F = {
708
+ audio: mt,
709
+ document: ut,
710
+ image: dt,
711
+ video: ft
712
+ }, Xt = [
713
+ ...F.audio,
714
+ ...F.document,
715
+ ...F.image,
716
+ ...F.video
717
+ ], qt = {
718
+ ...B.audio,
719
+ ...B.document,
720
+ ...B.image,
721
+ ...B.video
722
+ }, Te = R.createContext({
1347
723
  urls: null,
1348
724
  title: "",
1349
725
  isLoading: !1,
@@ -1351,62 +727,62 @@ const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1351
727
  },
1352
728
  onError: () => {
1353
729
  }
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) => {
730
+ }), ht = ({ title: e, onSuccess: t, onError: r, children: n }) => {
731
+ const s = Q(), a = typeof window < "u" ? window.location.href : "", [u, i] = P(null), [m, v] = P(!1);
732
+ O(() => {
733
+ s.membership && (v(!0), s.membership?.getOAuthURL().then((d) => {
734
+ i(d);
735
+ }).catch((d) => {
1360
736
  r({
1361
- code: u?.code || "SOMETHING_WENT_WRONG",
1362
- message: u?.message || "We could not connect with our service for your sign-in."
737
+ code: d?.code || "SOMETHING_WENT_WRONG",
738
+ message: d?.message || "We could not connect with our service for your sign-in."
1363
739
  });
1364
740
  }).finally(() => {
1365
- d(!1);
741
+ v(!1);
1366
742
  }));
1367
743
  }, []);
1368
- const p = me(
1369
- () => ({ title: e, urls: l, isLoading: a, onSuccess: t, onError: r }),
1370
- [e, l, t, r, a]
744
+ const h = fe(
745
+ () => ({ title: e, urls: u, isLoading: m, onSuccess: t, onError: r }),
746
+ [e, u, t, r, m]
1371
747
  );
1372
- return k(() => {
1373
- if (l && i) {
1374
- const u = {}, m = Object.keys(l);
1375
- for (const b of m)
748
+ return O(() => {
749
+ if (u && a) {
750
+ const d = {}, T = Object.keys(u);
751
+ for (const w of T)
1376
752
  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();
753
+ const E = u[w];
754
+ if (E) {
755
+ const C = new URL(E), N = C.searchParams;
756
+ N.set("redirect_uri", a);
757
+ const L = s.pageContext;
758
+ L && N.set("page_context", JSON.stringify(L)), d[w] = C.toString();
1383
759
  }
1384
760
  } catch {
1385
761
  }
1386
- c(u);
762
+ i(d);
1387
763
  }
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;
764
+ }, [a]), /* @__PURE__ */ l.jsx(Te.Provider, { value: h, children: n });
765
+ }, xt = () => K(Te), wt = ({ url: e, title: t, height: r, width: n }) => {
766
+ const s = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - r) / 2.5;
1391
767
  return window.open(
1392
768
  e,
1393
769
  t,
1394
- `width=${n},height=${r},left=${o},top=${i}`
770
+ `width=${n},height=${r},left=${s},top=${a}`
1395
771
  );
1396
- }, qr = ({
772
+ }, yt = ({
1397
773
  title: e = "",
1398
774
  width: t = 500,
1399
775
  height: r = 500,
1400
776
  url: n,
1401
- children: o,
1402
- onCode: i,
1403
- onClose: l
777
+ children: s,
778
+ onCode: a,
779
+ onClose: u
1404
780
  }) => {
1405
- const [c, a] = N(), d = H(void 0), p = () => {
1406
- window.clearInterval(d.current);
1407
- }, u = () => {
1408
- a(
1409
- Jr({
781
+ const [i, m] = P(), v = me(void 0), h = () => {
782
+ window.clearInterval(v.current);
783
+ }, d = () => {
784
+ m(
785
+ wt({
1410
786
  url: n,
1411
787
  title: e,
1412
788
  width: t,
@@ -1414,107 +790,107 @@ const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1414
790
  })
1415
791
  );
1416
792
  };
1417
- return k(() => (c && (d.current = window.setInterval(() => {
793
+ return O(() => (i && (v.current = window.setInterval(() => {
1418
794
  try {
1419
- const m = c.location.href, b = new URL(m).searchParams, h = b.get("code");
1420
- if (!h)
795
+ const T = i.location.href, w = new URL(T).searchParams, E = w.get("code");
796
+ if (!E)
1421
797
  return;
1422
- i(h, b), p(), c.close();
798
+ a(E, w), h(), i.close();
1423
799
  } catch {
1424
800
  } finally {
1425
- (!c || c.closed) && (l(), p());
801
+ (!i || i.closed) && (u(), h());
1426
802
  }
1427
803
  }, 700)), () => {
1428
- c && c.close(), l && l();
1429
- }), [c]), /* @__PURE__ */ g.jsx(
804
+ i && i.close(), u && u();
805
+ }), [i]), /* @__PURE__ */ l.jsx(
1430
806
  "div",
1431
807
  {
1432
808
  onClick: () => {
1433
- u();
809
+ d();
1434
810
  },
1435
- children: o
811
+ children: s
1436
812
  }
1437
813
  );
1438
- }, Kr = ({
814
+ }, Et = ({
1439
815
  title: e = "Levo",
1440
816
  url: t,
1441
817
  children: r,
1442
818
  onSuccess: n,
1443
- onError: o,
1444
- width: i = 500,
1445
- height: l = 700
819
+ onError: s,
820
+ width: a = 500,
821
+ height: u = 700
1446
822
  }) => {
1447
- const c = ee((a, d) => {
1448
- a.toLowerCase() === "success" ? n(d) : o(d);
823
+ const i = X((m, v) => {
824
+ m.toLowerCase() === "success" ? n(v) : s(v);
1449
825
  }, []);
1450
- return /* @__PURE__ */ g.jsx(
1451
- qr,
826
+ return /* @__PURE__ */ l.jsx(
827
+ yt,
1452
828
  {
1453
829
  title: e,
1454
- width: i,
1455
- height: l,
830
+ width: a,
831
+ height: u,
1456
832
  onClose: () => {
1457
833
  },
1458
834
  url: t,
1459
- onCode: c,
835
+ onCode: i,
1460
836
  children: r
1461
837
  }
1462
838
  );
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;
839
+ }, jt = ({ children: e, provider: t }) => {
840
+ const { title: r, urls: n, isLoading: s, onSuccess: a, onError: u } = xt(), i = n?.[t];
841
+ return i ? /* @__PURE__ */ l.jsx(Et, { title: r, provider: t, url: i, onSuccess: a, onError: u, children: s ? /* @__PURE__ */ l.jsx("div", { className: "w-full items-center justify-center", children: /* @__PURE__ */ l.jsx(ot, { className: "h-5 w-5 bg-brand" }) }) : e }) : null;
842
+ }, Ot = ({ url: e, title: t, height: r, width: n }) => {
843
+ const s = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - r) / 2.5;
1468
844
  return window.open(
1469
845
  e,
1470
846
  t,
1471
- `width=${n},height=${r},left=${o},top=${i}`
847
+ `width=${n},height=${r},left=${s},top=${a}`
1472
848
  );
1473
- }, Nn = ({
849
+ }, Kt = ({
1474
850
  title: e = "Levo",
1475
851
  width: t = 500,
1476
852
  height: r = 700,
1477
853
  onSuccess: n
1478
854
  }) => {
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(_);
855
+ const s = Q(), [a, u] = P(!1), [i, m] = P(null), [v, h] = P(null), [d, T] = P(), w = me(void 0), E = () => {
856
+ window.clearInterval(w.current);
857
+ }, C = X((b, x) => {
858
+ b.toLowerCase() === "success" ? (h(null), n(x)) : h(x);
1483
859
  }, []);
1484
- k(() => {
1485
- o.membership && (l(!0), o.membership?.getOAuthURL().then((w) => {
1486
- if (w)
1487
- return a(w), w;
860
+ O(() => {
861
+ s.membership && (u(!0), s.membership?.getOAuthURL().then((b) => {
862
+ if (b)
863
+ return m(b), b;
1488
864
  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."
865
+ }).catch((b) => {
866
+ const x = ge(b);
867
+ s.logger?.error("Failed to get OAuth URL", x.message), h({
868
+ code: x?.code || "SOMETHING_WENT_WRONG",
869
+ message: x?.message || "We could not connect with our service for your sign-in."
1494
870
  });
1495
871
  }).finally(() => {
1496
- l(!1);
872
+ u(!1);
1497
873
  }));
1498
- }, []), k(() => (u && (b.current = window.setInterval(() => {
874
+ }, []), O(() => (d && (w.current = window.setInterval(() => {
1499
875
  try {
1500
- const w = u.location.href, _ = new URL(w).searchParams, P = _.get("code");
1501
- if (!P)
876
+ const b = d.location.href, x = new URL(b).searchParams, $ = x.get("code");
877
+ if (!$)
1502
878
  return;
1503
- O(P, _), h(), u.close();
879
+ C($, x), E(), d.close();
1504
880
  } catch {
1505
881
  } finally {
1506
- (!u || u.closed) && (h(), p(null));
882
+ (!d || d.closed) && (E(), h(null));
1507
883
  }
1508
884
  }, 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: _,
885
+ d && d.close();
886
+ }), [d]);
887
+ const N = X(
888
+ (b) => {
889
+ if (b && i !== null) {
890
+ const x = i?.[b];
891
+ x && (d && d.close(), T(
892
+ Ot({
893
+ url: x,
1518
894
  title: e,
1519
895
  width: t,
1520
896
  height: r
@@ -1522,86 +898,86 @@ const _n = ({ children: e, label: t, labelClassName: r, asChild: n = !0, content
1522
898
  ));
1523
899
  }
1524
900
  },
1525
- [c, u]
901
+ [i, d]
1526
902
  );
1527
903
  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
904
+ providers: fe(() => i !== null ? Object.keys(i).filter(
905
+ (b) => !!i[b]
906
+ ) : [], [i]),
907
+ isLoading: a,
908
+ error: v,
909
+ launchPopup: N
1534
910
  };
1535
911
  };
1536
- class jn {
1537
- static Container = Gr;
1538
- static Button = Zr;
912
+ class Zt {
913
+ static Container = ht;
914
+ static Button = jt;
1539
915
  }
1540
- const Cn = (e, t = 2) => {
916
+ const Qt = (e, t = 2) => {
1541
917
  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", {
918
+ 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));
919
+ return `${Number.parseFloat((e / r ** a).toFixed(n))} ${s[a]}`;
920
+ }, er = (e) => {
921
+ const t = ge(e);
922
+ return t?.code === "REQUEST_TIMEOUT" || t?.code === "NETWORK_ERROR" || t?.status === 408 || t?.status === 0 || rt(t?.message || "", t?.title || "Error", {
1547
923
  id: `${t?.title || ""}-${t?.message || ""}`
1548
924
  }), 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;
925
+ }, 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
926
  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
927
+ Ze as Button,
928
+ Qe as Dialog,
929
+ zt as DialogClose,
930
+ we as DialogContent,
931
+ je as DialogDescription,
932
+ tt as DialogFooter,
933
+ ye as DialogHeader,
934
+ xe as DialogOverlay,
935
+ et as DialogPortal,
936
+ Ee as DialogTitle,
937
+ Ft as DialogTrigger,
938
+ Ut as DialogWrapper,
939
+ Mt as LevoInsightsBlock,
940
+ Wt as LevoInsightsComponent,
941
+ Bt as LevoInsightsPage,
942
+ Zt as LevoOAuth,
943
+ $t as LevoProvider,
944
+ Jt as SimpleTooltipWrapper,
945
+ ot as Spinner,
946
+ Vt as Tabs,
947
+ at as TabsContent,
948
+ nt as TabsList,
949
+ st as TabsTrigger,
950
+ Yt as Toaster,
951
+ it as Tooltip,
952
+ Oe as TooltipContent,
953
+ lt as TooltipPortal,
954
+ Ht as TooltipProvider,
955
+ ct as TooltipTrigger,
956
+ Xt as allMediaFileExtensions,
957
+ qt as allMediaMimetypes,
958
+ mt as audioFileExtensions,
959
+ bt as audioMimetype,
960
+ Ke as buttonVariants,
961
+ Qt as byteToSize,
962
+ j as cn,
963
+ ut as documentFileExtensions,
964
+ pt as documentMimetype,
965
+ er as errorHandler,
966
+ rt as errorToast,
967
+ dt as imageFileExtensions,
968
+ gt as imageMimetype,
969
+ Tt as isDateObject,
970
+ tr as isEmptyObject,
971
+ Rt as isNullOrUndefined,
972
+ Nt as isObject,
973
+ _t as isObjectType,
974
+ F as mediaExtensionsByKind,
975
+ B as mediaMimetypeByKind,
976
+ Gt as successToast,
977
+ nr as toast,
978
+ Q as useLevo,
979
+ ee as useLevoInsights,
980
+ Kt as useLevoOAuth,
981
+ ft as videoFileExtensions,
982
+ vt as videoMimetype
1607
983
  };