chat-customer-47net 0.0.1-alpha.1
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/chat-customer-47net.css +1 -0
- package/chat-customer-47net.js +434 -0
- package/chat-customer-47net.umd.cjs +1 -0
- package/index-BCmYEvSn.js +2338 -0
- package/package.json +12 -0
- package/vite.svg +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@charset "UTF-8";.chat-drawer[data-v-281c6db5]{background-color:#00000080;bottom:0;height:100%;left:0;overflow:auto;position:fixed;right:0;top:0;z-index:2004}.chat-drawer_wrapper[data-v-281c6db5]{background-color:#fff;box-shadow:0 16px 48px 16px #00000014,0 12px 32px #0000001f,0 8px 16px -8px #00000029;box-sizing:border-box;display:flex;flex-direction:column;overflow:hidden;position:absolute;transition:all .3;max-width:660px;width:100%;height:100%;bottom:0;right:0;top:0}.chat-drawer_title[data-v-281c6db5]{margin-bottom:0;padding:15px 20px;color:#fff;background:#007b78;align-items:center;display:flex}.chat-drawer_title img[data-v-281c6db5]{width:26px;margin-right:10px}.chat-drawer_title span[data-v-281c6db5]{flex:1;font-size:18px;font-weight:700;line-height:1.4;margin:0;text-align:left}.chat-drawer_title i[data-v-281c6db5]{cursor:pointer;height:24px;width:24px}.chat-drawer_title i[data-v-281c6db5]:after{content:"";display:block;height:24px;width:24px;background-image:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201024%201024'%3e%3cpath%20fill='currentColor'%20d='M764.288%20214.592%20512%20466.88%20259.712%20214.592a31.936%2031.936%200%200%200-45.12%2045.12L466.752%20512%20214.528%20764.224a31.936%2031.936%200%201%200%2045.12%2045.184L512%20557.184l252.288%20252.288a31.936%2031.936%200%200%200%2045.12-45.12L557.12%20512.064l252.288-252.352a31.936%2031.936%200%201%200-45.12-45.184z'%3e%3c/path%3e%3c/svg%3e");background-size:cover;filter:invert(100%)}.chat-drawer_content[data-v-281c6db5]{background-color:#fff;box-sizing:border-box;flex:1 1 auto;overflow:auto;padding:24px 44px 24px 34px;position:relative;width:100%;overflow-x:hidden}.chat-drawer_fade[data-v-281c6db5]{opacity:0;transition:all .3s;visibility:hidden}.chat-drawer_fade .chat-drawer_wrapper[data-v-281c6db5]{transform:translate(100%);transition:all .3s}.chat-drawer_show[data-v-281c6db5]{opacity:1;transition:all .3s;visibility:visible}.chat-drawer_show .chat-drawer_wrapper[data-v-281c6db5]{transform:translate(0);transition:all .3s}.chat-drawer_footer[data-v-281c6db5]{background-color:#fff;box-sizing:border-box;flex:0 0 auto;padding:16px 34px;position:relative;height:70px;display:flex;align-items:center;justify-content:center}.chat-item[data-v-15793bae]{width:100%;margin-bottom:46px}.chat-item>div[data-v-15793bae]{width:100%;display:flex;align-items:center;gap:10px;margin-bottom:10px}.chat-item>div h3[data-v-15793bae],.chat-item>div p[data-v-15793bae]{margin:0}.chat-item>div h3[data-v-15793bae]{color:#0d082c;font-size:16px;line-height:20px;margin-bottom:5px}.chat-item>div p[data-v-15793bae]{font-size:14px;line-height:1.5;max-width:60%;padding:15px;text-align:left;position:relative;box-sizing:initial}.chat-item>div span[data-v-15793bae]{position:absolute;bottom:-23px;font-size:14px;line-height:18px;color:#0d082c66;white-space:nowrap}.chat-item .user[data-v-15793bae]{text-align:right;display:flex;flex-direction:column;align-items:flex-end;margin-left:auto}.chat-item .user p[data-v-15793bae]{background-color:#007b780f;color:#007b78;border-radius:10px 0 10px 10px}.chat-item .user p span[data-v-15793bae]{left:0}.chat-item .other[data-v-15793bae]{text-align:left;display:flex;flex-direction:row;align-items:flex-start;margin-right:auto}.chat-item .other .avatar[data-v-15793bae]{display:flex;align-items:center;justify-content:center;border-radius:50%;width:35px;height:35px;font-size:0;flex:none}.chat-item .other .ai-avatar[data-v-15793bae]{background-color:#007b78}.chat-item .other .avatar:not(.ai-avatar) img[data-v-15793bae]{border-radius:50%;width:100%;height:100%}.chat-item .other .avatar.flicker[data-v-15793bae]{animation:blink-15793bae 1.2s infinite}@keyframes blink-15793bae{0%{transform:scale(1)}50%{transform:scale(1.14)}to{transform:scale(1)}}.chat-item .other img[data-v-15793bae]{width:20px;object-fit:cover;object-position:center}.chat-item .other .content[data-v-15793bae]{width:100%}.chat-item .other p[data-v-15793bae]{background-color:#f7f9fb;color:#0d082c;border-radius:0 10px 10px;width:fit-content}.chat-item .other p i[data-v-15793bae],.chat-item .other p span[data-v-15793bae]{right:0}.chat-button[data-v-38a08185]{display:flex;justify-content:center;align-items:center;height:44px;padding:10px;background-color:#15c489;border-radius:4px;color:#fff;cursor:pointer;box-sizing:border-box}.chat-send[data-v-bd61df65]{width:100%;display:flex;align-items:center;gap:10px}.chat-send input[data-v-bd61df65]{width:100%;height:44px;border-radius:6px;border:1px solid #E2E8F0;padding:0 10px}.chat-send input[data-v-bd61df65]:focus{outline:none}.chat-send .chat-button img[data-v-bd61df65]{width:20px;margin-left:4px}.chat-hint[data-v-d1eca076]{width:100%;display:flex;justify-content:space-between;flex-direction:row;flex-wrap:wrap;padding:34px 0 34px 5px;cursor:pointer}.chat-hint .chat-hint__content[data-v-d1eca076]{width:calc(50% - 5px);min-height:80px;font-size:14px;box-sizing:border-box;background-color:#007b780f;border-radius:6px;color:#404040;margin-bottom:10px;padding:4px 15px;display:flex;align-items:center;text-align:left}.chat-window[data-v-2cb45a3a]{width:100%}.chat-window .loading[data-v-2cb45a3a],.chat-window .no-more[data-v-2cb45a3a]{text-align:center;padding:10px;color:#999;font-size:14px}.chat-window .loading[data-v-2cb45a3a]{color:#666}.scroll-enter-active[data-v-2cb45a3a],.scroll-leave-active[data-v-2cb45a3a]{transition:all .3s ease}.scroll-enter-from[data-v-2cb45a3a],.scroll-leave-to[data-v-2cb45a3a]{opacity:0;transform:translateY(20px)}.chat-window.instagem[data-v-2cb45a3a] .chat-drawer_title,.chat-window.instagem[data-v-2cb45a3a] .chat-item .other .avatar{background-color:#0202ff}.chat-window.instagem[data-v-2cb45a3a] .chat-item .user p{background-color:#0202ff0d;color:#0202ff}.chat-window.instagem[data-v-2cb45a3a] .chat-hint .chat-hint__content{background-color:#f6f7fa;background-color:#0202ff0d}.chat-window.instagem[data-v-2cb45a3a] .chat-button{background-color:#0202ff}.chat-window.instagem[data-v-2cb45a3a] .chat-button:hover{background-color:#3381ff}
|
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import { defineComponent as C, ref as p, openBlock as u, createElementBlock as m, normalizeClass as N, createElementVNode as r, withModifiers as Q, unref as j, toDisplayString as y, renderSlot as B, nextTick as X, createTextVNode as E, withKeys as Y, createVNode as T, withCtx as x, Fragment as R, renderList as q, createCommentVNode as S, TransitionGroup as ee, createBlock as Z } from "vue";
|
|
2
|
+
const z = "data:image/svg+xml,%3csvg%20id='组件_17_1'%20data-name='组件%2017%20–%201'%20xmlns='http://www.w3.org/2000/svg'%20width='82.344'%20height='88.431'%20viewBox='0%200%2082.344%2088.431'%3e%3cpath%20id='减去_2'%20data-name='减去%202'%20d='M37.288,88.43V74.948h-.005c-.446-.062-11.02-1.567-18.959-5.412-3.843-1.862-7.794-5.4-11.125-9.95A38.155,38.155,0,0,1,.778,46.225,38.6,38.6,0,0,1,.712,31.1,38.616,38.616,0,0,1,7.49,15.108,36.865,36.865,0,0,1,20.4,4.017,39.775,39.775,0,0,1,38.525,0c.358,0,.724,0,1.086.011A33.368,33.368,0,0,1,49.736,1.817a36.75,36.75,0,0,1,8.392,4.162,36.354,36.354,0,0,1,10.63,10.588c2.084,3.339,3.618,8.311,4.538,11.9,1,3.9,1.507,7.017,1.512,7.048l.007.009c.623.832,6.11,8.176,7.076,9.781a2.581,2.581,0,0,1,0,2.938,3.864,3.864,0,0,1-1.01.929c-.759.529-3.687,3.076-3.716,3.1,1.478,2.575,1.6,3.371,1.312,4.181-.377,1.062-2.654,1.465-2.706,1.474,0,0,0,0,.006.007a7.056,7.056,0,0,1,1.387,3.082,4.1,4.1,0,0,1-1.394,3.1c-.618.548-.31,2.408,0,2.938.048.081.125.19.223.326a4.991,4.991,0,0,1,1.171,4.086c-.539,2.1-3.684,3.47-3.716,3.484-.063,0-7.066-.067-11.991-.067-2.9,0-4.551.023-4.894.067a17.456,17.456,0,0,0-3.93,1.721c-1.1.558-2.464,1.252-4.037,2-4.17,1.971-11.238,9.686-11.309,9.764Zm.371-70.793c-11.351,0-20.587,8.032-20.587,17.9,0,5.608,2.936,10.786,8.056,14.206v6.267c0,.631.258,1.007.69,1.007a1.282,1.282,0,0,0,.741-.3l5.284-4a23.487,23.487,0,0,0,5.816.724c11.351,0,20.587-8.032,20.587-17.9S49.01,17.637,37.659,17.637ZM50.189,38.227a2.686,2.686,0,1,1,2.686-2.686A2.688,2.688,0,0,1,50.189,38.227Zm-12.531,0a2.686,2.686,0,1,1,2.686-2.686A2.689,2.689,0,0,1,37.659,38.227Zm-12.531,0a2.686,2.686,0,1,1,2.685-2.686A2.689,2.689,0,0,1,25.128,38.227Z'%20transform='translate(0.001%200)'%20fill='%23fff'/%3e%3c/svg%3e", D = (t) => {
|
|
3
|
+
const l = t ? new Date(t) : /* @__PURE__ */ new Date(), n = l.getHours(), o = l.getMinutes(), c = n < 12 ? "AM" : "PM", d = n % 12 || 12, _ = o.toString().padStart(2, "0");
|
|
4
|
+
return `${d}:${_} ${c}`;
|
|
5
|
+
}, te = (t, l) => {
|
|
6
|
+
const { thread_id: n, userName: o, avatar: c } = l;
|
|
7
|
+
return {
|
|
8
|
+
joinRoom: (g, h) => {
|
|
9
|
+
t.emit("join", {
|
|
10
|
+
userId: n,
|
|
11
|
+
userName: o,
|
|
12
|
+
avatar: c,
|
|
13
|
+
room: g
|
|
14
|
+
}, h);
|
|
15
|
+
},
|
|
16
|
+
leaveRoom: (g) => {
|
|
17
|
+
t.emit("disconnect", g);
|
|
18
|
+
},
|
|
19
|
+
onMessage: (g) => {
|
|
20
|
+
t.on("message", g);
|
|
21
|
+
},
|
|
22
|
+
sendMessage: (g, h) => {
|
|
23
|
+
t.emit("sendMessage", g, h);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}, ae = { class: "chat-drawer_title" }, ne = ["src"], oe = { class: "chat-drawer_footer" }, se = {
|
|
27
|
+
name: "chat-drawer"
|
|
28
|
+
}, le = /* @__PURE__ */ C({
|
|
29
|
+
...se,
|
|
30
|
+
props: {
|
|
31
|
+
title: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "AI Chat"
|
|
34
|
+
},
|
|
35
|
+
footerTitle: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "Send"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
emits: ["close", "scroll"],
|
|
41
|
+
setup(t, { expose: l, emit: n }) {
|
|
42
|
+
const o = n, c = (h) => {
|
|
43
|
+
o("scroll", h);
|
|
44
|
+
}, d = p(!1), _ = () => {
|
|
45
|
+
d.value = !0;
|
|
46
|
+
}, a = () => {
|
|
47
|
+
d.value = !1;
|
|
48
|
+
}, v = p(null);
|
|
49
|
+
return l({
|
|
50
|
+
visible: d,
|
|
51
|
+
openDrawer: _,
|
|
52
|
+
closeDrawer: a,
|
|
53
|
+
scrollToBottom: async () => {
|
|
54
|
+
if (v.value) {
|
|
55
|
+
await X();
|
|
56
|
+
const h = v.value;
|
|
57
|
+
h.scrollHeight > h.clientHeight && (h.scrollTop = h.scrollHeight);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}), (h, $) => (u(), m("div", {
|
|
61
|
+
class: N(["chat-drawer", {
|
|
62
|
+
"chat-drawer_fade": !d.value,
|
|
63
|
+
"chat-drawer_show": d.value
|
|
64
|
+
}]),
|
|
65
|
+
onClick: a
|
|
66
|
+
}, [
|
|
67
|
+
r("div", {
|
|
68
|
+
class: "chat-drawer_wrapper",
|
|
69
|
+
onClick: $[0] || ($[0] = Q(() => {
|
|
70
|
+
}, ["stop"]))
|
|
71
|
+
}, [
|
|
72
|
+
r("div", ae, [
|
|
73
|
+
r("img", {
|
|
74
|
+
src: j(z),
|
|
75
|
+
alt: "avatar"
|
|
76
|
+
}, null, 8, ne),
|
|
77
|
+
r("span", null, y(t.title), 1),
|
|
78
|
+
r("i", { onClick: a })
|
|
79
|
+
]),
|
|
80
|
+
r("div", {
|
|
81
|
+
class: "chat-drawer_content",
|
|
82
|
+
ref_key: "chatContent",
|
|
83
|
+
ref: v,
|
|
84
|
+
onScroll: c
|
|
85
|
+
}, [
|
|
86
|
+
B(h.$slots, "content", {}, void 0, !0)
|
|
87
|
+
], 544),
|
|
88
|
+
r("div", oe, [
|
|
89
|
+
B(h.$slots, "footer", {}, void 0, !0)
|
|
90
|
+
])
|
|
91
|
+
])
|
|
92
|
+
], 2));
|
|
93
|
+
}
|
|
94
|
+
}), M = (t, l) => {
|
|
95
|
+
const n = t.__vccOpts || t;
|
|
96
|
+
for (const [o, c] of l)
|
|
97
|
+
n[o] = c;
|
|
98
|
+
return n;
|
|
99
|
+
}, ce = /* @__PURE__ */ M(le, [["__scopeId", "data-v-281c6db5"]]), re = { class: "chat-item" }, ie = {
|
|
100
|
+
key: 0,
|
|
101
|
+
class: "user"
|
|
102
|
+
}, ue = {
|
|
103
|
+
key: 1,
|
|
104
|
+
class: "other"
|
|
105
|
+
}, de = ["src"], he = { class: "content" }, ve = {
|
|
106
|
+
name: "chat-item"
|
|
107
|
+
}, me = /* @__PURE__ */ C({
|
|
108
|
+
...ve,
|
|
109
|
+
props: {
|
|
110
|
+
type: {
|
|
111
|
+
type: String,
|
|
112
|
+
default: "user"
|
|
113
|
+
},
|
|
114
|
+
message: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: ""
|
|
117
|
+
},
|
|
118
|
+
time: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: ""
|
|
121
|
+
},
|
|
122
|
+
avatar: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: ""
|
|
125
|
+
},
|
|
126
|
+
name: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: ""
|
|
129
|
+
},
|
|
130
|
+
flicker: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: !1
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
setup(t) {
|
|
136
|
+
return (l, n) => (u(), m("div", re, [
|
|
137
|
+
t.type === "user" ? (u(), m("div", ie, [
|
|
138
|
+
r("p", null, [
|
|
139
|
+
E(y(t.message) + " ", 1),
|
|
140
|
+
r("span", null, y(t.time), 1)
|
|
141
|
+
])
|
|
142
|
+
])) : (u(), m("div", ue, [
|
|
143
|
+
r("div", {
|
|
144
|
+
class: N(["avatar", {
|
|
145
|
+
flicker: t.flicker,
|
|
146
|
+
"ai-avatar": t.type === "ai"
|
|
147
|
+
}])
|
|
148
|
+
}, [
|
|
149
|
+
r("img", {
|
|
150
|
+
src: t.avatar,
|
|
151
|
+
alt: "avatar"
|
|
152
|
+
}, null, 8, de)
|
|
153
|
+
], 2),
|
|
154
|
+
r("div", he, [
|
|
155
|
+
r("h3", null, y(t.name), 1),
|
|
156
|
+
r("p", null, [
|
|
157
|
+
E(y(t.message) + " ", 1),
|
|
158
|
+
r("span", null, y(t.time), 1)
|
|
159
|
+
])
|
|
160
|
+
])
|
|
161
|
+
]))
|
|
162
|
+
]));
|
|
163
|
+
}
|
|
164
|
+
}), _e = /* @__PURE__ */ M(me, [["__scopeId", "data-v-15793bae"]]), fe = "data:image/svg+xml,%3csvg%20width='22'%20height='18'%20viewBox='0%200%2022%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18.4403%202.81147L3.21621%207.91957C2.17723%208.28267%202.18324%208.78698%203.02559%209.01187L6.93422%2010.0728L15.9777%205.10813C16.4053%204.88175%2016.796%205.00354%2016.4748%205.25158L9.14785%2011.0052H9.14613L9.14785%2011.0059L8.87823%2014.5115C9.27322%2014.5115%209.44752%2014.3538%209.66906%2014.1678L11.5676%2012.5615L15.5166%2015.0995C16.2447%2015.4484%2016.7676%2015.2691%2016.9488%2014.513L19.5411%203.88285C19.8064%202.95716%2019.135%202.53802%2018.4403%202.81147Z'%20fill='white'/%3e%3c/svg%3e", pe = {
|
|
165
|
+
name: "chat-button"
|
|
166
|
+
}, ge = { class: "chat-button" };
|
|
167
|
+
function we(t, l, n, o, c, d) {
|
|
168
|
+
return u(), m("div", ge, [
|
|
169
|
+
B(t.$slots, "default", {}, void 0, !0)
|
|
170
|
+
]);
|
|
171
|
+
}
|
|
172
|
+
const ye = /* @__PURE__ */ M(pe, [["render", we], ["__scopeId", "data-v-38a08185"]]), Me = { class: "chat-send" }, Ce = ["value", "placeholder"], $e = ["src"], ke = {
|
|
173
|
+
name: "chat-send"
|
|
174
|
+
}, Ie = /* @__PURE__ */ C({
|
|
175
|
+
...ke,
|
|
176
|
+
emits: ["send"],
|
|
177
|
+
setup(t, { emit: l }) {
|
|
178
|
+
const n = p("type your message here"), o = l, c = p(""), d = (a) => {
|
|
179
|
+
c.value = a.target.value;
|
|
180
|
+
}, _ = () => {
|
|
181
|
+
c.value.trim() !== "" && (o("send", c.value), c.value = "");
|
|
182
|
+
};
|
|
183
|
+
return (a, v) => (u(), m("div", Me, [
|
|
184
|
+
r("input", {
|
|
185
|
+
type: "text",
|
|
186
|
+
value: c.value,
|
|
187
|
+
placeholder: n.value,
|
|
188
|
+
onKeydown: Y(_, ["enter"]),
|
|
189
|
+
onInput: d
|
|
190
|
+
}, null, 40, Ce),
|
|
191
|
+
T(ye, { onClick: _ }, {
|
|
192
|
+
default: x(() => [
|
|
193
|
+
v[0] || (v[0] = r("span", null, "Send", -1)),
|
|
194
|
+
r("img", {
|
|
195
|
+
src: j(fe),
|
|
196
|
+
alt: "send"
|
|
197
|
+
}, null, 8, $e)
|
|
198
|
+
]),
|
|
199
|
+
_: 1
|
|
200
|
+
})
|
|
201
|
+
]));
|
|
202
|
+
}
|
|
203
|
+
}), Se = /* @__PURE__ */ M(Ie, [["__scopeId", "data-v-bd61df65"]]), Te = { class: "chat-hint" }, xe = ["onClick"], Ae = {
|
|
204
|
+
name: "chat-hint"
|
|
205
|
+
}, He = /* @__PURE__ */ C({
|
|
206
|
+
...Ae,
|
|
207
|
+
props: {
|
|
208
|
+
list: {
|
|
209
|
+
type: Array,
|
|
210
|
+
default: () => []
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
emits: ["tapHint"],
|
|
214
|
+
setup(t, { emit: l }) {
|
|
215
|
+
const n = l, o = (c) => {
|
|
216
|
+
n("tapHint", c);
|
|
217
|
+
};
|
|
218
|
+
return (c, d) => (u(), m("div", Te, [
|
|
219
|
+
(u(!0), m(R, null, q(t.list, (_, a) => (u(), m("div", {
|
|
220
|
+
class: "chat-hint__content",
|
|
221
|
+
key: a,
|
|
222
|
+
onClick: (v) => o(_)
|
|
223
|
+
}, y(_), 9, xe))), 128))
|
|
224
|
+
]));
|
|
225
|
+
}
|
|
226
|
+
}), be = /* @__PURE__ */ M(He, [["__scopeId", "data-v-d1eca076"]]), Le = {
|
|
227
|
+
key: 0,
|
|
228
|
+
class: "loading"
|
|
229
|
+
}, De = {
|
|
230
|
+
key: 1,
|
|
231
|
+
class: "no-more"
|
|
232
|
+
}, Be = {
|
|
233
|
+
name: "chat-window"
|
|
234
|
+
}, Re = /* @__PURE__ */ C({
|
|
235
|
+
...Be,
|
|
236
|
+
setup(t, { expose: l }) {
|
|
237
|
+
const n = p(null), o = p([]), c = (e) => {
|
|
238
|
+
o.value.push({
|
|
239
|
+
id: (/* @__PURE__ */ new Date()).getTime() + Math.random(),
|
|
240
|
+
type: "hint",
|
|
241
|
+
hintList: e
|
|
242
|
+
});
|
|
243
|
+
}, d = (e, i, s, f) => {
|
|
244
|
+
i.trim() !== "" && (o.value.push({
|
|
245
|
+
id: (/* @__PURE__ */ new Date()).getTime() + Math.random(),
|
|
246
|
+
type: "chat",
|
|
247
|
+
chatType: e,
|
|
248
|
+
message: i,
|
|
249
|
+
time: D(),
|
|
250
|
+
name: s,
|
|
251
|
+
avatar: f
|
|
252
|
+
}), k());
|
|
253
|
+
}, _ = (e, i, s) => {
|
|
254
|
+
i.trim() !== "" && (o.value.push({
|
|
255
|
+
id: e,
|
|
256
|
+
type: "chat",
|
|
257
|
+
chatType: "ai",
|
|
258
|
+
message: i,
|
|
259
|
+
time: D(),
|
|
260
|
+
name: "AI Agent",
|
|
261
|
+
avatar: z,
|
|
262
|
+
flicker: s
|
|
263
|
+
}), k());
|
|
264
|
+
}, a = p({
|
|
265
|
+
apiChat: null,
|
|
266
|
+
apiHint: null,
|
|
267
|
+
thread_id: null,
|
|
268
|
+
vendor_id: null,
|
|
269
|
+
website: null,
|
|
270
|
+
chatMode: null,
|
|
271
|
+
// AI、PEOPLE、GROUP
|
|
272
|
+
socket: null,
|
|
273
|
+
roomId: "",
|
|
274
|
+
userName: "",
|
|
275
|
+
avatar: "",
|
|
276
|
+
socketUrl: null,
|
|
277
|
+
getChatsApi: null
|
|
278
|
+
}), v = p(null), g = (e, i = () => {
|
|
279
|
+
}) => {
|
|
280
|
+
if (a.value = e, e.socketUrl) {
|
|
281
|
+
import("./index-BCmYEvSn.js").then((s) => {
|
|
282
|
+
v.value = te(s.io(e.socketUrl), e), i();
|
|
283
|
+
});
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
i();
|
|
287
|
+
}, h = (e) => {
|
|
288
|
+
const i = (/* @__PURE__ */ new Date()).getTime() + Math.random();
|
|
289
|
+
_(i, "thinking...", !0), a.value.apiChat({
|
|
290
|
+
thread_id: a.value.thread_id,
|
|
291
|
+
vendor_id: a.value.vendor_id,
|
|
292
|
+
website: a.value.website,
|
|
293
|
+
question: e
|
|
294
|
+
}).then((s) => {
|
|
295
|
+
const f = o.value.findIndex((L) => L.id === i);
|
|
296
|
+
f !== -1 && (o.value[f].message = s, o.value[f].flicker = !1), k();
|
|
297
|
+
});
|
|
298
|
+
}, $ = (e) => {
|
|
299
|
+
v.value.sendMessage(e);
|
|
300
|
+
}, H = (e) => {
|
|
301
|
+
a.value.apiChat && e.trim() !== "" && (d("user", e, a.value.userName, a.value.avatar), a.value.chatMode === "AI" ? setTimeout(() => {
|
|
302
|
+
h(e);
|
|
303
|
+
}, 700) : a.value.chatMode === "PEOPLE" ? $(e) : a.value.chatMode);
|
|
304
|
+
}, G = (e) => {
|
|
305
|
+
a.value.roomId = e, v.value.joinRoom(e, () => {
|
|
306
|
+
W();
|
|
307
|
+
});
|
|
308
|
+
}, K = () => {
|
|
309
|
+
v.value.leaveRoom(a.value.roomId);
|
|
310
|
+
}, F = () => {
|
|
311
|
+
if (n.value.openDrawer(), a.value.chatMode === "AI" && o.value.length === 0) {
|
|
312
|
+
const e = (/* @__PURE__ */ new Date()).getTime() + Math.random();
|
|
313
|
+
_(e, "I am your AI agent, Alice. How can I assist you today?", !1);
|
|
314
|
+
}
|
|
315
|
+
}, W = () => {
|
|
316
|
+
v.value.onMessage((e) => {
|
|
317
|
+
d("other", e.text, e.user, e.avatar);
|
|
318
|
+
});
|
|
319
|
+
}, k = () => {
|
|
320
|
+
n.value.scrollToBottom();
|
|
321
|
+
}, O = p(1), I = p(!1), b = p(!1), J = ((e, i) => {
|
|
322
|
+
let s = null;
|
|
323
|
+
return (...f) => {
|
|
324
|
+
s || (s = setTimeout(() => {
|
|
325
|
+
e.apply(this, f), s = null;
|
|
326
|
+
}, i));
|
|
327
|
+
};
|
|
328
|
+
})((e) => {
|
|
329
|
+
e.target.scrollTop <= 100 && P();
|
|
330
|
+
}, 200), P = async () => {
|
|
331
|
+
if (I.value || b.value) return;
|
|
332
|
+
I.value = !0;
|
|
333
|
+
const e = n.value.$el.querySelector(".chat-drawer_content"), i = e.scrollHeight, s = e.scrollTop;
|
|
334
|
+
try {
|
|
335
|
+
const f = await a.value.getChatsApi({
|
|
336
|
+
room: a.value.roomId,
|
|
337
|
+
page: O.value,
|
|
338
|
+
size: 20
|
|
339
|
+
});
|
|
340
|
+
f.length < 20 && (b.value = !0);
|
|
341
|
+
const L = f.map((w) => ({
|
|
342
|
+
id: (/* @__PURE__ */ new Date()).getTime() + Math.random(),
|
|
343
|
+
type: "chat",
|
|
344
|
+
chatType: a.value.chatMode === "AI" ? "ai" : w.userId === a.value.thread_id ? "user" : "other",
|
|
345
|
+
message: w.message,
|
|
346
|
+
time: D(w.timestamp),
|
|
347
|
+
name: w.userName,
|
|
348
|
+
avatar: w.avatar
|
|
349
|
+
}));
|
|
350
|
+
o.value.unshift(...L), O.value++, setTimeout(() => {
|
|
351
|
+
const w = e.scrollHeight;
|
|
352
|
+
e.scrollTop = w - i + s;
|
|
353
|
+
}, 0);
|
|
354
|
+
} catch (f) {
|
|
355
|
+
console.error("加载历史消息失败:", f);
|
|
356
|
+
} finally {
|
|
357
|
+
I.value = !1;
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
return l({
|
|
361
|
+
chatInit: g,
|
|
362
|
+
openDrawer: F,
|
|
363
|
+
sendMessage: H,
|
|
364
|
+
scrollToBottom: k,
|
|
365
|
+
pushHint: c,
|
|
366
|
+
joinRoom: G,
|
|
367
|
+
leaveRoom: K,
|
|
368
|
+
loadMore: P
|
|
369
|
+
}), (e, i) => (u(), m("div", {
|
|
370
|
+
class: N(["chat-window", { instagem: a.value.website === "instagem.com" }])
|
|
371
|
+
}, [
|
|
372
|
+
T(ce, {
|
|
373
|
+
ref_key: "chatDrawerRef",
|
|
374
|
+
ref: n,
|
|
375
|
+
title: "AI Chat",
|
|
376
|
+
onScroll: j(J)
|
|
377
|
+
}, {
|
|
378
|
+
content: x(() => [
|
|
379
|
+
I.value ? (u(), m("div", Le, "Loading...")) : S("", !0),
|
|
380
|
+
b.value ? (u(), m("div", De, "No more news")) : S("", !0),
|
|
381
|
+
T(ee, {
|
|
382
|
+
name: "scroll",
|
|
383
|
+
tag: "div"
|
|
384
|
+
}, {
|
|
385
|
+
default: x(() => [
|
|
386
|
+
(u(!0), m(R, null, q(o.value, (s) => (u(), m(R, {
|
|
387
|
+
key: s.id
|
|
388
|
+
}, [
|
|
389
|
+
s.type === "chat" ? (u(), Z(_e, {
|
|
390
|
+
key: 0,
|
|
391
|
+
type: s.chatType,
|
|
392
|
+
message: s.message,
|
|
393
|
+
time: s.time,
|
|
394
|
+
name: s.name,
|
|
395
|
+
avatar: s.avatar,
|
|
396
|
+
flicker: s.flicker
|
|
397
|
+
}, null, 8, ["type", "message", "time", "name", "avatar", "flicker"])) : S("", !0),
|
|
398
|
+
s.type === "hint" ? (u(), Z(be, {
|
|
399
|
+
key: 1,
|
|
400
|
+
list: s.hintList,
|
|
401
|
+
onTapHint: H
|
|
402
|
+
}, null, 8, ["list"])) : S("", !0)
|
|
403
|
+
], 64))), 128))
|
|
404
|
+
]),
|
|
405
|
+
_: 1
|
|
406
|
+
})
|
|
407
|
+
]),
|
|
408
|
+
footer: x(() => [
|
|
409
|
+
T(Se, { onSend: H })
|
|
410
|
+
]),
|
|
411
|
+
_: 1
|
|
412
|
+
}, 8, ["onScroll"])
|
|
413
|
+
], 2));
|
|
414
|
+
}
|
|
415
|
+
}), Ne = /* @__PURE__ */ M(Re, [["__scopeId", "data-v-2cb45a3a"]]), je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
416
|
+
__proto__: null,
|
|
417
|
+
default: Ne
|
|
418
|
+
}, Symbol.toStringTag, { value: "Module" })), V = /* @__PURE__ */ Object.assign({ "./ChatWindow/index.vue": je }), A = (t) => {
|
|
419
|
+
A.installed || (A.installed, Object.keys(V).forEach((l) => {
|
|
420
|
+
const n = V[l], o = n.default.name;
|
|
421
|
+
t.component(o, n.default || n);
|
|
422
|
+
}), t.directive("focus", {
|
|
423
|
+
mounted: function(l) {
|
|
424
|
+
l.focus();
|
|
425
|
+
}
|
|
426
|
+
}));
|
|
427
|
+
}, U = window.Vue;
|
|
428
|
+
typeof window < "u" && U && A(U);
|
|
429
|
+
const Ee = {
|
|
430
|
+
install: A
|
|
431
|
+
};
|
|
432
|
+
export {
|
|
433
|
+
Ee as default
|
|
434
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(i,A){typeof exports=="object"&&typeof module<"u"?module.exports=A(require("vue")):typeof define=="function"&&define.amd?define(["vue"],A):(i=typeof globalThis<"u"?globalThis:i||self,i["chat-customer-47net"]=A(i.Vue))})(this,function(i){"use strict";const A="data:image/svg+xml,%3csvg%20id='组件_17_1'%20data-name='组件%2017%20–%201'%20xmlns='http://www.w3.org/2000/svg'%20width='82.344'%20height='88.431'%20viewBox='0%200%2082.344%2088.431'%3e%3cpath%20id='减去_2'%20data-name='减去%202'%20d='M37.288,88.43V74.948h-.005c-.446-.062-11.02-1.567-18.959-5.412-3.843-1.862-7.794-5.4-11.125-9.95A38.155,38.155,0,0,1,.778,46.225,38.6,38.6,0,0,1,.712,31.1,38.616,38.616,0,0,1,7.49,15.108,36.865,36.865,0,0,1,20.4,4.017,39.775,39.775,0,0,1,38.525,0c.358,0,.724,0,1.086.011A33.368,33.368,0,0,1,49.736,1.817a36.75,36.75,0,0,1,8.392,4.162,36.354,36.354,0,0,1,10.63,10.588c2.084,3.339,3.618,8.311,4.538,11.9,1,3.9,1.507,7.017,1.512,7.048l.007.009c.623.832,6.11,8.176,7.076,9.781a2.581,2.581,0,0,1,0,2.938,3.864,3.864,0,0,1-1.01.929c-.759.529-3.687,3.076-3.716,3.1,1.478,2.575,1.6,3.371,1.312,4.181-.377,1.062-2.654,1.465-2.706,1.474,0,0,0,0,.006.007a7.056,7.056,0,0,1,1.387,3.082,4.1,4.1,0,0,1-1.394,3.1c-.618.548-.31,2.408,0,2.938.048.081.125.19.223.326a4.991,4.991,0,0,1,1.171,4.086c-.539,2.1-3.684,3.47-3.716,3.484-.063,0-7.066-.067-11.991-.067-2.9,0-4.551.023-4.894.067a17.456,17.456,0,0,0-3.93,1.721c-1.1.558-2.464,1.252-4.037,2-4.17,1.971-11.238,9.686-11.309,9.764Zm.371-70.793c-11.351,0-20.587,8.032-20.587,17.9,0,5.608,2.936,10.786,8.056,14.206v6.267c0,.631.258,1.007.69,1.007a1.282,1.282,0,0,0,.741-.3l5.284-4a23.487,23.487,0,0,0,5.816.724c11.351,0,20.587-8.032,20.587-17.9S49.01,17.637,37.659,17.637ZM50.189,38.227a2.686,2.686,0,1,1,2.686-2.686A2.688,2.688,0,0,1,50.189,38.227Zm-12.531,0a2.686,2.686,0,1,1,2.686-2.686A2.689,2.689,0,0,1,37.659,38.227Zm-12.531,0a2.686,2.686,0,1,1,2.685-2.686A2.689,2.689,0,0,1,25.128,38.227Z'%20transform='translate(0.001%200)'%20fill='%23fff'/%3e%3c/svg%3e",W=n=>{const e=n?new Date(n):new Date,t=e.getHours(),s=e.getMinutes(),r=t<12?"AM":"PM",o=t%12||12,a=s.toString().padStart(2,"0");return`${o}:${a} ${r}`},Oe=(n,e)=>{const{thread_id:t,userName:s,avatar:r}=e;return{joinRoom:(m,f)=>{n.emit("join",{userId:t,userName:s,avatar:r,room:m},f)},leaveRoom:m=>{n.emit("disconnect",m)},onMessage:m=>{n.on("message",m)},sendMessage:(m,f)=>{n.emit("sendMessage",m,f)}}},Le={class:"chat-drawer_title"},Pe=["src"],Ie={class:"chat-drawer_footer"},qe={name:"chat-drawer"},De=i.defineComponent({...qe,props:{title:{type:String,default:"AI Chat"},footerTitle:{type:String,default:"Send"}},emits:["close","scroll"],setup(n,{expose:e,emit:t}){const s=t,r=f=>{s("scroll",f)},o=i.ref(!1),a=()=>{o.value=!0},c=()=>{o.value=!1},h=i.ref(null);return e({visible:o,openDrawer:a,closeDrawer:c,scrollToBottom:async()=>{if(h.value){await i.nextTick();const f=h.value;f.scrollHeight>f.clientHeight&&(f.scrollTop=f.scrollHeight)}}}),(f,g)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["chat-drawer",{"chat-drawer_fade":!o.value,"chat-drawer_show":o.value}]),onClick:c},[i.createElementVNode("div",{class:"chat-drawer_wrapper",onClick:g[0]||(g[0]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",Le,[i.createElementVNode("img",{src:i.unref(A),alt:"avatar"},null,8,Pe),i.createElementVNode("span",null,i.toDisplayString(n.title),1),i.createElementVNode("i",{onClick:c})]),i.createElementVNode("div",{class:"chat-drawer_content",ref_key:"chatContent",ref:h,onScroll:r},[i.renderSlot(f.$slots,"content",{},void 0,!0)],544),i.createElementVNode("div",Ie,[i.renderSlot(f.$slots,"footer",{},void 0,!0)])])],2))}}),B=(n,e)=>{const t=n.__vccOpts||n;for(const[s,r]of e)t[s]=r;return t},Me=B(De,[["__scopeId","data-v-281c6db5"]]),Ve={class:"chat-item"},Ue={key:0,class:"user"},He={key:1,class:"other"},Fe=["src"],We={class:"content"},Ke={name:"chat-item"},ze=i.defineComponent({...Ke,props:{type:{type:String,default:"user"},message:{type:String,default:""},time:{type:String,default:""},avatar:{type:String,default:""},name:{type:String,default:""},flicker:{type:Boolean,default:!1}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",Ve,[n.type==="user"?(i.openBlock(),i.createElementBlock("div",Ue,[i.createElementVNode("p",null,[i.createTextVNode(i.toDisplayString(n.message)+" ",1),i.createElementVNode("span",null,i.toDisplayString(n.time),1)])])):(i.openBlock(),i.createElementBlock("div",He,[i.createElementVNode("div",{class:i.normalizeClass(["avatar",{flicker:n.flicker,"ai-avatar":n.type==="ai"}])},[i.createElementVNode("img",{src:n.avatar,alt:"avatar"},null,8,Fe)],2),i.createElementVNode("div",We,[i.createElementVNode("h3",null,i.toDisplayString(n.name),1),i.createElementVNode("p",null,[i.createTextVNode(i.toDisplayString(n.message)+" ",1),i.createElementVNode("span",null,i.toDisplayString(n.time),1)])])]))]))}}),Ye=B(ze,[["__scopeId","data-v-15793bae"]]),Je="data:image/svg+xml,%3csvg%20width='22'%20height='18'%20viewBox='0%200%2022%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18.4403%202.81147L3.21621%207.91957C2.17723%208.28267%202.18324%208.78698%203.02559%209.01187L6.93422%2010.0728L15.9777%205.10813C16.4053%204.88175%2016.796%205.00354%2016.4748%205.25158L9.14785%2011.0052H9.14613L9.14785%2011.0059L8.87823%2014.5115C9.27322%2014.5115%209.44752%2014.3538%209.66906%2014.1678L11.5676%2012.5615L15.5166%2015.0995C16.2447%2015.4484%2016.7676%2015.2691%2016.9488%2014.513L19.5411%203.88285C19.8064%202.95716%2019.135%202.53802%2018.4403%202.81147Z'%20fill='white'/%3e%3c/svg%3e",je={name:"chat-button"},Xe={class:"chat-button"};function Qe(n,e,t,s,r,o){return i.openBlock(),i.createElementBlock("div",Xe,[i.renderSlot(n.$slots,"default",{},void 0,!0)])}const Ze=B(je,[["render",Qe],["__scopeId","data-v-38a08185"]]),Ge={class:"chat-send"},$e=["value","placeholder"],et=["src"],tt={name:"chat-send"},st=i.defineComponent({...tt,emits:["send"],setup(n,{emit:e}){const t=i.ref("type your message here"),s=e,r=i.ref(""),o=c=>{r.value=c.target.value},a=()=>{r.value.trim()!==""&&(s("send",r.value),r.value="")};return(c,h)=>(i.openBlock(),i.createElementBlock("div",Ge,[i.createElementVNode("input",{type:"text",value:r.value,placeholder:t.value,onKeydown:i.withKeys(a,["enter"]),onInput:o},null,40,$e),i.createVNode(Ze,{onClick:a},{default:i.withCtx(()=>[h[0]||(h[0]=i.createElementVNode("span",null,"Send",-1)),i.createElementVNode("img",{src:i.unref(Je),alt:"send"},null,8,et)]),_:1})]))}}),nt=B(st,[["__scopeId","data-v-bd61df65"]]),rt={class:"chat-hint"},it=["onClick"],ot={name:"chat-hint"},at=i.defineComponent({...ot,props:{list:{type:Array,default:()=>[]}},emits:["tapHint"],setup(n,{emit:e}){const t=e,s=r=>{t("tapHint",r)};return(r,o)=>(i.openBlock(),i.createElementBlock("div",rt,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.list,(a,c)=>(i.openBlock(),i.createElementBlock("div",{class:"chat-hint__content",key:c,onClick:h=>s(a)},i.toDisplayString(a),9,it))),128))]))}}),ct=B(at,[["__scopeId","data-v-d1eca076"]]),ht={key:0,class:"loading"},lt={key:1,class:"no-more"},ut={name:"chat-window"},ft=i.defineComponent({...ut,setup(n,{expose:e}){const t=i.ref(null),s=i.ref([]),r=l=>{s.value.push({id:new Date().getTime()+Math.random(),type:"hint",hintList:l})},o=(l,y,d,w)=>{y.trim()!==""&&(s.value.push({id:new Date().getTime()+Math.random(),type:"chat",chatType:l,message:y,time:W(),name:d,avatar:w}),H())},a=(l,y,d)=>{y.trim()!==""&&(s.value.push({id:l,type:"chat",chatType:"ai",message:y,time:W(),name:"AI Agent",avatar:A,flicker:d}),H())},c=i.ref({apiChat:null,apiHint:null,thread_id:null,vendor_id:null,website:null,chatMode:null,socket:null,roomId:"",userName:"",avatar:"",socketUrl:null,getChatsApi:null}),h=i.ref(null),m=(l,y=()=>{})=>{if(c.value=l,l.socketUrl){Promise.resolve().then(()=>ns).then(d=>{h.value=Oe(d.io(l.socketUrl),l),y()});return}y()},f=l=>{const y=new Date().getTime()+Math.random();a(y,"thinking...",!0),c.value.apiChat({thread_id:c.value.thread_id,vendor_id:c.value.vendor_id,website:c.value.website,question:l}).then(d=>{const w=s.value.findIndex(ae=>ae.id===y);w!==-1&&(s.value[w].message=d,s.value[w].flicker=!1),H()})},g=l=>{h.value.sendMessage(l)},v=l=>{c.value.apiChat&&l.trim()!==""&&(o("user",l,c.value.userName,c.value.avatar),c.value.chatMode==="AI"?setTimeout(()=>{f(l)},700):c.value.chatMode==="PEOPLE"?g(l):c.value.chatMode)},rs=l=>{c.value.roomId=l,h.value.joinRoom(l,()=>{as()})},is=()=>{h.value.leaveRoom(c.value.roomId)},os=()=>{if(t.value.openDrawer(),c.value.chatMode==="AI"&&s.value.length===0){const l=new Date().getTime()+Math.random();a(l,"I am your AI agent, Alice. How can I assist you today?",!1)}},as=()=>{h.value.onMessage(l=>{o("other",l.text,l.user,l.avatar)})},H=()=>{t.value.scrollToBottom()},Ne=i.ref(1),F=i.ref(!1),oe=i.ref(!1),cs=((l,y)=>{let d=null;return(...w)=>{d||(d=setTimeout(()=>{l.apply(this,w),d=null},y))}})(l=>{l.target.scrollTop<=100&&xe()},200),xe=async()=>{if(F.value||oe.value)return;F.value=!0;const l=t.value.$el.querySelector(".chat-drawer_content"),y=l.scrollHeight,d=l.scrollTop;try{const w=await c.value.getChatsApi({room:c.value.roomId,page:Ne.value,size:20});w.length<20&&(oe.value=!0);const ae=w.map(C=>({id:new Date().getTime()+Math.random(),type:"chat",chatType:c.value.chatMode==="AI"?"ai":C.userId===c.value.thread_id?"user":"other",message:C.message,time:W(C.timestamp),name:C.userName,avatar:C.avatar}));s.value.unshift(...ae),Ne.value++,setTimeout(()=>{const C=l.scrollHeight;l.scrollTop=C-y+d},0)}catch(w){console.error("加载历史消息失败:",w)}finally{F.value=!1}};return e({chatInit:m,openDrawer:os,sendMessage:v,scrollToBottom:H,pushHint:r,joinRoom:rs,leaveRoom:is,loadMore:xe}),(l,y)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["chat-window",{instagem:c.value.website==="instagem.com"}])},[i.createVNode(Me,{ref_key:"chatDrawerRef",ref:t,title:"AI Chat",onScroll:i.unref(cs)},{content:i.withCtx(()=>[F.value?(i.openBlock(),i.createElementBlock("div",ht,"Loading...")):i.createCommentVNode("",!0),oe.value?(i.openBlock(),i.createElementBlock("div",lt,"No more news")):i.createCommentVNode("",!0),i.createVNode(i.TransitionGroup,{name:"scroll",tag:"div"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,d=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:d.id},[d.type==="chat"?(i.openBlock(),i.createBlock(Ye,{key:0,type:d.chatType,message:d.message,time:d.time,name:d.name,avatar:d.avatar,flicker:d.flicker},null,8,["type","message","time","name","avatar","flicker"])):i.createCommentVNode("",!0),d.type==="hint"?(i.openBlock(),i.createBlock(ct,{key:1,list:d.hintList,onTapHint:v},null,8,["list"])):i.createCommentVNode("",!0)],64))),128))]),_:1})]),footer:i.withCtx(()=>[i.createVNode(nt,{onSend:v})]),_:1},8,["onScroll"])],2))}}),ce=Object.assign({"./ChatWindow/index.vue":Object.freeze(Object.defineProperty({__proto__:null,default:B(ft,[["__scopeId","data-v-2cb45a3a"]])},Symbol.toStringTag,{value:"Module"}))}),O=n=>{O.installed||(O.installed,Object.keys(ce).forEach(e=>{const t=ce[e],s=t.default.name;n.component(s,t.default||t)}),n.directive("focus",{mounted:function(e){e.focus()}}))},he=window.Vue;typeof window<"u"&&he&&O(he);const dt={install:O},k=Object.create(null);k.open="0",k.close="1",k.ping="2",k.pong="3",k.message="4",k.upgrade="5",k.noop="6";const L=Object.create(null);Object.keys(k).forEach(n=>{L[k[n]]=n});const K={type:"error",data:"parser error"},le=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ue=typeof ArrayBuffer=="function",fe=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,z=({type:n,data:e},t,s)=>le&&e instanceof Blob?t?s(e):de(e,s):ue&&(e instanceof ArrayBuffer||fe(e))?t?s(e):de(new Blob([e]),s):s(k[n]+(e||"")),de=(n,e)=>{const t=new FileReader;return t.onload=function(){const s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(n)};function pe(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let Y;function pt(n,e){if(le&&n.data instanceof Blob)return n.data.arrayBuffer().then(pe).then(e);if(ue&&(n.data instanceof ArrayBuffer||fe(n.data)))return e(pe(n.data));z(n,!1,t=>{Y||(Y=new TextEncoder),e(Y.encode(t))})}const me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<me.length;n++)N[me.charCodeAt(n)]=n;const mt=n=>{let e=n.length*.75,t=n.length,s,r=0,o,a,c,h;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const m=new ArrayBuffer(e),f=new Uint8Array(m);for(s=0;s<t;s+=4)o=N[n.charCodeAt(s)],a=N[n.charCodeAt(s+1)],c=N[n.charCodeAt(s+2)],h=N[n.charCodeAt(s+3)],f[r++]=o<<2|a>>4,f[r++]=(a&15)<<4|c>>2,f[r++]=(c&3)<<6|h&63;return m},yt=typeof ArrayBuffer=="function",J=(n,e)=>{if(typeof n!="string")return{type:"message",data:ye(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:gt(n.substring(1),e)}:L[t]?n.length>1?{type:L[t],data:n.substring(1)}:{type:L[t]}:K},gt=(n,e)=>{if(yt){const t=mt(n);return ye(t,e)}else return{base64:!0,data:n}},ye=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},ge="",_t=(n,e)=>{const t=n.length,s=new Array(t);let r=0;n.forEach((o,a)=>{z(o,!1,c=>{s[a]=c,++r===t&&e(s.join(ge))})})},wt=(n,e)=>{const t=n.split(ge),s=[];for(let r=0;r<t.length;r++){const o=J(t[r],e);if(s.push(o),o.type==="error")break}return s};function bt(){return new TransformStream({transform(n,e){pt(n,t=>{const s=t.length;let r;if(s<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,s);else if(s<65536){r=new Uint8Array(3);const o=new DataView(r.buffer);o.setUint8(0,126),o.setUint16(1,s)}else{r=new Uint8Array(9);const o=new DataView(r.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let j;function P(n){return n.reduce((e,t)=>e+t.length,0)}function I(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let s=0;for(let r=0;r<e;r++)t[r]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),t}function kt(n,e){j||(j=new TextDecoder);const t=[];let s=0,r=-1,o=!1;return new TransformStream({transform(a,c){for(t.push(a);;){if(s===0){if(P(t)<1)break;const h=I(t,1);o=(h[0]&128)===128,r=h[0]&127,r<126?s=3:r===126?s=1:s=2}else if(s===1){if(P(t)<2)break;const h=I(t,2);r=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),s=3}else if(s===2){if(P(t)<8)break;const h=I(t,8),m=new DataView(h.buffer,h.byteOffset,h.length),f=m.getUint32(0);if(f>Math.pow(2,21)-1){c.enqueue(K);break}r=f*Math.pow(2,32)+m.getUint32(4),s=3}else{if(P(t)<r)break;const h=I(t,r);c.enqueue(J(o?h:j.decode(h),e)),s=0}if(r===0||r>n){c.enqueue(K);break}}}})}const _e=4;function p(n){if(n)return Et(n)}function Et(n){for(var e in p.prototype)n[e]=p.prototype[e];return n}p.prototype.on=p.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this},p.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this},p.prototype.off=p.prototype.removeListener=p.prototype.removeAllListeners=p.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,r=0;r<t.length;r++)if(s=t[r],s===e||s.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+n],this},p.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,r=t.length;s<r;++s)t[s].apply(this,e)}return this},p.prototype.emitReserved=p.prototype.emit,p.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},p.prototype.hasListeners=function(n){return!!this.listeners(n).length};const q=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),_=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),vt="arraybuffer";function us(){}function we(n,...e){return e.reduce((t,s)=>(n.hasOwnProperty(s)&&(t[s]=n[s]),t),{})}const Tt=_.setTimeout,Ct=_.clearTimeout;function D(n,e){e.useNativeTimers?(n.setTimeoutFn=Tt.bind(_),n.clearTimeoutFn=Ct.bind(_)):(n.setTimeoutFn=_.setTimeout.bind(_),n.clearTimeoutFn=_.clearTimeout.bind(_))}const At=1.33;function Bt(n){return typeof n=="string"?St(n):Math.ceil((n.byteLength||n.size)*At)}function St(n){let e=0,t=0;for(let s=0,r=n.length;s<r;s++)e=n.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function be(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Rt(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function Nt(n){let e={},t=n.split("&");for(let s=0,r=t.length;s<r;s++){let o=t[s].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class xt extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class X extends p{constructor(e){super(),this.writable=!1,D(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new xt(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=J(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=Rt(e);return t.length?"?"+t:""}}class ke extends X{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};wt(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,_t(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=be()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let Ee=!1;try{Ee=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ot=Ee;function Lt(){}class Pt extends ke{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(r,o)=>{this.onError("xhr post error",r,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}}class E extends p{constructor(e,t,s){super(),this.createRequest=e,D(this,s),this._opts=s,this._method=s.method||"GET",this._uri=t,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;const t=we(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(t);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&s.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var r;s.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=E.requestsCount++,E.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Lt,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete E.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(E.requestsCount=0,E.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ve);else if(typeof addEventListener=="function"){const n="onpagehide"in _?"pagehide":"unload";addEventListener(n,ve,!1)}}function ve(){for(let n in E.requests)E.requests.hasOwnProperty(n)&&E.requests[n].abort()}const It=function(){const n=Te({xdomain:!1});return n&&n.responseType!==null}();class Q extends Pt{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=It&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new E(Te,this.uri(),e)}}function Te(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Ot))return new XMLHttpRequest}catch{}if(!e)try{return new _[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Ce=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class qt extends X{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,s=Ce?{}:we(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],r=t===e.length-1;z(s,this.supportsBinary,o=>{try{this.doWrite(s,o)}catch{}r&&q(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=be()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Z=_.WebSocket||_.MozWebSocket;class G extends qt{createSocket(e,t,s){return Ce?new Z(e,t,s):t?new Z(e,t):new Z(e)}doWrite(e,t){this.ws.send(t)}}class Ae extends X{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=kt(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),r=bt();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const o=()=>{s.read().then(({done:c,value:h})=>{c||(this.onPacket(h),o())}).catch(c=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],r=t===e.length-1;this._writer.write(s).then(()=>{r&&q(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Dt={websocket:G,webtransport:Ae,polling:Q},Mt=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Vt=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function $(n){if(n.length>8e3)throw"URI too long";const e=n,t=n.indexOf("["),s=n.indexOf("]");t!=-1&&s!=-1&&(n=n.substring(0,t)+n.substring(t,s).replace(/:/g,";")+n.substring(s,n.length));let r=Mt.exec(n||""),o={},a=14;for(;a--;)o[Vt[a]]=r[a]||"";return t!=-1&&s!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=Ut(o,o.path),o.queryKey=Ht(o,o.query),o}function Ut(n,e){const t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function Ht(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,r,o){r&&(t[r]=o)}),t}const ee=typeof addEventListener=="function"&&typeof removeEventListener=="function",M=[];ee&&addEventListener("offline",()=>{M.forEach(n=>n())},!1);class T extends p{constructor(e,t){if(super(),this.binaryType=vt,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const s=$(e);t.hostname=s.host,t.secure=s.protocol==="https"||s.protocol==="wss",t.port=s.port,s.query&&(t.query=s.query)}else t.host&&(t.hostname=$(t.host).host);D(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(s=>{const r=s.prototype.name;this.transports.push(r),this._transportsByName[r]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Nt(this.opts.query)),ee&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},M.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=_e,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&T.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",T.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const r=this.writeBuffer[s].data;if(r&&(t+=Bt(r)),s>0&&t>this._maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,q(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,s){return this._sendPacket("message",e,t,s),this}send(e,t,s){return this._sendPacket("message",e,t,s),this}_sendPacket(e,t,s,r){if(typeof t=="function"&&(r=t,t=void 0),typeof s=="function"&&(r=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const o={type:e,data:t,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(T.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),ee&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=M.indexOf(this._offlineEventListener);s!==-1&&M.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}T.protocol=_e;class Ft extends T{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;T.priorWebsocketSuccess=!1;const r=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",g=>{if(!s)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;T.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(f(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=t.name,this.emitReserved("upgradeError",v)}}))};function o(){s||(s=!0,f(),t.close(),t=null)}const a=g=>{const v=new Error("probe error: "+g);v.transport=t.name,o(),this.emitReserved("upgradeError",v)};function c(){a("transport closed")}function h(){a("socket closed")}function m(g){t&&g.name!==t.name&&o()}const f=()=>{t.removeListener("open",r),t.removeListener("error",a),t.removeListener("close",c),this.off("close",h),this.off("upgrading",m)};t.once("open",r),t.once("error",a),t.once("close",c),this.once("close",h),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}let Wt=class extends Ft{constructor(e,t={}){const s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(r=>Dt[r]).filter(r=>!!r)),super(e,s)}};class Kt extends ke{doPoll(){this._fetch().then(e=>{if(!e.ok)return this.onError("fetch read error",e.status,e);e.text().then(t=>this.onData(t))}).catch(e=>{this.onError("fetch read error",e)})}doWrite(e,t){this._fetch(e).then(s=>{if(!s.ok)return this.onError("fetch write error",s.status,s);t()}).catch(s=>{this.onError("fetch write error",s)})}_fetch(e){var t;const s=e!==void 0,r=new Headers(this.opts.extraHeaders);return s&&r.set("content-type","text/plain;charset=UTF-8"),(t=this.socket._cookieJar)===null||t===void 0||t.appendCookies(r),fetch(this.uri(),{method:s?"POST":"GET",body:s?e:null,headers:r,credentials:this.opts.withCredentials?"include":"omit"}).then(o=>{var a;return(a=this.socket._cookieJar)===null||a===void 0||a.parseCookies(o.headers.getSetCookie()),o})}}function zt(n,e="",t){let s=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),s=$(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const o=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+o+":"+s.port+e,s.href=s.protocol+"://"+o+(t&&t.port===s.port?"":":"+s.port),s}const Yt=typeof ArrayBuffer=="function",Jt=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Be=Object.prototype.toString,jt=typeof Blob=="function"||typeof Blob<"u"&&Be.call(Blob)==="[object BlobConstructor]",Xt=typeof File=="function"||typeof File<"u"&&Be.call(File)==="[object FileConstructor]";function te(n){return Yt&&(n instanceof ArrayBuffer||Jt(n))||jt&&n instanceof Blob||Xt&&n instanceof File}function V(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,s=n.length;t<s;t++)if(V(n[t]))return!0;return!1}if(te(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return V(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&V(n[t]))return!0;return!1}function Qt(n){const e=[],t=n.data,s=n;return s.data=se(t,e),s.attachments=e.length,{packet:s,buffers:e}}function se(n,e){if(!n)return n;if(te(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let s=0;s<n.length;s++)t[s]=se(n[s],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=se(n[s],e));return t}return n}function Zt(n,e){return n.data=ne(n.data,e),delete n.attachments,n}function ne(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=ne(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=ne(n[t],e));return n}const Gt=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Se=5;var u;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(u||(u={}));class $t{constructor(e){this.replacer=e}encode(e){return(e.type===u.EVENT||e.type===u.ACK)&&V(e)?this.encodeAsBinary({type:e.type===u.EVENT?u.BINARY_EVENT:u.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===u.BINARY_EVENT||e.type===u.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Qt(e),s=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(s),r}}function Re(n){return Object.prototype.toString.call(n)==="[object Object]"}class re extends p{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const s=t.type===u.BINARY_EVENT;s||t.type===u.BINARY_ACK?(t.type=s?u.EVENT:u.ACK,this.reconstructor=new es(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(te(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const s={type:Number(e.charAt(0))};if(u[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===u.BINARY_EVENT||s.type===u.BINARY_ACK){const o=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const a=e.substring(o,t);if(a!=Number(a)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(a)}if(e.charAt(t+1)==="/"){const o=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(o,t)}else s.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const o=t+1;for(;++t;){const a=e.charAt(t);if(a==null||Number(a)!=a){--t;break}if(t===e.length)break}s.id=Number(e.substring(o,t+1))}if(e.charAt(++t)){const o=this.tryParse(e.substr(t));if(re.isPayloadValid(s.type,o))s.data=o;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case u.CONNECT:return Re(t);case u.DISCONNECT:return t===void 0;case u.CONNECT_ERROR:return typeof t=="string"||Re(t);case u.EVENT:case u.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Gt.indexOf(t[0])===-1);case u.ACK:case u.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class es{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Zt(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const ts=Object.freeze(Object.defineProperty({__proto__:null,Decoder:re,Encoder:$t,get PacketType(){return u},protocol:Se},Symbol.toStringTag,{value:"Module"}));function b(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const ss=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ie extends p{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[b(e,"open",this.onopen.bind(this)),b(e,"packet",this.onpacket.bind(this)),b(e,"error",this.onerror.bind(this)),b(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,r,o;if(ss.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const a={type:u.EVENT,data:t};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const f=this.ids++,g=t.pop();this._registerAckCallback(f,g),a.id=f}const c=(r=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||r===void 0?void 0:r.writable,h=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!c||(h?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),this.flags={},this}_registerAckCallback(e,t){var s;const r=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);t.call(this,new Error("operation has timed out"))},r),a=(...c)=>{this.io.clearTimeoutFn(o),t.apply(this,c)};a.withError=!0,this.acks[e]=a}emitWithAck(e,...t){return new Promise((s,r)=>{const o=(a,c)=>a?r(a):s(c);o.withError=!0,t.push(o),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...o)=>s!==this._queue[0]?void 0:(r!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...o)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:u.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){const s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case u.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case u.EVENT:case u.BINARY_EVENT:this.onevent(e);break;case u.ACK:case u.BINARY_ACK:this.onack(e);break;case u.DISCONNECT:this.ondisconnect();break;case u.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let s=!1;return function(...r){s||(s=!0,t.packet({type:u.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:u.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const s of t)s.apply(this,e.data)}}}function S(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}S.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=Math.floor(e*10)&1?n+t:n-t}return Math.min(n,this.max)|0},S.prototype.reset=function(){this.attempts=0},S.prototype.setMin=function(n){this.ms=n},S.prototype.setMax=function(n){this.max=n},S.prototype.setJitter=function(n){this.jitter=n};class U extends p{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,D(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new S({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||ts;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Wt(this.uri,this.opts);const t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const r=b(t,"open",function(){s.onopen(),e&&e()}),o=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},a=b(t,"error",o);if(this._timeout!==!1){const c=this._timeout,h=this.setTimeoutFn(()=>{r(),o(new Error("timeout")),t.close()},c);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(b(e,"ping",this.onping.bind(this)),b(e,"data",this.ondata.bind(this)),b(e,"error",this.onerror.bind(this)),b(e,"close",this.onclose.bind(this)),b(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){q(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new ie(this,e,t),this.nsps[e]=s),s}_destroy(e){const t=Object.keys(this.nsps);for(const s of t)if(this.nsps[s].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const x={};function R(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=zt(n,e.path||"/socket.io"),s=t.source,r=t.id,o=t.path,a=x[r]&&o in x[r].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||a;let h;return c?h=new U(s,e):(x[r]||(x[r]=new U(s,e)),h=x[r]),t.query&&!e.query&&(e.query=t.queryKey),h.socket(t.path,e)}Object.assign(R,{Manager:U,Socket:ie,io:R,connect:R});const ns=Object.freeze(Object.defineProperty({__proto__:null,Fetch:Kt,Manager:U,NodeWebSocket:G,NodeXHR:Q,Socket:ie,WebSocket:G,WebTransport:Ae,XHR:Q,connect:R,default:R,io:R,protocol:Se},Symbol.toStringTag,{value:"Module"}));return dt});
|