@brainfish-ai/widgets-initiator 1.7.0-alpha.9 → 1.7.0

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