@levo-so/react 0.1.76 → 0.1.78

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,983 +1,82 @@
1
- "use client";
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;
17
- var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
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, {
26
- $$typeof: e,
27
- type: n,
28
- key: u,
29
- ref: s !== void 0 ? s : null,
30
- props: a
31
- };
32
- }
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:
46
- return "Fragment";
47
- case b:
48
- return "Profiler";
49
- case L:
50
- return "StrictMode";
51
- case _e:
52
- return "Suspense";
53
- case Ne:
54
- return "SuspenseList";
55
- case ke:
56
- return "Activity";
57
- }
58
- if (typeof o == "object")
59
- switch (typeof o.tag == "number" && console.error(
60
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
61
- ), o.$$typeof) {
62
- case C:
63
- return "Portal";
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;
75
- try {
76
- return e(o(c));
77
- } catch {
78
- }
79
- }
80
- return null;
81
- }
82
- function t(o) {
83
- return "" + o;
84
- }
85
- function r(o) {
86
- try {
87
- t(o);
88
- var c = !1;
89
- } catch {
90
- c = !0;
91
- }
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,
97
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
98
- p
99
- ), t(o);
100
- }
101
- }
102
- function n(o) {
103
- if (o === N) return "<>";
104
- if (typeof o == "object" && o !== null && o.$$typeof === Y)
105
- return "<...>";
106
- try {
107
- var c = e(o);
108
- return c ? "<" + c + ">" : "<...>";
109
- } catch {
110
- return "<...>";
111
- }
112
- }
113
- function s() {
114
- var o = G.A;
115
- return o === null ? null : o.getOwner();
116
- }
117
- function a() {
118
- return Error("react-stack-top-frame");
119
- }
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;
124
- }
125
- return o.key !== void 0;
126
- }
127
- function i(o, c) {
128
- function f() {
129
- re || (re = !0, console.error(
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)",
131
- c
132
- ));
133
- }
134
- f.isReactWarning = !0, Object.defineProperty(o, "key", {
135
- get: f,
136
- configurable: !0
137
- });
138
- }
139
- function m() {
140
- var o = e(this.type);
141
- return oe[o] || (oe[o] = !0, console.error(
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."
143
- )), o = this.props.ref, o !== void 0 ? o : null;
144
- }
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", {
154
- enumerable: !1,
155
- get: m
156
- }) : Object.defineProperty(o, "ref", { enumerable: !1, value: null }), o._store = {}, Object.defineProperty(o._store, "validated", {
157
- configurable: !1,
158
- enumerable: !1,
159
- writable: !0,
160
- value: 0
161
- }), Object.defineProperty(o, "_debugInfo", {
162
- configurable: !1,
163
- enumerable: !1,
164
- writable: !0,
165
- value: null
166
- }), Object.defineProperty(o, "_debugStack", {
167
- configurable: !1,
168
- enumerable: !1,
169
- writable: !0,
170
- value: M
171
- }), Object.defineProperty(o, "_debugTask", {
172
- configurable: !1,
173
- enumerable: !1,
174
- writable: !0,
175
- value: H
176
- }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
177
- }
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);
186
- } else
187
- console.error(
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."
189
- );
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";
195
- });
196
- p = 0 < S.length ? "{key: someKey, " + S.join(": ..., ") + ": ...}" : "{key: someKey}", ae[g + p] || (S = 0 < S.length ? "{" + S.join(": ..., ") + ": ...}" : "{}", console.error(
197
- `A props object containing a "key" prop is being spread into JSX:
198
- let props = %s;
199
- <%s {...props} />
200
- React keys must be passed directly to JSX without using spread:
201
- let props = %s;
202
- <%s key={someKey} {...props} />`,
203
- p,
204
- g,
205
- S,
206
- g
207
- ), ae[g + p] = !0);
208
- }
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
224
- );
225
- }
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));
228
- }
229
- function T(o) {
230
- return typeof o == "object" && o !== null && o.$$typeof === E;
231
- }
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() {
233
- return null;
234
- };
235
- w = {
236
- react_stack_bottom_frame: function(o) {
237
- return o();
238
- }
239
- };
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
- f,
250
- !1,
251
- p ? Error("react-stack-top-frame") : ne,
252
- p ? V(n(o)) : se
253
- );
254
- }, I.jsxs = function(o, c, f) {
255
- var p = 1e4 > G.recentlyCreatedOwnerStacks++;
256
- return h(
257
- o,
258
- c,
259
- f,
260
- !0,
261
- p ? Error("react-stack-top-frame") : ne,
262
- p ? V(n(o)) : se
263
- );
264
- };
265
- })()), I;
266
- }
267
- var le;
268
- function ze() {
269
- return le || (le = 1, process.env.NODE_ENV === "production" ? W.exports = Be() : W.exports = Fe()), W.exports;
270
- }
271
- var l = ze();
272
- const Z = Le({
273
- client: null,
274
- insights: null
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);
277
- if (!e.client)
278
- throw new Error(
279
- "useLevo must be used within a LevoProvider. Please ensure you have wrapped your component tree with LevoProvider."
280
- );
281
- return e.client;
282
- }, ee = () => K(Z).insights, Mt = ({ id: e, properties: t = {} }) => {
283
- const r = ee(), [n, s] = P(!1);
284
- return O(() => {
285
- if (n || typeof r?.track != "function") return;
286
- const a = document.getElementById(e);
287
- if (!a) return;
288
- const u = () => {
289
- n || (r?.track("block.view", {
290
- ...t,
291
- resource: "block",
292
- identifier: e
293
- }), s(!0));
294
- }, i = new IntersectionObserver(
295
- (m) => {
296
- m.forEach((v) => {
297
- v.isIntersecting && (u(), i.disconnect());
298
- });
299
- },
300
- { threshold: 0 }
301
- );
302
- return i.observe(a), () => {
303
- i.disconnect();
304
- };
305
- }, [r, e, t, n]), null;
306
- }, Wt = ({ event: e, properties: t }) => {
307
- const r = ee();
308
- return O(() => {
309
- r?.track(e, t);
310
- }, [r, e, t]), null;
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
320
- });
321
- }, [r, e]), null;
322
- };
323
- var ve = {
324
- color: void 0,
325
- size: void 0,
326
- className: void 0,
327
- style: void 0,
328
- attr: void 0
329
- }, ue = R.createContext && /* @__PURE__ */ R.createContext(ve), Ue = ["attr", "size", "title"];
330
- function Ye(e, t) {
331
- if (e == null) return {};
332
- var r = Ge(e, t), n, s;
333
- if (Object.getOwnPropertySymbols) {
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]);
337
- }
338
- return r;
339
- }
340
- function Ge(e, t) {
341
- if (e == null) return {};
342
- var r = {};
343
- for (var n in e)
344
- if (Object.prototype.hasOwnProperty.call(e, n)) {
345
- if (t.indexOf(n) >= 0) continue;
346
- r[n] = e[n];
347
- }
348
- return r;
349
- }
350
- function z() {
351
- return z = Object.assign ? Object.assign.bind() : function(e) {
352
- for (var t = 1; t < arguments.length; t++) {
353
- var r = arguments[t];
354
- for (var n in r)
355
- Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
356
- }
357
- return e;
358
- }, z.apply(this, arguments);
359
- }
360
- function de(e, t) {
361
- var r = Object.keys(e);
362
- if (Object.getOwnPropertySymbols) {
363
- var n = Object.getOwnPropertySymbols(e);
364
- t && (n = n.filter(function(s) {
365
- return Object.getOwnPropertyDescriptor(e, s).enumerable;
366
- })), r.push.apply(r, n);
367
- }
368
- return r;
369
- }
370
- function U(e) {
371
- for (var t = 1; t < arguments.length; t++) {
372
- var r = arguments[t] != null ? arguments[t] : {};
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) {
376
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
377
- });
378
- }
379
- return e;
380
- }
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;
383
- }
384
- function He(e) {
385
- var t = Je(e, "string");
386
- return typeof t == "symbol" ? t : t + "";
387
- }
388
- function Je(e, t) {
389
- if (typeof e != "object" || !e) return e;
390
- var r = e[Symbol.toPrimitive];
391
- if (r !== void 0) {
392
- var n = r.call(e, t);
393
- if (typeof n != "object") return n;
394
- throw new TypeError("@@toPrimitive must return a primitive value.");
395
- }
396
- return (t === "string" ? String : Number)(e);
397
- }
398
- function be(e) {
399
- return e && e.map((t, r) => /* @__PURE__ */ R.createElement(t.tag, U({
400
- key: r
401
- }, t.attr), be(t.child)));
402
- }
403
- function Xe(e) {
404
- return (t) => /* @__PURE__ */ R.createElement(qe, z({
405
- attr: U({}, e.attr)
406
- }, t), be(e.child));
407
- }
408
- function qe(e) {
409
- var t = (r) => {
410
- var {
411
- attr: n,
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({
416
- stroke: "currentColor",
417
- fill: "currentColor",
418
- strokeWidth: "0"
419
- }, r.attr, n, u, {
420
- className: m,
421
- style: U(U({
422
- color: e.color || r.color
423
- }, r.style), e.style),
424
- height: i,
425
- width: i,
426
- xmlns: "http://www.w3.org/2000/svg"
427
- }), a && /* @__PURE__ */ R.createElement("title", null, a), e.children);
428
- };
429
- return ue !== void 0 ? /* @__PURE__ */ R.createElement(ue.Consumer, null, (r) => t(r)) : t(ve);
430
- }
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);
433
- }
434
- const j = (...e) => pe(De(e)), Ke = $e(
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",
436
- {
437
- variants: {
438
- variant: {
439
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
440
- destructive: "bg-destructive text-white hover:bg-destructive/90",
441
- destructiveOutline: "border border-red-500 bg-transparent text-destructive shadow-sm hover:bg-destructive hover:text-white",
442
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
443
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
444
- secondaryOutline: "border border-white border-solid bg-transparent hover:border-input hover:bg-white",
445
- ghost: "hover:bg-accent hover:text-accent-foreground",
446
- link: "text-primary underline-offset-4 hover:underline"
447
- },
448
- size: {
449
- default: "h-10 px-4 py-2",
450
- xs: "h-8 px-3 text-xs",
451
- sm: "h-9 px-3",
452
- lg: "h-11 px-8",
453
- icon: "h-10 w-10",
454
- "icon-small": "h-8 w-8"
455
- },
456
- rounded: {
457
- small: "rounded",
458
- default: "rounded-md",
459
- large: "rounded-lg",
460
- full: "rounded-full"
461
- }
462
- },
463
- defaultVariants: {
464
- variant: "default",
465
- size: "default",
466
- rounded: "default"
467
- }
468
- }
469
- ), Ze = _.forwardRef(
470
- ({
471
- className: e,
472
- variant: t,
473
- size: r,
474
- rounded: n,
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,
484
- {
485
- className: j(Ke({ variant: t, size: r, rounded: n, className: e })),
486
- ref: v,
487
- disabled: i || a,
488
- type: "button",
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
494
- }
495
- );
496
- }
497
- );
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,
501
- {
502
- ref: r,
503
- className: j(
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",
505
- e
506
- ),
507
- ...t
508
- }
509
- ));
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,
513
- {
514
- ref: u,
515
- className: j(
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",
517
- e
518
- ),
519
- ...a,
520
- children: [
521
- t,
522
- !n && /* @__PURE__ */ l.jsxs(
523
- y.Close,
524
- {
525
- type: "button",
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",
527
- children: [
528
- /* @__PURE__ */ l.jsx(Me, { className: "h-4 w-4" }),
529
- /* @__PURE__ */ l.jsx("span", { className: "sr-only", children: "Close" })
530
- ]
531
- }
532
- )
533
- ]
534
- }
535
- ) }) }));
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(
540
- "div",
541
- {
542
- className: j("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
543
- ...t
544
- }
545
- );
546
- tt.displayName = "DialogFooter";
547
- const Ee = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ l.jsx(
548
- y.Title,
549
- {
550
- ref: r,
551
- className: j("font-semibold text-lg leading-none tracking-tight", e),
552
- ...t
553
- }
554
- ));
555
- Ee.displayName = y.Title.displayName;
556
- const je = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ l.jsx(
557
- y.Description,
558
- {
559
- ref: r,
560
- className: j("text-muted-foreground text-sm", e),
561
- ...t
562
- }
563
- ));
564
- je.displayName = y.Description.displayName;
565
- const Ut = ({
566
- isOpen: e,
567
- onClose: t,
568
- children: r,
569
- title: n,
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 })
577
- ] }),
578
- /* @__PURE__ */ l.jsx("div", { className: "w-full", children: r })
579
- ] }) }), Yt = ({ ...e }) => /* @__PURE__ */ l.jsx(
580
- We,
581
- {
582
- closeButton: !0,
583
- richColors: !0,
584
- className: "toaster group",
585
- toastOptions: {
586
- classNames: {
587
- toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
588
- description: "group-[.toast]:text-muted-foreground",
589
- actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
590
- cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"
591
- }
592
- },
593
- ...e
594
- }
595
- ), rt = (e, t = "Error", r = {}) => {
596
- q.error(t, {
597
- description: e,
598
- duration: 4e3,
599
- position: "bottom-right",
600
- ...r
601
- });
602
- }, Gt = (e, t = "Success", r = {}) => {
603
- r?.id && q.dismiss(r?.id), q.success(t, {
604
- description: e,
605
- duration: 4e3,
606
- position: "bottom-right",
607
- ...r
608
- });
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,
611
- {
612
- ref: r,
613
- className: j(
614
- "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
615
- e
616
- ),
617
- ...t
618
- }
619
- ));
620
- nt.displayName = k.List.displayName;
621
- const st = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ l.jsx(
622
- k.Trigger,
623
- {
624
- ref: r,
625
- className: j(
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",
627
- e
628
- ),
629
- "data-levo-studio-interactive": "true",
630
- ...t
631
- }
632
- ));
633
- st.displayName = k.Trigger.displayName;
634
- const at = _.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ l.jsx(
635
- k.Content,
636
- {
637
- ref: r,
638
- className: j(
639
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
640
- e
641
- ),
642
- ...t
643
- }
644
- ));
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,
648
- {
649
- ref: n,
650
- sideOffset: t,
651
- className: j(
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",
653
- e
654
- ),
655
- ...r
656
- }
657
- ));
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 = [
663
- "pdf",
664
- "txt",
665
- "xml",
666
- "xls",
667
- "xlsx",
668
- "ods",
669
- "odt",
670
- "doc",
671
- "docx",
672
- "csv",
673
- "odp",
674
- "ppt",
675
- "pptx"
676
- ], dt = ["svg", "png", "jpg", "jpeg", "gif", "webp", "avif"], ft = ["mp4", "ogv", "webm"], mt = ["mp3", "ogg", "opus"], pt = {
677
- "application/xml": [".xml"],
678
- "text/plain": [".txt"],
679
- "application/pdf": [".pdf"],
680
- "application/msword": [".doc"],
681
- "application/vnd.ms-excel": [".xls"],
682
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
683
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
684
- "text/csv": [".csv"]
685
- }, gt = {
686
- "image/jpeg": [".jpeg", ".jpg"],
687
- "image/jpg": [".jpg"],
688
- "image/png": [".png"],
689
- "image/gif": [".gif"],
690
- "image/svg": [".svg"],
691
- "image/svg+xml": [".svg"],
692
- "image/webp": [".webp"],
693
- "image/avif": [".avif"]
694
- }, vt = {
695
- "video/mp4": [".mp4"],
696
- "video/mpeg": [".mpeg"],
697
- "video/webm": [".webm"]
698
- }, bt = {
699
- "audio/mpeg": [".mp3"],
700
- "audio/ogg": [".oga"],
701
- "audio/opus": [".opus"]
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({
723
- urls: null,
724
- title: "",
725
- isLoading: !1,
726
- onSuccess: () => {
727
- },
728
- onError: () => {
729
- }
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) => {
736
- r({
737
- code: d?.code || "SOMETHING_WENT_WRONG",
738
- message: d?.message || "We could not connect with our service for your sign-in."
739
- });
740
- }).finally(() => {
741
- v(!1);
742
- }));
743
- }, []);
744
- const h = fe(
745
- () => ({ title: e, urls: u, isLoading: m, onSuccess: t, onError: r }),
746
- [e, u, t, r, m]
747
- );
748
- return O(() => {
749
- if (u && a) {
750
- const d = {}, T = Object.keys(u);
751
- for (const w of T)
752
- try {
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();
759
- }
760
- } catch {
761
- }
762
- i(d);
763
- }
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;
767
- return window.open(
768
- e,
769
- t,
770
- `width=${n},height=${r},left=${s},top=${a}`
771
- );
772
- }, yt = ({
773
- title: e = "",
774
- width: t = 500,
775
- height: r = 500,
776
- url: n,
777
- children: s,
778
- onCode: a,
779
- onClose: u
780
- }) => {
781
- const [i, m] = P(), v = me(void 0), h = () => {
782
- window.clearInterval(v.current);
783
- }, d = () => {
784
- m(
785
- wt({
786
- url: n,
787
- title: e,
788
- width: t,
789
- height: r
790
- })
791
- );
792
- };
793
- return O(() => (i && (v.current = window.setInterval(() => {
794
- try {
795
- const T = i.location.href, w = new URL(T).searchParams, E = w.get("code");
796
- if (!E)
797
- return;
798
- a(E, w), h(), i.close();
799
- } catch {
800
- } finally {
801
- (!i || i.closed) && (u(), h());
802
- }
803
- }, 700)), () => {
804
- i && i.close(), u && u();
805
- }), [i]), /* @__PURE__ */ l.jsx(
806
- "div",
807
- {
808
- onClick: () => {
809
- d();
810
- },
811
- children: s
812
- }
813
- );
814
- }, Et = ({
815
- title: e = "Levo",
816
- url: t,
817
- children: r,
818
- onSuccess: n,
819
- onError: s,
820
- width: a = 500,
821
- height: u = 700
822
- }) => {
823
- const i = X((m, v) => {
824
- m.toLowerCase() === "success" ? n(v) : s(v);
825
- }, []);
826
- return /* @__PURE__ */ l.jsx(
827
- yt,
828
- {
829
- title: e,
830
- width: a,
831
- height: u,
832
- onClose: () => {
833
- },
834
- url: t,
835
- onCode: i,
836
- children: r
837
- }
838
- );
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;
844
- return window.open(
845
- e,
846
- t,
847
- `width=${n},height=${r},left=${s},top=${a}`
848
- );
849
- }, Kt = ({
850
- title: e = "Levo",
851
- width: t = 500,
852
- height: r = 700,
853
- onSuccess: n
854
- }) => {
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);
859
- }, []);
860
- O(() => {
861
- s.membership && (u(!0), s.membership?.getOAuthURL().then((b) => {
862
- if (b)
863
- return m(b), b;
864
- throw new Error();
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."
870
- });
871
- }).finally(() => {
872
- u(!1);
873
- }));
874
- }, []), O(() => (d && (w.current = window.setInterval(() => {
875
- try {
876
- const b = d.location.href, x = new URL(b).searchParams, $ = x.get("code");
877
- if (!$)
878
- return;
879
- C($, x), E(), d.close();
880
- } catch {
881
- } finally {
882
- (!d || d.closed) && (E(), h(null));
883
- }
884
- }, 700)), () => {
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,
894
- title: e,
895
- width: t,
896
- height: r
897
- })
898
- ));
899
- }
900
- },
901
- [i, d]
902
- );
903
- return {
904
- providers: fe(() => i !== null ? Object.keys(i).filter(
905
- (b) => !!i[b]
906
- ) : [], [i]),
907
- isLoading: a,
908
- error: v,
909
- launchPopup: N
910
- };
911
- };
912
- class Zt {
913
- static Container = ht;
914
- static Button = jt;
915
- }
916
- const Qt = (e, t = 2) => {
917
- if (e === 0) return "0 B";
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", {
923
- id: `${t?.title || ""}-${t?.message || ""}`
924
- }), t;
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;
1
+ /* empty css */
2
+ import { LevoOAuth as r } from "./membership/index.js";
3
+ import { LevoProvider as p, useLevo as s, useLevoInsights as a } from "./providers/LevoProvider.js";
4
+ import { LevoAudienceBlock as m } from "./audience/components/block.js";
5
+ import { LevoAudienceComponent as x } from "./audience/components/component.js";
6
+ import { LevoAudiencePage as f } from "./audience/components/page.js";
7
+ import { Button as T } from "./components/button/Button.js";
8
+ import { buttonVariants as v } from "./components/button/buttonVariants.js";
9
+ import { Dialog as D, DialogClose as y, DialogContent as L, DialogDescription as b, DialogFooter as M, DialogHeader as O, DialogOverlay as E, DialogPortal as h, DialogTitle as C, DialogTrigger as F } from "./components/Dialog.js";
10
+ import { DialogWrapper as A } from "./components/DialogWrapper.js";
11
+ import { Toaster as j, errorToast as I, successToast as S } from "./components/Sonner.js";
12
+ import { toast as H } from "sonner";
13
+ import { Spinner as W } from "./components/Spinner.js";
14
+ import { Tabs as N, TabsContent as U, TabsList as V, TabsTrigger as q } from "./components/Tabs.js";
15
+ import { SimpleTooltipWrapper as G, Tooltip as J, TooltipContent as Q, TooltipPortal as R, TooltipProvider as X, TooltipTrigger as Y } from "./components/Tooltip.js";
16
+ import { allMediaFileExtensions as _, allMediaMimetypes as $, audioFileExtensions as oo, audioMimetype as eo, documentFileExtensions as to, documentMimetype as ro, imageFileExtensions as io, imageMimetype as po, mediaExtensionsByKind as so, mediaMimetypeByKind as ao, videoFileExtensions as no, videoMimetype as mo } from "./constants/fileUploadPresets.js";
17
+ import { useLevoOAuth as xo } from "./membership/useLevoOAuth.js";
18
+ import { byteToSize as fo } from "./utils/byteToSize.js";
19
+ import { cn as uo } from "./utils/cn.js";
20
+ import { errorHandler as co } from "./utils/errorHandler.js";
21
+ import { isDateObject as yo } from "./utils/isDateObject.js";
22
+ import { isEmptyObject as bo } from "./utils/isEmptyObject.js";
23
+ import { isNullOrUndefined as Oo } from "./utils/isNullOrUndefined.js";
24
+ import { isObject as ho, isObjectType as Co } from "./utils/isObject.js";
926
25
  export {
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
26
+ T as Button,
27
+ D as Dialog,
28
+ y as DialogClose,
29
+ L as DialogContent,
30
+ b as DialogDescription,
31
+ M as DialogFooter,
32
+ O as DialogHeader,
33
+ E as DialogOverlay,
34
+ h as DialogPortal,
35
+ C as DialogTitle,
36
+ F as DialogTrigger,
37
+ A as DialogWrapper,
38
+ m as LevoInsightsBlock,
39
+ x as LevoInsightsComponent,
40
+ f as LevoInsightsPage,
41
+ r as LevoOAuth,
42
+ p as LevoProvider,
43
+ G as SimpleTooltipWrapper,
44
+ W as Spinner,
45
+ N as Tabs,
46
+ U as TabsContent,
47
+ V as TabsList,
48
+ q as TabsTrigger,
49
+ j as Toaster,
50
+ J as Tooltip,
51
+ Q as TooltipContent,
52
+ R as TooltipPortal,
53
+ X as TooltipProvider,
54
+ Y as TooltipTrigger,
55
+ _ as allMediaFileExtensions,
56
+ $ as allMediaMimetypes,
57
+ oo as audioFileExtensions,
58
+ eo as audioMimetype,
59
+ v as buttonVariants,
60
+ fo as byteToSize,
61
+ uo as cn,
62
+ to as documentFileExtensions,
63
+ ro as documentMimetype,
64
+ co as errorHandler,
65
+ I as errorToast,
66
+ io as imageFileExtensions,
67
+ po as imageMimetype,
68
+ yo as isDateObject,
69
+ bo as isEmptyObject,
70
+ Oo as isNullOrUndefined,
71
+ ho as isObject,
72
+ Co as isObjectType,
73
+ so as mediaExtensionsByKind,
74
+ ao as mediaMimetypeByKind,
75
+ S as successToast,
76
+ H as toast,
77
+ s as useLevo,
78
+ a as useLevoInsights,
79
+ xo as useLevoOAuth,
80
+ no as videoFileExtensions,
81
+ mo as videoMimetype
983
82
  };