@instockng/storefront-ui 1.0.112 → 1.0.113
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/components/AssistantDrawer.d.ts.map +1 -1
- package/dist/index100.mjs +65 -26
- package/dist/index101.mjs +84 -6
- package/dist/index102.mjs +26 -72
- package/dist/index103.mjs +8 -3
- package/dist/index104.mjs +75 -2
- package/dist/index105.mjs +3 -82
- package/dist/index106.mjs +2 -54
- package/dist/index107.mjs +82 -5
- package/dist/index108.mjs +53 -4
- package/dist/index109.mjs +5 -178
- package/dist/index110.mjs +5 -53
- package/dist/index111.mjs +178 -68
- package/dist/index112.mjs +50 -34
- package/dist/index113.mjs +69 -43
- package/dist/index115.mjs +1 -1
- package/dist/index116.mjs +1 -1
- package/dist/index117.mjs +6 -6
- package/dist/index118.mjs +4 -4
- package/dist/index119.mjs +3 -3
- package/dist/index120.mjs +1 -1
- package/dist/index121.mjs +1 -1
- package/dist/index122.mjs +1 -1
- package/dist/index123.mjs +2 -2
- package/dist/index124.mjs +2 -2
- package/dist/index125.mjs +3 -3
- package/dist/index126.mjs +1 -1
- package/dist/index127.mjs +3 -3
- package/dist/index128.mjs +2 -2
- package/dist/index129.mjs +2 -2
- package/dist/index130.mjs +1 -1
- package/dist/index131.mjs +3 -3
- package/dist/index132.mjs +1 -1
- package/dist/index133.mjs +1 -1
- package/dist/index134.mjs +3 -3
- package/dist/index135.mjs +2 -2
- package/dist/index136.mjs +4 -4
- package/dist/index137.mjs +1 -1
- package/dist/index138.mjs +3 -3
- package/dist/index139.mjs +4 -4
- package/dist/index140.mjs +1 -1
- package/dist/index141.mjs +1 -1
- package/dist/index142.mjs +1 -1
- package/dist/index143.mjs +1 -1
- package/dist/index144.mjs +1 -1
- package/dist/index145.mjs +1 -1
- package/dist/index146.mjs +1 -1
- package/dist/index147.mjs +2 -2
- package/dist/index148.mjs +3 -3
- package/dist/index151.mjs +1 -1
- package/dist/index153.mjs +2 -21
- package/dist/index154.mjs +2 -56
- package/dist/index155.mjs +2 -29
- package/dist/index156.mjs +2 -7
- package/dist/index157.mjs +16 -50
- package/dist/index158.mjs +32 -6
- package/dist/index159.mjs +37 -11
- package/dist/index160.mjs +18 -7
- package/dist/index161.mjs +18 -28
- package/dist/index162.mjs +2 -2
- package/dist/index163.mjs +20 -70
- package/dist/index164.mjs +42 -163
- package/dist/index166.mjs +30 -2
- package/dist/index167.mjs +18 -2
- package/dist/index168.mjs +2 -2
- package/dist/index169.mjs +2 -18
- package/dist/index170.mjs +2 -32
- package/dist/index171.mjs +2 -38
- package/dist/index172.mjs +67 -13
- package/dist/index173.mjs +2 -18
- package/dist/index174.mjs +53 -2
- package/dist/index175.mjs +2 -20
- package/dist/index176.mjs +29 -39
- package/dist/index177.mjs +152 -2
- package/dist/index178.mjs +2 -30
- package/dist/index179.mjs +2 -18
- package/dist/index180.mjs +19 -2
- package/dist/index181.mjs +2 -2
- package/dist/index182.mjs +2 -2
- package/dist/index183.mjs +26 -2
- package/dist/index184.mjs +2 -72
- package/dist/index185.mjs +2 -2
- package/dist/index186.mjs +20 -49
- package/dist/index187.mjs +23 -2
- package/dist/index188.mjs +2 -36
- package/dist/index189.mjs +2 -152
- package/dist/index190.mjs +2 -2
- package/dist/index191.mjs +23 -2
- package/dist/index192.mjs +2 -19
- package/dist/index193.mjs +23 -2
- package/dist/index195.mjs +2 -26
- package/dist/index196.mjs +2 -2
- package/dist/index197.mjs +23 -2
- package/dist/index198.mjs +2 -24
- package/dist/index199.mjs +15 -15
- package/dist/index200.mjs +2 -2
- package/dist/index201.mjs +2 -2
- package/dist/index202.mjs +2 -2
- package/dist/index203.mjs +2 -23
- package/dist/index204.mjs +2 -2
- package/dist/index205.mjs +2 -23
- package/dist/index206.mjs +2 -2
- package/dist/index207.mjs +2 -2
- package/dist/index208.mjs +127 -2
- package/dist/index209.mjs +2 -23
- package/dist/index210.mjs +74 -2
- package/dist/index211.mjs +71 -20
- package/dist/index212.mjs +21 -2
- package/dist/index213.mjs +56 -2
- package/dist/index214.mjs +29 -2
- package/dist/index215.mjs +7 -2
- package/dist/index216.mjs +52 -2
- package/dist/index217.mjs +6 -2
- package/dist/index218.mjs +12 -2
- package/dist/index219.mjs +7 -2
- package/dist/index22.mjs +66 -60
- package/dist/index220.mjs +28 -127
- package/dist/index221.mjs +2 -2
- package/dist/index222.mjs +69 -73
- package/dist/index223.mjs +164 -71
- package/dist/index229.mjs +2 -2
- package/dist/index230.mjs +2 -108
- package/dist/index232.mjs +244 -2
- package/dist/index233.mjs +2 -2
- package/dist/index234.mjs +33 -2
- package/dist/index235.mjs +56 -28
- package/dist/index236.mjs +25 -2
- package/dist/index237.mjs +2 -244
- package/dist/index239.mjs +32 -28
- package/dist/index240.mjs +2 -65
- package/dist/index241.mjs +2 -25
- package/dist/index242.mjs +2 -2
- package/dist/index243.mjs +2 -2
- package/dist/index244.mjs +2 -2
- package/dist/index245.mjs +2 -2
- package/dist/index246.mjs +2 -2
- package/dist/index247.mjs +108 -2
- package/dist/index248.mjs +2 -2
- package/dist/index250.mjs +2 -2
- package/dist/index253.mjs +2 -31
- package/dist/index254.mjs +4 -11
- package/dist/index255.mjs +13 -4
- package/dist/index256.mjs +7 -4
- package/dist/index257.mjs +31 -2
- package/dist/index258.mjs +11 -4
- package/dist/index259.mjs +4 -13
- package/dist/index260.mjs +4 -7
- package/dist/index261.mjs +1 -1
- package/dist/index263.mjs +1 -1
- package/dist/index264.mjs +6 -6
- package/dist/index265.mjs +3 -3
- package/dist/index267.mjs +2 -2
- package/dist/index271.mjs +2 -2
- package/dist/index272.mjs +2 -2
- package/dist/index273.mjs +2 -2
- package/dist/index274.mjs +91 -2
- package/dist/index275.mjs +2 -91
- package/dist/index277.mjs +1 -1
- package/dist/index282.mjs +1 -1
- package/dist/index283.mjs +2 -2
- package/dist/index63.mjs +17 -17
- package/dist/index64.mjs +2 -2
- package/dist/index95.mjs +33 -231
- package/dist/index96.mjs +42 -5
- package/dist/index97.mjs +228 -127
- package/dist/index98.mjs +4 -66
- package/dist/index99.mjs +124 -77
- package/package.json +1 -1
- package/src/components/AssistantDrawer.tsx +21 -3
package/dist/index22.mjs
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
3
3
|
import { useState as m, useRef as b, useCallback as B, useEffect as v } from "react";
|
|
4
4
|
import { createPortal as Z } from "react-dom";
|
|
5
5
|
import { Sparkles as Q, X as ee, MessageCircle as te, Loader2 as re, Send as se } from "lucide-react";
|
|
6
6
|
import { cn as k, formatCurrency as ne, WHATSAPP_HELP_LINK as ae } from "./index30.mjs";
|
|
7
7
|
import { useHideBodyOverflow as oe } from "./index53.mjs";
|
|
8
|
-
function
|
|
9
|
-
|
|
8
|
+
function le(a) {
|
|
9
|
+
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>").replace(/\*(.+?)\*/g, "<em>$1</em>").replace(/\n/g, "<br />");
|
|
10
|
+
}
|
|
11
|
+
function ce(a) {
|
|
12
|
+
return a.replace(/\s*PRODUCTS:[\w\-,]*\s*/g, "").replace(/\s*CONTACT_SUPPORT\s*/gi, "");
|
|
13
|
+
}
|
|
14
|
+
function ge({
|
|
15
|
+
isOpen: a,
|
|
10
16
|
onClose: x,
|
|
11
17
|
apiUrl: P,
|
|
12
18
|
brandSlug: R,
|
|
@@ -16,28 +22,28 @@ function fe({
|
|
|
16
22
|
className: K,
|
|
17
23
|
disablePortal: O = !1
|
|
18
24
|
}) {
|
|
19
|
-
const [u, d] = m([]), [w, S] = m(""), [f, L] = m(!1), [
|
|
20
|
-
|
|
21
|
-
const U = B((e,
|
|
25
|
+
const [u, d] = m([]), [w, S] = m(""), [f, L] = m(!1), [_, h] = m(null), [$, M] = m(!1), [V, W] = m(!1), D = b(null), H = b(null), A = b(!1), J = b([]);
|
|
26
|
+
J.current = u, oe(a);
|
|
27
|
+
const U = B((e, c) => {
|
|
22
28
|
if (e === "token")
|
|
23
29
|
d((s) => {
|
|
24
30
|
const i = [...s], t = i[i.length - 1];
|
|
25
31
|
if ((t == null ? void 0 : t.role) === "assistant") {
|
|
26
|
-
const
|
|
27
|
-
i[i.length - 1] = { ...t, content:
|
|
32
|
+
const n = t.content + c, o = ce(n);
|
|
33
|
+
i[i.length - 1] = { ...t, content: o };
|
|
28
34
|
}
|
|
29
35
|
return i;
|
|
30
36
|
});
|
|
31
37
|
else if (e === "done")
|
|
32
38
|
try {
|
|
33
|
-
const s = JSON.parse(
|
|
39
|
+
const s = JSON.parse(c);
|
|
34
40
|
d((i) => {
|
|
35
|
-
var
|
|
41
|
+
var o;
|
|
36
42
|
const t = [...i], n = t[t.length - 1];
|
|
37
43
|
return (n == null ? void 0 : n.role) === "assistant" && (t[t.length - 1] = {
|
|
38
44
|
...n,
|
|
39
45
|
content: s.answer || n.content,
|
|
40
|
-
products: ((
|
|
46
|
+
products: ((o = s.products) == null ? void 0 : o.length) > 0 ? s.products : void 0,
|
|
41
47
|
whatsapp: s.whatsapp || !1
|
|
42
48
|
}), t;
|
|
43
49
|
});
|
|
@@ -45,7 +51,7 @@ function fe({
|
|
|
45
51
|
}
|
|
46
52
|
else if (e === "error")
|
|
47
53
|
try {
|
|
48
|
-
const s = JSON.parse(
|
|
54
|
+
const s = JSON.parse(c);
|
|
49
55
|
h(s.message || "An error occurred");
|
|
50
56
|
} catch {
|
|
51
57
|
h("An error occurred");
|
|
@@ -55,11 +61,11 @@ function fe({
|
|
|
55
61
|
var i;
|
|
56
62
|
if (!e.trim()) return;
|
|
57
63
|
h(null);
|
|
58
|
-
const
|
|
64
|
+
const c = { role: "user", content: e }, s = J.current.slice(-20).map((t) => ({
|
|
59
65
|
role: t.role,
|
|
60
66
|
content: t.content
|
|
61
67
|
}));
|
|
62
|
-
d((t) => [...t,
|
|
68
|
+
d((t) => [...t, c]), S(""), L(!0), d((t) => [...t, { role: "assistant", content: "" }]);
|
|
63
69
|
try {
|
|
64
70
|
const t = await fetch(`${P}/v1/assistant/ask`, {
|
|
65
71
|
method: "POST",
|
|
@@ -72,38 +78,38 @@ function fe({
|
|
|
72
78
|
})
|
|
73
79
|
});
|
|
74
80
|
if (!t.ok) {
|
|
75
|
-
const
|
|
81
|
+
const g = await t.json().catch(() => ({}));
|
|
76
82
|
throw new Error(
|
|
77
|
-
((i =
|
|
83
|
+
((i = g == null ? void 0 : g.error) == null ? void 0 : i.message) || `Request failed (${t.status})`
|
|
78
84
|
);
|
|
79
85
|
}
|
|
80
86
|
if (!t.body) throw new Error("No response body");
|
|
81
|
-
const n = t.body.getReader(),
|
|
87
|
+
const n = t.body.getReader(), o = new TextDecoder();
|
|
82
88
|
let E = "", T = "";
|
|
83
89
|
for (; ; ) {
|
|
84
|
-
const { done:
|
|
85
|
-
if (
|
|
86
|
-
E +=
|
|
90
|
+
const { done: g, value: G } = await n.read();
|
|
91
|
+
if (g) break;
|
|
92
|
+
E += o.decode(G, { stream: !0 });
|
|
87
93
|
const z = E.split(`
|
|
88
94
|
`);
|
|
89
95
|
E = z.pop() || "";
|
|
90
|
-
for (const
|
|
91
|
-
if (
|
|
96
|
+
for (const p of z) {
|
|
97
|
+
if (p.trim() === "") {
|
|
92
98
|
T = "";
|
|
93
99
|
continue;
|
|
94
100
|
}
|
|
95
|
-
if (
|
|
96
|
-
T =
|
|
97
|
-
else if (
|
|
98
|
-
const C =
|
|
101
|
+
if (p.trimStart().startsWith("event:"))
|
|
102
|
+
T = p.trimStart().slice(6).trim();
|
|
103
|
+
else if (p.trimStart().startsWith("data:")) {
|
|
104
|
+
const C = p.trimStart().slice(5), Y = C.startsWith(" ") ? C.slice(1) : C;
|
|
99
105
|
U(T || "token", Y);
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
108
|
}
|
|
103
109
|
} catch (t) {
|
|
104
110
|
h(t.message || "Something went wrong"), d((n) => {
|
|
105
|
-
const
|
|
106
|
-
return (
|
|
111
|
+
const o = n[n.length - 1];
|
|
112
|
+
return (o == null ? void 0 : o.role) === "assistant" && !o.content ? n.slice(0, -1) : n;
|
|
107
113
|
});
|
|
108
114
|
} finally {
|
|
109
115
|
L(!1);
|
|
@@ -112,42 +118,42 @@ function fe({
|
|
|
112
118
|
[P, R, j, U]
|
|
113
119
|
);
|
|
114
120
|
N.current = q, v(() => {
|
|
115
|
-
if (
|
|
116
|
-
|
|
121
|
+
if (a)
|
|
122
|
+
W(!0), requestAnimationFrame(() => {
|
|
117
123
|
requestAnimationFrame(() => {
|
|
118
|
-
|
|
124
|
+
M(!0);
|
|
119
125
|
});
|
|
120
126
|
});
|
|
121
127
|
else {
|
|
122
|
-
|
|
128
|
+
M(!1);
|
|
123
129
|
const e = setTimeout(() => {
|
|
124
|
-
|
|
130
|
+
W(!1), d([]), S(""), h(null), A.current = !1;
|
|
125
131
|
}, 300);
|
|
126
132
|
return () => clearTimeout(e);
|
|
127
133
|
}
|
|
128
|
-
}, [
|
|
129
|
-
|
|
134
|
+
}, [a]), v(() => {
|
|
135
|
+
a && y && !A.current && (A.current = !0, y.trim() ? setTimeout(() => {
|
|
130
136
|
var e;
|
|
131
137
|
return (e = N.current) == null ? void 0 : e.call(N, y);
|
|
132
138
|
}, 100) : setTimeout(() => {
|
|
133
139
|
var e;
|
|
134
|
-
return (e =
|
|
140
|
+
return (e = H.current) == null ? void 0 : e.focus();
|
|
135
141
|
}, 350));
|
|
136
|
-
}, [
|
|
142
|
+
}, [a, y]), v(() => {
|
|
137
143
|
var e;
|
|
138
|
-
(e =
|
|
144
|
+
(e = D.current) == null || e.scrollIntoView({ behavior: "smooth" });
|
|
139
145
|
}, [u]), v(() => {
|
|
140
|
-
const e = (
|
|
141
|
-
|
|
146
|
+
const e = (c) => {
|
|
147
|
+
c.key === "Escape" && a && x();
|
|
142
148
|
};
|
|
143
|
-
if (
|
|
149
|
+
if (a)
|
|
144
150
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
145
|
-
}, [
|
|
151
|
+
}, [a, x]);
|
|
146
152
|
const X = (e) => {
|
|
147
153
|
e.preventDefault(), w.trim() && q(w.trim());
|
|
148
154
|
};
|
|
149
155
|
if (!V) return null;
|
|
150
|
-
const F = /* @__PURE__ */
|
|
156
|
+
const F = /* @__PURE__ */ l(
|
|
151
157
|
"div",
|
|
152
158
|
{
|
|
153
159
|
className: k(
|
|
@@ -162,7 +168,7 @@ function fe({
|
|
|
162
168
|
onClick: x
|
|
163
169
|
}
|
|
164
170
|
),
|
|
165
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ l(
|
|
166
172
|
"div",
|
|
167
173
|
{
|
|
168
174
|
className: k(
|
|
@@ -176,8 +182,8 @@ function fe({
|
|
|
176
182
|
K
|
|
177
183
|
),
|
|
178
184
|
children: [
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ l("div", { className: "flex items-center justify-between border-b border-gray-200 px-4 py-3 flex-shrink-0", children: [
|
|
186
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
181
187
|
/* @__PURE__ */ r(Q, { className: "h-5 w-5 text-orange-500" }),
|
|
182
188
|
/* @__PURE__ */ r("span", { className: "font-semibold text-gray-900", children: I }),
|
|
183
189
|
/* @__PURE__ */ r("span", { className: "text-xs text-gray-400 bg-gray-100 rounded px-1.5 py-0.5", children: "beta" })
|
|
@@ -193,14 +199,14 @@ function fe({
|
|
|
193
199
|
}
|
|
194
200
|
)
|
|
195
201
|
] }),
|
|
196
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ l("div", { className: "flex-1 overflow-y-auto p-4 space-y-4 min-h-0", children: [
|
|
197
203
|
u.length === 0 && !f && /* @__PURE__ */ r("div", { className: "text-center text-gray-400 text-sm py-8", children: "Ask me anything about our products!" }),
|
|
198
|
-
u.map((e,
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
e.content,
|
|
201
|
-
f &&
|
|
204
|
+
u.map((e, c) => /* @__PURE__ */ r("div", { children: e.role === "user" ? /* @__PURE__ */ r("div", { className: "flex justify-end", children: /* @__PURE__ */ r("div", { className: "bg-gray-800 text-white rounded-2xl rounded-br-sm px-4 py-2 max-w-[80%] text-sm", children: e.content }) }) : /* @__PURE__ */ l("div", { className: "space-y-3", children: [
|
|
205
|
+
/* @__PURE__ */ l("div", { className: "text-sm text-gray-800 leading-relaxed", children: [
|
|
206
|
+
/* @__PURE__ */ r("span", { dangerouslySetInnerHTML: { __html: le(e.content) } }),
|
|
207
|
+
f && c === u.length - 1 && /* @__PURE__ */ r("span", { className: "inline-block w-1.5 h-4 bg-gray-400 animate-pulse ml-0.5 align-text-bottom" })
|
|
202
208
|
] }),
|
|
203
|
-
e.products && e.products.length > 0 && /* @__PURE__ */ r("div", { className: "space-y-2", children: e.products.map((s) => /* @__PURE__ */
|
|
209
|
+
e.products && e.products.length > 0 && /* @__PURE__ */ r("div", { className: "space-y-2", children: e.products.map((s) => /* @__PURE__ */ l(
|
|
204
210
|
"a",
|
|
205
211
|
{
|
|
206
212
|
href: `/product/${s.slug}`,
|
|
@@ -214,7 +220,7 @@ function fe({
|
|
|
214
220
|
className: "h-16 w-16 rounded-lg object-cover flex-shrink-0"
|
|
215
221
|
}
|
|
216
222
|
) : /* @__PURE__ */ r("div", { className: "h-16 w-16 rounded-lg bg-gray-100 flex-shrink-0" }),
|
|
217
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ l("div", { className: "min-w-0", children: [
|
|
218
224
|
/* @__PURE__ */ r("p", { className: "text-sm font-medium text-gray-900 line-clamp-2", children: s.name }),
|
|
219
225
|
/* @__PURE__ */ r("p", { className: "text-sm font-semibold text-blue-600", children: ne(s.price) })
|
|
220
226
|
] })
|
|
@@ -222,7 +228,7 @@ function fe({
|
|
|
222
228
|
},
|
|
223
229
|
s.slug
|
|
224
230
|
)) }),
|
|
225
|
-
e.whatsapp && /* @__PURE__ */
|
|
231
|
+
e.whatsapp && /* @__PURE__ */ l(
|
|
226
232
|
"a",
|
|
227
233
|
{
|
|
228
234
|
href: ae,
|
|
@@ -235,15 +241,15 @@ function fe({
|
|
|
235
241
|
]
|
|
236
242
|
}
|
|
237
243
|
)
|
|
238
|
-
] }) },
|
|
239
|
-
|
|
240
|
-
/* @__PURE__ */ r("div", { ref:
|
|
244
|
+
] }) }, c)),
|
|
245
|
+
_ && /* @__PURE__ */ r("div", { className: "rounded-lg bg-red-50 border border-red-200 p-3 text-sm text-red-700", children: _ }),
|
|
246
|
+
/* @__PURE__ */ r("div", { ref: D })
|
|
241
247
|
] }),
|
|
242
|
-
/* @__PURE__ */ r("div", { className: "border-t border-gray-200 p-3 flex-shrink-0", children: /* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ r("div", { className: "border-t border-gray-200 p-3 flex-shrink-0", children: /* @__PURE__ */ l("form", { onSubmit: X, className: "flex items-center gap-2", children: [
|
|
243
249
|
/* @__PURE__ */ r(
|
|
244
250
|
"input",
|
|
245
251
|
{
|
|
246
|
-
ref:
|
|
252
|
+
ref: H,
|
|
247
253
|
type: "text",
|
|
248
254
|
value: w,
|
|
249
255
|
onChange: (e) => S(e.target.value),
|
|
@@ -280,5 +286,5 @@ function fe({
|
|
|
280
286
|
return O ? F : Z(F, document.body);
|
|
281
287
|
}
|
|
282
288
|
export {
|
|
283
|
-
|
|
289
|
+
ge as AssistantDrawer
|
|
284
290
|
};
|
package/dist/index220.mjs
CHANGED
|
@@ -1,130 +1,31 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
function h() {
|
|
30
|
-
e.emit(p);
|
|
31
|
-
var y = a[p];
|
|
32
|
-
if (y)
|
|
33
|
-
return y.apply(a, arguments);
|
|
34
|
-
a.emit(p);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function E(p) {
|
|
38
|
-
a.on(p, h);
|
|
39
|
-
function h() {
|
|
40
|
-
var y = c.call(arguments);
|
|
41
|
-
y.unshift(p), e.emit.apply(e, y);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function F() {
|
|
45
|
-
if (!d) {
|
|
46
|
-
d = !0;
|
|
47
|
-
var p = c.call(arguments);
|
|
48
|
-
p.unshift("end"), e.emit.apply(e, p);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function w(p) {
|
|
52
|
-
e.emit("error", p);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}, 349: (t, m, n) => {
|
|
56
|
-
const i = n(147), u = n(781), f = n(796), l = n(154), c = n(530), r = (s) => Object.assign({ level: 9 }, s);
|
|
57
|
-
t.exports = (s, o) => s ? c(f.gzip)(s, r(o)).then((a) => a.length).catch((a) => 0) : Promise.resolve(0), t.exports.sync = (s, o) => f.gzipSync(s, r(o)).length, t.exports.stream = (s) => {
|
|
58
|
-
const o = new u.PassThrough(), a = new u.PassThrough(), e = l(o, a);
|
|
59
|
-
let d = 0;
|
|
60
|
-
const x = f.createGzip(r(s)).on("data", (z) => {
|
|
61
|
-
d += z.length;
|
|
62
|
-
}).on("error", () => {
|
|
63
|
-
e.gzipSize = 0;
|
|
64
|
-
}).on("end", () => {
|
|
65
|
-
e.gzipSize = d, e.emit("gzip-size", d), a.end();
|
|
66
|
-
});
|
|
67
|
-
return o.pipe(x), o.pipe(a, { end: !1 }), e;
|
|
68
|
-
}, t.exports.file = (s, o) => new Promise((a, e) => {
|
|
69
|
-
const d = i.createReadStream(s);
|
|
70
|
-
d.on("error", e);
|
|
71
|
-
const x = d.pipe(t.exports.stream(o));
|
|
72
|
-
x.on("error", e), x.on("gzip-size", a);
|
|
73
|
-
}), t.exports.fileSync = (s, o) => t.exports.sync(i.readFileSync(s), o);
|
|
74
|
-
}, 530: (t) => {
|
|
75
|
-
const m = (n, i) => function(...u) {
|
|
76
|
-
const f = i.promiseModule;
|
|
77
|
-
return new f((l, c) => {
|
|
78
|
-
i.multiArgs ? u.push((...r) => {
|
|
79
|
-
i.errorFirst ? r[0] ? c(r) : (r.shift(), l(r)) : l(r);
|
|
80
|
-
}) : i.errorFirst ? u.push((r, s) => {
|
|
81
|
-
r ? c(r) : l(s);
|
|
82
|
-
}) : u.push(l), n.apply(this, u);
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
t.exports = (n, i) => {
|
|
86
|
-
i = Object.assign({ exclude: [/.+(Sync|Stream)$/], errorFirst: !0, promiseModule: Promise }, i);
|
|
87
|
-
const u = typeof n;
|
|
88
|
-
if (!(n !== null && (u === "object" || u === "function")))
|
|
89
|
-
throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${n === null ? "null" : u}\``);
|
|
90
|
-
const f = (c) => {
|
|
91
|
-
const r = (s) => typeof s == "string" ? c === s : s.test(c);
|
|
92
|
-
return i.include ? i.include.some(r) : !i.exclude.some(r);
|
|
93
|
-
};
|
|
94
|
-
let l;
|
|
95
|
-
u === "function" ? l = function(...c) {
|
|
96
|
-
return i.excludeMain ? n(...c) : m(n, i).apply(this, c);
|
|
97
|
-
} : l = Object.create(Object.getPrototypeOf(n));
|
|
98
|
-
for (const c in n) {
|
|
99
|
-
const r = n[c];
|
|
100
|
-
l[c] = typeof r == "function" && f(c) ? m(r, i) : r;
|
|
101
|
-
}
|
|
102
|
-
return l;
|
|
103
|
-
};
|
|
104
|
-
}, 147: (t) => {
|
|
105
|
-
t.exports = S;
|
|
106
|
-
}, 781: (t) => {
|
|
107
|
-
t.exports = S;
|
|
108
|
-
}, 796: (t) => {
|
|
109
|
-
t.exports = S;
|
|
110
|
-
} }, v = {};
|
|
111
|
-
function g(t) {
|
|
112
|
-
var m = v[t];
|
|
113
|
-
if (m !== void 0)
|
|
114
|
-
return m.exports;
|
|
115
|
-
var n = v[t] = { exports: {} }, i = !0;
|
|
116
|
-
try {
|
|
117
|
-
O[t](n, n.exports, g), i = !1;
|
|
118
|
-
} finally {
|
|
119
|
-
i && delete v[t];
|
|
120
|
-
}
|
|
121
|
-
return n.exports;
|
|
122
|
-
}
|
|
123
|
-
typeof g < "u" && (g.ab = __dirname + "/");
|
|
124
|
-
var j = g(349);
|
|
125
|
-
b.exports = j;
|
|
126
|
-
})(), b.exports);
|
|
127
|
-
}
|
|
2
|
+
import n from "./index97.mjs";
|
|
3
|
+
const a = n.toObjectSet([
|
|
4
|
+
"age",
|
|
5
|
+
"authorization",
|
|
6
|
+
"content-length",
|
|
7
|
+
"content-type",
|
|
8
|
+
"etag",
|
|
9
|
+
"expires",
|
|
10
|
+
"from",
|
|
11
|
+
"host",
|
|
12
|
+
"if-modified-since",
|
|
13
|
+
"if-unmodified-since",
|
|
14
|
+
"last-modified",
|
|
15
|
+
"location",
|
|
16
|
+
"max-forwards",
|
|
17
|
+
"proxy-authorization",
|
|
18
|
+
"referer",
|
|
19
|
+
"retry-after",
|
|
20
|
+
"user-agent"
|
|
21
|
+
]), u = (s) => {
|
|
22
|
+
const t = {};
|
|
23
|
+
let e, r, i;
|
|
24
|
+
return s && s.split(`
|
|
25
|
+
`).forEach(function(o) {
|
|
26
|
+
i = o.indexOf(":"), e = o.substring(0, i).trim().toLowerCase(), r = o.substring(i + 1).trim(), !(!e || t[e] && a[e]) && (e === "set-cookie" ? t[e] ? t[e].push(r) : t[e] = [r] : t[e] = t[e] ? t[e] + ", " + r : r);
|
|
27
|
+
}), t;
|
|
28
|
+
};
|
|
128
29
|
export {
|
|
129
|
-
|
|
30
|
+
u as default
|
|
130
31
|
};
|
package/dist/index221.mjs
CHANGED
package/dist/index222.mjs
CHANGED
|
@@ -1,77 +1,73 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
switch (m) {
|
|
21
|
-
case l:
|
|
22
|
-
switch (r = r.type, r) {
|
|
23
|
-
case n:
|
|
24
|
-
case f:
|
|
25
|
-
case o:
|
|
26
|
-
case a:
|
|
27
|
-
case E:
|
|
28
|
-
return r;
|
|
29
|
-
default:
|
|
30
|
-
switch (r = r && r.$$typeof, r) {
|
|
31
|
-
case i:
|
|
32
|
-
case u:
|
|
33
|
-
case _:
|
|
34
|
-
case c:
|
|
35
|
-
return r;
|
|
36
|
-
case s:
|
|
37
|
-
return r;
|
|
38
|
-
default:
|
|
39
|
-
return m;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
case T:
|
|
43
|
-
return m;
|
|
44
|
-
}
|
|
2
|
+
import H from "./index97.mjs";
|
|
3
|
+
import D from "./index261.mjs";
|
|
4
|
+
import L from "./index217.mjs";
|
|
5
|
+
import n from "./index108.mjs";
|
|
6
|
+
import y from "./index103.mjs";
|
|
7
|
+
import O from "./index262.mjs";
|
|
8
|
+
import U from "./index219.mjs";
|
|
9
|
+
import q from "./index111.mjs";
|
|
10
|
+
import { progressEventReducer as A } from "./index263.mjs";
|
|
11
|
+
import v from "./index264.mjs";
|
|
12
|
+
const N = typeof XMLHttpRequest < "u", Q = N && function(s) {
|
|
13
|
+
return new Promise(function(C, i) {
|
|
14
|
+
const t = v(s);
|
|
15
|
+
let E = t.data;
|
|
16
|
+
const T = q.from(t.headers).normalize();
|
|
17
|
+
let { responseType: d, onUploadProgress: R, onDownloadProgress: h } = t, l, g, w, u, f;
|
|
18
|
+
function x() {
|
|
19
|
+
u && u(), f && f(), t.cancelToken && t.cancelToken.unsubscribe(l), t.signal && t.signal.removeEventListener("abort", l);
|
|
45
20
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
21
|
+
let e = new XMLHttpRequest();
|
|
22
|
+
e.open(t.method.toUpperCase(), t.url, !0), e.timeout = t.timeout;
|
|
23
|
+
function b() {
|
|
24
|
+
if (!e)
|
|
25
|
+
return;
|
|
26
|
+
const o = q.from(
|
|
27
|
+
"getAllResponseHeaders" in e && e.getAllResponseHeaders()
|
|
28
|
+
), a = {
|
|
29
|
+
data: !d || d === "text" || d === "json" ? e.responseText : e.response,
|
|
30
|
+
status: e.status,
|
|
31
|
+
statusText: e.statusText,
|
|
32
|
+
headers: o,
|
|
33
|
+
config: s,
|
|
34
|
+
request: e
|
|
35
|
+
};
|
|
36
|
+
D(function(c) {
|
|
37
|
+
C(c), x();
|
|
38
|
+
}, function(c) {
|
|
39
|
+
i(c), x();
|
|
40
|
+
}, a), e = null;
|
|
41
|
+
}
|
|
42
|
+
"onloadend" in e ? e.onloadend = b : e.onreadystatechange = function() {
|
|
43
|
+
!e || e.readyState !== 4 || e.status === 0 && !(e.responseURL && e.responseURL.indexOf("file:") === 0) || setTimeout(b);
|
|
44
|
+
}, e.onabort = function() {
|
|
45
|
+
e && (i(new n("Request aborted", n.ECONNABORTED, s, e)), e = null);
|
|
46
|
+
}, e.onerror = function(r) {
|
|
47
|
+
const a = r && r.message ? r.message : "Network Error", p = new n(a, n.ERR_NETWORK, s, e);
|
|
48
|
+
p.event = r || null, i(p), e = null;
|
|
49
|
+
}, e.ontimeout = function() {
|
|
50
|
+
let r = t.timeout ? "timeout of " + t.timeout + "ms exceeded" : "timeout exceeded";
|
|
51
|
+
const a = t.transitional || L;
|
|
52
|
+
t.timeoutErrorMessage && (r = t.timeoutErrorMessage), i(new n(
|
|
53
|
+
r,
|
|
54
|
+
a.clarifyTimeoutError ? n.ETIMEDOUT : n.ECONNABORTED,
|
|
55
|
+
s,
|
|
56
|
+
e
|
|
57
|
+
)), e = null;
|
|
58
|
+
}, E === void 0 && T.setContentType(null), "setRequestHeader" in e && H.forEach(T.toJSON(), function(r, a) {
|
|
59
|
+
e.setRequestHeader(a, r);
|
|
60
|
+
}), H.isUndefined(t.withCredentials) || (e.withCredentials = !!t.withCredentials), d && d !== "json" && (e.responseType = t.responseType), h && ([w, f] = A(h, !0), e.addEventListener("progress", w)), R && e.upload && ([g, u] = A(R), e.upload.addEventListener("progress", g), e.upload.addEventListener("loadend", u)), (t.cancelToken || t.signal) && (l = (o) => {
|
|
61
|
+
e && (i(!o || o.type ? new y(null, s, e) : o), e.abort(), e = null);
|
|
62
|
+
}, t.cancelToken && t.cancelToken.subscribe(l), t.signal && (t.signal.aborted ? l() : t.signal.addEventListener("abort", l)));
|
|
63
|
+
const m = O(t.url);
|
|
64
|
+
if (m && U.protocols.indexOf(m) === -1) {
|
|
65
|
+
i(new n("Unsupported protocol " + m + ":", n.ERR_BAD_REQUEST, s));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
e.send(E || null);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
75
71
|
export {
|
|
76
|
-
|
|
72
|
+
Q as default
|
|
77
73
|
};
|