trade-safety 1.2.0 → 1.4.0

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.mjs CHANGED
@@ -1,316 +1,522 @@
1
- import { jsxs as i, jsx as s } from "react/jsx-runtime";
2
- import { useTranslation as o } from "react-i18next";
1
+ import { jsxs as s, jsx as a } from "react/jsx-runtime";
2
+ import { useTranslation as u } from "react-i18next";
3
3
  import "i18next";
4
4
  import "i18next-resources-to-backend";
5
- import { TRADE_SAFETY_NS as d } from "./locale.mjs";
6
- import { tradeSafetyTranslations as J } from "./locale.mjs";
7
- import * as c from "react";
8
- import { BaseCrudRepository as p } from "@aioia/core";
9
- import { z as r } from "zod";
10
- function f(e) {
11
- var t, n, a = "";
12
- if (typeof e == "string" || typeof e == "number") a += e;
5
+ import { TRADE_SAFETY_NS as f } from "./locale.mjs";
6
+ import { tradeSafetyTranslations as ge } from "./locale.mjs";
7
+ import * as o from "react";
8
+ import m from "react";
9
+ import { BaseCrudRepository as R } from "@aioia/core";
10
+ import { z as l } from "zod";
11
+ function _(e) {
12
+ var t, r, n = "";
13
+ if (typeof e == "string" || typeof e == "number") n += e;
13
14
  else if (typeof e == "object") if (Array.isArray(e)) {
14
- var l = e.length;
15
- for (t = 0; t < l; t++) e[t] && (n = f(e[t])) && (a && (a += " "), a += n);
16
- } else for (n in e) e[n] && (a && (a += " "), a += n);
17
- return a;
15
+ var i = e.length;
16
+ for (t = 0; t < i; t++) e[t] && (r = _(e[t])) && (n && (n += " "), n += r);
17
+ } else for (r in e) e[r] && (n && (n += " "), n += r);
18
+ return n;
18
19
  }
19
- function b() {
20
- for (var e, t, n = 0, a = "", l = arguments.length; n < l; n++) (e = arguments[n]) && (t = f(e)) && (a && (a += " "), a += t);
21
- return a;
20
+ function S() {
21
+ for (var e, t, r = 0, n = "", i = arguments.length; r < i; r++) (e = arguments[r]) && (t = _(e)) && (n && (n += " "), n += t);
22
+ return n;
22
23
  }
23
- const _ = {
24
+ const C = {
24
25
  default: "border-base-300",
25
26
  error: "border-error bg-error/10",
26
27
  warning: "border-warning bg-warning/10",
27
28
  success: "border-success bg-success/10",
28
29
  info: "border-info bg-info/10"
29
30
  };
30
- function u({
31
+ function p({
31
32
  title: e,
32
33
  icon: t,
33
- variant: n = "default",
34
- children: a
34
+ variant: r = "default",
35
+ children: n
35
36
  }) {
36
- return a ? /* @__PURE__ */ i("div", { className: b("rounded-lg border p-6", _[n]), children: [
37
- e && /* @__PURE__ */ i("h2", { className: "mb-2 flex items-center gap-2 font-bold", children: [
37
+ return n ? /* @__PURE__ */ s("div", { className: S("rounded-lg border p-6", C[r]), children: [
38
+ e && /* @__PURE__ */ s("h2", { className: "mb-2 flex items-center gap-2 font-bold", children: [
38
39
  e,
39
40
  t
40
41
  ] }),
41
- a
42
+ n
42
43
  ] }) : null;
43
44
  }
44
- function x({ data: e }) {
45
- const { t, i18n: n } = o(d);
46
- return e ? /* @__PURE__ */ i(u, { title: t("result.priceAnalysis"), children: [
47
- e.market_price_range && /* @__PURE__ */ i("div", { className: "mb-2", children: [
48
- /* @__PURE__ */ s("h3", { className: "text-sm font-bold", children: t("result.marketPrice") }),
49
- /* @__PURE__ */ s("p", { className: "text-xs", children: e.market_price_range })
45
+ function k({ summary: e }) {
46
+ const { t } = u(f);
47
+ return /* @__PURE__ */ a(p, { title: t("result.aiSummary"), children: /* @__PURE__ */ a("p", { className: "rounded-lg bg-base-200 p-6 text-sm leading-relaxed text-base-content", children: e }) });
48
+ }
49
+ function P({ data: e }) {
50
+ const { t, i18n: r } = u(f);
51
+ return e ? /* @__PURE__ */ s(p, { title: t("result.priceAnalysis"), children: [
52
+ e.market_price_range && /* @__PURE__ */ s("div", { className: "mb-2", children: [
53
+ /* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: t("result.marketPrice") }),
54
+ /* @__PURE__ */ a("p", { className: "text-xs", children: e.market_price_range })
50
55
  ] }),
51
- e.offered_price && /* @__PURE__ */ i("div", { className: "mb-2", children: [
52
- /* @__PURE__ */ s("h3", { className: "text-sm font-bold", children: t("result.offeredPrice") }),
53
- /* @__PURE__ */ s("p", { className: "text-xs", children: new Intl.NumberFormat(n.language, {
56
+ e.offered_price && /* @__PURE__ */ s("div", { className: "mb-2", children: [
57
+ /* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: t("result.offeredPrice") }),
58
+ /* @__PURE__ */ a("p", { className: "text-xs", children: new Intl.NumberFormat(r.language, {
54
59
  style: "currency",
55
60
  currency: e.currency || "USD"
56
61
  }).format(e.offered_price) })
57
62
  ] }),
58
- e.price_assessment && /* @__PURE__ */ i("div", { children: [
59
- /* @__PURE__ */ s("h3", { className: "text-sm font-bold", children: t("result.priceAssessment") }),
60
- /* @__PURE__ */ s("p", { className: "text-xs", children: e.price_assessment })
63
+ e.price_assessment && /* @__PURE__ */ s("div", { children: [
64
+ /* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: t("result.priceAssessment") }),
65
+ /* @__PURE__ */ a("p", { className: "text-xs", children: e.price_assessment })
61
66
  ] })
62
67
  ] }) : null;
63
68
  }
64
- function v({
69
+ function z({
65
70
  recommendation: e
66
71
  }) {
67
- const { t } = o(d);
68
- return e ? /* @__PURE__ */ s(u, { title: t("result.recommendation"), children: /* @__PURE__ */ s("p", { className: "text-xs", children: e }) }) : null;
72
+ const { t } = u(f);
73
+ return e ? /* @__PURE__ */ a(p, { title: t("result.recommendation"), children: /* @__PURE__ */ a("p", { className: "text-xs", children: e }) }) : null;
69
74
  }
70
- function w({
75
+ function A({
71
76
  title: e,
72
77
  titleId: t,
73
- ...n
74
- }, a) {
75
- return /* @__PURE__ */ c.createElement("svg", Object.assign({
78
+ ...r
79
+ }, n) {
80
+ return /* @__PURE__ */ o.createElement("svg", Object.assign({
76
81
  xmlns: "http://www.w3.org/2000/svg",
77
82
  viewBox: "0 0 24 24",
78
83
  fill: "currentColor",
79
84
  "aria-hidden": "true",
80
85
  "data-slot": "icon",
81
- ref: a,
86
+ ref: n,
82
87
  "aria-labelledby": t
83
- }, n), e ? /* @__PURE__ */ c.createElement("title", {
88
+ }, r), e ? /* @__PURE__ */ o.createElement("title", {
84
89
  id: t
85
- }, e) : null, /* @__PURE__ */ c.createElement("path", {
90
+ }, e) : null, /* @__PURE__ */ o.createElement("path", {
86
91
  fillRule: "evenodd",
87
92
  d: "M8.603 3.799A4.49 4.49 0 0 1 12 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 0 1 3.498 1.307 4.491 4.491 0 0 1 1.307 3.497A4.49 4.49 0 0 1 21.75 12a4.49 4.49 0 0 1-1.549 3.397 4.491 4.491 0 0 1-1.307 3.497 4.491 4.491 0 0 1-3.497 1.307A4.49 4.49 0 0 1 12 21.75a4.49 4.49 0 0 1-3.397-1.549 4.49 4.49 0 0 1-3.498-1.306 4.491 4.491 0 0 1-1.307-3.498A4.49 4.49 0 0 1 2.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 0 1 1.307-3.497 4.49 4.49 0 0 1 3.497-1.307Zm7.007 6.387a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",
88
93
  clipRule: "evenodd"
89
94
  }));
90
95
  }
91
- const y = /* @__PURE__ */ c.forwardRef(w);
92
- function N({
96
+ const T = /* @__PURE__ */ o.forwardRef(A);
97
+ function D({
93
98
  title: e,
94
99
  titleId: t,
95
- ...n
96
- }, a) {
97
- return /* @__PURE__ */ c.createElement("svg", Object.assign({
100
+ ...r
101
+ }, n) {
102
+ return /* @__PURE__ */ o.createElement("svg", Object.assign({
98
103
  xmlns: "http://www.w3.org/2000/svg",
99
104
  viewBox: "0 0 24 24",
100
105
  fill: "currentColor",
101
106
  "aria-hidden": "true",
102
107
  "data-slot": "icon",
103
- ref: a,
108
+ ref: n,
104
109
  "aria-labelledby": t
105
- }, n), e ? /* @__PURE__ */ c.createElement("title", {
110
+ }, r), e ? /* @__PURE__ */ o.createElement("title", {
106
111
  id: t
107
- }, e) : null, /* @__PURE__ */ c.createElement("path", {
112
+ }, e) : null, /* @__PURE__ */ o.createElement("path", {
108
113
  fillRule: "evenodd",
109
114
  d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75Zm0 8.25a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",
110
115
  clipRule: "evenodd"
111
116
  }));
112
117
  }
113
- const S = /* @__PURE__ */ c.forwardRef(N);
114
- function R({
118
+ const M = /* @__PURE__ */ o.forwardRef(D);
119
+ function Z({
115
120
  title: e,
116
121
  titleId: t,
117
- ...n
118
- }, a) {
119
- return /* @__PURE__ */ c.createElement("svg", Object.assign({
122
+ ...r
123
+ }, n) {
124
+ return /* @__PURE__ */ o.createElement("svg", Object.assign({
120
125
  xmlns: "http://www.w3.org/2000/svg",
121
126
  viewBox: "0 0 24 24",
122
127
  fill: "currentColor",
123
128
  "aria-hidden": "true",
124
129
  "data-slot": "icon",
125
- ref: a,
130
+ ref: n,
126
131
  "aria-labelledby": t
127
- }, n), e ? /* @__PURE__ */ c.createElement("title", {
132
+ }, r), e ? /* @__PURE__ */ o.createElement("title", {
128
133
  id: t
129
- }, e) : null, /* @__PURE__ */ c.createElement("path", {
134
+ }, e) : null, /* @__PURE__ */ o.createElement("path", {
130
135
  fillRule: "evenodd",
131
136
  d: "M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-2.625 6c-.54 0-.828.419-.936.634a1.96 1.96 0 0 0-.189.866c0 .298.059.605.189.866.108.215.395.634.936.634.54 0 .828-.419.936-.634.13-.26.189-.568.189-.866 0-.298-.059-.605-.189-.866-.108-.215-.395-.634-.936-.634Zm4.314.634c.108-.215.395-.634.936-.634.54 0 .828.419.936.634.13.26.189.568.189.866 0 .298-.059.605-.189.866-.108.215-.395.634-.936.634-.54 0-.828-.419-.936-.634a1.96 1.96 0 0 1-.189-.866c0-.298.059-.605.189-.866Zm-4.34 7.964a.75.75 0 0 1-1.061-1.06 5.236 5.236 0 0 1 3.73-1.538 5.236 5.236 0 0 1 3.695 1.538.75.75 0 1 1-1.061 1.06 3.736 3.736 0 0 0-2.639-1.098 3.736 3.736 0 0 0-2.664 1.098Z",
132
137
  clipRule: "evenodd"
133
138
  }));
134
139
  }
135
- const k = /* @__PURE__ */ c.forwardRef(R);
136
- function E({
140
+ const F = /* @__PURE__ */ o.forwardRef(Z);
141
+ function B({
137
142
  title: e,
138
143
  titleId: t,
139
- ...n
140
- }, a) {
141
- return /* @__PURE__ */ c.createElement("svg", Object.assign({
144
+ ...r
145
+ }, n) {
146
+ return /* @__PURE__ */ o.createElement("svg", Object.assign({
142
147
  xmlns: "http://www.w3.org/2000/svg",
143
148
  viewBox: "0 0 24 24",
144
149
  fill: "currentColor",
145
150
  "aria-hidden": "true",
146
151
  "data-slot": "icon",
147
- ref: a,
152
+ ref: n,
148
153
  "aria-labelledby": t
149
- }, n), e ? /* @__PURE__ */ c.createElement("title", {
154
+ }, r), e ? /* @__PURE__ */ o.createElement("title", {
150
155
  id: t
151
- }, e) : null, /* @__PURE__ */ c.createElement("path", {
156
+ }, e) : null, /* @__PURE__ */ o.createElement("path", {
152
157
  fillRule: "evenodd",
153
158
  d: "M11.484 2.17a.75.75 0 0 1 1.032 0 11.209 11.209 0 0 0 7.877 3.08.75.75 0 0 1 .722.515 12.74 12.74 0 0 1 .635 3.985c0 5.942-4.064 10.933-9.563 12.348a.749.749 0 0 1-.374 0C6.314 20.683 2.25 15.692 2.25 9.75c0-1.39.223-2.73.635-3.985a.75.75 0 0 1 .722-.516l.143.001c2.996 0 5.718-1.17 7.734-3.08ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75ZM12 15a.75.75 0 0 0-.75.75v.008c0 .414.336.75.75.75h.008a.75.75 0 0 0 .75-.75v-.008a.75.75 0 0 0-.75-.75H12Z",
154
159
  clipRule: "evenodd"
155
160
  }));
156
161
  }
157
- const A = /* @__PURE__ */ c.forwardRef(E);
158
- function j({ items: e }) {
159
- const { t } = o(d);
160
- return e.length === 0 ? null : /* @__PURE__ */ i("div", { className: "mb-4", children: [
161
- /* @__PURE__ */ i("h2", { className: "flex items-center gap-1 py-4 font-bold", children: [
162
+ const H = /* @__PURE__ */ o.forwardRef(B);
163
+ function I({ items: e }) {
164
+ const { t } = u(f);
165
+ return e.length === 0 ? null : /* @__PURE__ */ s("div", { className: "mb-4", children: [
166
+ /* @__PURE__ */ s("h2", { className: "flex items-center gap-1 py-4 font-bold", children: [
162
167
  t("result.safetyChecklist"),
163
168
  " ",
164
- /* @__PURE__ */ s(y, { className: "size-6" })
169
+ /* @__PURE__ */ a(T, { className: "size-6" })
165
170
  ] }),
166
- /* @__PURE__ */ s(u, { variant: "info", children: e.map((n, a) => /* @__PURE__ */ i("label", { className: "label w-fit cursor-pointer gap-2", children: [
167
- /* @__PURE__ */ s(
171
+ /* @__PURE__ */ a(p, { variant: "info", children: e.map((r, n) => /* @__PURE__ */ s("label", { className: "label w-fit cursor-pointer gap-2", children: [
172
+ /* @__PURE__ */ a(
168
173
  "input",
169
174
  {
170
175
  type: "checkbox",
171
176
  className: "checkbox rounded-full [--chkbg:theme(colors.neutral)] [--chkfg:theme(colors.neutral-content)]"
172
177
  }
173
178
  ),
174
- /* @__PURE__ */ s("span", { className: "label-text", children: n })
175
- ] }, a)) })
179
+ /* @__PURE__ */ a("span", { className: "label-text", children: r })
180
+ ] }, n)) })
176
181
  ] });
177
182
  }
178
- const C = {
179
- error: k,
180
- warning: S,
181
- success: A
182
- }, T = {
183
+ const L = {
184
+ error: F,
185
+ warning: M,
186
+ success: H
187
+ }, W = {
183
188
  error: "result.riskSignals",
184
189
  warning: "result.cautions",
185
190
  success: "result.safeIndicators"
186
191
  };
187
- function m({
192
+ function v({
188
193
  signals: e,
189
194
  variant: t = "error"
190
195
  }) {
191
- const { t: n } = o(d);
196
+ const { t: r } = u(f);
192
197
  if (e.length === 0) return null;
193
- const a = C[t];
194
- return /* @__PURE__ */ i("div", { className: "mb-4", children: [
195
- /* @__PURE__ */ i("h2", { className: "flex items-center gap-1 py-4 font-bold", children: [
196
- n(T[t]),
198
+ const n = L[t];
199
+ return /* @__PURE__ */ s("div", { className: "mb-4", children: [
200
+ /* @__PURE__ */ s("h2", { className: "flex items-center gap-1 py-4 font-bold", children: [
201
+ r(W[t]),
197
202
  " ",
198
- /* @__PURE__ */ s(a, { className: "size-6" })
203
+ /* @__PURE__ */ a(n, { className: "size-6" })
199
204
  ] }),
200
- /* @__PURE__ */ s("div", { className: "space-y-3", children: e.map((l, g) => /* @__PURE__ */ s(u, { variant: t, children: /* @__PURE__ */ i("div", { className: "space-y-2", children: [
201
- /* @__PURE__ */ i("div", { children: [
202
- /* @__PURE__ */ s("h3", { className: "text-sm font-bold", children: l.title }),
203
- /* @__PURE__ */ s("p", { className: "text-xs", children: l.description })
205
+ /* @__PURE__ */ a("div", { className: "space-y-3", children: e.map((i, c) => /* @__PURE__ */ a(p, { variant: t, children: /* @__PURE__ */ s("div", { className: "space-y-2", children: [
206
+ /* @__PURE__ */ s("div", { children: [
207
+ /* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: i.title }),
208
+ /* @__PURE__ */ a("p", { className: "text-xs", children: i.description })
204
209
  ] }),
205
- /* @__PURE__ */ i("div", { children: [
206
- /* @__PURE__ */ s("h3", { className: "text-sm font-bold", children: n("result.whatToDo") }),
207
- /* @__PURE__ */ s("p", { className: "text-xs", children: l.what_to_do })
210
+ /* @__PURE__ */ s("div", { children: [
211
+ /* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: r("result.whatToDo") }),
212
+ /* @__PURE__ */ a("p", { className: "text-xs", children: i.what_to_do })
208
213
  ] })
209
- ] }) }, g)) })
214
+ ] }) }, c)) })
210
215
  ] });
211
216
  }
212
- function Z({
217
+ function $({
213
218
  translation: e,
214
219
  nuance: t
215
220
  }) {
216
- const { t: n } = o(d);
217
- return /* @__PURE__ */ i(u, { title: n("result.translation"), children: [
218
- e && /* @__PURE__ */ i("div", { className: "mb-2", children: [
219
- /* @__PURE__ */ s("h3", { className: "text-sm font-bold", children: n("result.translationTitle") }),
220
- /* @__PURE__ */ s("p", { className: "text-xs", children: e })
221
+ const { t: r } = u(f);
222
+ return /* @__PURE__ */ s(p, { title: r("result.translation"), children: [
223
+ e && /* @__PURE__ */ s("div", { className: "mb-2", children: [
224
+ /* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: r("result.translationTitle") }),
225
+ /* @__PURE__ */ a("p", { className: "text-xs", children: e })
221
226
  ] }),
222
- t && /* @__PURE__ */ i("div", { children: [
223
- /* @__PURE__ */ s("h3", { className: "text-sm font-bold", children: n("result.nuanceTitle") }),
224
- /* @__PURE__ */ s("p", { className: "text-xs", children: t })
227
+ t && /* @__PURE__ */ s("div", { children: [
228
+ /* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: r("result.nuanceTitle") }),
229
+ /* @__PURE__ */ a("p", { className: "text-xs", children: t })
225
230
  ] })
226
231
  ] });
227
232
  }
228
- function V({ analysis: e }) {
229
- return /* @__PURE__ */ i("div", { children: [
230
- /* @__PURE__ */ i("div", { className: "mb-4 flex flex-col gap-4", children: [
231
- (e.translation || e.nuance_explanation) && /* @__PURE__ */ s(
232
- Z,
233
+ function me({ analysis: e }) {
234
+ return /* @__PURE__ */ s("div", { children: [
235
+ e.ai_summary && /* @__PURE__ */ a(k, { summary: e.ai_summary }),
236
+ /* @__PURE__ */ s("div", { className: "my-4 flex flex-col gap-4", children: [
237
+ (e.translation || e.nuance_explanation) && /* @__PURE__ */ a(
238
+ $,
233
239
  {
234
240
  translation: e.translation,
235
241
  nuance: e.nuance_explanation
236
242
  }
237
243
  ),
238
- e.price_analysis && /* @__PURE__ */ s(x, { data: e.price_analysis }),
239
- e.recommendation && /* @__PURE__ */ s(v, { recommendation: e.recommendation })
244
+ e.price_analysis && /* @__PURE__ */ a(P, { data: e.price_analysis }),
245
+ e.recommendation && /* @__PURE__ */ a(z, { recommendation: e.recommendation })
240
246
  ] }),
241
- e.risk_signals.length > 0 && /* @__PURE__ */ s(m, { signals: e.risk_signals, variant: "error" }),
242
- e.cautions.length > 0 && /* @__PURE__ */ s(m, { signals: e.cautions, variant: "warning" }),
243
- e.safe_indicators.length > 0 && /* @__PURE__ */ s(m, { signals: e.safe_indicators, variant: "success" }),
244
- e.safety_checklist.length > 0 && /* @__PURE__ */ s(j, { items: e.safety_checklist })
247
+ e.risk_signals.length > 0 && /* @__PURE__ */ a(v, { signals: e.risk_signals, variant: "error" }),
248
+ e.cautions.length > 0 && /* @__PURE__ */ a(v, { signals: e.cautions, variant: "warning" }),
249
+ e.safe_indicators.length > 0 && /* @__PURE__ */ a(v, { signals: e.safe_indicators, variant: "success" }),
250
+ e.safety_checklist.length > 0 && /* @__PURE__ */ a(I, { items: e.safety_checklist })
245
251
  ] });
246
252
  }
247
- const h = r.object({
248
- category: r.enum(["payment", "seller", "platform", "price", "content"]),
249
- severity: r.enum(["high", "medium", "low"]),
250
- title: r.string(),
251
- description: r.string(),
252
- what_to_do: r.string()
253
- }), F = r.object({
254
- market_price_range: r.string().nullish(),
255
- offered_price: r.number().nullish(),
256
- currency: r.string().nullish(),
257
- price_assessment: r.string(),
258
- warnings: r.array(r.string())
259
- }), M = r.object({
260
- translation: r.string().nullish(),
261
- nuance_explanation: r.string().nullish(),
262
- risk_signals: r.array(h),
263
- cautions: r.array(h),
264
- safe_indicators: r.array(h),
265
- price_analysis: F,
266
- safety_checklist: r.array(r.string()),
267
- risk_score: r.number(),
268
- recommendation: r.string(),
269
- emotional_support: r.string()
270
- }), B = r.object({
271
- risk_signals_count: r.number(),
272
- cautions_count: r.number(),
273
- safe_indicators_count: r.number()
274
- }), D = r.object({
275
- id: r.string(),
276
- user_id: r.string().nullish(),
277
- input_text: r.string(),
278
- llm_analysis: M,
279
- risk_score: r.number(),
280
- expert_advice: r.string().nullish(),
281
- expert_reviewed: r.boolean(),
282
- expert_reviewed_at: r.string().nullish(),
283
- expert_reviewed_by: r.string().nullish(),
284
- created_at: r.string(),
285
- updated_at: r.string()
286
- }), O = r.union([
287
- D,
288
- r.object({
289
- id: r.string(),
290
- quick_summary: B,
291
- signup_required: r.literal(!0)
292
- })
293
- ]);
294
- class K extends p {
253
+ var O = {
254
+ color: void 0,
255
+ size: void 0,
256
+ className: void 0,
257
+ style: void 0,
258
+ attr: void 0
259
+ }, y = m.createContext && /* @__PURE__ */ m.createContext(O), K = ["attr", "size", "title"];
260
+ function V(e, t) {
261
+ if (e == null) return {};
262
+ var r = X(e, t), n, i;
263
+ if (Object.getOwnPropertySymbols) {
264
+ var c = Object.getOwnPropertySymbols(e);
265
+ for (i = 0; i < c.length; i++)
266
+ n = c[i], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
267
+ }
268
+ return r;
269
+ }
270
+ function X(e, t) {
271
+ if (e == null) return {};
272
+ var r = {};
273
+ for (var n in e)
274
+ if (Object.prototype.hasOwnProperty.call(e, n)) {
275
+ if (t.indexOf(n) >= 0) continue;
276
+ r[n] = e[n];
277
+ }
278
+ return r;
279
+ }
280
+ function g() {
281
+ return g = Object.assign ? Object.assign.bind() : function(e) {
282
+ for (var t = 1; t < arguments.length; t++) {
283
+ var r = arguments[t];
284
+ for (var n in r)
285
+ Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
286
+ }
287
+ return e;
288
+ }, g.apply(this, arguments);
289
+ }
290
+ function N(e, t) {
291
+ var r = Object.keys(e);
292
+ if (Object.getOwnPropertySymbols) {
293
+ var n = Object.getOwnPropertySymbols(e);
294
+ t && (n = n.filter(function(i) {
295
+ return Object.getOwnPropertyDescriptor(e, i).enumerable;
296
+ })), r.push.apply(r, n);
297
+ }
298
+ return r;
299
+ }
300
+ function x(e) {
301
+ for (var t = 1; t < arguments.length; t++) {
302
+ var r = arguments[t] != null ? arguments[t] : {};
303
+ t % 2 ? N(Object(r), !0).forEach(function(n) {
304
+ Y(e, n, r[n]);
305
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : N(Object(r)).forEach(function(n) {
306
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
307
+ });
308
+ }
309
+ return e;
310
+ }
311
+ function Y(e, t, r) {
312
+ return t = G(t), t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
313
+ }
314
+ function G(e) {
315
+ var t = U(e, "string");
316
+ return typeof t == "symbol" ? t : t + "";
317
+ }
318
+ function U(e, t) {
319
+ if (typeof e != "object" || !e) return e;
320
+ var r = e[Symbol.toPrimitive];
321
+ if (r !== void 0) {
322
+ var n = r.call(e, t);
323
+ if (typeof n != "object") return n;
324
+ throw new TypeError("@@toPrimitive must return a primitive value.");
325
+ }
326
+ return (t === "string" ? String : Number)(e);
327
+ }
328
+ function j(e) {
329
+ return e && e.map((t, r) => /* @__PURE__ */ m.createElement(t.tag, x({
330
+ key: r
331
+ }, t.attr), j(t.child)));
332
+ }
333
+ function E(e) {
334
+ return (t) => /* @__PURE__ */ m.createElement(q, g({
335
+ attr: x({}, e.attr)
336
+ }, t), j(e.child));
337
+ }
338
+ function q(e) {
339
+ var t = (r) => {
340
+ var {
341
+ attr: n,
342
+ size: i,
343
+ title: c
344
+ } = e, b = V(e, K), h = i || r.size || "1em", d;
345
+ return r.className && (d = r.className), e.className && (d = (d ? d + " " : "") + e.className), /* @__PURE__ */ m.createElement("svg", g({
346
+ stroke: "currentColor",
347
+ fill: "currentColor",
348
+ strokeWidth: "0"
349
+ }, r.attr, n, b, {
350
+ className: d,
351
+ style: x(x({
352
+ color: e.color || r.color
353
+ }, r.style), e.style),
354
+ height: h,
355
+ width: h,
356
+ xmlns: "http://www.w3.org/2000/svg"
357
+ }), c && /* @__PURE__ */ m.createElement("title", null, c), e.children);
358
+ };
359
+ return y !== void 0 ? /* @__PURE__ */ m.createElement(y.Consumer, null, (r) => t(r)) : t(O);
360
+ }
361
+ function J(e) {
362
+ return E({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M0 256C0 114.6 114.6 0 256 0S512 114.6 512 256s-114.6 256-256 256L37.1 512c-13.7 0-20.5-16.5-10.9-26.2L75 437C28.7 390.7 0 326.7 0 256zM349.6 153.6c23.6 0 42.7-19.1 42.7-42.7s-19.1-42.7-42.7-42.7c-20.6 0-37.8 14.6-41.8 34c-34.5 3.7-61.4 33-61.4 68.4l0 .2c-37.5 1.6-71.8 12.3-99 29.1c-10.1-7.8-22.8-12.5-36.5-12.5c-33 0-59.8 26.8-59.8 59.8c0 24 14.1 44.6 34.4 54.1c2 69.4 77.6 125.2 170.6 125.2s168.7-55.9 170.6-125.3c20.2-9.6 34.1-30.2 34.1-54c0-33-26.8-59.8-59.8-59.8c-13.7 0-26.3 4.6-36.4 12.4c-27.4-17-62.1-27.7-100-29.1l0-.2c0-25.4 18.9-46.5 43.4-49.9l0 0c4.4 18.8 21.3 32.8 41.5 32.8zM177.1 246.9c16.7 0 29.5 17.6 28.5 39.3s-13.5 29.6-30.3 29.6s-31.4-8.8-30.4-30.5s15.4-38.3 32.1-38.3zm190.1 38.3c1 21.7-13.7 30.5-30.4 30.5s-29.3-7.9-30.3-29.6c-1-21.7 11.8-39.3 28.5-39.3s31.2 16.6 32.1 38.3zm-48.1 56.7c-10.3 24.6-34.6 41.9-63 41.9s-52.7-17.3-63-41.9c-1.2-2.9 .8-6.2 3.9-6.5c18.4-1.9 38.3-2.9 59.1-2.9s40.7 1 59.1 2.9c3.1 .3 5.1 3.6 3.9 6.5z" }, child: [] }] })(e);
363
+ }
364
+ function Q(e) {
365
+ return E({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z" }, child: [] }] })(e);
366
+ }
367
+ function ue({
368
+ value: e,
369
+ onChange: t,
370
+ onSubmit: r,
371
+ isLoading: n,
372
+ error: i
373
+ }) {
374
+ const { t: c } = u(f), b = n ? /* @__PURE__ */ a("span", { className: "loading loading-spinner loading-sm" }) : c("hero.checkSafety"), h = n || !e.trim();
375
+ return /* @__PURE__ */ a("div", { className: "flex w-full flex-col items-center justify-center", children: /* @__PURE__ */ s("div", { className: "w-full lg:max-w-[720px]", children: [
376
+ /* @__PURE__ */ a("h1", { className: "mb-2 text-left text-3xl font-bold text-base-content sm:mb-8 sm:text-center sm:text-4xl md:mb-8", children: c("hero.title") }),
377
+ /* @__PURE__ */ a("p", { className: "mb-4 text-left text-sm text-base-content/70 sm:mb-8 sm:text-center sm:text-base md:mb-16", children: c("hero.subtitle") }),
378
+ /* @__PURE__ */ s("div", { className: S("mb-4", !i && "sm:mb-8 md:mb-12"), children: [
379
+ /* @__PURE__ */ s("div", { className: "relative hidden lg:block", children: [
380
+ /* @__PURE__ */ a(
381
+ "input",
382
+ {
383
+ type: "text",
384
+ className: "input input-bordered h-[72px] w-full pr-36 text-sm placeholder:text-base-300 focus:outline-none",
385
+ placeholder: c("hero.placeholder"),
386
+ "aria-label": c("hero.placeholder"),
387
+ value: e,
388
+ onChange: (d) => t(d.target.value),
389
+ disabled: n,
390
+ onKeyDown: (d) => {
391
+ d.key === "Enter" && !h && r();
392
+ }
393
+ }
394
+ ),
395
+ /* @__PURE__ */ a(
396
+ "button",
397
+ {
398
+ className: "btn btn-neutral absolute right-2 top-1/2 h-[56px] min-h-0 -translate-y-1/2 !animate-none px-6 font-bold text-neutral-content",
399
+ onClick: r,
400
+ disabled: h,
401
+ children: b
402
+ }
403
+ )
404
+ ] }),
405
+ /* @__PURE__ */ a("div", { className: "block lg:hidden", children: /* @__PURE__ */ s("div", { className: "relative h-[400px] w-full overflow-hidden rounded-xl border border-base-300 bg-base-100", children: [
406
+ !e && /* @__PURE__ */ a(
407
+ "div",
408
+ {
409
+ className: "pointer-events-none absolute inset-0 overflow-hidden p-5 pb-24 text-base text-base-300",
410
+ "aria-hidden": "true",
411
+ children: /* @__PURE__ */ s("div", { className: "whitespace-pre-line leading-relaxed", children: [
412
+ /* @__PURE__ */ a("p", { className: "mb-4 text-base-300", children: c("hero.placeholder") }),
413
+ c("hero.placeholderExample")
414
+ ] })
415
+ }
416
+ ),
417
+ /* @__PURE__ */ a("div", { className: "absolute inset-0 overflow-hidden pb-24", children: /* @__PURE__ */ a(
418
+ "textarea",
419
+ {
420
+ className: "textarea size-full resize-none overflow-auto bg-transparent p-4 leading-6 text-base-content focus:outline-none",
421
+ value: e,
422
+ "aria-label": c("hero.placeholder"),
423
+ onChange: (d) => t(d.target.value),
424
+ disabled: n,
425
+ placeholder: ""
426
+ }
427
+ ) }),
428
+ /* @__PURE__ */ a("div", { className: "absolute inset-x-4 bottom-4 z-10", children: /* @__PURE__ */ a(
429
+ "button",
430
+ {
431
+ className: "btn btn-neutral h-16 w-full text-base font-medium text-neutral-content",
432
+ onClick: r,
433
+ disabled: h,
434
+ children: b
435
+ }
436
+ ) })
437
+ ] }) })
438
+ ] }),
439
+ i && /* @__PURE__ */ a("div", { className: "alert alert-error mb-6 flex items-center gap-2 text-sm", children: /* @__PURE__ */ a("span", { children: i }) }),
440
+ /* @__PURE__ */ a("p", { className: "mb-4 text-left text-xs text-base-content/60 sm:mb-8 sm:text-center md:mb-12", children: c("hero.disclaimer") }),
441
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-start gap-6 sm:justify-center", children: [
442
+ /* @__PURE__ */ a(
443
+ "a",
444
+ {
445
+ href: "https://x.com",
446
+ target: "_blank",
447
+ rel: "noopener noreferrer",
448
+ "aria-label": "X",
449
+ children: /* @__PURE__ */ a(Q, { className: "size-6 text-base-content transition-colors hover:text-base-content/70" })
450
+ }
451
+ ),
452
+ /* @__PURE__ */ a(
453
+ "a",
454
+ {
455
+ href: "https://reddit.com",
456
+ target: "_blank",
457
+ rel: "noopener noreferrer",
458
+ "aria-label": "Reddit",
459
+ children: /* @__PURE__ */ a(J, { className: "size-6 text-base-content transition-colors hover:text-base-content/70" })
460
+ }
461
+ )
462
+ ] })
463
+ ] }) });
464
+ }
465
+ const w = l.object({
466
+ category: l.enum(["payment", "seller", "platform", "price", "content"]),
467
+ severity: l.enum(["high", "medium", "low"]),
468
+ title: l.string(),
469
+ description: l.string(),
470
+ what_to_do: l.string()
471
+ }), ee = l.object({
472
+ market_price_range: l.string().nullish(),
473
+ offered_price: l.number().nullish(),
474
+ currency: l.string().nullish(),
475
+ price_assessment: l.string(),
476
+ warnings: l.array(l.string())
477
+ }), te = l.object({
478
+ ai_summary: l.string(),
479
+ translation: l.string().nullish(),
480
+ nuance_explanation: l.string().nullish(),
481
+ risk_signals: l.array(w),
482
+ cautions: l.array(w),
483
+ safe_indicators: l.array(w),
484
+ price_analysis: ee,
485
+ safety_checklist: l.array(l.string()),
486
+ safe_score: l.number(),
487
+ recommendation: l.string(),
488
+ emotional_support: l.string()
489
+ }), re = l.object({
490
+ id: l.string(),
491
+ user_id: l.string().nullish(),
492
+ input_text: l.string(),
493
+ llm_analysis: te,
494
+ safe_score: l.number(),
495
+ expert_advice: l.string().nullish(),
496
+ expert_reviewed: l.boolean(),
497
+ expert_reviewed_at: l.string().nullish(),
498
+ expert_reviewed_by: l.string().nullish(),
499
+ created_at: l.string(),
500
+ updated_at: l.string()
501
+ });
502
+ class fe extends R {
295
503
  constructor() {
296
504
  super(...arguments), this.resource = "trade-safety";
297
505
  }
298
506
  getDataSchema() {
299
- return O;
507
+ return re;
300
508
  }
301
509
  }
302
- const U = {
303
- high: 70,
304
- // >= 70: High risk (red)
305
- medium: 40
306
- // >= 40: Medium risk (yellow)
307
- // < 40: Low risk (green)
510
+ const he = {
511
+ safe: 70,
512
+ caution: 40
308
513
  };
309
514
  export {
310
- V as DetailedResult,
311
- U as RISK_SCORE_THRESHOLDS,
312
- d as TRADE_SAFETY_NS,
313
- K as TradeSafetyRepository,
314
- J as tradeSafetyTranslations
515
+ me as DetailedResult,
516
+ ue as HomeHeroSection,
517
+ he as SAFETY_SCORE_THRESHOLDS,
518
+ f as TRADE_SAFETY_NS,
519
+ fe as TradeSafetyRepository,
520
+ ge as tradeSafetyTranslations
315
521
  };
316
522
  //# sourceMappingURL=index.mjs.map