@sprig-technologies/sprig-browser
Version:
npm package for the sprig web sdk
1,111 lines • 110 kB
JavaScript
import { i as yt, A as J, d as mn, e as yn, C as vt, f as xe, r as vn, D as hn } from "./core-BtQuNcD-.js";
import { e as me, h as Ee, S as H, s as fe, b as He, D as ht, t as ye, u as gn, v as gt } from "./metricsReporter-CVAZgxNJ.js";
var be, x, cr, z, bt, dr, Ye, pr, he = {}, _r = [], bn = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Ue = Array.isArray;
function W(e, t) {
for (var r in t) e[r] = t[r];
return e;
}
function fr(e) {
var t = e.parentNode;
t && t.removeChild(e);
}
function q(e, t, r) {
var o, n, s, i = {};
for (s in t) s == "key" ? o = t[s] : s == "ref" ? n = t[s] : i[s] = t[s];
if (arguments.length > 2 && (i.children = arguments.length > 3 ? be.call(arguments, 2) : r), typeof e == "function" && e.defaultProps != null) for (s in e.defaultProps) i[s] === void 0 && (i[s] = e.defaultProps[s]);
return ve(e, i, o, n, null);
}
function ve(e, t, r, o, n) {
var s = { type: e, props: t, key: r, ref: o, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: n ?? ++cr, __i: -1, __u: 0 };
return n == null && x.vnode != null && x.vnode(s), s;
}
function mr() {
return { current: null };
}
function B(e) {
return e.children;
}
function F(e, t) {
this.props = e, this.context = t;
}
function le(e, t) {
if (t == null) return e.__ ? le(e.__, e.__i + 1) : null;
for (var r; t < e.__k.length; t++) if ((r = e.__k[t]) != null && r.__e != null) return r.__e;
return typeof e.type == "function" ? le(e) : null;
}
function yr(e) {
var t, r;
if ((e = e.__) != null && e.__c != null) {
for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++) if ((r = e.__k[t]) != null && r.__e != null) {
e.__e = e.__c.base = r.__e;
break;
}
return yr(e);
}
}
function Xe(e) {
(!e.__d && (e.__d = !0) && z.push(e) && !Ne.__r++ || bt !== x.debounceRendering) && ((bt = x.debounceRendering) || dr)(Ne);
}
function Ne() {
var e, t, r, o, n, s, i, u, a;
for (z.sort(Ye); e = z.shift(); ) e.__d && (t = z.length, o = void 0, s = (n = (r = e).__v).__e, u = [], a = [], (i = r.__P) && ((o = W({}, n)).__v = n.__v + 1, x.vnode && x.vnode(o), ot(i, o, n, r.__n, i.ownerSVGElement !== void 0, 32 & n.__u ? [s] : null, u, s ?? le(n), !!(32 & n.__u), a), o.__.__k[o.__i] = o, gr(u, o, a), o.__e != s && yr(o)), z.length > t && z.sort(Ye));
Ne.__r = 0;
}
function vr(e, t, r, o, n, s, i, u, a, l, d) {
var c, f, p, C, m, v = o && o.__k || _r, b = t.length;
for (r.__d = a, function(_, k, w) {
var S, h, y, I, g, N = k.length, E = w.length, L = E, O = 0;
for (_.__k = [], S = 0; S < N; S++) (h = _.__k[S] = (h = k[S]) == null || typeof h == "boolean" || typeof h == "function" ? null : typeof h == "string" || typeof h == "number" || typeof h == "bigint" || h.constructor == String ? ve(null, h, null, null, h) : Ue(h) ? ve(B, { children: h }, null, null, null) : h.constructor === void 0 && h.__b > 0 ? ve(h.type, h.props, h.key, h.ref ? h.ref : null, h.__v) : h) != null ? (h.__ = _, h.__b = _.__b + 1, g = Cn(h, w, I = S + O, L), h.__i = g, y = null, g !== -1 && (L--, (y = w[g]) && (y.__u |= 131072)), y == null || y.__v === null ? (g == -1 && O--, typeof h.type != "function" && (h.__u |= 65536)) : g !== I && (g === I + 1 ? O++ : g > I ? L > N - I ? O += g - I : O-- : O = g < I && g == I - 1 ? g - I : 0, g !== S + O && (h.__u |= 65536))) : (y = w[S]) && y.key == null && y.__e && (y.__e == _.__d && (_.__d = le(y)), et(y, y, !1), w[S] = null, L--);
if (L) for (S = 0; S < E; S++) (y = w[S]) != null && !(131072 & y.__u) && (y.__e == _.__d && (_.__d = le(y)), et(y, y));
}(r, t, v), a = r.__d, c = 0; c < b; c++) (p = r.__k[c]) != null && typeof p != "boolean" && typeof p != "function" && (f = p.__i === -1 ? he : v[p.__i] || he, p.__i = c, ot(e, p, f, n, s, i, u, a, l, d), C = p.__e, p.ref && f.ref != p.ref && (f.ref && st(f.ref, null, p), d.push(p.ref, p.__c || C, p)), m == null && C != null && (m = C), 65536 & p.__u || f.__k === p.__k ? a = hr(p, a, e) : typeof p.type == "function" && p.__d !== void 0 ? a = p.__d : C && (a = C.nextSibling), p.__d = void 0, p.__u &= -196609);
r.__d = a, r.__e = m;
}
function hr(e, t, r) {
var o, n;
if (typeof e.type == "function") {
for (o = e.__k, n = 0; o && n < o.length; n++) o[n] && (o[n].__ = e, t = hr(o[n], t, r));
return t;
}
return e.__e != t && (r.insertBefore(e.__e, t || null), t = e.__e), t && t.nextSibling;
}
function Q(e, t) {
return t = t || [], e == null || typeof e == "boolean" || (Ue(e) ? e.some(function(r) {
Q(r, t);
}) : t.push(e)), t;
}
function Cn(e, t, r, o) {
var n = e.key, s = e.type, i = r - 1, u = r + 1, a = t[r];
if (a === null || a && n == a.key && s === a.type) return r;
if (o > (a == null || 131072 & a.__u ? 0 : 1)) for (; i >= 0 || u < t.length; ) {
if (i >= 0) {
if ((a = t[i]) && !(131072 & a.__u) && n == a.key && s === a.type) return i;
i--;
}
if (u < t.length) {
if ((a = t[u]) && !(131072 & a.__u) && n == a.key && s === a.type) return u;
u++;
}
}
return -1;
}
function Ct(e, t, r) {
t[0] === "-" ? e.setProperty(t, r ?? "") : e[t] = r == null ? "" : typeof r != "number" || bn.test(t) ? r : r + "px";
}
function Se(e, t, r, o, n) {
var s;
e: if (t === "style") if (typeof r == "string") e.style.cssText = r;
else {
if (typeof o == "string" && (e.style.cssText = o = ""), o) for (t in o) r && t in r || Ct(e.style, t, "");
if (r) for (t in r) o && r[t] === o[t] || Ct(e.style, t, r[t]);
}
else if (t[0] === "o" && t[1] === "n") s = t !== (t = t.replace(/(PointerCapture)$|Capture$/, "$1")), t = t.toLowerCase() in e ? t.toLowerCase().slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + s] = r, r ? o ? r.u = o.u : (r.u = Date.now(), e.addEventListener(t, s ? wt : kt, s)) : e.removeEventListener(t, s ? wt : kt, s);
else {
if (n) t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
else if (t !== "width" && t !== "height" && t !== "href" && t !== "list" && t !== "form" && t !== "tabIndex" && t !== "download" && t !== "rowSpan" && t !== "colSpan" && t !== "role" && t in e) try {
e[t] = r ?? "";
break e;
} catch {
}
typeof r == "function" || (r == null || r === !1 && t[4] !== "-" ? e.removeAttribute(t) : e.setAttribute(t, r));
}
}
function kt(e) {
var t = this.l[e.type + !1];
if (e.t) {
if (e.t <= t.u) return;
} else e.t = Date.now();
return t(x.event ? x.event(e) : e);
}
function wt(e) {
return this.l[e.type + !0](x.event ? x.event(e) : e);
}
function ot(e, t, r, o, n, s, i, u, a, l) {
var d, c, f, p, C, m, v, b, _, k, w, S, h, y, I, g = t.type;
if (t.constructor !== void 0) return null;
128 & r.__u && (a = !!(32 & r.__u), s = [u = t.__e = r.__e]), (d = x.__b) && d(t);
e: if (typeof g == "function") try {
if (b = t.props, _ = (d = g.contextType) && o[d.__c], k = d ? _ ? _.props.value : d.__ : o, r.__c ? v = (c = t.__c = r.__c).__ = c.__E : ("prototype" in g && g.prototype.render ? t.__c = c = new g(b, k) : (t.__c = c = new F(b, k), c.constructor = g, c.render = wn), _ && _.sub(c), c.props = b, c.state || (c.state = {}), c.context = k, c.__n = o, f = c.__d = !0, c.__h = [], c._sb = []), c.__s == null && (c.__s = c.state), g.getDerivedStateFromProps != null && (c.__s == c.state && (c.__s = W({}, c.__s)), W(c.__s, g.getDerivedStateFromProps(b, c.__s))), p = c.props, C = c.state, c.__v = t, f) g.getDerivedStateFromProps == null && c.componentWillMount != null && c.componentWillMount(), c.componentDidMount != null && c.__h.push(c.componentDidMount);
else {
if (g.getDerivedStateFromProps == null && b !== p && c.componentWillReceiveProps != null && c.componentWillReceiveProps(b, k), !c.__e && (c.shouldComponentUpdate != null && c.shouldComponentUpdate(b, c.__s, k) === !1 || t.__v === r.__v)) {
for (t.__v !== r.__v && (c.props = b, c.state = c.__s, c.__d = !1), t.__e = r.__e, t.__k = r.__k, t.__k.forEach(function(N) {
N && (N.__ = t);
}), w = 0; w < c._sb.length; w++) c.__h.push(c._sb[w]);
c._sb = [], c.__h.length && i.push(c);
break e;
}
c.componentWillUpdate != null && c.componentWillUpdate(b, c.__s, k), c.componentDidUpdate != null && c.__h.push(function() {
c.componentDidUpdate(p, C, m);
});
}
if (c.context = k, c.props = b, c.__P = e, c.__e = !1, S = x.__r, h = 0, "prototype" in g && g.prototype.render) {
for (c.state = c.__s, c.__d = !1, S && S(t), d = c.render(c.props, c.state, c.context), y = 0; y < c._sb.length; y++) c.__h.push(c._sb[y]);
c._sb = [];
} else do
c.__d = !1, S && S(t), d = c.render(c.props, c.state, c.context), c.state = c.__s;
while (c.__d && ++h < 25);
c.state = c.__s, c.getChildContext != null && (o = W(W({}, o), c.getChildContext())), f || c.getSnapshotBeforeUpdate == null || (m = c.getSnapshotBeforeUpdate(p, C)), vr(e, Ue(I = d != null && d.type === B && d.key == null ? d.props.children : d) ? I : [I], t, r, o, n, s, i, u, a, l), c.base = t.__e, t.__u &= -161, c.__h.length && i.push(c), v && (c.__E = c.__ = null);
} catch (N) {
t.__v = null, a || s != null ? (t.__e = u, t.__u |= a ? 160 : 32, s[s.indexOf(u)] = null) : (t.__e = r.__e, t.__k = r.__k), x.__e(N, t, r);
}
else s == null && t.__v === r.__v ? (t.__k = r.__k, t.__e = r.__e) : t.__e = kn(r.__e, t, r, o, n, s, i, a, l);
(d = x.diffed) && d(t);
}
function gr(e, t, r) {
t.__d = void 0;
for (var o = 0; o < r.length; o++) st(r[o], r[++o], r[++o]);
x.__c && x.__c(t, e), e.some(function(n) {
try {
e = n.__h, n.__h = [], e.some(function(s) {
s.call(n);
});
} catch (s) {
x.__e(s, n.__v);
}
});
}
function kn(e, t, r, o, n, s, i, u, a) {
var l, d, c, f, p, C, m, v = r.props, b = t.props, _ = t.type;
if (_ === "svg" && (n = !0), s != null) {
for (l = 0; l < s.length; l++) if ((p = s[l]) && "setAttribute" in p == !!_ && (_ ? p.localName === _ : p.nodeType === 3)) {
e = p, s[l] = null;
break;
}
}
if (e == null) {
if (_ === null) return document.createTextNode(b);
e = n ? document.createElementNS("http://www.w3.org/2000/svg", _) : document.createElement(_, b.is && b), s = null, u = !1;
}
if (_ === null) v === b || u && e.data === b || (e.data = b);
else {
if (s = s && be.call(e.childNodes), v = r.props || he, !u && s != null) for (v = {}, l = 0; l < e.attributes.length; l++) v[(p = e.attributes[l]).name] = p.value;
for (l in v) p = v[l], l == "children" || (l == "dangerouslySetInnerHTML" ? c = p : l === "key" || l in b || Se(e, l, null, p, n));
for (l in b) p = b[l], l == "children" ? f = p : l == "dangerouslySetInnerHTML" ? d = p : l == "value" ? C = p : l == "checked" ? m = p : l === "key" || u && typeof p != "function" || v[l] === p || Se(e, l, p, v[l], n);
if (d) u || c && (d.__html === c.__html || d.__html === e.innerHTML) || (e.innerHTML = d.__html), t.__k = [];
else if (c && (e.innerHTML = ""), vr(e, Ue(f) ? f : [f], t, r, o, n && _ !== "foreignObject", s, i, s ? s[0] : r.__k && le(r, 0), u, a), s != null) for (l = s.length; l--; ) s[l] != null && fr(s[l]);
u || (l = "value", C !== void 0 && (C !== e[l] || _ === "progress" && !C || _ === "option" && C !== v[l]) && Se(e, l, C, v[l], !1), l = "checked", m !== void 0 && m !== e[l] && Se(e, l, m, v[l], !1));
}
return e;
}
function st(e, t, r) {
try {
typeof e == "function" ? e(t) : e.current = t;
} catch (o) {
x.__e(o, r);
}
}
function et(e, t, r) {
var o, n;
if (x.unmount && x.unmount(e), (o = e.ref) && (o.current && o.current !== e.__e || st(o, null, t)), (o = e.__c) != null) {
if (o.componentWillUnmount) try {
o.componentWillUnmount();
} catch (s) {
x.__e(s, t);
}
o.base = o.__P = null, e.__c = void 0;
}
if (o = e.__k) for (n = 0; n < o.length; n++) o[n] && et(o[n], t, r || typeof e.type != "function");
r || e.__e == null || fr(e.__e), e.__ = e.__e = e.__d = void 0;
}
function wn(e, t, r) {
return this.constructor(e, r);
}
function ce(e, t, r) {
var o, n, s, i;
x.__ && x.__(e, t), n = (o = typeof r == "function") ? null : r && r.__k || t.__k, s = [], i = [], ot(t, e = (!o && r || t).__k = q(B, null, [e]), n || he, he, t.ownerSVGElement !== void 0, !o && r ? [r] : n ? null : t.firstChild ? be.call(t.childNodes) : null, s, !o && r ? r : n ? n.__e : t.firstChild, o, i), gr(s, e, i);
}
function br(e, t) {
ce(e, t, br);
}
function Sn(e, t, r) {
var o, n, s, i, u = W({}, e.props);
for (s in e.type && e.type.defaultProps && (i = e.type.defaultProps), t) s == "key" ? o = t[s] : s == "ref" ? n = t[s] : u[s] = t[s] === void 0 && i !== void 0 ? i[s] : t[s];
return arguments.length > 2 && (u.children = arguments.length > 3 ? be.call(arguments, 2) : r), ve(e.type, u, o || e.key, n || e.ref, null);
}
function Cr(e, t) {
var r = { __c: t = "__cC" + pr++, __: e, Consumer: function(o, n) {
return o.children(n);
}, Provider: function(o) {
var n, s;
return this.getChildContext || (n = [], (s = {})[t] = this, this.getChildContext = function() {
return s;
}, this.shouldComponentUpdate = function(i) {
this.props.value !== i.value && n.some(function(u) {
u.__e = !0, Xe(u);
});
}, this.sub = function(i) {
n.push(i);
var u = i.componentWillUnmount;
i.componentWillUnmount = function() {
n.splice(n.indexOf(i), 1), u && u.call(i);
};
}), o.children;
} };
return r.Provider.__ = r.Consumer.contextType = r;
}
be = _r.slice, x = { __e: function(e, t, r, o) {
for (var n, s, i; t = t.__; ) if ((n = t.__c) && !n.__) try {
if ((s = n.constructor) && s.getDerivedStateFromError != null && (n.setState(s.getDerivedStateFromError(e)), i = n.__d), n.componentDidCatch != null && (n.componentDidCatch(e, o || {}), i = n.__d), i) return n.__E = n;
} catch (u) {
e = u;
}
throw e;
} }, cr = 0, F.prototype.setState = function(e, t) {
var r;
r = this.__s != null && this.__s !== this.state ? this.__s : this.__s = W({}, this.state), typeof e == "function" && (e = e(W({}, r), this.props)), e && W(r, e), e != null && this.__v && (t && this._sb.push(t), Xe(this));
}, F.prototype.forceUpdate = function(e) {
this.__v && (this.__e = !0, e && this.__h.push(e), Xe(this));
}, F.prototype.render = B, z = [], dr = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Ye = function(e, t) {
return e.__v.__b - t.__v.__b;
}, Ne.__r = 0, pr = 0;
var xn = 0;
function R(e, t, r, o, n, s) {
var i, u, a = {};
for (u in t) u == "ref" ? i = t[u] : a[u] = t[u];
var l = { type: e, props: a, key: r, ref: i, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --xn, __i: -1, __u: 0, __source: n, __self: s };
if (typeof e == "function" && (i = e.defaultProps)) for (u in i) a[u] === void 0 && (a[u] = i[u]);
return x.vnode && x.vnode(l), l;
}
var G, T, je, St, de = 0, kr = [], Re = [], xt = x.__b, Rt = x.__r, It = x.diffed, At = x.__c, Et = x.unmount;
function te(e, t) {
x.__h && x.__h(T, e, de || t), de = 0;
var r = T.__H || (T.__H = { __: [], __h: [] });
return e >= r.__.length && r.__.push({ __V: Re }), r.__[e];
}
function X(e) {
return de = 1, it(Rr, e);
}
function it(e, t, r) {
var o = te(G++, 2);
if (o.t = e, !o.__c && (o.__ = [r ? r(t) : Rr(void 0, t), function(u) {
var a = o.__N ? o.__N[0] : o.__[0], l = o.t(a, u);
a !== l && (o.__N = [l, o.__[1]], o.__c.setState({}));
}], o.__c = T, !T.u)) {
var n = function(u, a, l) {
if (!o.__c.__H) return !0;
var d = o.__c.__H.__.filter(function(f) {
return f.__c;
});
if (d.every(function(f) {
return !f.__N;
})) return !s || s.call(this, u, a, l);
var c = !1;
return d.forEach(function(f) {
if (f.__N) {
var p = f.__[0];
f.__ = f.__N, f.__N = void 0, p !== f.__[0] && (c = !0);
}
}), !(!c && o.__c.props === u) && (!s || s.call(this, u, a, l));
};
T.u = !0;
var s = T.shouldComponentUpdate, i = T.componentWillUpdate;
T.componentWillUpdate = function(u, a, l) {
if (this.__e) {
var d = s;
s = void 0, n(u, a, l), s = d;
}
i && i.call(this, u, a, l);
}, T.shouldComponentUpdate = n;
}
return o.__N || o.__;
}
function j(e, t) {
var r = te(G++, 3);
!x.__s && ut(r.__H, t) && (r.__ = e, r.i = t, T.__H.__h.push(r));
}
function Ce(e, t) {
var r = te(G++, 4);
!x.__s && ut(r.__H, t) && (r.__ = e, r.i = t, T.__h.push(r));
}
function ee(e) {
return de = 5, re(function() {
return { current: e };
}, []);
}
function wr(e, t, r) {
de = 6, Ce(function() {
return typeof e == "function" ? (e(t()), function() {
return e(null);
}) : e ? (e.current = t(), function() {
return e.current = null;
}) : void 0;
}, r == null ? r : r.concat(e));
}
function re(e, t) {
var r = te(G++, 7);
return ut(r.__H, t) ? (r.__V = e(), r.i = t, r.__h = e, r.__V) : r.__;
}
function Le(e, t) {
return de = 8, re(function() {
return e;
}, t);
}
function Sr(e) {
var t = T.context[e.__c], r = te(G++, 9);
return r.c = e, t ? (r.__ == null && (r.__ = !0, t.sub(T)), t.props.value) : e.__;
}
function at(e, t) {
x.useDebugValue && x.useDebugValue(t ? t(e) : e);
}
function xr() {
var e = te(G++, 11);
if (!e.__) {
for (var t = T.__v; t !== null && !t.__m && t.__ !== null; ) t = t.__;
var r = t.__m || (t.__m = [0, 0]);
e.__ = "P" + r[0] + "-" + r[1]++;
}
return e.__;
}
function Rn() {
for (var e; e = kr.shift(); ) if (e.__P && e.__H) try {
e.__H.__h.forEach(Ie), e.__H.__h.forEach(tt), e.__H.__h = [];
} catch (t) {
e.__H.__h = [], x.__e(t, e.__v);
}
}
x.__b = function(e) {
T = null, xt && xt(e);
}, x.__r = function(e) {
Rt && Rt(e), G = 0;
var t = (T = e.__c).__H;
t && (je === T ? (t.__h = [], T.__h = [], t.__.forEach(function(r) {
r.__N && (r.__ = r.__N), r.__V = Re, r.__N = r.i = void 0;
})) : (t.__h.forEach(Ie), t.__h.forEach(tt), t.__h = [], G = 0)), je = T;
}, x.diffed = function(e) {
It && It(e);
var t = e.__c;
t && t.__H && (t.__H.__h.length && (kr.push(t) !== 1 && St === x.requestAnimationFrame || ((St = x.requestAnimationFrame) || In)(Rn)), t.__H.__.forEach(function(r) {
r.i && (r.__H = r.i), r.__V !== Re && (r.__ = r.__V), r.i = void 0, r.__V = Re;
})), je = T = null;
}, x.__c = function(e, t) {
t.some(function(r) {
try {
r.__h.forEach(Ie), r.__h = r.__h.filter(function(o) {
return !o.__ || tt(o);
});
} catch (o) {
t.some(function(n) {
n.__h && (n.__h = []);
}), t = [], x.__e(o, r.__v);
}
}), At && At(e, t);
}, x.unmount = function(e) {
Et && Et(e);
var t, r = e.__c;
r && r.__H && (r.__H.__.forEach(function(o) {
try {
Ie(o);
} catch (n) {
t = n;
}
}), r.__H = void 0, t && x.__e(t, r.__v));
};
var Nt = typeof requestAnimationFrame == "function";
function In(e) {
var t, r = function() {
clearTimeout(o), Nt && cancelAnimationFrame(t), setTimeout(e);
}, o = setTimeout(r, 100);
Nt && (t = requestAnimationFrame(r));
}
function Ie(e) {
var t = T, r = e.__c;
typeof r == "function" && (e.__c = void 0, r()), T = t;
}
function tt(e) {
var t = T;
e.__c = e.__(), T = t;
}
function ut(e, t) {
return !e || e.length !== t.length || t.some(function(r, o) {
return r !== e[o];
});
}
function Rr(e, t) {
return typeof t == "function" ? t(e) : t;
}
function Ir(e, t) {
for (var r in t) e[r] = t[r];
return e;
}
function rt(e, t) {
for (var r in e) if (r !== "__source" && !(r in t)) return !0;
for (var o in t) if (o !== "__source" && e[o] !== t[o]) return !0;
return !1;
}
function Te(e) {
this.props = e;
}
function Ar(e, t) {
function r(n) {
var s = this.props.ref, i = s == n.ref;
return !i && s && (s.call ? s(null) : s.current = null), t ? !t(this.props, n) || !i : rt(this.props, n);
}
function o(n) {
return this.shouldComponentUpdate = r, q(e, n);
}
return o.displayName = "Memo(" + (e.displayName || e.name) + ")", o.prototype.isReactComponent = !0, o.__f = !0, o;
}
(Te.prototype = new F()).isPureReactComponent = !0, Te.prototype.shouldComponentUpdate = function(e, t) {
return rt(this.props, e) || rt(this.state, t);
};
var Lt = x.__b;
x.__b = function(e) {
e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), Lt && Lt(e);
};
var An = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911;
function lt(e) {
function t(r) {
var o = Ir({}, r);
return delete o.ref, e(o, r.ref || null);
}
return t.$$typeof = An, t.render = t, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", t;
}
var Tt = function(e, t) {
return e == null ? null : Q(Q(e).map(t));
}, Er = { map: Tt, forEach: Tt, count: function(e) {
return e ? Q(e).length : 0;
}, only: function(e) {
var t = Q(e);
if (t.length !== 1) throw "Children.only";
return t[0];
}, toArray: Q }, En = x.__e;
x.__e = function(e, t, r, o) {
if (e.then) {
for (var n, s = t; s = s.__; ) if ((n = s.__c) && n.__c) return t.__e == null && (t.__e = r.__e, t.__k = r.__k), n.__c(e, t);
}
En(e, t, r, o);
};
var Ot = x.unmount;
function Nr(e, t, r) {
return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(o) {
typeof o.__c == "function" && o.__c();
}), e.__c.__H = null), (e = Ir({}, e)).__c != null && (e.__c.__P === r && (e.__c.__P = t), e.__c = null), e.__k = e.__k && e.__k.map(function(o) {
return Nr(o, t, r);
})), e;
}
function Lr(e, t, r) {
return e && r && (e.__v = null, e.__k = e.__k && e.__k.map(function(o) {
return Lr(o, t, r);
}), e.__c && e.__c.__P === t && (e.__e && r.appendChild(e.__e), e.__c.__e = !0, e.__c.__P = r)), e;
}
function ue() {
this.__u = 0, this.t = null, this.__b = null;
}
function Tr(e) {
var t = e.__.__c;
return t && t.__a && t.__a(e);
}
function Pe(e) {
var t, r, o;
function n(s) {
if (t || (t = e()).then(function(i) {
r = i.default || i;
}, function(i) {
o = i;
}), o) throw o;
if (!r) throw t;
return q(r, s);
}
return n.displayName = "Lazy", n.__f = !0, n;
}
function ie() {
this.u = null, this.o = null;
}
x.unmount = function(e) {
var t = e.__c;
t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), Ot && Ot(e);
}, (ue.prototype = new F()).__c = function(e, t) {
var r = t.__c, o = this;
o.t == null && (o.t = []), o.t.push(r);
var n = Tr(o.__v), s = !1, i = function() {
s || (s = !0, r.__R = null, n ? n(u) : u());
};
r.__R = i;
var u = function() {
if (!--o.__u) {
if (o.state.__a) {
var a = o.state.__a;
o.__v.__k[0] = Lr(a, a.__c.__P, a.__c.__O);
}
var l;
for (o.setState({ __a: o.__b = null }); l = o.t.pop(); ) l.forceUpdate();
}
};
o.__u++ || 32 & t.__u || o.setState({ __a: o.__b = o.__v.__k[0] }), e.then(i, i);
}, ue.prototype.componentWillUnmount = function() {
this.t = [];
}, ue.prototype.render = function(e, t) {
if (this.__b) {
if (this.__v.__k) {
var r = document.createElement("div"), o = this.__v.__k[0].__c;
this.__v.__k[0] = Nr(this.__b, r, o.__O = o.__P);
}
this.__b = null;
}
var n = t.__a && q(B, null, e.fallback);
return n && (n.__u &= -33), [q(B, null, t.__a ? null : e.children), n];
};
var Vt = function(e, t, r) {
if (++r[1] === r[0] && e.o.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.o.size)) for (r = e.u; r; ) {
for (; r.length > 3; ) r.pop()();
if (r[1] < r[0]) break;
e.u = r = r[2];
}
};
function Nn(e) {
return this.getChildContext = function() {
return e.context;
}, e.children;
}
function Ln(e) {
var t = this, r = e.i;
t.componentWillUnmount = function() {
ce(null, t.l), t.l = null, t.i = null;
}, t.i && t.i !== r && t.componentWillUnmount(), t.l || (t.i = r, t.l = { nodeType: 1, parentNode: r, childNodes: [], appendChild: function(o) {
this.childNodes.push(o), t.i.appendChild(o);
}, insertBefore: function(o, n) {
this.childNodes.push(o), t.i.appendChild(o);
}, removeChild: function(o) {
this.childNodes.splice(this.childNodes.indexOf(o) >>> 1, 1), t.i.removeChild(o);
} }), ce(q(Nn, { context: t.context }, e.__v), t.l);
}
function Or(e, t) {
var r = q(Ln, { __v: e, i: t });
return r.containerInfo = t, r;
}
(ie.prototype = new F()).__a = function(e) {
var t = this, r = Tr(t.__v), o = t.o.get(e);
return o[0]++, function(n) {
var s = function() {
t.props.revealOrder ? (o.push(n), Vt(t, e, o)) : n();
};
r ? r(s) : s();
};
}, ie.prototype.render = function(e) {
this.u = null, this.o = /* @__PURE__ */ new Map();
var t = Q(e.children);
e.revealOrder && e.revealOrder[0] === "b" && t.reverse();
for (var r = t.length; r--; ) this.o.set(t[r], this.u = [1, 0, this.u]);
return e.children;
}, ie.prototype.componentDidUpdate = ie.prototype.componentDidMount = function() {
var e = this;
this.o.forEach(function(t, r) {
Vt(e, r, t);
});
};
var Vr = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, Tn = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, On = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, Vn = /[A-Z0-9]/g, Un = typeof document < "u", Pn = function(e) {
return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e);
};
function Ur(e, t, r) {
return t.__k == null && (t.textContent = ""), ce(e, t), typeof r == "function" && r(), e ? e.__c : null;
}
function Pr(e, t, r) {
return br(e, t), typeof r == "function" && r(), e ? e.__c : null;
}
F.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) {
Object.defineProperty(F.prototype, e, { configurable: !0, get: function() {
return this["UNSAFE_" + e];
}, set: function(t) {
Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t });
} });
});
var Ut = x.event;
function qn() {
}
function Mn() {
return this.cancelBubble;
}
function Hn() {
return this.defaultPrevented;
}
x.event = function(e) {
return Ut && (e = Ut(e)), e.persist = qn, e.isPropagationStopped = Mn, e.isDefaultPrevented = Hn, e.nativeEvent = e;
};
var ct, jn = { enumerable: !1, configurable: !0, get: function() {
return this.class;
} }, Pt = x.vnode;
x.vnode = function(e) {
typeof e.type == "string" && function(t) {
var r = t.props, o = t.type, n = {};
for (var s in r) {
var i = r[s];
if (!(s === "value" && "defaultValue" in r && i == null || Un && s === "children" && o === "noscript" || s === "class" || s === "className")) {
var u = s.toLowerCase();
s === "defaultValue" && "value" in r && r.value == null ? s = "value" : s === "download" && i === !0 ? i = "" : u === "ondoubleclick" ? s = "ondblclick" : u !== "onchange" || o !== "input" && o !== "textarea" || Pn(r.type) ? u === "onfocus" ? s = "onfocusin" : u === "onblur" ? s = "onfocusout" : On.test(s) ? s = u : o.indexOf("-") === -1 && Tn.test(s) ? s = s.replace(Vn, "-$&").toLowerCase() : i === null && (i = void 0) : u = s = "oninput", u === "oninput" && n[s = u] && (s = "oninputCapture"), n[s] = i;
}
}
o == "select" && n.multiple && Array.isArray(n.value) && (n.value = Q(r.children).forEach(function(a) {
a.props.selected = n.value.indexOf(a.props.value) != -1;
})), o == "select" && n.defaultValue != null && (n.value = Q(r.children).forEach(function(a) {
a.props.selected = n.multiple ? n.defaultValue.indexOf(a.props.value) != -1 : n.defaultValue == a.props.value;
})), r.class && !r.className ? (n.class = r.class, Object.defineProperty(n, "className", jn)) : (r.className && !r.class || r.class && r.className) && (n.class = n.className = r.className), t.props = n;
}(e), e.$$typeof = Vr, Pt && Pt(e);
};
var qt = x.__r;
x.__r = function(e) {
qt && qt(e), ct = e.__c;
};
var Mt = x.diffed;
x.diffed = function(e) {
Mt && Mt(e);
var t = e.props, r = e.__e;
r != null && e.type === "textarea" && "value" in t && t.value !== r.value && (r.value = t.value == null ? "" : t.value), ct = null;
};
var qr = { ReactCurrentDispatcher: { current: { readContext: function(e) {
return ct.__n[e.__c].props.value;
} } } };
function Mr(e) {
return q.bind(null, e);
}
function ke(e) {
return !!e && e.$$typeof === Vr;
}
function Hr(e) {
return ke(e) && e.type === B;
}
function jr(e) {
return ke(e) ? Sn.apply(null, arguments) : e;
}
function Oe(e) {
return !!e.__k && (ce(null, e), !0);
}
function Dr(e) {
return e && (e.base || e.nodeType === 1 && e) || null;
}
var Fr = function(e, t) {
return e(t);
}, Br = function(e, t) {
return e(t);
}, $r = B;
function dt(e) {
e();
}
function Wr(e) {
return e;
}
function Qr() {
return [!1, dt];
}
var Gr = Ce, Zr = ke;
function Kr(e, t) {
var r = t(), o = X({ h: { __: r, v: t } }), n = o[0].h, s = o[1];
return Ce(function() {
n.__ = r, n.v = t, De(n) && s({ h: n });
}, [e, r, t]), j(function() {
return De(n) && s({ h: n }), e(function() {
De(n) && s({ h: n });
});
}, [e]), r;
}
function De(e) {
var t, r, o = e.v, n = e.__;
try {
var s = o();
return !((t = n) === (r = s) && (t !== 0 || 1 / t == 1 / r) || t != t && r != r);
} catch {
return !0;
}
}
var Dn = { useState: X, useId: xr, useReducer: it, useEffect: j, useLayoutEffect: Ce, useInsertionEffect: Gr, useTransition: Qr, useDeferredValue: Wr, useSyncExternalStore: Kr, startTransition: dt, useRef: ee, useImperativeHandle: wr, useMemo: re, useCallback: Le, useContext: Sr, useDebugValue: at, version: "17.0.2", Children: Er, render: Ur, hydrate: Pr, unmountComponentAtNode: Oe, createPortal: Or, createElement: q, createContext: Cr, createFactory: Mr, cloneElement: jr, createRef: mr, Fragment: B, isValidElement: ke, isElement: Zr, isFragment: Hr, findDOMNode: Dr, Component: F, PureComponent: Te, memo: Ar, forwardRef: lt, flushSync: Br, unstable_batchedUpdates: Fr, StrictMode: $r, Suspense: ue, SuspenseList: ie, lazy: Pe, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: qr };
const Fn = Object.freeze(Object.defineProperty({ __proto__: null, Children: Er, Component: F, Fragment: B, PureComponent: Te, StrictMode: $r, Suspense: ue, SuspenseList: ie, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: qr, cloneElement: jr, createContext: Cr, createElement: q, createFactory: Mr, createPortal: Or, createRef: mr, default: Dn, findDOMNode: Dr, flushSync: Br, forwardRef: lt, hydrate: Pr, isElement: Zr, isFragment: Hr, isValidElement: ke, lazy: Pe, memo: Ar, render: Ur, startTransition: dt, unmountComponentAtNode: Oe, unstable_batchedUpdates: Fr, useCallback: Le, useContext: Sr, useDebugValue: at, useDeferredValue: Wr, useEffect: j, useErrorBoundary: function(e) {
var t = te(G++, 10), r = X();
return t.__ = e, T.componentDidCatch || (T.componentDidCatch = function(o, n) {
t.__ && t.__(o, n), r[1](o);
}), [r[0], function() {
r[1](void 0);
}];
}, useId: xr, useImperativeHandle: wr, useInsertionEffect: Gr, useLayoutEffect: Ce, useMemo: re, useReducer: it, useRef: ee, useState: X, useSyncExternalStore: Kr, useTransition: Qr, version: "17.0.2" }, Symbol.toStringTag, { value: "Module" })), Ht = (e) => {
let t;
const r = /* @__PURE__ */ new Set(), o = (i, u) => {
const a = typeof i == "function" ? i(t) : i;
if (!Object.is(a, t)) {
const l = t;
t = u ?? typeof a != "object" ? a : Object.assign({}, t, a), r.forEach((d) => d(t, l));
}
}, n = () => t, s = { setState: o, getState: n, subscribe: (i) => (r.add(i), () => r.delete(i)), destroy: () => r.clear() };
return t = e(o, n, s), s;
};
function Bn(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function $n(e) {
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
var t = e.default;
if (typeof t == "function") {
var r = function o() {
return this instanceof o ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
};
r.prototype = t.prototype;
} else r = {};
return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(e).forEach(function(o) {
var n = Object.getOwnPropertyDescriptor(e, o);
Object.defineProperty(r, o, n.get ? n : { enumerable: !0, get: function() {
return e[o];
} });
}), r;
}
var jt = { exports: {} }, Fe = {};
const zr = $n(Fn);
var Dt, Ft, Bt, $t, Wt = { exports: {} }, Be = {};
function Wn() {
return Ft || (Ft = 1, Wt.exports = function() {
if (Dt) return Be;
Dt = 1;
var e = zr, t = typeof Object.is == "function" ? Object.is : function(a, l) {
return a === l && (a !== 0 || 1 / a == 1 / l) || a != a && l != l;
}, r = e.useState, o = e.useEffect, n = e.useLayoutEffect, s = e.useDebugValue;
function i(a) {
var l = a.getSnapshot;
a = a.value;
try {
var d = l();
return !t(a, d);
} catch {
return !0;
}
}
var u = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? function(a, l) {
return l();
} : function(a, l) {
var d = l(), c = r({ inst: { value: d, getSnapshot: l } }), f = c[0].inst, p = c[1];
return n(function() {
f.value = d, f.getSnapshot = l, i(f) && p({ inst: f });
}, [a, d, l]), o(function() {
return i(f) && p({ inst: f }), a(function() {
i(f) && p({ inst: f });
});
}, [a]), s(d), d;
};
return Be.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u, Be;
}()), Wt.exports;
}
var Qn = ($t || ($t = 1, jt.exports = function() {
if (Bt) return Fe;
Bt = 1;
var e = zr, t = Wn(), r = typeof Object.is == "function" ? Object.is : function(a, l) {
return a === l && (a !== 0 || 1 / a == 1 / l) || a != a && l != l;
}, o = t.useSyncExternalStore, n = e.useRef, s = e.useEffect, i = e.useMemo, u = e.useDebugValue;
return Fe.useSyncExternalStoreWithSelector = function(a, l, d, c, f) {
var p = n(null);
if (p.current === null) {
var C = { hasValue: !1, value: null };
p.current = C;
} else C = p.current;
p = i(function() {
function v(S) {
if (!k) {
if (k = !0, b = S, S = c(S), f !== void 0 && C.hasValue) {
var h = C.value;
if (f(h, S)) return _ = h;
}
return _ = S;
}
if (h = _, r(b, S)) return h;
var y = c(S);
return f !== void 0 && f(h, y) ? h : (b = S, _ = y);
}
var b, _, k = !1, w = d === void 0 ? null : d;
return [function() {
return v(l());
}, w === null ? void 0 : function() {
return v(w());
}];
}, [l, d, c, f]);
var m = o(a, p[0], p[1]);
return s(function() {
C.hasValue = !0, C.value = m;
}, [m]), u(m), m;
}, Fe;
}()), jt.exports);
const Gn = Bn(Qn), { useSyncExternalStoreWithSelector: Zn } = Gn, Qt = (e) => {
const t = typeof e == "function" ? ((o) => o ? Ht(o) : Ht)(e) : e, r = (o, n) => function(s, i = s.getState, u) {
const a = Zn(s.subscribe, s.getState, s.getServerState || s.getState, i, u);
return at(a), a;
}(t, o, n);
return Object.assign(r, t), r;
}, Kn = (e) => e ? Qt(e) : Qt;
var zn = ((e) => (e.RIGHT = "right", e.LEFT = "left", e))(zn || {});
const $e = (e) => e != null && typeof e == "object" && typeof Reflect.get(e, "taskStatus") == "string", Gt = (e) => e != null && typeof e == "object" && !Array.isArray(e) && Object.values(e).every((t) => t === null || typeof t == "string"), Zt = (e) => e != null && typeof e == "object" && !Array.isArray(e) && Object.values(e).every((t) => t === null || typeof t == "number"), Kt = (e) => Array.isArray(e) && e.every((t) => Array.isArray(t) && t.every((r) => {
if (typeof r != "object" || r === null) return !1;
const o = Reflect.get(r, "selected");
return o === "left" || o === "right" || o === null;
})), nt = (e, t) => {
const { allowUndefined: r = !0, rejectBooleanRecord: o = !1 } = t ?? {};
if (e === void 0) return r;
if (e === null || typeof e == "string" || typeof e == "number" || Array.isArray(e)) return !0;
if (typeof e == "object" && e !== null) {
if (o) {
const n = Object.values(e);
if (n.length > 0 && n.every((s) => typeof s == "boolean")) return !1;
}
return !0;
}
return !1;
}, pt = (e, t) => {
var r;
if (t === null) return null;
if (e.type === "texturlprompt") return ((o) => o === void 0 || typeof o == "object" && o !== null && "skipped" in o)(t) ? t : void 0;
if (t === void 0) return null;
if (e.type === "consentlegal") return typeof t == "object" && "submitted" in t && t.submitted === !0 ? t : null;
if (e.type === "multipleselect") {
const o = (r = e.props) == null ? void 0 : r.options;
if (Array.isArray(o) && ((n) => typeof n == "object" && n !== null && !Array.isArray(n) && Object.values(n).every((s) => typeof s == "boolean"))(t)) {
const n = t;
return o.reduce((s, i) => (n[String(i.id)] && s.push(i.value), s), []);
}
}
if (e.type === "multiplechoice") {
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
if (Object.keys(t).length === 0) return null;
const o = Object.values(t).find((n) => n !== !1 && n !== void 0);
if (o !== void 0) return o;
}
return nt(t, { allowUndefined: !1, rejectBooleanRecord: !0 }) ? t : null;
}
return nt(t, { allowUndefined: !1, rejectBooleanRecord: !0 }) ? t : null;
}, Oo = ({ storeAllResponses: e, cards: t, cardValues: r, cardIndexByName: o }) => {
const n = e ? [...e] : [];
if (o === void 0) return n;
for (const s of t) {
const i = o[s.name];
if (typeof i != "number") continue;
const u = r[s.name];
(u == null ? void 0 : u.value) !== void 0 && (n[i] = pt(s, u.value));
}
return n;
}, Jn = /<piped-value\b([^>]*)>.*?<\/piped-value>/gis, zt = ["questionHtml", "captionHtml", "footerHtml", "richTextBody"], _t = (e) => !!e.props && typeof e.props == "object" && "properties" in e.props, We = (e) => !!e.props && typeof e.props == "object" && "options" in e.props && Array.isArray(e.props.options), Jt = (e) => ["string", "number"].includes(typeof e), Yt = (e) => e.length === 0 ? "" : e.length === 1 ? e[0] : e.join(", "), Yn = (e) => {
var r, o;
const t = ((n) => n != null && typeof n == "object" && "value" in n)(e) ? e.value : void 0;
if (t != null) {
if (e.type === "multipleselect" && We(e) && ((n) => !!n && typeof n == "object" && !Array.isArray(n))(t)) {
const n = e.secondaryValue ?? null, s = e.props.options.filter((i) => t[String(i.id)] === !0).map((i) => {
var u;
return i.label + ((u = n == null ? void 0 : n[String(i.id)]) != null && u.userText ? `: ${n[String(i.id)].userText}` : "");
});
return s.length ? Yt(s) : "No options selected";
}
if (e.type === "multiplechoice" && typeof t == "object" && t !== null) {
const n = Object.keys(t);
if (n.length === 0) return "No options selected";
const s = e.secondaryValue ?? null, i = n[0];
if (i) {
const u = e.props.options.find((a) => String(a.id) === i);
return (u == null ? void 0 : u.label) + ((r = s == null ? void 0 : s[i]) != null && r.userText ? `: ${(o = s == null ? void 0 : s[i]) == null ? void 0 : o.userText}` : "");
}
}
if (e.type === "matrix" && We(e) && ((n) => {
if (!_t(n)) return !1;
const s = n.props.properties;
return !!s && typeof s == "object" && "matrixColumn" in s;
})(e)) {
const n = e.props.options, s = e.props.properties.matrixColumn, i = [];
for (const [u, a] of Object.entries(t)) {
const l = n.find((C) => String(C.id) === u), d = (l == null ? void 0 : l.label) ?? u, c = Jt(a) ? String(a) : JSON.stringify(a), f = s.find((C) => C.value === c), p = (f == null ? void 0 : f.label) ?? c;
i.push(`${d}: ${p}`);
}
return i.join("; ");
}
if (e.type === "rankorder" && We(e)) {
const n = e.props.options.reduce((i, u) => (i[String(u.id)] = u.label, i), {}), s = [];
for (const [i, u] of Object.entries(t)) {
const a = n[i];
a && (s[u - 1] = a);
}
return Yt(s);
}
if (Jt(t)) {
const n = String(t).replaceAll(/[\u200B-\u200D\uFEFF]/g, "").trim();
return n === "" ? void 0 : n;
}
try {
return JSON.stringify(t);
} catch {
return String(t);
}
}
}, Vo = (e, t) => e.map((r) => {
if (!_t(r) || r.props.properties === void 0 || r.props.properties === null) return r;
const o = r.props.properties;
if (o === null || typeof o != "object" || !zt.some((i) => i in o)) return r;
let n = !1;
const s = {};
for (const i of zt) {
const u = o[i];
if (u !== void 0) {
const a = Xn(u, t);
s[i] = a, a !== u && (n = !0);
}
}
return n ? { ...r, props: { ...r.props, properties: { ...o, ...s } } } : r;
}), Xt = (e, t) => {
const r = new RegExp(`${t}="([^"]*)"`, "i").exec(e);
return (r == null ? void 0 : r[1]) ?? null;
}, Xn = (e, t) => {
if (e == null) return e;
let r = !1;
const o = e.replace(Jn, (n, s) => {
r = !0;
const i = Xt(s, "answer-id"), u = Xt(s, "fallback-text") ?? "";
if (!i) return u;
const a = i.startsWith("attr-") ? i : Number(i);
if (Object.hasOwn(t, a)) {
const l = t[a];
return String(l);
}
return u;
});
return r ? o : e;
}, Jr = (e, t) => {
const r = {};
if (t) for (const [o, n] of Object.entries(t)) typeof n == "string" ? r[`attr-${o}`] = n : n != null && (r[`attr-${o}`] = JSON.stringify(n));
for (const o of e) {
const n = Yn(o);
n !== void 0 && (r[o.name] = n);
}
return r;
}, Uo = (e) => {
var t;
return _t(e) && ((t = e.props.properties) != null && t.questionHtml) && typeof e.props.properties.questionHtml == "string" ? e.props.properties.questionHtml.replace(/<[^>]*>/g, "").trim() : e.props && "message" in e.props && typeof e.props.message == "string" ? e.props.message.trim() : e.props && "questionHtml" in e.props && typeof e.props.questionHtml == "string" ? e.props.questionHtml.replace(/<[^>]*>/g, "").trim() : "";
}, eo = (e, t, r) => {
switch (t) {
case "videovoice":
return !!(e != null && e.value);
case "open":
return !!r;
case "multipleselect":
return !!(r && Object.keys(r).length);
case "recordedtask":
return r !== null && typeof r == "object" && "taskStatus" in r && r.taskStatus === "completed";
case "texturlprompt":
return !e.value;
case "consentlegal":
case "nps":
case "likert":
return r !== null;
case "multiplechoice":
return r !== void 0;
case "matrix":
return !!(r && Object.values(r).every((o) => o !== null));
default:
return !0;
}
}, Yr = (e, t) => {
if (t === "matrix" && e && typeof e == "object") {
const r = Object.keys(e).length, o = Object.values(e).filter((n) => n !== null).length;
return o > 0 && o < r;
}
return !1;
}, Ve = (e) => e == null ? "" : typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : String(e), ae = { eq: (e, t) => Number(e) === Number(t), neq: (e, t) => !ae.eq(e, t), gt: (e, t) => Number(e) > Number(t), gte: (e, t) => Number(e) >= Number(t), lt: (e, t) => Number(e) < Number(t), lte: (e, t) => Number(e) <= Number(t), list_exact(e, t) {
if (!Array.isArray(e) || !Array.isArray(t)) return !1;
const r = (o, n) => String(o).localeCompare(String(n));
return e.slice().sort(r).join(",") === t.slice().sort(r).join(",");
}, list_all: (e, t) => !(!Array.isArray(e) || !Array.isArray(t)) && !t.some((r) => !e.includes(r)), list_alo(e, t) {
if (!Array.isArray(t)) return !1;
const r = Array.isArray(e) ? e : [e], o = new Set(r);
return t.some((n) => o.has(n));
}, list_dni(e, t) {
if (!Array.isArray(t)) return !1;
const r = Array.isArray(e) ? e : [e], o = new Set(r);
return t.every((n) => !o.has(n));
}, contains(e, t) {
const r = Ve(e).toLowerCase(), o = Ve(t).toLowerCase();
return r.includes(o);
}, notcontains: (e, t) => !ae.contains(e, t) }, ft = (e, t, r) => r > 0 ? t ? e.length - 3 : e.length - 2 : t ? e.length - 2 : e.length - 1, Po = (e, t) => {
const r = t.findIndex((s) => s.type === "uploading"), o = t.some((s) => s.type === "thanks"), n = t.findIndex((s) => s.name === e);
return n === -1 ? !1 : n === ft(t, o, r);
}, ge = { eq: (e, t) => e == t, neq: (e, t) => !ge.eq(e, t), gt: (e, t) => Number(e) > Number(t), gte: (e, t) => Number(e) >= Number(t), lt: (e, t) => Number(e) < Number(t), lte: (e, t) => Number(e) <= Number(t), list_exact(e, t) {
if (!Array.isArray(e) || !Array.isArray(t)) return !1;
const r = (o, n) => String(o).localeCompare(String(n));
return e.slice().sort(r).join(",") === t.slice().sort(r).join(",");
}, list_all: (e, t) => !(!Array.isArray(e) || !Array.isArray(t)) && !t.some((r) => !e.includes(r)), list_alo(e, t) {
if (!Array.isArray(t)) return !1;
const r = Array.isArray(e) ? e : [e], o = new Set(r);
return t.some((n) => o.has(n));
}, list_dni(e, t) {
if (!Array.isArray(t)) return !1;
const r = Array.isArray(e) ? e : [e], o = new Set(r);
return t.every((n) => !o.has(n));
}, contains(e, t) {
const r = String(e ?? "").toLowerCase(), o = String(t ?? "").toLowerCase();
return r.includes(o);
}, notcontains: (e, t) => !ge.contains(e, t) }, to = (e) => e in ge, qe = 1, Xr = 2, ro = (e) => {
var o, n, s;
switch (e.type) {
case "multipleselect":
return e && e.props && e.props.options ? e.props.options.length > 13 ? e.props.options.map((i) => [i.value]) : (t = e.props.options.map((i) => i.value), r = !e.props.properties.required, t.reduce((i, u) => i.concat(i.map((a) => [...a, u])), [[]]).filter((i) => r || i.length > 0)) : null;
case "multiplechoice": {
if (!e || !e.props || !e.props.options) return null;
const i = e.props.options.map((u) => u.value);
return e.props.properties.required || i.push(void 0), i;
}
case "matrix": {
if (!((o = e == null ? void 0 : e.props) != null && o.options)) return null;
const i = e.props.properties.matrixColumn, u = e.props.options, a = u.reduce((d, c) => (d[c.id] = null, d), {}), l = [{ ...a, [u[0].id]: i[0].value }, u.reduce((d, c) => (d[c.id] = i[0].value, d), {})];
return e.props.properties.required || l.push(a), l;
}
case "likert": {
const i = Number((s = (n = e.props) == null ? void 0 : n.properties) == null ? void 0 : s.range) || 5;
return [...Array.from(new Array(i).keys()).map((a) => a + 1), ...e.props.properties.required ? [] : [null]];
}
case "nps":
return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...e.props.properties.required ? [] : [null]];
case "videovoice":
case "open":
return ["1", ...e.props.properties.required ? [] : [""]];
case "recordedtask": {
const i = [{ taskStatus: "completed" }, { taskStatus: "given.up" }];
return e.props.properties.required || i.push({ taskStatus: "abandoned" }), i;
}
case "texturlprompt":
return [void 0, ...e.props.properties.required ? [] : [{ skipped: !0 }]];
case "consentlegal":
return [1, ...e.props.properties.required ? [] : [null]];
default:
return [1];
}
var t, r;
}, no = (e) => typeof e == "object" && e !== null && "taskStatus" in e, oo = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && "comparator" in e && "questionIndex" in e, en = (e, t) => {
const r = [];
for (const o of e) Array.isArray(o) ? r.push(...en(o, t)) : oo(o) && o.questionIndex === t && r.push(o);
return r;
}, so = (e, t = []) => t.reduce((r, o) => {
const { group: n, target: s } = o;
if (!(n != null && n.length)) return [...r];
const i = en(n, e).map((u) => {
const { comparator: a, value: l } = u;
return { comparator: a, target: s, value: l };
});
return [...r, ...i];
}, []), tn = ({ cards: e, index: t, hasEndCard: r, allResponses: o, uploadProgress: n = {}, surveyVisitorAttributes: s = {} }) => {
var d;
if (t >= e.length || t < 0) return null;
let i = t + 1;
const u = e[t].props.routingOptions || [];
for (const c of u) {
if (!rn(c)) continue;
const { group: f, target: p } = c;
if (an({ group: f, allResponses: o, cards: e, surveyVisitorAttributes: s })) {
i = p === -1 && r ? e.length - 1 : p;
break;
}
}
const a = e.findIndex((c) => c.type === "uploading"), l = ft(e, r, a);
for (; i !== null && i !== -1 && i <= l; ) {
const c = e[i], f = ((d = c == null ? void 0 : c.props) == null ? void 0 : d.displayLogic) || [];
if (f.length > 0 && !sn({ displayLogic: f, allResponses: o, cards: e, surveyVisitorAttributes: s })) {
i++;
continue;
}
if (c != null && c.parentId) {
const p = e.findIndex((C) => C.name === c.parentId);
if (p > -1) {
const C = e[p], m = o[p], v = pe({ comparator: "answered", type: C.type, response: m }), b = C.type === "matrix" && pe({ comparator: "partial", type: C.type, response: m });
if (!(v || b)) {
i++;
continue;
}
}
}
break;
}
return t >= l || i === -1 || i !== null && i > l ? a > 0 && Object.values(n).some((f) => f.isSubmitted && !f.isComplete) ? a : r ? e.length - 1 : null : i === -1 ? null : i;
}, rn = (e) => typeof e == "object" && e !== null && "group" in e, nn = (e) => e === qe || e === Xr, er = ({ segment: e, allResponses: t, cards: r, surveyVisitorAttributes: o }) => Array.isArray(e) ? on({ segments: e, allResponses: t, cards: r, surveyVisitorAttributes: o }) : !nn(e) && !!((n) =