@leadbot/components 2.21.1 → 2.24.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.
Files changed (56) hide show
  1. package/README.md +49 -3
  2. package/dist/agentChat-0mQZrzM9.js +366 -0
  3. package/dist/agentChat-C1wUvNcg.cjs +1 -0
  4. package/dist/agentChat.d.ts +2 -0
  5. package/dist/agentChat.d.ts.map +1 -1
  6. package/dist/buttons-ecViBEJ9.js +85 -0
  7. package/dist/buttons-rml8Kh8z.cjs +1 -0
  8. package/dist/buttons.cjs +1 -0
  9. package/dist/buttons.js +3 -0
  10. package/dist/chat.cjs +1 -0
  11. package/dist/chat.js +3 -0
  12. package/dist/entries/_shared.d.ts +5 -0
  13. package/dist/entries/_shared.d.ts.map +1 -0
  14. package/dist/entries/buttons.d.ts +3 -0
  15. package/dist/entries/buttons.d.ts.map +1 -0
  16. package/dist/entries/chat.d.ts +3 -0
  17. package/dist/entries/chat.d.ts.map +1 -0
  18. package/dist/entries/flow.d.ts +3 -0
  19. package/dist/entries/flow.d.ts.map +1 -0
  20. package/dist/entries/form.d.ts +3 -0
  21. package/dist/entries/form.d.ts.map +1 -0
  22. package/dist/entries/whatsapp.d.ts +3 -0
  23. package/dist/entries/whatsapp.d.ts.map +1 -0
  24. package/dist/flow-BY5oslmc.js +5006 -0
  25. package/dist/flow-CNUyZA89.cjs +82 -0
  26. package/dist/flow.cjs +1 -0
  27. package/dist/flow.d.ts.map +1 -1
  28. package/dist/flow.js +3 -0
  29. package/dist/form-Dc8AaZBV.cjs +1 -0
  30. package/dist/form-Df53ALbk.js +290 -0
  31. package/dist/form.cjs +1 -0
  32. package/dist/form.d.ts +1 -0
  33. package/dist/form.d.ts.map +1 -1
  34. package/dist/form.js +3 -0
  35. package/dist/i18n-DyDsn-Fk.js +93 -0
  36. package/dist/i18n-gV6rxSod.cjs +1 -0
  37. package/dist/i18n.d.ts +25 -0
  38. package/dist/i18n.d.ts.map +1 -0
  39. package/dist/index.cjs +1 -0
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +9 -6779
  43. package/dist/jsxRuntime.module-CT7yzySL.cjs +1 -0
  44. package/dist/jsxRuntime.module-DsRxbn3o.js +657 -0
  45. package/dist/mount.d.ts +38 -2
  46. package/dist/mount.d.ts.map +1 -1
  47. package/dist/styles.css +79 -1
  48. package/dist/useStep.d.ts +47 -1
  49. package/dist/useStep.d.ts.map +1 -1
  50. package/dist/whatsapp-B3GO1RDT.cjs +1 -0
  51. package/dist/whatsapp-DGnyaume.js +128 -0
  52. package/dist/whatsapp.cjs +1 -0
  53. package/dist/whatsapp.d.ts +1 -0
  54. package/dist/whatsapp.d.ts.map +1 -1
  55. package/dist/whatsapp.js +3 -0
  56. package/package.json +39 -11
@@ -0,0 +1,657 @@
1
+ import { applyFlowGates as e, buildAnalytics as t, createClient as n, fetchComponentsFlow as r, getVariableValue as i, initTracking as a, isFlowForbidden as o, onUrlChange as s, resetGoogleAnalyticsTracker as c, resolveApiBase as l } from "@leadbot/core";
2
+ //#region ../../node_modules/.pnpm/preact@10.29.8_preact-render-to-string@6.7.0/node_modules/preact/dist/preact.module.js
3
+ var u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T = {}, E = [], D = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, O = Array.isArray;
4
+ function k(e, t) {
5
+ for (var n in t) e[n] = t[n];
6
+ return e;
7
+ }
8
+ function ee(e) {
9
+ e && e.parentNode && e.parentNode.removeChild(e);
10
+ }
11
+ function A(e, t, n) {
12
+ var r, i, a, o = {};
13
+ for (a in t) a == "key" ? r = t[a] : a == "ref" ? i = t[a] : o[a] = t[a];
14
+ if (arguments.length > 2 && (o.children = arguments.length > 3 ? u.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (a in e.defaultProps) o[a] === void 0 && (o[a] = e.defaultProps[a]);
15
+ return j(e, o, r, i, null);
16
+ }
17
+ function j(e, t, n, r, i) {
18
+ var a = {
19
+ type: e,
20
+ props: t,
21
+ key: n,
22
+ ref: r,
23
+ __k: null,
24
+ __: null,
25
+ __b: 0,
26
+ __e: null,
27
+ __c: null,
28
+ constructor: void 0,
29
+ __v: i ?? ++f,
30
+ __i: -1,
31
+ __u: 0
32
+ };
33
+ return i == null && d.vnode != null && d.vnode(a), a;
34
+ }
35
+ function M(e) {
36
+ return e.children;
37
+ }
38
+ function N(e, t) {
39
+ this.props = e, this.context = t;
40
+ }
41
+ function P(e, t) {
42
+ if (t == null) return e.__ ? P(e.__, e.__i + 1) : null;
43
+ for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
44
+ return typeof e.type == "function" ? P(e) : null;
45
+ }
46
+ function te(e) {
47
+ if (e.__P && e.__d) {
48
+ var t = e.__v, n = t.__e, r = [], i = [], a = k({}, t);
49
+ a.__v = t.__v + 1, d.vnode && d.vnode(a), R(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? P(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, de(r, a, i), t.__e = t.__ = null, a.__e != n && ne(a);
50
+ }
51
+ }
52
+ function ne(e) {
53
+ if ((e = e.__) != null && e.__c != null) return e.__e = e.__c.base = null, e.__k.some(function(t) {
54
+ if (t != null && t.__e != null) return e.__e = e.__c.base = t.__e;
55
+ }), ne(e);
56
+ }
57
+ function F(e) {
58
+ (!e.__d && (e.__d = !0) && p.push(e) && !I.__r++ || m != d.debounceRendering) && ((m = d.debounceRendering) || h)(I);
59
+ }
60
+ function I() {
61
+ try {
62
+ for (var e, t = 1; p.length;) p.length > t && p.sort(g), e = p.shift(), t = p.length, te(e);
63
+ } finally {
64
+ p.length = I.__r = 0;
65
+ }
66
+ }
67
+ function re(e, t, n, r, i, a, o, s, c, l, u) {
68
+ var d, f, p, m, h, g, _ = r && r.__k || E, v = t.length;
69
+ for (c = ie(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || T, p.__i = d, g = R(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && z(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = ae(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
70
+ return n.__e = h, c;
71
+ }
72
+ function ie(e, t, n, r, i) {
73
+ var a, o, s, c, l, u = n.length, d = u, f = 0;
74
+ for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = j(null, o, null, null, null) : O(o) ? o = e.__k[a] = j(M, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = j(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = se(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
75
+ if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = P(s)), me(s, s));
76
+ return r;
77
+ }
78
+ function ae(e, t, n) {
79
+ var r, i;
80
+ if (typeof e.type == "function") {
81
+ for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = ae(r[i], t, n));
82
+ return t;
83
+ }
84
+ e.__e != t && (t && e.type && !t.parentNode && (t = P(e)), t = n.insertBefore(e.__e, t || null));
85
+ do
86
+ t &&= t.nextSibling;
87
+ while (t != null && t.nodeType == 8);
88
+ return t;
89
+ }
90
+ function oe(e, t) {
91
+ return t ||= [], e == null || typeof e == "boolean" || (O(e) ? e.some(function(e) {
92
+ oe(e, t);
93
+ }) : t.push(e)), t;
94
+ }
95
+ function se(e, t, n, r) {
96
+ var i, a, o, s = e.key, c = e.type, l = t[n], u = l != null && !(2 & l.__u);
97
+ if (l === null && s == null || u && s == l.key && c == l.type) return n;
98
+ if (r > +!!u) {
99
+ for (i = n - 1, a = n + 1; i >= 0 || a < t.length;) if ((l = t[o = i >= 0 ? i-- : a++]) != null && !(2 & l.__u) && s == l.key && c == l.type) return o;
100
+ }
101
+ return -1;
102
+ }
103
+ function ce(e, t, n) {
104
+ t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || D.test(t) ? n : n + "px";
105
+ }
106
+ function L(e, t, n, r, i) {
107
+ var a, o;
108
+ n: if (t == "style") {
109
+ if (typeof n == "string") e.style.cssText = n;
110
+ else {
111
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || ce(e.style, t, "");
112
+ if (n) for (t in n) r && n[t] == r[t] || ce(e.style, t, n[t]);
113
+ }
114
+ } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(b, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[y] = r[y] : (n[y] = x, e.addEventListener(t, a ? C : S, a)) : e.removeEventListener(t, a ? C : S, a);
115
+ else {
116
+ if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
117
+ else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {
118
+ e[t] = n ?? "";
119
+ break n;
120
+ } catch {}
121
+ typeof n == "function" || (n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
122
+ }
123
+ }
124
+ function le(e) {
125
+ return function(t) {
126
+ if (this.l) {
127
+ var n = this.l[t.type + e];
128
+ if (t[v] == null) t[v] = x++;
129
+ else if (t[v] < n[y]) return;
130
+ return n(d.event ? d.event(t) : t);
131
+ }
132
+ };
133
+ }
134
+ function R(e, t, n, r, i, a, o, s, c, l) {
135
+ var u, f, p, m, h, g, _, v, y, b, x, S, C, w, T, D, A = t.type;
136
+ if (t.constructor !== void 0) return null;
137
+ 128 & n.__u && (c = !!(32 & n.__u), a = [s = t.__e = n.__e]), (u = d.__b) && u(t);
138
+ n: if (typeof A == "function") {
139
+ f = o.length;
140
+ try {
141
+ if (y = t.props, b = A.prototype && A.prototype.render, x = (u = A.contextType) && r[u.__c], S = u ? x ? x.props.value : u.__ : r, n.__c ? v = (p = t.__c = n.__c).__ = p.__E : (b ? t.__c = p = new A(y, S) : (t.__c = p = new N(y, S), p.constructor = A, p.render = he), x && x.sub(p), p.state || (p.state = {}), p.__n = r, m = p.__d = !0, p.__h = [], p._sb = []), b && p.__s == null && (p.__s = p.state), b && A.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = k({}, p.__s)), k(p.__s, A.getDerivedStateFromProps(y, p.__s))), h = p.props, g = p.state, p.__v = t, m) b && A.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), b && p.componentDidMount != null && p.__h.push(p.componentDidMount);
142
+ else {
143
+ if (b && A.getDerivedStateFromProps == null && y !== h && p.componentWillReceiveProps != null && p.componentWillReceiveProps(y, S), t.__v == n.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(y, p.__s, S)) {
144
+ t.__v != n.__v && (p.props = y, p.state = p.__s, p.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
145
+ e && (e.__ = t);
146
+ }), E.push.apply(p.__h, p._sb), p._sb = [], p.__h.length && o.push(p), s = P(n);
147
+ break n;
148
+ }
149
+ p.componentWillUpdate != null && p.componentWillUpdate(y, p.__s, S), b && p.componentDidUpdate != null && p.__h.push(function() {
150
+ p.componentDidUpdate(h, g, _);
151
+ });
152
+ }
153
+ if (p.context = S, p.props = y, p.__P = e, p.__e = !1, C = d.__r, w = 0, b) p.state = p.__s, p.__d = !1, C && C(t), u = p.render(p.props, p.state, p.context), E.push.apply(p.__h, p._sb), p._sb = [];
154
+ else do
155
+ p.__d = !1, C && C(t), u = p.render(p.props, p.state, p.context), p.state = p.__s;
156
+ while (p.__d && ++w < 25);
157
+ p.state = p.__s, p.getChildContext != null && (r = k(k({}, r), p.getChildContext())), b && !m && p.getSnapshotBeforeUpdate != null && (_ = p.getSnapshotBeforeUpdate(h, g)), T = u != null && u.type === M && u.key == null ? fe(u.props.children) : u, s = re(e, O(T) ? T : [T], t, n, r, i, a, o, s, c, l), p.base = t.__e, t.__u &= -161, p.__h.length && o.push(p), v && (p.__E = p.__ = null);
158
+ } catch (e) {
159
+ if (o.length = f, t.__v = null, c || a != null) {
160
+ if (e.then) {
161
+ for (t.__u |= c ? 160 : 128; s && s.nodeType == 8 && s.nextSibling;) s = s.nextSibling;
162
+ a != null && (a[a.indexOf(s)] = null), t.__e = s;
163
+ } else if (a != null) for (D = a.length; D--;) ee(a[D]);
164
+ } else t.__e = n.__e;
165
+ t.__k ??= n.__k || [], e.then || ue(t), d.__e(e, t, n);
166
+ }
167
+ } else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = pe(n.__e, t, n, r, i, a, o, c, l);
168
+ return (u = d.diffed) && u(t), 128 & t.__u ? void 0 : s;
169
+ }
170
+ function ue(e) {
171
+ e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(ue));
172
+ }
173
+ function de(e, t, n) {
174
+ for (var r = 0; r < n.length; r++) z(n[r], n[++r], n[++r]);
175
+ d.__c && d.__c(t, e), e.some(function(t) {
176
+ try {
177
+ e = t.__h, t.__h = [], e.some(function(e) {
178
+ e.call(t);
179
+ });
180
+ } catch (e) {
181
+ d.__e(e, t.__v);
182
+ }
183
+ });
184
+ }
185
+ function fe(e) {
186
+ return typeof e != "object" || !e || e.__b > 0 ? e : O(e) ? e.map(fe) : e.constructor === void 0 ? k({}, e) : null;
187
+ }
188
+ function pe(e, t, n, r, i, a, o, s, c) {
189
+ var l, f, p, m, h, g, _, v = n.props || T, y = t.props, b = t.type;
190
+ if (b == "svg" ? i = "http://www.w3.org/2000/svg" : b == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i ||= "http://www.w3.org/1999/xhtml", a != null) {
191
+ for (l = 0; l < a.length; l++) if ((h = a[l]) && "setAttribute" in h == !!b && (b ? h.localName == b : h.nodeType == 3)) {
192
+ e = h, a[l] = null;
193
+ break;
194
+ }
195
+ }
196
+ if (e == null) {
197
+ if (b == null) return document.createTextNode(y);
198
+ e = document.createElementNS(i, b, y.is && y), s &&= (d.__m && d.__m(t, a), !1), a = null;
199
+ }
200
+ if (b == null) v === y || s && e.data == y || (e.data = y);
201
+ else {
202
+ if (a = b == "textarea" && y.defaultValue != null ? null : a && u.call(e.childNodes), !s && a != null) for (v = {}, l = 0; l < e.attributes.length; l++) v[(h = e.attributes[l]).name] = h.value;
203
+ for (l in v) h = v[l], l == "dangerouslySetInnerHTML" ? p = h : l == "children" || l in y || l == "value" && "defaultValue" in y || l == "checked" && "defaultChecked" in y || L(e, l, null, h, i);
204
+ for (l in y) h = y[l], l == "children" ? m = h : l == "dangerouslySetInnerHTML" ? f = h : l == "value" ? g = h : l == "checked" ? _ = h : s && typeof h != "function" || v[l] === h || L(e, l, h, v[l], i);
205
+ if (f) s || p && (f.__html == p.__html || f.__html == e.innerHTML) || (e.innerHTML = f.__html), t.__k = [];
206
+ else if (p && (e.innerHTML = ""), re(t.type == "template" ? e.content : e, O(m) ? m : [m], t, n, r, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && P(n, 0), s, c), a != null) for (l = a.length; l--;) ee(a[l]);
207
+ s && b != "textarea" || (l = "value", b == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[l] || b == "progress" && !g || b == "option" && g != v[l]) && L(e, l, g, v[l], i), l = "checked", _ != null && _ != e[l] && L(e, l, _, v[l], i));
208
+ }
209
+ return e;
210
+ }
211
+ function z(e, t, n) {
212
+ try {
213
+ if (typeof e == "function") {
214
+ var r = typeof e.__u == "function";
215
+ r && e.__u(), r && t == null || (e.__u = e(t));
216
+ } else e.current = t;
217
+ } catch (e) {
218
+ d.__e(e, n);
219
+ }
220
+ }
221
+ function me(e, t, n) {
222
+ var r, i;
223
+ if (d.unmount && d.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || z(r, null, t)), (r = e.__c) != null) {
224
+ if (r.componentWillUnmount) try {
225
+ r.componentWillUnmount();
226
+ } catch (e) {
227
+ d.__e(e, t);
228
+ }
229
+ r.base = r.__P = r.__n = null;
230
+ }
231
+ if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && me(r[i], t, n || typeof e.type != "function");
232
+ n || ee(e.__e), e.__c = e.__ = e.__e = void 0;
233
+ }
234
+ function he(e, t, n) {
235
+ return this.constructor(e, n);
236
+ }
237
+ function B(e, t, n) {
238
+ var r, i, a, o;
239
+ t == document && (t = document.documentElement), d.__ && d.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], R(t, e = (!r && n || t).__k = A(M, null, [e]), i || T, T, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? u.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), de(a, e, o), e.props.children = null;
240
+ }
241
+ function ge(e) {
242
+ function t(e) {
243
+ var n, r;
244
+ return this.getChildContext || (n = /* @__PURE__ */ new Set(), (r = {})[t.__c] = this, this.getChildContext = function() {
245
+ return r;
246
+ }, this.componentWillUnmount = function() {
247
+ n = null;
248
+ }, this.shouldComponentUpdate = function(e) {
249
+ this.props.value != e.value && n.forEach(function(e) {
250
+ e.__e = !0, F(e);
251
+ });
252
+ }, this.sub = function(e) {
253
+ n.add(e);
254
+ var t = e.componentWillUnmount;
255
+ e.componentWillUnmount = function() {
256
+ n && n.delete(e), t && t.call(e);
257
+ };
258
+ }), e.children;
259
+ }
260
+ return t.__c = "__cC" + w++, t.__ = e, t.Provider = t.__l = (t.Consumer = function(e, t) {
261
+ return e.children(t);
262
+ }).contextType = t, t;
263
+ }
264
+ u = E.slice, d = { __e: function(e, t, n, r) {
265
+ for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {
266
+ if ((a = i.constructor) && a.getDerivedStateFromError != null && (i.setState(a.getDerivedStateFromError(e)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(e, r || {}), o = i.__d), o) return i.__E = i;
267
+ } catch (t) {
268
+ e = t;
269
+ }
270
+ throw e;
271
+ } }, f = 0, N.prototype.setState = function(e, t) {
272
+ var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = k({}, this.state);
273
+ typeof e == "function" && (e = e(k({}, n), this.props)), e && k(n, e), e != null && this.__v && (t && this._sb.push(t), F(this));
274
+ }, N.prototype.forceUpdate = function(e) {
275
+ this.__v && (this.__e = !0, e && this.__h.push(e), F(this));
276
+ }, N.prototype.render = M, p = [], h = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, g = function(e, t) {
277
+ return e.__v.__b - t.__v.__b;
278
+ }, I.__r = 0, _ = Math.random().toString(8), v = "__d" + _, y = "__a" + _, b = /(PointerCapture)$|Capture$/i, x = 0, S = le(!1), C = le(!0), w = 0;
279
+ //#endregion
280
+ //#region src/mount.ts
281
+ var V = "https://collector.leadbot.com", H = { apiHost: V }, U = 0;
282
+ function _e(e) {
283
+ H = {
284
+ ...e,
285
+ apiHost: e.apiHost ?? V
286
+ };
287
+ let t = ++U;
288
+ Ce(), c(), ve?.(), ve = void 0, e.domainKey && (a({
289
+ domainKey: e.domainKey,
290
+ apiBase: l({ apiHost: e.apiHost ?? V }),
291
+ previewToken: Ae(e).previewToken
292
+ }), e.leadbotId && (Oe(e, t), ve = s(() => {
293
+ Oe(e, ++U);
294
+ })));
295
+ }
296
+ var ve, W = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Set(), ye = {};
297
+ function be(e) {
298
+ return e == null ? "" : String(e);
299
+ }
300
+ var K = /* @__PURE__ */ new Map();
301
+ function xe(e) {
302
+ return W.get(be(e)) ?? ye;
303
+ }
304
+ function Se(e) {
305
+ return G.add(e), () => {
306
+ G.delete(e);
307
+ };
308
+ }
309
+ function Ce() {
310
+ if (W.size !== 0) {
311
+ W.clear(), K.clear();
312
+ for (let e of G) e();
313
+ }
314
+ }
315
+ function we(e, t) {
316
+ let n = xe(e);
317
+ if (t.language !== n.language || t.baseColor !== n.baseColor) {
318
+ W.set(be(e), t);
319
+ for (let e of G) e();
320
+ }
321
+ }
322
+ function q(e) {
323
+ let t = { ...H };
324
+ for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
325
+ return t;
326
+ }
327
+ function Te(e) {
328
+ return n({
329
+ domainKey: e.domainKey ?? H.domainKey,
330
+ apiHost: e.apiHost ?? H.apiHost
331
+ });
332
+ }
333
+ function Ee(e) {
334
+ return e.domainKey ? {
335
+ apiBase: l({ apiHost: e.apiHost }),
336
+ domainKey: e.domainKey,
337
+ leadbotId: e.leadbotId,
338
+ path: e.path,
339
+ language: e.language,
340
+ previewToken: Ae(e).previewToken,
341
+ applyGates: !1
342
+ } : null;
343
+ }
344
+ function De(e) {
345
+ let t = Ee(q(e));
346
+ return t ? o(t) : !1;
347
+ }
348
+ function Oe(t, n) {
349
+ c();
350
+ let i = q(t), a = Ee(i);
351
+ if (!a) return Promise.resolve(null);
352
+ let o = be(i.leadbotId), s = (K.get(o) ?? 0) + 1;
353
+ return K.set(o, s), r(a).then((t) => t && (n === U && e(t), K.get(o) === s && we(i.leadbotId, {
354
+ language: t.leadbot?.language ?? void 0,
355
+ baseColor: t.styling?.base_color || void 0
356
+ }), t));
357
+ }
358
+ function ke(e) {
359
+ return Oe(e, ++U);
360
+ }
361
+ function Ae(e) {
362
+ let t = e.preview ?? H.preview;
363
+ return {
364
+ preview: t,
365
+ previewToken: t ? e.previewToken ?? H.previewToken : void 0
366
+ };
367
+ }
368
+ var je = "leadbot-components", Me = "leadbot-bare";
369
+ function Ne(e) {
370
+ return (e ?? "").split(/\s+/).filter(Boolean);
371
+ }
372
+ function Pe(e, t, n) {
373
+ let r = n, i = [], a = () => {
374
+ let n = Ne(r.className);
375
+ r.chrome === !1 && n.push(Me), t.classList.remove(...i), t.classList.add(je, ...n), i = n;
376
+ let a = r.baseColor ?? H.baseColor ?? xe(r.leadbotId ?? H.leadbotId).baseColor;
377
+ a ? t.style.setProperty("--leadbot-primary", a) : t.style.removeProperty("--leadbot-primary"), B(A(e, r), t);
378
+ };
379
+ a();
380
+ let o = Se(a);
381
+ return {
382
+ update(e) {
383
+ r = {
384
+ ...r,
385
+ ...e
386
+ }, a();
387
+ },
388
+ destroy() {
389
+ o(), B(null, t), t.classList.remove(je, ...i), t.style.removeProperty("--leadbot-primary");
390
+ }
391
+ };
392
+ }
393
+ //#endregion
394
+ //#region ../../node_modules/.pnpm/preact@10.29.8_preact-render-to-string@6.7.0/node_modules/preact/hooks/dist/hooks.module.js
395
+ var J, Y, Fe, Ie, X = 0, Le = [], Z = d, Re = Z.__b, ze = Z.__r, Be = Z.diffed, Ve = Z.__c, He = Z.unmount, Ue = Z.__;
396
+ function Q(e, t) {
397
+ Z.__h && Z.__h(Y, e, X || t), X = 0;
398
+ var n = Y.__H || (Y.__H = {
399
+ __: [],
400
+ __h: []
401
+ });
402
+ return e >= n.__.length && n.__.push({}), n.__[e];
403
+ }
404
+ function We(e) {
405
+ return X = 1, Ge(it, e);
406
+ }
407
+ function Ge(e, t, n) {
408
+ var r = Q(J++, 2);
409
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : it(void 0, t), function(e) {
410
+ var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
411
+ t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
412
+ }], r.__c = Y, !Y.__f)) {
413
+ var i = function(e, t, n) {
414
+ if (!r.__c.__H) return !0;
415
+ var i = !1, o = r.__c.props !== e;
416
+ if (r.__c.__H.__.some(function(e) {
417
+ if (e.__N) {
418
+ i = !0;
419
+ var t = e.__[0];
420
+ e.__ = e.__N, e.__N = void 0, t !== e.__[0] && (o = !0);
421
+ }
422
+ }), a) {
423
+ var s = a.call(this, e, t, n);
424
+ return i ? s || o : s;
425
+ }
426
+ return !i || o;
427
+ };
428
+ Y.__f = !0;
429
+ var a = Y.shouldComponentUpdate, o = Y.componentWillUpdate;
430
+ Y.componentWillUpdate = function(e, t, n) {
431
+ if (this.__e) {
432
+ var r = a;
433
+ a = void 0, i(e, t, n), a = r;
434
+ }
435
+ o && o.call(this, e, t, n);
436
+ }, Y.shouldComponentUpdate = i;
437
+ }
438
+ return r.__N || r.__;
439
+ }
440
+ function Ke(e, t) {
441
+ var n = Q(J++, 3);
442
+ !Z.__s && rt(n.__H, t) && (n.__ = e, n.u = t, Y.__H.__h.push(n));
443
+ }
444
+ function qe(e, t) {
445
+ var n = Q(J++, 4);
446
+ !Z.__s && rt(n.__H, t) && (n.__ = e, n.u = t, Y.__h.push(n));
447
+ }
448
+ function Je(e) {
449
+ return X = 5, Ye(function() {
450
+ return { current: e };
451
+ }, []);
452
+ }
453
+ function Ye(e, t) {
454
+ var n = Q(J++, 7);
455
+ return rt(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
456
+ }
457
+ function Xe(e, t) {
458
+ return X = 8, Ye(function() {
459
+ return e;
460
+ }, t);
461
+ }
462
+ function Ze(e) {
463
+ var t = Y.context[e.__c], n = Q(J++, 9);
464
+ return n.c = e, t ? (n.__ ?? (n.__ = !0, t.sub(Y)), t.props.value) : e.__;
465
+ }
466
+ function Qe() {
467
+ var e = Q(J++, 11);
468
+ if (!e.__) {
469
+ for (var t = Y.__v; t !== null && !t.__m && t.__ !== null;) t = t.__;
470
+ var n = t.__m || (t.__m = [0, 0]);
471
+ e.__ = "P" + n[0] + "-" + n[1]++;
472
+ }
473
+ return e.__;
474
+ }
475
+ function $e() {
476
+ for (var e; e = Le.shift();) {
477
+ var t = e.__H;
478
+ if (e.__P && t) try {
479
+ t.__h.some($), t.__h.some(nt), t.__h = [];
480
+ } catch (n) {
481
+ t.__h = [], Z.__e(n, e.__v);
482
+ }
483
+ }
484
+ }
485
+ Z.__b = function(e) {
486
+ Y = null, Re && Re(e);
487
+ }, Z.__ = function(e, t) {
488
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Ue && Ue(e, t);
489
+ }, Z.__r = function(e) {
490
+ ze && ze(e), J = 0;
491
+ var t = (Y = e.__c).__H;
492
+ t && (Fe === Y ? (t.__h = [], Y.__h = [], t.__.some(function(e) {
493
+ e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
494
+ })) : (t.__h.some($), t.__h.some(nt), t.__h = [], J = 0)), Fe = Y;
495
+ }, Z.diffed = function(e) {
496
+ Be && Be(e);
497
+ var t = e.__c;
498
+ t && t.__H && (t.__H.__h.length && (Le.push(t) !== 1 && Ie === Z.requestAnimationFrame || ((Ie = Z.requestAnimationFrame) || tt)($e)), t.__H.__.some(function(e) {
499
+ e.u &&= (e.__H = e.u, void 0);
500
+ })), Fe = Y = null;
501
+ }, Z.__c = function(e, t) {
502
+ t.some(function(e) {
503
+ try {
504
+ e.__h.some($), e.__h = e.__h.filter(function(e) {
505
+ return !e.__ || nt(e);
506
+ });
507
+ } catch (n) {
508
+ t.some(function(e) {
509
+ e.__h &&= [];
510
+ }), t = [], Z.__e(n, e.__v);
511
+ }
512
+ }), Ve && Ve(e, t);
513
+ }, Z.unmount = function(e) {
514
+ He && He(e);
515
+ var t, n = e.__c;
516
+ n && n.__H && (n.__H.__.some(function(e) {
517
+ try {
518
+ $(e);
519
+ } catch (e) {
520
+ t = e;
521
+ }
522
+ }), n.__H = void 0, t && Z.__e(t, n.__v));
523
+ };
524
+ var et = typeof requestAnimationFrame == "function";
525
+ function tt(e) {
526
+ var t, n = function() {
527
+ clearTimeout(r), et && cancelAnimationFrame(t), setTimeout(e);
528
+ }, r = setTimeout(n, 35);
529
+ et && (t = requestAnimationFrame(n));
530
+ }
531
+ function $(e) {
532
+ var t = Y, n = e.__c;
533
+ typeof n == "function" && (e.__c = void 0, n()), Y = t;
534
+ }
535
+ function nt(e) {
536
+ var t = Y;
537
+ e.__c = e.__(), Y = t;
538
+ }
539
+ function rt(e, t) {
540
+ return !e || e.length !== t.length || t.some(function(t, n) {
541
+ return t !== e[n];
542
+ });
543
+ }
544
+ function it(e, t) {
545
+ return typeof t == "function" ? t(e) : t;
546
+ }
547
+ //#endregion
548
+ //#region src/useStep.ts
549
+ function at() {
550
+ if (typeof location > "u") return !1;
551
+ let e = location.hostname;
552
+ return e === "localhost" || e === "127.0.0.1" || e === "[::1]" || e.endsWith(".local") || e.endsWith(".localhost");
553
+ }
554
+ function ot(e) {
555
+ return (e.forbidden ? e.debug !== !1 : e.debug ?? (e.preview || at())) ? e.forbidden ? A("div", {
556
+ className: "leadbot-step-stub leadbot-step-stub--quiet",
557
+ role: "note"
558
+ }, i("component_unavailable", e.lang)) : A("div", {
559
+ className: "leadbot-step-stub",
560
+ role: "note"
561
+ }, [
562
+ A("strong", { key: "t" }, "LeadBot: no published step"),
563
+ A("span", { key: "d" }, `leadbotId ${e.leadbotId ?? "(unset)"} · step ${e.id ?? "(unset)"}`),
564
+ A("span", { key: "h" }, "Check the id in the dashboard, and the console for the flow request.")
565
+ ]) : null;
566
+ }
567
+ function st(e) {
568
+ let t = q(e);
569
+ return {
570
+ id: e.id,
571
+ leadbotId: t.leadbotId,
572
+ preview: t.preview,
573
+ debug: t.debug
574
+ };
575
+ }
576
+ function ct(e) {
577
+ let [t, n] = We({
578
+ step: null,
579
+ missing: !1,
580
+ forbidden: !1
581
+ }), { id: r, domainKey: i, apiHost: a, leadbotId: o, path: c, language: l, previewToken: u, preview: d } = e, [f, p] = We(0);
582
+ return Ke(() => {
583
+ if (!c) return s(() => p((e) => e + 1));
584
+ }, [c]), Ke(() => {
585
+ if (!r) {
586
+ n({
587
+ step: null,
588
+ missing: !1,
589
+ forbidden: !1
590
+ });
591
+ return;
592
+ }
593
+ let e = !0, t = {
594
+ domainKey: i,
595
+ apiHost: a,
596
+ leadbotId: o,
597
+ path: c,
598
+ language: l,
599
+ previewToken: u,
600
+ preview: d
601
+ };
602
+ return ke(t).then((i) => {
603
+ if (!e) return;
604
+ let a = i?.steps?.find((e) => e.uuid === r) ?? null;
605
+ !a && d && console.warn(`[leadbot] no published step with id "${r}"`), n({
606
+ step: a,
607
+ missing: !a,
608
+ forbidden: !a && De(t)
609
+ });
610
+ }), () => {
611
+ e = !1;
612
+ };
613
+ }, [
614
+ r,
615
+ i,
616
+ a,
617
+ o,
618
+ c,
619
+ l,
620
+ u,
621
+ d,
622
+ f
623
+ ]), t;
624
+ }
625
+ function lt(e) {
626
+ return ct(e).step;
627
+ }
628
+ //#endregion
629
+ //#region ../../node_modules/.pnpm/preact@10.29.8_preact-render-to-string@6.7.0/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
630
+ var ut = 0;
631
+ Array.isArray;
632
+ function dt(e, t, n, r, i, a) {
633
+ t ||= {};
634
+ var o, s, c = t;
635
+ if ("ref" in c) for (s in c = {}, t) s == "ref" ? o = t[s] : c[s] = t[s];
636
+ var l = {
637
+ type: e,
638
+ props: c,
639
+ key: n,
640
+ ref: o,
641
+ __k: null,
642
+ __: null,
643
+ __b: 0,
644
+ __e: null,
645
+ __c: null,
646
+ constructor: void 0,
647
+ __v: --ut,
648
+ __i: -1,
649
+ __u: 0,
650
+ __source: i,
651
+ __self: a
652
+ };
653
+ if (typeof e == "function" && (o = e.defaultProps)) for (s in o) c[s] === void 0 && (c[s] = o[s]);
654
+ return d.vnode && d.vnode(l), l;
655
+ }
656
+ //#endregion
657
+ export { d as A, q as C, M as D, B as E, ge as O, Se as S, oe as T, xe as _, lt as a, Ae as b, qe as c, Ke as d, Xe as f, Pe as g, t as h, ct as i, A as k, We as l, je as m, ot as n, Je as o, Ze as p, st as r, Ye as s, dt as t, Qe as u, _e as v, N as w, Te as x, ke as y };