@brainfish-ai/widgets-initiator 1.8.1-alpha.1 → 1.10.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/initIframeTrigger/index.d.ts +0 -2
- package/dist/types/types/brainfish.d.ts +1 -1
- package/dist/types/utils/brainfishQueue.d.ts +1 -1
- package/dist/web.cjs.js +5 -5
- package/dist/web.cjs.js.map +1 -1
- package/dist/web.js +173 -172
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
package/dist/web.js
CHANGED
|
@@ -10,37 +10,37 @@ var L = (a, t, n) => t in a ? Te(a, t, { enumerable: !0, configurable: !0, writa
|
|
|
10
10
|
$e.call(t, n) && L(a, n, t[n]);
|
|
11
11
|
return a;
|
|
12
12
|
}, $ = (a, t) => We(a, Le(t));
|
|
13
|
-
var
|
|
13
|
+
var C = (a, t, n) => L(a, typeof t != "symbol" ? t + "" : t, n);
|
|
14
14
|
var v = (a, t, n) => new Promise((s, i) => {
|
|
15
|
-
var r = (
|
|
15
|
+
var r = (d) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
17
|
+
l(n.next(d));
|
|
18
18
|
} catch (o) {
|
|
19
19
|
i(o);
|
|
20
20
|
}
|
|
21
|
-
}, e = (
|
|
21
|
+
}, e = (d) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
23
|
+
l(n.throw(d));
|
|
24
24
|
} catch (o) {
|
|
25
25
|
i(o);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, l = (d) => d.done ? s(d.value) : Promise.resolve(d.value).then(r, e);
|
|
28
|
+
l((n = n.apply(a, t)).next());
|
|
29
29
|
});
|
|
30
|
-
var
|
|
30
|
+
var A, R;
|
|
31
31
|
(function() {
|
|
32
32
|
try {
|
|
33
33
|
var a = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}, t = new a.Error().stack;
|
|
34
|
-
t && (a._sentryDebugIds = a._sentryDebugIds || {}, a._sentryDebugIds[t] = "
|
|
34
|
+
t && (a._sentryDebugIds = a._sentryDebugIds || {}, a._sentryDebugIds[t] = "1109afa4-1c36-47ff-a6f0-f20dd7b84689", a._sentryDebugIdIdentifier = "sentry-dbid-1109afa4-1c36-47ff-a6f0-f20dd7b84689");
|
|
35
35
|
} catch (n) {
|
|
36
36
|
}
|
|
37
|
-
})(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "
|
|
37
|
+
})(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "f738d39870be32f3150c4e943a3ba3a7d09c2b85" }, function(a) {
|
|
38
38
|
a.Sidebar = "sidebar", a.Searchbar = "searchbar";
|
|
39
|
-
}(
|
|
39
|
+
}(A || (A = {})), A.Sidebar, A.Searchbar;
|
|
40
40
|
class de extends Error {
|
|
41
41
|
constructor(n, s) {
|
|
42
42
|
super(n, s);
|
|
43
|
-
|
|
43
|
+
C(this, "cause");
|
|
44
44
|
this.name = "BrainfishWidgetError", this.cause = s == null ? void 0 : s.cause, Error.captureStackTrace && Error.captureStackTrace(this, de), this.cause instanceof Error && this.cause.stack && (this.stack = this.stack + `
|
|
45
45
|
Caused by: ` + this.cause.stack);
|
|
46
46
|
}
|
|
@@ -51,7 +51,7 @@ Caused by: ` + this.cause.stack);
|
|
|
51
51
|
(function(a) {
|
|
52
52
|
a.LINK = "link", a.CALLBACK = "callback", a.EMAIL = "email", a.PHONE = "phone";
|
|
53
53
|
})(R || (R = {}));
|
|
54
|
-
const
|
|
54
|
+
const S = (a, t, n, s) => {
|
|
55
55
|
let i = n, r = {};
|
|
56
56
|
if (t instanceof Error) try {
|
|
57
57
|
r = JSON.parse(t.message), i += ` - ${r.message || t.message}`;
|
|
@@ -59,24 +59,24 @@ const k = (a, t, n, s) => {
|
|
|
59
59
|
i += ` - ${t.message}`;
|
|
60
60
|
}
|
|
61
61
|
else i += ` - ${String(t)}`;
|
|
62
|
-
((e,
|
|
62
|
+
((e, l, d) => {
|
|
63
63
|
if (!navigator || navigator.userAgent.toLowerCase().includes("headless")) return;
|
|
64
|
-
const o =
|
|
65
|
-
fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key":
|
|
64
|
+
const o = l.toJSON();
|
|
65
|
+
fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": d }, body: JSON.stringify({ error: `WebWidgetVersion: 1.10.0-alpha.1. ${l.message}`, stack: l.stack, cause: { message: o.message, stack: o.stack, cause: o.cause } }) });
|
|
66
66
|
})(a, new de(i, { cause: r }), s);
|
|
67
67
|
}, He = (a) => v(void 0, null, function* () {
|
|
68
68
|
let { widgetKey: t, apiHost: n } = a;
|
|
69
69
|
return function(s, i, r) {
|
|
70
70
|
return v(this, null, function* () {
|
|
71
|
-
let e,
|
|
72
|
-
for (;
|
|
73
|
-
const
|
|
74
|
-
if (!
|
|
75
|
-
const o = yield
|
|
71
|
+
let e, l = 0;
|
|
72
|
+
for (; l < 3; ) try {
|
|
73
|
+
const d = yield fetch(`${s}${i}`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": r } });
|
|
74
|
+
if (!d.ok) throw new Error(`API call failed with status: ${d.status}`);
|
|
75
|
+
const o = yield d.json();
|
|
76
76
|
if (!o) throw new Error("Error loading config: empty response");
|
|
77
77
|
return o;
|
|
78
|
-
} catch (
|
|
79
|
-
if (e =
|
|
78
|
+
} catch (d) {
|
|
79
|
+
if (e = d, l++, l >= 3) throw S(s, d, "Error fetching config", r), e;
|
|
80
80
|
yield new Promise((o) => setTimeout(o, 500));
|
|
81
81
|
}
|
|
82
82
|
});
|
|
@@ -97,22 +97,22 @@ const k = (a, t, n, s) => {
|
|
|
97
97
|
let { apiHost: t, widgetKey: n, version: s } = a;
|
|
98
98
|
try {
|
|
99
99
|
const i = `https://cdn.jsdelivr.net/npm/@brainfish-ai/search-widget@${s}/dist/web.js`, r = H ? i.replace("web.js", "web.umd.js") : i;
|
|
100
|
-
return { widget: yield ((
|
|
101
|
-
return document.getElementById("brainfish-widget") ? window.Brainfish : new Promise((
|
|
100
|
+
return { widget: yield ((l) => v(void 0, null, function* () {
|
|
101
|
+
return document.getElementById("brainfish-widget") ? window.Brainfish : new Promise((d, o) => {
|
|
102
102
|
const u = document.createElement("script");
|
|
103
|
-
u.id = "brainfish-widget", u.src =
|
|
103
|
+
u.id = "brainfish-widget", u.src = l, u.type = H ? "text/javascript" : "module", u.async = !0, u.crossOrigin = "anonymous", u.onload = () => {
|
|
104
104
|
setTimeout(() => {
|
|
105
105
|
const c = window.Brainfish;
|
|
106
|
-
c ?
|
|
106
|
+
c ? d(c) : o(new Error("Failed to load Brainfish module"));
|
|
107
107
|
}, 200);
|
|
108
108
|
}, u.onerror = (c) => {
|
|
109
|
-
const f = c, g = { message: `Failed to load script: ${
|
|
109
|
+
const f = c, g = { message: `Failed to load script: ${l}`, type: f.type, fileName: f.filename, lineNumber: f.lineno, columnNumber: f.colno, error: f.error ? f.error.toString() : "Unknown error" };
|
|
110
110
|
o(new Error(JSON.stringify(g)));
|
|
111
111
|
}, H || document.head.appendChild(u);
|
|
112
112
|
});
|
|
113
113
|
}))(r) };
|
|
114
114
|
} catch (i) {
|
|
115
|
-
|
|
115
|
+
S(t, i, i.message, n);
|
|
116
116
|
}
|
|
117
117
|
}), me = /* @__PURE__ */ new Set(), Re = (a, t) => v(void 0, null, function* () {
|
|
118
118
|
const n = le(a.overrides);
|
|
@@ -122,43 +122,43 @@ const k = (a, t, n, s) => {
|
|
|
122
122
|
if (s) {
|
|
123
123
|
const { widget: i } = s, r = Ke({ config: t, apiKey: a.widgetKey, apiHost: n });
|
|
124
124
|
return a.overrides && t.settings && Object.entries(a.overrides).forEach((e) => {
|
|
125
|
-
let [
|
|
126
|
-
t.settings &&
|
|
125
|
+
let [l, d] = e;
|
|
126
|
+
t.settings && l in t.settings && (t.settings[l] = function() {
|
|
127
127
|
let o = arguments.length > 1 ? arguments[1] : void 0;
|
|
128
128
|
const u = new Map((arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).map((c) => [c.label, c]));
|
|
129
129
|
return o.forEach((c) => u.set(c.label, c)), Array.from(u.values());
|
|
130
|
-
}(t.settings[
|
|
131
|
-
}), function(e,
|
|
132
|
-
|
|
130
|
+
}(t.settings[l], d));
|
|
131
|
+
}), function(e, l) {
|
|
132
|
+
l.widgetType === A.Searchbar || l.widgetType === "Search" ? e.SearchWidget.initStandard(l) : e.HelpWidget.initPopup(l);
|
|
133
133
|
}(i, r), me.add(a.widgetKey), i;
|
|
134
134
|
}
|
|
135
135
|
} catch (s) {
|
|
136
|
-
|
|
136
|
+
S(n, s, s.message, a.widgetKey);
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
let be = !1;
|
|
140
140
|
const qe = function(s, i, r) {
|
|
141
141
|
return v(this, arguments, function* (a, t, n) {
|
|
142
|
-
let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "",
|
|
143
|
-
if (t ||
|
|
142
|
+
let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "", l = arguments.length > 4 && arguments[4] !== void 0 && arguments[4], d = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : [], o = arguments.length > 6 ? arguments[6] : void 0;
|
|
143
|
+
if (t || S(n, new Error("Access key is required"), "Access key is required", a), !be) try {
|
|
144
144
|
const u = (() => {
|
|
145
145
|
if (typeof window == "undefined" || typeof navigator == "undefined") return !1;
|
|
146
146
|
const c = navigator, f = window, g = (c.doNotTrack || f.doNotTrack || c.msDoNotTrack || "0").toString().toLowerCase();
|
|
147
147
|
return ["1", "yes", "true"].includes(g);
|
|
148
148
|
})();
|
|
149
|
-
window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !
|
|
149
|
+
window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !0, trackAttributes: !u, trackOutgoingLinks: !u, enableRecording: !u && l, recordingBlocklist: d, _allowLocalhostRecording: o }), be = !0, yield ((c, f) => v(this, null, function* () {
|
|
150
150
|
if (document.getElementById("brainfish-analytics")) return window.BrainfishAnalytics;
|
|
151
151
|
const g = document.createElement("script");
|
|
152
152
|
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
|
-
|
|
153
|
+
S(c, new Error(`Failed to load script: ${g.src}`), `Failed to load script: ${g.src}`, f);
|
|
154
154
|
}, document.head.appendChild(g);
|
|
155
155
|
}))(n, a);
|
|
156
156
|
} catch (u) {
|
|
157
|
-
|
|
157
|
+
S(n, u, "Failed to initialize BrainfishAnalytics", a);
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
160
|
};
|
|
161
|
-
function
|
|
161
|
+
function k(a, t) {
|
|
162
162
|
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
163
163
|
const s = document.createElement(a);
|
|
164
164
|
return s.className = t, Object.entries(n).forEach((i) => {
|
|
@@ -208,27 +208,27 @@ class y {
|
|
|
208
208
|
(t = this.button) === null || t === void 0 || t.classList.add("hidden");
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
|
|
211
|
+
C(y, "isOpen", !1), C(y, "button", null), C(y, "icon", null), C(y, "isButtonHidden", !1);
|
|
212
212
|
function Ne(a) {
|
|
213
213
|
let { widgetHost: t, apiHost: n, widgetKey: s, signal: i } = a;
|
|
214
214
|
window.addEventListener("message", (r) => {
|
|
215
215
|
if (r.origin !== t) return;
|
|
216
216
|
const { type: e } = r.data;
|
|
217
217
|
if (e === "TOGGLE_WIDGET_SIZE" && function() {
|
|
218
|
-
const
|
|
219
|
-
|
|
218
|
+
const l = document.querySelector(`.${T}`);
|
|
219
|
+
l.classList.contains("expanded") ? l.classList.remove("expanded") : l.classList.add("expanded");
|
|
220
220
|
}(), e === "TRACK_EVENT") {
|
|
221
221
|
if (!window.BrainfishAnalytics) return;
|
|
222
|
-
const { eventName:
|
|
223
|
-
window.BrainfishAnalytics("track",
|
|
222
|
+
const { eventName: l, data: d } = r.data;
|
|
223
|
+
window.BrainfishAnalytics("track", l, d);
|
|
224
224
|
}
|
|
225
225
|
if (e === "CLOSE_WIDGET" && (window.BrainfishAnalytics("track", "Close Widget"), y.toggleIframeVisibility()), e === "NEXT_BEST_ACTION_CLICKED") {
|
|
226
|
-
const { action:
|
|
227
|
-
if (!["function", "callback"].includes(
|
|
228
|
-
if (window.__bfCallbacks = window.__bfCallbacks || {}, window.__bfCallbacks[
|
|
229
|
-
const f = `${n}/api/searchWidgets.callback.codeblocks?apiKey=${s}&codeblockId=${
|
|
226
|
+
const { action: l, searchQueryId: d, query: o, answer: u } = r.data, c = { action: l, searchQueryId: d };
|
|
227
|
+
if (!["function", "callback"].includes(l.type)) return void console.error("Invalid action type", l);
|
|
228
|
+
if (window.__bfCallbacks = window.__bfCallbacks || {}, window.__bfCallbacks[l.id]) return void window.__bfCallbacks[l.id](o, u, c);
|
|
229
|
+
const f = `${n}/api/searchWidgets.callback.codeblocks?apiKey=${s}&codeblockId=${l.id}`, g = document.createElement("script");
|
|
230
230
|
g.src = f, document.head.appendChild(g), g.onload = () => {
|
|
231
|
-
window.__bfCallbacks[
|
|
231
|
+
window.__bfCallbacks[l.id](o, u, c), setTimeout(() => {
|
|
232
232
|
document.head.removeChild(g);
|
|
233
233
|
}, 300);
|
|
234
234
|
};
|
|
@@ -246,12 +246,12 @@ var q = { exports: {} }, N = { exports: {} }, D = { exports: {} };
|
|
|
246
246
|
function s(i, r, e) {
|
|
247
247
|
return n(i) + "," + n(r) + "," + n(e);
|
|
248
248
|
}
|
|
249
|
-
t.__esModule = !0, t.default = void 0, t.default = function(i, r, e,
|
|
250
|
-
if (
|
|
251
|
-
var
|
|
252
|
-
|
|
249
|
+
t.__esModule = !0, t.default = void 0, t.default = function(i, r, e, l) {
|
|
250
|
+
if (l === void 0 && (l = s), r === 0) return l(e, e, e);
|
|
251
|
+
var d = (i % 360 + 360) % 360 / 60, o = (1 - Math.abs(2 * e - 1)) * r, u = o * (1 - Math.abs(d % 2 - 1)), c = 0, f = 0, g = 0;
|
|
252
|
+
d >= 0 && d < 1 ? (c = o, f = u) : d >= 1 && d < 2 ? (c = u, f = o) : d >= 2 && d < 3 ? (f = o, g = u) : d >= 3 && d < 4 ? (f = u, g = o) : d >= 4 && d < 5 ? (c = u, g = o) : d >= 5 && d < 6 && (c = o, g = u);
|
|
253
253
|
var h = e - o / 2;
|
|
254
|
-
return
|
|
254
|
+
return l(c + h, f + h, g + h);
|
|
255
255
|
}, a.exports = t.default;
|
|
256
256
|
})(D, D.exports);
|
|
257
257
|
var fe = D.exports, J = { exports: {} };
|
|
@@ -266,7 +266,7 @@ var fe = D.exports, J = { exports: {} };
|
|
|
266
266
|
})(J, J.exports);
|
|
267
267
|
var De = J.exports, Y = { exports: {} };
|
|
268
268
|
(function(a, t) {
|
|
269
|
-
function n(
|
|
269
|
+
function n(d) {
|
|
270
270
|
var o = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
271
271
|
return n = function(u) {
|
|
272
272
|
if (u === null || !function(f) {
|
|
@@ -291,27 +291,27 @@ var De = J.exports, Y = { exports: {} };
|
|
|
291
291
|
}(u, arguments, r(this).constructor);
|
|
292
292
|
}
|
|
293
293
|
return c.prototype = Object.create(u.prototype, { constructor: { value: c, enumerable: !1, writable: !0, configurable: !0 } }), i(c, u);
|
|
294
|
-
}, n(
|
|
294
|
+
}, n(d);
|
|
295
295
|
}
|
|
296
296
|
function s() {
|
|
297
297
|
try {
|
|
298
|
-
var
|
|
298
|
+
var d = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
299
299
|
}));
|
|
300
300
|
} catch (o) {
|
|
301
301
|
}
|
|
302
302
|
return (s = function() {
|
|
303
|
-
return !!
|
|
303
|
+
return !!d;
|
|
304
304
|
})();
|
|
305
305
|
}
|
|
306
|
-
function i(
|
|
306
|
+
function i(d, o) {
|
|
307
307
|
return i = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(u, c) {
|
|
308
308
|
return u.__proto__ = c, u;
|
|
309
|
-
}, i(
|
|
309
|
+
}, i(d, o);
|
|
310
310
|
}
|
|
311
|
-
function r(
|
|
311
|
+
function r(d) {
|
|
312
312
|
return r = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) {
|
|
313
313
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
314
|
-
}, r(
|
|
314
|
+
}, r(d);
|
|
315
315
|
}
|
|
316
316
|
t.__esModule = !0, t.default = void 0;
|
|
317
317
|
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 }).
|
|
@@ -463,48 +463,48 @@ To pass a single animation please supply them in simple values, e.g. animation('
|
|
|
463
463
|
|
|
464
464
|
`, 78: `base must be set in "px" or "%" but you set it in "%s".
|
|
465
465
|
` };
|
|
466
|
-
function
|
|
467
|
-
for (var
|
|
466
|
+
function l() {
|
|
467
|
+
for (var d = arguments.length, o = new Array(d), u = 0; u < d; u++) o[u] = arguments[u];
|
|
468
468
|
var c, f = o[0], g = [];
|
|
469
469
|
for (c = 1; c < o.length; c += 1) g.push(o[c]);
|
|
470
470
|
return g.forEach(function(h) {
|
|
471
471
|
f = f.replace(/%[a-z]/, h);
|
|
472
472
|
}), f;
|
|
473
473
|
}
|
|
474
|
-
t.default = function(
|
|
474
|
+
t.default = function(d) {
|
|
475
475
|
var o, u;
|
|
476
476
|
function c(f) {
|
|
477
477
|
var g;
|
|
478
|
-
if (process.env.NODE_ENV === "production") g =
|
|
478
|
+
if (process.env.NODE_ENV === "production") g = d.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + f + " for more information.") || this;
|
|
479
479
|
else {
|
|
480
480
|
for (var h = arguments.length, p = new Array(h > 1 ? h - 1 : 0), m = 1; m < h; m++) p[m - 1] = arguments[m];
|
|
481
|
-
g =
|
|
481
|
+
g = d.call(this, l.apply(void 0, [e[f]].concat(p))) || this;
|
|
482
482
|
}
|
|
483
483
|
return function(b) {
|
|
484
484
|
if (b === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
485
485
|
return b;
|
|
486
486
|
}(g);
|
|
487
487
|
}
|
|
488
|
-
return u =
|
|
488
|
+
return u = d, (o = c).prototype = Object.create(u.prototype), o.prototype.constructor = o, i(o, u), c;
|
|
489
489
|
}(n(Error)), a.exports = t.default;
|
|
490
490
|
})(Y, Y.exports);
|
|
491
|
-
var
|
|
491
|
+
var E = Y.exports;
|
|
492
492
|
(function(a, t) {
|
|
493
493
|
t.__esModule = !0, t.default = function(h) {
|
|
494
494
|
if (typeof h != "string") throw new i.default(3);
|
|
495
495
|
var p = (0, s.default)(h);
|
|
496
496
|
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
|
-
if (p.match(
|
|
497
|
+
if (p.match(l)) {
|
|
498
498
|
var m = parseFloat((parseInt("" + p[7] + p[8], 16) / 255).toFixed(2));
|
|
499
499
|
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
500
|
}
|
|
501
|
-
if (p.match(
|
|
501
|
+
if (p.match(d)) return { red: parseInt("" + p[1] + p[1], 16), green: parseInt("" + p[2] + p[2], 16), blue: parseInt("" + p[3] + p[3], 16) };
|
|
502
502
|
if (p.match(o)) {
|
|
503
503
|
var b = parseFloat((parseInt("" + p[4] + p[4], 16) / 255).toFixed(2));
|
|
504
504
|
return { red: parseInt("" + p[1] + p[1], 16), green: parseInt("" + p[2] + p[2], 16), blue: parseInt("" + p[3] + p[3], 16), alpha: b };
|
|
505
505
|
}
|
|
506
|
-
var
|
|
507
|
-
if (
|
|
506
|
+
var x = u.exec(p);
|
|
507
|
+
if (x) return { red: parseInt("" + x[1], 10), green: parseInt("" + x[2], 10), blue: parseInt("" + x[3], 10) };
|
|
508
508
|
var w = c.exec(p.substring(0, 50));
|
|
509
509
|
if (w) return { red: parseInt("" + w[1], 10), green: parseInt("" + w[2], 10), blue: parseInt("" + w[3], 10), alpha: parseFloat("" + w[4]) > 1 ? parseFloat("" + w[4]) / 100 : parseFloat("" + w[4]) };
|
|
510
510
|
var I = f.exec(p);
|
|
@@ -513,19 +513,19 @@ var C = Y.exports;
|
|
|
513
513
|
if (!O) throw new i.default(4, p, pe);
|
|
514
514
|
return { red: parseInt("" + O[1], 10), green: parseInt("" + O[2], 10), blue: parseInt("" + O[3], 10) };
|
|
515
515
|
}
|
|
516
|
-
var
|
|
517
|
-
if (
|
|
518
|
-
var Me = parseInt("" +
|
|
516
|
+
var _ = g.exec(p.substring(0, 50));
|
|
517
|
+
if (_) {
|
|
518
|
+
var Me = parseInt("" + _[1], 10), je = parseInt("" + _[2], 10) / 100, Pe = parseInt("" + _[3], 10) / 100, ge = "rgb(" + (0, n.default)(Me, je, Pe) + ")", M = u.exec(ge);
|
|
519
519
|
if (!M) throw new i.default(4, p, ge);
|
|
520
|
-
return { red: parseInt("" + M[1], 10), green: parseInt("" + M[2], 10), blue: parseInt("" + M[3], 10), alpha: parseFloat("" +
|
|
520
|
+
return { red: parseInt("" + M[1], 10), green: parseInt("" + M[2], 10), blue: parseInt("" + M[3], 10), alpha: parseFloat("" + _[4]) > 1 ? parseFloat("" + _[4]) / 100 : parseFloat("" + _[4]) };
|
|
521
521
|
}
|
|
522
522
|
throw new i.default(5);
|
|
523
523
|
};
|
|
524
|
-
var n = r(fe), s = r(De), i = r(
|
|
524
|
+
var n = r(fe), s = r(De), i = r(E);
|
|
525
525
|
function r(h) {
|
|
526
526
|
return h && h.__esModule ? h : { default: h };
|
|
527
527
|
}
|
|
528
|
-
var e = /^#[a-fA-F0-9]{6}$/,
|
|
528
|
+
var e = /^#[a-fA-F0-9]{6}$/, l = /^#[a-fA-F0-9]{8}$/, d = /^#[a-fA-F0-9]{3}$/, o = /^#[a-fA-F0-9]{4}$/, u = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i, c = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i, f = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i, g = /^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;
|
|
529
529
|
a.exports = t.default;
|
|
530
530
|
})(N, N.exports);
|
|
531
531
|
var ce = N.exports;
|
|
@@ -535,8 +535,8 @@ var ce = N.exports;
|
|
|
535
535
|
var r = (0, s.default)(i), e = Object.keys(r).map(function(u) {
|
|
536
536
|
var c = r[u] / 255;
|
|
537
537
|
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
538
|
-
}),
|
|
539
|
-
return parseFloat((0.2126 *
|
|
538
|
+
}), l = e[0], d = e[1], o = e[2];
|
|
539
|
+
return parseFloat((0.2126 * l + 0.7152 * d + 0.0722 * o).toFixed(3));
|
|
540
540
|
};
|
|
541
541
|
var n, s = (n = ce) && n.__esModule ? n : { default: n };
|
|
542
542
|
a.exports = t.default;
|
|
@@ -561,10 +561,10 @@ ve = V, (j = V.exports).__esModule = !0, j.default = void 0, j.default = functio
|
|
|
561
561
|
var xe = V.exports, Z = { exports: {} }, Q = { exports: {} };
|
|
562
562
|
(function(a, t) {
|
|
563
563
|
t.__esModule = !0, t.default = void 0, t.default = function(n) {
|
|
564
|
-
var s, i = n.red / 255, r = n.green / 255, e = n.blue / 255,
|
|
565
|
-
if (
|
|
566
|
-
var u =
|
|
567
|
-
switch (
|
|
564
|
+
var s, i = n.red / 255, r = n.green / 255, e = n.blue / 255, l = Math.max(i, r, e), d = Math.min(i, r, e), o = (l + d) / 2;
|
|
565
|
+
if (l === d) return n.alpha !== void 0 ? { hue: 0, saturation: 0, lightness: o, alpha: n.alpha } : { hue: 0, saturation: 0, lightness: o };
|
|
566
|
+
var u = l - d, c = o > 0.5 ? u / (2 - l - d) : u / (l + d);
|
|
567
|
+
switch (l) {
|
|
568
568
|
case i:
|
|
569
569
|
s = (r - e) / u + (r < e ? 6 : 0);
|
|
570
570
|
break;
|
|
@@ -605,27 +605,27 @@ var Se = re.exports;
|
|
|
605
605
|
(function(a, t) {
|
|
606
606
|
t.__esModule = !0, t.default = void 0;
|
|
607
607
|
var n = r(fe), s = r(ke), i = r(Se);
|
|
608
|
-
function r(
|
|
609
|
-
return
|
|
608
|
+
function r(d) {
|
|
609
|
+
return d && d.__esModule ? d : { default: d };
|
|
610
610
|
}
|
|
611
|
-
function e(
|
|
612
|
-
return (0, i.default)(Math.round(255 *
|
|
611
|
+
function e(d) {
|
|
612
|
+
return (0, i.default)(Math.round(255 * d));
|
|
613
613
|
}
|
|
614
|
-
function d
|
|
615
|
-
return (0, s.default)("#" + e(
|
|
614
|
+
function l(d, o, u) {
|
|
615
|
+
return (0, s.default)("#" + e(d) + e(o) + e(u));
|
|
616
616
|
}
|
|
617
|
-
t.default = function(
|
|
618
|
-
return (0, n.default)(
|
|
617
|
+
t.default = function(d, o, u) {
|
|
618
|
+
return (0, n.default)(d, o, u, l);
|
|
619
619
|
}, a.exports = t.default;
|
|
620
620
|
})(te, te.exports);
|
|
621
621
|
var Ce = te.exports;
|
|
622
622
|
(function(a, t) {
|
|
623
|
-
t.__esModule = !0, t.default = function(r, e,
|
|
624
|
-
if (typeof r == "number" && typeof e == "number" && typeof
|
|
625
|
-
if (typeof r == "object" && e === void 0 &&
|
|
623
|
+
t.__esModule = !0, t.default = function(r, e, l) {
|
|
624
|
+
if (typeof r == "number" && typeof e == "number" && typeof l == "number") return (0, n.default)(r, e, l);
|
|
625
|
+
if (typeof r == "object" && e === void 0 && l === void 0) return (0, n.default)(r.hue, r.saturation, r.lightness);
|
|
626
626
|
throw new s.default(1);
|
|
627
627
|
};
|
|
628
|
-
var n = i(Ce), s = i(
|
|
628
|
+
var n = i(Ce), s = i(E);
|
|
629
629
|
function i(r) {
|
|
630
630
|
return r && r.__esModule ? r : { default: r };
|
|
631
631
|
}
|
|
@@ -633,12 +633,12 @@ var Ce = te.exports;
|
|
|
633
633
|
})(ee, ee.exports);
|
|
634
634
|
var Ue = ee.exports, ae = { exports: {} };
|
|
635
635
|
(function(a, t) {
|
|
636
|
-
t.__esModule = !0, t.default = function(e,
|
|
637
|
-
if (typeof e == "number" && typeof
|
|
638
|
-
if (typeof e == "object" &&
|
|
636
|
+
t.__esModule = !0, t.default = function(e, l, d, o) {
|
|
637
|
+
if (typeof e == "number" && typeof l == "number" && typeof d == "number" && typeof o == "number") return o >= 1 ? (0, n.default)(e, l, d) : "rgba(" + (0, s.default)(e, l, d) + "," + o + ")";
|
|
638
|
+
if (typeof e == "object" && l === void 0 && d === void 0 && o === void 0) return e.alpha >= 1 ? (0, n.default)(e.hue, e.saturation, e.lightness) : "rgba(" + (0, s.default)(e.hue, e.saturation, e.lightness) + "," + e.alpha + ")";
|
|
639
639
|
throw new i.default(2);
|
|
640
640
|
};
|
|
641
|
-
var n = r(Ce), s = r(fe), i = r(
|
|
641
|
+
var n = r(Ce), s = r(fe), i = r(E);
|
|
642
642
|
function r(e) {
|
|
643
643
|
return e && e.__esModule ? e : { default: e };
|
|
644
644
|
}
|
|
@@ -646,12 +646,12 @@ var Ue = ee.exports, ae = { exports: {} };
|
|
|
646
646
|
})(ae, ae.exports);
|
|
647
647
|
var Ge = ae.exports, ie = { exports: {} };
|
|
648
648
|
(function(a, t) {
|
|
649
|
-
t.__esModule = !0, t.default = function(e,
|
|
650
|
-
if (typeof e == "number" && typeof
|
|
651
|
-
if (typeof e == "object" &&
|
|
649
|
+
t.__esModule = !0, t.default = function(e, l, d) {
|
|
650
|
+
if (typeof e == "number" && typeof l == "number" && typeof d == "number") return (0, n.default)("#" + (0, s.default)(e) + (0, s.default)(l) + (0, s.default)(d));
|
|
651
|
+
if (typeof e == "object" && l === void 0 && d === void 0) return (0, n.default)("#" + (0, s.default)(e.red) + (0, s.default)(e.green) + (0, s.default)(e.blue));
|
|
652
652
|
throw new i.default(6);
|
|
653
653
|
};
|
|
654
|
-
var n = r(ke), s = r(Se), i = r(
|
|
654
|
+
var n = r(ke), s = r(Se), i = r(E);
|
|
655
655
|
function r(e) {
|
|
656
656
|
return e && e.__esModule ? e : { default: e };
|
|
657
657
|
}
|
|
@@ -659,16 +659,16 @@ var Ge = ae.exports, ie = { exports: {} };
|
|
|
659
659
|
})(ie, ie.exports);
|
|
660
660
|
var Ee = ie.exports, oe = { exports: {} };
|
|
661
661
|
(function(a, t) {
|
|
662
|
-
t.__esModule = !0, t.default = function(e,
|
|
663
|
-
if (typeof e == "string" && typeof
|
|
662
|
+
t.__esModule = !0, t.default = function(e, l, d, o) {
|
|
663
|
+
if (typeof e == "string" && typeof l == "number") {
|
|
664
664
|
var u = (0, n.default)(e);
|
|
665
|
-
return "rgba(" + u.red + "," + u.green + "," + u.blue + "," +
|
|
665
|
+
return "rgba(" + u.red + "," + u.green + "," + u.blue + "," + l + ")";
|
|
666
666
|
}
|
|
667
|
-
if (typeof e == "number" && typeof
|
|
668
|
-
if (typeof e == "object" &&
|
|
667
|
+
if (typeof e == "number" && typeof l == "number" && typeof d == "number" && typeof o == "number") return o >= 1 ? (0, s.default)(e, l, d) : "rgba(" + e + "," + l + "," + d + "," + o + ")";
|
|
668
|
+
if (typeof e == "object" && l === void 0 && d === void 0 && o === void 0) return e.alpha >= 1 ? (0, s.default)(e.red, e.green, e.blue) : "rgba(" + e.red + "," + e.green + "," + e.blue + "," + e.alpha + ")";
|
|
669
669
|
throw new i.default(7);
|
|
670
670
|
};
|
|
671
|
-
var n = r(ce), s = r(Ee), i = r(
|
|
671
|
+
var n = r(ce), s = r(Ee), i = r(E);
|
|
672
672
|
function r(e) {
|
|
673
673
|
return e && e.__esModule ? e : { default: e };
|
|
674
674
|
}
|
|
@@ -679,16 +679,16 @@ var Ve = oe.exports;
|
|
|
679
679
|
t.__esModule = !0, t.default = function(f) {
|
|
680
680
|
if (typeof f != "object") throw new e.default(8);
|
|
681
681
|
if (o(f)) return (0, r.default)(f);
|
|
682
|
-
if (
|
|
682
|
+
if (d(f)) return (0, i.default)(f);
|
|
683
683
|
if (c(f)) return (0, s.default)(f);
|
|
684
684
|
if (u(f)) return (0, n.default)(f);
|
|
685
685
|
throw new e.default(8);
|
|
686
686
|
};
|
|
687
|
-
var n =
|
|
688
|
-
function
|
|
687
|
+
var n = l(Ue), s = l(Ge), i = l(Ee), r = l(Ve), e = l(E);
|
|
688
|
+
function l(f) {
|
|
689
689
|
return f && f.__esModule ? f : { default: f };
|
|
690
690
|
}
|
|
691
|
-
var
|
|
691
|
+
var d = function(f) {
|
|
692
692
|
return typeof f.red == "number" && typeof f.green == "number" && typeof f.blue == "number" && (typeof f.alpha != "number" || f.alpha === void 0);
|
|
693
693
|
}, o = function(f) {
|
|
694
694
|
return typeof f.red == "number" && typeof f.green == "number" && typeof f.blue == "number" && typeof f.alpha == "number";
|
|
@@ -706,21 +706,21 @@ var Be = X.exports;
|
|
|
706
706
|
function e(o) {
|
|
707
707
|
return o && o.__esModule ? o : { default: o };
|
|
708
708
|
}
|
|
709
|
-
function
|
|
710
|
-
return
|
|
709
|
+
function l() {
|
|
710
|
+
return l = Object.assign ? Object.assign.bind() : function(o) {
|
|
711
711
|
for (var u = 1; u < arguments.length; u++) {
|
|
712
712
|
var c = arguments[u];
|
|
713
713
|
for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (o[f] = c[f]);
|
|
714
714
|
}
|
|
715
715
|
return o;
|
|
716
|
-
},
|
|
716
|
+
}, l.apply(this, arguments);
|
|
717
717
|
}
|
|
718
|
-
var
|
|
718
|
+
var d = (0, n.default)(function(o, u) {
|
|
719
719
|
if (u === "transparent") return u;
|
|
720
720
|
var c = (0, i.default)(u);
|
|
721
|
-
return (0, r.default)(
|
|
721
|
+
return (0, r.default)(l({}, c, { lightness: (0, s.default)(0, 1, c.lightness - parseFloat(o)) }));
|
|
722
722
|
});
|
|
723
|
-
t.default =
|
|
723
|
+
t.default = d, a.exports = t.default;
|
|
724
724
|
})(U, U.exports);
|
|
725
725
|
const Ze = ue(U.exports);
|
|
726
726
|
var se = { exports: {} };
|
|
@@ -730,21 +730,21 @@ var se = { exports: {} };
|
|
|
730
730
|
function e(o) {
|
|
731
731
|
return o && o.__esModule ? o : { default: o };
|
|
732
732
|
}
|
|
733
|
-
function
|
|
734
|
-
return
|
|
733
|
+
function l() {
|
|
734
|
+
return l = Object.assign ? Object.assign.bind() : function(o) {
|
|
735
735
|
for (var u = 1; u < arguments.length; u++) {
|
|
736
736
|
var c = arguments[u];
|
|
737
737
|
for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (o[f] = c[f]);
|
|
738
738
|
}
|
|
739
739
|
return o;
|
|
740
|
-
},
|
|
740
|
+
}, l.apply(this, arguments);
|
|
741
741
|
}
|
|
742
|
-
var
|
|
742
|
+
var d = (0, n.default)(function(o, u) {
|
|
743
743
|
if (u === "transparent") return u;
|
|
744
744
|
var c = (0, i.default)(u);
|
|
745
|
-
return (0, r.default)(
|
|
745
|
+
return (0, r.default)(l({}, c, { lightness: (0, s.default)(0, 1, c.lightness + parseFloat(o)) }));
|
|
746
746
|
});
|
|
747
|
-
t.default =
|
|
747
|
+
t.default = d, a.exports = t.default;
|
|
748
748
|
})(se, se.exports);
|
|
749
749
|
const Qe = ue(se.exports);
|
|
750
750
|
function Xe(a) {
|
|
@@ -783,8 +783,8 @@ function tt(a, t) {
|
|
|
783
783
|
const s = () => {
|
|
784
784
|
((r) => {
|
|
785
785
|
var e;
|
|
786
|
-
const
|
|
787
|
-
(e = a.contentWindow) === null || e === void 0 || e.postMessage(
|
|
786
|
+
const l = { type: "UPDATE_BODY_CLASS", isMobile: r };
|
|
787
|
+
(e = a.contentWindow) === null || e === void 0 || e.postMessage(l, "*"), r && (y.isWidgetOpen ? y.hideTriggerButton() : y.showTriggerButton());
|
|
788
788
|
})(document.body.clientWidth <= 576);
|
|
789
789
|
}, i = () => {
|
|
790
790
|
n && clearTimeout(n), n = window.setTimeout(s, 300);
|
|
@@ -809,8 +809,8 @@ function nt(a, t, n) {
|
|
|
809
809
|
const r = document.createDocumentFragment();
|
|
810
810
|
if (s) y.initialize({ isButtonHidden: s });
|
|
811
811
|
else {
|
|
812
|
-
const { button:
|
|
813
|
-
const f =
|
|
812
|
+
const { button: d, icon: o } = function(u, c) {
|
|
813
|
+
const f = k("button", W, { id: `trigger-button-${u}`, "aria-controls": T, "aria-expanded": "false", "data-name": W }), g = k("div", "trigger-button-icon", { "aria-hidden": "true" });
|
|
814
814
|
return g.innerHTML = c ? `
|
|
815
815
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256" class="close-icon">
|
|
816
816
|
<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>
|
|
@@ -825,58 +825,59 @@ function nt(a, t, n) {
|
|
|
825
825
|
</svg>
|
|
826
826
|
`, f.setAttribute("aria-label", "Open Brainfish widget"), f.appendChild(g), { button: f, icon: g };
|
|
827
827
|
}(a, i);
|
|
828
|
-
r.appendChild(
|
|
828
|
+
r.appendChild(d), y.initialize({ button: d, icon: o });
|
|
829
829
|
}
|
|
830
|
-
const { iframeContainer: e, iframe:
|
|
831
|
-
const o =
|
|
830
|
+
const { iframeContainer: e, iframe: l } = function(d) {
|
|
831
|
+
const o = k("div", T, { id: T, "aria-live": "polite", "aria-hidden": "true" }), u = k("div", "iframe-loading-indicator"), c = k("div", "spinner");
|
|
832
832
|
u.setAttribute("aria-label", "Loading content"), u.setAttribute("role", "status"), u.appendChild(c), o.appendChild(u);
|
|
833
|
-
const f =
|
|
833
|
+
const f = k("iframe", "trigger-iframe", { src: d, sandbox: "allow-scripts allow-same-origin allow-popups allow-forms", allow: "clipboard-write", role: "dialog" });
|
|
834
834
|
return f.style.opacity = "0", f.addEventListener("load", () => {
|
|
835
835
|
u.style.display = "none", f.style.opacity = "1";
|
|
836
836
|
}), f.addEventListener("error", (g) => {
|
|
837
837
|
console.error("Error loading iframe:", g), u.innerHTML = "";
|
|
838
|
-
const h =
|
|
838
|
+
const h = k("div", "loading-error");
|
|
839
839
|
u.appendChild(h), u.setAttribute("aria-label", "Failed to load content");
|
|
840
840
|
}), o.appendChild(f), { iframeContainer: o, iframe: f };
|
|
841
841
|
}(t);
|
|
842
|
-
return r.appendChild(e), { fragment: r, iframe:
|
|
842
|
+
return r.appendChild(e), { fragment: r, iframe: l };
|
|
843
843
|
}
|
|
844
844
|
const rt = (a, t) => {
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
845
|
+
var n, s;
|
|
846
|
+
const i = le(a.overrides), r = ((e = a.overrides) == null ? void 0 : e.widgetHost) || "https://agent.brainfi.sh";
|
|
847
|
+
var e;
|
|
848
|
+
const { theme: l, settings: d } = t, o = K(JSON.stringify((n = a.overrides) === null || n === void 0 ? void 0 : n.redirectRules)), u = `${r}/?widgetKey=${a.widgetKey}&themeParam=${K(JSON.stringify(l))}&settingsParam=${K(JSON.stringify(d))}${(s = a.overrides) !== null && s !== void 0 && s.redirectRules ? `&redirectRulesParam=${o}` : ""}`, c = d == null ? void 0 : d.hideTriggerButton, f = d == null ? void 0 : d.triggerButtonIcon;
|
|
848
849
|
try {
|
|
849
|
-
if (
|
|
850
|
-
return !!document.getElementById(`trigger-button-${
|
|
850
|
+
if (g = a.widgetKey, ye.has(g) || function(w) {
|
|
851
|
+
return !!document.getElementById(`trigger-button-${w}`);
|
|
851
852
|
}(a.widgetKey)) return;
|
|
852
853
|
Xe(t);
|
|
853
|
-
const { fragment:
|
|
854
|
-
|
|
854
|
+
const { fragment: h, iframe: p } = nt(a.widgetKey, u, { isButtonHidden: c || !1, triggerButtonIcon: f || "" }), m = new AbortController(), { signal: b } = m;
|
|
855
|
+
p.onload = () => {
|
|
855
856
|
setTimeout(() => {
|
|
856
|
-
et(
|
|
857
|
+
et(p, b), Ne({ widgetHost: r, apiHost: i, widgetKey: a.widgetKey, signal: b }), tt(p, b);
|
|
857
858
|
}, 0);
|
|
858
|
-
}, document.body.appendChild(
|
|
859
|
-
const
|
|
860
|
-
|
|
859
|
+
}, document.body.appendChild(h), ye.add(a.widgetKey);
|
|
860
|
+
const x = () => {
|
|
861
|
+
m.abort(), window.removeEventListener("beforeunload", x);
|
|
861
862
|
};
|
|
862
|
-
return void window.addEventListener("beforeunload",
|
|
863
|
-
} catch (
|
|
864
|
-
(function(
|
|
865
|
-
|
|
866
|
-
})(
|
|
863
|
+
return void window.addEventListener("beforeunload", x);
|
|
864
|
+
} catch (h) {
|
|
865
|
+
(function(p, m, b) {
|
|
866
|
+
S(p, m, m.message, b);
|
|
867
|
+
})(i, h, a.widgetKey);
|
|
867
868
|
}
|
|
868
|
-
var
|
|
869
|
+
var g;
|
|
869
870
|
};
|
|
870
871
|
let P = null;
|
|
871
|
-
const
|
|
872
|
+
const B = typeof window != "undefined" && window.Brainfish ? window.Brainfish : (P || (P = /* @__PURE__ */ function() {
|
|
872
873
|
let a = [], t = null;
|
|
873
874
|
function n(i, r) {
|
|
874
875
|
if (t) {
|
|
875
876
|
const e = i.split(".");
|
|
876
|
-
let
|
|
877
|
-
for (let o = 0; o < e.length - 1; o++)
|
|
878
|
-
const
|
|
879
|
-
if (typeof
|
|
877
|
+
let l = t;
|
|
878
|
+
for (let o = 0; o < e.length - 1; o++) l = l[e[o]];
|
|
879
|
+
const d = l[e[e.length - 1]];
|
|
880
|
+
if (typeof d == "function") return d.apply(l, r);
|
|
880
881
|
} else a.push([i, r]);
|
|
881
882
|
}
|
|
882
883
|
return { Widgets: { init: function() {
|
|
@@ -908,11 +909,11 @@ const E = typeof window != "undefined" && window.Brainfish ? window.Brainfish :
|
|
|
908
909
|
} };
|
|
909
910
|
}(), typeof window != "undefined" && (window.Brainfish = P)), P);
|
|
910
911
|
let z = null;
|
|
911
|
-
|
|
912
|
+
B.Widgets.isReady = !1, B.Widgets.identify = (a) => {
|
|
912
913
|
window.BrainfishAnalytics("identify", a);
|
|
913
|
-
},
|
|
914
|
+
}, B.Widgets.init = (a) => v(void 0, null, function* () {
|
|
914
915
|
window && (window.BrainfishAnalytics = window.BrainfishAnalytics || function() {
|
|
915
|
-
for (var r = arguments.length, e = new Array(r),
|
|
916
|
+
for (var r = arguments.length, e = new Array(r), l = 0; l < r; l++) e[l] = arguments[l];
|
|
916
917
|
(window.BrainfishAnalytics.q = window.BrainfishAnalytics.q || []).push(e);
|
|
917
918
|
});
|
|
918
919
|
const t = le(a.overrides), n = ((s = a.overrides) == null ? void 0 : s.analyticsApiHost) || "";
|
|
@@ -920,9 +921,9 @@ E.Widgets.isReady = !1, E.Widgets.identify = (a) => {
|
|
|
920
921
|
let i;
|
|
921
922
|
if (a.config) i = JSON.parse(((r) => {
|
|
922
923
|
if (typeof window != "undefined" && typeof window.atob == "function") {
|
|
923
|
-
const e = atob(r),
|
|
924
|
-
for (let o = 0; o <
|
|
925
|
-
return new TextDecoder().decode(
|
|
924
|
+
const e = atob(r), l = e.length, d = new Uint8Array(l);
|
|
925
|
+
for (let o = 0; o < l; o++) d[o] = e.charCodeAt(o);
|
|
926
|
+
return new TextDecoder().decode(d);
|
|
926
927
|
}
|
|
927
928
|
if (typeof Buffer != "undefined") return Buffer.from(r, "base64").toString("utf-8");
|
|
928
929
|
throw new Error("[utils.base64Decode]: Unsupported environment");
|
|
@@ -931,21 +932,21 @@ E.Widgets.isReady = !1, E.Widgets.identify = (a) => {
|
|
|
931
932
|
const { config: r } = yield He({ widgetKey: a.widgetKey, apiHost: t });
|
|
932
933
|
i = r;
|
|
933
934
|
}
|
|
934
|
-
z || (z = function(r, e,
|
|
935
|
+
z || (z = function(r, e, l, d) {
|
|
935
936
|
return v(this, null, function* () {
|
|
936
937
|
var o, u, c, f, g;
|
|
937
938
|
const h = ((o = r.overrides) === null || o === void 0 ? void 0 : o.enableRecording) || (e == null || (u = e.settings) === null || u === void 0 ? void 0 : u.enableRecording) || !1, p = ((c = r.overrides) === null || c === void 0 ? void 0 : c.version) || (e == null ? void 0 : e.version), m = [];
|
|
938
|
-
p != null && p.startsWith("2.") ? rt(r, e) : m.push(Re(r, e)), m.push(qe(r.widgetKey, e.trackingToken || "",
|
|
939
|
+
p != null && p.startsWith("2.") ? rt(r, e) : m.push(Re(r, e)), m.push(qe(r.widgetKey, e.trackingToken || "", l, d, h, (e == null || (f = e.settings) === null || f === void 0 ? void 0 : f.recordingBlocklist) || [], e == null || (g = e.settings) === null || g === void 0 ? void 0 : g._allowLocalhostRecording));
|
|
939
940
|
const [b] = yield Promise.allSettled(m);
|
|
940
|
-
b && b.status === "fulfilled" && b.value &&
|
|
941
|
+
b && b.status === "fulfilled" && b.value && B._setRealBrainfish(b.value);
|
|
941
942
|
});
|
|
942
|
-
}(a, i, t, n)), yield z,
|
|
943
|
+
}(a, i, t, n)), yield z, B.Widgets.isReady = !0, window.dispatchEvent(new Event("onBrainfishReady"));
|
|
943
944
|
});
|
|
944
945
|
const it = function() {
|
|
945
946
|
typeof window != "undefined" && window.BrainfishAnalytics && window.BrainfishAnalytics(...arguments);
|
|
946
947
|
};
|
|
947
948
|
export {
|
|
948
949
|
it as BrainfishAnalytics,
|
|
949
|
-
|
|
950
|
+
B as default
|
|
950
951
|
};
|
|
951
952
|
//# sourceMappingURL=web.js.map
|