@brainfish-ai/widgets-initiator 1.3.2-alpha.0 → 1.4.0-alpha.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,217 +1,824 @@
1
- var j = Object.defineProperty, C = Object.defineProperties;
2
- var I = Object.getOwnPropertyDescriptors;
3
- var K = Object.getOwnPropertySymbols;
4
- var N = Object.prototype.hasOwnProperty, P = Object.prototype.propertyIsEnumerable;
5
- var b = (t, n, r) => n in t ? j(t, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[n] = r, v = (t, n) => {
6
- for (var r in n || (n = {}))
7
- N.call(n, r) && b(t, r, n[r]);
8
- if (K)
9
- for (var r of K(n))
10
- P.call(n, r) && b(t, r, n[r]);
11
- return t;
12
- }, A = (t, n) => C(t, I(n));
13
- var H = (t, n, r) => b(t, typeof n != "symbol" ? n + "" : n, r);
14
- var g = (t, n, r) => new Promise((o, i) => {
15
- var s = (d) => {
1
+ var Fe = Object.defineProperty, Oe = Object.defineProperties;
2
+ var Be = Object.getOwnPropertyDescriptors;
3
+ var fe = Object.getOwnPropertySymbols;
4
+ var Le = Object.prototype.hasOwnProperty, $e = Object.prototype.propertyIsEnumerable;
5
+ var F = (a, t, r) => t in a ? Fe(a, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[t] = r, O = (a, t) => {
6
+ for (var r in t || (t = {}))
7
+ Le.call(t, r) && F(a, r, t[r]);
8
+ if (fe)
9
+ for (var r of fe(t))
10
+ $e.call(t, r) && F(a, r, t[r]);
11
+ return a;
12
+ }, B = (a, t) => Oe(a, Be(t));
13
+ var ce = (a, t, r) => F(a, typeof t != "symbol" ? t + "" : t, r);
14
+ var b = (a, t, r) => new Promise((l, o) => {
15
+ var n = (s) => {
16
16
  try {
17
- a(r.next(d));
18
- } catch (u) {
19
- i(u);
17
+ d(r.next(s));
18
+ } catch (i) {
19
+ o(i);
20
20
  }
21
- }, e = (d) => {
21
+ }, e = (s) => {
22
22
  try {
23
- a(r.throw(d));
24
- } catch (u) {
25
- i(u);
23
+ d(r.throw(s));
24
+ } catch (i) {
25
+ o(i);
26
26
  }
27
- }, a = (d) => d.done ? o(d.value) : Promise.resolve(d.value).then(s, e);
28
- a((r = r.apply(t, n)).next());
27
+ }, d = (s) => s.done ? l(s.value) : Promise.resolve(s.value).then(n, e);
28
+ d((r = r.apply(a, t)).next());
29
29
  });
30
- var w, S;
30
+ var _, T;
31
31
  (function() {
32
32
  try {
33
- var t = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}, n = new t.Error().stack;
34
- n && (t._sentryDebugIds = t._sentryDebugIds || {}, t._sentryDebugIds[n] = "06818797-d968-4339-8447-5896798c2cde", t._sentryDebugIdIdentifier = "sentry-dbid-06818797-d968-4339-8447-5896798c2cde");
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] = "8af36667-9d88-44bb-83e8-6e846c353e99", a._sentryDebugIdIdentifier = "sentry-dbid-8af36667-9d88-44bb-83e8-6e846c353e99");
35
35
  } catch (r) {
36
36
  }
37
- })(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "f1b3472b67ed59854ba4be50f86981500ee3e188" }, function(t) {
38
- t.Sidebar = "sidebar", t.Searchbar = "searchbar";
39
- }(w || (w = {})), w.Sidebar, w.Searchbar;
40
- class B extends Error {
41
- constructor(r, o) {
42
- super(r, o);
43
- H(this, "cause");
44
- this.name = "BrainfishWidgetError", this.cause = o == null ? void 0 : o.cause, Error.captureStackTrace && Error.captureStackTrace(this, B), this.cause instanceof Error && this.cause.stack && (this.stack = this.stack + `
37
+ })(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "fc6c9a05ea3bac86a978016fde6cf7b778d63a4a" }, function(a) {
38
+ a.Sidebar = "sidebar", a.Searchbar = "searchbar";
39
+ }(_ || (_ = {})), _.Sidebar, _.Searchbar;
40
+ class ae extends Error {
41
+ constructor(r, l) {
42
+ super(r, l);
43
+ ce(this, "cause");
44
+ this.name = "BrainfishWidgetError", this.cause = l == null ? void 0 : l.cause, Error.captureStackTrace && Error.captureStackTrace(this, ae), this.cause instanceof Error && this.cause.stack && (this.stack = this.stack + `
45
45
  Caused by: ` + this.cause.stack);
46
46
  }
47
47
  toJSON() {
48
48
  return { name: this.name, message: this.message, stack: this.stack, cause: this.cause instanceof Error ? { name: this.cause.name, message: this.cause.message, stack: this.cause.stack } : this.cause };
49
49
  }
50
50
  }
51
- (function(t) {
52
- t.LINK = "link", t.CALLBACK = "callback", t.EMAIL = "email", t.PHONE = "phone";
53
- })(S || (S = {}));
54
- const h = (t, n, r, o) => {
55
- let i = r, s = {};
56
- if (n instanceof Error) try {
57
- s = JSON.parse(n.message), i += ` - ${s.message || n.message}`;
51
+ (function(a) {
52
+ a.LINK = "link", a.CALLBACK = "callback", a.EMAIL = "email", a.PHONE = "phone";
53
+ })(T || (T = {}));
54
+ const w = (a, t, r, l) => {
55
+ let o = r, n = {};
56
+ if (t instanceof Error) try {
57
+ n = JSON.parse(t.message), o += ` - ${n.message || t.message}`;
58
58
  } catch (e) {
59
- i += ` - ${n.message}`;
59
+ o += ` - ${t.message}`;
60
60
  }
61
- else i += ` - ${String(n)}`;
62
- ((e, a, d) => {
61
+ else o += ` - ${String(t)}`;
62
+ ((e, d, s) => {
63
63
  if (!navigator || navigator.userAgent.toLowerCase().includes("headless")) return;
64
- const u = a.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.3.2-alpha.0. ${a.message}`, stack: a.stack, cause: { message: u.message, stack: u.stack, cause: u.cause } }) });
66
- })(t, new B(i, { cause: s }), o);
67
- }, L = (t) => g(void 0, null, function* () {
68
- let { widgetKey: n, apiHost: r } = t;
69
- return function(o, i, s) {
70
- return g(this, null, function* () {
71
- return fetch(`${o}${i}`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": s } }).then((e) => {
72
- if (!e.ok) throw new Error(`API call failed with status: ${e.status}`);
73
- return e.json();
74
- }).then((e) => {
75
- if (!e) throw new Error("Error loading config: empty response");
76
- return e;
77
- }).catch((e) => {
78
- h(o, e, "Error fetching config", s);
79
- });
64
+ const i = d.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.4.0-alpha.0. ${d.message}`, stack: d.stack, cause: { message: i.message, stack: i.stack, cause: i.cause } }) });
66
+ })(a, new ae(o, { cause: n }), l);
67
+ }, Te = (a) => b(void 0, null, function* () {
68
+ let { widgetKey: t, apiHost: r } = a;
69
+ return function(l, o, n) {
70
+ return b(this, null, function* () {
71
+ let e, d = 0;
72
+ for (; d < 3; ) try {
73
+ const s = yield fetch(`${l}${o}`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": n } });
74
+ if (!s.ok) throw new Error(`API call failed with status: ${s.status}`);
75
+ const i = yield s.json();
76
+ if (!i) throw new Error("Error loading config: empty response");
77
+ return i;
78
+ } catch (s) {
79
+ if (e = s, d++, d >= 3) throw w(l, s, "Error fetching config", n), e;
80
+ yield new Promise((i) => setTimeout(i, 500));
81
+ }
80
82
  });
81
- }(r, "/api/searchWidgets.getConfigByKey", n);
82
- }), R = (t) => {
83
- let { config: n, apiKey: r, apiHost: o } = t;
84
- const i = n.settings || {};
85
- return ["bodyActionButtons", "footerActionButtons", "nextBestActions"].forEach((s) => {
86
- i[s] && (i[s] = i[s].map((e) => e.type === S.CALLBACK && e.value ? A(v({}, e), { value: new Function(`return ${e.value}`)() }) : e));
87
- }), A(v({}, n), { settings: i, apiHost: o, widgetMode: n.widgetType, apiKey: r });
88
- }, $ = (t) => (t == null ? void 0 : t.apiHost) || "https://app.brainfi.sh", k = (() => {
83
+ }(r, "/api/searchWidgets.getConfigByKey", t);
84
+ }), Ke = (a) => {
85
+ let { config: t, apiKey: r, apiHost: l } = a;
86
+ const o = t.settings || {};
87
+ return ["bodyActionButtons", "footerActionButtons", "nextBestActions"].forEach((n) => {
88
+ o[n] && (o[n] = o[n].map((e) => e.type === T.CALLBACK && e.value ? B(O({}, e), { value: new Function(`return ${e.value}`)() }) : e));
89
+ }), B(O({}, t), { settings: o, apiHost: l, widgetMode: t.widgetType, apiKey: r });
90
+ }, oe = (a) => (a == null ? void 0 : a.apiHost) || "https://app.brainfi.sh", L = (() => {
89
91
  if (typeof window == "undefined") return;
90
- const t = window.navigator.userAgent;
91
- if (!(t.match(/iPad/i) || t.match(/iPhone/i))) return !1;
92
- const n = t.match(/OS (\d+)_/i);
93
- return n && parseInt(n[1], 10) <= 14;
94
- })(), _ = (t) => g(void 0, null, function* () {
95
- let { apiHost: n, widgetKey: r, version: o } = t;
92
+ const a = window.navigator.userAgent;
93
+ if (!(a.match(/iPad/i) || a.match(/iPhone/i))) return !1;
94
+ const t = a.match(/OS (\d+)_/i);
95
+ return t && parseInt(t[1], 10) <= 14;
96
+ })(), He = (a) => b(void 0, null, function* () {
97
+ let { apiHost: t, widgetKey: r, version: l } = a;
96
98
  try {
97
- const i = `https://cdn.jsdelivr.net/npm/@brainfish-ai/search-widget@${o}/dist/web.js`, s = k ? i.replace("web.js", "web.umd.js") : i;
98
- return { widget: yield ((a) => g(void 0, null, function* () {
99
- return document.getElementById("brainfish-widget") ? window.Brainfish : new Promise((d, u) => {
100
- const c = document.createElement("script");
101
- c.id = "brainfish-widget", c.src = a, c.type = k ? "text/javascript" : "module", c.async = !0, c.crossOrigin = "anonymous", c.onload = () => {
99
+ const o = `https://cdn.jsdelivr.net/npm/@brainfish-ai/search-widget@${l}/dist/web.js`, n = L ? o.replace("web.js", "web.umd.js") : o;
100
+ return { widget: yield ((d) => b(void 0, null, function* () {
101
+ return document.getElementById("brainfish-widget") ? window.Brainfish : new Promise((s, i) => {
102
+ const u = document.createElement("script");
103
+ u.id = "brainfish-widget", u.src = d, u.type = L ? "text/javascript" : "module", u.async = !0, u.crossOrigin = "anonymous", u.onload = () => {
102
104
  setTimeout(() => {
103
- const l = window.Brainfish;
104
- l ? d(l) : u(new Error("Failed to load Brainfish module"));
105
+ const c = window.Brainfish;
106
+ c ? s(c) : i(new Error("Failed to load Brainfish module"));
105
107
  }, 200);
106
- }, c.onerror = (l) => {
107
- const f = l, p = { message: `Failed to load script: ${a}`, type: f.type, fileName: f.filename, lineNumber: f.lineno, columnNumber: f.colno, error: f.error ? f.error.toString() : "Unknown error" };
108
- u(new Error(JSON.stringify(p)));
109
- }, k || document.head.appendChild(c);
108
+ }, u.onerror = (c) => {
109
+ const f = c, h = { 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
+ i(new Error(JSON.stringify(h)));
111
+ }, L || document.head.appendChild(u);
110
112
  });
111
- }))(s) };
112
- } catch (i) {
113
- h(n, i, i.message, r);
113
+ }))(n) };
114
+ } catch (o) {
115
+ w(t, o, o.message, r);
114
116
  }
115
- }), W = /* @__PURE__ */ new Set(), F = (t, n) => g(void 0, null, function* () {
116
- const r = $(t.overrides);
117
+ }), pe = /* @__PURE__ */ new Set(), qe = (a, t) => b(void 0, null, function* () {
118
+ const r = oe(a.overrides);
117
119
  try {
118
- if (W.has(t.widgetKey)) return;
119
- const o = yield _({ apiHost: r, widgetKey: t.widgetKey, version: n.version || "latest" });
120
- if (o) {
121
- const { widget: i } = o, s = R({ config: n, apiKey: t.widgetKey, apiHost: r });
122
- return t.overrides && n.settings && Object.entries(t.overrides).forEach((e) => {
123
- let [a, d] = e;
124
- n.settings && a in n.settings && (n.settings[a] = function() {
125
- let u = arguments.length > 1 ? arguments[1] : void 0;
126
- const c = new Map((arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).map((l) => [l.label, l]));
127
- return u.forEach((l) => c.set(l.label, l)), Array.from(c.values());
128
- }(n.settings[a], d));
129
- }), function(e, a) {
130
- a.widgetType === w.Searchbar || a.widgetType === "Search" ? e.SearchWidget.initStandard(a) : e.HelpWidget.initPopup(a);
131
- }(i, s), W.add(t.widgetKey), i;
120
+ if (pe.has(a.widgetKey)) return;
121
+ const l = yield He({ apiHost: r, widgetKey: a.widgetKey, version: t.version || "latest" });
122
+ if (l) {
123
+ const { widget: o } = l, n = Ke({ config: t, apiKey: a.widgetKey, apiHost: r });
124
+ return a.overrides && t.settings && Object.entries(a.overrides).forEach((e) => {
125
+ let [d, s] = e;
126
+ t.settings && d in t.settings && (t.settings[d] = function() {
127
+ let i = 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 i.forEach((c) => u.set(c.label, c)), Array.from(u.values());
130
+ }(t.settings[d], s));
131
+ }), function(e, d) {
132
+ d.widgetType === _.Searchbar || d.widgetType === "Search" ? e.SearchWidget.initStandard(d) : e.HelpWidget.initPopup(d);
133
+ }(o, n), pe.add(a.widgetKey), o;
132
134
  }
133
- } catch (o) {
134
- h(r, o, o.message, t.widgetKey);
135
+ } catch (l) {
136
+ w(r, l, l.message, a.widgetKey);
135
137
  }
136
138
  });
137
- let O = !1;
138
- const J = function(o, i, s) {
139
- return g(this, arguments, function* (t, n, r) {
140
- let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : void 0, a = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
141
- if (n || h(r, new Error("Access key is required"), "Access key is required", t), !O) try {
142
- window.BrainfishAnalytics("init", { apiUrl: e, accessKey: n, trackScreenViews: !0, trackAttributes: !0, trackOutgoingLinks: !0, enableRecording: a }), O = !0, yield ((d, u) => g(this, null, function* () {
139
+ let ge = !1;
140
+ const ze = function(l, o, n) {
141
+ return b(this, arguments, function* (a, t, r) {
142
+ let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : void 0, d = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
143
+ if (t || w(r, new Error("Access key is required"), "Access key is required", a), !ge) try {
144
+ window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !0, trackAttributes: !0, trackOutgoingLinks: !0, enableRecording: d }), ge = !0, yield ((s, i) => b(this, null, function* () {
143
145
  if (document.getElementById("brainfish-analytics")) return window.BrainfishAnalytics;
144
- const c = document.createElement("script");
145
- 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 = () => {
146
- h(d, new Error(`Failed to load script: ${c.src}`), `Failed to load script: ${c.src}`, u);
147
- }, document.head.appendChild(c);
148
- }))(r, t);
149
- } catch (d) {
150
- h(r, d, "Failed to initialize BrainfishAnalytics", t);
146
+ const u = document.createElement("script");
147
+ 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 = () => {
148
+ w(s, new Error(`Failed to load script: ${u.src}`), `Failed to load script: ${u.src}`, i);
149
+ }, document.head.appendChild(u);
150
+ }))(r, a);
151
+ } catch (s) {
152
+ w(r, s, "Failed to initialize BrainfishAnalytics", a);
151
153
  }
152
154
  });
153
155
  };
154
- let y = null;
155
- const T = typeof window != "undefined" && window.Brainfish ? window.Brainfish : (y || (y = /* @__PURE__ */ function() {
156
- let t = [], n = null;
157
- function r(i, s) {
158
- if (n) {
159
- const e = i.split(".");
160
- let a = n;
161
- for (let u = 0; u < e.length - 1; u++) a = a[e[u]];
162
- const d = a[e[e.length - 1]];
163
- if (typeof d == "function") return d.apply(a, s);
164
- } else t.push([i, s]);
156
+ function P(a, t) {
157
+ let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
158
+ const l = document.createElement(a);
159
+ return l.className = t, Object.entries(r).forEach((o) => {
160
+ let [n, e] = o;
161
+ l.setAttribute(n, e);
162
+ }), l;
163
+ }
164
+ function se(a) {
165
+ return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
166
+ }
167
+ var K = { exports: {} }, H = { exports: {} }, q = { exports: {} };
168
+ (function(a, t) {
169
+ function r(o) {
170
+ return Math.round(255 * o);
171
+ }
172
+ function l(o, n, e) {
173
+ return r(o) + "," + r(n) + "," + r(e);
174
+ }
175
+ t.__esModule = !0, t.default = void 0, t.default = function(o, n, e, d) {
176
+ if (d === void 0 && (d = l), n === 0) return d(e, e, e);
177
+ var s = (o % 360 + 360) % 360 / 60, i = (1 - Math.abs(2 * e - 1)) * n, u = i * (1 - Math.abs(s % 2 - 1)), c = 0, f = 0, h = 0;
178
+ s >= 0 && s < 1 ? (c = i, f = u) : s >= 1 && s < 2 ? (c = u, f = i) : s >= 2 && s < 3 ? (f = i, h = u) : s >= 3 && s < 4 ? (f = u, h = i) : s >= 4 && s < 5 ? (c = u, h = i) : s >= 5 && s < 6 && (c = i, h = u);
179
+ var g = e - i / 2;
180
+ return d(c + g, f + g, h + g);
181
+ }, a.exports = t.default;
182
+ })(q, q.exports);
183
+ var ie = q.exports, z = { exports: {} };
184
+ (function(a, t) {
185
+ t.__esModule = !0, t.default = void 0;
186
+ var r = { 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" };
187
+ t.default = function(l) {
188
+ if (typeof l != "string") return l;
189
+ var o = l.toLowerCase();
190
+ return r[o] ? "#" + r[o] : l;
191
+ }, a.exports = t.default;
192
+ })(z, z.exports);
193
+ var Re = z.exports, R = { exports: {} };
194
+ (function(a, t) {
195
+ function r(s) {
196
+ var i = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
197
+ return r = function(u) {
198
+ if (u === null || !function(f) {
199
+ try {
200
+ return Function.toString.call(f).indexOf("[native code]") !== -1;
201
+ } catch (h) {
202
+ return typeof f == "function";
203
+ }
204
+ }(u)) return u;
205
+ if (typeof u != "function") throw new TypeError("Super expression must either be null or a function");
206
+ if (i !== void 0) {
207
+ if (i.has(u)) return i.get(u);
208
+ i.set(u, c);
209
+ }
210
+ function c() {
211
+ return function(f, h, g) {
212
+ if (l()) return Reflect.construct.apply(null, arguments);
213
+ var p = [null];
214
+ p.push.apply(p, h);
215
+ var m = new (f.bind.apply(f, p))();
216
+ return g && o(m, g.prototype), m;
217
+ }(u, arguments, n(this).constructor);
218
+ }
219
+ return c.prototype = Object.create(u.prototype, { constructor: { value: c, enumerable: !1, writable: !0, configurable: !0 } }), o(c, u);
220
+ }, r(s);
221
+ }
222
+ function l() {
223
+ try {
224
+ var s = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
225
+ }));
226
+ } catch (i) {
227
+ }
228
+ return (l = function() {
229
+ return !!s;
230
+ })();
231
+ }
232
+ function o(s, i) {
233
+ return o = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(u, c) {
234
+ return u.__proto__ = c, u;
235
+ }, o(s, i);
236
+ }
237
+ function n(s) {
238
+ return n = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(i) {
239
+ return i.__proto__ || Object.getPrototypeOf(i);
240
+ }, n(s);
241
+ }
242
+ t.__esModule = !0, t.default = void 0;
243
+ 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 }).
244
+
245
+ `, 2: `Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).
246
+
247
+ `, 3: `Passed an incorrect argument to a color function, please pass a string representation of a color.
248
+
249
+ `, 4: `Couldn't generate valid rgb string from %s, it returned %s.
250
+
251
+ `, 5: `Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.
252
+
253
+ `, 6: `Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).
254
+
255
+ `, 7: `Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).
256
+
257
+ `, 8: `Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.
258
+
259
+ `, 9: `Please provide a number of steps to the modularScale helper.
260
+
261
+ `, 10: `Please pass a number or one of the predefined scales to the modularScale helper as the ratio.
262
+
263
+ `, 11: `Invalid value passed as base to modularScale, expected number or em string but got "%s"
264
+
265
+ `, 12: `Expected a string ending in "px" or a number passed as the first argument to %s(), got "%s" instead.
266
+
267
+ `, 13: `Expected a string ending in "px" or a number passed as the second argument to %s(), got "%s" instead.
268
+
269
+ `, 14: `Passed invalid pixel value ("%s") to %s(), please pass a value like "12px" or 12.
270
+
271
+ `, 15: `Passed invalid base value ("%s") to %s(), please pass a value like "12px" or 12.
272
+
273
+ `, 16: `You must provide a template to this method.
274
+
275
+ `, 17: `You passed an unsupported selector state to this method.
276
+
277
+ `, 18: `minScreen and maxScreen must be provided as stringified numbers with the same units.
278
+
279
+ `, 19: `fromSize and toSize must be provided as stringified numbers with the same units.
280
+
281
+ `, 20: `expects either an array of objects or a single object with the properties prop, fromSize, and toSize.
282
+
283
+ `, 21: "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n", 22: "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n", 23: `fontFace expects a name of a font-family.
284
+
285
+ `, 24: `fontFace expects either the path to the font file(s) or a name of a local copy.
286
+
287
+ `, 25: `fontFace expects localFonts to be an array.
288
+
289
+ `, 26: `fontFace expects fileFormats to be an array.
290
+
291
+ `, 27: `radialGradient requries at least 2 color-stops to properly render.
292
+
293
+ `, 28: `Please supply a filename to retinaImage() as the first argument.
294
+
295
+ `, 29: `Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.
296
+
297
+ `, 30: "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n", 31: `The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation
298
+
299
+ `, 32: `To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])
300
+ To pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')
301
+
302
+ `, 33: `The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation
303
+
304
+ `, 34: `borderRadius expects a radius value as a string or number as the second argument.
305
+
306
+ `, 35: `borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.
307
+
308
+ `, 36: `Property must be a string value.
309
+
310
+ `, 37: `Syntax Error at %s.
311
+
312
+ `, 38: `Formula contains a function that needs parentheses at %s.
313
+
314
+ `, 39: `Formula is missing closing parenthesis at %s.
315
+
316
+ `, 40: `Formula has too many closing parentheses at %s.
317
+
318
+ `, 41: `All values in a formula must have the same unit or be unitless.
319
+
320
+ `, 42: `Please provide a number of steps to the modularScale helper.
321
+
322
+ `, 43: `Please pass a number or one of the predefined scales to the modularScale helper as the ratio.
323
+
324
+ `, 44: `Invalid value passed as base to modularScale, expected number or em/rem string but got %s.
325
+
326
+ `, 45: `Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.
327
+
328
+ `, 46: `Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.
329
+
330
+ `, 47: `minScreen and maxScreen must be provided as stringified numbers with the same units.
331
+
332
+ `, 48: `fromSize and toSize must be provided as stringified numbers with the same units.
333
+
334
+ `, 49: `Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.
335
+
336
+ `, 50: `Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.
337
+
338
+ `, 51: `Expects the first argument object to have the properties prop, fromSize, and toSize.
339
+
340
+ `, 52: `fontFace expects either the path to the font file(s) or a name of a local copy.
341
+
342
+ `, 53: `fontFace expects localFonts to be an array.
343
+
344
+ `, 54: `fontFace expects fileFormats to be an array.
345
+
346
+ `, 55: `fontFace expects a name of a font-family.
347
+
348
+ `, 56: `linearGradient requries at least 2 color-stops to properly render.
349
+
350
+ `, 57: `radialGradient requries at least 2 color-stops to properly render.
351
+
352
+ `, 58: `Please supply a filename to retinaImage() as the first argument.
353
+
354
+ `, 59: `Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.
355
+
356
+ `, 60: "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n", 61: `Property must be a string value.
357
+
358
+ `, 62: `borderRadius expects a radius value as a string or number as the second argument.
359
+
360
+ `, 63: `borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.
361
+
362
+ `, 64: `The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.
363
+
364
+ `, 65: `To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').
365
+
366
+ `, 66: `The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.
367
+
368
+ `, 67: `You must provide a template to this method.
369
+
370
+ `, 68: `You passed an unsupported selector state to this method.
371
+
372
+ `, 69: `Expected a string ending in "px" or a number passed as the first argument to %s(), got %s instead.
373
+
374
+ `, 70: `Expected a string ending in "px" or a number passed as the second argument to %s(), got %s instead.
375
+
376
+ `, 71: `Passed invalid pixel value %s to %s(), please pass a value like "12px" or 12.
377
+
378
+ `, 72: `Passed invalid base value %s to %s(), please pass a value like "12px" or 12.
379
+
380
+ `, 73: `Please provide a valid CSS variable.
381
+
382
+ `, 74: `CSS variable not found and no default was provided.
383
+
384
+ `, 75: `important requires a valid style object, got a %s instead.
385
+
386
+ `, 76: `fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.
387
+
388
+ `, 77: `remToPx expects a value in "rem" but you provided it in "%s".
389
+
390
+ `, 78: `base must be set in "px" or "%" but you set it in "%s".
391
+ ` };
392
+ function d() {
393
+ for (var s = arguments.length, i = new Array(s), u = 0; u < s; u++) i[u] = arguments[u];
394
+ var c, f = i[0], h = [];
395
+ for (c = 1; c < i.length; c += 1) h.push(i[c]);
396
+ return h.forEach(function(g) {
397
+ f = f.replace(/%[a-z]/, g);
398
+ }), f;
399
+ }
400
+ t.default = function(s) {
401
+ var i, u;
402
+ function c(f) {
403
+ var h;
404
+ 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;
405
+ else {
406
+ for (var g = arguments.length, p = new Array(g > 1 ? g - 1 : 0), m = 1; m < g; m++) p[m - 1] = arguments[m];
407
+ h = s.call(this, d.apply(void 0, [e[f]].concat(p))) || this;
408
+ }
409
+ return function(S) {
410
+ if (S === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
411
+ return S;
412
+ }(h);
413
+ }
414
+ return u = s, (i = c).prototype = Object.create(u.prototype), i.prototype.constructor = i, o(i, u), c;
415
+ }(r(Error)), a.exports = t.default;
416
+ })(R, R.exports);
417
+ var x = R.exports;
418
+ (function(a, t) {
419
+ t.__esModule = !0, t.default = function(g) {
420
+ if (typeof g != "string") throw new o.default(3);
421
+ var p = (0, l.default)(g);
422
+ 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) };
423
+ if (p.match(d)) {
424
+ var m = parseFloat((parseInt("" + p[7] + p[8], 16) / 255).toFixed(2));
425
+ return { red: parseInt("" + p[1] + p[2], 16), green: parseInt("" + p[3] + p[4], 16), blue: parseInt("" + p[5] + p[6], 16), alpha: m };
426
+ }
427
+ 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) };
428
+ if (p.match(i)) {
429
+ var S = parseFloat((parseInt("" + p[4] + p[4], 16) / 255).toFixed(2));
430
+ return { red: parseInt("" + p[1] + p[1], 16), green: parseInt("" + p[2] + p[2], 16), blue: parseInt("" + p[3] + p[3], 16), alpha: S };
431
+ }
432
+ var C = u.exec(p);
433
+ if (C) return { red: parseInt("" + C[1], 10), green: parseInt("" + C[2], 10), blue: parseInt("" + C[3], 10) };
434
+ var v = c.exec(p.substring(0, 50));
435
+ if (v) return { red: parseInt("" + v[1], 10), green: parseInt("" + v[2], 10), blue: parseInt("" + v[3], 10), alpha: parseFloat("" + v[4]) > 1 ? parseFloat("" + v[4]) / 100 : parseFloat("" + v[4]) };
436
+ var E = f.exec(p);
437
+ if (E) {
438
+ var Ee = parseInt("" + E[1], 10), Ae = parseInt("" + E[2], 10) / 100, je = parseInt("" + E[3], 10) / 100, ue = "rgb(" + (0, r.default)(Ee, Ae, je) + ")", A = u.exec(ue);
439
+ if (!A) throw new o.default(4, p, ue);
440
+ return { red: parseInt("" + A[1], 10), green: parseInt("" + A[2], 10), blue: parseInt("" + A[3], 10) };
441
+ }
442
+ var y = h.exec(p.substring(0, 50));
443
+ if (y) {
444
+ var Me = parseInt("" + y[1], 10), Ie = parseInt("" + y[2], 10) / 100, Pe = parseInt("" + y[3], 10) / 100, de = "rgb(" + (0, r.default)(Me, Ie, Pe) + ")", j = u.exec(de);
445
+ if (!j) throw new o.default(4, p, de);
446
+ return { red: parseInt("" + j[1], 10), green: parseInt("" + j[2], 10), blue: parseInt("" + j[3], 10), alpha: parseFloat("" + y[4]) > 1 ? parseFloat("" + y[4]) / 100 : parseFloat("" + y[4]) };
447
+ }
448
+ throw new o.default(5);
449
+ };
450
+ var r = n(ie), l = n(Re), o = n(x);
451
+ function n(g) {
452
+ return g && g.__esModule ? g : { default: g };
453
+ }
454
+ var e = /^#[a-fA-F0-9]{6}$/, d = /^#[a-fA-F0-9]{8}$/, s = /^#[a-fA-F0-9]{3}$/, i = /^#[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, 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;
455
+ a.exports = t.default;
456
+ })(H, H.exports);
457
+ var le = H.exports;
458
+ (function(a, t) {
459
+ t.__esModule = !0, t.default = function(o) {
460
+ if (o === "transparent") return 0;
461
+ var n = (0, l.default)(o), e = Object.keys(n).map(function(u) {
462
+ var c = n[u] / 255;
463
+ return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
464
+ }), d = e[0], s = e[1], i = e[2];
465
+ return parseFloat((0.2126 * d + 0.7152 * s + 0.0722 * i).toFixed(3));
466
+ };
467
+ var r, l = (r = le) && r.__esModule ? r : { default: r };
468
+ a.exports = t.default;
469
+ })(K, K.exports);
470
+ const We = se(K.exports);
471
+ var W = { exports: {} }, N = { exports: {} };
472
+ (function(a, t) {
473
+ function r(l, o, n) {
474
+ return function() {
475
+ var e = n.concat(Array.prototype.slice.call(arguments));
476
+ return e.length >= o ? l.apply(this, e) : r(l, o, e);
477
+ };
478
+ }
479
+ t.__esModule = !0, t.default = function(l) {
480
+ return r(l, l.length, []);
481
+ }, a.exports = t.default;
482
+ })(N, N.exports);
483
+ var he, M, ve = N.exports, D = { exports: {} };
484
+ he = D, (M = D.exports).__esModule = !0, M.default = void 0, M.default = function(a, t, r) {
485
+ return Math.max(a, Math.min(t, r));
486
+ }, he.exports = M.default;
487
+ var ye = D.exports, Y = { exports: {} }, G = { exports: {} };
488
+ (function(a, t) {
489
+ t.__esModule = !0, t.default = void 0, t.default = function(r) {
490
+ var l, o = r.red / 255, n = r.green / 255, e = r.blue / 255, d = Math.max(o, n, e), s = Math.min(o, n, e), i = (d + s) / 2;
491
+ if (d === s) return r.alpha !== void 0 ? { hue: 0, saturation: 0, lightness: i, alpha: r.alpha } : { hue: 0, saturation: 0, lightness: i };
492
+ var u = d - s, c = i > 0.5 ? u / (2 - d - s) : u / (d + s);
493
+ switch (d) {
494
+ case o:
495
+ l = (n - e) / u + (n < e ? 6 : 0);
496
+ break;
497
+ case n:
498
+ l = (e - o) / u + 2;
499
+ break;
500
+ default:
501
+ l = (o - n) / u + 4;
502
+ }
503
+ return l *= 60, r.alpha !== void 0 ? { hue: l, saturation: c, lightness: i, alpha: r.alpha } : { hue: l, saturation: c, lightness: i };
504
+ }, a.exports = t.default;
505
+ })(G, G.exports);
506
+ var Ne = G.exports;
507
+ (function(a, t) {
508
+ t.__esModule = !0, t.default = function(n) {
509
+ return (0, l.default)((0, r.default)(n));
510
+ };
511
+ var r = o(le), l = o(Ne);
512
+ function o(n) {
513
+ return n && n.__esModule ? n : { default: n };
514
+ }
515
+ a.exports = t.default;
516
+ })(Y, Y.exports);
517
+ var we = Y.exports, J = { exports: {} }, Z = { exports: {} }, V = { exports: {} }, U = { exports: {} };
518
+ (function(a, t) {
519
+ t.__esModule = !0, t.default = void 0, t.default = function(r) {
520
+ return r.length === 7 && r[1] === r[2] && r[3] === r[4] && r[5] === r[6] ? "#" + r[1] + r[3] + r[5] : r;
521
+ }, a.exports = t.default;
522
+ })(U, U.exports);
523
+ var xe = U.exports, Q = { exports: {} };
524
+ (function(a, t) {
525
+ t.__esModule = !0, t.default = void 0, t.default = function(r) {
526
+ var l = r.toString(16);
527
+ return l.length === 1 ? "0" + l : l;
528
+ }, a.exports = t.default;
529
+ })(Q, Q.exports);
530
+ var _e = Q.exports;
531
+ (function(a, t) {
532
+ t.__esModule = !0, t.default = void 0;
533
+ var r = n(ie), l = n(xe), o = n(_e);
534
+ function n(s) {
535
+ return s && s.__esModule ? s : { default: s };
536
+ }
537
+ function e(s) {
538
+ return (0, o.default)(Math.round(255 * s));
539
+ }
540
+ function d(s, i, u) {
541
+ return (0, l.default)("#" + e(s) + e(i) + e(u));
542
+ }
543
+ t.default = function(s, i, u) {
544
+ return (0, r.default)(s, i, u, d);
545
+ }, a.exports = t.default;
546
+ })(V, V.exports);
547
+ var ke = V.exports;
548
+ (function(a, t) {
549
+ t.__esModule = !0, t.default = function(n, e, d) {
550
+ if (typeof n == "number" && typeof e == "number" && typeof d == "number") return (0, r.default)(n, e, d);
551
+ if (typeof n == "object" && e === void 0 && d === void 0) return (0, r.default)(n.hue, n.saturation, n.lightness);
552
+ throw new l.default(1);
553
+ };
554
+ var r = o(ke), l = o(x);
555
+ function o(n) {
556
+ return n && n.__esModule ? n : { default: n };
557
+ }
558
+ a.exports = t.default;
559
+ })(Z, Z.exports);
560
+ var De = Z.exports, X = { exports: {} };
561
+ (function(a, t) {
562
+ t.__esModule = !0, t.default = function(e, d, s, i) {
563
+ if (typeof e == "number" && typeof d == "number" && typeof s == "number" && typeof i == "number") return i >= 1 ? (0, r.default)(e, d, s) : "rgba(" + (0, l.default)(e, d, s) + "," + i + ")";
564
+ if (typeof e == "object" && d === void 0 && s === void 0 && i === void 0) return e.alpha >= 1 ? (0, r.default)(e.hue, e.saturation, e.lightness) : "rgba(" + (0, l.default)(e.hue, e.saturation, e.lightness) + "," + e.alpha + ")";
565
+ throw new o.default(2);
566
+ };
567
+ var r = n(ke), l = n(ie), o = n(x);
568
+ function n(e) {
569
+ return e && e.__esModule ? e : { default: e };
570
+ }
571
+ a.exports = t.default;
572
+ })(X, X.exports);
573
+ var Ye = X.exports, ee = { exports: {} };
574
+ (function(a, t) {
575
+ t.__esModule = !0, t.default = function(e, d, s) {
576
+ if (typeof e == "number" && typeof d == "number" && typeof s == "number") return (0, r.default)("#" + (0, l.default)(e) + (0, l.default)(d) + (0, l.default)(s));
577
+ if (typeof e == "object" && d === void 0 && s === void 0) return (0, r.default)("#" + (0, l.default)(e.red) + (0, l.default)(e.green) + (0, l.default)(e.blue));
578
+ throw new o.default(6);
579
+ };
580
+ var r = n(xe), l = n(_e), o = n(x);
581
+ function n(e) {
582
+ return e && e.__esModule ? e : { default: e };
583
+ }
584
+ a.exports = t.default;
585
+ })(ee, ee.exports);
586
+ var Se = ee.exports, te = { exports: {} };
587
+ (function(a, t) {
588
+ t.__esModule = !0, t.default = function(e, d, s, i) {
589
+ if (typeof e == "string" && typeof d == "number") {
590
+ var u = (0, r.default)(e);
591
+ return "rgba(" + u.red + "," + u.green + "," + u.blue + "," + d + ")";
592
+ }
593
+ if (typeof e == "number" && typeof d == "number" && typeof s == "number" && typeof i == "number") return i >= 1 ? (0, l.default)(e, d, s) : "rgba(" + e + "," + d + "," + s + "," + i + ")";
594
+ if (typeof e == "object" && d === void 0 && s === void 0 && i === void 0) return e.alpha >= 1 ? (0, l.default)(e.red, e.green, e.blue) : "rgba(" + e.red + "," + e.green + "," + e.blue + "," + e.alpha + ")";
595
+ throw new o.default(7);
596
+ };
597
+ var r = n(le), l = n(Se), o = n(x);
598
+ function n(e) {
599
+ return e && e.__esModule ? e : { default: e };
600
+ }
601
+ a.exports = t.default;
602
+ })(te, te.exports);
603
+ var Ge = te.exports;
604
+ (function(a, t) {
605
+ t.__esModule = !0, t.default = function(f) {
606
+ if (typeof f != "object") throw new e.default(8);
607
+ if (i(f)) return (0, n.default)(f);
608
+ if (s(f)) return (0, o.default)(f);
609
+ if (c(f)) return (0, l.default)(f);
610
+ if (u(f)) return (0, r.default)(f);
611
+ throw new e.default(8);
612
+ };
613
+ var r = d(De), l = d(Ye), o = d(Se), n = d(Ge), e = d(x);
614
+ function d(f) {
615
+ return f && f.__esModule ? f : { default: f };
616
+ }
617
+ var s = function(f) {
618
+ return typeof f.red == "number" && typeof f.green == "number" && typeof f.blue == "number" && (typeof f.alpha != "number" || f.alpha === void 0);
619
+ }, i = function(f) {
620
+ return typeof f.red == "number" && typeof f.green == "number" && typeof f.blue == "number" && typeof f.alpha == "number";
621
+ }, u = function(f) {
622
+ return typeof f.hue == "number" && typeof f.saturation == "number" && typeof f.lightness == "number" && (typeof f.alpha != "number" || f.alpha === void 0);
623
+ }, c = function(f) {
624
+ return typeof f.hue == "number" && typeof f.saturation == "number" && typeof f.lightness == "number" && typeof f.alpha == "number";
625
+ };
626
+ a.exports = t.default;
627
+ })(J, J.exports);
628
+ var Ce = J.exports;
629
+ (function(a, t) {
630
+ t.__esModule = !0, t.default = void 0;
631
+ var r = e(ve), l = e(ye), o = e(we), n = e(Ce);
632
+ function e(i) {
633
+ return i && i.__esModule ? i : { default: i };
634
+ }
635
+ function d() {
636
+ return d = Object.assign ? Object.assign.bind() : function(i) {
637
+ for (var u = 1; u < arguments.length; u++) {
638
+ var c = arguments[u];
639
+ for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (i[f] = c[f]);
640
+ }
641
+ return i;
642
+ }, d.apply(this, arguments);
643
+ }
644
+ var s = (0, r.default)(function(i, u) {
645
+ if (u === "transparent") return u;
646
+ var c = (0, o.default)(u);
647
+ return (0, n.default)(d({}, c, { lightness: (0, l.default)(0, 1, c.lightness - parseFloat(i)) }));
648
+ });
649
+ t.default = s, a.exports = t.default;
650
+ })(W, W.exports);
651
+ const Je = se(W.exports);
652
+ var ne = { exports: {} };
653
+ (function(a, t) {
654
+ t.__esModule = !0, t.default = void 0;
655
+ var r = e(ve), l = e(ye), o = e(we), n = e(Ce);
656
+ function e(i) {
657
+ return i && i.__esModule ? i : { default: i };
658
+ }
659
+ function d() {
660
+ return d = Object.assign ? Object.assign.bind() : function(i) {
661
+ for (var u = 1; u < arguments.length; u++) {
662
+ var c = arguments[u];
663
+ for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (i[f] = c[f]);
664
+ }
665
+ return i;
666
+ }, d.apply(this, arguments);
667
+ }
668
+ var s = (0, r.default)(function(i, u) {
669
+ if (u === "transparent") return u;
670
+ var c = (0, o.default)(u);
671
+ return (0, n.default)(d({}, c, { lightness: (0, l.default)(0, 1, c.lightness + parseFloat(i)) }));
672
+ });
673
+ t.default = s, a.exports = t.default;
674
+ })(ne, ne.exports);
675
+ const Ze = se(ne.exports), me = /* @__PURE__ */ new Set(), k = "bf-iframe-container", re = "bf-trigger-button";
676
+ function Ve(a) {
677
+ if (!document.querySelector("style[data-widget-styles]")) {
678
+ var t, r;
679
+ (function() {
680
+ let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "#000", o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "FFF";
681
+ const n = document.createElement("style");
682
+ n.attributes.setNamedItem(document.createAttribute("data-widget-styles"));
683
+ const e = We(l) > 0.5;
684
+ n.textContent = `
685
+ .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}.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: 768px){.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))}}
686
+ .${re} { background: ${l}; }
687
+ .${re}:hover {
688
+ background: ${e ? Je(0.05, l) : Ze(0.05, l)};
689
+ }
690
+ .trigger-button-icon { color: ${o}; }
691
+ `, document.head.appendChild(n);
692
+ })((a == null || (t = a.theme) === null || t === void 0 ? void 0 : t.inputButtonBgColor) || "#007bff", (a == null || (r = a.theme) === null || r === void 0 ? void 0 : r.textBaseColor) || "#ffffff");
693
+ }
694
+ }
695
+ function Ue(a) {
696
+ const t = P("button", re, { id: `trigger-button-${a}`, "aria-controls": k, "aria-expanded": "false" }), r = P("div", "trigger-button-icon", { "aria-hidden": "true" });
697
+ return r.innerHTML = `
698
+ <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" viewBox="0 0 256 256" class="close-icon">
699
+ <path class="icon-path" d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
700
+ </svg>
701
+ <svg width="24" height="14" viewBox="0 0 24 14" fill="none" xmlns="http://www.w3.org/2000/svg" class="fish-icon visible">
702
+ <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"/>
703
+ </svg>
704
+ `, t.setAttribute("aria-label", "Open Brainfish widget"), t.appendChild(r), function(l, o) {
705
+ let n = !1;
706
+ const e = o.querySelector(".fish-icon"), d = o.querySelector(".close-icon");
707
+ l.addEventListener("click", () => {
708
+ n = !n;
709
+ const s = document.querySelector(`.${k}`), i = s == null ? void 0 : s.querySelector("iframe");
710
+ var u;
711
+ n ? (s == null || s.classList.add("open"), s == null || s.setAttribute("aria-hidden", "false"), l.setAttribute("aria-expanded", "true"), e.classList.remove("visible"), d.classList.add("visible"), i == null || (u = i.contentWindow) === null || u === void 0 || u.postMessage({ type: "FOCUS_SEARCH_FIELD" }, "*")) : (s == null || s.classList.remove("open"), s == null || s.setAttribute("aria-hidden", "true"), l.setAttribute("aria-expanded", "false"), d.classList.remove("visible"), e.classList.add("visible"));
712
+ });
713
+ }(t, r), t;
714
+ }
715
+ function Qe(a, t) {
716
+ const r = document.createDocumentFragment(), l = Ue(a), o = function(n) {
717
+ const e = P("div", k, { id: k, "aria-live": "polite", "aria-hidden": "true" }), d = P("iframe", "trigger-iframe", { src: n, sandbox: "allow-scripts allow-same-origin allow-popups", role: "dialog" });
718
+ return e.appendChild(d), e;
719
+ }(t);
720
+ return r.appendChild(l), r.appendChild(o), r;
721
+ }
722
+ function Xe(a) {
723
+ const t = new AbortController(), { signal: r } = t;
724
+ return window.addEventListener("message", (l) => {
725
+ if (l.origin !== a) return;
726
+ const { type: o } = l.data;
727
+ if (o === "TOGGLE_WIDGET_SIZE" && function() {
728
+ const n = document.querySelector(`.${k}`);
729
+ n.classList.contains("expanded") ? n.classList.remove("expanded") : n.classList.add("expanded");
730
+ }(), o === "TRACK_EVENT") {
731
+ if (!window.BrainfishAnalytics) return;
732
+ const { eventName: n, data: e } = l.data;
733
+ window.BrainfishAnalytics("track", n, e);
734
+ }
735
+ }, { signal: r }), t;
736
+ }
737
+ const et = (a, t) => {
738
+ const r = oe(a.overrides), l = ((o = a.overrides) == null ? void 0 : o.widgetHost) || void 0;
739
+ var o;
740
+ const n = `${l}/?widgetKey=${a.widgetKey}`;
741
+ try {
742
+ if (e = a.widgetKey, me.has(e) || function(u) {
743
+ return !!document.getElementById(`trigger-button-${u}`);
744
+ }(a.widgetKey)) return;
745
+ Ve(t);
746
+ const d = Qe(a.widgetKey, n);
747
+ document.body.appendChild(d);
748
+ const s = Xe(l);
749
+ me.add(a.widgetKey);
750
+ const i = () => {
751
+ s.abort(), window.removeEventListener("beforeunload", i);
752
+ };
753
+ return void window.addEventListener("beforeunload", i);
754
+ } catch (d) {
755
+ (function(s, i, u) {
756
+ w(s, i, i.message, u);
757
+ })(r, d, a.widgetKey);
758
+ }
759
+ var e;
760
+ };
761
+ let I = null;
762
+ const be = typeof window != "undefined" && window.Brainfish ? window.Brainfish : (I || (I = /* @__PURE__ */ function() {
763
+ let a = [], t = null;
764
+ function r(o, n) {
765
+ if (t) {
766
+ const e = o.split(".");
767
+ let d = t;
768
+ for (let i = 0; i < e.length - 1; i++) d = d[e[i]];
769
+ const s = d[e[e.length - 1]];
770
+ if (typeof s == "function") return s.apply(d, n);
771
+ } else a.push([o, n]);
165
772
  }
166
773
  return { Widgets: { init: function() {
167
- for (var i = arguments.length, s = new Array(i), e = 0; e < i; e++) s[e] = arguments[e];
168
- return r("Widgets.init", s);
774
+ for (var o = arguments.length, n = new Array(o), e = 0; e < o; e++) n[e] = arguments[e];
775
+ return r("Widgets.init", n);
169
776
  } }, SearchWidget: { initStandard: function() {
170
- for (var i = arguments.length, s = new Array(i), e = 0; e < i; e++) s[e] = arguments[e];
171
- return r("SearchWidget.initStandard", s);
777
+ for (var o = arguments.length, n = new Array(o), e = 0; e < o; e++) n[e] = arguments[e];
778
+ return r("SearchWidget.initStandard", n);
172
779
  } }, HelpWidget: { initPopup: function() {
173
- for (var i = arguments.length, s = new Array(i), e = 0; e < i; e++) s[e] = arguments[e];
174
- return r("HelpWidget.initPopup", s);
780
+ for (var o = arguments.length, n = new Array(o), e = 0; e < o; e++) n[e] = arguments[e];
781
+ return r("HelpWidget.initPopup", n);
175
782
  }, close: function() {
176
- for (var i = arguments.length, s = new Array(i), e = 0; e < i; e++) s[e] = arguments[e];
177
- return r("HelpWidget.close", s);
783
+ for (var o = arguments.length, n = new Array(o), e = 0; e < o; e++) n[e] = arguments[e];
784
+ return r("HelpWidget.close", n);
178
785
  }, open: function() {
179
- for (var i = arguments.length, s = new Array(i), e = 0; e < i; e++) s[e] = arguments[e];
180
- return r("HelpWidget.open", s);
786
+ for (var o = arguments.length, n = new Array(o), e = 0; e < o; e++) n[e] = arguments[e];
787
+ return r("HelpWidget.open", n);
181
788
  }, toggle: function() {
182
- for (var i = arguments.length, s = new Array(i), e = 0; e < i; e++) s[e] = arguments[e];
183
- return r("HelpWidget.toggle", s);
184
- } }, _setRealBrainfish: function(i) {
185
- for (n = i; t.length > 0; ) {
186
- const [s, e] = t.shift();
187
- r(s, e);
789
+ for (var o = arguments.length, n = new Array(o), e = 0; e < o; e++) n[e] = arguments[e];
790
+ return r("HelpWidget.toggle", n);
791
+ } }, _setRealBrainfish: function(o) {
792
+ for (t = o; a.length > 0; ) {
793
+ const [n, e] = a.shift();
794
+ r(n, e);
188
795
  }
189
796
  } };
190
- }(), typeof window != "undefined" && (window.Brainfish = y)), y);
191
- let E = null;
192
- T.Widgets.init = (t) => g(void 0, null, function* () {
797
+ }(), typeof window != "undefined" && (window.Brainfish = I)), I);
798
+ let $ = null;
799
+ be.Widgets.init = (a) => b(void 0, null, function* () {
193
800
  window && (window.BrainfishAnalytics = window.BrainfishAnalytics || function() {
194
- for (var s = arguments.length, e = new Array(s), a = 0; a < s; a++) e[a] = arguments[a];
801
+ for (var n = arguments.length, e = new Array(n), d = 0; d < n; d++) e[d] = arguments[d];
195
802
  (window.BrainfishAnalytics.q = window.BrainfishAnalytics.q || []).push(e);
196
803
  });
197
- const n = $(t.overrides), r = ((o = t.overrides) == null ? void 0 : o.analyticsApiHost) || void 0;
198
- var o;
199
- const { config: i } = yield L({ widgetKey: t.widgetKey, apiHost: n });
200
- E || (E = function(s, e, a, d) {
201
- return g(this, null, function* () {
202
- var u, c, l;
203
- const f = ((u = s.overrides) === null || u === void 0 ? void 0 : u.enableRecording) || (e == null || (c = e.settings) === null || c === void 0 ? void 0 : c.enableRecording) || !1, p = [F(s, e)];
204
- e != null && (l = e.settings) !== null && l !== void 0 && l.enableTracking && p.push(J(s.widgetKey, e.trackingToken || "", a, d, f));
804
+ const t = oe(a.overrides), r = ((l = a.overrides) == null ? void 0 : l.analyticsApiHost) || void 0;
805
+ var l;
806
+ const { config: o } = yield Te({ widgetKey: a.widgetKey, apiHost: t });
807
+ $ || ($ = function(n, e, d, s) {
808
+ return b(this, null, function* () {
809
+ var i, u, c, f;
810
+ const h = ((i = n.overrides) === null || i === void 0 ? void 0 : i.enableRecording) || (e == null || (u = e.settings) === null || u === void 0 ? void 0 : u.enableRecording) || !1, g = ((c = n.overrides) === null || c === void 0 ? void 0 : c.version) || (e == null ? void 0 : e.version), p = [];
811
+ g != null && g.startsWith("2.") ? et(n, e) : p.push(qe(n, e)), e != null && (f = e.settings) !== null && f !== void 0 && f.enableTracking && p.push(ze(n.widgetKey, e.trackingToken || "", d, s, h));
205
812
  const [m] = yield Promise.allSettled(p);
206
- m.status === "fulfilled" && m.value && T._setRealBrainfish(m.value);
813
+ m && m.status === "fulfilled" && m.value && be._setRealBrainfish(m.value);
207
814
  });
208
- }(t, i, n, r)), yield E;
815
+ }(a, o, t, r)), yield $;
209
816
  });
210
- const x = function() {
817
+ const nt = function() {
211
818
  typeof window != "undefined" && window.BrainfishAnalytics && window.BrainfishAnalytics(...arguments);
212
819
  };
213
820
  export {
214
- x as BrainfishAnalytics,
215
- T as default
821
+ nt as BrainfishAnalytics,
822
+ be as default
216
823
  };
217
824
  //# sourceMappingURL=web.js.map