@enegelai/bot-widget 1.14.0 → 1.14.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/dist/enegelaibot.umd.js +5 -5
- package/dist/index.es.js +206 -195
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -22,7 +22,7 @@ import "@shoelace-style/shoelace/dist/components/alert/alert.js";
|
|
|
22
22
|
import "@shoelace-style/shoelace/dist/components/progress-bar/progress-bar.js";
|
|
23
23
|
import "@shoelace-style/shoelace/dist/components/badge/badge.js";
|
|
24
24
|
import { repeat as He } from "lit/directives/repeat.js";
|
|
25
|
-
import { until as
|
|
25
|
+
import { until as zt } from "lit-html/directives/until.js";
|
|
26
26
|
import fi from "markdown-it";
|
|
27
27
|
import bi from "markdown-it-link-attributes";
|
|
28
28
|
import Et from "highlight.js";
|
|
@@ -120,7 +120,7 @@ const ui = (s, e) => e !== s && (e === e || s === s), Gt = class Gt extends Even
|
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
Gt.finalized = !1;
|
|
123
|
-
let
|
|
123
|
+
let Pt = Gt;
|
|
124
124
|
class Ve {
|
|
125
125
|
constructor(e, t, a) {
|
|
126
126
|
this.host = e, this.state = t, this.callback = a || (() => this.host.requestUpdate()), this.host.addController(this);
|
|
@@ -195,8 +195,8 @@ function yi() {
|
|
|
195
195
|
"warn",
|
|
196
196
|
"error"
|
|
197
197
|
], o = {}, c = null;
|
|
198
|
-
function p(A,
|
|
199
|
-
var I = A[
|
|
198
|
+
function p(A, P) {
|
|
199
|
+
var I = A[P];
|
|
200
200
|
if (typeof I.bind == "function")
|
|
201
201
|
return I.bind(A);
|
|
202
202
|
try {
|
|
@@ -214,9 +214,9 @@ function yi() {
|
|
|
214
214
|
return A === "debug" && (A = "log"), typeof console === t ? !1 : A === "trace" && a ? v : console[A] !== void 0 ? p(console, A) : console.log !== void 0 ? p(console, "log") : e;
|
|
215
215
|
}
|
|
216
216
|
function S() {
|
|
217
|
-
for (var A = this.getLevel(),
|
|
218
|
-
var I = n[
|
|
219
|
-
this[I] =
|
|
217
|
+
for (var A = this.getLevel(), P = 0; P < n.length; P++) {
|
|
218
|
+
var I = n[P];
|
|
219
|
+
this[I] = P < A ? e : this.methodFactory(I, A, this.name);
|
|
220
220
|
}
|
|
221
221
|
if (this.log = this.debug, typeof console === t && A < this.levels.SILENT)
|
|
222
222
|
return "No console available for logging";
|
|
@@ -226,10 +226,10 @@ function yi() {
|
|
|
226
226
|
typeof console !== t && (S.call(this), this[A].apply(this, arguments));
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
|
-
function _(A,
|
|
229
|
+
function _(A, P, I) {
|
|
230
230
|
return y(A) || w.apply(this, arguments);
|
|
231
231
|
}
|
|
232
|
-
function L(A,
|
|
232
|
+
function L(A, P) {
|
|
233
233
|
var I = this, be, Q, ie, ee = "loglevel";
|
|
234
234
|
typeof A == "string" ? ee += ":" + A : typeof A == "symbol" && (ee = void 0);
|
|
235
235
|
function It(D) {
|
|
@@ -289,7 +289,7 @@ function yi() {
|
|
|
289
289
|
WARN: 3,
|
|
290
290
|
ERROR: 4,
|
|
291
291
|
SILENT: 5
|
|
292
|
-
}, I.methodFactory =
|
|
292
|
+
}, I.methodFactory = P || _, I.getLevel = function() {
|
|
293
293
|
return ie ?? Q ?? be;
|
|
294
294
|
}, I.setLevel = function(D, W) {
|
|
295
295
|
return ie = Se(D), W !== !1 && It(ie), S.call(I);
|
|
@@ -311,12 +311,12 @@ function yi() {
|
|
|
311
311
|
var j = We();
|
|
312
312
|
j != null && (ie = Se(j)), S.call(I);
|
|
313
313
|
}
|
|
314
|
-
c = new L(), c.getLogger = function(
|
|
315
|
-
if (typeof
|
|
314
|
+
c = new L(), c.getLogger = function(P) {
|
|
315
|
+
if (typeof P != "symbol" && typeof P != "string" || P === "")
|
|
316
316
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
317
|
-
var I = o[
|
|
318
|
-
return I || (I = o[
|
|
319
|
-
|
|
317
|
+
var I = o[P];
|
|
318
|
+
return I || (I = o[P] = new L(
|
|
319
|
+
P,
|
|
320
320
|
c.methodFactory
|
|
321
321
|
)), I;
|
|
322
322
|
};
|
|
@@ -1008,13 +1008,13 @@ const oa = [
|
|
|
1008
1008
|
"A",
|
|
1009
1009
|
"A#",
|
|
1010
1010
|
"B"
|
|
1011
|
-
],
|
|
1011
|
+
], Pe = [], Vt = [];
|
|
1012
1012
|
for (let s = 1; s <= 8; s++)
|
|
1013
1013
|
for (let e = 0; e < oa.length; e++) {
|
|
1014
1014
|
const t = oa[e];
|
|
1015
|
-
|
|
1015
|
+
Pe.push(t / Math.pow(2, 8 - s)), Vt.push(Ei[e] + s);
|
|
1016
1016
|
}
|
|
1017
|
-
const mt = [32, 2e3], ca =
|
|
1017
|
+
const mt = [32, 2e3], ca = Pe.filter((s, e) => Pe[e] > mt[0] && Pe[e] < mt[1]), Ti = Vt.filter((s, e) => Pe[e] > mt[0] && Pe[e] < mt[1]);
|
|
1018
1018
|
class st {
|
|
1019
1019
|
/**
|
|
1020
1020
|
* Retrieves frequency domain data from an AnalyserNode adjusted to a decibel range
|
|
@@ -1032,16 +1032,16 @@ class st {
|
|
|
1032
1032
|
const p = t / 2, v = 1 / a.length * p;
|
|
1033
1033
|
let y, S, w;
|
|
1034
1034
|
if (n === "music" || n === "voice") {
|
|
1035
|
-
const E = n === "voice" ? ca :
|
|
1036
|
-
for (let
|
|
1037
|
-
const I =
|
|
1035
|
+
const E = n === "voice" ? ca : Pe, A = Array(E.length).fill(o);
|
|
1036
|
+
for (let P = 0; P < a.length; P++) {
|
|
1037
|
+
const I = P * v, be = a[P];
|
|
1038
1038
|
for (let Q = E.length - 1; Q >= 0; Q--)
|
|
1039
1039
|
if (I > E[Q]) {
|
|
1040
1040
|
A[Q] = Math.max(A[Q], be);
|
|
1041
1041
|
break;
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
|
-
y = A, S = n === "voice" ? ca :
|
|
1044
|
+
y = A, S = n === "voice" ? ca : Pe, w = n === "voice" ? Ti : Vt;
|
|
1045
1045
|
} else
|
|
1046
1046
|
y = Array.from(a), S = y.map((E, A) => v * A), w = S.map((E) => `${E.toFixed(2)} Hz`);
|
|
1047
1047
|
const _ = y.map((E) => Math.max(
|
|
@@ -1206,9 +1206,9 @@ class StreamProcessor extends AudioWorkletProcessor {
|
|
|
1206
1206
|
}
|
|
1207
1207
|
|
|
1208
1208
|
registerProcessor('stream_processor', StreamProcessor);
|
|
1209
|
-
`,
|
|
1209
|
+
`, zi = new Blob([Li], {
|
|
1210
1210
|
type: "application/javascript"
|
|
1211
|
-
}),
|
|
1211
|
+
}), Pi = URL.createObjectURL(zi), qi = Pi;
|
|
1212
1212
|
class Aa {
|
|
1213
1213
|
/**
|
|
1214
1214
|
* Creates a new WavStreamPlayer instance
|
|
@@ -1927,12 +1927,12 @@ class Hi {
|
|
|
1927
1927
|
if (L <= 0)
|
|
1928
1928
|
return this._float32ToInt16(t);
|
|
1929
1929
|
for (let E = 0; E <= L; E += v) {
|
|
1930
|
-
let A = 0,
|
|
1930
|
+
let A = 0, P = 0;
|
|
1931
1931
|
for (let Q = 0; Q < y; Q++) {
|
|
1932
1932
|
const ie = o[Q], ee = _[E + Q];
|
|
1933
|
-
A += ie * ee,
|
|
1933
|
+
A += ie * ee, P += ee * ee;
|
|
1934
1934
|
}
|
|
1935
|
-
const I = S * (Math.sqrt(
|
|
1935
|
+
const I = S * (Math.sqrt(P) + 1e-12), be = I > 0 ? A / I : 0;
|
|
1936
1936
|
if (be > w && (w = be), w > Math.min(0.98, this.threshold + 0.25)) break;
|
|
1937
1937
|
}
|
|
1938
1938
|
if (w >= this.threshold) {
|
|
@@ -2081,8 +2081,8 @@ class ji {
|
|
|
2081
2081
|
for (let y = 0; y <= o; y += p) {
|
|
2082
2082
|
let S = 0, w = 0;
|
|
2083
2083
|
for (let E = 0; E < a; E++) {
|
|
2084
|
-
const A = t[E],
|
|
2085
|
-
S += A *
|
|
2084
|
+
const A = t[E], P = n[y + E];
|
|
2085
|
+
S += A * P, w += P * P;
|
|
2086
2086
|
}
|
|
2087
2087
|
const _ = c * (Math.sqrt(w) + 1e-12), L = _ > 0 ? S / _ : 0;
|
|
2088
2088
|
if (L > v && (v = L), v > Math.min(0.98, this.high + 0.25)) break;
|
|
@@ -2352,7 +2352,7 @@ var Xi = Object.defineProperty, R = (s, e, t, a) => {
|
|
|
2352
2352
|
const T = Ne.noConflict();
|
|
2353
2353
|
T.setLevel("info");
|
|
2354
2354
|
const ne = "cb_";
|
|
2355
|
-
class q extends
|
|
2355
|
+
class q extends Pt {
|
|
2356
2356
|
constructor() {
|
|
2357
2357
|
super(...arguments), this.actionIdCounter = 0, this.currentLoadContext = {}, this.prefilledFormValues = {}, this.wsClient = null, this.webAudioProcessor = null, this.webAudioTrackId = null, this.webAudioCurrentMark = null, this.replyMessage = null, this.streamingResponseInProgress = !1, this.streamingResponseLastText = null, this.streamingResponseBuffer = null, this.streamingResponseTagStartPos = 0, this.streamingResponseCurrentTag = null;
|
|
2358
2358
|
}
|
|
@@ -2648,118 +2648,119 @@ class q extends zt {
|
|
|
2648
2648
|
this.typingActive ? e && ["message", "message-chunk", "media", "typing-stopped"].includes(e?.type) && (this.typingActive = !1, T.info("c7o: typing stopped")) : e && e?.type === "typing" && (this.typingActive = !0, T.info("c7o: typing started"));
|
|
2649
2649
|
}
|
|
2650
2650
|
handleWscMessage(e) {
|
|
2651
|
-
if (e?.type
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2651
|
+
if (e?.type === "ack")
|
|
2652
|
+
return;
|
|
2653
|
+
switch (this.updateTypingState(e), ["message", "message-chunk", "agent-connected", "agent-disconnected", "typing", "typing-stopped", "form", "actions"].includes(e?.type) && (this.lastConversationUpdate = Date.now()), e?.type) {
|
|
2654
|
+
case "message": {
|
|
2655
|
+
if (e?.author === "user") {
|
|
2656
|
+
const a = {
|
|
2657
|
+
id: e?.id || null,
|
|
2658
|
+
type: "text",
|
|
2659
|
+
author: "user",
|
|
2660
|
+
data: {
|
|
2661
|
+
text: e.text
|
|
2662
|
+
}
|
|
2663
|
+
};
|
|
2664
|
+
this.replyMessage ? this.insertMessage(a, -1) : this.addMessage(a);
|
|
2665
|
+
} else {
|
|
2666
|
+
if (this.replyMessage)
|
|
2667
|
+
"userName" in e && (this.replyMessage.data.userName = e.userName), "userAvatar" in e && (this.replyMessage.data.userAvatar = e.userAvatar), this.streamingResponseInProgress ? (this.finishStreamingResponse(e.text), this.streamingResponseInProgress = !1) : (this.replyMessage.data.text = e.text, this.updateMessage(this.replyMessage, "")), this.replyMessage = null;
|
|
2668
|
+
else {
|
|
2669
|
+
const a = {
|
|
2656
2670
|
id: e?.id || null,
|
|
2657
2671
|
type: "text",
|
|
2658
|
-
author: "
|
|
2672
|
+
author: "assistant",
|
|
2659
2673
|
data: {
|
|
2660
2674
|
text: e.text
|
|
2661
2675
|
}
|
|
2662
2676
|
};
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
"userName" in e && (this.replyMessage.data.userName = e.userName), "userAvatar" in e && (this.replyMessage.data.userAvatar = e.userAvatar), this.streamingResponseInProgress ? (this.finishStreamingResponse(e.text), this.streamingResponseInProgress = !1) : (this.replyMessage.data.text = e.text, this.updateMessage(this.replyMessage, "")), this.replyMessage = null;
|
|
2667
|
-
else {
|
|
2668
|
-
const t = {
|
|
2669
|
-
id: e?.id || null,
|
|
2670
|
-
type: "text",
|
|
2671
|
-
author: "assistant",
|
|
2672
|
-
data: {
|
|
2673
|
-
text: e.text
|
|
2674
|
-
}
|
|
2675
|
-
};
|
|
2676
|
-
"userName" in e && (t.data.userName = e.userName), "userAvatar" in e && (t.data.userAvatar = e.userAvatar);
|
|
2677
|
-
const a = this.formatMessage(t);
|
|
2678
|
-
this.messages = this.messages.concat([a]);
|
|
2679
|
-
}
|
|
2680
|
-
this.open || (this.unreadMessages++, this.playAudioNotification());
|
|
2677
|
+
"userName" in e && (a.data.userName = e.userName), "userAvatar" in e && (a.data.userAvatar = e.userAvatar);
|
|
2678
|
+
const n = this.formatMessage(a);
|
|
2679
|
+
this.messages = this.messages.concat([n]);
|
|
2681
2680
|
}
|
|
2682
|
-
|
|
2683
|
-
}
|
|
2684
|
-
case "message-chunk": {
|
|
2685
|
-
e.text && this.processStreamingResponse(e.text);
|
|
2686
|
-
break;
|
|
2687
|
-
}
|
|
2688
|
-
// TODO Instead of "thinking" message, use state flag "typing" and show special thinking indicator in the message-list component
|
|
2689
|
-
// so we can avoid adding/removing "reply" message for typing start / stop
|
|
2690
|
-
case "typing": {
|
|
2691
|
-
this.replyMessage || (this.replyMessage = {
|
|
2692
|
-
id: e?.id || null,
|
|
2693
|
-
author: "assistant",
|
|
2694
|
-
type: "text",
|
|
2695
|
-
isThinking: !0,
|
|
2696
|
-
data: {
|
|
2697
|
-
text: ""
|
|
2698
|
-
}
|
|
2699
|
-
}, this.addMessage(this.replyMessage));
|
|
2700
|
-
break;
|
|
2701
|
-
}
|
|
2702
|
-
case "typing-stopped": {
|
|
2703
|
-
this.replyMessage && typeof this.replyMessage.id == "string" && this.replyMessage.isThinking && (this.removeMessage(this.replyMessage.id), this.replyMessage = null);
|
|
2704
|
-
break;
|
|
2705
|
-
}
|
|
2706
|
-
case "agent-connected": {
|
|
2707
|
-
this.addMessage({
|
|
2708
|
-
id: e?.id || null,
|
|
2709
|
-
author: "assistant",
|
|
2710
|
-
type: "text",
|
|
2711
|
-
data: {
|
|
2712
|
-
text: "_Joined chat_",
|
|
2713
|
-
...e.userName && { userName: e.userName },
|
|
2714
|
-
...e.userAvatar && { userAvatar: e.userAvatar }
|
|
2715
|
-
}
|
|
2716
|
-
});
|
|
2717
|
-
break;
|
|
2718
|
-
}
|
|
2719
|
-
case "agent-disconnected": {
|
|
2720
|
-
this.addMessage({
|
|
2721
|
-
id: e?.id || null,
|
|
2722
|
-
author: "assistant",
|
|
2723
|
-
type: "text",
|
|
2724
|
-
data: {
|
|
2725
|
-
text: "_Left chat_",
|
|
2726
|
-
...e.userName && { userName: e.userName },
|
|
2727
|
-
...e.userAvatar && { userAvatar: e.userAvatar }
|
|
2728
|
-
}
|
|
2729
|
-
});
|
|
2730
|
-
break;
|
|
2681
|
+
this.open || (this.unreadMessages++, this.playAudioNotification());
|
|
2731
2682
|
}
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2683
|
+
break;
|
|
2684
|
+
}
|
|
2685
|
+
case "message-chunk": {
|
|
2686
|
+
e.text && this.processStreamingResponse(e.text);
|
|
2687
|
+
break;
|
|
2688
|
+
}
|
|
2689
|
+
// TODO Instead of "thinking" message, use state flag "typing" and show special thinking indicator in the message-list component
|
|
2690
|
+
// so we can avoid adding/removing "reply" message for typing start / stop
|
|
2691
|
+
case "typing": {
|
|
2692
|
+
this.replyMessage || (this.replyMessage = {
|
|
2693
|
+
id: e?.id || null,
|
|
2694
|
+
author: "assistant",
|
|
2695
|
+
type: "text",
|
|
2696
|
+
isThinking: !0,
|
|
2697
|
+
data: {
|
|
2698
|
+
text: ""
|
|
2738
2699
|
}
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
}
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2700
|
+
}, this.addMessage(this.replyMessage));
|
|
2701
|
+
break;
|
|
2702
|
+
}
|
|
2703
|
+
case "typing-stopped": {
|
|
2704
|
+
this.replyMessage && typeof this.replyMessage.id == "string" && this.replyMessage.isThinking && (this.removeMessage(this.replyMessage.id), this.replyMessage = null);
|
|
2705
|
+
break;
|
|
2706
|
+
}
|
|
2707
|
+
case "agent-connected": {
|
|
2708
|
+
this.addMessage({
|
|
2709
|
+
id: e?.id || null,
|
|
2710
|
+
author: "assistant",
|
|
2711
|
+
type: "text",
|
|
2712
|
+
data: {
|
|
2713
|
+
text: "_Joined chat_",
|
|
2714
|
+
...e.userName && { userName: e.userName },
|
|
2715
|
+
...e.userAvatar && { userAvatar: e.userAvatar }
|
|
2716
|
+
}
|
|
2717
|
+
});
|
|
2718
|
+
break;
|
|
2719
|
+
}
|
|
2720
|
+
case "agent-disconnected": {
|
|
2721
|
+
this.addMessage({
|
|
2722
|
+
id: e?.id || null,
|
|
2723
|
+
author: "assistant",
|
|
2724
|
+
type: "text",
|
|
2725
|
+
data: {
|
|
2726
|
+
text: "_Left chat_",
|
|
2727
|
+
...e.userName && { userName: e.userName },
|
|
2728
|
+
...e.userAvatar && { userAvatar: e.userAvatar }
|
|
2729
|
+
}
|
|
2730
|
+
});
|
|
2731
|
+
break;
|
|
2732
|
+
}
|
|
2733
|
+
//{"type":"agent-connected","author":"assistant","userName":"SF DEV ADMIN"}
|
|
2734
|
+
//{"type":"agent-disconnected","author":"assistant","userName":"SF DEV ADMIN"}
|
|
2735
|
+
case "form": {
|
|
2736
|
+
if (T.info("Got form:", e), this.replyMessage && this.replyMessage.id) {
|
|
2737
|
+
const a = this.replyMessage.data?.text || "";
|
|
2738
|
+
(this.replyMessage.isThinking || a.trim() === "") && (this.removeMessage(this.replyMessage.id), this.replyMessage = null);
|
|
2761
2739
|
}
|
|
2740
|
+
this.initForm(e.form);
|
|
2741
|
+
break;
|
|
2742
|
+
}
|
|
2743
|
+
case "actions": {
|
|
2744
|
+
this.addActions(e?.actions || []);
|
|
2745
|
+
break;
|
|
2762
2746
|
}
|
|
2747
|
+
// Multi-Modal // //////////////////////
|
|
2748
|
+
case "media": {
|
|
2749
|
+
this.handleMediaReceived(e).catch((a) => {
|
|
2750
|
+
});
|
|
2751
|
+
break;
|
|
2752
|
+
}
|
|
2753
|
+
case "mediaClear": {
|
|
2754
|
+
this.handleMediaClear(e).catch((a) => {
|
|
2755
|
+
});
|
|
2756
|
+
break;
|
|
2757
|
+
}
|
|
2758
|
+
case "mediaMark": {
|
|
2759
|
+
this.handleMediaMark(e).catch((a) => {
|
|
2760
|
+
});
|
|
2761
|
+
break;
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2763
2764
|
}
|
|
2764
2765
|
processStreamingResponseTagBr() {
|
|
2765
2766
|
if (!this.streamingResponseBuffer || !this.replyMessage || this.streamingResponseBuffer.length < this.streamingResponseTagStartPos + 4)
|
|
@@ -3301,6 +3302,13 @@ var Zi = Object.defineProperty, Ji = (s, e, t, a) => {
|
|
|
3301
3302
|
di("system", {
|
|
3302
3303
|
resolver: (s) => ""
|
|
3303
3304
|
});
|
|
3305
|
+
(() => {
|
|
3306
|
+
try {
|
|
3307
|
+
return new CustomEvent("t", { composed: !0 }).composed === !0;
|
|
3308
|
+
} catch {
|
|
3309
|
+
return !1;
|
|
3310
|
+
}
|
|
3311
|
+
})();
|
|
3304
3312
|
class ae extends At {
|
|
3305
3313
|
constructor() {
|
|
3306
3314
|
super(...arguments), this.lang = "en";
|
|
@@ -3313,7 +3321,7 @@ class ae extends At {
|
|
|
3313
3321
|
detail: {},
|
|
3314
3322
|
...t
|
|
3315
3323
|
});
|
|
3316
|
-
return
|
|
3324
|
+
return window.dispatchEvent(a), a;
|
|
3317
3325
|
}
|
|
3318
3326
|
}
|
|
3319
3327
|
Ji([
|
|
@@ -3721,18 +3729,18 @@ function rs() {
|
|
|
3721
3729
|
}
|
|
3722
3730
|
function w(i) {
|
|
3723
3731
|
var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, l = r.onElement, d = r.withCallback, f = r.avoidDuplicate, g = f === void 0 || f, h = r.once, m = h !== void 0 && h, C = r.useCapture, k = C !== void 0 && C, M = arguments.length > 2 ? arguments[2] : void 0, $ = l || [];
|
|
3724
|
-
function
|
|
3725
|
-
j(d) && d.call(M, B, this), m &&
|
|
3732
|
+
function z(B) {
|
|
3733
|
+
j(d) && d.call(M, B, this), m && z.destroy();
|
|
3726
3734
|
}
|
|
3727
|
-
return D($) && ($ = document.querySelectorAll($)),
|
|
3735
|
+
return D($) && ($ = document.querySelectorAll($)), z.destroy = function() {
|
|
3728
3736
|
y($, function(B) {
|
|
3729
|
-
var F = S(B, i,
|
|
3730
|
-
F.found && F.all.splice(F.evt, 1), B.removeEventListener && B.removeEventListener(i,
|
|
3737
|
+
var F = S(B, i, z);
|
|
3738
|
+
F.found && F.all.splice(F.evt, 1), B.removeEventListener && B.removeEventListener(i, z, k);
|
|
3731
3739
|
});
|
|
3732
3740
|
}, y($, function(B) {
|
|
3733
|
-
var F = S(B, i,
|
|
3734
|
-
(B.addEventListener && g && !F.found || !g) && (B.addEventListener(i,
|
|
3735
|
-
}),
|
|
3741
|
+
var F = S(B, i, z);
|
|
3742
|
+
(B.addEventListener && g && !F.found || !g) && (B.addEventListener(i, z, k), F.all.push({ eventName: i, fn: z }));
|
|
3743
|
+
}), z;
|
|
3736
3744
|
}
|
|
3737
3745
|
function _(i, r) {
|
|
3738
3746
|
y(r.split(" "), function(l) {
|
|
@@ -3753,7 +3761,7 @@ function rs() {
|
|
|
3753
3761
|
if (typeof i.matches == "function" ? i.matches(r) : i.msMatchesSelector(r)) return i;
|
|
3754
3762
|
}
|
|
3755
3763
|
}
|
|
3756
|
-
function
|
|
3764
|
+
function P(i) {
|
|
3757
3765
|
var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", l = arguments.length > 2 && arguments[2] !== void 0 && arguments[2];
|
|
3758
3766
|
if (!i || r === "") return !1;
|
|
3759
3767
|
if (r === "none") return j(l) && l(), !1;
|
|
@@ -3959,12 +3967,12 @@ function rs() {
|
|
|
3959
3967
|
var r = this, l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
3960
3968
|
t(this, i);
|
|
3961
3969
|
var d = l.dragEl, f = l.toleranceX, g = f === void 0 ? 40 : f, h = l.toleranceY, m = h === void 0 ? 65 : h, C = l.slide, k = C === void 0 ? null : C, M = l.instance, $ = M === void 0 ? null : M;
|
|
3962
|
-
this.el = d, this.active = !1, this.dragging = !1, this.currentX = null, this.currentY = null, this.initialX = null, this.initialY = null, this.xOffset = 0, this.yOffset = 0, this.direction = null, this.lastDirection = null, this.toleranceX = g, this.toleranceY = m, this.toleranceReached = !1, this.dragContainer = this.el, this.slide = k, this.instance = $, this.el.addEventListener("mousedown", function(
|
|
3963
|
-
return r.dragStart(
|
|
3964
|
-
}, !1), this.el.addEventListener("mouseup", function(
|
|
3965
|
-
return r.dragEnd(
|
|
3966
|
-
}, !1), this.el.addEventListener("mousemove", function(
|
|
3967
|
-
return r.drag(
|
|
3970
|
+
this.el = d, this.active = !1, this.dragging = !1, this.currentX = null, this.currentY = null, this.initialX = null, this.initialY = null, this.xOffset = 0, this.yOffset = 0, this.direction = null, this.lastDirection = null, this.toleranceX = g, this.toleranceY = m, this.toleranceReached = !1, this.dragContainer = this.el, this.slide = k, this.instance = $, this.el.addEventListener("mousedown", function(z) {
|
|
3971
|
+
return r.dragStart(z);
|
|
3972
|
+
}, !1), this.el.addEventListener("mouseup", function(z) {
|
|
3973
|
+
return r.dragEnd(z);
|
|
3974
|
+
}, !1), this.el.addEventListener("mousemove", function(z) {
|
|
3975
|
+
return r.drag(z);
|
|
3968
3976
|
}, !1);
|
|
3969
3977
|
}, [{ key: "dragStart", value: function(i) {
|
|
3970
3978
|
if (this.slide.classList.contains("zoomed")) this.active = !1;
|
|
@@ -4018,14 +4026,14 @@ function rs() {
|
|
|
4018
4026
|
_(g, "gvideo-container"), m.insertBefore(ie('<div class="gvideo-wrapper"></div>'), m.firstChild);
|
|
4019
4027
|
var k = i.querySelector(".gvideo-wrapper");
|
|
4020
4028
|
nt(this.settings.plyr.css, "Plyr");
|
|
4021
|
-
var M = r.href, $ = r?.videoProvider,
|
|
4029
|
+
var M = r.href, $ = r?.videoProvider, z = !1;
|
|
4022
4030
|
m.style.maxWidth = r.width, nt(this.settings.plyr.js, "Plyr", function() {
|
|
4023
4031
|
if (!$ && M.match(/vimeo\.com\/([0-9]*)/) && ($ = "vimeo"), !$ && (M.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || M.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || M.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/) || M.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/)) && ($ = "youtube"), $ === "local" || !$) {
|
|
4024
4032
|
$ = "local";
|
|
4025
4033
|
var B = '<video id="' + h + '" ';
|
|
4026
|
-
B += 'style="background:#000; max-width: '.concat(r.width, ';" '), B += 'preload="metadata" ', B += 'x-webkit-airplay="allow" ', B += "playsinline ", B += "controls ", B += 'class="gvideo-local">', B += '<source src="'.concat(M, '">'),
|
|
4034
|
+
B += 'style="background:#000; max-width: '.concat(r.width, ';" '), B += 'preload="metadata" ', B += 'x-webkit-airplay="allow" ', B += "playsinline ", B += "controls ", B += 'class="gvideo-local">', B += '<source src="'.concat(M, '">'), z = ie(B += "</video>");
|
|
4027
4035
|
}
|
|
4028
|
-
var F =
|
|
4036
|
+
var F = z || ie('<div id="'.concat(h, '" data-plyr-provider="').concat($, '" data-plyr-embed-id="').concat(M, '"></div>'));
|
|
4029
4037
|
_(k, "".concat($, "-video gvideo")), k.appendChild(F), k.setAttribute("data-id", h), k.setAttribute("data-index", l);
|
|
4030
4038
|
var G = K(f.settings.plyr, "config") ? f.settings.plyr.config : {}, he = new Plyr("#" + h, G);
|
|
4031
4039
|
he.on("ready", function(fe) {
|
|
@@ -4055,8 +4063,8 @@ function rs() {
|
|
|
4055
4063
|
$.style.height = r.height, $.style.maxWidth = r.width, _($, "ginlined-content"), f = $;
|
|
4056
4064
|
}
|
|
4057
4065
|
if (!f) return console.error("Unable to append inline slide content", r), !1;
|
|
4058
|
-
h.style.height = r.height, h.style.width = r.width, h.appendChild(f), this.events["inlineclose" + m] = w("click", { onElement: h.querySelectorAll(".gtrigger-close"), withCallback: function(
|
|
4059
|
-
|
|
4066
|
+
h.style.height = r.height, h.style.width = r.width, h.appendChild(f), this.events["inlineclose" + m] = w("click", { onElement: h.querySelectorAll(".gtrigger-close"), withCallback: function(z) {
|
|
4067
|
+
z.preventDefault(), g.close();
|
|
4060
4068
|
} }), j(d) && d();
|
|
4061
4069
|
}
|
|
4062
4070
|
function Ja(i, r, l, d) {
|
|
@@ -4117,8 +4125,8 @@ function rs() {
|
|
|
4117
4125
|
$ && (d.description = $);
|
|
4118
4126
|
}
|
|
4119
4127
|
if (!d.description) {
|
|
4120
|
-
var
|
|
4121
|
-
|
|
4128
|
+
var z = i.querySelector(".glightbox-desc");
|
|
4129
|
+
z && (d.description = z.innerHTML);
|
|
4122
4130
|
}
|
|
4123
4131
|
return this.setSize(d, r, i), this.slideConfig = d, d;
|
|
4124
4132
|
} }, { key: "setSize", value: function(i, r) {
|
|
@@ -4135,18 +4143,18 @@ function rs() {
|
|
|
4135
4143
|
if (E(r, "loaded")) return !1;
|
|
4136
4144
|
var d = this.instance.settings, f = this.slideConfig, g = Se();
|
|
4137
4145
|
j(d.beforeSlideLoad) && d.beforeSlideLoad({ index: this.index, slide: r, player: !1 });
|
|
4138
|
-
var h = f.type, m = f.descPosition, C = r.querySelector(".gslide-media"), k = r.querySelector(".gslide-title"), M = r.querySelector(".gslide-desc"), $ = r.querySelector(".gdesc-inner"),
|
|
4139
|
-
if (j(d.afterSlideLoad) && (
|
|
4146
|
+
var h = f.type, m = f.descPosition, C = r.querySelector(".gslide-media"), k = r.querySelector(".gslide-title"), M = r.querySelector(".gslide-desc"), $ = r.querySelector(".gdesc-inner"), z = l, B = "gSlideTitle_" + this.index, F = "gSlideDesc_" + this.index;
|
|
4147
|
+
if (j(d.afterSlideLoad) && (z = function() {
|
|
4140
4148
|
j(l) && l(), d.afterSlideLoad({ index: i.index, slide: r, player: i.instance.getSlidePlayerInstance(i.index) });
|
|
4141
4149
|
}), f.title == "" && f.description == "" ? $ && $.parentNode.parentNode.removeChild($.parentNode) : (k && f.title !== "" ? (k.id = B, k.innerHTML = f.title) : k.parentNode.removeChild(k), M && f.description !== "" ? (M.id = F, g && d.moreLength > 0 ? (f.smallDescription = this.slideShortDesc(f.description, d.moreLength, d.moreText), M.innerHTML = f.smallDescription, this.descriptionEvents(M, f)) : M.innerHTML = f.description) : M.parentNode.removeChild(M), _(C.parentNode, "desc-".concat(m)), _($.parentNode, "description-".concat(m))), _(C, "gslide-".concat(h)), _(r, "loaded"), h !== "video") {
|
|
4142
|
-
if (h !== "external") return h === "inline" ? (Za.apply(this.instance, [r, f, this.index,
|
|
4150
|
+
if (h !== "external") return h === "inline" ? (Za.apply(this.instance, [r, f, this.index, z]), void (f.draggable && new Kt({ dragEl: r.querySelector(".gslide-inline"), toleranceX: d.dragToleranceX, toleranceY: d.dragToleranceY, slide: r, instance: this.instance }))) : void (h !== "image" ? j(z) && z() : Xa(r, f, this.index, function() {
|
|
4143
4151
|
var G = r.querySelector("img");
|
|
4144
4152
|
f.draggable && new Kt({ dragEl: G, toleranceX: d.dragToleranceX, toleranceY: d.dragToleranceY, slide: r, instance: i.instance }), f.zoomable && G.naturalWidth > G.offsetWidth && (_(G, "zoomable"), new Ya(G, r, function() {
|
|
4145
4153
|
i.instance.resize();
|
|
4146
|
-
})), j(
|
|
4154
|
+
})), j(z) && z();
|
|
4147
4155
|
}));
|
|
4148
|
-
Ja.apply(this, [r, f, this.index,
|
|
4149
|
-
} else Ga.apply(this.instance, [r, f, this.index,
|
|
4156
|
+
Ja.apply(this, [r, f, this.index, z]);
|
|
4157
|
+
} else Ga.apply(this.instance, [r, f, this.index, z]);
|
|
4150
4158
|
} }, { key: "slideShortDesc", value: function(i) {
|
|
4151
4159
|
var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 50, l = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], d = document.createElement("div");
|
|
4152
4160
|
d.innerHTML = i;
|
|
@@ -4283,7 +4291,7 @@ function rs() {
|
|
|
4283
4291
|
}
|
|
4284
4292
|
function ai(i) {
|
|
4285
4293
|
if (i.events.hasOwnProperty("touch")) return !1;
|
|
4286
|
-
var r, l, d, f = ee(), g = f.width, h = f.height, m = !1, C = null, k = null, M = null, $ = !1,
|
|
4294
|
+
var r, l, d, f = ee(), g = f.width, h = f.height, m = !1, C = null, k = null, M = null, $ = !1, z = 1, B = 1, F = !1, G = !1, he = null, fe = null, Ae = null, se = null, Me = 0, Ie = 0, Ke = !1, Ye = !1, ve = {}, we = {}, ia = 0, sa = 0, ni = document.getElementById("glightbox-slider"), lt = document.querySelector(".goverlay"), ri = new ti(ni, { touchStart: function(U) {
|
|
4287
4295
|
if (m = !0, (E(U.targetTouches[0].target, "ginner-container") || A(U.targetTouches[0].target, ".gslide-desc") || U.targetTouches[0].target.nodeName.toLowerCase() == "a") && (m = !1), A(U.targetTouches[0].target, ".gslide-inline") && !E(U.targetTouches[0].target.parentNode, "gslide-inline") && (m = !1), m) {
|
|
4288
4296
|
if (we = U.targetTouches[0], ve.pageX = U.targetTouches[0].pageX, ve.pageY = U.targetTouches[0].pageY, ia = U.targetTouches[0].clientX, sa = U.targetTouches[0].clientY, C = i.activeSlide, k = C.querySelector(".gslide-media"), d = C.querySelector(".gslide-inline"), M = null, E(k, "gslide-image") && (M = k.querySelector("img")), (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) > 769 && (k = C.querySelector(".ginner-container")), L(lt, "greset"), U.pageX > 20 && U.pageX < window.innerWidth - 20) return;
|
|
4289
4297
|
U.preventDefault();
|
|
@@ -4295,8 +4303,8 @@ function rs() {
|
|
|
4295
4303
|
if (Math.abs(oe) <= 13) return !1;
|
|
4296
4304
|
}
|
|
4297
4305
|
$ = !0;
|
|
4298
|
-
var
|
|
4299
|
-
if (Math.abs(ci) > Math.abs(li) ? (Ke = !1, Ye = !0) : (Ye = !1, Ke = !0), r = we.pageX - ve.pageX, Me = 100 * r / g, l = we.pageY - ve.pageY, Ie = 100 * l / h, Ke && M && (
|
|
4306
|
+
var ze, dt = U.targetTouches[0].clientX, oi = U.targetTouches[0].clientY, ci = ia - dt, li = sa - oi;
|
|
4307
|
+
if (Math.abs(ci) > Math.abs(li) ? (Ke = !1, Ye = !0) : (Ye = !1, Ke = !0), r = we.pageX - ve.pageX, Me = 100 * r / g, l = we.pageY - ve.pageY, Ie = 100 * l / h, Ke && M && (ze = 1 - Math.abs(l) / h, lt.style.opacity = ze, i.settings.touchFollowAxis && (Me = 0)), Ye && (ze = 1 - Math.abs(r) / g, k.style.opacity = ze, i.settings.touchFollowAxis && (Ie = 0)), !M) return I(k, "translate3d(".concat(Me, "%, 0, 0)"));
|
|
4300
4308
|
I(k, "translate3d(".concat(Me, "%, ").concat(Ie, "%, 0)"));
|
|
4301
4309
|
}
|
|
4302
4310
|
}, touchEnd: function() {
|
|
@@ -4311,18 +4319,18 @@ function rs() {
|
|
|
4311
4319
|
F = !1;
|
|
4312
4320
|
}, 50);
|
|
4313
4321
|
}, multipointStart: function() {
|
|
4314
|
-
F = !0,
|
|
4322
|
+
F = !0, z = B || 1;
|
|
4315
4323
|
}, pinch: function(U) {
|
|
4316
4324
|
if (!M || $) return !1;
|
|
4317
|
-
F = !0, M.scaleX = M.scaleY =
|
|
4318
|
-
var oe =
|
|
4325
|
+
F = !0, M.scaleX = M.scaleY = z * U.zoom;
|
|
4326
|
+
var oe = z * U.zoom;
|
|
4319
4327
|
if (G = !0, oe <= 1) return G = !1, oe = 1, se = null, Ae = null, he = null, fe = null, void M.setAttribute("style", "");
|
|
4320
4328
|
oe > 4.5 && (oe = 4.5), M.style.transform = "scale3d(".concat(oe, ", ").concat(oe, ", 1)"), B = oe;
|
|
4321
4329
|
}, pressMove: function(U) {
|
|
4322
4330
|
if (G && !F) {
|
|
4323
|
-
var oe = we.pageX - ve.pageX,
|
|
4324
|
-
Ae && (oe += Ae), se && (
|
|
4325
|
-
var dt = "translate3d(".concat(oe, "px, ").concat(
|
|
4331
|
+
var oe = we.pageX - ve.pageX, ze = we.pageY - ve.pageY;
|
|
4332
|
+
Ae && (oe += Ae), se && (ze += se), he = oe, fe = ze;
|
|
4333
|
+
var dt = "translate3d(".concat(oe, "px, ").concat(ze, "px, 0)");
|
|
4326
4334
|
B && (dt += " scale3d(".concat(B, ", ").concat(B, ", 1)")), I(M, dt);
|
|
4327
4335
|
}
|
|
4328
4336
|
}, swipe: function(U) {
|
|
@@ -4379,7 +4387,7 @@ function rs() {
|
|
|
4379
4387
|
var d = i.getAttribute("data-gallery");
|
|
4380
4388
|
d && (this.fullElementsList = this.elements, this.elements = this.getGalleryElements(this.elements, d)), de(l) && (l = this.getElementIndex(i)) < 0 && (l = 0);
|
|
4381
4389
|
}
|
|
4382
|
-
rt(l) || (l = 0), this.build(),
|
|
4390
|
+
rt(l) || (l = 0), this.build(), P(this.overlay, this.settings.openEffect === "none" ? "none" : this.settings.cssEfects.fade.in);
|
|
4383
4391
|
var f = document.body, g = window.innerWidth - document.documentElement.clientWidth;
|
|
4384
4392
|
if (g > 0) {
|
|
4385
4393
|
var h = document.createElement("style");
|
|
@@ -4447,12 +4455,12 @@ function rs() {
|
|
|
4447
4455
|
r && (this.getActiveSlideIndex() == i && (i == this.elements.length - 1 ? this.prevSlide() : this.nextSlide()), r.parentNode.removeChild(r)), this.elements.splice(i, 1), this.trigger("slide_removed", i), j(this.settings.slideRemoved) && this.settings.slideRemoved(i);
|
|
4448
4456
|
} }, { key: "slideAnimateIn", value: function(i, r) {
|
|
4449
4457
|
var l = this, d = i.querySelector(".gslide-media"), f = i.querySelector(".gslide-description"), g = { index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, slideNode: this.prevActiveSlide, slideIndex: this.prevActiveSlide, slideConfig: de(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].slideConfig, trigger: de(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].node, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }, h = { index: this.index, slide: this.activeSlide, slideNode: this.activeSlide, slideConfig: this.elements[this.index].slideConfig, slideIndex: this.index, trigger: this.elements[this.index].node, player: this.getSlidePlayerInstance(this.index) };
|
|
4450
|
-
if (d.offsetWidth > 0 && f && (Q(f), f.style.display = ""), L(i, this.effectsClasses), r)
|
|
4458
|
+
if (d.offsetWidth > 0 && f && (Q(f), f.style.display = ""), L(i, this.effectsClasses), r) P(i, this.settings.cssEfects[this.settings.openEffect].in, function() {
|
|
4451
4459
|
l.settings.autoplayVideos && l.slidePlayerPlay(i), l.trigger("slide_changed", { prev: g, current: h }), j(l.settings.afterSlideChange) && l.settings.afterSlideChange.apply(l, [g, h]);
|
|
4452
4460
|
});
|
|
4453
4461
|
else {
|
|
4454
4462
|
var m = this.settings.slideEffect, C = m !== "none" ? this.settings.cssEfects[m].in : m;
|
|
4455
|
-
this.prevActiveSlideIndex > this.index && this.settings.slideEffect == "slide" && (C = this.settings.cssEfects.slideBack.in),
|
|
4463
|
+
this.prevActiveSlideIndex > this.index && this.settings.slideEffect == "slide" && (C = this.settings.cssEfects.slideBack.in), P(i, C, function() {
|
|
4456
4464
|
l.settings.autoplayVideos && l.slidePlayerPlay(i), l.trigger("slide_changed", { prev: g, current: h }), j(l.settings.afterSlideChange) && l.settings.afterSlideChange.apply(l, [g, h]);
|
|
4457
4465
|
});
|
|
4458
4466
|
}
|
|
@@ -4464,7 +4472,7 @@ function rs() {
|
|
|
4464
4472
|
var i = this.prevActiveSlide;
|
|
4465
4473
|
L(i, this.effectsClasses), _(i, "prev");
|
|
4466
4474
|
var r = this.settings.slideEffect, l = r !== "none" ? this.settings.cssEfects[r].out : r;
|
|
4467
|
-
this.slidePlayerPause(i), this.trigger("slide_before_change", { prev: { index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, slideNode: this.prevActiveSlide, slideIndex: this.prevActiveSlideIndex, slideConfig: de(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].slideConfig, trigger: de(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].node, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }, current: { index: this.index, slide: this.activeSlide, slideNode: this.activeSlide, slideIndex: this.index, slideConfig: this.elements[this.index].slideConfig, trigger: this.elements[this.index].node, player: this.getSlidePlayerInstance(this.index) } }), j(this.settings.beforeSlideChange) && this.settings.beforeSlideChange.apply(this, [{ index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }, { index: this.index, slide: this.activeSlide, player: this.getSlidePlayerInstance(this.index) }]), this.prevActiveSlideIndex > this.index && this.settings.slideEffect == "slide" && (l = this.settings.cssEfects.slideBack.out),
|
|
4475
|
+
this.slidePlayerPause(i), this.trigger("slide_before_change", { prev: { index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, slideNode: this.prevActiveSlide, slideIndex: this.prevActiveSlideIndex, slideConfig: de(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].slideConfig, trigger: de(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].node, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }, current: { index: this.index, slide: this.activeSlide, slideNode: this.activeSlide, slideIndex: this.index, slideConfig: this.elements[this.index].slideConfig, trigger: this.elements[this.index].node, player: this.getSlidePlayerInstance(this.index) } }), j(this.settings.beforeSlideChange) && this.settings.beforeSlideChange.apply(this, [{ index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }, { index: this.index, slide: this.activeSlide, player: this.getSlidePlayerInstance(this.index) }]), this.prevActiveSlideIndex > this.index && this.settings.slideEffect == "slide" && (l = this.settings.cssEfects.slideBack.out), P(i, l, function() {
|
|
4468
4476
|
var d = i.querySelector(".ginner-container"), f = i.querySelector(".gslide-media"), g = i.querySelector(".gslide-description");
|
|
4469
4477
|
d.style.transform = "", f.style.transform = "", L(f, "greset"), f.style.opacity = "", g && (g.style.opacity = ""), L(i, "prev");
|
|
4470
4478
|
});
|
|
@@ -4584,8 +4592,8 @@ function rs() {
|
|
|
4584
4592
|
if (f && (E(f, "description-bottom") || E(f, "description-top")) && !E(f, "gabsolute") && (m = !0), d) {
|
|
4585
4593
|
if (g <= 768) d.querySelector("img");
|
|
4586
4594
|
else if (m) {
|
|
4587
|
-
var C, k, M = f.offsetHeight, $ = d.querySelector("img"),
|
|
4588
|
-
|
|
4595
|
+
var C, k, M = f.offsetHeight, $ = d.querySelector("img"), z = (C = this.elements[this.index]) === null || C === void 0 ? void 0 : C.node, B = "100vh";
|
|
4596
|
+
z && (B = (k = z.getAttribute("data-height")) !== null && k !== void 0 ? k : B), $.setAttribute("style", "max-height: calc(".concat(B, " - ").concat(M, "px)")), f.setAttribute("style", "max-width: ".concat($.offsetWidth, "px;"));
|
|
4589
4597
|
}
|
|
4590
4598
|
}
|
|
4591
4599
|
if (l) {
|
|
@@ -4622,7 +4630,7 @@ function rs() {
|
|
|
4622
4630
|
if (this.closing) return !1;
|
|
4623
4631
|
this.closing = !0, this.slidePlayerPause(this.activeSlide), this.fullElementsList && (this.elements = this.fullElementsList), this.bodyHiddenChildElms.length && y(this.bodyHiddenChildElms, function(l) {
|
|
4624
4632
|
l.removeAttribute("aria-hidden");
|
|
4625
|
-
}), _(this.modal, "glightbox-closing"),
|
|
4633
|
+
}), _(this.modal, "glightbox-closing"), P(this.overlay, this.settings.openEffect == "none" ? "none" : this.settings.cssEfects.fade.out), P(this.activeSlide, this.settings.cssEfects[this.settings.closeEffect].out, function() {
|
|
4626
4634
|
if (i.activeSlide = null, i.prevActiveSlideIndex = null, i.prevActiveSlide = null, i.built = !1, i.events) {
|
|
4627
4635
|
for (var l in i.events) i.events.hasOwnProperty(l) && i.events[l].destroy();
|
|
4628
4636
|
i.events = null;
|
|
@@ -6497,7 +6505,7 @@ let Te = class extends ae {
|
|
|
6497
6505
|
() => u`<div class="assistant-message-user-name">${s.data.userName}</div>`,
|
|
6498
6506
|
() => null
|
|
6499
6507
|
)}
|
|
6500
|
-
${
|
|
6508
|
+
${zt(
|
|
6501
6509
|
this._getMessageText(s).then((e) => u`${e}`)
|
|
6502
6510
|
)}
|
|
6503
6511
|
</div>` : s.type === "file" ? u`${He(
|
|
@@ -6509,7 +6517,7 @@ let Te = class extends ae {
|
|
|
6509
6517
|
(e) => e.name,
|
|
6510
6518
|
(e) => u`<div>${e.name}</div>`
|
|
6511
6519
|
)}` : u`<div class="cb-message-text">
|
|
6512
|
-
${
|
|
6520
|
+
${zt(
|
|
6513
6521
|
Ot(s.data.text?.toString() || "").then((e) => u`${e}`)
|
|
6514
6522
|
)}
|
|
6515
6523
|
</div>`;
|
|
@@ -6654,7 +6662,7 @@ let pe = class extends ae {
|
|
|
6654
6662
|
return !b.setting.disclaimerMessage || !b.isConversationStart() ? null : u`
|
|
6655
6663
|
<details class="cb-disclaimer-wrapper" part="disclaimer-wrapper">
|
|
6656
6664
|
<summary class="cb-disclaimer-message" part="disclaimer-message">
|
|
6657
|
-
${
|
|
6665
|
+
${zt(
|
|
6658
6666
|
Ot(b.setting.disclaimerMessage).then((s) => u`${s}`)
|
|
6659
6667
|
)}
|
|
6660
6668
|
</summary>
|
|
@@ -6944,7 +6952,7 @@ ke([
|
|
|
6944
6952
|
pe = ke([
|
|
6945
6953
|
J("cb-message-list")
|
|
6946
6954
|
], pe);
|
|
6947
|
-
const
|
|
6955
|
+
const zs = Z`
|
|
6948
6956
|
${ye}
|
|
6949
6957
|
|
|
6950
6958
|
:host {
|
|
@@ -6986,11 +6994,11 @@ const Ps = Z`
|
|
|
6986
6994
|
align-items: center;
|
|
6987
6995
|
margin: 6px 2px;
|
|
6988
6996
|
}
|
|
6989
|
-
`,
|
|
6990
|
-
var
|
|
6997
|
+
`, za = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576zm6.787-8.201L1.591 6.602l4.339 2.76z"/></svg>', Pa = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M4.5 3a2.5 2.5 0 0 1 5 0v9a1.5 1.5 0 0 1-3 0V5a.5.5 0 0 1 1 0v7a.5.5 0 0 0 1 0V3a1.5 1.5 0 1 0-3 0v9a2.5 2.5 0 0 0 5 0V5a.5.5 0 0 1 1 0v7a3.5 3.5 0 1 1-7 0z"/></svg>', qa = '<svg viewBox="0 0 24 24" width="26px" height="26px" ><path fill="currentColor" d="M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3m5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72z"/></svg>', Wt = '<svg viewBox="0 0 24 24" width="26px" height="26px" ><path fill="currentColor" d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z"/></svg>';
|
|
6998
|
+
var Ps = Object.defineProperty, qs = Object.getOwnPropertyDescriptor, _e = (s, e, t, a) => {
|
|
6991
6999
|
for (var n = a > 1 ? void 0 : a ? qs(e, t) : e, o = s.length - 1, c; o >= 0; o--)
|
|
6992
7000
|
(c = s[o]) && (n = (a ? c(e, t, n) : c(n)) || n);
|
|
6993
|
-
return a && n &&
|
|
7001
|
+
return a && n && Ps(e, t, n), n;
|
|
6994
7002
|
};
|
|
6995
7003
|
let ge = class extends ae {
|
|
6996
7004
|
constructor() {
|
|
@@ -7066,7 +7074,7 @@ let ge = class extends ae {
|
|
|
7066
7074
|
${N(
|
|
7067
7075
|
b.setting.sendIconSvg !== "",
|
|
7068
7076
|
() => u`<cb-icon part="user-input-send-icon" svg="${b.setting.sendIconSvg}"></cb-icon>`,
|
|
7069
|
-
() => u`<cb-icon part="user-input-send-icon" svg="${
|
|
7077
|
+
() => u`<cb-icon part="user-input-send-icon" svg="${za}"></cb-icon>`
|
|
7070
7078
|
)}
|
|
7071
7079
|
</sl-button>
|
|
7072
7080
|
${N(
|
|
@@ -7076,7 +7084,7 @@ let ge = class extends ae {
|
|
|
7076
7084
|
${N(
|
|
7077
7085
|
b.setting.attachIconSvg !== "",
|
|
7078
7086
|
() => u`<cb-icon part="user-input-attach-icon" svg="${b.setting.attachIconSvg}"></cb-icon>`,
|
|
7079
|
-
() => u`<cb-icon part="user-input-attach-icon" svg="${
|
|
7087
|
+
() => u`<cb-icon part="user-input-attach-icon" svg="${Pa}"></cb-icon>`
|
|
7080
7088
|
)}
|
|
7081
7089
|
<!-- select file input -->
|
|
7082
7090
|
<input type="file" id="file" name="file" class="file-input" />
|
|
@@ -7105,7 +7113,7 @@ let ge = class extends ae {
|
|
|
7105
7113
|
s.key === "Enter" && !s.shiftKey && this._sendHandler();
|
|
7106
7114
|
}
|
|
7107
7115
|
};
|
|
7108
|
-
ge.styles =
|
|
7116
|
+
ge.styles = zs;
|
|
7109
7117
|
_e([
|
|
7110
7118
|
x({ type: String, attribute: "placeholder" })
|
|
7111
7119
|
], ge.prototype, "placeholder", 2);
|
|
@@ -7346,7 +7354,7 @@ let me = class extends ae {
|
|
|
7346
7354
|
${N(
|
|
7347
7355
|
b.setting.sendIconSvg !== "",
|
|
7348
7356
|
() => u`<cb-icon part="user-input-send-icon" svg="${b.setting.sendIconSvg}"></cb-icon>`,
|
|
7349
|
-
() => u`<cb-icon part="user-input-send-icon" svg="${
|
|
7357
|
+
() => u`<cb-icon part="user-input-send-icon" svg="${za}"></cb-icon>`
|
|
7350
7358
|
)}
|
|
7351
7359
|
</sl-button>
|
|
7352
7360
|
${N(
|
|
@@ -7356,7 +7364,7 @@ let me = class extends ae {
|
|
|
7356
7364
|
${N(
|
|
7357
7365
|
b.setting.attachIconSvg !== "",
|
|
7358
7366
|
() => u`<cb-icon part="user-input-attach-icon" svg="${b.setting.attachIconSvg}"></cb-icon>`,
|
|
7359
|
-
() => u`<cb-icon part="user-input-attach-icon" svg="${
|
|
7367
|
+
() => u`<cb-icon part="user-input-attach-icon" svg="${Pa}"></cb-icon>`
|
|
7360
7368
|
)}
|
|
7361
7369
|
<!-- select file input -->
|
|
7362
7370
|
<input type="file" id="file" name="file" class="file-input" />
|
|
@@ -8661,8 +8669,8 @@ class bt {
|
|
|
8661
8669
|
if (y === 0)
|
|
8662
8670
|
e.moveTo(S, w);
|
|
8663
8671
|
else {
|
|
8664
|
-
const _ = (y - 1) * c, L = this.renderPoints[y - 1] * a * 0.8, E = _ + c * 0.5, A = L,
|
|
8665
|
-
e.bezierCurveTo(E, A,
|
|
8672
|
+
const _ = (y - 1) * c, L = this.renderPoints[y - 1] * a * 0.8, E = _ + c * 0.5, A = L, P = S - c * 0.5, I = w;
|
|
8673
|
+
e.bezierCurveTo(E, A, P, I, S, w);
|
|
8666
8674
|
}
|
|
8667
8675
|
}
|
|
8668
8676
|
e.lineTo(t, 0), e.lineTo(0, 0), n === Yt && !o ? this.currentColorRGB = this._lerpColor(this.currentColorRGB, this.inputColorRGB, 0.02) : this.currentColorRGB = this._lerpColor(this.currentColorRGB, this.outputColorRGB, 0.02);
|
|
@@ -9046,7 +9054,7 @@ const Ua = (s = {}, e = {}) => ({
|
|
|
9046
9054
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
9047
9055
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
9048
9056
|
delay: (s) => 0.3 * 2 ** (s - 1) * 1e3
|
|
9049
|
-
},
|
|
9057
|
+
}, zn = (s = {}) => {
|
|
9050
9058
|
if (typeof s == "number")
|
|
9051
9059
|
return {
|
|
9052
9060
|
...wa,
|
|
@@ -9061,7 +9069,7 @@ const Ua = (s = {}, e = {}) => ({
|
|
|
9061
9069
|
...s
|
|
9062
9070
|
};
|
|
9063
9071
|
};
|
|
9064
|
-
async function
|
|
9072
|
+
async function Pn(s, e, t, a) {
|
|
9065
9073
|
return new Promise((n, o) => {
|
|
9066
9074
|
const c = setTimeout(() => {
|
|
9067
9075
|
t && t.abort(), o(new ja(s));
|
|
@@ -9149,7 +9157,7 @@ class Ct {
|
|
|
9149
9157
|
method: $n(t.method ?? this._input.method ?? "GET"),
|
|
9150
9158
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
9151
9159
|
prefixUrl: String(t.prefixUrl || ""),
|
|
9152
|
-
retry:
|
|
9160
|
+
retry: zn(t.retry),
|
|
9153
9161
|
throwHttpErrors: t.throwHttpErrors !== !1,
|
|
9154
9162
|
timeout: t.timeout ?? 1e4,
|
|
9155
9163
|
fetch: t.fetch ?? globalThis.fetch.bind(globalThis)
|
|
@@ -9228,7 +9236,7 @@ class Ct {
|
|
|
9228
9236
|
return n;
|
|
9229
9237
|
}
|
|
9230
9238
|
const e = Bn(this.request, this._options), t = this.request;
|
|
9231
|
-
return this.request = t.clone(), this._options.timeout === !1 ? this._options.fetch(t, e) :
|
|
9239
|
+
return this.request = t.clone(), this._options.timeout === !1 ? this._options.fetch(t, e) : Pn(t, e, this.abortController, this._options);
|
|
9232
9240
|
}
|
|
9233
9241
|
}
|
|
9234
9242
|
/*! MIT License © Sindre Sorhus */
|
|
@@ -9504,6 +9512,9 @@ let H = class extends ae {
|
|
|
9504
9512
|
}
|
|
9505
9513
|
}
|
|
9506
9514
|
}
|
|
9515
|
+
sanitizeInputText(s) {
|
|
9516
|
+
return !s || typeof s != "string" ? "" : s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
9517
|
+
}
|
|
9507
9518
|
_addMessageHandler(s) {
|
|
9508
9519
|
console.log("_addMessageHandler called", s);
|
|
9509
9520
|
const e = s.detail, t = e?.data?.text || null;
|
|
@@ -9511,7 +9522,7 @@ let H = class extends ae {
|
|
|
9511
9522
|
console.log("_addMessageHandler: input text is empty, ignored", s);
|
|
9512
9523
|
return;
|
|
9513
9524
|
}
|
|
9514
|
-
b.isConversationStart() && (console.log("Start of conversation detected, emitting c7o:bot:conversationStart"), e.conversationId = b.conversationId, this.emit("c7o:bot:conversationStart", {
|
|
9525
|
+
e.data.text = this.sanitizeInputText(t.trim()), b.isConversationStart() && (console.log("Start of conversation detected, emitting c7o:bot:conversationStart", e), e.conversationId = b.conversationId, this.emit("c7o:bot:conversationStart", {
|
|
9515
9526
|
detail: e
|
|
9516
9527
|
})), b.sendMessage(e);
|
|
9517
9528
|
}
|