@brainfish-ai/widgets-initiator 1.6.0 → 1.6.2

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/web.js CHANGED
@@ -1,47 +1,47 @@
1
- var Fe = Object.defineProperty, Te = Object.defineProperties;
2
- var Le = Object.getOwnPropertyDescriptors;
3
- var pe = Object.getOwnPropertySymbols;
4
- var $e = Object.prototype.hasOwnProperty, We = Object.prototype.propertyIsEnumerable;
5
- var T = (a, t, n) => t in a ? Fe(a, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[t] = n, L = (a, t) => {
1
+ var je = Object.defineProperty, Fe = Object.defineProperties;
2
+ var We = Object.getOwnPropertyDescriptors;
3
+ var ge = Object.getOwnPropertySymbols;
4
+ var He = Object.prototype.hasOwnProperty, $e = Object.prototype.propertyIsEnumerable;
5
+ var F = (a, t, n) => t in a ? je(a, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[t] = n, W = (a, t) => {
6
6
  for (var n in t || (t = {}))
7
- $e.call(t, n) && T(a, n, t[n]);
8
- if (pe)
9
- for (var n of pe(t))
10
- We.call(t, n) && T(a, n, t[n]);
7
+ He.call(t, n) && F(a, n, t[n]);
8
+ if (ge)
9
+ for (var n of ge(t))
10
+ $e.call(t, n) && F(a, n, t[n]);
11
11
  return a;
12
- }, $ = (a, t) => Te(a, Le(t));
13
- var k = (a, t, n) => T(a, typeof t != "symbol" ? t + "" : t, n);
12
+ }, H = (a, t) => Fe(a, We(t));
13
+ var S = (a, t, n) => F(a, typeof t != "symbol" ? t + "" : t, n);
14
14
  var m = (a, t, n) => new Promise((i, o) => {
15
- var r = (s) => {
15
+ var r = (l) => {
16
16
  try {
17
- l(n.next(s));
18
- } catch (u) {
19
- o(u);
17
+ d(n.next(l));
18
+ } catch (s) {
19
+ o(s);
20
20
  }
21
- }, e = (s) => {
21
+ }, e = (l) => {
22
22
  try {
23
- l(n.throw(s));
24
- } catch (u) {
25
- o(u);
23
+ d(n.throw(l));
24
+ } catch (s) {
25
+ o(s);
26
26
  }
27
- }, l = (s) => s.done ? i(s.value) : Promise.resolve(s.value).then(r, e);
28
- l((n = n.apply(a, t)).next());
27
+ }, d = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(r, e);
28
+ d((n = n.apply(a, t)).next());
29
29
  });
30
- var _, z;
30
+ var k, q;
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] = "f5ce7c80-c3f2-4add-90bb-4a7e41b9d696", a._sentryDebugIdIdentifier = "sentry-dbid-f5ce7c80-c3f2-4add-90bb-4a7e41b9d696");
34
+ t && (a._sentryDebugIds = a._sentryDebugIds || {}, a._sentryDebugIds[t] = "ec3dc36b-ca2f-4e8f-91bd-b84cd56642ce", a._sentryDebugIdIdentifier = "sentry-dbid-ec3dc36b-ca2f-4e8f-91bd-b84cd56642ce");
35
35
  } catch (n) {
36
36
  }
37
- })(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "18e27120541df46d79a1a60398b242824660e266" }, function(a) {
37
+ })(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "8caaf781e1d718f459b9b3c07fdbcb4a119f0d01" }, function(a) {
38
38
  a.Sidebar = "sidebar", a.Searchbar = "searchbar";
39
- }(_ || (_ = {})), _.Sidebar, _.Searchbar;
40
- class ie extends Error {
39
+ }(k || (k = {})), k.Sidebar, k.Searchbar;
40
+ class se extends Error {
41
41
  constructor(n, i) {
42
42
  super(n, i);
43
- k(this, "cause");
44
- this.name = "BrainfishWidgetError", this.cause = i == null ? void 0 : i.cause, Error.captureStackTrace && Error.captureStackTrace(this, ie), this.cause instanceof Error && this.cause.stack && (this.stack = this.stack + `
43
+ S(this, "cause");
44
+ this.name = "BrainfishWidgetError", this.cause = i == null ? void 0 : i.cause, Error.captureStackTrace && Error.captureStackTrace(this, se), this.cause instanceof Error && this.cause.stack && (this.stack = this.stack + `
45
45
  Caused by: ` + this.cause.stack);
46
46
  }
47
47
  toJSON() {
@@ -50,7 +50,7 @@ Caused by: ` + this.cause.stack);
50
50
  }
51
51
  (function(a) {
52
52
  a.LINK = "link", a.CALLBACK = "callback", a.EMAIL = "email", a.PHONE = "phone";
53
- })(z || (z = {}));
53
+ })(q || (q = {}));
54
54
  const x = (a, t, n, i) => {
55
55
  let o = n, r = {};
56
56
  if (t instanceof Error) try {
@@ -59,106 +59,106 @@ const x = (a, t, n, i) => {
59
59
  o += ` - ${t.message}`;
60
60
  }
61
61
  else o += ` - ${String(t)}`;
62
- ((e, l, s) => {
62
+ ((e, d, l) => {
63
63
  if (!navigator || navigator.userAgent.toLowerCase().includes("headless")) return;
64
- const u = l.toJSON();
65
- fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": s }, body: JSON.stringify({ error: `WebWidgetVersion: 1.6.0. ${l.message}`, stack: l.stack, cause: { message: u.message, stack: u.stack, cause: u.cause } }) });
66
- })(a, new ie(o, { cause: r }), i);
64
+ const s = d.toJSON();
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.6.2. ${d.message}`, stack: d.stack, cause: { message: s.message, stack: s.stack, cause: s.cause } }) });
66
+ })(a, new se(o, { cause: r }), i);
67
67
  }, Ke = (a) => m(void 0, null, function* () {
68
68
  let { widgetKey: t, apiHost: n } = a;
69
69
  return function(i, o, r) {
70
70
  return m(this, null, function* () {
71
- let e, l = 0;
72
- for (; l < 3; ) try {
73
- const s = yield fetch(`${i}${o}`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": r } });
74
- if (!s.ok) throw new Error(`API call failed with status: ${s.status}`);
75
- const u = yield s.json();
76
- if (!u) throw new Error("Error loading config: empty response");
77
- return u;
78
- } catch (s) {
79
- if (e = s, l++, l >= 3) throw x(i, s, "Error fetching config", r), e;
80
- yield new Promise((u) => setTimeout(u, 500));
71
+ let e, d = 0;
72
+ for (; d < 3; ) try {
73
+ const l = yield fetch(`${i}${o}`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": r } });
74
+ if (!l.ok) throw new Error(`API call failed with status: ${l.status}`);
75
+ const s = yield l.json();
76
+ if (!s) throw new Error("Error loading config: empty response");
77
+ return s;
78
+ } catch (l) {
79
+ if (e = l, d++, d >= 3) throw x(i, l, "Error fetching config", r), e;
80
+ yield new Promise((s) => setTimeout(s, 500));
81
81
  }
82
82
  });
83
83
  }(n, "/api/searchWidgets.getConfigByKey", t);
84
- }), ze = (a) => {
84
+ }), qe = (a) => {
85
85
  let { config: t, apiKey: n, apiHost: i } = a;
86
86
  const o = t.settings || {};
87
87
  return ["bodyActionButtons", "footerActionButtons", "nextBestActions"].forEach((r) => {
88
- o[r] && (o[r] = o[r].map((e) => e.type === z.CALLBACK && e.value ? $(L({}, e), { value: new Function(`return ${e.value}`)() }) : e));
89
- }), $(L({}, t), { settings: o, apiHost: i, widgetMode: t.widgetType, apiKey: n });
90
- }, se = (a) => (a == null ? void 0 : a.apiHost) || "https://app.brainfi.sh", W = (() => {
88
+ o[r] && (o[r] = o[r].map((e) => e.type === q.CALLBACK && e.value ? H(W({}, e), { value: new Function(`return ${e.value}`)() }) : e));
89
+ }), H(W({}, t), { settings: o, apiHost: i, widgetMode: t.widgetType, apiKey: n });
90
+ }, de = (a) => (a == null ? void 0 : a.apiHost) || "https://app.brainfi.sh", $ = (() => {
91
91
  if (typeof window == "undefined") return;
92
92
  const a = window.navigator.userAgent;
93
93
  if (!(a.match(/iPad/i) || a.match(/iPhone/i))) return !1;
94
94
  const t = a.match(/OS (\d+)_/i);
95
95
  return t && parseInt(t[1], 10) <= 14;
96
- })(), He = (a) => m(void 0, null, function* () {
96
+ })(), ze = (a) => m(void 0, null, function* () {
97
97
  let { apiHost: t, widgetKey: n, version: i } = a;
98
98
  try {
99
- const o = `https://cdn.jsdelivr.net/npm/@brainfish-ai/search-widget@${i}/dist/web.js`, r = W ? o.replace("web.js", "web.umd.js") : o;
100
- return { widget: yield ((l) => m(void 0, null, function* () {
101
- return document.getElementById("brainfish-widget") ? window.Brainfish : new Promise((s, u) => {
102
- const d = document.createElement("script");
103
- d.id = "brainfish-widget", d.src = l, d.type = W ? "text/javascript" : "module", d.async = !0, d.crossOrigin = "anonymous", d.onload = () => {
99
+ const o = `https://cdn.jsdelivr.net/npm/@brainfish-ai/search-widget@${i}/dist/web.js`, r = $ ? o.replace("web.js", "web.umd.js") : o;
100
+ return { widget: yield ((d) => m(void 0, null, function* () {
101
+ return document.getElementById("brainfish-widget") ? window.Brainfish : new Promise((l, s) => {
102
+ const u = document.createElement("script");
103
+ u.id = "brainfish-widget", u.src = d, u.type = $ ? "text/javascript" : "module", u.async = !0, u.crossOrigin = "anonymous", u.onload = () => {
104
104
  setTimeout(() => {
105
105
  const c = window.Brainfish;
106
- c ? s(c) : u(new Error("Failed to load Brainfish module"));
106
+ c ? l(c) : s(new Error("Failed to load Brainfish module"));
107
107
  }, 200);
108
- }, d.onerror = (c) => {
109
- const f = c, h = { 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
- u(new Error(JSON.stringify(h)));
111
- }, W || document.head.appendChild(d);
108
+ }, u.onerror = (c) => {
109
+ const f = c, g = { message: `Failed to load script: ${d}`, type: f.type, fileName: f.filename, lineNumber: f.lineno, columnNumber: f.colno, error: f.error ? f.error.toString() : "Unknown error" };
110
+ s(new Error(JSON.stringify(g)));
111
+ }, $ || document.head.appendChild(u);
112
112
  });
113
113
  }))(r) };
114
114
  } catch (o) {
115
115
  x(t, o, o.message, n);
116
116
  }
117
- }), ge = /* @__PURE__ */ new Set(), qe = (a, t) => m(void 0, null, function* () {
118
- const n = se(a.overrides);
117
+ }), he = /* @__PURE__ */ new Set(), De = (a, t) => m(void 0, null, function* () {
118
+ const n = de(a.overrides);
119
119
  try {
120
- if (ge.has(a.widgetKey)) return;
121
- const i = yield He({ apiHost: n, widgetKey: a.widgetKey, version: t.version || "latest" });
120
+ if (he.has(a.widgetKey)) return;
121
+ const i = yield ze({ apiHost: n, widgetKey: a.widgetKey, version: t.version || "latest" });
122
122
  if (i) {
123
- const { widget: o } = i, r = ze({ config: t, apiKey: a.widgetKey, apiHost: n });
123
+ const { widget: o } = i, r = qe({ config: t, apiKey: a.widgetKey, apiHost: n });
124
124
  return a.overrides && t.settings && Object.entries(a.overrides).forEach((e) => {
125
- let [l, s] = e;
126
- t.settings && l in t.settings && (t.settings[l] = function() {
127
- let u = arguments.length > 1 ? arguments[1] : void 0;
128
- const d = new Map((arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).map((c) => [c.label, c]));
129
- return u.forEach((c) => d.set(c.label, c)), Array.from(d.values());
130
- }(t.settings[l], s));
131
- }), function(e, l) {
132
- l.widgetType === _.Searchbar || l.widgetType === "Search" ? e.SearchWidget.initStandard(l) : e.HelpWidget.initPopup(l);
133
- }(o, r), ge.add(a.widgetKey), o;
125
+ let [d, l] = e;
126
+ t.settings && d in t.settings && (t.settings[d] = function() {
127
+ let s = arguments.length > 1 ? arguments[1] : void 0;
128
+ const u = new Map((arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).map((c) => [c.label, c]));
129
+ return s.forEach((c) => u.set(c.label, c)), Array.from(u.values());
130
+ }(t.settings[d], l));
131
+ }), function(e, d) {
132
+ d.widgetType === k.Searchbar || d.widgetType === "Search" ? e.SearchWidget.initStandard(d) : e.HelpWidget.initPopup(d);
133
+ }(o, r), he.add(a.widgetKey), o;
134
134
  }
135
135
  } catch (i) {
136
136
  x(n, i, i.message, a.widgetKey);
137
137
  }
138
138
  });
139
- let he = !1;
140
- const De = function(i, o, r) {
139
+ let me = !1;
140
+ const Ne = function(i, o, r) {
141
141
  return m(this, arguments, function* (a, t, n) {
142
- let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "", l = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
143
- if (t || x(n, new Error("Access key is required"), "Access key is required", a), !he) try {
144
- const s = (() => {
142
+ let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "", d = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
143
+ if (t || x(n, new Error("Access key is required"), "Access key is required", a), !me) try {
144
+ const l = (() => {
145
145
  if (typeof window == "undefined" || typeof navigator == "undefined") return !1;
146
- const u = navigator, d = window, c = (u.doNotTrack || d.doNotTrack || u.msDoNotTrack || "0").toString().toLowerCase();
146
+ const s = navigator, u = window, c = (s.doNotTrack || u.doNotTrack || s.msDoNotTrack || "0").toString().toLowerCase();
147
147
  return ["1", "yes", "true"].includes(c);
148
148
  })();
149
- window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !s, trackAttributes: !s, trackOutgoingLinks: !s, enableRecording: !s && l }), he = !0, yield ((u, d) => m(this, null, function* () {
149
+ window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !l, trackAttributes: !l, trackOutgoingLinks: !l, enableRecording: !l && d }), me = !0, yield ((s, u) => m(this, null, function* () {
150
150
  if (document.getElementById("brainfish-analytics")) return window.BrainfishAnalytics;
151
151
  const c = document.createElement("script");
152
152
  c.id = "brainfish-analytics", c.src = "https://cdn.jsdelivr.net/npm/@brainfish-ai/web-tracker@latest/dist/tracker.js", c.type = "module", c.async = !0, c.crossOrigin = "anonymous", c.onerror = () => {
153
- x(u, new Error(`Failed to load script: ${c.src}`), `Failed to load script: ${c.src}`, d);
153
+ x(s, new Error(`Failed to load script: ${c.src}`), `Failed to load script: ${c.src}`, u);
154
154
  }, document.head.appendChild(c);
155
155
  }))(n, a);
156
- } catch (s) {
157
- x(n, s, "Failed to initialize BrainfishAnalytics", a);
156
+ } catch (l) {
157
+ x(n, l, "Failed to initialize BrainfishAnalytics", a);
158
158
  }
159
159
  });
160
160
  };
161
- function M(a, t) {
161
+ function I(a, t) {
162
162
  let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
163
163
  const i = document.createElement(a);
164
164
  return i.className = t, Object.entries(n).forEach((o) => {
@@ -166,20 +166,40 @@ function M(a, t) {
166
166
  i.setAttribute(r, e);
167
167
  }), i;
168
168
  }
169
- const j = "bf-iframe-container", F = "bf-trigger-button";
169
+ const P = "bf-iframe-container", j = "bf-trigger-button", L = 576;
170
170
  class v {
171
171
  static get isWidgetOpen() {
172
172
  return this.isOpen;
173
173
  }
174
- static initialize(t, n) {
175
- this.button = t, this.icon = n, t.addEventListener("click", () => this.toggleIframeVisibility());
174
+ static initialize(t, n, i) {
175
+ var o;
176
+ this.button = t, this.icon = n, this.isButtonHidden = i, t.addEventListener("click", () => this.toggleIframeVisibility()), i && this.hideTriggerButton(), (o = window.Brainfish) !== null && o !== void 0 && o.HelpWidget && (window.Brainfish.HelpWidget.close = () => this.closeWidget(), window.Brainfish.HelpWidget.open = () => this.openWidget());
176
177
  }
177
178
  static toggleIframeVisibility() {
178
179
  if (!this.button || !this.icon) return;
179
180
  this.isOpen = !this.isOpen;
180
181
  const t = this.icon.querySelector(".fish-icon"), n = this.icon.querySelector(".close-icon"), i = document.querySelector(".bf-iframe-container"), o = i == null ? void 0 : i.querySelector("iframe");
181
182
  var r;
182
- this.isOpen ? (i == null || i.classList.add("open"), i == null || i.setAttribute("aria-hidden", "false"), this.button.setAttribute("aria-expanded", "true"), t.classList.remove("visible"), n.classList.add("visible"), o == null || (r = o.contentWindow) === null || r === void 0 || r.postMessage({ type: "FOCUS_SEARCH_FIELD" }, "*"), window.BrainfishAnalytics("track", "Open Widget"), document.body.clientWidth <= 576 && this.hideTriggerButton()) : (i == null || i.classList.remove("open"), i == null || i.setAttribute("aria-hidden", "true"), this.button.setAttribute("aria-expanded", "false"), n.classList.remove("visible"), t.classList.add("visible"), this.showTriggerButton(), window.BrainfishAnalytics("track", "Close Widget"));
183
+ this.isOpen ? (i == null || i.classList.add("open"), i == null || i.setAttribute("aria-hidden", "false"), this.button.setAttribute("aria-expanded", "true"), t.classList.remove("visible"), n.classList.add("visible"), o == null || (r = o.contentWindow) === null || r === void 0 || r.postMessage({ type: "FOCUS_SEARCH_FIELD" }, "*"), window.BrainfishAnalytics("track", "Open Widget"), document.body.clientWidth <= L && this.hideTriggerButton()) : (i == null || i.classList.remove("open"), i == null || i.setAttribute("aria-hidden", "true"), this.button.setAttribute("aria-expanded", "false"), n.classList.remove("visible"), t.classList.add("visible"), this.showTriggerButton(), window.BrainfishAnalytics("track", "Close Widget"));
184
+ }
185
+ static openWidget() {
186
+ var t;
187
+ if (!this.icon) return;
188
+ this.isOpen = !0;
189
+ const n = document.querySelector(".bf-iframe-container"), i = n == null ? void 0 : n.querySelector("iframe");
190
+ if (n == null || n.classList.add("open"), n == null || n.setAttribute("aria-hidden", "false"), i == null || (t = i.contentWindow) === null || t === void 0 || t.postMessage({ type: "FOCUS_SEARCH_FIELD" }, "*"), window.BrainfishAnalytics("track", "Open Widget"), this.button && this.icon && !this.isButtonHidden) {
191
+ const o = this.icon.querySelector(".fish-icon"), r = this.icon.querySelector(".close-icon");
192
+ this.button.setAttribute("aria-expanded", "true"), o.classList.remove("visible"), r.classList.add("visible"), window.BrainfishAnalytics("track", "Open Widget"), document.body.clientWidth <= L && this.hideTriggerButton();
193
+ }
194
+ }
195
+ static closeWidget() {
196
+ this.isOpen = !1;
197
+ const t = document.querySelector(".bf-iframe-container");
198
+ if (t == null || t.classList.remove("open"), t == null || t.setAttribute("aria-hidden", "true"), window.BrainfishAnalytics("track", "Close Widget"), this.button && this.icon && !this.isButtonHidden) {
199
+ this.button.setAttribute("aria-expanded", "false");
200
+ const n = this.icon.querySelector(".fish-icon"), i = this.icon.querySelector(".close-icon");
201
+ n.classList.add("visible"), i.classList.remove("visible"), document.body.clientWidth <= L && this.showTriggerButton();
202
+ }
183
203
  }
184
204
  static showTriggerButton() {
185
205
  var t;
@@ -190,26 +210,37 @@ class v {
190
210
  (t = this.button) === null || t === void 0 || t.classList.add("hidden");
191
211
  }
192
212
  }
193
- k(v, "isOpen", !1), k(v, "button", null), k(v, "icon", null);
194
- function Ne(a, t) {
195
- window.addEventListener("message", (n) => {
196
- if (n.origin !== a) return;
197
- const { type: i } = n.data;
198
- if (i === "TOGGLE_WIDGET_SIZE" && function() {
199
- const o = document.querySelector(`.${j}`);
200
- o.classList.contains("expanded") ? o.classList.remove("expanded") : o.classList.add("expanded");
201
- }(), i === "TRACK_EVENT") {
213
+ S(v, "isOpen", !1), S(v, "button", null), S(v, "icon", null), S(v, "isButtonHidden", !1);
214
+ function Re(a) {
215
+ let { widgetHost: t, apiHost: n, widgetKey: i, signal: o } = a;
216
+ window.addEventListener("message", (r) => {
217
+ if (r.origin !== t) return;
218
+ const { type: e } = r.data;
219
+ if (e === "TOGGLE_WIDGET_SIZE" && function() {
220
+ const d = document.querySelector(`.${P}`);
221
+ d.classList.contains("expanded") ? d.classList.remove("expanded") : d.classList.add("expanded");
222
+ }(), e === "TRACK_EVENT") {
202
223
  if (!window.BrainfishAnalytics) return;
203
- const { eventName: o, data: r } = n.data;
204
- window.BrainfishAnalytics("track", o, r);
224
+ const { eventName: d, data: l } = r.data;
225
+ window.BrainfishAnalytics("track", d, l);
226
+ }
227
+ if (e === "CLOSE_WIDGET" && (window.BrainfishAnalytics("track", "Close Widget"), v.toggleIframeVisibility()), e === "NEXT_BEST_ACTION_CLICKED") {
228
+ const { action: d, searchQueryId: l, query: s, answer: u } = r.data, c = { action: d, searchQueryId: l };
229
+ if (!["function", "callback"].includes(d.type)) return void console.error("Invalid action type", d);
230
+ if (window.__bfCallbacks = window.__bfCallbacks || {}, window.__bfCallbacks[d.id]) return void window.__bfCallbacks[d.id](s, u, c);
231
+ const f = `${n}/api/searchWidgets.callback.codeblocks?apiKey=${i}&codeblockId=${d.id}`, g = document.createElement("script");
232
+ g.src = f, document.head.appendChild(g), g.onload = () => {
233
+ window.__bfCallbacks[d.id](s, u, c), setTimeout(() => {
234
+ document.head.removeChild(g);
235
+ }, 300);
236
+ };
205
237
  }
206
- i === "CLOSE_WIDGET" && (window.BrainfishAnalytics("track", "Close Widget"), v.toggleIframeVisibility());
207
- }, { signal: t });
238
+ }, { signal: o });
208
239
  }
209
- function ue(a) {
240
+ function le(a) {
210
241
  return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
211
242
  }
212
- var H = { exports: {} }, q = { exports: {} }, D = { exports: {} };
243
+ var z = { exports: {} }, D = { exports: {} }, N = { exports: {} };
213
244
  (function(a, t) {
214
245
  function n(o) {
215
246
  return Math.round(255 * o);
@@ -217,15 +248,15 @@ var H = { exports: {} }, q = { exports: {} }, D = { exports: {} };
217
248
  function i(o, r, e) {
218
249
  return n(o) + "," + n(r) + "," + n(e);
219
250
  }
220
- t.__esModule = !0, t.default = void 0, t.default = function(o, r, e, l) {
221
- if (l === void 0 && (l = i), r === 0) return l(e, e, e);
222
- var s = (o % 360 + 360) % 360 / 60, u = (1 - Math.abs(2 * e - 1)) * r, d = u * (1 - Math.abs(s % 2 - 1)), c = 0, f = 0, h = 0;
223
- s >= 0 && s < 1 ? (c = u, f = d) : s >= 1 && s < 2 ? (c = d, f = u) : s >= 2 && s < 3 ? (f = u, h = d) : s >= 3 && s < 4 ? (f = d, h = u) : s >= 4 && s < 5 ? (c = d, h = u) : s >= 5 && s < 6 && (c = u, h = d);
224
- var g = e - u / 2;
225
- return l(c + g, f + g, h + g);
251
+ t.__esModule = !0, t.default = void 0, t.default = function(o, r, e, d) {
252
+ if (d === void 0 && (d = i), r === 0) return d(e, e, e);
253
+ var l = (o % 360 + 360) % 360 / 60, s = (1 - Math.abs(2 * e - 1)) * r, u = s * (1 - Math.abs(l % 2 - 1)), c = 0, f = 0, g = 0;
254
+ l >= 0 && l < 1 ? (c = s, f = u) : l >= 1 && l < 2 ? (c = u, f = s) : l >= 2 && l < 3 ? (f = s, g = u) : l >= 3 && l < 4 ? (f = u, g = s) : l >= 4 && l < 5 ? (c = u, g = s) : l >= 5 && l < 6 && (c = s, g = u);
255
+ var h = e - s / 2;
256
+ return d(c + h, f + h, g + h);
226
257
  }, a.exports = t.default;
227
- })(D, D.exports);
228
- var le = D.exports, N = { exports: {} };
258
+ })(N, N.exports);
259
+ var ue = N.exports, R = { exports: {} };
229
260
  (function(a, t) {
230
261
  t.__esModule = !0, t.default = void 0;
231
262
  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" };
@@ -234,55 +265,55 @@ var le = D.exports, N = { exports: {} };
234
265
  var o = i.toLowerCase();
235
266
  return n[o] ? "#" + n[o] : i;
236
267
  }, a.exports = t.default;
237
- })(N, N.exports);
238
- var Re = N.exports, R = { exports: {} };
268
+ })(R, R.exports);
269
+ var Ue = R.exports, U = { exports: {} };
239
270
  (function(a, t) {
240
- function n(s) {
241
- var u = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
242
- return n = function(d) {
243
- if (d === null || !function(f) {
271
+ function n(l) {
272
+ var s = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
273
+ return n = function(u) {
274
+ if (u === null || !function(f) {
244
275
  try {
245
276
  return Function.toString.call(f).indexOf("[native code]") !== -1;
246
- } catch (h) {
277
+ } catch (g) {
247
278
  return typeof f == "function";
248
279
  }
249
- }(d)) return d;
250
- if (typeof d != "function") throw new TypeError("Super expression must either be null or a function");
251
- if (u !== void 0) {
252
- if (u.has(d)) return u.get(d);
253
- u.set(d, c);
280
+ }(u)) return u;
281
+ if (typeof u != "function") throw new TypeError("Super expression must either be null or a function");
282
+ if (s !== void 0) {
283
+ if (s.has(u)) return s.get(u);
284
+ s.set(u, c);
254
285
  }
255
286
  function c() {
256
- return function(f, h, g) {
287
+ return function(f, g, h) {
257
288
  if (i()) return Reflect.construct.apply(null, arguments);
258
289
  var p = [null];
259
- p.push.apply(p, h);
290
+ p.push.apply(p, g);
260
291
  var b = new (f.bind.apply(f, p))();
261
- return g && o(b, g.prototype), b;
262
- }(d, arguments, r(this).constructor);
292
+ return h && o(b, h.prototype), b;
293
+ }(u, arguments, r(this).constructor);
263
294
  }
264
- return c.prototype = Object.create(d.prototype, { constructor: { value: c, enumerable: !1, writable: !0, configurable: !0 } }), o(c, d);
265
- }, n(s);
295
+ return c.prototype = Object.create(u.prototype, { constructor: { value: c, enumerable: !1, writable: !0, configurable: !0 } }), o(c, u);
296
+ }, n(l);
266
297
  }
267
298
  function i() {
268
299
  try {
269
- var s = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
300
+ var l = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
270
301
  }));
271
- } catch (u) {
302
+ } catch (s) {
272
303
  }
273
304
  return (i = function() {
274
- return !!s;
305
+ return !!l;
275
306
  })();
276
307
  }
277
- function o(s, u) {
278
- return o = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(d, c) {
279
- return d.__proto__ = c, d;
280
- }, o(s, u);
308
+ function o(l, s) {
309
+ return o = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(u, c) {
310
+ return u.__proto__ = c, u;
311
+ }, o(l, s);
281
312
  }
282
- function r(s) {
283
- return r = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(u) {
284
- return u.__proto__ || Object.getPrototypeOf(u);
285
- }, r(s);
313
+ function r(l) {
314
+ return r = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(s) {
315
+ return s.__proto__ || Object.getPrototypeOf(s);
316
+ }, r(l);
286
317
  }
287
318
  t.__esModule = !0, t.default = void 0;
288
319
  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 }).
@@ -434,85 +465,85 @@ To pass a single animation please supply them in simple values, e.g. animation('
434
465
 
435
466
  `, 78: `base must be set in "px" or "%" but you set it in "%s".
436
467
  ` };
437
- function l() {
438
- for (var s = arguments.length, u = new Array(s), d = 0; d < s; d++) u[d] = arguments[d];
439
- var c, f = u[0], h = [];
440
- for (c = 1; c < u.length; c += 1) h.push(u[c]);
441
- return h.forEach(function(g) {
442
- f = f.replace(/%[a-z]/, g);
468
+ function d() {
469
+ for (var l = arguments.length, s = new Array(l), u = 0; u < l; u++) s[u] = arguments[u];
470
+ var c, f = s[0], g = [];
471
+ for (c = 1; c < s.length; c += 1) g.push(s[c]);
472
+ return g.forEach(function(h) {
473
+ f = f.replace(/%[a-z]/, h);
443
474
  }), f;
444
475
  }
445
- t.default = function(s) {
446
- var u, d;
476
+ t.default = function(l) {
477
+ var s, u;
447
478
  function c(f) {
448
- var h;
449
- if (process.env.NODE_ENV === "production") h = s.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + f + " for more information.") || this;
479
+ var g;
480
+ if (process.env.NODE_ENV === "production") g = l.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + f + " for more information.") || this;
450
481
  else {
451
- for (var g = arguments.length, p = new Array(g > 1 ? g - 1 : 0), b = 1; b < g; b++) p[b - 1] = arguments[b];
452
- h = s.call(this, l.apply(void 0, [e[f]].concat(p))) || this;
482
+ for (var h = arguments.length, p = new Array(h > 1 ? h - 1 : 0), b = 1; b < h; b++) p[b - 1] = arguments[b];
483
+ g = l.call(this, d.apply(void 0, [e[f]].concat(p))) || this;
453
484
  }
454
485
  return function(C) {
455
486
  if (C === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
456
487
  return C;
457
- }(h);
488
+ }(g);
458
489
  }
459
- return d = s, (u = c).prototype = Object.create(d.prototype), u.prototype.constructor = u, o(u, d), c;
490
+ return u = l, (s = c).prototype = Object.create(u.prototype), s.prototype.constructor = s, o(s, u), c;
460
491
  }(n(Error)), a.exports = t.default;
461
- })(R, R.exports);
462
- var S = R.exports;
492
+ })(U, U.exports);
493
+ var _ = U.exports;
463
494
  (function(a, t) {
464
- t.__esModule = !0, t.default = function(g) {
465
- if (typeof g != "string") throw new o.default(3);
466
- var p = (0, i.default)(g);
495
+ t.__esModule = !0, t.default = function(h) {
496
+ if (typeof h != "string") throw new o.default(3);
497
+ var p = (0, i.default)(h);
467
498
  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) };
468
- if (p.match(l)) {
499
+ if (p.match(d)) {
469
500
  var b = parseFloat((parseInt("" + p[7] + p[8], 16) / 255).toFixed(2));
470
501
  return { red: parseInt("" + p[1] + p[2], 16), green: parseInt("" + p[3] + p[4], 16), blue: parseInt("" + p[5] + p[6], 16), alpha: b };
471
502
  }
472
- if (p.match(s)) return { red: parseInt("" + p[1] + p[1], 16), green: parseInt("" + p[2] + p[2], 16), blue: parseInt("" + p[3] + p[3], 16) };
473
- if (p.match(u)) {
503
+ 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) };
504
+ if (p.match(s)) {
474
505
  var C = parseFloat((parseInt("" + p[4] + p[4], 16) / 255).toFixed(2));
475
506
  return { red: parseInt("" + p[1] + p[1], 16), green: parseInt("" + p[2] + p[2], 16), blue: parseInt("" + p[3] + p[3], 16), alpha: C };
476
507
  }
477
- var E = d.exec(p);
508
+ var E = u.exec(p);
478
509
  if (E) return { red: parseInt("" + E[1], 10), green: parseInt("" + E[2], 10), blue: parseInt("" + E[3], 10) };
479
510
  var y = c.exec(p.substring(0, 50));
480
511
  if (y) return { red: parseInt("" + y[1], 10), green: parseInt("" + y[2], 10), blue: parseInt("" + y[3], 10), alpha: parseFloat("" + y[4]) > 1 ? parseFloat("" + y[4]) / 100 : parseFloat("" + y[4]) };
481
512
  var A = f.exec(p);
482
513
  if (A) {
483
- var Ie = parseInt("" + A[1], 10), Oe = parseInt("" + A[2], 10) / 100, Me = parseInt("" + A[3], 10) / 100, fe = "rgb(" + (0, n.default)(Ie, Oe, Me) + ")", I = d.exec(fe);
484
- if (!I) throw new o.default(4, p, fe);
485
- return { red: parseInt("" + I[1], 10), green: parseInt("" + I[2], 10), blue: parseInt("" + I[3], 10) };
514
+ var Oe = parseInt("" + A[1], 10), Ie = parseInt("" + A[2], 10) / 100, Me = parseInt("" + A[3], 10) / 100, ce = "rgb(" + (0, n.default)(Oe, Ie, Me) + ")", B = u.exec(ce);
515
+ if (!B) throw new o.default(4, p, ce);
516
+ return { red: parseInt("" + B[1], 10), green: parseInt("" + B[2], 10), blue: parseInt("" + B[3], 10) };
486
517
  }
487
- var w = h.exec(p.substring(0, 50));
518
+ var w = g.exec(p.substring(0, 50));
488
519
  if (w) {
489
- var Be = parseInt("" + w[1], 10), Pe = parseInt("" + w[2], 10) / 100, je = parseInt("" + w[3], 10) / 100, ce = "rgb(" + (0, n.default)(Be, Pe, je) + ")", O = d.exec(ce);
490
- if (!O) throw new o.default(4, p, ce);
520
+ var Te = parseInt("" + w[1], 10), Pe = parseInt("" + w[2], 10) / 100, Le = parseInt("" + w[3], 10) / 100, pe = "rgb(" + (0, n.default)(Te, Pe, Le) + ")", O = u.exec(pe);
521
+ if (!O) throw new o.default(4, p, pe);
491
522
  return { red: parseInt("" + O[1], 10), green: parseInt("" + O[2], 10), blue: parseInt("" + O[3], 10), alpha: parseFloat("" + w[4]) > 1 ? parseFloat("" + w[4]) / 100 : parseFloat("" + w[4]) };
492
523
  }
493
524
  throw new o.default(5);
494
525
  };
495
- var n = r(le), i = r(Re), o = r(S);
496
- function r(g) {
497
- return g && g.__esModule ? g : { default: g };
526
+ var n = r(ue), i = r(Ue), o = r(_);
527
+ function r(h) {
528
+ return h && h.__esModule ? h : { default: h };
498
529
  }
499
- var e = /^#[a-fA-F0-9]{6}$/, l = /^#[a-fA-F0-9]{8}$/, s = /^#[a-fA-F0-9]{3}$/, u = /^#[a-fA-F0-9]{4}$/, d = /^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, 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;
530
+ var e = /^#[a-fA-F0-9]{6}$/, d = /^#[a-fA-F0-9]{8}$/, l = /^#[a-fA-F0-9]{3}$/, s = /^#[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;
500
531
  a.exports = t.default;
501
- })(q, q.exports);
502
- var de = q.exports;
532
+ })(D, D.exports);
533
+ var fe = D.exports;
503
534
  (function(a, t) {
504
535
  t.__esModule = !0, t.default = function(o) {
505
536
  if (o === "transparent") return 0;
506
- var r = (0, i.default)(o), e = Object.keys(r).map(function(d) {
507
- var c = r[d] / 255;
537
+ var r = (0, i.default)(o), e = Object.keys(r).map(function(u) {
538
+ var c = r[u] / 255;
508
539
  return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
509
- }), l = e[0], s = e[1], u = e[2];
510
- return parseFloat((0.2126 * l + 0.7152 * s + 0.0722 * u).toFixed(3));
540
+ }), d = e[0], l = e[1], s = e[2];
541
+ return parseFloat((0.2126 * d + 0.7152 * l + 0.0722 * s).toFixed(3));
511
542
  };
512
- var n, i = (n = de) && n.__esModule ? n : { default: n };
543
+ var n, i = (n = fe) && n.__esModule ? n : { default: n };
513
544
  a.exports = t.default;
514
- })(H, H.exports);
515
- const Ye = ue(H.exports);
545
+ })(z, z.exports);
546
+ const Ye = le(z.exports);
516
547
  var Y = { exports: {} }, J = { exports: {} };
517
548
  (function(a, t) {
518
549
  function n(i, o, r) {
@@ -525,200 +556,200 @@ var Y = { exports: {} }, J = { exports: {} };
525
556
  return n(i, i.length, []);
526
557
  }, a.exports = t.default;
527
558
  })(J, J.exports);
528
- var me, B, we = J.exports, U = { exports: {} };
529
- me = U, (B = U.exports).__esModule = !0, B.default = void 0, B.default = function(a, t, n) {
559
+ var be, M, xe = J.exports, G = { exports: {} };
560
+ be = G, (M = G.exports).__esModule = !0, M.default = void 0, M.default = function(a, t, n) {
530
561
  return Math.max(a, Math.min(t, n));
531
- }, me.exports = B.default;
532
- var xe = U.exports, G = { exports: {} }, V = { exports: {} };
562
+ }, be.exports = M.default;
563
+ var Se = G.exports, V = { exports: {} }, Z = { exports: {} };
533
564
  (function(a, t) {
534
565
  t.__esModule = !0, t.default = void 0, t.default = function(n) {
535
- var i, o = n.red / 255, r = n.green / 255, e = n.blue / 255, l = Math.max(o, r, e), s = Math.min(o, r, e), u = (l + s) / 2;
536
- if (l === s) return n.alpha !== void 0 ? { hue: 0, saturation: 0, lightness: u, alpha: n.alpha } : { hue: 0, saturation: 0, lightness: u };
537
- var d = l - s, c = u > 0.5 ? d / (2 - l - s) : d / (l + s);
538
- switch (l) {
566
+ var i, o = n.red / 255, r = n.green / 255, e = n.blue / 255, d = Math.max(o, r, e), l = Math.min(o, r, e), s = (d + l) / 2;
567
+ if (d === l) return n.alpha !== void 0 ? { hue: 0, saturation: 0, lightness: s, alpha: n.alpha } : { hue: 0, saturation: 0, lightness: s };
568
+ var u = d - l, c = s > 0.5 ? u / (2 - d - l) : u / (d + l);
569
+ switch (d) {
539
570
  case o:
540
- i = (r - e) / d + (r < e ? 6 : 0);
571
+ i = (r - e) / u + (r < e ? 6 : 0);
541
572
  break;
542
573
  case r:
543
- i = (e - o) / d + 2;
574
+ i = (e - o) / u + 2;
544
575
  break;
545
576
  default:
546
- i = (o - r) / d + 4;
577
+ i = (o - r) / u + 4;
547
578
  }
548
- return i *= 60, n.alpha !== void 0 ? { hue: i, saturation: c, lightness: u, alpha: n.alpha } : { hue: i, saturation: c, lightness: u };
579
+ return i *= 60, n.alpha !== void 0 ? { hue: i, saturation: c, lightness: s, alpha: n.alpha } : { hue: i, saturation: c, lightness: s };
549
580
  }, a.exports = t.default;
550
- })(V, V.exports);
551
- var Je = V.exports;
581
+ })(Z, Z.exports);
582
+ var Je = Z.exports;
552
583
  (function(a, t) {
553
584
  t.__esModule = !0, t.default = function(r) {
554
585
  return (0, i.default)((0, n.default)(r));
555
586
  };
556
- var n = o(de), i = o(Je);
587
+ var n = o(fe), i = o(Je);
557
588
  function o(r) {
558
589
  return r && r.__esModule ? r : { default: r };
559
590
  }
560
591
  a.exports = t.default;
561
- })(G, G.exports);
562
- var Se = G.exports, Z = { exports: {} }, Q = { exports: {} }, X = { exports: {} }, ee = { exports: {} };
592
+ })(V, V.exports);
593
+ var _e = V.exports, Q = { exports: {} }, X = { exports: {} }, ee = { exports: {} }, te = { exports: {} };
563
594
  (function(a, t) {
564
595
  t.__esModule = !0, t.default = void 0, t.default = function(n) {
565
596
  return n.length === 7 && n[1] === n[2] && n[3] === n[4] && n[5] === n[6] ? "#" + n[1] + n[3] + n[5] : n;
566
597
  }, a.exports = t.default;
567
- })(ee, ee.exports);
568
- var ke = ee.exports, te = { exports: {} };
598
+ })(te, te.exports);
599
+ var ke = te.exports, ne = { exports: {} };
569
600
  (function(a, t) {
570
601
  t.__esModule = !0, t.default = void 0, t.default = function(n) {
571
602
  var i = n.toString(16);
572
603
  return i.length === 1 ? "0" + i : i;
573
604
  }, a.exports = t.default;
574
- })(te, te.exports);
575
- var _e = te.exports;
605
+ })(ne, ne.exports);
606
+ var Ce = ne.exports;
576
607
  (function(a, t) {
577
608
  t.__esModule = !0, t.default = void 0;
578
- var n = r(le), i = r(ke), o = r(_e);
579
- function r(s) {
580
- return s && s.__esModule ? s : { default: s };
609
+ var n = r(ue), i = r(ke), o = r(Ce);
610
+ function r(l) {
611
+ return l && l.__esModule ? l : { default: l };
581
612
  }
582
- function e(s) {
583
- return (0, o.default)(Math.round(255 * s));
613
+ function e(l) {
614
+ return (0, o.default)(Math.round(255 * l));
584
615
  }
585
- function l(s, u, d) {
586
- return (0, i.default)("#" + e(s) + e(u) + e(d));
616
+ function d(l, s, u) {
617
+ return (0, i.default)("#" + e(l) + e(s) + e(u));
587
618
  }
588
- t.default = function(s, u, d) {
589
- return (0, n.default)(s, u, d, l);
619
+ t.default = function(l, s, u) {
620
+ return (0, n.default)(l, s, u, d);
590
621
  }, a.exports = t.default;
591
- })(X, X.exports);
592
- var Ce = X.exports;
622
+ })(ee, ee.exports);
623
+ var Ee = ee.exports;
593
624
  (function(a, t) {
594
- t.__esModule = !0, t.default = function(r, e, l) {
595
- if (typeof r == "number" && typeof e == "number" && typeof l == "number") return (0, n.default)(r, e, l);
596
- if (typeof r == "object" && e === void 0 && l === void 0) return (0, n.default)(r.hue, r.saturation, r.lightness);
625
+ t.__esModule = !0, t.default = function(r, e, d) {
626
+ if (typeof r == "number" && typeof e == "number" && typeof d == "number") return (0, n.default)(r, e, d);
627
+ if (typeof r == "object" && e === void 0 && d === void 0) return (0, n.default)(r.hue, r.saturation, r.lightness);
597
628
  throw new i.default(1);
598
629
  };
599
- var n = o(Ce), i = o(S);
630
+ var n = o(Ee), i = o(_);
600
631
  function o(r) {
601
632
  return r && r.__esModule ? r : { default: r };
602
633
  }
603
634
  a.exports = t.default;
604
- })(Q, Q.exports);
605
- var Ue = Q.exports, ne = { exports: {} };
635
+ })(X, X.exports);
636
+ var Ge = X.exports, re = { exports: {} };
606
637
  (function(a, t) {
607
- t.__esModule = !0, t.default = function(e, l, s, u) {
608
- if (typeof e == "number" && typeof l == "number" && typeof s == "number" && typeof u == "number") return u >= 1 ? (0, n.default)(e, l, s) : "rgba(" + (0, i.default)(e, l, s) + "," + u + ")";
609
- if (typeof e == "object" && l === void 0 && s === void 0 && u === void 0) return e.alpha >= 1 ? (0, n.default)(e.hue, e.saturation, e.lightness) : "rgba(" + (0, i.default)(e.hue, e.saturation, e.lightness) + "," + e.alpha + ")";
638
+ t.__esModule = !0, t.default = function(e, d, l, s) {
639
+ if (typeof e == "number" && typeof d == "number" && typeof l == "number" && typeof s == "number") return s >= 1 ? (0, n.default)(e, d, l) : "rgba(" + (0, i.default)(e, d, l) + "," + s + ")";
640
+ if (typeof e == "object" && d === void 0 && l === void 0 && s === void 0) return e.alpha >= 1 ? (0, n.default)(e.hue, e.saturation, e.lightness) : "rgba(" + (0, i.default)(e.hue, e.saturation, e.lightness) + "," + e.alpha + ")";
610
641
  throw new o.default(2);
611
642
  };
612
- var n = r(Ce), i = r(le), o = r(S);
643
+ var n = r(Ee), i = r(ue), o = r(_);
613
644
  function r(e) {
614
645
  return e && e.__esModule ? e : { default: e };
615
646
  }
616
647
  a.exports = t.default;
617
- })(ne, ne.exports);
618
- var Ge = ne.exports, re = { exports: {} };
648
+ })(re, re.exports);
649
+ var Ve = re.exports, ae = { exports: {} };
619
650
  (function(a, t) {
620
- t.__esModule = !0, t.default = function(e, l, s) {
621
- if (typeof e == "number" && typeof l == "number" && typeof s == "number") return (0, n.default)("#" + (0, i.default)(e) + (0, i.default)(l) + (0, i.default)(s));
622
- if (typeof e == "object" && l === void 0 && s === void 0) return (0, n.default)("#" + (0, i.default)(e.red) + (0, i.default)(e.green) + (0, i.default)(e.blue));
651
+ t.__esModule = !0, t.default = function(e, d, l) {
652
+ if (typeof e == "number" && typeof d == "number" && typeof l == "number") return (0, n.default)("#" + (0, i.default)(e) + (0, i.default)(d) + (0, i.default)(l));
653
+ if (typeof e == "object" && d === void 0 && l === void 0) return (0, n.default)("#" + (0, i.default)(e.red) + (0, i.default)(e.green) + (0, i.default)(e.blue));
623
654
  throw new o.default(6);
624
655
  };
625
- var n = r(ke), i = r(_e), o = r(S);
656
+ var n = r(ke), i = r(Ce), o = r(_);
626
657
  function r(e) {
627
658
  return e && e.__esModule ? e : { default: e };
628
659
  }
629
660
  a.exports = t.default;
630
- })(re, re.exports);
631
- var Ee = re.exports, ae = { exports: {} };
661
+ })(ae, ae.exports);
662
+ var Ae = ae.exports, ie = { exports: {} };
632
663
  (function(a, t) {
633
- t.__esModule = !0, t.default = function(e, l, s, u) {
634
- if (typeof e == "string" && typeof l == "number") {
635
- var d = (0, n.default)(e);
636
- return "rgba(" + d.red + "," + d.green + "," + d.blue + "," + l + ")";
664
+ t.__esModule = !0, t.default = function(e, d, l, s) {
665
+ if (typeof e == "string" && typeof d == "number") {
666
+ var u = (0, n.default)(e);
667
+ return "rgba(" + u.red + "," + u.green + "," + u.blue + "," + d + ")";
637
668
  }
638
- if (typeof e == "number" && typeof l == "number" && typeof s == "number" && typeof u == "number") return u >= 1 ? (0, i.default)(e, l, s) : "rgba(" + e + "," + l + "," + s + "," + u + ")";
639
- if (typeof e == "object" && l === void 0 && s === void 0 && u === void 0) return e.alpha >= 1 ? (0, i.default)(e.red, e.green, e.blue) : "rgba(" + e.red + "," + e.green + "," + e.blue + "," + e.alpha + ")";
669
+ if (typeof e == "number" && typeof d == "number" && typeof l == "number" && typeof s == "number") return s >= 1 ? (0, i.default)(e, d, l) : "rgba(" + e + "," + d + "," + l + "," + s + ")";
670
+ if (typeof e == "object" && d === void 0 && l === void 0 && s === void 0) return e.alpha >= 1 ? (0, i.default)(e.red, e.green, e.blue) : "rgba(" + e.red + "," + e.green + "," + e.blue + "," + e.alpha + ")";
640
671
  throw new o.default(7);
641
672
  };
642
- var n = r(de), i = r(Ee), o = r(S);
673
+ var n = r(fe), i = r(Ae), o = r(_);
643
674
  function r(e) {
644
675
  return e && e.__esModule ? e : { default: e };
645
676
  }
646
677
  a.exports = t.default;
647
- })(ae, ae.exports);
648
- var Ve = ae.exports;
678
+ })(ie, ie.exports);
679
+ var Ze = ie.exports;
649
680
  (function(a, t) {
650
681
  t.__esModule = !0, t.default = function(f) {
651
682
  if (typeof f != "object") throw new e.default(8);
652
- if (u(f)) return (0, r.default)(f);
653
- if (s(f)) return (0, o.default)(f);
683
+ if (s(f)) return (0, r.default)(f);
684
+ if (l(f)) return (0, o.default)(f);
654
685
  if (c(f)) return (0, i.default)(f);
655
- if (d(f)) return (0, n.default)(f);
686
+ if (u(f)) return (0, n.default)(f);
656
687
  throw new e.default(8);
657
688
  };
658
- var n = l(Ue), i = l(Ge), o = l(Ee), r = l(Ve), e = l(S);
659
- function l(f) {
689
+ var n = d(Ge), i = d(Ve), o = d(Ae), r = d(Ze), e = d(_);
690
+ function d(f) {
660
691
  return f && f.__esModule ? f : { default: f };
661
692
  }
662
- var s = function(f) {
693
+ var l = function(f) {
663
694
  return typeof f.red == "number" && typeof f.green == "number" && typeof f.blue == "number" && (typeof f.alpha != "number" || f.alpha === void 0);
664
- }, u = function(f) {
695
+ }, s = function(f) {
665
696
  return typeof f.red == "number" && typeof f.green == "number" && typeof f.blue == "number" && typeof f.alpha == "number";
666
- }, d = function(f) {
697
+ }, u = function(f) {
667
698
  return typeof f.hue == "number" && typeof f.saturation == "number" && typeof f.lightness == "number" && (typeof f.alpha != "number" || f.alpha === void 0);
668
699
  }, c = function(f) {
669
700
  return typeof f.hue == "number" && typeof f.saturation == "number" && typeof f.lightness == "number" && typeof f.alpha == "number";
670
701
  };
671
702
  a.exports = t.default;
672
- })(Z, Z.exports);
673
- var Ae = Z.exports;
703
+ })(Q, Q.exports);
704
+ var Be = Q.exports;
674
705
  (function(a, t) {
675
706
  t.__esModule = !0, t.default = void 0;
676
- var n = e(we), i = e(xe), o = e(Se), r = e(Ae);
677
- function e(u) {
678
- return u && u.__esModule ? u : { default: u };
679
- }
680
- function l() {
681
- return l = Object.assign ? Object.assign.bind() : function(u) {
682
- for (var d = 1; d < arguments.length; d++) {
683
- var c = arguments[d];
684
- for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (u[f] = c[f]);
707
+ var n = e(xe), i = e(Se), o = e(_e), r = e(Be);
708
+ function e(s) {
709
+ return s && s.__esModule ? s : { default: s };
710
+ }
711
+ function d() {
712
+ return d = Object.assign ? Object.assign.bind() : function(s) {
713
+ for (var u = 1; u < arguments.length; u++) {
714
+ var c = arguments[u];
715
+ for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (s[f] = c[f]);
685
716
  }
686
- return u;
687
- }, l.apply(this, arguments);
717
+ return s;
718
+ }, d.apply(this, arguments);
688
719
  }
689
- var s = (0, n.default)(function(u, d) {
690
- if (d === "transparent") return d;
691
- var c = (0, o.default)(d);
692
- return (0, r.default)(l({}, c, { lightness: (0, i.default)(0, 1, c.lightness - parseFloat(u)) }));
720
+ var l = (0, n.default)(function(s, u) {
721
+ if (u === "transparent") return u;
722
+ var c = (0, o.default)(u);
723
+ return (0, r.default)(d({}, c, { lightness: (0, i.default)(0, 1, c.lightness - parseFloat(s)) }));
693
724
  });
694
- t.default = s, a.exports = t.default;
725
+ t.default = l, a.exports = t.default;
695
726
  })(Y, Y.exports);
696
- const Ze = ue(Y.exports);
727
+ const Qe = le(Y.exports);
697
728
  var oe = { exports: {} };
698
729
  (function(a, t) {
699
730
  t.__esModule = !0, t.default = void 0;
700
- var n = e(we), i = e(xe), o = e(Se), r = e(Ae);
701
- function e(u) {
702
- return u && u.__esModule ? u : { default: u };
703
- }
704
- function l() {
705
- return l = Object.assign ? Object.assign.bind() : function(u) {
706
- for (var d = 1; d < arguments.length; d++) {
707
- var c = arguments[d];
708
- for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (u[f] = c[f]);
731
+ var n = e(xe), i = e(Se), o = e(_e), r = e(Be);
732
+ function e(s) {
733
+ return s && s.__esModule ? s : { default: s };
734
+ }
735
+ function d() {
736
+ return d = Object.assign ? Object.assign.bind() : function(s) {
737
+ for (var u = 1; u < arguments.length; u++) {
738
+ var c = arguments[u];
739
+ for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (s[f] = c[f]);
709
740
  }
710
- return u;
711
- }, l.apply(this, arguments);
741
+ return s;
742
+ }, d.apply(this, arguments);
712
743
  }
713
- var s = (0, n.default)(function(u, d) {
714
- if (d === "transparent") return d;
715
- var c = (0, o.default)(d);
716
- return (0, r.default)(l({}, c, { lightness: (0, i.default)(0, 1, c.lightness + parseFloat(u)) }));
744
+ var l = (0, n.default)(function(s, u) {
745
+ if (u === "transparent") return u;
746
+ var c = (0, o.default)(u);
747
+ return (0, r.default)(d({}, c, { lightness: (0, i.default)(0, 1, c.lightness + parseFloat(s)) }));
717
748
  });
718
- t.default = s, a.exports = t.default;
749
+ t.default = l, a.exports = t.default;
719
750
  })(oe, oe.exports);
720
- const Qe = ue(oe.exports);
721
- function Xe(a) {
751
+ const Xe = le(oe.exports);
752
+ function et(a) {
722
753
  if (!document.querySelector("style[data-widget-styles]")) {
723
754
  var t, n;
724
755
  (function() {
@@ -728,16 +759,16 @@ function Xe(a) {
728
759
  const e = Ye(i) > 0.5;
729
760
  r.textContent = `
730
761
  .bf-trigger-button{position:fixed;bottom:16px;right:16px;width:56px;height:56px;border-radius:50%;border:none;box-shadow:0 20px 25px -5px #1212171a,0 10px 10px -5px #1212170a;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{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 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{position:fixed;bottom:0;right:0;width:100vw;height:100vh;border:none;overflow:hidden;z-index:999;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{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))}}
731
- .${F} { background: ${i}; }
732
- .${F}:hover {
733
- background: ${e ? Ze(0.05, i) : Qe(0.05, i)};
762
+ .${j} { background: ${i}; }
763
+ .${j}:hover {
764
+ background: ${e ? Qe(0.05, i) : Xe(0.05, i)};
734
765
  }
735
766
  .trigger-button-icon { color: ${o}; }
736
767
  `, document.head.appendChild(r);
737
768
  })((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");
738
769
  }
739
770
  }
740
- function et(a, t) {
771
+ function tt(a, t) {
741
772
  const n = () => {
742
773
  ((i) => {
743
774
  var o;
@@ -749,14 +780,14 @@ function et(a, t) {
749
780
  i.observe(document.body, { attributes: !0, attributeFilter: ["class"] }), t.addEventListener("abort", () => i.disconnect());
750
781
  })();
751
782
  }
752
- function tt(a, t) {
783
+ function nt(a, t) {
753
784
  let n;
754
785
  const i = () => {
755
786
  ((r) => {
756
787
  var e;
757
- const l = { type: "UPDATE_BODY_CLASS", isMobile: r };
758
- (e = a.contentWindow) === null || e === void 0 || e.postMessage(l, "*"), r && (v.isWidgetOpen ? v.hideTriggerButton() : v.showTriggerButton());
759
- })(document.body.clientWidth <= 576);
788
+ const d = { type: "UPDATE_BODY_CLASS", isMobile: r };
789
+ (e = a.contentWindow) === null || e === void 0 || e.postMessage(d, "*"), r && (v.isWidgetOpen ? v.hideTriggerButton() : v.showTriggerButton());
790
+ })(document.body.clientWidth <= L);
760
791
  }, o = () => {
761
792
  n && clearTimeout(n), n = window.setTimeout(i, 300);
762
793
  };
@@ -765,7 +796,7 @@ function tt(a, t) {
765
796
  r.observe(document.body), t.addEventListener("abort", () => r.disconnect());
766
797
  })();
767
798
  }
768
- function be(a) {
799
+ function ve(a) {
769
800
  const t = new TextEncoder().encode(a);
770
801
  if (typeof window != "undefined" && typeof window.btoa == "function") {
771
802
  const n = Array.from(t, (i) => String.fromCharCode(i)).join("");
@@ -774,60 +805,60 @@ function be(a) {
774
805
  if (typeof Buffer != "undefined") return Buffer.from(t).toString("base64");
775
806
  throw new Error("[utils.base64Encode]: Unsupported environment");
776
807
  }
777
- const ve = /* @__PURE__ */ new Set();
778
- function nt(a, t) {
779
- const n = document.createDocumentFragment(), i = function(e) {
780
- const l = M("button", F, { id: `trigger-button-${e}`, "aria-controls": j, "aria-expanded": "false", "data-name": F }), s = M("div", "trigger-button-icon", { "aria-hidden": "true" });
781
- return s.innerHTML = `
808
+ const ye = /* @__PURE__ */ new Set();
809
+ function rt(a, t, n) {
810
+ const i = document.createDocumentFragment(), o = function(d, l) {
811
+ const s = I("button", j, { id: `trigger-button-${d}`, "aria-controls": P, "aria-expanded": "false", "data-name": j }), u = I("div", "trigger-button-icon", { "aria-hidden": "true" });
812
+ return u.innerHTML = `
782
813
  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256" class="close-icon">
783
814
  <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>
784
815
  </svg>
785
816
  <svg width="24" height="14" viewBox="0 0 24 14" fill="none" xmlns="http://www.w3.org/2000/svg" class="fish-icon visible">
786
817
  <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"/>
787
818
  </svg>
788
- `, l.setAttribute("aria-label", "Open Brainfish widget"), l.appendChild(s), v.initialize(l, s), l;
789
- }(a), { iframeContainer: o, iframe: r } = function(e) {
790
- const l = M("div", j, { id: j, "aria-live": "polite", "aria-hidden": "true" }), s = M("iframe", "trigger-iframe", { src: e, sandbox: "allow-scripts allow-same-origin allow-popups allow-forms", allow: "clipboard-write", role: "dialog" });
819
+ `, s.setAttribute("aria-label", "Open Brainfish widget"), s.appendChild(u), v.initialize(s, u, l), s;
820
+ }(a, n), { iframeContainer: r, iframe: e } = function(d) {
821
+ const l = I("div", P, { id: P, "aria-live": "polite", "aria-hidden": "true" }), s = I("iframe", "trigger-iframe", { src: d, sandbox: "allow-scripts allow-same-origin allow-popups allow-forms", allow: "clipboard-write", role: "dialog" });
791
822
  return l.appendChild(s), { iframeContainer: l, iframe: s };
792
823
  }(t);
793
- return n.appendChild(i), n.appendChild(o), { fragment: n, iframe: r };
824
+ return i.appendChild(o), i.appendChild(r), { fragment: i, iframe: e };
794
825
  }
795
- const rt = (a, t) => {
796
- const n = se(a.overrides), i = ((o = a.overrides) == null ? void 0 : o.widgetHost) || "https://agent.brainfi.sh";
826
+ const at = (a, t) => {
827
+ const n = de(a.overrides), i = ((o = a.overrides) == null ? void 0 : o.widgetHost) || "https://agent.brainfi.sh";
797
828
  var o;
798
- const { theme: r, settings: e } = t, l = `${i}/?widgetKey=${a.widgetKey}&themeParam=${be(JSON.stringify(r))}&settingsParam=${be(JSON.stringify(e))}`;
829
+ const { theme: r, settings: e } = t, d = `${i}/?widgetKey=${a.widgetKey}&themeParam=${ve(JSON.stringify(r))}&settingsParam=${ve(JSON.stringify(e))}`, l = e == null ? void 0 : e.hideTriggerButton;
799
830
  try {
800
- if (s = a.widgetKey, ve.has(s) || function(g) {
801
- return !!document.getElementById(`trigger-button-${g}`);
831
+ if (s = a.widgetKey, ye.has(s) || function(p) {
832
+ return !!document.getElementById(`trigger-button-${p}`);
802
833
  }(a.widgetKey)) return;
803
- Xe(t);
804
- const { fragment: u, iframe: d } = nt(a.widgetKey, l), c = new AbortController(), { signal: f } = c;
805
- d.onload = () => {
834
+ et(t);
835
+ const { fragment: u, iframe: c } = rt(a.widgetKey, d, l || !1), f = new AbortController(), { signal: g } = f;
836
+ c.onload = () => {
806
837
  setTimeout(() => {
807
- et(d, f), Ne(i, f), tt(d, f);
838
+ tt(c, g), Re({ widgetHost: i, apiHost: n, widgetKey: a.widgetKey, signal: g }), nt(c, g);
808
839
  }, 0);
809
- }, document.body.appendChild(u), ve.add(a.widgetKey);
840
+ }, document.body.appendChild(u), ye.add(a.widgetKey);
810
841
  const h = () => {
811
- c.abort(), window.removeEventListener("beforeunload", h);
842
+ f.abort(), window.removeEventListener("beforeunload", h);
812
843
  };
813
844
  return void window.addEventListener("beforeunload", h);
814
845
  } catch (u) {
815
- (function(d, c, f) {
816
- x(d, c, c.message, f);
846
+ (function(c, f, g) {
847
+ x(c, f, f.message, g);
817
848
  })(n, u, a.widgetKey);
818
849
  }
819
850
  var s;
820
851
  };
821
- let P = null;
822
- const ye = typeof window != "undefined" && window.Brainfish ? window.Brainfish : (P || (P = /* @__PURE__ */ function() {
852
+ let T = null;
853
+ const we = typeof window != "undefined" && window.Brainfish ? window.Brainfish : (T || (T = /* @__PURE__ */ function() {
823
854
  let a = [], t = null;
824
855
  function n(o, r) {
825
856
  if (t) {
826
857
  const e = o.split(".");
827
- let l = t;
828
- for (let u = 0; u < e.length - 1; u++) l = l[e[u]];
829
- const s = l[e[e.length - 1]];
830
- if (typeof s == "function") return s.apply(l, r);
858
+ let d = t;
859
+ for (let s = 0; s < e.length - 1; s++) d = d[e[s]];
860
+ const l = d[e[e.length - 1]];
861
+ if (typeof l == "function") return l.apply(d, r);
831
862
  } else a.push([o, r]);
832
863
  }
833
864
  return { Widgets: { init: function() {
@@ -854,21 +885,21 @@ const ye = typeof window != "undefined" && window.Brainfish ? window.Brainfish :
854
885
  n(r, e);
855
886
  }
856
887
  } };
857
- }(), typeof window != "undefined" && (window.Brainfish = P)), P);
888
+ }(), typeof window != "undefined" && (window.Brainfish = T)), T);
858
889
  let K = null;
859
- ye.Widgets.init = (a) => m(void 0, null, function* () {
890
+ we.Widgets.init = (a) => m(void 0, null, function* () {
860
891
  window && (window.BrainfishAnalytics = window.BrainfishAnalytics || function() {
861
- for (var r = arguments.length, e = new Array(r), l = 0; l < r; l++) e[l] = arguments[l];
892
+ for (var r = arguments.length, e = new Array(r), d = 0; d < r; d++) e[d] = arguments[d];
862
893
  (window.BrainfishAnalytics.q = window.BrainfishAnalytics.q || []).push(e);
863
894
  });
864
- const t = se(a.overrides), n = ((i = a.overrides) == null ? void 0 : i.analyticsApiHost) || "";
895
+ const t = de(a.overrides), n = ((i = a.overrides) == null ? void 0 : i.analyticsApiHost) || "";
865
896
  var i;
866
897
  let o;
867
898
  if (a.config) o = JSON.parse(((r) => {
868
899
  if (typeof window != "undefined" && typeof window.atob == "function") {
869
- const e = atob(r), l = e.length, s = new Uint8Array(l);
870
- for (let u = 0; u < l; u++) s[u] = e.charCodeAt(u);
871
- return new TextDecoder().decode(s);
900
+ const e = atob(r), d = e.length, l = new Uint8Array(d);
901
+ for (let s = 0; s < d; s++) l[s] = e.charCodeAt(s);
902
+ return new TextDecoder().decode(l);
872
903
  }
873
904
  if (typeof Buffer != "undefined") return Buffer.from(r, "base64").toString("utf-8");
874
905
  throw new Error("[utils.base64Decode]: Unsupported environment");
@@ -877,13 +908,13 @@ ye.Widgets.init = (a) => m(void 0, null, function* () {
877
908
  const { config: r } = yield Ke({ widgetKey: a.widgetKey, apiHost: t });
878
909
  o = r;
879
910
  }
880
- K || (K = function(r, e, l, s) {
911
+ K || (K = function(r, e, d, l) {
881
912
  return m(this, null, function* () {
882
- var u, d, c;
883
- const f = ((u = r.overrides) === null || u === void 0 ? void 0 : u.enableRecording) || (e == null || (d = e.settings) === null || d === void 0 ? void 0 : d.enableRecording) || !1, h = ((c = r.overrides) === null || c === void 0 ? void 0 : c.version) || (e == null ? void 0 : e.version), g = [];
884
- h != null && h.startsWith("2.") ? rt(r, e) : g.push(qe(r, e)), g.push(De(r.widgetKey, e.trackingToken || "", l, s, f));
885
- const [p] = yield Promise.allSettled(g);
886
- p && p.status === "fulfilled" && p.value && ye._setRealBrainfish(p.value);
913
+ var s, u, c;
914
+ const f = ((s = r.overrides) === null || s === void 0 ? void 0 : s.enableRecording) || (e == null || (u = e.settings) === null || u === void 0 ? void 0 : u.enableRecording) || !1, g = ((c = r.overrides) === null || c === void 0 ? void 0 : c.version) || (e == null ? void 0 : e.version), h = [];
915
+ g != null && g.startsWith("2.") ? at(r, e) : h.push(De(r, e)), h.push(Ne(r.widgetKey, e.trackingToken || "", d, l, f));
916
+ const [p] = yield Promise.allSettled(h);
917
+ p && p.status === "fulfilled" && p.value && we._setRealBrainfish(p.value);
887
918
  });
888
919
  }(a, o, t, n)), yield K;
889
920
  });
@@ -892,6 +923,6 @@ const ot = function() {
892
923
  };
893
924
  export {
894
925
  ot as BrainfishAnalytics,
895
- ye as default
926
+ we as default
896
927
  };
897
928
  //# sourceMappingURL=web.js.map