@chaibuilder/sdk 4.0.0-beta.1 → 4.0.0-beta.2
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/README.md +27 -20
- package/dist/2SSKDMRQ-C4VFVd-q.cjs +1 -0
- package/dist/2SSKDMRQ-DSnzF_1o.js +42 -0
- package/dist/AP7HFJJL-B7YYCY9q.cjs +1228 -0
- package/dist/AP7HFJJL-Cxwj01Aq.js +9214 -0
- package/dist/IconPicker-C9-ieDWm.cjs +1 -0
- package/dist/IconPicker-RqVvq6G2.js +59 -0
- package/dist/WDYDFRGG-C7aSUcjs.js +33 -0
- package/dist/WDYDFRGG-b3T2SQbz.cjs +1 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
- package/dist/actions-registery-CZ1w0NKa.js +15545 -0
- package/dist/actions-registery-YnFmU21O.cjs +418 -0
- package/dist/actions.cjs +1 -0
- package/dist/actions.d.ts +3202 -0
- package/dist/actions.js +216 -0
- package/dist/active-in-another-tab-Clng6zpY.cjs +1 -0
- package/dist/active-in-another-tab-wb8qolB8.js +34 -0
- package/dist/add-new-language-page-C4BuMTaN.cjs +1 -0
- package/dist/add-new-language-page-D7NDABl1.js +401 -0
- package/dist/add-new-page-B4hc0B-g.js +31 -0
- package/dist/add-new-page-BNfwKjRd.cjs +1 -0
- package/dist/ai-panel-content-BnbURb7j.js +61 -0
- package/dist/ai-panel-content-DPy2jgKw.cjs +1 -0
- package/dist/ai-panel-default-lang-3tCHzab5.cjs +3 -0
- package/dist/ai-panel-default-lang-oVk4TDeb.js +341 -0
- package/dist/ai-panel-other-lang-BBHCCSen.cjs +1 -0
- package/dist/ai-panel-other-lang-DmQ3QMDD.js +162 -0
- package/dist/ai-prompt-input-DaTyfib-.js +655 -0
- package/dist/ai-prompt-input-b5ty81RB.cjs +1 -0
- package/dist/ai-translation-prompt-DJPe2O-n.js +28 -0
- package/dist/ai-translation-prompt-c0Q3zkT2.cjs +1 -0
- package/dist/apply-binding-6iwlED02.js +833 -0
- package/dist/apply-binding-KKp5PnpZ.cjs +1 -0
- package/dist/{code-display-337R7Dev.js → code-display-BzBq5xSn.js} +1 -1
- package/dist/code-display-Q3_sK_Ta.cjs +1 -0
- package/dist/code-editor-BQZi6-FB.cjs +1 -0
- package/dist/code-editor-DWWnphW9.js +50 -0
- package/dist/common-functions-B3a4xKt_.cjs +1 -0
- package/dist/common-functions-D2lMFR6K.js +13 -0
- package/dist/continue-editing-in-this-client-BllU94XG.js +24 -0
- package/dist/continue-editing-in-this-client-D9HyD4GP.cjs +1 -0
- package/dist/core-BoRDjj4h.cjs +1 -0
- package/dist/core-yvI6kCyw.js +56 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +51 -383
- package/dist/core.js +39 -106
- package/dist/css-import-modal-BSMGKA2T.cjs +13 -0
- package/dist/{css-import-modal-DA2L6kwP.js → css-import-modal-D72a-16X.js} +39 -38
- package/dist/delete-design-token-Cd1ZDtqT.js +40 -0
- package/dist/delete-design-token-D_TLlO3I.cjs +1 -0
- package/dist/delete-page-ByQwBupJ.cjs +1 -0
- package/dist/delete-page-DC8pzvWW.js +70 -0
- package/dist/design-token-usage-BqZeR1sT.cjs +1 -0
- package/dist/design-token-usage-DE4XCDdn.js +113 -0
- package/dist/digital-asset-manager-BYLKFEYi.cjs +1 -0
- package/dist/digital-asset-manager-C_gL_0YY.js +876 -0
- package/dist/duplicate-page-BoVhko2q.js +133 -0
- package/dist/duplicate-page-vdvwLQLo.cjs +1 -0
- package/dist/dynamic-page-selector-CSndg2-y.js +85 -0
- package/dist/dynamic-page-selector-DdnbCuQZ.cjs +1 -0
- package/dist/fonts-B-Xt29pe.cjs +1 -0
- package/dist/fonts-DRly3Wzd.js +78 -0
- package/dist/{get-chai-builder-tailwind-config-C6MHaUM0.cjs → get-chai-builder-tailwind-config-B9rCyiQo.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-DjoVOuAf.js} +13 -10
- package/dist/{get-chai-builder-theme-D0IsUvK4.js → get-chai-builder-theme-BYtp20KD.js} +4 -4
- package/dist/get-chai-builder-theme-Dl72X7cz.cjs +1 -0
- package/dist/get-seo-defaults-9zHebckY.js +65 -0
- package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
- package/dist/image-compression-DZ9WMmyn.cjs +1 -0
- package/dist/image-compression-DsZ1oqpb.js +37 -0
- package/dist/image-editor-DTspjj_c.cjs +1 -0
- package/dist/image-editor-oypq8asR.js +108 -0
- package/dist/index-B-rSiAp_.cjs +1 -0
- package/dist/index-BDnwJqMw.js +4732 -0
- package/dist/index-CbwxUFy_.cjs +5 -0
- package/dist/index-CnSjWE1P.cjs +160 -0
- package/dist/index-Dxfyt4d4.js +39 -0
- package/dist/index-S8ibZk9Q.js +19069 -0
- package/dist/json-diff-viewer-B5dr-Y_L.js +258 -0
- package/dist/json-diff-viewer-XX1pgabt.cjs +8 -0
- package/dist/lang-panel-BPxex-M2.cjs +1 -0
- package/dist/lang-panel-Cn83SRzd.js +215 -0
- package/dist/manage-design-tokens-ConiyuPr.cjs +1 -0
- package/dist/manage-design-tokens-lP4HLS0P.js +240 -0
- package/dist/mark-as-template-DYRxre1f.cjs +1 -0
- package/dist/mark-as-template-jncsjfHm.js +156 -0
- package/dist/models-5gOsRC56.cjs +1 -0
- package/dist/models-D95ZYr_x.js +70 -0
- package/dist/nested-path-selector-content-B-8LqhXI.js +87 -0
- package/dist/nested-path-selector-content-BYtLi7mC.cjs +1 -0
- package/dist/no-language-page-content-DAbLq0gX.cjs +1 -0
- package/dist/no-language-page-content-D_zd9Rb0.js +42 -0
- package/dist/no-language-page-dialog-C5Ps6YYL.js +10 -0
- package/dist/no-language-page-dialog-fXmbQO7L.cjs +1 -0
- package/dist/page-creator-VWIB2VAs.cjs +1 -0
- package/dist/page-creator-wCMtlE6Z.js +795 -0
- package/dist/page-lock-BPCxfv9J.js +30 -0
- package/dist/page-lock-DweiYy1w.cjs +1 -0
- package/dist/page-locked-dialog-BlbgvaG2.cjs +1 -0
- package/dist/page-locked-dialog-ByGl18_m.js +133 -0
- package/dist/page-manager-new-BWFE-S-O.js +394 -0
- package/dist/page-manager-new-D0lGfNnS.cjs +1 -0
- package/dist/page-manager-search-and-filter-DpGMoOII.cjs +1 -0
- package/dist/page-manager-search-and-filter-kNJFWJ86.js +201 -0
- package/dist/page-revisions-content-DYxXZqmh.cjs +1 -0
- package/dist/page-revisions-content-Ulr8slUN.js +445 -0
- package/dist/pages.cjs +1 -0
- package/dist/pages.d.ts +492 -0
- package/dist/pages.js +27 -0
- package/dist/plugin-3ZKK6RXm.js +245 -0
- package/dist/plugin-C6rgJDNQ.cjs +22 -0
- package/dist/publish-pages-content-BTPzt_m4.js +178 -0
- package/dist/publish-pages-content-D6g8GAsd.cjs +1 -0
- package/dist/register-partial-type-BjtdfKHE.js +36 -0
- package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +26 -13
- package/dist/render.js +130 -124
- package/dist/rte-widget-modal-DrMzWWjw.cjs +1 -0
- package/dist/rte-widget-modal-Rk_NW3KU.js +38 -0
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +306 -7
- package/dist/runtime.js +44 -1
- package/dist/save-to-lib-BK3uTFss.js +422 -0
- package/dist/save-to-lib-DHHUO12i.cjs +1 -0
- package/dist/sdk.css +1 -1
- package/dist/selected-block-display-CU3TwIMA.js +319 -0
- package/dist/selected-block-display-DSFhddPj.cjs +16 -0
- package/dist/seo-panel-Dl0IDV09.cjs +2 -0
- package/dist/seo-panel-jbzxFioc.js +798 -0
- package/dist/shared-json-ld-BL_dv3_q.js +565 -0
- package/dist/shared-json-ld-DPNkqDC1.cjs +1 -0
- package/dist/slug-input-1qwKkXhA.js +86 -0
- package/dist/slug-input-YVLjtTI3.cjs +1 -0
- package/dist/supabase-actions.cjs +1 -0
- package/dist/supabase-actions.d.ts +284 -0
- package/dist/supabase-actions.js +524 -0
- package/dist/take-over-request-DKvKi3mM.js +63 -0
- package/dist/take-over-request-DvMIg_cZ.cjs +1 -0
- package/dist/theme-panel-footer-BMOaPLWc.cjs +1 -0
- package/dist/theme-panel-footer-DbMDLYGI.js +25 -0
- package/dist/translation-warning-modal-9wTwIy_9.js +26 -0
- package/dist/translation-warning-modal-DjTwz75c.cjs +1 -0
- package/dist/unmark-as-template-CdqIJJER.cjs +1 -0
- package/dist/unmark-as-template-Dulvf7Zw.js +39 -0
- package/dist/unpublish-page-BwSVBf0_.cjs +1 -0
- package/dist/unpublish-page-Degu5Cy9.js +27 -0
- package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
- package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
- package/dist/{tailwind.cjs → utils.cjs} +1 -1
- package/dist/{tailwind.d.ts → utils.d.ts} +12 -11
- package/dist/utils.js +7 -0
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.d.ts +0 -6
- package/dist/web-blocks.js +258 -251
- package/dist/web-preview-DXE4Jnf5.js +73 -0
- package/dist/web-preview-YzKxyXft.cjs +1 -0
- package/package.json +175 -105
- package/dist/IconPicker-CGWn9C4u.cjs +0 -1
- package/dist/IconPicker-QvxJ-4Ez.js +0 -64
- package/dist/apply-binding-DCno1xQL.js +0 -711
- package/dist/apply-binding-DvHNFLQD.cjs +0 -1
- package/dist/code-display-BZ1x7SqI.cjs +0 -1
- package/dist/code-editor-B28LoECM.cjs +0 -1
- package/dist/code-editor-CfG2FhJ-.js +0 -58
- package/dist/common-functions-BGzDsf1z.js +0 -14
- package/dist/common-functions-BZmyleS1.cjs +0 -1
- package/dist/css-import-modal-CENUYvcl.cjs +0 -13
- package/dist/get-chai-builder-theme-Ck_Z4Q-M.cjs +0 -1
- package/dist/index-CaGNHF7f.js +0 -12209
- package/dist/index-Gn6pJt2v.cjs +0 -166
- package/dist/mockServiceWorker.js +0 -307
- package/dist/plugin-B5627hMN.js +0 -195
- package/dist/plugin-UxTRfDum.cjs +0 -22
- package/dist/rte-widget-modal-DL739qeQ.cjs +0 -1
- package/dist/rte-widget-modal-Dte0od04.js +0 -41
- package/dist/tailwind.js +0 -7
- package/dist/tooltip-A4qGk781.cjs +0 -1
- package/dist/tooltip-tLiIOgjq.js +0 -1067
- package/dist/ui.cjs +0 -1
- package/dist/ui.d.ts +0 -415
- package/dist/ui.js +0 -129
- package/dist/vite.svg +0 -1
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { jsx as e, jsxs as a, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import { a3 as _, a4 as H, I as z, B as u, a5 as K, L as X, a6 as q, a7 as J, a8 as Y } from "./index-S8ibZk9Q.js";
|
|
3
|
+
import { D as ee } from "./apply-binding-6iwlED02.js";
|
|
4
|
+
import { MagnifyingGlassIcon as L, PlusIcon as O, TokensIcon as te, ArrowLeftIcon as ne, EyeOpenIcon as se, Pencil1Icon as re, TrashIcon as ae } from "@radix-ui/react-icons";
|
|
5
|
+
import { useAtom as oe } from "jotai";
|
|
6
|
+
import { nanoid as ie } from "nanoid";
|
|
7
|
+
import { useState as g, useRef as le, useMemo as ce, useEffect as de, useCallback as me, Suspense as R, lazy as M } from "react";
|
|
8
|
+
import { useTranslation as ue } from "react-i18next";
|
|
9
|
+
import { toast as N } from "sonner";
|
|
10
|
+
import { twMerge as he } from "tailwind-merge";
|
|
11
|
+
const S = (n) => {
|
|
12
|
+
const s = n.trim();
|
|
13
|
+
return s.length === 0 || s.length > 25 ? !1 : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(s);
|
|
14
|
+
}, fe = (n, s, o, d = !1, i) => {
|
|
15
|
+
const m = n.trim();
|
|
16
|
+
return m.length === 0 ? "" : m.length > 25 ? o("Token name must be 25 characters or less") : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(m) ? Object.entries(s).find(
|
|
17
|
+
([l, v]) => v.name === m && (!d || l !== i)
|
|
18
|
+
) ? o("Token name already exists") : "" : o("Only alphanumeric characters and hyphens allowed");
|
|
19
|
+
}, xe = (n) => n.replace(/\s+/g, "-"), ge = M(() => import("./delete-design-token-Cd1ZDtqT.js")), pe = M(() => import("./design-token-usage-DE4XCDdn.js")), ve = ({ tokenId: n, token: s, isDisabled: o, onEdit: d, onDelete: i }) => /* @__PURE__ */ a("div", { className: "group relative flex items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 hover:bg-muted/90", children: [
|
|
20
|
+
/* @__PURE__ */ a("div", { className: "min-w-0 flex-1 overflow-hidden", children: [
|
|
21
|
+
/* @__PURE__ */ e("div", { className: "text-xs font-semibold", children: s.name }),
|
|
22
|
+
/* @__PURE__ */ e("div", { className: "w-full max-w-52 truncate text-[10px] font-light", children: s.value })
|
|
23
|
+
] }),
|
|
24
|
+
/* @__PURE__ */ a("div", { className: "absolute right-1 top-1 flex flex-shrink-0 items-center opacity-0 transition-opacity duration-150 group-hover:opacity-100", children: [
|
|
25
|
+
/* @__PURE__ */ e(R, { fallback: null, children: /* @__PURE__ */ e(pe, { tokenId: n, tokenName: s.name, children: /* @__PURE__ */ e(
|
|
26
|
+
u,
|
|
27
|
+
{
|
|
28
|
+
variant: "ghost",
|
|
29
|
+
size: "sm",
|
|
30
|
+
className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
|
|
31
|
+
children: /* @__PURE__ */ e(se, { className: "h-3 w-3" })
|
|
32
|
+
}
|
|
33
|
+
) }) }),
|
|
34
|
+
/* @__PURE__ */ e(
|
|
35
|
+
u,
|
|
36
|
+
{
|
|
37
|
+
variant: "ghost",
|
|
38
|
+
size: "sm",
|
|
39
|
+
onClick: () => d(n),
|
|
40
|
+
disabled: o,
|
|
41
|
+
className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
|
|
42
|
+
children: /* @__PURE__ */ e(re, { className: "h-3 w-3" })
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ e(R, { fallback: null, children: /* @__PURE__ */ e(ge, { tokenName: s.name, tokenValue: s.value, onDelete: () => i(n), children: /* @__PURE__ */ e(
|
|
46
|
+
u,
|
|
47
|
+
{
|
|
48
|
+
variant: "ghost",
|
|
49
|
+
size: "sm",
|
|
50
|
+
disabled: o,
|
|
51
|
+
className: "h-6 w-6 rounded-full p-0 hover:bg-destructive/10",
|
|
52
|
+
children: /* @__PURE__ */ e(ae, { className: "h-3 w-3 text-destructive" })
|
|
53
|
+
}
|
|
54
|
+
) }) })
|
|
55
|
+
] })
|
|
56
|
+
] }), ze = ({}) => {
|
|
57
|
+
const { t: n } = ue(), [s, o] = oe(_), d = H(), [i, m] = g("view"), [p, k] = g(null), [l, v] = g(""), [h, b] = g(""), [T, y] = g(""), [w, P] = g(""), [B, C] = g(!1), f = le(null), D = ce(() => Object.entries(s).filter(
|
|
58
|
+
([, t]) => t.name.toLowerCase().includes(w.toLowerCase()) || t.value.toLowerCase().includes(w.toLowerCase())
|
|
59
|
+
), [s, w]);
|
|
60
|
+
de(() => () => {
|
|
61
|
+
f.current && clearTimeout(f.current);
|
|
62
|
+
}, []);
|
|
63
|
+
const j = me(
|
|
64
|
+
(t, r) => {
|
|
65
|
+
!p || i !== "edit" || !t.trim() || !r.trim() || !S(t) || Object.entries(s).find(
|
|
66
|
+
([x, U]) => U.name === t.trim() && x !== p
|
|
67
|
+
) || (C(!0), f.current && clearTimeout(f.current), f.current = setTimeout(() => {
|
|
68
|
+
const x = {
|
|
69
|
+
...s,
|
|
70
|
+
[p]: {
|
|
71
|
+
name: t.trim(),
|
|
72
|
+
value: r.trim()
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
o(x), d(), C(!1);
|
|
76
|
+
}, 250));
|
|
77
|
+
},
|
|
78
|
+
[p, i, s, o, d]
|
|
79
|
+
), F = () => {
|
|
80
|
+
if (!l.trim() || !h.trim()) {
|
|
81
|
+
N.error(n("Please fill in both token name and classes"));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!S(l)) {
|
|
85
|
+
N.error(n("Invalid design token name format"));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (Object.values(s).find((x) => x.name === l.trim())) {
|
|
89
|
+
N.error(n("Token already exists"));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const r = `${ee}${ie(12)}`, c = {
|
|
93
|
+
...s,
|
|
94
|
+
[r]: {
|
|
95
|
+
name: l.trim(),
|
|
96
|
+
value: h.trim()
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
o(c), d(), N.success(n("Token added successfully")), A();
|
|
100
|
+
}, V = (t) => {
|
|
101
|
+
const r = { ...s };
|
|
102
|
+
delete r[t], o(r), d(), N.success(n("Token deleted successfully"));
|
|
103
|
+
}, W = (t) => {
|
|
104
|
+
const r = s[t];
|
|
105
|
+
r && (k(t), v(r.name), b(r.value), y(""), m("edit"));
|
|
106
|
+
}, I = () => {
|
|
107
|
+
k(null), v(""), b(""), y(""), m("add");
|
|
108
|
+
}, A = () => {
|
|
109
|
+
f.current && clearTimeout(f.current), k(null), v(""), b(""), y(""), C(!1), m("view");
|
|
110
|
+
}, Z = (t) => {
|
|
111
|
+
const r = xe(t);
|
|
112
|
+
v(r);
|
|
113
|
+
const c = fe(r, s, n, i === "edit", p || void 0);
|
|
114
|
+
y(c), i === "edit" && !c && j(r, h);
|
|
115
|
+
}, E = (t) => {
|
|
116
|
+
b(t), i === "edit" && !T && l.trim() && j(l, t);
|
|
117
|
+
}, $ = (t) => {
|
|
118
|
+
const r = J(Y(he(h, t)));
|
|
119
|
+
E(r);
|
|
120
|
+
}, G = (t) => {
|
|
121
|
+
const r = h.split(" ").filter((c) => c !== t).join(" ");
|
|
122
|
+
E(r);
|
|
123
|
+
};
|
|
124
|
+
return /* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: i === "view" ? /* @__PURE__ */ a(Q, { children: [
|
|
125
|
+
Object.entries(s).length > 0 && /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
126
|
+
/* @__PURE__ */ a("div", { className: "relative flex-1", children: [
|
|
127
|
+
/* @__PURE__ */ e(L, { className: "absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground" }),
|
|
128
|
+
/* @__PURE__ */ e(
|
|
129
|
+
z,
|
|
130
|
+
{
|
|
131
|
+
placeholder: n("Search tokens"),
|
|
132
|
+
value: w,
|
|
133
|
+
onChange: (t) => P(t.target.value),
|
|
134
|
+
className: "h-6 pl-7 text-xs"
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
] }),
|
|
138
|
+
/* @__PURE__ */ a(
|
|
139
|
+
u,
|
|
140
|
+
{
|
|
141
|
+
variant: "outline",
|
|
142
|
+
onClick: I,
|
|
143
|
+
size: "sm",
|
|
144
|
+
className: "h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",
|
|
145
|
+
children: [
|
|
146
|
+
/* @__PURE__ */ e(O, { className: "h-3 w-3" }),
|
|
147
|
+
n("Add")
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
] }),
|
|
152
|
+
/* @__PURE__ */ e("div", { className: "no-scrollbar flex flex-1 flex-col overflow-hidden pt-2", children: /* @__PURE__ */ e(K, { className: "h-full flex-1", children: /* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
153
|
+
Object.entries(s).length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8", children: [
|
|
154
|
+
/* @__PURE__ */ e("div", { className: "mb-2 text-3xl", children: /* @__PURE__ */ e(te, { className: "h-12 w-12 text-muted-foreground" }) }),
|
|
155
|
+
/* @__PURE__ */ e("p", { className: "mb-1 text-sm font-medium text-foreground", children: n("No design tokens yet") }),
|
|
156
|
+
/* @__PURE__ */ e("p", { className: "text-center text-xs text-muted-foreground", children: n("Create reusable design tokens to streamline your styling") }),
|
|
157
|
+
/* @__PURE__ */ a(u, { variant: "default", onClick: I, size: "sm", className: "mt-4 h-7 text-xs leading-tight", children: [
|
|
158
|
+
/* @__PURE__ */ e(O, { className: "mr-1 h-3 w-3" }),
|
|
159
|
+
n("Add first design token")
|
|
160
|
+
] })
|
|
161
|
+
] }) : D.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8", children: [
|
|
162
|
+
/* @__PURE__ */ e("div", { className: "mb-2", children: /* @__PURE__ */ e(L, { className: "h-10 w-10 text-muted-foreground" }) }),
|
|
163
|
+
/* @__PURE__ */ e("p", { className: "mb-1 text-sm font-medium text-foreground", children: n("No tokens found") }),
|
|
164
|
+
/* @__PURE__ */ e("p", { className: "text-center text-xs text-muted-foreground", children: n("No design tokens match your search") })
|
|
165
|
+
] }) : D.map(([t, r]) => /* @__PURE__ */ e(
|
|
166
|
+
ve,
|
|
167
|
+
{
|
|
168
|
+
token: r,
|
|
169
|
+
tokenId: t,
|
|
170
|
+
onEdit: W,
|
|
171
|
+
onDelete: V,
|
|
172
|
+
isDisabled: !1
|
|
173
|
+
},
|
|
174
|
+
t
|
|
175
|
+
)),
|
|
176
|
+
/* @__PURE__ */ e("div", { className: "h-44" })
|
|
177
|
+
] }) }) })
|
|
178
|
+
] }) : (() => {
|
|
179
|
+
const t = i === "edit", r = n(t ? "Edit Design Token" : "Add Design Token"), c = n(t ? "Update design token. Auto-saved." : "Create a reusable design token");
|
|
180
|
+
return /* @__PURE__ */ a("div", { className: "flex h-full flex-col", children: [
|
|
181
|
+
/* @__PURE__ */ a("div", { className: "mb-3 flex items-center gap-2 rounded-md border border-border/50 bg-muted p-1.5", children: [
|
|
182
|
+
/* @__PURE__ */ e(
|
|
183
|
+
u,
|
|
184
|
+
{
|
|
185
|
+
variant: "ghost",
|
|
186
|
+
size: "sm",
|
|
187
|
+
onClick: A,
|
|
188
|
+
className: "h-6 w-6 rounded-full p-0 hover:bg-muted",
|
|
189
|
+
children: /* @__PURE__ */ e(ne, { className: "h-3 w-3" })
|
|
190
|
+
}
|
|
191
|
+
),
|
|
192
|
+
/* @__PURE__ */ a("div", { className: "flex-1", children: [
|
|
193
|
+
/* @__PURE__ */ e("h3", { className: "text-xs font-semibold text-foreground", children: r }),
|
|
194
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] text-muted-foreground", children: c })
|
|
195
|
+
] }),
|
|
196
|
+
t && B && /* @__PURE__ */ e("div", { className: "flex items-center gap-1 text-[10px] text-muted-foreground", children: /* @__PURE__ */ e("div", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-primary" }) })
|
|
197
|
+
] }),
|
|
198
|
+
/* @__PURE__ */ a("div", { className: "flex-1 space-y-3 overflow-y-auto", children: [
|
|
199
|
+
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
200
|
+
/* @__PURE__ */ e(X, { htmlFor: "token-name", className: "text-xs font-medium", children: n("Token Name") }),
|
|
201
|
+
/* @__PURE__ */ e(
|
|
202
|
+
z,
|
|
203
|
+
{
|
|
204
|
+
id: "token-name",
|
|
205
|
+
placeholder: "Button-Primary",
|
|
206
|
+
value: l,
|
|
207
|
+
onChange: (x) => Z(x.target.value),
|
|
208
|
+
className: "h-7 text-xs"
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
T ? /* @__PURE__ */ e("span", { className: "text-[10px] text-destructive", children: T }) : /* @__PURE__ */ e("span", { className: "text-[10px] font-light text-muted-foreground", children: n("Button-Primary, Card-Header, Text-Large etc.") })
|
|
212
|
+
] }),
|
|
213
|
+
/* @__PURE__ */ e(
|
|
214
|
+
q,
|
|
215
|
+
{
|
|
216
|
+
from: "designToken",
|
|
217
|
+
classFromProps: h,
|
|
218
|
+
onAddNew: $,
|
|
219
|
+
onRemove: G
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
!t && /* @__PURE__ */ a("div", { className: "mt-3 flex items-center justify-end gap-2 pt-3", children: [
|
|
223
|
+
/* @__PURE__ */ e(u, { variant: "outline", onClick: A, className: "h-7 text-xs", children: n("Cancel") }),
|
|
224
|
+
/* @__PURE__ */ e(
|
|
225
|
+
u,
|
|
226
|
+
{
|
|
227
|
+
onClick: F,
|
|
228
|
+
disabled: !l.trim() || !h.trim() || !!T,
|
|
229
|
+
className: "h-7 text-xs",
|
|
230
|
+
children: n("Add Token")
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
] })
|
|
234
|
+
] })
|
|
235
|
+
] });
|
|
236
|
+
})() });
|
|
237
|
+
};
|
|
238
|
+
export {
|
|
239
|
+
ze as default
|
|
240
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-CnSjWE1P.cjs"),b=require("./index-CbwxUFy_.cjs"),y=require("lodash-es"),d=require("lucide-react"),l=require("react"),M=require("react-i18next"),w=require("sonner"),q=1*1024*1024,A=({page:r,onClose:m})=>{const{t:s}=M.useTranslation(),[g,u]=l.useState(!1),[f,k]=l.useState(""),[c,j]=l.useState(""),[N,p]=l.useState(!1),i=l.useRef(null),I=b.useMarkAsTemplate(),{data:x}=b.usePageTypes(),h=x==null?void 0:x.find(t=>t.key===r.pageType),T=(h==null?void 0:h.name)||y.startCase(r.pageType),C=l.useCallback(t=>{var v;const o=(v=t.target.files)==null?void 0:v[0];if(o){if(o.size>q){w.toast.error(s("File too large"),{description:`${s("Maximum file size is 1MB. Selected file is")} ${(o.size/1024).toFixed(2)}KB.`}),i.current&&(i.current.value="");return}try{p(!0);const n=new FileReader;n.onloadend=()=>{j(n.result),p(!1)},n.readAsDataURL(o)}catch(n){console.error("Error reading file:",n),p(!1),w.toast.error(s("Failed to process image"),{description:n instanceof Error?n.message:s("Unknown error")})}}},[s]),D=()=>{j(""),i.current&&(i.current.value="")},F=()=>{var t;(t=i.current)==null||t.click()},S=()=>{u(!0),I.mutate({page:r,name:r.name,description:f.trim()||void 0,pageType:r.pageType,...c?{previewImage:c}:{}},{onSuccess:()=>{u(!1),m()},onError:()=>{u(!1)}})};return e.jsx(a.Dialog,{open:!0,onOpenChange:m,children:e.jsxs(a.DialogContent,{children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:s("Mark as template")}),e.jsxs(a.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:[s("Are you sure you want to mark this page as a template?"),e.jsx("br",{}),s("Templates can be used to create new pages with the same content.")]})]}),e.jsxs("div",{className:"mb-4 space-y-4 text-xs",children:[e.jsxs("div",{className:"space-y-3 rounded border bg-slate-50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d.Tag,{className:"h-4 w-4 text-slate-500"}),e.jsxs("span",{className:"font-medium text-slate-500",children:[s("Page Name"),":"]}),e.jsx("span",{className:"font-semibold",children:y.startCase(r.name)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d.File,{className:"h-4 w-4 text-slate-500"}),e.jsxs("span",{className:"font-medium text-slate-500",children:[s("Type"),":"]}),e.jsx("span",{className:"font-semibold",children:T})]})]}),e.jsxs("div",{children:[e.jsx(a.Label,{htmlFor:"description",className:"text-xs font-medium",children:s("Description (Optional)")}),e.jsx(a.Textarea,{id:"description",placeholder:s("Describe this template's purpose"),className:"mt-1 h-24 resize-none text-xs",value:f,onChange:t=>k(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"previewImage",className:"text-xs font-medium",children:s("Preview Image (Optional)")}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(a.Input,{type:"file",id:"previewImage",ref:i,onChange:C,accept:"image/*",className:"hidden"}),e.jsx(a.Button,{type:"button",variant:"outline",onClick:F,disabled:N,className:"w-full",children:N?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),s("Uploading...")]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(d.ImageIcon,{className:"h-4 w-4"}),s("Select image")]})}),c&&e.jsx(a.Button,{type:"button",variant:"outline",size:"icon",onClick:D,children:e.jsx(d.X,{className:"h-4 w-4"})})]}),c&&e.jsx("div",{className:"aspect-video overflow-hidden rounded-md border",children:e.jsx("img",{src:c,alt:s("Preview"),className:"h-full max-h-[200px] w-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("max 1mb")})]})]})]}),e.jsxs(a.DialogFooter,{className:g?"pointer-events-none opacity-75":"",children:[e.jsx(a.Button,{variant:"outline",onClick:t=>{t.stopPropagation(),m()},children:s("Cancel")}),e.jsx(a.Button,{variant:"default",disabled:g,onClick:S,children:s("Mark as template")})]})]})})};exports.default=A;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { D as L, d as P, e as z, f as B, p as E, L as w, T as S, I as U, B as c, q as R } from "./index-S8ibZk9Q.js";
|
|
3
|
+
import { q as j, m as O } from "./index-BDnwJqMw.js";
|
|
4
|
+
import { startCase as y } from "lodash-es";
|
|
5
|
+
import { Tag as q, File as X, ImageIcon as _, X as $ } from "lucide-react";
|
|
6
|
+
import { useState as d, useRef as H, useCallback as K } from "react";
|
|
7
|
+
import { useTranslation as Z } from "react-i18next";
|
|
8
|
+
import { toast as k } from "sonner";
|
|
9
|
+
const G = 1 * 1024 * 1024, se = ({ page: n, onClose: m }) => {
|
|
10
|
+
const { t: a } = Z(), [g, p] = d(!1), [x, I] = d(""), [l, N] = d(""), [v, u] = d(!1), i = H(null), T = j(), { data: h } = O(), f = h == null ? void 0 : h.find((s) => s.key === n.pageType), C = (f == null ? void 0 : f.name) || y(n.pageType), D = K(
|
|
11
|
+
(s) => {
|
|
12
|
+
var b;
|
|
13
|
+
const o = (b = s.target.files) == null ? void 0 : b[0];
|
|
14
|
+
if (o) {
|
|
15
|
+
if (o.size > G) {
|
|
16
|
+
k.error(a("File too large"), {
|
|
17
|
+
description: `${a("Maximum file size is 1MB. Selected file is")} ${(o.size / 1024).toFixed(2)}KB.`
|
|
18
|
+
}), i.current && (i.current.value = "");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
u(!0);
|
|
23
|
+
const r = new FileReader();
|
|
24
|
+
r.onloadend = () => {
|
|
25
|
+
N(r.result), u(!1);
|
|
26
|
+
}, r.readAsDataURL(o);
|
|
27
|
+
} catch (r) {
|
|
28
|
+
console.error("Error reading file:", r), u(!1), k.error(a("Failed to process image"), {
|
|
29
|
+
description: r instanceof Error ? r.message : a("Unknown error")
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
[a]
|
|
35
|
+
), F = () => {
|
|
36
|
+
N(""), i.current && (i.current.value = "");
|
|
37
|
+
}, M = () => {
|
|
38
|
+
var s;
|
|
39
|
+
(s = i.current) == null || s.click();
|
|
40
|
+
}, A = () => {
|
|
41
|
+
p(!0), T.mutate(
|
|
42
|
+
{
|
|
43
|
+
page: n,
|
|
44
|
+
name: n.name,
|
|
45
|
+
description: x.trim() || void 0,
|
|
46
|
+
pageType: n.pageType,
|
|
47
|
+
...l ? { previewImage: l } : {}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
onSuccess: () => {
|
|
51
|
+
p(!1), m();
|
|
52
|
+
},
|
|
53
|
+
onError: () => {
|
|
54
|
+
p(!1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ e(L, { open: !0, onOpenChange: m, children: /* @__PURE__ */ t(P, { children: [
|
|
60
|
+
/* @__PURE__ */ t(z, { children: [
|
|
61
|
+
/* @__PURE__ */ e(B, { children: a("Mark as template") }),
|
|
62
|
+
/* @__PURE__ */ t(E, { className: "space-y-1 py-4 text-xs text-slate-500", children: [
|
|
63
|
+
a("Are you sure you want to mark this page as a template?"),
|
|
64
|
+
/* @__PURE__ */ e("br", {}),
|
|
65
|
+
a("Templates can be used to create new pages with the same content.")
|
|
66
|
+
] })
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ t("div", { className: "mb-4 space-y-4 text-xs", children: [
|
|
69
|
+
/* @__PURE__ */ t("div", { className: "space-y-3 rounded border bg-slate-50 p-4", children: [
|
|
70
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
71
|
+
/* @__PURE__ */ e(q, { className: "h-4 w-4 text-slate-500" }),
|
|
72
|
+
/* @__PURE__ */ t("span", { className: "font-medium text-slate-500", children: [
|
|
73
|
+
a("Page Name"),
|
|
74
|
+
":"
|
|
75
|
+
] }),
|
|
76
|
+
/* @__PURE__ */ e("span", { className: "font-semibold", children: y(n.name) })
|
|
77
|
+
] }),
|
|
78
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
79
|
+
/* @__PURE__ */ e(X, { className: "h-4 w-4 text-slate-500" }),
|
|
80
|
+
/* @__PURE__ */ t("span", { className: "font-medium text-slate-500", children: [
|
|
81
|
+
a("Type"),
|
|
82
|
+
":"
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ e("span", { className: "font-semibold", children: C })
|
|
85
|
+
] })
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ t("div", { children: [
|
|
88
|
+
/* @__PURE__ */ e(w, { htmlFor: "description", className: "text-xs font-medium", children: a("Description (Optional)") }),
|
|
89
|
+
/* @__PURE__ */ e(
|
|
90
|
+
S,
|
|
91
|
+
{
|
|
92
|
+
id: "description",
|
|
93
|
+
placeholder: a("Describe this template's purpose"),
|
|
94
|
+
className: "mt-1 h-24 resize-none text-xs",
|
|
95
|
+
value: x,
|
|
96
|
+
onChange: (s) => I(s.target.value)
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] }),
|
|
100
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
101
|
+
/* @__PURE__ */ e(w, { htmlFor: "previewImage", className: "text-xs font-medium", children: a("Preview Image (Optional)") }),
|
|
102
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
103
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
104
|
+
/* @__PURE__ */ e(
|
|
105
|
+
U,
|
|
106
|
+
{
|
|
107
|
+
type: "file",
|
|
108
|
+
id: "previewImage",
|
|
109
|
+
ref: i,
|
|
110
|
+
onChange: D,
|
|
111
|
+
accept: "image/*",
|
|
112
|
+
className: "hidden"
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ e(
|
|
116
|
+
c,
|
|
117
|
+
{
|
|
118
|
+
type: "button",
|
|
119
|
+
variant: "outline",
|
|
120
|
+
onClick: M,
|
|
121
|
+
disabled: v,
|
|
122
|
+
className: "w-full",
|
|
123
|
+
children: v ? /* @__PURE__ */ t("span", { className: "flex items-center gap-2", children: [
|
|
124
|
+
/* @__PURE__ */ e("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
125
|
+
a("Uploading...")
|
|
126
|
+
] }) : /* @__PURE__ */ t("span", { className: "flex items-center gap-2", children: [
|
|
127
|
+
/* @__PURE__ */ e(_, { className: "h-4 w-4" }),
|
|
128
|
+
a("Select image")
|
|
129
|
+
] })
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
l && /* @__PURE__ */ e(c, { type: "button", variant: "outline", size: "icon", onClick: F, children: /* @__PURE__ */ e($, { className: "h-4 w-4" }) })
|
|
133
|
+
] }),
|
|
134
|
+
l && /* @__PURE__ */ e("div", { className: "aspect-video overflow-hidden rounded-md border", children: /* @__PURE__ */ e("img", { src: l, alt: a("Preview"), className: "h-full max-h-[200px] w-full object-contain" }) }),
|
|
135
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a("max 1mb") })
|
|
136
|
+
] })
|
|
137
|
+
] })
|
|
138
|
+
] }),
|
|
139
|
+
/* @__PURE__ */ t(R, { className: g ? "pointer-events-none opacity-75" : "", children: [
|
|
140
|
+
/* @__PURE__ */ e(
|
|
141
|
+
c,
|
|
142
|
+
{
|
|
143
|
+
variant: "outline",
|
|
144
|
+
onClick: (s) => {
|
|
145
|
+
s.stopPropagation(), m();
|
|
146
|
+
},
|
|
147
|
+
children: a("Cancel")
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ e(c, { variant: "default", disabled: g, onClick: A, children: a("Mark as template") })
|
|
151
|
+
] })
|
|
152
|
+
] }) });
|
|
153
|
+
};
|
|
154
|
+
export {
|
|
155
|
+
se as default
|
|
156
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=[{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash",provider:"google",description:"0.5x Credits",multiplier:.5},{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro",provider:"google",description:"1.25x Credits",multiplier:1.25},{id:"google/gemini-3-flash",name:"Gemini 3 Flash",provider:"google",description:"1x Credits",multiplier:1},{id:"google/gemini-3-pro",name:"Gemini 3 Pro",provider:"google",description:"2.5x Credits",multiplier:2.5},{id:"openai/gpt-5",name:"GPT-5",provider:"openai",description:"2x Credits",multiplier:2},{id:"anthropic/claude-haiku-4.5",name:"Claude Haiku 4.5",provider:"anthropic",description:"1x Credits",multiplier:1},{id:"anthropic/claude-sonnet-4",name:"Claude Sonnet 4",provider:"anthropic",description:"3x Credits",multiplier:3},{id:"anthropic/claude-sonnet-4.5",name:"Claude Sonnet 4.5",provider:"anthropic",description:"3x Credits",multiplier:3},{id:"openai/gpt-4.1",name:"GPT-4.1",provider:"openai",description:"2x Credits",multiplier:2}],o=e=>i.find(r=>r.id===e),t=()=>i[0];exports.AI_MODELS=i;exports.getDefaultModel=t;exports.getModelById=o;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const i = [
|
|
2
|
+
{
|
|
3
|
+
id: "google/gemini-2.5-flash",
|
|
4
|
+
name: "Gemini 2.5 Flash",
|
|
5
|
+
provider: "google",
|
|
6
|
+
description: "0.5x Credits",
|
|
7
|
+
multiplier: 0.5
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
id: "google/gemini-2.5-pro",
|
|
11
|
+
name: "Gemini 2.5 Pro",
|
|
12
|
+
provider: "google",
|
|
13
|
+
description: "1.25x Credits",
|
|
14
|
+
multiplier: 1.25
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "google/gemini-3-flash",
|
|
18
|
+
name: "Gemini 3 Flash",
|
|
19
|
+
provider: "google",
|
|
20
|
+
description: "1x Credits",
|
|
21
|
+
multiplier: 1
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "google/gemini-3-pro",
|
|
25
|
+
name: "Gemini 3 Pro",
|
|
26
|
+
provider: "google",
|
|
27
|
+
description: "2.5x Credits",
|
|
28
|
+
multiplier: 2.5
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "openai/gpt-5",
|
|
32
|
+
name: "GPT-5",
|
|
33
|
+
provider: "openai",
|
|
34
|
+
description: "2x Credits",
|
|
35
|
+
multiplier: 2
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "anthropic/claude-haiku-4.5",
|
|
39
|
+
name: "Claude Haiku 4.5",
|
|
40
|
+
provider: "anthropic",
|
|
41
|
+
description: "1x Credits",
|
|
42
|
+
multiplier: 1
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "anthropic/claude-sonnet-4",
|
|
46
|
+
name: "Claude Sonnet 4",
|
|
47
|
+
provider: "anthropic",
|
|
48
|
+
description: "3x Credits",
|
|
49
|
+
multiplier: 3
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "anthropic/claude-sonnet-4.5",
|
|
53
|
+
name: "Claude Sonnet 4.5",
|
|
54
|
+
provider: "anthropic",
|
|
55
|
+
description: "3x Credits",
|
|
56
|
+
multiplier: 3
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "openai/gpt-4.1",
|
|
60
|
+
name: "GPT-4.1",
|
|
61
|
+
provider: "openai",
|
|
62
|
+
description: "2x Credits",
|
|
63
|
+
multiplier: 2
|
|
64
|
+
}
|
|
65
|
+
], o = (e) => i.find((r) => r.id === e), n = () => i[0];
|
|
66
|
+
export {
|
|
67
|
+
i as A,
|
|
68
|
+
o as a,
|
|
69
|
+
n as g
|
|
70
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as c, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft as p, ChevronRight as g } from "lucide-react";
|
|
3
|
+
import * as l from "react";
|
|
4
|
+
import { P as k, C as N, i as x, j as P, k as S, l as w, m as d, B } from "./index-S8ibZk9Q.js";
|
|
5
|
+
function E({
|
|
6
|
+
data: o,
|
|
7
|
+
onSelect: u,
|
|
8
|
+
dataType: t = "value",
|
|
9
|
+
open: f,
|
|
10
|
+
setOpen: m
|
|
11
|
+
}) {
|
|
12
|
+
const [s, i] = l.useState([]), [y, h] = l.useState(o);
|
|
13
|
+
l.useEffect(() => {
|
|
14
|
+
f || i([]), h(o);
|
|
15
|
+
}, [o, f]);
|
|
16
|
+
const b = (e) => Array.isArray(e) ? "array" : typeof e == "object" && e !== null ? "object" : "value", j = l.useCallback(
|
|
17
|
+
(e) => {
|
|
18
|
+
const r = (a) => t === "value" ? a === "value" || a === "object" : t === "array" ? a === "array" : a === t;
|
|
19
|
+
e.type === "object" ? (i((a) => [...a, e.key]), h(e.value)) : r(e.type) && (u([...s, e.key].join(".")), m(!1));
|
|
20
|
+
},
|
|
21
|
+
[t, u, s, m]
|
|
22
|
+
), C = l.useCallback(() => {
|
|
23
|
+
if (s.length > 0) {
|
|
24
|
+
const e = s.slice(0, -1);
|
|
25
|
+
i(e), h(e.reduce((r, a) => r[a], o));
|
|
26
|
+
}
|
|
27
|
+
}, [s, o]), v = l.useMemo(() => Object.entries(y).map(([e, r]) => ({
|
|
28
|
+
key: e,
|
|
29
|
+
value: r,
|
|
30
|
+
type: b(r)
|
|
31
|
+
})).filter((e) => t === "value" ? e.type === "value" || e.type === "object" : t === "array" ? e.type === "array" || e.type === "object" : t === "object" ? e.type === "object" : !0), [y, t]);
|
|
32
|
+
return /* @__PURE__ */ c(k, { className: "z-[9999] w-[200px] p-0", children: /* @__PURE__ */ n(N, { children: [
|
|
33
|
+
/* @__PURE__ */ c(x, { className: "border-none", placeholder: "Search..." }),
|
|
34
|
+
/* @__PURE__ */ n(
|
|
35
|
+
P,
|
|
36
|
+
{
|
|
37
|
+
onWheel: (e) => {
|
|
38
|
+
try {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
const r = e.currentTarget;
|
|
41
|
+
r.scrollTop += e.deltaY;
|
|
42
|
+
} catch {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ c(S, { children: "No option found." }),
|
|
48
|
+
/* @__PURE__ */ n(w, { children: [
|
|
49
|
+
s.length > 0 && /* @__PURE__ */ n(d, { onSelect: C, className: "flex items-center text-sm", children: [
|
|
50
|
+
/* @__PURE__ */ c(p, { className: "mr-2 h-4 w-4" }),
|
|
51
|
+
"Back"
|
|
52
|
+
] }),
|
|
53
|
+
v.map((e) => /* @__PURE__ */ n(
|
|
54
|
+
d,
|
|
55
|
+
{
|
|
56
|
+
onSelect: () => j(e),
|
|
57
|
+
className: "flex items-center justify-between",
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ c("span", { children: e.key }),
|
|
60
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
61
|
+
t === "object" && e.type === "object" && /* @__PURE__ */ c(
|
|
62
|
+
B,
|
|
63
|
+
{
|
|
64
|
+
size: "sm",
|
|
65
|
+
variant: "ghost",
|
|
66
|
+
className: "h-6 px-2 hover:bg-primary hover:text-primary-foreground",
|
|
67
|
+
onClick: (r) => {
|
|
68
|
+
r.stopPropagation(), u([...s, e.key].join(".")), m(!1);
|
|
69
|
+
},
|
|
70
|
+
children: "Select"
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
(e.type === "object" || e.type === "array") && /* @__PURE__ */ c("div", { className: "cursor-pointer rounded p-1 hover:bg-muted", children: /* @__PURE__ */ c(g, { className: "h-4 w-4 opacity-50" }) })
|
|
74
|
+
] })
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
e.key
|
|
78
|
+
))
|
|
79
|
+
] })
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] }) });
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
E as default
|
|
87
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("lucide-react"),v=require("react"),s=require("./index-CnSjWE1P.cjs");function p(c){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const r in c)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(c,r);Object.defineProperty(l,r,i.get?i:{enumerable:!0,get:()=>c[r]})}}return l.default=c,Object.freeze(l)}const o=p(v);function C({data:c,onSelect:l,dataType:r="value",open:i,setOpen:m}){const[u,f]=o.useState([]),[h,j]=o.useState(c);o.useEffect(()=>{i||f([]),j(c)},[c,i]);const b=e=>Array.isArray(e)?"array":typeof e=="object"&&e!==null?"object":"value",y=o.useCallback(e=>{const n=a=>r==="value"?a==="value"||a==="object":r==="array"?a==="array":a===r;e.type==="object"?(f(a=>[...a,e.key]),j(e.value)):n(e.type)&&(l([...u,e.key].join(".")),m(!1))},[r,l,u,m]),x=o.useCallback(()=>{if(u.length>0){const e=u.slice(0,-1);f(e),j(e.reduce((n,a)=>n[a],c))}},[u,c]),g=o.useMemo(()=>Object.entries(h).map(([e,n])=>({key:e,value:n,type:b(n)})).filter(e=>r==="value"?e.type==="value"||e.type==="object":r==="array"?e.type==="array"||e.type==="object":r==="object"?e.type==="object":!0),[h,r]);return t.jsx(s.PopoverContent,{className:"z-[9999] w-[200px] p-0",children:t.jsxs(s.Command,{children:[t.jsx(s.CommandInput,{className:"border-none",placeholder:"Search..."}),t.jsxs(s.CommandList,{onWheel:e=>{try{e.preventDefault();const n=e.currentTarget;n.scrollTop+=e.deltaY}catch{e.preventDefault()}},children:[t.jsx(s.CommandEmpty,{children:"No option found."}),t.jsxs(s.CommandGroup,{children:[u.length>0&&t.jsxs(s.CommandItem,{onSelect:x,className:"flex items-center text-sm",children:[t.jsx(d.ChevronLeft,{className:"mr-2 h-4 w-4"}),"Back"]}),g.map(e=>t.jsxs(s.CommandItem,{onSelect:()=>y(e),className:"flex items-center justify-between",children:[t.jsx("span",{children:e.key}),t.jsxs("div",{className:"flex items-center gap-2",children:[r==="object"&&e.type==="object"&&t.jsx(s.Button,{size:"sm",variant:"ghost",className:"h-6 px-2 hover:bg-primary hover:text-primary-foreground",onClick:n=>{n.stopPropagation(),l([...u,e.key].join(".")),m(!1)},children:"Select"}),(e.type==="object"||e.type==="array")&&t.jsx("div",{className:"cursor-pointer rounded p-1 hover:bg-muted",children:t.jsx(d.ChevronRight,{className:"h-4 w-4 opacity-50"})})]})]},e.key))]})]})]})})}exports.default=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-CnSjWE1P.cjs"),n=require("./index-CbwxUFy_.cjs"),m=require("lodash-es"),w=require("lucide-react"),x=require("react-i18next"),P=()=>{const{t}=x.useTranslation(),[l,i]=n.useSearchParams(),c=l.get("lang"),g=n.useIsLanguagePageCreated(c),{setSelectedLang:u}=a.useLanguages(),d=()=>{const r=new URLSearchParams(window.location.search);r.delete("lang");const o=r.toString(),h=`${window.location.pathname}${o?`?${o}`:""}`;window.history.pushState({},"",h),i(r),u(""),window.dispatchEvent(new PopStateEvent("popstate"))};if(g)return null;const s=m.get(n.LANGUAGES,c);return e.jsx(n.BlurContainer,{children:e.jsxs(a.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(a.CardHeader,{className:"space-y-1",children:e.jsxs(a.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[e.jsx(w.LockIcon,{className:"h-6 w-6 text-yellow-500"}),t("Page missing for"),' "',s,'" ',t("language"),"."]})}),e.jsx(a.CardContent,{className:"grid gap-4",children:e.jsxs("div",{children:[t("Page is not available in the"),' "',s,'" ',t("language. Either create the page in the"),' "',s,'"',t("language or switch to the base language.")]})}),e.jsx(a.CardFooter,{children:e.jsx(a.Button,{onClick:d,className:"w-full",variant:"destructive",children:t("Switch to default language")})})]})})};exports.default=P;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { n as h, W as u, X as w, Y as p, Z as f, _ as P, B as C } from "./index-S8ibZk9Q.js";
|
|
3
|
+
import { c as S, d as L, L as x, B as N } from "./index-BDnwJqMw.js";
|
|
4
|
+
import { get as v } from "lodash-es";
|
|
5
|
+
import { LockIcon as B } from "lucide-react";
|
|
6
|
+
import { useTranslation as E } from "react-i18next";
|
|
7
|
+
const A = () => {
|
|
8
|
+
const { t: a } = E(), [c, l] = S(), r = c.get("lang"), i = L(r), { setSelectedLang: g } = h(), d = () => {
|
|
9
|
+
const n = new URLSearchParams(window.location.search);
|
|
10
|
+
n.delete("lang");
|
|
11
|
+
const o = n.toString(), m = `${window.location.pathname}${o ? `?${o}` : ""}`;
|
|
12
|
+
window.history.pushState({}, "", m), l(n), g(""), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
13
|
+
};
|
|
14
|
+
if (i) return null;
|
|
15
|
+
const t = v(x, r);
|
|
16
|
+
return /* @__PURE__ */ e(N, { children: /* @__PURE__ */ s(u, { className: "mx-auto w-full max-w-md", children: [
|
|
17
|
+
/* @__PURE__ */ e(w, { className: "space-y-1", children: /* @__PURE__ */ s(p, { className: "flex items-center gap-2 text-2xl", children: [
|
|
18
|
+
/* @__PURE__ */ e(B, { className: "h-6 w-6 text-yellow-500" }),
|
|
19
|
+
a("Page missing for"),
|
|
20
|
+
' "',
|
|
21
|
+
t,
|
|
22
|
+
'" ',
|
|
23
|
+
a("language"),
|
|
24
|
+
"."
|
|
25
|
+
] }) }),
|
|
26
|
+
/* @__PURE__ */ e(f, { className: "grid gap-4", children: /* @__PURE__ */ s("div", { children: [
|
|
27
|
+
a("Page is not available in the"),
|
|
28
|
+
' "',
|
|
29
|
+
t,
|
|
30
|
+
'" ',
|
|
31
|
+
a("language. Either create the page in the"),
|
|
32
|
+
' "',
|
|
33
|
+
t,
|
|
34
|
+
'"',
|
|
35
|
+
a("language or switch to the base language.")
|
|
36
|
+
] }) }),
|
|
37
|
+
/* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(C, { onClick: d, className: "w-full", variant: "destructive", children: a("Switch to default language") }) })
|
|
38
|
+
] }) });
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
A as default
|
|
42
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { c as g, d as n } from "./index-BDnwJqMw.js";
|
|
3
|
+
import { Suspense as s, lazy as t } from "react";
|
|
4
|
+
const o = t(() => import("./no-language-page-content-D_zd9Rb0.js")), l = () => {
|
|
5
|
+
const [e] = g(), r = e.get("lang");
|
|
6
|
+
return n(r) ? null : /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(o, {}) });
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
l as default
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-CbwxUFy_.cjs"),n=require("react"),t=n.lazy(()=>Promise.resolve().then(()=>require("./no-language-page-content-DAbLq0gX.cjs"))),g=()=>{const[r]=a.useSearchParams(),s=r.get("lang");return a.useIsLanguagePageCreated(s)?null:e.jsx(n.Suspense,{children:e.jsx(t,{})})};exports.default=g;
|