@brainfish-ai/widgets-initiator 1.11.1 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/initNudgeWidget.d.ts +1 -0
- package/dist/types/utils/brainfishQueue.d.ts +3 -1
- package/dist/web.cjs.js +9 -9
- package/dist/web.js +543 -471
- package/package.json +2 -1
package/dist/web.js
CHANGED
|
@@ -1,180 +1,208 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var $e = Object.defineProperty, Re = Object.defineProperties;
|
|
2
|
+
var Ke = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var be = Object.getOwnPropertySymbols;
|
|
4
|
+
var ze = Object.prototype.hasOwnProperty, Ne = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var F = (a, t, n) => t in a ? $e(a, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[t] = n, H = (a, t) => {
|
|
6
6
|
for (var n in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var n of
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var E = (
|
|
14
|
-
var b = (
|
|
15
|
-
var
|
|
7
|
+
ze.call(t, n) && F(a, n, t[n]);
|
|
8
|
+
if (be)
|
|
9
|
+
for (var n of be(t))
|
|
10
|
+
Ne.call(t, n) && F(a, n, t[n]);
|
|
11
|
+
return a;
|
|
12
|
+
}, $ = (a, t) => Re(a, Ke(t));
|
|
13
|
+
var E = (a, t, n) => F(a, typeof t != "symbol" ? t + "" : t, n);
|
|
14
|
+
var b = (a, t, n) => new Promise((o, i) => {
|
|
15
|
+
var r = (l) => {
|
|
16
16
|
try {
|
|
17
17
|
s(n.next(l));
|
|
18
|
-
} catch (
|
|
19
|
-
i(
|
|
18
|
+
} catch (d) {
|
|
19
|
+
i(d);
|
|
20
20
|
}
|
|
21
21
|
}, e = (l) => {
|
|
22
22
|
try {
|
|
23
23
|
s(n.throw(l));
|
|
24
|
-
} catch (
|
|
25
|
-
i(
|
|
24
|
+
} catch (d) {
|
|
25
|
+
i(d);
|
|
26
26
|
}
|
|
27
|
-
}, s = (l) => l.done ?
|
|
28
|
-
s((n = n.apply(
|
|
27
|
+
}, s = (l) => l.done ? o(l.value) : Promise.resolve(l.value).then(r, e);
|
|
28
|
+
s((n = n.apply(a, t)).next());
|
|
29
29
|
});
|
|
30
|
-
var _, z;
|
|
31
30
|
(function() {
|
|
32
31
|
try {
|
|
33
|
-
var
|
|
34
|
-
t && (
|
|
32
|
+
var a = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}, t = new a.Error().stack;
|
|
33
|
+
t && (a._sentryDebugIds = a._sentryDebugIds || {}, a._sentryDebugIds[t] = "1e3b8aaa-5780-4039-8d1a-fe0668059131", a._sentryDebugIdIdentifier = "sentry-dbid-1e3b8aaa-5780-4039-8d1a-fe0668059131");
|
|
35
34
|
} catch (n) {
|
|
36
35
|
}
|
|
37
|
-
})()
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
})();
|
|
37
|
+
class I extends Error {
|
|
38
|
+
}
|
|
39
|
+
function qe(a) {
|
|
40
|
+
let t = a.replace(/-/g, "+").replace(/_/g, "/");
|
|
41
|
+
switch (t.length % 4) {
|
|
42
|
+
case 0:
|
|
43
|
+
break;
|
|
44
|
+
case 2:
|
|
45
|
+
t += "==";
|
|
46
|
+
break;
|
|
47
|
+
case 3:
|
|
48
|
+
t += "=";
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
throw new Error("base64 string is not of the correct length");
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
return function(n) {
|
|
55
|
+
return decodeURIComponent(atob(n).replace(/(.)/g, (o, i) => {
|
|
56
|
+
let r = i.charCodeAt(0).toString(16).toUpperCase();
|
|
57
|
+
return r.length < 2 && (r = "0" + r), "%" + r;
|
|
58
|
+
}));
|
|
59
|
+
}(t);
|
|
60
|
+
} catch (n) {
|
|
61
|
+
return atob(t);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
var C, N;
|
|
65
|
+
I.prototype.name = "InvalidTokenError", (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "bd134520d7a38ae7e47e800f76bcadc8b4d42a81" }, function(a) {
|
|
66
|
+
a.Sidebar = "sidebar", a.Searchbar = "searchbar", a.Popup = "popup";
|
|
67
|
+
}(C || (C = {})), C.Sidebar, C.Searchbar, C.Popup;
|
|
68
|
+
class ue extends Error {
|
|
69
|
+
constructor(n, o) {
|
|
70
|
+
super(n, o);
|
|
43
71
|
E(this, "cause");
|
|
44
|
-
this.name = "BrainfishWidgetError", this.cause =
|
|
72
|
+
this.name = "BrainfishWidgetError", this.cause = o == null ? void 0 : o.cause, Error.captureStackTrace && Error.captureStackTrace(this, ue), this.cause instanceof Error && this.cause.stack && (this.stack = this.stack + `
|
|
45
73
|
Caused by: ` + this.cause.stack);
|
|
46
74
|
}
|
|
47
75
|
toJSON() {
|
|
48
76
|
return { name: this.name, message: this.message, stack: this.stack, cause: this.cause instanceof Error ? { name: this.cause.name, message: this.cause.message, stack: this.cause.stack } : this.cause };
|
|
49
77
|
}
|
|
50
78
|
}
|
|
51
|
-
(function(
|
|
52
|
-
|
|
53
|
-
})(
|
|
54
|
-
const
|
|
55
|
-
let i = n,
|
|
79
|
+
(function(a) {
|
|
80
|
+
a.LINK = "link", a.CALLBACK = "callback", a.EMAIL = "email", a.PHONE = "phone";
|
|
81
|
+
})(N || (N = {}));
|
|
82
|
+
const x = (a, t, n, o) => {
|
|
83
|
+
let i = n, r = {};
|
|
56
84
|
if (t instanceof Error) try {
|
|
57
|
-
|
|
85
|
+
r = JSON.parse(t.message), i += ` - ${r.message || t.message}`;
|
|
58
86
|
} catch (e) {
|
|
59
87
|
i += ` - ${t.message}`;
|
|
60
88
|
}
|
|
61
89
|
else i += ` - ${String(t)}`;
|
|
62
90
|
((e, s, l) => {
|
|
63
91
|
if (!navigator || navigator.userAgent.toLowerCase().includes("headless")) return;
|
|
64
|
-
const
|
|
65
|
-
fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": l }, body: JSON.stringify({ error: `WebWidgetVersion: 1.
|
|
66
|
-
})(
|
|
67
|
-
},
|
|
68
|
-
let { widgetKey: t, apiHost: n } =
|
|
69
|
-
return function(
|
|
92
|
+
const d = s.toJSON();
|
|
93
|
+
fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": l }, body: JSON.stringify({ error: `WebWidgetVersion: 1.13.0. ${s.message}`, stack: s.stack, cause: { message: d.message, stack: d.stack, cause: d.cause } }) });
|
|
94
|
+
})(a, new ue(i, { cause: r }), o);
|
|
95
|
+
}, De = (a) => b(void 0, null, function* () {
|
|
96
|
+
let { widgetKey: t, apiHost: n } = a;
|
|
97
|
+
return function(o, i, r) {
|
|
70
98
|
return b(this, null, function* () {
|
|
71
99
|
let e, s = 0;
|
|
72
100
|
for (; s < 3; ) try {
|
|
73
|
-
const l = yield fetch(`${
|
|
101
|
+
const l = yield fetch(`${o}${i}`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": r } });
|
|
74
102
|
if (!l.ok) throw new Error(`API call failed with status: ${l.status}`);
|
|
75
|
-
const
|
|
76
|
-
if (!
|
|
77
|
-
return
|
|
103
|
+
const d = yield l.json();
|
|
104
|
+
if (!d) throw new Error("Error loading config: empty response");
|
|
105
|
+
return d;
|
|
78
106
|
} catch (l) {
|
|
79
|
-
if (e = l, s++, s >= 3) throw
|
|
80
|
-
yield new Promise((
|
|
107
|
+
if (e = l, s++, s >= 3) throw x(o, l, "Error fetching config", r), e;
|
|
108
|
+
yield new Promise((d) => setTimeout(d, 500));
|
|
81
109
|
}
|
|
82
110
|
});
|
|
83
111
|
}(n, "/api/searchWidgets.getConfigByKey", t);
|
|
84
|
-
}),
|
|
85
|
-
let { config: t, apiKey: n, apiHost: d } = r;
|
|
86
|
-
const i = t.settings || {};
|
|
87
|
-
return ["bodyActionButtons", "footerActionButtons", "nextBestActions"].forEach((a) => {
|
|
88
|
-
i[a] && (i[a] = i[a].map((e) => e.type === z.CALLBACK && e.value ? H(F({}, e), { value: new Function(`return ${e.value}`)() }) : e));
|
|
89
|
-
}), H(F({}, t), { settings: i, apiHost: d, widgetMode: t.widgetType, apiKey: n });
|
|
90
|
-
}, ue = (r) => (r == null ? void 0 : r.apiHost) || "https://app.brainfi.sh", R = (() => {
|
|
112
|
+
}), _e = () => {
|
|
91
113
|
if (typeof window == "undefined") return;
|
|
92
|
-
const
|
|
93
|
-
if (!(
|
|
94
|
-
const t =
|
|
114
|
+
const a = window.navigator.userAgent;
|
|
115
|
+
if (!(a.match(/iPad/i) || a.match(/iPhone/i))) return !1;
|
|
116
|
+
const t = a.match(/OS (\d+)_/i);
|
|
95
117
|
return t && parseInt(t[1], 10) <= 14;
|
|
96
|
-
}
|
|
97
|
-
let {
|
|
118
|
+
}, Ue = (a) => {
|
|
119
|
+
let { config: t, apiKey: n, apiHost: o } = a;
|
|
120
|
+
const i = t.settings || {};
|
|
121
|
+
return ["bodyActionButtons", "footerActionButtons", "nextBestActions"].forEach((r) => {
|
|
122
|
+
i[r] && (i[r] = i[r].map((e) => e.type === N.CALLBACK && e.value ? $(H({}, e), { value: new Function(`return ${e.value}`)() }) : e));
|
|
123
|
+
}), $(H({}, t), { settings: i, apiHost: o, widgetMode: t.widgetType, apiKey: n });
|
|
124
|
+
}, ce = (a) => (a == null ? void 0 : a.apiHost) || "https://app.brainfi.sh", R = _e(), Je = (a) => b(void 0, null, function* () {
|
|
125
|
+
let { apiHost: t, widgetKey: n, version: o } = a;
|
|
98
126
|
try {
|
|
99
|
-
const i = `https://cdn.jsdelivr.net/npm/@brainfish-ai/search-widget@${
|
|
127
|
+
const i = `https://cdn.jsdelivr.net/npm/@brainfish-ai/search-widget@${o}/dist/web.js`, r = R ? i.replace("web.js", "web.umd.js") : i;
|
|
100
128
|
return { widget: yield ((s) => b(void 0, null, function* () {
|
|
101
|
-
return document.getElementById("brainfish-widget") ? window.Brainfish : new Promise((l,
|
|
129
|
+
return document.getElementById("brainfish-widget") ? window.Brainfish : new Promise((l, d) => {
|
|
102
130
|
const u = document.createElement("script");
|
|
103
131
|
u.id = "brainfish-widget", u.src = s, u.type = R ? "text/javascript" : "module", u.async = !0, u.crossOrigin = "anonymous", u.onload = () => {
|
|
104
132
|
setTimeout(() => {
|
|
105
|
-
const
|
|
106
|
-
|
|
133
|
+
const f = window.Brainfish;
|
|
134
|
+
f ? l(f) : d(new Error("Failed to load Brainfish module"));
|
|
107
135
|
}, 200);
|
|
108
|
-
}, u.onerror = (
|
|
109
|
-
const
|
|
110
|
-
|
|
136
|
+
}, u.onerror = (f) => {
|
|
137
|
+
const c = f, h = { message: `Failed to load script: ${s}`, type: c.type, fileName: c.filename, lineNumber: c.lineno, columnNumber: c.colno, error: c.error ? c.error.toString() : "Unknown error" };
|
|
138
|
+
d(new Error(JSON.stringify(h)));
|
|
111
139
|
}, R || document.head.appendChild(u);
|
|
112
140
|
});
|
|
113
|
-
}))(
|
|
141
|
+
}))(r) };
|
|
114
142
|
} catch (i) {
|
|
115
|
-
|
|
143
|
+
x(t, i, i.message, n);
|
|
116
144
|
}
|
|
117
|
-
}),
|
|
118
|
-
const n =
|
|
145
|
+
}), ve = /* @__PURE__ */ new Set(), Ye = (a, t) => b(void 0, null, function* () {
|
|
146
|
+
const n = ce(a.overrides);
|
|
119
147
|
try {
|
|
120
|
-
if (
|
|
121
|
-
const
|
|
122
|
-
if (
|
|
123
|
-
const { widget: i } =
|
|
124
|
-
return
|
|
148
|
+
if (ve.has(a.widgetKey)) return;
|
|
149
|
+
const o = yield Je({ apiHost: n, widgetKey: a.widgetKey, version: t.version || "latest" });
|
|
150
|
+
if (o) {
|
|
151
|
+
const { widget: i } = o, r = Ue({ config: t, apiKey: a.widgetKey, apiHost: n });
|
|
152
|
+
return a.overrides && t.settings && Object.entries(a.overrides).forEach((e) => {
|
|
125
153
|
let [s, l] = e;
|
|
126
154
|
t.settings && s in t.settings && (t.settings[s] = function() {
|
|
127
|
-
let
|
|
128
|
-
const u = new Map((arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).map((
|
|
129
|
-
return
|
|
155
|
+
let d = arguments.length > 1 ? arguments[1] : void 0;
|
|
156
|
+
const u = new Map((arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).map((f) => [f.label, f]));
|
|
157
|
+
return d.forEach((f) => u.set(f.label, f)), Array.from(u.values());
|
|
130
158
|
}(t.settings[s], l));
|
|
131
159
|
}), function(e, s) {
|
|
132
|
-
s.widgetType ===
|
|
133
|
-
}(i,
|
|
160
|
+
s.widgetType === C.Searchbar || s.widgetType === "Search" ? e.SearchWidget.initStandard(s) : e.HelpWidget.initPopup(s);
|
|
161
|
+
}(i, r), ve.add(a.widgetKey), i;
|
|
134
162
|
}
|
|
135
|
-
} catch (
|
|
136
|
-
|
|
163
|
+
} catch (o) {
|
|
164
|
+
x(n, o, o.message, a.widgetKey);
|
|
137
165
|
}
|
|
138
166
|
});
|
|
139
|
-
let
|
|
140
|
-
const
|
|
141
|
-
return b(this, arguments, function* (
|
|
142
|
-
let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "", s = arguments.length > 4 && arguments[4] !== void 0 && arguments[4], l = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : [],
|
|
143
|
-
if (t ||
|
|
144
|
-
const
|
|
167
|
+
let ye = !1;
|
|
168
|
+
const Ge = function(o, i, r) {
|
|
169
|
+
return b(this, arguments, function* (a, t, n) {
|
|
170
|
+
let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "", s = arguments.length > 4 && arguments[4] !== void 0 && arguments[4], l = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : [], d = arguments.length > 6 ? arguments[6] : void 0, u = arguments.length > 7 ? arguments[7] : void 0;
|
|
171
|
+
if (t || x(n, new Error("Access key is required"), "Access key is required", a), !ye) try {
|
|
172
|
+
const f = (() => {
|
|
145
173
|
if (typeof window == "undefined" || typeof navigator == "undefined") return !1;
|
|
146
|
-
const
|
|
174
|
+
const c = navigator, h = window, g = (c.doNotTrack || h.doNotTrack || c.msDoNotTrack || "0").toString().toLowerCase();
|
|
147
175
|
return ["1", "yes", "true"].includes(g);
|
|
148
176
|
})();
|
|
149
|
-
window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !0, trackAttributes: !
|
|
177
|
+
window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !0, trackAttributes: !f, trackOutgoingLinks: !f, enableRecording: !f && s, recordingBlocklist: l, _allowLocalhostRecording: d, _allowScreenRecording: u }), ye = !0, yield ((c, h) => b(this, null, function* () {
|
|
150
178
|
if (document.getElementById("brainfish-analytics")) return window.BrainfishAnalytics;
|
|
151
179
|
const g = document.createElement("script");
|
|
152
180
|
g.id = "brainfish-analytics", g.src = "https://cdn.jsdelivr.net/npm/@brainfish-ai/web-tracker@latest/dist/tracker.js", g.type = "module", g.async = !0, g.crossOrigin = "anonymous", g.onerror = () => {
|
|
153
|
-
|
|
181
|
+
x(c, new Error(`Failed to load script: ${g.src}`), `Failed to load script: ${g.src}`, h);
|
|
154
182
|
}, document.head.appendChild(g);
|
|
155
|
-
}))(n,
|
|
156
|
-
} catch (
|
|
157
|
-
|
|
183
|
+
}))(n, a);
|
|
184
|
+
} catch (f) {
|
|
185
|
+
x(n, f, "Failed to initialize BrainfishAnalytics", a);
|
|
158
186
|
}
|
|
159
187
|
});
|
|
160
188
|
};
|
|
161
|
-
function
|
|
189
|
+
function _(a, t) {
|
|
162
190
|
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
163
|
-
const
|
|
164
|
-
return
|
|
165
|
-
let [
|
|
166
|
-
|
|
167
|
-
}),
|
|
191
|
+
const o = document.createElement(a);
|
|
192
|
+
return o.className = t, Object.entries(n).forEach((i) => {
|
|
193
|
+
let [r, e] = i;
|
|
194
|
+
o.setAttribute(r, e);
|
|
195
|
+
}), o;
|
|
168
196
|
}
|
|
169
|
-
const P = "bf-iframe-container",
|
|
197
|
+
const P = "bf-iframe-container", L = "bf-trigger-button";
|
|
170
198
|
class w {
|
|
171
199
|
static get isWidgetOpen() {
|
|
172
200
|
return this.isOpen;
|
|
173
201
|
}
|
|
174
202
|
static initialize(t) {
|
|
175
|
-
var n,
|
|
176
|
-
let { button: i, icon:
|
|
177
|
-
this.button = i || null, this.icon =
|
|
203
|
+
var n, o;
|
|
204
|
+
let { button: i, icon: r, isButtonHidden: e } = t;
|
|
205
|
+
this.button = i || null, this.icon = r || null, this.isButtonHidden = e || !1, i && i.addEventListener("click", () => this.toggleIframeVisibility()), (n = window.Brainfish) !== null && n !== void 0 && n.HelpWidget && (window.Brainfish.HelpWidget.close = () => this.closeWidget(), window.Brainfish.HelpWidget.open = () => this.openWidget()), (o = window.Brainfish) !== null && o !== void 0 && o.Widgets && (window.Brainfish.Widgets.open = () => this.openWidget(), window.Brainfish.Widgets.close = () => this.closeWidget());
|
|
178
206
|
}
|
|
179
207
|
static toggleIframeVisibility() {
|
|
180
208
|
this.isOpen = !this.isOpen, this.isOpen ? this.openWidget() : this.closeWidget();
|
|
@@ -182,10 +210,10 @@ class w {
|
|
|
182
210
|
static openWidget() {
|
|
183
211
|
var t;
|
|
184
212
|
this.isOpen = !0;
|
|
185
|
-
const n = document.querySelector(".bf-iframe-container"),
|
|
186
|
-
if (n == null || n.classList.add("open"), n == null || n.setAttribute("aria-hidden", "false"),
|
|
187
|
-
const i = this.icon.querySelector(".fish-icon"),
|
|
188
|
-
this.button.setAttribute("aria-expanded", "true"), i.classList.remove("visible"),
|
|
213
|
+
const n = document.querySelector(".bf-iframe-container"), o = n == null ? void 0 : n.querySelector("iframe");
|
|
214
|
+
if (n == null || n.classList.add("open"), n == null || n.setAttribute("aria-hidden", "false"), o == null || (t = o.contentWindow) === null || t === void 0 || t.postMessage({ type: "FOCUS_SEARCH_FIELD" }, "*"), this.button && this.icon) {
|
|
215
|
+
const i = this.icon.querySelector(".fish-icon"), r = this.icon.querySelector(".close-icon");
|
|
216
|
+
this.button.setAttribute("aria-expanded", "true"), i.classList.remove("visible"), r.classList.add("visible"), document.body.clientWidth <= 576 && this.hideTriggerButton();
|
|
189
217
|
}
|
|
190
218
|
window.dispatchEvent(new Event("onBrainfishWidgetOpen")), window.BrainfishAnalytics("track", "Open Widget");
|
|
191
219
|
}
|
|
@@ -194,8 +222,8 @@ class w {
|
|
|
194
222
|
const t = document.querySelector(".bf-iframe-container");
|
|
195
223
|
if (t == null || t.classList.remove("open"), t == null || t.setAttribute("aria-hidden", "true"), this.button && this.icon) {
|
|
196
224
|
this.button.setAttribute("aria-expanded", "false");
|
|
197
|
-
const n = this.icon.querySelector(".fish-icon"),
|
|
198
|
-
n.classList.add("visible"),
|
|
225
|
+
const n = this.icon.querySelector(".fish-icon"), o = this.icon.querySelector(".close-icon");
|
|
226
|
+
n.classList.add("visible"), o.classList.remove("visible"), document.body.clientWidth <= 576 && this.showTriggerButton();
|
|
199
227
|
}
|
|
200
228
|
window.dispatchEvent(new Event("onBrainfishWidgetClose")), window.BrainfishAnalytics("track", "Close Widget");
|
|
201
229
|
}
|
|
@@ -209,109 +237,109 @@ class w {
|
|
|
209
237
|
}
|
|
210
238
|
}
|
|
211
239
|
E(w, "isOpen", !1), E(w, "button", null), E(w, "icon", null), E(w, "isButtonHidden", !1);
|
|
212
|
-
function
|
|
213
|
-
let { widgetHost: t, apiHost: n, widgetKey:
|
|
214
|
-
window.addEventListener("message", (
|
|
215
|
-
if (
|
|
216
|
-
const { type: e } =
|
|
240
|
+
function Ve(a) {
|
|
241
|
+
let { widgetHost: t, apiHost: n, widgetKey: o, signal: i } = a;
|
|
242
|
+
window.addEventListener("message", (r) => {
|
|
243
|
+
if (r.origin !== t) return;
|
|
244
|
+
const { type: e } = r.data;
|
|
217
245
|
if (e === "TOGGLE_WIDGET_SIZE" && function() {
|
|
218
246
|
const s = document.querySelector(`.${P}`);
|
|
219
247
|
s.classList.contains("expanded") ? s.classList.remove("expanded") : s.classList.add("expanded");
|
|
220
248
|
}(), e === "TRACK_EVENT") {
|
|
221
249
|
if (!window.BrainfishAnalytics) return;
|
|
222
|
-
const { eventName: s, data: l } =
|
|
250
|
+
const { eventName: s, data: l } = r.data;
|
|
223
251
|
window.BrainfishAnalytics("track", s, l);
|
|
224
252
|
}
|
|
225
253
|
if (e === "CLOSE_WIDGET" && (window.BrainfishAnalytics("track", "Close Widget"), w.toggleIframeVisibility()), e === "NEXT_BEST_ACTION_CLICKED") {
|
|
226
|
-
const { action: s, searchQueryId: l, query:
|
|
254
|
+
const { action: s, searchQueryId: l, query: d, answer: u } = r.data, f = { action: s, searchQueryId: l };
|
|
227
255
|
if (!["function", "callback"].includes(s.type)) return void console.error("Invalid action type", s);
|
|
228
|
-
if (window.__bfCallbacks = window.__bfCallbacks || {}, window.__bfCallbacks[s.id]) return void window.__bfCallbacks[s.id](
|
|
229
|
-
const
|
|
230
|
-
h.src =
|
|
231
|
-
window.__bfCallbacks[s.id](
|
|
256
|
+
if (window.__bfCallbacks = window.__bfCallbacks || {}, window.__bfCallbacks[s.id]) return void window.__bfCallbacks[s.id](d, u, f);
|
|
257
|
+
const c = `${n}/api/searchWidgets.callback.codeblocks?apiKey=${o}&codeblockId=${s.id}`, h = document.createElement("script");
|
|
258
|
+
h.src = c, document.head.appendChild(h), h.onload = () => {
|
|
259
|
+
window.__bfCallbacks[s.id](d, u, f), setTimeout(() => {
|
|
232
260
|
document.head.removeChild(h);
|
|
233
261
|
}, 300);
|
|
234
262
|
};
|
|
235
263
|
}
|
|
236
264
|
}, { signal: i });
|
|
237
265
|
}
|
|
238
|
-
function fe(
|
|
239
|
-
return
|
|
266
|
+
function fe(a) {
|
|
267
|
+
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
240
268
|
}
|
|
241
|
-
var
|
|
242
|
-
(function(
|
|
269
|
+
var q = { exports: {} }, D = { exports: {} }, U = { exports: {} };
|
|
270
|
+
(function(a, t) {
|
|
243
271
|
function n(i) {
|
|
244
272
|
return Math.round(255 * i);
|
|
245
273
|
}
|
|
246
|
-
function
|
|
247
|
-
return n(i) + "," + n(
|
|
274
|
+
function o(i, r, e) {
|
|
275
|
+
return n(i) + "," + n(r) + "," + n(e);
|
|
248
276
|
}
|
|
249
|
-
t.__esModule = !0, t.default = void 0, t.default = function(i,
|
|
250
|
-
if (s === void 0 && (s =
|
|
251
|
-
var l = (i % 360 + 360) % 360 / 60,
|
|
252
|
-
l >= 0 && l < 1 ? (
|
|
253
|
-
var g = e -
|
|
254
|
-
return s(
|
|
255
|
-
},
|
|
256
|
-
})(
|
|
257
|
-
var
|
|
258
|
-
(function(
|
|
277
|
+
t.__esModule = !0, t.default = void 0, t.default = function(i, r, e, s) {
|
|
278
|
+
if (s === void 0 && (s = o), r === 0) return s(e, e, e);
|
|
279
|
+
var l = (i % 360 + 360) % 360 / 60, d = (1 - Math.abs(2 * e - 1)) * r, u = d * (1 - Math.abs(l % 2 - 1)), f = 0, c = 0, h = 0;
|
|
280
|
+
l >= 0 && l < 1 ? (f = d, c = u) : l >= 1 && l < 2 ? (f = u, c = d) : l >= 2 && l < 3 ? (c = d, h = u) : l >= 3 && l < 4 ? (c = u, h = d) : l >= 4 && l < 5 ? (f = u, h = d) : l >= 5 && l < 6 && (f = d, h = u);
|
|
281
|
+
var g = e - d / 2;
|
|
282
|
+
return s(f + g, c + g, h + g);
|
|
283
|
+
}, a.exports = t.default;
|
|
284
|
+
})(U, U.exports);
|
|
285
|
+
var pe = U.exports, J = { exports: {} };
|
|
286
|
+
(function(a, t) {
|
|
259
287
|
t.__esModule = !0, t.default = void 0;
|
|
260
288
|
var n = { aliceblue: "f0f8ff", antiquewhite: "faebd7", aqua: "00ffff", aquamarine: "7fffd4", azure: "f0ffff", beige: "f5f5dc", bisque: "ffe4c4", black: "000", blanchedalmond: "ffebcd", blue: "0000ff", blueviolet: "8a2be2", brown: "a52a2a", burlywood: "deb887", cadetblue: "5f9ea0", chartreuse: "7fff00", chocolate: "d2691e", coral: "ff7f50", cornflowerblue: "6495ed", cornsilk: "fff8dc", crimson: "dc143c", cyan: "00ffff", darkblue: "00008b", darkcyan: "008b8b", darkgoldenrod: "b8860b", darkgray: "a9a9a9", darkgreen: "006400", darkgrey: "a9a9a9", darkkhaki: "bdb76b", darkmagenta: "8b008b", darkolivegreen: "556b2f", darkorange: "ff8c00", darkorchid: "9932cc", darkred: "8b0000", darksalmon: "e9967a", darkseagreen: "8fbc8f", darkslateblue: "483d8b", darkslategray: "2f4f4f", darkslategrey: "2f4f4f", darkturquoise: "00ced1", darkviolet: "9400d3", deeppink: "ff1493", deepskyblue: "00bfff", dimgray: "696969", dimgrey: "696969", dodgerblue: "1e90ff", firebrick: "b22222", floralwhite: "fffaf0", forestgreen: "228b22", fuchsia: "ff00ff", gainsboro: "dcdcdc", ghostwhite: "f8f8ff", gold: "ffd700", goldenrod: "daa520", gray: "808080", green: "008000", greenyellow: "adff2f", grey: "808080", honeydew: "f0fff0", hotpink: "ff69b4", indianred: "cd5c5c", indigo: "4b0082", ivory: "fffff0", khaki: "f0e68c", lavender: "e6e6fa", lavenderblush: "fff0f5", lawngreen: "7cfc00", lemonchiffon: "fffacd", lightblue: "add8e6", lightcoral: "f08080", lightcyan: "e0ffff", lightgoldenrodyellow: "fafad2", lightgray: "d3d3d3", lightgreen: "90ee90", lightgrey: "d3d3d3", lightpink: "ffb6c1", lightsalmon: "ffa07a", lightseagreen: "20b2aa", lightskyblue: "87cefa", lightslategray: "789", lightslategrey: "789", lightsteelblue: "b0c4de", lightyellow: "ffffe0", lime: "0f0", limegreen: "32cd32", linen: "faf0e6", magenta: "f0f", maroon: "800000", mediumaquamarine: "66cdaa", mediumblue: "0000cd", mediumorchid: "ba55d3", mediumpurple: "9370db", mediumseagreen: "3cb371", mediumslateblue: "7b68ee", mediumspringgreen: "00fa9a", mediumturquoise: "48d1cc", mediumvioletred: "c71585", midnightblue: "191970", mintcream: "f5fffa", mistyrose: "ffe4e1", moccasin: "ffe4b5", navajowhite: "ffdead", navy: "000080", oldlace: "fdf5e6", olive: "808000", olivedrab: "6b8e23", orange: "ffa500", orangered: "ff4500", orchid: "da70d6", palegoldenrod: "eee8aa", palegreen: "98fb98", paleturquoise: "afeeee", palevioletred: "db7093", papayawhip: "ffefd5", peachpuff: "ffdab9", peru: "cd853f", pink: "ffc0cb", plum: "dda0dd", powderblue: "b0e0e6", purple: "800080", rebeccapurple: "639", red: "f00", rosybrown: "bc8f8f", royalblue: "4169e1", saddlebrown: "8b4513", salmon: "fa8072", sandybrown: "f4a460", seagreen: "2e8b57", seashell: "fff5ee", sienna: "a0522d", silver: "c0c0c0", skyblue: "87ceeb", slateblue: "6a5acd", slategray: "708090", slategrey: "708090", snow: "fffafa", springgreen: "00ff7f", steelblue: "4682b4", tan: "d2b48c", teal: "008080", thistle: "d8bfd8", tomato: "ff6347", turquoise: "40e0d0", violet: "ee82ee", wheat: "f5deb3", white: "fff", whitesmoke: "f5f5f5", yellow: "ff0", yellowgreen: "9acd32" };
|
|
261
|
-
t.default = function(
|
|
262
|
-
if (typeof
|
|
263
|
-
var i =
|
|
264
|
-
return n[i] ? "#" + n[i] :
|
|
265
|
-
},
|
|
266
|
-
})(
|
|
267
|
-
var
|
|
268
|
-
(function(
|
|
289
|
+
t.default = function(o) {
|
|
290
|
+
if (typeof o != "string") return o;
|
|
291
|
+
var i = o.toLowerCase();
|
|
292
|
+
return n[i] ? "#" + n[i] : o;
|
|
293
|
+
}, a.exports = t.default;
|
|
294
|
+
})(J, J.exports);
|
|
295
|
+
var Ze = J.exports, Y = { exports: {} };
|
|
296
|
+
(function(a, t) {
|
|
269
297
|
function n(l) {
|
|
270
|
-
var
|
|
298
|
+
var d = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
271
299
|
return n = function(u) {
|
|
272
|
-
if (u === null || !function(
|
|
300
|
+
if (u === null || !function(c) {
|
|
273
301
|
try {
|
|
274
|
-
return Function.toString.call(
|
|
302
|
+
return Function.toString.call(c).indexOf("[native code]") !== -1;
|
|
275
303
|
} catch (h) {
|
|
276
|
-
return typeof
|
|
304
|
+
return typeof c == "function";
|
|
277
305
|
}
|
|
278
306
|
}(u)) return u;
|
|
279
307
|
if (typeof u != "function") throw new TypeError("Super expression must either be null or a function");
|
|
280
|
-
if (
|
|
281
|
-
if (
|
|
282
|
-
|
|
308
|
+
if (d !== void 0) {
|
|
309
|
+
if (d.has(u)) return d.get(u);
|
|
310
|
+
d.set(u, f);
|
|
283
311
|
}
|
|
284
|
-
function
|
|
285
|
-
return function(
|
|
286
|
-
if (
|
|
312
|
+
function f() {
|
|
313
|
+
return function(c, h, g) {
|
|
314
|
+
if (o()) return Reflect.construct.apply(null, arguments);
|
|
287
315
|
var p = [null];
|
|
288
316
|
p.push.apply(p, h);
|
|
289
|
-
var m = new (
|
|
317
|
+
var m = new (c.bind.apply(c, p))();
|
|
290
318
|
return g && i(m, g.prototype), m;
|
|
291
|
-
}(u, arguments,
|
|
319
|
+
}(u, arguments, r(this).constructor);
|
|
292
320
|
}
|
|
293
|
-
return
|
|
321
|
+
return f.prototype = Object.create(u.prototype, { constructor: { value: f, enumerable: !1, writable: !0, configurable: !0 } }), i(f, u);
|
|
294
322
|
}, n(l);
|
|
295
323
|
}
|
|
296
|
-
function
|
|
324
|
+
function o() {
|
|
297
325
|
try {
|
|
298
326
|
var l = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
299
327
|
}));
|
|
300
|
-
} catch (
|
|
328
|
+
} catch (d) {
|
|
301
329
|
}
|
|
302
|
-
return (
|
|
330
|
+
return (o = function() {
|
|
303
331
|
return !!l;
|
|
304
332
|
})();
|
|
305
333
|
}
|
|
306
|
-
function i(l,
|
|
307
|
-
return i = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(u,
|
|
308
|
-
return u.__proto__ =
|
|
309
|
-
}, i(l,
|
|
334
|
+
function i(l, d) {
|
|
335
|
+
return i = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(u, f) {
|
|
336
|
+
return u.__proto__ = f, u;
|
|
337
|
+
}, i(l, d);
|
|
310
338
|
}
|
|
311
|
-
function
|
|
312
|
-
return
|
|
313
|
-
return
|
|
314
|
-
},
|
|
339
|
+
function r(l) {
|
|
340
|
+
return r = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(d) {
|
|
341
|
+
return d.__proto__ || Object.getPrototypeOf(d);
|
|
342
|
+
}, r(l);
|
|
315
343
|
}
|
|
316
344
|
t.__esModule = !0, t.default = void 0;
|
|
317
345
|
var e = { 1: `Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
|
|
@@ -464,358 +492,358 @@ To pass a single animation please supply them in simple values, e.g. animation('
|
|
|
464
492
|
`, 78: `base must be set in "px" or "%" but you set it in "%s".
|
|
465
493
|
` };
|
|
466
494
|
function s() {
|
|
467
|
-
for (var l = arguments.length,
|
|
468
|
-
var
|
|
469
|
-
for (
|
|
495
|
+
for (var l = arguments.length, d = new Array(l), u = 0; u < l; u++) d[u] = arguments[u];
|
|
496
|
+
var f, c = d[0], h = [];
|
|
497
|
+
for (f = 1; f < d.length; f += 1) h.push(d[f]);
|
|
470
498
|
return h.forEach(function(g) {
|
|
471
|
-
|
|
472
|
-
}),
|
|
499
|
+
c = c.replace(/%[a-z]/, g);
|
|
500
|
+
}), c;
|
|
473
501
|
}
|
|
474
502
|
t.default = function(l) {
|
|
475
|
-
var
|
|
476
|
-
function c
|
|
503
|
+
var d, u;
|
|
504
|
+
function f(c) {
|
|
477
505
|
var h;
|
|
478
|
-
if (process.env.NODE_ENV === "production") h = l.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" +
|
|
506
|
+
if (process.env.NODE_ENV === "production") h = l.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + c + " for more information.") || this;
|
|
479
507
|
else {
|
|
480
508
|
for (var g = arguments.length, p = new Array(g > 1 ? g - 1 : 0), m = 1; m < g; m++) p[m - 1] = arguments[m];
|
|
481
|
-
h = l.call(this, s.apply(void 0, [e[
|
|
509
|
+
h = l.call(this, s.apply(void 0, [e[c]].concat(p))) || this;
|
|
482
510
|
}
|
|
483
511
|
return function(v) {
|
|
484
512
|
if (v === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
485
513
|
return v;
|
|
486
514
|
}(h);
|
|
487
515
|
}
|
|
488
|
-
return u = l, (
|
|
489
|
-
}(n(Error)),
|
|
490
|
-
})(
|
|
491
|
-
var B =
|
|
492
|
-
(function(
|
|
516
|
+
return u = l, (d = f).prototype = Object.create(u.prototype), d.prototype.constructor = d, i(d, u), f;
|
|
517
|
+
}(n(Error)), a.exports = t.default;
|
|
518
|
+
})(Y, Y.exports);
|
|
519
|
+
var B = Y.exports;
|
|
520
|
+
(function(a, t) {
|
|
493
521
|
t.__esModule = !0, t.default = function(g) {
|
|
494
522
|
if (typeof g != "string") throw new i.default(3);
|
|
495
|
-
var p = (0,
|
|
523
|
+
var p = (0, o.default)(g);
|
|
496
524
|
if (p.match(e)) return { red: parseInt("" + p[1] + p[2], 16), green: parseInt("" + p[3] + p[4], 16), blue: parseInt("" + p[5] + p[6], 16) };
|
|
497
525
|
if (p.match(s)) {
|
|
498
526
|
var m = parseFloat((parseInt("" + p[7] + p[8], 16) / 255).toFixed(2));
|
|
499
527
|
return { red: parseInt("" + p[1] + p[2], 16), green: parseInt("" + p[3] + p[4], 16), blue: parseInt("" + p[5] + p[6], 16), alpha: m };
|
|
500
528
|
}
|
|
501
529
|
if (p.match(l)) return { red: parseInt("" + p[1] + p[1], 16), green: parseInt("" + p[2] + p[2], 16), blue: parseInt("" + p[3] + p[3], 16) };
|
|
502
|
-
if (p.match(
|
|
530
|
+
if (p.match(d)) {
|
|
503
531
|
var v = parseFloat((parseInt("" + p[4] + p[4], 16) / 255).toFixed(2));
|
|
504
532
|
return { red: parseInt("" + p[1] + p[1], 16), green: parseInt("" + p[2] + p[2], 16), blue: parseInt("" + p[3] + p[3], 16), alpha: v };
|
|
505
533
|
}
|
|
506
534
|
var y = u.exec(p);
|
|
507
535
|
if (y) return { red: parseInt("" + y[1], 10), green: parseInt("" + y[2], 10), blue: parseInt("" + y[3], 10) };
|
|
508
|
-
var
|
|
509
|
-
if (
|
|
510
|
-
var
|
|
511
|
-
if (
|
|
512
|
-
var
|
|
513
|
-
if (!O) throw new i.default(4, p, ge);
|
|
514
|
-
return { red: parseInt("" + O[1], 10), green: parseInt("" + O[2], 10), blue: parseInt("" + O[3], 10) };
|
|
515
|
-
}
|
|
516
|
-
var S = h.exec(p.substring(0, 50));
|
|
517
|
-
if (S) {
|
|
518
|
-
var Me = parseInt("" + S[1], 10), We = parseInt("" + S[2], 10) / 100, Pe = parseInt("" + S[3], 10) / 100, he = "rgb(" + (0, n.default)(Me, We, Pe) + ")", T = u.exec(he);
|
|
536
|
+
var S = f.exec(p.substring(0, 50));
|
|
537
|
+
if (S) return { red: parseInt("" + S[1], 10), green: parseInt("" + S[2], 10), blue: parseInt("" + S[3], 10), alpha: parseFloat("" + S[4]) > 1 ? parseFloat("" + S[4]) / 100 : parseFloat("" + S[4]) };
|
|
538
|
+
var O = c.exec(p);
|
|
539
|
+
if (O) {
|
|
540
|
+
var je = parseInt("" + O[1], 10), Me = parseInt("" + O[2], 10) / 100, Pe = parseInt("" + O[3], 10) / 100, he = "rgb(" + (0, n.default)(je, Me, Pe) + ")", T = u.exec(he);
|
|
519
541
|
if (!T) throw new i.default(4, p, he);
|
|
520
|
-
return { red: parseInt("" + T[1], 10), green: parseInt("" + T[2], 10), blue: parseInt("" + T[3], 10)
|
|
542
|
+
return { red: parseInt("" + T[1], 10), green: parseInt("" + T[2], 10), blue: parseInt("" + T[3], 10) };
|
|
543
|
+
}
|
|
544
|
+
var k = h.exec(p.substring(0, 50));
|
|
545
|
+
if (k) {
|
|
546
|
+
var Le = parseInt("" + k[1], 10), Fe = parseInt("" + k[2], 10) / 100, He = parseInt("" + k[3], 10) / 100, me = "rgb(" + (0, n.default)(Le, Fe, He) + ")", W = u.exec(me);
|
|
547
|
+
if (!W) throw new i.default(4, p, me);
|
|
548
|
+
return { red: parseInt("" + W[1], 10), green: parseInt("" + W[2], 10), blue: parseInt("" + W[3], 10), alpha: parseFloat("" + k[4]) > 1 ? parseFloat("" + k[4]) / 100 : parseFloat("" + k[4]) };
|
|
521
549
|
}
|
|
522
550
|
throw new i.default(5);
|
|
523
551
|
};
|
|
524
|
-
var n =
|
|
525
|
-
function
|
|
552
|
+
var n = r(pe), o = r(Ze), i = r(B);
|
|
553
|
+
function r(g) {
|
|
526
554
|
return g && g.__esModule ? g : { default: g };
|
|
527
555
|
}
|
|
528
|
-
var e = /^#[a-fA-F0-9]{6}$/, s = /^#[a-fA-F0-9]{8}$/, l = /^#[a-fA-F0-9]{3}$/,
|
|
529
|
-
|
|
530
|
-
})(
|
|
531
|
-
var
|
|
532
|
-
(function(
|
|
556
|
+
var e = /^#[a-fA-F0-9]{6}$/, s = /^#[a-fA-F0-9]{8}$/, l = /^#[a-fA-F0-9]{3}$/, d = /^#[a-fA-F0-9]{4}$/, u = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i, f = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i, c = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i, h = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
|
|
557
|
+
a.exports = t.default;
|
|
558
|
+
})(D, D.exports);
|
|
559
|
+
var ge = D.exports;
|
|
560
|
+
(function(a, t) {
|
|
533
561
|
t.__esModule = !0, t.default = function(i) {
|
|
534
562
|
if (i === "transparent") return 0;
|
|
535
|
-
var
|
|
536
|
-
var
|
|
537
|
-
return
|
|
538
|
-
}), s = e[0], l = e[1],
|
|
539
|
-
return parseFloat((0.2126 * s + 0.7152 * l + 0.0722 *
|
|
563
|
+
var r = (0, o.default)(i), e = Object.keys(r).map(function(u) {
|
|
564
|
+
var f = r[u] / 255;
|
|
565
|
+
return f <= 0.03928 ? f / 12.92 : Math.pow((f + 0.055) / 1.055, 2.4);
|
|
566
|
+
}), s = e[0], l = e[1], d = e[2];
|
|
567
|
+
return parseFloat((0.2126 * s + 0.7152 * l + 0.0722 * d).toFixed(3));
|
|
540
568
|
};
|
|
541
|
-
var n,
|
|
542
|
-
|
|
543
|
-
})(
|
|
544
|
-
const
|
|
545
|
-
var
|
|
546
|
-
(function(
|
|
547
|
-
function n(
|
|
569
|
+
var n, o = (n = ge) && n.__esModule ? n : { default: n };
|
|
570
|
+
a.exports = t.default;
|
|
571
|
+
})(q, q.exports);
|
|
572
|
+
const Qe = fe(q.exports);
|
|
573
|
+
var G = { exports: {} }, V = { exports: {} };
|
|
574
|
+
(function(a, t) {
|
|
575
|
+
function n(o, i, r) {
|
|
548
576
|
return function() {
|
|
549
|
-
var e =
|
|
550
|
-
return e.length >= i ?
|
|
577
|
+
var e = r.concat(Array.prototype.slice.call(arguments));
|
|
578
|
+
return e.length >= i ? o.apply(this, e) : n(o, i, e);
|
|
551
579
|
};
|
|
552
580
|
}
|
|
553
|
-
t.__esModule = !0, t.default = function(
|
|
554
|
-
return n(
|
|
555
|
-
},
|
|
556
|
-
})(
|
|
557
|
-
var
|
|
558
|
-
|
|
559
|
-
return Math.max(
|
|
560
|
-
},
|
|
561
|
-
var
|
|
562
|
-
(function(
|
|
581
|
+
t.__esModule = !0, t.default = function(o) {
|
|
582
|
+
return n(o, o.length, []);
|
|
583
|
+
}, a.exports = t.default;
|
|
584
|
+
})(V, V.exports);
|
|
585
|
+
var we, j, Ce = V.exports, Z = { exports: {} };
|
|
586
|
+
we = Z, (j = Z.exports).__esModule = !0, j.default = void 0, j.default = function(a, t, n) {
|
|
587
|
+
return Math.max(a, Math.min(t, n));
|
|
588
|
+
}, we.exports = j.default;
|
|
589
|
+
var Ee = Z.exports, Q = { exports: {} }, X = { exports: {} };
|
|
590
|
+
(function(a, t) {
|
|
563
591
|
t.__esModule = !0, t.default = void 0, t.default = function(n) {
|
|
564
|
-
var
|
|
565
|
-
if (s === l) return n.alpha !== void 0 ? { hue: 0, saturation: 0, lightness:
|
|
566
|
-
var u = s - l,
|
|
592
|
+
var o, i = n.red / 255, r = n.green / 255, e = n.blue / 255, s = Math.max(i, r, e), l = Math.min(i, r, e), d = (s + l) / 2;
|
|
593
|
+
if (s === l) return n.alpha !== void 0 ? { hue: 0, saturation: 0, lightness: d, alpha: n.alpha } : { hue: 0, saturation: 0, lightness: d };
|
|
594
|
+
var u = s - l, f = d > 0.5 ? u / (2 - s - l) : u / (s + l);
|
|
567
595
|
switch (s) {
|
|
568
596
|
case i:
|
|
569
|
-
|
|
597
|
+
o = (r - e) / u + (r < e ? 6 : 0);
|
|
570
598
|
break;
|
|
571
|
-
case
|
|
572
|
-
|
|
599
|
+
case r:
|
|
600
|
+
o = (e - i) / u + 2;
|
|
573
601
|
break;
|
|
574
602
|
default:
|
|
575
|
-
|
|
603
|
+
o = (i - r) / u + 4;
|
|
576
604
|
}
|
|
577
|
-
return
|
|
578
|
-
},
|
|
579
|
-
})(
|
|
580
|
-
var
|
|
581
|
-
(function(
|
|
582
|
-
t.__esModule = !0, t.default = function(
|
|
583
|
-
return (0,
|
|
605
|
+
return o *= 60, n.alpha !== void 0 ? { hue: o, saturation: f, lightness: d, alpha: n.alpha } : { hue: o, saturation: f, lightness: d };
|
|
606
|
+
}, a.exports = t.default;
|
|
607
|
+
})(X, X.exports);
|
|
608
|
+
var Xe = X.exports;
|
|
609
|
+
(function(a, t) {
|
|
610
|
+
t.__esModule = !0, t.default = function(r) {
|
|
611
|
+
return (0, o.default)((0, n.default)(r));
|
|
584
612
|
};
|
|
585
|
-
var n = i(
|
|
586
|
-
function i(
|
|
587
|
-
return
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
})(
|
|
591
|
-
var
|
|
592
|
-
(function(
|
|
613
|
+
var n = i(ge), o = i(Xe);
|
|
614
|
+
function i(r) {
|
|
615
|
+
return r && r.__esModule ? r : { default: r };
|
|
616
|
+
}
|
|
617
|
+
a.exports = t.default;
|
|
618
|
+
})(Q, Q.exports);
|
|
619
|
+
var Ae = Q.exports, ee = { exports: {} }, te = { exports: {} }, ne = { exports: {} }, re = { exports: {} };
|
|
620
|
+
(function(a, t) {
|
|
593
621
|
t.__esModule = !0, t.default = void 0, t.default = function(n) {
|
|
594
622
|
return n.length === 7 && n[1] === n[2] && n[3] === n[4] && n[5] === n[6] ? "#" + n[1] + n[3] + n[5] : n;
|
|
595
|
-
},
|
|
596
|
-
})(ne, ne.exports);
|
|
597
|
-
var _e = ne.exports, re = { exports: {} };
|
|
598
|
-
(function(r, t) {
|
|
599
|
-
t.__esModule = !0, t.default = void 0, t.default = function(n) {
|
|
600
|
-
var d = n.toString(16);
|
|
601
|
-
return d.length === 1 ? "0" + d : d;
|
|
602
|
-
}, r.exports = t.default;
|
|
623
|
+
}, a.exports = t.default;
|
|
603
624
|
})(re, re.exports);
|
|
604
|
-
var
|
|
605
|
-
(function(
|
|
625
|
+
var Be = re.exports, ae = { exports: {} };
|
|
626
|
+
(function(a, t) {
|
|
627
|
+
t.__esModule = !0, t.default = void 0, t.default = function(n) {
|
|
628
|
+
var o = n.toString(16);
|
|
629
|
+
return o.length === 1 ? "0" + o : o;
|
|
630
|
+
}, a.exports = t.default;
|
|
631
|
+
})(ae, ae.exports);
|
|
632
|
+
var Ie = ae.exports;
|
|
633
|
+
(function(a, t) {
|
|
606
634
|
t.__esModule = !0, t.default = void 0;
|
|
607
|
-
var n =
|
|
608
|
-
function
|
|
635
|
+
var n = r(pe), o = r(Be), i = r(Ie);
|
|
636
|
+
function r(l) {
|
|
609
637
|
return l && l.__esModule ? l : { default: l };
|
|
610
638
|
}
|
|
611
639
|
function e(l) {
|
|
612
640
|
return (0, i.default)(Math.round(255 * l));
|
|
613
641
|
}
|
|
614
|
-
function s(l,
|
|
615
|
-
return (0,
|
|
642
|
+
function s(l, d, u) {
|
|
643
|
+
return (0, o.default)("#" + e(l) + e(d) + e(u));
|
|
616
644
|
}
|
|
617
|
-
t.default = function(l,
|
|
618
|
-
return (0, n.default)(l,
|
|
619
|
-
},
|
|
620
|
-
})(
|
|
621
|
-
var
|
|
622
|
-
(function(
|
|
623
|
-
t.__esModule = !0, t.default = function(
|
|
624
|
-
if (typeof
|
|
625
|
-
if (typeof
|
|
626
|
-
throw new
|
|
645
|
+
t.default = function(l, d, u) {
|
|
646
|
+
return (0, n.default)(l, d, u, s);
|
|
647
|
+
}, a.exports = t.default;
|
|
648
|
+
})(ne, ne.exports);
|
|
649
|
+
var Oe = ne.exports;
|
|
650
|
+
(function(a, t) {
|
|
651
|
+
t.__esModule = !0, t.default = function(r, e, s) {
|
|
652
|
+
if (typeof r == "number" && typeof e == "number" && typeof s == "number") return (0, n.default)(r, e, s);
|
|
653
|
+
if (typeof r == "object" && e === void 0 && s === void 0) return (0, n.default)(r.hue, r.saturation, r.lightness);
|
|
654
|
+
throw new o.default(1);
|
|
627
655
|
};
|
|
628
|
-
var n = i(
|
|
629
|
-
function i(
|
|
630
|
-
return
|
|
656
|
+
var n = i(Oe), o = i(B);
|
|
657
|
+
function i(r) {
|
|
658
|
+
return r && r.__esModule ? r : { default: r };
|
|
631
659
|
}
|
|
632
|
-
|
|
633
|
-
})(
|
|
634
|
-
var
|
|
635
|
-
(function(
|
|
636
|
-
t.__esModule = !0, t.default = function(e, s, l,
|
|
637
|
-
if (typeof e == "number" && typeof s == "number" && typeof l == "number" && typeof
|
|
638
|
-
if (typeof e == "object" && s === void 0 && l === void 0 &&
|
|
660
|
+
a.exports = t.default;
|
|
661
|
+
})(te, te.exports);
|
|
662
|
+
var et = te.exports, ie = { exports: {} };
|
|
663
|
+
(function(a, t) {
|
|
664
|
+
t.__esModule = !0, t.default = function(e, s, l, d) {
|
|
665
|
+
if (typeof e == "number" && typeof s == "number" && typeof l == "number" && typeof d == "number") return d >= 1 ? (0, n.default)(e, s, l) : "rgba(" + (0, o.default)(e, s, l) + "," + d + ")";
|
|
666
|
+
if (typeof e == "object" && s === void 0 && l === void 0 && d === void 0) return e.alpha >= 1 ? (0, n.default)(e.hue, e.saturation, e.lightness) : "rgba(" + (0, o.default)(e.hue, e.saturation, e.lightness) + "," + e.alpha + ")";
|
|
639
667
|
throw new i.default(2);
|
|
640
668
|
};
|
|
641
|
-
var n =
|
|
642
|
-
function
|
|
669
|
+
var n = r(Oe), o = r(pe), i = r(B);
|
|
670
|
+
function r(e) {
|
|
643
671
|
return e && e.__esModule ? e : { default: e };
|
|
644
672
|
}
|
|
645
|
-
|
|
646
|
-
})(
|
|
647
|
-
var
|
|
648
|
-
(function(
|
|
673
|
+
a.exports = t.default;
|
|
674
|
+
})(ie, ie.exports);
|
|
675
|
+
var tt = ie.exports, oe = { exports: {} };
|
|
676
|
+
(function(a, t) {
|
|
649
677
|
t.__esModule = !0, t.default = function(e, s, l) {
|
|
650
|
-
if (typeof e == "number" && typeof s == "number" && typeof l == "number") return (0, n.default)("#" + (0,
|
|
651
|
-
if (typeof e == "object" && s === void 0 && l === void 0) return (0, n.default)("#" + (0,
|
|
678
|
+
if (typeof e == "number" && typeof s == "number" && typeof l == "number") return (0, n.default)("#" + (0, o.default)(e) + (0, o.default)(s) + (0, o.default)(l));
|
|
679
|
+
if (typeof e == "object" && s === void 0 && l === void 0) return (0, n.default)("#" + (0, o.default)(e.red) + (0, o.default)(e.green) + (0, o.default)(e.blue));
|
|
652
680
|
throw new i.default(6);
|
|
653
681
|
};
|
|
654
|
-
var n =
|
|
655
|
-
function
|
|
682
|
+
var n = r(Be), o = r(Ie), i = r(B);
|
|
683
|
+
function r(e) {
|
|
656
684
|
return e && e.__esModule ? e : { default: e };
|
|
657
685
|
}
|
|
658
|
-
|
|
659
|
-
})(
|
|
660
|
-
var
|
|
661
|
-
(function(
|
|
662
|
-
t.__esModule = !0, t.default = function(e, s, l,
|
|
686
|
+
a.exports = t.default;
|
|
687
|
+
})(oe, oe.exports);
|
|
688
|
+
var Te = oe.exports, se = { exports: {} };
|
|
689
|
+
(function(a, t) {
|
|
690
|
+
t.__esModule = !0, t.default = function(e, s, l, d) {
|
|
663
691
|
if (typeof e == "string" && typeof s == "number") {
|
|
664
692
|
var u = (0, n.default)(e);
|
|
665
693
|
return "rgba(" + u.red + "," + u.green + "," + u.blue + "," + s + ")";
|
|
666
694
|
}
|
|
667
|
-
if (typeof e == "number" && typeof s == "number" && typeof l == "number" && typeof
|
|
668
|
-
if (typeof e == "object" && s === void 0 && l === void 0 &&
|
|
695
|
+
if (typeof e == "number" && typeof s == "number" && typeof l == "number" && typeof d == "number") return d >= 1 ? (0, o.default)(e, s, l) : "rgba(" + e + "," + s + "," + l + "," + d + ")";
|
|
696
|
+
if (typeof e == "object" && s === void 0 && l === void 0 && d === void 0) return e.alpha >= 1 ? (0, o.default)(e.red, e.green, e.blue) : "rgba(" + e.red + "," + e.green + "," + e.blue + "," + e.alpha + ")";
|
|
669
697
|
throw new i.default(7);
|
|
670
698
|
};
|
|
671
|
-
var n =
|
|
672
|
-
function
|
|
699
|
+
var n = r(ge), o = r(Te), i = r(B);
|
|
700
|
+
function r(e) {
|
|
673
701
|
return e && e.__esModule ? e : { default: e };
|
|
674
702
|
}
|
|
675
|
-
|
|
676
|
-
})(
|
|
677
|
-
var
|
|
678
|
-
(function(
|
|
679
|
-
t.__esModule = !0, t.default = function(
|
|
680
|
-
if (typeof
|
|
681
|
-
if (
|
|
682
|
-
if (l(
|
|
683
|
-
if (c
|
|
684
|
-
if (u(
|
|
703
|
+
a.exports = t.default;
|
|
704
|
+
})(se, se.exports);
|
|
705
|
+
var nt = se.exports;
|
|
706
|
+
(function(a, t) {
|
|
707
|
+
t.__esModule = !0, t.default = function(c) {
|
|
708
|
+
if (typeof c != "object") throw new e.default(8);
|
|
709
|
+
if (d(c)) return (0, r.default)(c);
|
|
710
|
+
if (l(c)) return (0, i.default)(c);
|
|
711
|
+
if (f(c)) return (0, o.default)(c);
|
|
712
|
+
if (u(c)) return (0, n.default)(c);
|
|
685
713
|
throw new e.default(8);
|
|
686
714
|
};
|
|
687
|
-
var n = s(
|
|
688
|
-
function s(
|
|
689
|
-
return
|
|
690
|
-
}
|
|
691
|
-
var l = function(
|
|
692
|
-
return typeof
|
|
693
|
-
},
|
|
694
|
-
return typeof
|
|
695
|
-
}, u = function(
|
|
696
|
-
return typeof
|
|
697
|
-
},
|
|
698
|
-
return typeof
|
|
715
|
+
var n = s(et), o = s(tt), i = s(Te), r = s(nt), e = s(B);
|
|
716
|
+
function s(c) {
|
|
717
|
+
return c && c.__esModule ? c : { default: c };
|
|
718
|
+
}
|
|
719
|
+
var l = function(c) {
|
|
720
|
+
return typeof c.red == "number" && typeof c.green == "number" && typeof c.blue == "number" && (typeof c.alpha != "number" || c.alpha === void 0);
|
|
721
|
+
}, d = function(c) {
|
|
722
|
+
return typeof c.red == "number" && typeof c.green == "number" && typeof c.blue == "number" && typeof c.alpha == "number";
|
|
723
|
+
}, u = function(c) {
|
|
724
|
+
return typeof c.hue == "number" && typeof c.saturation == "number" && typeof c.lightness == "number" && (typeof c.alpha != "number" || c.alpha === void 0);
|
|
725
|
+
}, f = function(c) {
|
|
726
|
+
return typeof c.hue == "number" && typeof c.saturation == "number" && typeof c.lightness == "number" && typeof c.alpha == "number";
|
|
699
727
|
};
|
|
700
|
-
|
|
701
|
-
})(
|
|
702
|
-
var
|
|
703
|
-
(function(
|
|
728
|
+
a.exports = t.default;
|
|
729
|
+
})(ee, ee.exports);
|
|
730
|
+
var We = ee.exports;
|
|
731
|
+
(function(a, t) {
|
|
704
732
|
t.__esModule = !0, t.default = void 0;
|
|
705
|
-
var n = e(
|
|
706
|
-
function e(
|
|
707
|
-
return
|
|
733
|
+
var n = e(Ce), o = e(Ee), i = e(Ae), r = e(We);
|
|
734
|
+
function e(d) {
|
|
735
|
+
return d && d.__esModule ? d : { default: d };
|
|
708
736
|
}
|
|
709
737
|
function s() {
|
|
710
|
-
return s = Object.assign ? Object.assign.bind() : function(
|
|
738
|
+
return s = Object.assign ? Object.assign.bind() : function(d) {
|
|
711
739
|
for (var u = 1; u < arguments.length; u++) {
|
|
712
|
-
var
|
|
713
|
-
for (var
|
|
740
|
+
var f = arguments[u];
|
|
741
|
+
for (var c in f) Object.prototype.hasOwnProperty.call(f, c) && (d[c] = f[c]);
|
|
714
742
|
}
|
|
715
|
-
return
|
|
743
|
+
return d;
|
|
716
744
|
}, s.apply(this, arguments);
|
|
717
745
|
}
|
|
718
|
-
var l = (0, n.default)(function(
|
|
746
|
+
var l = (0, n.default)(function(d, u) {
|
|
719
747
|
if (u === "transparent") return u;
|
|
720
|
-
var
|
|
721
|
-
return (0,
|
|
748
|
+
var f = (0, i.default)(u);
|
|
749
|
+
return (0, r.default)(s({}, f, { lightness: (0, o.default)(0, 1, f.lightness - parseFloat(d)) }));
|
|
722
750
|
});
|
|
723
|
-
t.default = l,
|
|
724
|
-
})(
|
|
725
|
-
const
|
|
726
|
-
var
|
|
727
|
-
(function(
|
|
751
|
+
t.default = l, a.exports = t.default;
|
|
752
|
+
})(G, G.exports);
|
|
753
|
+
const rt = fe(G.exports);
|
|
754
|
+
var de = { exports: {} };
|
|
755
|
+
(function(a, t) {
|
|
728
756
|
t.__esModule = !0, t.default = void 0;
|
|
729
|
-
var n = e(
|
|
730
|
-
function e(
|
|
731
|
-
return
|
|
757
|
+
var n = e(Ce), o = e(Ee), i = e(Ae), r = e(We);
|
|
758
|
+
function e(d) {
|
|
759
|
+
return d && d.__esModule ? d : { default: d };
|
|
732
760
|
}
|
|
733
761
|
function s() {
|
|
734
|
-
return s = Object.assign ? Object.assign.bind() : function(
|
|
762
|
+
return s = Object.assign ? Object.assign.bind() : function(d) {
|
|
735
763
|
for (var u = 1; u < arguments.length; u++) {
|
|
736
|
-
var
|
|
737
|
-
for (var
|
|
764
|
+
var f = arguments[u];
|
|
765
|
+
for (var c in f) Object.prototype.hasOwnProperty.call(f, c) && (d[c] = f[c]);
|
|
738
766
|
}
|
|
739
|
-
return
|
|
767
|
+
return d;
|
|
740
768
|
}, s.apply(this, arguments);
|
|
741
769
|
}
|
|
742
|
-
var l = (0, n.default)(function(
|
|
770
|
+
var l = (0, n.default)(function(d, u) {
|
|
743
771
|
if (u === "transparent") return u;
|
|
744
|
-
var
|
|
745
|
-
return (0,
|
|
772
|
+
var f = (0, i.default)(u);
|
|
773
|
+
return (0, r.default)(s({}, f, { lightness: (0, o.default)(0, 1, f.lightness + parseFloat(d)) }));
|
|
746
774
|
});
|
|
747
|
-
t.default = l,
|
|
748
|
-
})(
|
|
749
|
-
const
|
|
750
|
-
function
|
|
775
|
+
t.default = l, a.exports = t.default;
|
|
776
|
+
})(de, de.exports);
|
|
777
|
+
const at = fe(de.exports);
|
|
778
|
+
function it(a) {
|
|
751
779
|
if (!document.querySelector("style[data-widget-styles]")) {
|
|
752
780
|
var t, n;
|
|
753
781
|
(function() {
|
|
754
|
-
let
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
const e =
|
|
758
|
-
|
|
782
|
+
let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "#000", i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "FFF";
|
|
783
|
+
const r = document.createElement("style");
|
|
784
|
+
r.attributes.setNamedItem(document.createAttribute("data-widget-styles"));
|
|
785
|
+
const e = Qe(o) > 0.5;
|
|
786
|
+
r.textContent = `
|
|
759
787
|
.bf-trigger-button{position:fixed;bottom:16px;right:16px;width:36px;height:36px;border-radius:50%;border:none;box-shadow:0 1px 6px #0000000f,0 2px 32px #00000029;transition:transform 167ms cubic-bezier(.33,0,0,1);box-sizing:content-box;display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:1000;padding:12px;gap:10px;overflow:hidden}.bf-trigger-button.hidden{display:none}.trigger-button-icon{display:flex;align-items:center;justify-content:center;width:36px;height:36px;position:relative}.trigger-button-icon svg{width:100%;height:100%;position:absolute;inset:0}.trigger-button-icon>svg>path{transition:transform .3s ease,opacity .3s ease;transform:scale(.5);transform-origin:center;opacity:0}.trigger-button-icon .fish-icon{display:none}.trigger-button-icon .fish-icon.visible{display:block}.trigger-button-icon svg.visible{display:block}.trigger-button-icon>svg.visible>path{opacity:1;transform:scale(1)}.trigger-iframe{position:relative;width:100%;height:100%;border:none;outline:none;transform:translateZ(0)}.bf-iframe-container{display:none;position:fixed;z-index:2147483000000;background-color:#fff;bottom:0;right:0;width:100vw;height:100vh;border:none;overflow:hidden;opacity:0;pointer-events:none;transform:translateY(20px);transition:opacity .3s ease,transform .3s ease,width .2s ease-in-out,height .2s ease-in-out}.bf-iframe-container.open{display:block;opacity:1;transform:translateY(0);pointer-events:auto;top:0;left:0}@media (min-width: 576px){.bf-iframe-container{bottom:80px;right:24px;width:448px;height:min(750px,calc(100vh - 80px));border-radius:8px;border:1px solid var(--Dark-300, #D4D4D4);box-shadow:0 20px 25px -5px #1212171a,0 10px 10px -5px #1212170a}.bf-iframe-container.open{top:unset;left:unset}.bf-iframe-container.expanded{width:min(calc(448px * 1.35),calc(100vw - 16px));height:min(calc(750px * 1.35),calc(100vh - 80px))}}.iframe-loading-indicator{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center;z-index:10}.spinner{width:24px;height:24px;border:2px solid rgba(0,0,0,.1);border-radius:50%;border-top-color:#3498db;animation:spin 1s ease-in-out infinite}@keyframes spin{to{transform:rotate(360deg)}}.loading-error{width:24px;height:24px;position:relative;display:flex;align-items:center;justify-content:center}.loading-error:before,.loading-error:after{content:"";position:absolute;width:16px;height:2px;background-color:#e74c3c;border-radius:2px}.loading-error:before{transform:rotate(45deg)}.loading-error:after{transform:rotate(-45deg)}
|
|
760
|
-
.${
|
|
761
|
-
.${
|
|
762
|
-
background: ${e ?
|
|
788
|
+
.${L} { background: ${o}; }
|
|
789
|
+
.${L}:hover {
|
|
790
|
+
background: ${e ? rt(0.05, o) : at(0.05, o)};
|
|
763
791
|
}
|
|
764
792
|
.trigger-button-icon { color: ${i}; }
|
|
765
|
-
`, document.head.appendChild(
|
|
766
|
-
})((
|
|
793
|
+
`, document.head.appendChild(r);
|
|
794
|
+
})((a == null || (t = a.theme) === null || t === void 0 ? void 0 : t.inputButtonBgColor) || "#007bff", (a == null || (n = a.theme) === null || n === void 0 ? void 0 : n.textBaseColor) || "#ffffff");
|
|
767
795
|
}
|
|
768
796
|
}
|
|
769
|
-
function
|
|
797
|
+
function ot(a, t) {
|
|
770
798
|
const n = () => {
|
|
771
|
-
((
|
|
799
|
+
((o) => {
|
|
772
800
|
var i;
|
|
773
|
-
(i =
|
|
801
|
+
(i = a.contentWindow) === null || i === void 0 || i.postMessage({ type: "UPDATE_BODY_CLASS", isDarkMode: o }, "*");
|
|
774
802
|
})(document.body.classList.contains("dark"));
|
|
775
803
|
};
|
|
776
804
|
n(), (() => {
|
|
777
|
-
const
|
|
778
|
-
|
|
805
|
+
const o = new MutationObserver(n);
|
|
806
|
+
o.observe(document.body, { attributes: !0, attributeFilter: ["class"] }), t.addEventListener("abort", () => o.disconnect());
|
|
779
807
|
})();
|
|
780
808
|
}
|
|
781
|
-
function
|
|
809
|
+
function st(a, t) {
|
|
782
810
|
let n;
|
|
783
|
-
const
|
|
784
|
-
((
|
|
811
|
+
const o = () => {
|
|
812
|
+
((r) => {
|
|
785
813
|
var e;
|
|
786
|
-
const s = { type: "UPDATE_BODY_CLASS", isMobile:
|
|
787
|
-
(e =
|
|
814
|
+
const s = { type: "UPDATE_BODY_CLASS", isMobile: r };
|
|
815
|
+
(e = a.contentWindow) === null || e === void 0 || e.postMessage(s, "*"), r && (w.isWidgetOpen ? w.hideTriggerButton() : w.showTriggerButton());
|
|
788
816
|
})(document.body.clientWidth <= 576);
|
|
789
817
|
}, i = () => {
|
|
790
|
-
n && clearTimeout(n), n = window.setTimeout(
|
|
818
|
+
n && clearTimeout(n), n = window.setTimeout(o, 300);
|
|
791
819
|
};
|
|
792
|
-
|
|
793
|
-
const
|
|
794
|
-
|
|
820
|
+
o(), (() => {
|
|
821
|
+
const r = new ResizeObserver(i);
|
|
822
|
+
r.observe(document.body), t.addEventListener("abort", () => r.disconnect());
|
|
795
823
|
})();
|
|
796
824
|
}
|
|
797
|
-
function
|
|
798
|
-
const t = new TextEncoder().encode(
|
|
825
|
+
function K(a) {
|
|
826
|
+
const t = new TextEncoder().encode(a);
|
|
799
827
|
if (typeof window != "undefined" && typeof window.btoa == "function") {
|
|
800
|
-
const n = Array.from(t, (
|
|
828
|
+
const n = Array.from(t, (o) => String.fromCharCode(o)).join("");
|
|
801
829
|
return btoa(n);
|
|
802
830
|
}
|
|
803
831
|
if (typeof Buffer != "undefined") return Buffer.from(t).toString("base64");
|
|
804
832
|
throw new Error("[utils.base64Encode]: Unsupported environment");
|
|
805
833
|
}
|
|
806
|
-
const
|
|
807
|
-
function
|
|
808
|
-
let { isButtonHidden:
|
|
809
|
-
const
|
|
810
|
-
if (
|
|
834
|
+
const xe = /* @__PURE__ */ new Set();
|
|
835
|
+
function dt(a, t, n) {
|
|
836
|
+
let { isButtonHidden: o, triggerButtonIcon: i } = n;
|
|
837
|
+
const r = document.createDocumentFragment();
|
|
838
|
+
if (o) w.initialize({ isButtonHidden: o });
|
|
811
839
|
else {
|
|
812
|
-
const { button: l, icon:
|
|
813
|
-
const
|
|
814
|
-
return h.innerHTML =
|
|
840
|
+
const { button: l, icon: d } = function(u, f) {
|
|
841
|
+
const c = _("button", L, { id: `trigger-button-${u}`, "aria-controls": P, "aria-expanded": "false", "data-name": L }), h = _("div", "trigger-button-icon", { "aria-hidden": "true" });
|
|
842
|
+
return h.innerHTML = f ? `
|
|
815
843
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256" class="close-icon">
|
|
816
844
|
<path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"></path>
|
|
817
845
|
</svg>
|
|
818
|
-
<img src="${
|
|
846
|
+
<img src="${f}" class="fish-icon visible" alt="Trigger button icon" height="32" width="32" aria-hidden="true" aria-label="help button icon" />
|
|
819
847
|
` : `
|
|
820
848
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256" class="close-icon">
|
|
821
849
|
<path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"></path>
|
|
@@ -823,141 +851,185 @@ function rt(r, t, n) {
|
|
|
823
851
|
<svg width="24" height="14" viewBox="0 0 24 14" fill="none" xmlns="http://www.w3.org/2000/svg" class="fish-icon visible">
|
|
824
852
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.71844 10.3882L4.60606 6.98384L1.71844 3.58375C1.4014 3.21362 1.44424 2.65841 1.81269 2.33993C1.97978 2.1979 2.65242 1.98701 3.04657 2.43461L5.78425 5.65824C6.14281 5.29523 6.51693 4.95924 6.90479 4.65114C8.88976 3.07437 11.2345 2.22803 13.6931 2.22803C16.9492 2.22803 20.0039 3.71718 22.2917 6.41142C22.5702 6.74282 22.5702 7.22916 22.2917 7.56056C20.0039 10.2591 16.9492 11.744 13.6931 11.744C11.2348 11.744 8.89035 10.8948 6.90554 9.31995C6.51741 9.01199 6.14304 8.67628 5.78425 8.31374L3.04657 11.5374C2.72953 11.9075 2.18114 11.9505 1.81269 11.632C1.44852 11.3179 1.40568 10.7584 1.71844 10.3882ZM5.93026 10.4683C8.17161 12.2599 10.8546 13.25 13.6931 13.25C17.4881 13.25 21.019 11.4034 23.4447 8.52942C24.1873 7.64571 24.1843 6.31801 23.4397 5.43663C20.8944 2.43919 17.4337 0.722025 13.6931 0.722025C10.8555 0.722025 8.17194 1.70845 5.92952 3.50276L4.17682 1.43933C3.57943 0.760929 2.79325 0.630009 2.25286 0.662947C1.98116 0.679506 1.73125 0.736852 1.51895 0.811846C1.26839 0.900352 1.03017 1.02718 0.827835 1.20058C-0.165283 2.05903 -0.283916 3.561 0.574656 4.56345L2.63075 6.98445L0.568104 9.41623C-0.272133 10.4106 -0.166523 11.9125 0.827835 12.7714C1.81372 13.6243 3.34308 13.5062 4.19036 12.5171L5.93026 10.4683Z" fill="currentColor"/>
|
|
825
853
|
</svg>
|
|
826
|
-
`,
|
|
827
|
-
}(
|
|
828
|
-
|
|
854
|
+
`, c.setAttribute("aria-label", "Open Brainfish widget"), c.appendChild(h), { button: c, icon: h };
|
|
855
|
+
}(a, i);
|
|
856
|
+
r.appendChild(l), w.initialize({ button: l, icon: d });
|
|
829
857
|
}
|
|
830
858
|
const { iframeContainer: e, iframe: s } = function(l) {
|
|
831
|
-
const
|
|
832
|
-
u.setAttribute("aria-label", "Loading content"), u.setAttribute("role", "status"), u.appendChild(
|
|
833
|
-
const
|
|
834
|
-
return
|
|
835
|
-
u.style.display = "none",
|
|
836
|
-
}),
|
|
859
|
+
const d = _("div", P, { id: P, "aria-live": "polite", "aria-hidden": "true" }), u = _("div", "iframe-loading-indicator"), f = _("div", "spinner");
|
|
860
|
+
u.setAttribute("aria-label", "Loading content"), u.setAttribute("role", "status"), u.appendChild(f), d.appendChild(u);
|
|
861
|
+
const c = _("iframe", "trigger-iframe", { src: l, sandbox: "allow-scripts allow-same-origin allow-popups allow-forms", allow: "clipboard-write", role: "dialog" });
|
|
862
|
+
return c.style.opacity = "0", c.addEventListener("load", () => {
|
|
863
|
+
u.style.display = "none", c.style.opacity = "1";
|
|
864
|
+
}), c.addEventListener("error", (h) => {
|
|
837
865
|
console.error("Error loading iframe:", h), u.innerHTML = "";
|
|
838
|
-
const g =
|
|
866
|
+
const g = _("div", "loading-error");
|
|
839
867
|
u.appendChild(g), u.setAttribute("aria-label", "Failed to load content");
|
|
840
|
-
}),
|
|
868
|
+
}), d.appendChild(c), { iframeContainer: d, iframe: c };
|
|
841
869
|
}(t);
|
|
842
|
-
return
|
|
870
|
+
return r.appendChild(e), { fragment: r, iframe: s };
|
|
843
871
|
}
|
|
844
|
-
const
|
|
872
|
+
const lt = (a, t) => {
|
|
845
873
|
var n;
|
|
846
|
-
const
|
|
847
|
-
var
|
|
848
|
-
const { theme: e, settings: s } = t, l =
|
|
874
|
+
const o = ce(a.overrides), i = ((r = a.overrides) == null ? void 0 : r.widgetHost) || "https://agent.brainfi.sh";
|
|
875
|
+
var r;
|
|
876
|
+
const { theme: e, settings: s } = t, l = K(JSON.stringify((n = a.overrides) === null || n === void 0 ? void 0 : n.redirectRules)), d = `${i}/?widgetKey=${a.widgetKey}#${new URLSearchParams({ theme: K(JSON.stringify(e)), settings: K(JSON.stringify(s)), redirectRules: l }).toString()}`, u = s == null ? void 0 : s.hideTriggerButton, f = s == null ? void 0 : s.triggerButtonIcon;
|
|
849
877
|
try {
|
|
850
|
-
if (
|
|
878
|
+
if (c = a.widgetKey, xe.has(c) || function(y) {
|
|
851
879
|
return !!document.getElementById(`trigger-button-${y}`);
|
|
852
|
-
}(
|
|
853
|
-
|
|
854
|
-
const { fragment: h, iframe: g } =
|
|
880
|
+
}(a.widgetKey)) return;
|
|
881
|
+
it(t);
|
|
882
|
+
const { fragment: h, iframe: g } = dt(a.widgetKey, d, { isButtonHidden: u || !1, triggerButtonIcon: f || "" }), p = new AbortController(), { signal: m } = p;
|
|
855
883
|
g.onload = () => {
|
|
856
884
|
setTimeout(() => {
|
|
857
|
-
|
|
885
|
+
ot(g, m), Ve({ widgetHost: i, apiHost: o, widgetKey: a.widgetKey, signal: m }), st(g, m);
|
|
858
886
|
}, 0);
|
|
859
|
-
}, document.body.appendChild(h),
|
|
887
|
+
}, document.body.appendChild(h), xe.add(a.widgetKey);
|
|
860
888
|
const v = () => {
|
|
861
889
|
p.abort(), window.removeEventListener("beforeunload", v);
|
|
862
890
|
};
|
|
863
891
|
return void window.addEventListener("beforeunload", v);
|
|
864
892
|
} catch (h) {
|
|
865
893
|
(function(g, p, m) {
|
|
866
|
-
|
|
867
|
-
})(
|
|
894
|
+
x(g, p, p.message, m);
|
|
895
|
+
})(o, h, a.widgetKey);
|
|
868
896
|
}
|
|
869
|
-
var
|
|
897
|
+
var c;
|
|
870
898
|
};
|
|
871
|
-
var
|
|
872
|
-
const
|
|
873
|
-
if (
|
|
874
|
-
const t = window.fcWidget ?
|
|
875
|
-
t && t ===
|
|
899
|
+
var le = ((a) => (a.FRESHCHAT = "freshchat", a.INTERCOM = "intercom", a.ZENDESK = "zendesk", a.HELPSCOUT = "helpscout", a))(le || {});
|
|
900
|
+
const ut = (a) => b(void 0, null, function* () {
|
|
901
|
+
if (a.widgetType === C.Popup) {
|
|
902
|
+
const t = window.fcWidget ? le.FRESHCHAT : null;
|
|
903
|
+
t && t === le.FRESHCHAT && (yield b(void 0, null, function* () {
|
|
876
904
|
window.fcWidget || (yield new Promise((n) => setTimeout(n, 100))), window.fcWidget.hide(), window.fcWidget.on("widget:closed", () => {
|
|
877
905
|
window.fcWidget.hide();
|
|
878
906
|
});
|
|
879
907
|
}));
|
|
880
908
|
}
|
|
909
|
+
}), Se = "brainfish-nudges", ke = _e(), ct = (a, t) => b(void 0, null, function* () {
|
|
910
|
+
try {
|
|
911
|
+
yield ((n, o) => b(void 0, null, function* () {
|
|
912
|
+
if (document.getElementById(Se)) return;
|
|
913
|
+
const i = document.createElement("script");
|
|
914
|
+
i.id = Se, i.src = `https://cdn.jsdelivr.net/npm/@brainfish-ai/nudge-widget@latest/dist/index.${ke ? "umd" : "es"}.js`, i.type = ke ? "text/javascript" : "module", i.async = !0, i.crossOrigin = "anonymous", i.onerror = () => {
|
|
915
|
+
x(n, new Error(`Failed to load script: ${i.src}`), `Failed to load script: ${i.src}`, o);
|
|
916
|
+
}, document.head.appendChild(i);
|
|
917
|
+
}))(a, t);
|
|
918
|
+
} catch (n) {
|
|
919
|
+
x(a, n, "Failed to initialize Nudge widget", t);
|
|
920
|
+
}
|
|
881
921
|
});
|
|
882
|
-
let
|
|
883
|
-
const A = typeof window != "undefined" && window.Brainfish ? window.Brainfish : (
|
|
884
|
-
let
|
|
885
|
-
function n(i,
|
|
922
|
+
let M = null;
|
|
923
|
+
const A = typeof window != "undefined" && window.Brainfish ? window.Brainfish : (M || (M = /* @__PURE__ */ function() {
|
|
924
|
+
let a = [], t = null;
|
|
925
|
+
function n(i, r) {
|
|
886
926
|
if (t) {
|
|
887
927
|
const e = i.split(".");
|
|
888
928
|
let s = t;
|
|
889
|
-
for (let
|
|
929
|
+
for (let d = 0; d < e.length - 1; d++) s = s[e[d]];
|
|
890
930
|
const l = s[e[e.length - 1]];
|
|
891
|
-
if (typeof l == "function") return l.apply(s,
|
|
892
|
-
} else
|
|
931
|
+
if (typeof l == "function") return l.apply(s, r);
|
|
932
|
+
} else a.push([i, r]);
|
|
893
933
|
}
|
|
894
934
|
return { Widgets: { init: function() {
|
|
895
|
-
for (var i = arguments.length,
|
|
896
|
-
return n("Widgets.init",
|
|
935
|
+
for (var i = arguments.length, r = new Array(i), e = 0; e < i; e++) r[e] = arguments[e];
|
|
936
|
+
return n("Widgets.init", r);
|
|
897
937
|
}, identify: function() {
|
|
898
|
-
for (var i = arguments.length,
|
|
899
|
-
return n("Widgets.identify",
|
|
938
|
+
for (var i = arguments.length, r = new Array(i), e = 0; e < i; e++) r[e] = arguments[e];
|
|
939
|
+
return n("Widgets.identify", r);
|
|
940
|
+
}, setSignedAttributes: function() {
|
|
941
|
+
for (var i = arguments.length, r = new Array(i), e = 0; e < i; e++) r[e] = arguments[e];
|
|
942
|
+
return n("Widgets.setSignedAttributes", r);
|
|
900
943
|
}, open: () => n("Widgets.open", []), close: () => n("Widgets.close", []), isReady: !1 }, SearchWidget: { initStandard: function() {
|
|
901
|
-
for (var i = arguments.length,
|
|
902
|
-
return n("SearchWidget.initStandard",
|
|
944
|
+
for (var i = arguments.length, r = new Array(i), e = 0; e < i; e++) r[e] = arguments[e];
|
|
945
|
+
return n("SearchWidget.initStandard", r);
|
|
903
946
|
} }, HelpWidget: { initPopup: function() {
|
|
904
|
-
for (var i = arguments.length,
|
|
905
|
-
return n("HelpWidget.initPopup",
|
|
947
|
+
for (var i = arguments.length, r = new Array(i), e = 0; e < i; e++) r[e] = arguments[e];
|
|
948
|
+
return n("HelpWidget.initPopup", r);
|
|
906
949
|
}, close: function() {
|
|
907
|
-
for (var i = arguments.length,
|
|
908
|
-
return n("HelpWidget.close",
|
|
950
|
+
for (var i = arguments.length, r = new Array(i), e = 0; e < i; e++) r[e] = arguments[e];
|
|
951
|
+
return n("HelpWidget.close", r);
|
|
909
952
|
}, open: function() {
|
|
910
|
-
for (var i = arguments.length,
|
|
911
|
-
return n("HelpWidget.open",
|
|
953
|
+
for (var i = arguments.length, r = new Array(i), e = 0; e < i; e++) r[e] = arguments[e];
|
|
954
|
+
return n("HelpWidget.open", r);
|
|
912
955
|
}, toggle: function() {
|
|
913
|
-
for (var i = arguments.length,
|
|
914
|
-
return n("HelpWidget.toggle",
|
|
956
|
+
for (var i = arguments.length, r = new Array(i), e = 0; e < i; e++) r[e] = arguments[e];
|
|
957
|
+
return n("HelpWidget.toggle", r);
|
|
915
958
|
} }, _setRealBrainfish: function(i) {
|
|
916
|
-
for (t = i;
|
|
917
|
-
const [
|
|
918
|
-
n(
|
|
959
|
+
for (t = i; a.length > 0; ) {
|
|
960
|
+
const [r, e] = a.shift();
|
|
961
|
+
n(r, e);
|
|
919
962
|
}
|
|
920
963
|
} };
|
|
921
|
-
}(), typeof window != "undefined" && (window.Brainfish =
|
|
922
|
-
let
|
|
923
|
-
A.Widgets.isReady = !1, A.Widgets.identify = (
|
|
924
|
-
window.BrainfishAnalytics("identify",
|
|
925
|
-
}, A.Widgets.
|
|
964
|
+
}(), typeof window != "undefined" && (window.Brainfish = M)), M);
|
|
965
|
+
let z = null;
|
|
966
|
+
A.Widgets.isReady = !1, A.Widgets.identify = (a) => {
|
|
967
|
+
window.BrainfishAnalytics("identify", a);
|
|
968
|
+
}, A.Widgets.setSignedAttributes = (a) => {
|
|
969
|
+
try {
|
|
970
|
+
(function(n, o) {
|
|
971
|
+
if (typeof n != "string") throw new I("Invalid token specified: must be a string");
|
|
972
|
+
o || (o = {});
|
|
973
|
+
const i = o.header === !0 ? 0 : 1, r = n.split(".")[i];
|
|
974
|
+
if (typeof r != "string") throw new I(`Invalid token specified: missing part #${i + 1}`);
|
|
975
|
+
let e;
|
|
976
|
+
try {
|
|
977
|
+
e = qe(r);
|
|
978
|
+
} catch (s) {
|
|
979
|
+
throw new I(`Invalid token specified: invalid base64 for part #${i + 1} (${s.message})`);
|
|
980
|
+
}
|
|
981
|
+
try {
|
|
982
|
+
return JSON.parse(e);
|
|
983
|
+
} catch (s) {
|
|
984
|
+
throw new I(`Invalid token specified: invalid json for part #${i + 1} (${s.message})`);
|
|
985
|
+
}
|
|
986
|
+
})(a);
|
|
987
|
+
} catch (n) {
|
|
988
|
+
return void console.error("[Brainfish] Invalid JWT provided to setSignedAttributes:", n);
|
|
989
|
+
}
|
|
990
|
+
const t = document.querySelector("#bf-iframe-container .trigger-iframe");
|
|
991
|
+
if (t) {
|
|
992
|
+
const n = () => {
|
|
993
|
+
t.contentWindow && t.contentWindow.postMessage({ type: "SET_SIGNED_ATTRIBUTES", jwt: a }, "*");
|
|
994
|
+
};
|
|
995
|
+
t.contentWindow && n(), t.addEventListener("load", n);
|
|
996
|
+
}
|
|
997
|
+
}, A.Widgets.init = (a) => b(void 0, null, function* () {
|
|
926
998
|
window && (window.BrainfishAnalytics = window.BrainfishAnalytics || function() {
|
|
927
|
-
for (var
|
|
999
|
+
for (var r = arguments.length, e = new Array(r), s = 0; s < r; s++) e[s] = arguments[s];
|
|
928
1000
|
(window.BrainfishAnalytics.q = window.BrainfishAnalytics.q || []).push(e);
|
|
929
1001
|
});
|
|
930
|
-
const t =
|
|
931
|
-
var
|
|
1002
|
+
const t = ce(a.overrides), n = ((o = a.overrides) == null ? void 0 : o.analyticsApiHost) || "";
|
|
1003
|
+
var o;
|
|
932
1004
|
let i;
|
|
933
|
-
if (
|
|
1005
|
+
if (a.config) i = JSON.parse(((r) => {
|
|
934
1006
|
if (typeof window != "undefined" && typeof window.atob == "function") {
|
|
935
|
-
const e = atob(
|
|
936
|
-
for (let
|
|
1007
|
+
const e = atob(r), s = e.length, l = new Uint8Array(s);
|
|
1008
|
+
for (let d = 0; d < s; d++) l[d] = e.charCodeAt(d);
|
|
937
1009
|
return new TextDecoder().decode(l);
|
|
938
1010
|
}
|
|
939
|
-
if (typeof Buffer != "undefined") return Buffer.from(
|
|
1011
|
+
if (typeof Buffer != "undefined") return Buffer.from(r, "base64").toString("utf-8");
|
|
940
1012
|
throw new Error("[utils.base64Decode]: Unsupported environment");
|
|
941
|
-
})(
|
|
1013
|
+
})(a.config));
|
|
942
1014
|
else {
|
|
943
|
-
const { config:
|
|
944
|
-
i =
|
|
1015
|
+
const { config: r } = yield De({ widgetKey: a.widgetKey, apiHost: t });
|
|
1016
|
+
i = r;
|
|
945
1017
|
}
|
|
946
|
-
|
|
1018
|
+
z || (z = function(r, e, s, l) {
|
|
947
1019
|
return b(this, null, function* () {
|
|
948
|
-
var
|
|
949
|
-
const p = ((
|
|
950
|
-
m != null && m.startsWith("2.") ?
|
|
1020
|
+
var d, u, f, c, h, g;
|
|
1021
|
+
const p = ((d = r.overrides) === null || d === void 0 ? void 0 : d.enableRecording) || (e == null || (u = e.settings) === null || u === void 0 ? void 0 : u.enableRecording) || !1, m = ((f = r.overrides) === null || f === void 0 ? void 0 : f.version) || (e == null ? void 0 : e.version), v = [];
|
|
1022
|
+
m != null && m.startsWith("2.") ? lt(r, e) : v.push(Ye(r, e)), v.push(Ge(r.widgetKey, e.trackingToken || "", s, l, p, (e == null || (c = e.settings) === null || c === void 0 ? void 0 : c.recordingBlocklist) || [], e == null || (h = e.settings) === null || h === void 0 ? void 0 : h._allowLocalhostRecording, e == null || (g = e.settings) === null || g === void 0 ? void 0 : g._allowScreenRecording)), v.push(ct(s, r.widgetKey));
|
|
951
1023
|
const [y] = yield Promise.allSettled(v);
|
|
952
1024
|
y && y.status === "fulfilled" && y.value && A._setRealBrainfish(y.value);
|
|
953
1025
|
});
|
|
954
|
-
}(
|
|
1026
|
+
}(a, i, t, n)), yield z, yield ut(i), A.Widgets.isReady = !0, window.dispatchEvent(new Event("onBrainfishReady"));
|
|
955
1027
|
});
|
|
956
|
-
const
|
|
1028
|
+
const pt = function() {
|
|
957
1029
|
typeof window != "undefined" && window.BrainfishAnalytics && window.BrainfishAnalytics(...arguments);
|
|
958
1030
|
};
|
|
959
1031
|
export {
|
|
960
|
-
|
|
1032
|
+
pt as BrainfishAnalytics,
|
|
961
1033
|
A as default
|
|
962
1034
|
};
|
|
963
1035
|
//# sourceMappingURL=web.js.map
|