@sprig-technologies/sprig-browser 2.40.0 → 2.40.1

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 (33) hide show
  1. package/dist/conversational-styles-BiL7hMhj.js +4 -0
  2. package/dist/conversational-styles-DlhTFTL6.cjs +1 -0
  3. package/dist/conversational-ui-DWOygt3h.cjs +1 -0
  4. package/dist/conversational-ui-Qad4jSLB.js +579 -0
  5. package/dist/{core-CvM2f3CD.cjs → core-oShYwNGS.cjs} +3 -3
  6. package/dist/{core-CzqULo6b.js → core-swSxd_ys.js} +447 -454
  7. package/dist/core.cjs +1 -1
  8. package/dist/core.d.ts +11 -0
  9. package/dist/core.js +2 -2
  10. package/dist/debounce-CMb8f7wh.js +9 -0
  11. package/dist/debounce-DsC7462b.cjs +1 -0
  12. package/dist/{getAttributedUrl-DUesmkhh.js → getAttributedUrl-C8OLV7E9.js} +241 -244
  13. package/dist/{getAttributedUrl-C1AsMcwH.cjs → getAttributedUrl-DuHEi0A7.cjs} +6 -6
  14. package/dist/index-DCMlaRyW.cjs +1 -0
  15. package/dist/index-Zzh93qL6.js +695 -0
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.d.ts +11 -0
  18. package/dist/index.js +2 -2
  19. package/dist/{metricsReporter-BChkCOLD.js → metricsReporter-D0NmprYW.js} +1 -1
  20. package/dist/{metricsReporter-Bqy_vLyq.cjs → metricsReporter-DC-3J5Sa.cjs} +1 -1
  21. package/dist/replay.cjs +1 -1
  22. package/dist/replay.js +134 -138
  23. package/dist/view-Cu1EeVuN.js +1503 -0
  24. package/dist/view-DAxlTNxd.cjs +1 -0
  25. package/package.json +1 -1
  26. package/dist/conversational-styles-CWNea3pP.js +0 -4
  27. package/dist/conversational-styles-CzhxRRD3.cjs +0 -1
  28. package/dist/conversational-ui-D2Y5H9To.js +0 -610
  29. package/dist/conversational-ui-DJlCFQ-6.cjs +0 -1
  30. package/dist/index-D1_q2uph.cjs +0 -1
  31. package/dist/index-mshAF3wp.js +0 -709
  32. package/dist/view-C7XtFlCN.cjs +0 -1
  33. package/dist/view-afp9mz2J.js +0 -1491
@@ -0,0 +1,579 @@
1
+ import { a as A, u as e, h as $, c as L, b as j, e as J, f as fe, p as te, F as oe, _ as K, T as le, A as Ve, g as ke, i as Fe, j as Ze, k as Ye, w as Re, l as ze } from "./view-Cu1EeVuN.js";
2
+ import { v as Ke, R as V, B as X, M as z, Q as re, O as xe, a as W, b as ue, S as Xe, L as We, u as Je, H as ce, c as Ce, g as et, P as tt, p as rt, d as nt, s as st } from "./getAttributedUrl-C8OLV7E9.js";
3
+ import { a as ve, D as Te, A as _e, g as at } from "./core-swSxd_ys.js";
4
+ import { t as Le } from "./metricsReporter-D0NmprYW.js";
5
+ const it = ({ properties: t, surveyVideoUrl: s, questionId: r }) => {
6
+ const n = `ul-card-video__question_player-q${r}`, { apiURL: a, viewDocument: i } = A((o) => ({ apiURL: o.apiURL, viewDocument: o.viewDocument }));
7
+ return e("div", { id: n, ref: (o) => {
8
+ if (o && o.children.length === 0 && !t.properties.hideRecordedPrompt) {
9
+ const d = Ke(n, { src: s, type: "application/x-mpegURL" }, void 0, t.properties.mediaType === V.MEDIA_TYPE_AUDIO, a, i);
10
+ o.appendChild(d);
11
+ }
12
+ } });
13
+ }, se = ({ isDisabled: t, onClick: s, children: r }) => e(X, { className: "ul-card__button-checkmark", disabled: t, onClick: s, type: "button", children: [e("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#ffffff", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), r || "Ok"] }), lt = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
14
+ const { useMobileStyling: i, border: o } = A((k) => ({ useMobileStyling: k.useMobileStyling, border: k.border })), [d, c] = $(!1), [m, h] = $(""), [l, u] = $(!1), y = r == null ? void 0 : r.collectName, f = (r == null ? void 0 : r.nameLabelText) || "Full Name", p = (r == null ? void 0 : r.consentText) || "I agree to the stated conditions", C = (r == null ? void 0 : r.submitButtonText) || "Submit", w = !!m.trim(), v = d && (!y || w), T = (k, q = !1) => {
15
+ k.preventDefault(), k.stopPropagation();
16
+ let D = null;
17
+ if (!q) {
18
+ if (!v) return void u(!0);
19
+ D = { submitted: !0 }, y && (D.name = m);
20
+ }
21
+ s({ value: D, questionId: n, type: a }, !!q || v);
22
+ };
23
+ return e("div", { className: L(t, "ul-card__consent-legal", "fade-in-transition"), children: e(z, { embeddedType: "pdf", properties: r, children: e(re, { children: [e("div", { className: "sprig-stretch", children: [e(xe, { allowTextEntry: !1, border: o, error: l && !d, id: "consent", isRadio: !1, isSelected: d, label: p, onUserInputChanged: ({ selected: k }) => {
24
+ k !== d && c(!d);
25
+ }, useMobileStyling: i }), y && e("input", { "aria-label": f, "aria-placeholder": f, className: L(j("ul-consent-legal__name-input", i)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (k) => {
26
+ k.currentTarget.style.borderColor = l && !w ? ve : Te;
27
+ }, onFocus: (k) => {
28
+ k.currentTarget.style.borderColor = l && !w ? ve : o;
29
+ }, onInput: (k) => {
30
+ k.preventDefault(), k.stopPropagation(), h(k.currentTarget.value);
31
+ }, placeholder: f, style: l && !w ? { borderColor: ve } : {}, tabIndex: 0, value: m })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(se, { isDisabled: !v, onClick: (k) => T(new SubmitEvent(k.type)), children: J({ buttonText: C }) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (k) => T(new SubmitEvent(k.type), !0), children: fe(r) })] })] }) }) }, n);
32
+ }, ot = () => {
33
+ const { destroy: t, forceBrandedLogo: s } = A((r) => ({ destroy: r.destroy, forceBrandedLogo: r.forceBrandedLogo }));
34
+ return te(() => {
35
+ setTimeout(() => {
36
+ t(_e);
37
+ }, s ? 4e3 : 2e3);
38
+ }, [t, s]), e("div", { className: "end-of-survey-text", children: "End of survey" });
39
+ }, ct = ({ activeValue: t, border: s, icon: r, enableCspTrustedTypes: n, isPressed: a, range: i, scaleLabelType: o, selectedValue: d, setSelectedValue: c, setActiveValue: m, setIsPressed: h, useMobileStyling: l, value: u, viewDocument: y }) => {
40
+ const f = `option-${u}`, p = o === "number", C = o === "star", w = o === "smiley", v = p && u === t || u === d, [T, k] = (() => {
41
+ const _ = C && d !== null && u <= d;
42
+ return C && u <= t || w && u === t || _ || u === t || u === d ? [s, a || _ || u === d ? 1 : 0.3] : ["", 1];
43
+ })(), q = oe(() => {
44
+ const _ = { borderColor: v ? T : "", fillOpacity: v ? "" : k, zIndex: v ? 3 : "auto", color: d === u ? "#fff" : "" };
45
+ return p ? { ..._, backgroundColor: d === u ? T : "" } : { ..._, color: C || w || d === u ? T : "" };
46
+ }, [v, T, k, d, u, p, C, w]), D = oe(() => at((({ icon: _, scaleLabelType: b, value: S, selectedValue: g }) => {
47
+ if (b === "smiley" && S === g) {
48
+ let N = 0;
49
+ return _.replace(/black/g, () => ++N == 1 ? "black" : "white");
50
+ }
51
+ return _;
52
+ })({ icon: r, scaleLabelType: o, value: u, selectedValue: d }), n), [n, r, o, d, u]);
53
+ return e("button", { "aria-label": p ? void 0 : String(u), className: (() => {
54
+ switch (o) {
55
+ case "star":
56
+ return L(j("likert-star", l), j(`likert-star-${u}`, l));
57
+ case "smiley":
58
+ return L(j("likert-smiley", l), j(`likert-smiley-${u}`, l));
59
+ default:
60
+ return u === i ? L(j("likert-number", l), j(`likert-number-${u}`, l), j("likert-last-option", l)) : L(j("likert-number", l), j(`likert-number-${u}`, l));
61
+ }
62
+ })(), dangerouslySetInnerHTML: { __html: D }, id: f, onClick: (_) => {
63
+ _.preventDefault(), _.stopPropagation(), c(u);
64
+ }, onKeyDown: (_) => {
65
+ var g, N;
66
+ const b = y.querySelectorAll(`.likert-${o ?? "number"}`), S = u - 1;
67
+ _.key === "ArrowRight" ? (g = b[S + 1]) == null || g.focus() : _.key === "ArrowLeft" ? (N = b[S - 1]) == null || N.focus() : _.key !== "Enter" && _.key !== " " || (_.preventDefault(), _.stopPropagation(), c(u));
68
+ }, onPointerDown: () => h(!0), onPointerEnter: () => m(u), onPointerLeave: () => {
69
+ m(-1), h(!1);
70
+ }, style: q, tabIndex: 0 });
71
+ }, dt = ({ className: t, labels: s, next: r, properties: n, questionId: a, type: i }) => {
72
+ const { border: o, useMobileStyling: d, viewDocument: c, enableCspTrustedTypes: m } = A((b) => ({ border: b.border, useMobileStyling: b.useMobileStyling, viewDocument: b.viewDocument, enableCspTrustedTypes: b.enableCspTrustedTypes })), [h, l] = $(-1), [u, y] = $(!1), [f, p] = $(null), C = s && s.left, w = s && s.right;
73
+ let v;
74
+ const { range: T, scaleLabelType: k, ratingIcons: q } = n;
75
+ T && (v = Number(T));
76
+ const D = v || 5, _ = (b) => {
77
+ var S, g;
78
+ switch (k) {
79
+ case "star":
80
+ return (S = q[0]) == null ? void 0 : S.svg;
81
+ case "smiley":
82
+ return (g = q[b]) == null ? void 0 : g.svg;
83
+ default:
84
+ return String(b + 1);
85
+ }
86
+ };
87
+ return e("form", { className: L(t, "ul-card--likert", "fade-in-transition"), children: e(z, { properties: n, children: [e(W, { children: [e("div", { "aria-label": `Rating (1 - ${D})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(D)].map((b, S) => {
88
+ const g = S + 1;
89
+ return e(ct, { activeValue: h, border: o, enableCspTrustedTypes: m, icon: _(S), isPressed: u, range: D, scaleLabelType: k, selectedValue: f, setActiveValue: l, setIsPressed: y, setSelectedValue: p, useMobileStyling: d, value: g, viewDocument: c }, S);
90
+ }) }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: C }), e("span", { children: w })] })] }), e(re, { children: e(se, { isDisabled: f === null && n.required, onClick: () => r({ value: f, questionId: a, type: i }, !0), children: J(n) }) })] }) }, a);
91
+ }, ut = ({ columns: t, onSelect: s, options: r, selectedOptions: n }) => {
92
+ const a = K([]), { border: i, useMobileStyling: o } = A((u) => ({ border: u.border, useMobileStyling: u.useMobileStyling })), d = r.findIndex((u) => n[u.id] === null), [c, m] = $(d), h = le((u, y) => {
93
+ s(u, y);
94
+ const f = c + 1, p = r[f];
95
+ p && n[p.id] === null && m(f);
96
+ }, [s, r, n, c]), l = le((u, y) => {
97
+ const f = c === u;
98
+ return e(Ve, { animate: !0, header: y.label, isOpen: f, onClick: () => {
99
+ var p;
100
+ return m(f && !((p = window.UserLeap) != null && p.isMobileSDK) ? -1 : u);
101
+ }, ref: (p) => {
102
+ p && (a.current[u] = p);
103
+ }, showHeaderCheck: n[y.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: t.map((p) => e(xe, { allowTextEntry: !1, ariaLabel: `${y.label}-${p.label}`, border: i, error: !1, id: `${y.id}-${p.value}`, isRadio: !0, isSelected: n[y.id] === p.value, label: p.label, onUserInputChanged: () => h(y.id, p.value), useMobileStyling: o }, p.label)) }) }, y.id);
104
+ }, [i, t, c, h, n, o]);
105
+ return e("div", { children: r.map((u, y) => l(y, u)) });
106
+ }, pt = ({ className: t, next: s, options: r, properties: n, questionId: a, type: i, onSubmitButtonClick: o }) => {
107
+ const d = n.matrixColumn, c = n.required, m = (f) => {
108
+ f.preventDefault(), f.stopPropagation(), s({ value: l, questionId: a, type: i }, !0), o && o();
109
+ }, h = r.reduce((f, p) => (f[p.id] = null, f), {}), [l, u] = $(h);
110
+ return e("form", { className: L(t, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: m, children: e(z, { properties: n, children: [e(W, { children: e(ut, { columns: d, onSelect: (f, p) => {
111
+ u((C) => ({ ...C, [f]: p }));
112
+ }, options: r, selectedOptions: l }) }), e(re, { children: e(se, { isDisabled: (y = l, c && Object.values(y).every((f) => f == null)), onClick: () => m(new SubmitEvent("submit")), children: J(n) }) })] }) }, a);
113
+ var y;
114
+ }, Me = ({ className: t, onSubmit: s, options: r = [], properties: n, questionId: a, type: i, showIndividualSubmit: o = !1, onSubmitButtonClick: d }) => {
115
+ const { border: c, useMobileStyling: m } = A((g) => ({ border: g.border, useMobileStyling: g.useMobileStyling })), h = r.reduce((g, N) => (g[N.id] = { isSelected: !1 }, g), {}), [l, u] = $(h), y = i === "multiplechoice", f = n.required, p = r.find((g) => {
116
+ var N;
117
+ return (N = g.optionProperties) == null ? void 0 : N.noneOfTheAbove;
118
+ }), C = (g) => Object.entries(g).some(([N, B]) => {
119
+ var Q;
120
+ const H = r.find((ee) => `${ee.id}` === N), O = B.userText === void 0 || B.userText.trim() === "";
121
+ return ((Q = H == null ? void 0 : H.optionProperties) == null ? void 0 : Q.allowsTextEntry) && O && B.isSelected;
122
+ }), w = (g) => Object.values(g).filter((N) => N.isSelected).length, v = n.minSelect && n.minSelect > 0 && n.maxSelectMode === ue.Range && w(l) < n.minSelect && (f || w(l) > 0), T = (g) => C(g) || f && !w(g) || !((N) => {
123
+ const { minSelect: B = 0, maxSelect: H = 1 / 0, maxSelectMode: O } = n, Q = w(N);
124
+ switch (O) {
125
+ case ue.Maximum:
126
+ return Q <= H;
127
+ case ue.Range:
128
+ return Q === 0 || Q >= B;
129
+ default:
130
+ return !0;
131
+ }
132
+ })(g), k = Object.entries(l).some(([g, N]) => {
133
+ var B, H;
134
+ return N.isSelected && ((H = (B = r.find((O) => `${O.id}` === g)) == null ? void 0 : B.optionProperties) == null ? void 0 : H.allowsTextEntry);
135
+ }), q = o && (!y || k), D = (g) => {
136
+ S(g.id, g.selected, g.userText, g.noneOfTheAbove);
137
+ }, _ = (g) => {
138
+ var N;
139
+ return (n == null ? void 0 : n.maxSelectMode) !== ue.Unlimited && w(l) === (n == null ? void 0 : n.maxSelect) && !((N = l[g]) != null && N.isSelected);
140
+ }, b = () => {
141
+ s(l, !0), d && d();
142
+ }, S = (g, N, B, H) => {
143
+ const O = Object.assign({}, l);
144
+ if ((y || H) && N) for (const Q of Object.values(O)) Q.isSelected = !1, delete Q.userText;
145
+ else p && !H && l[p.id].isSelected && (O[p.id].isSelected = !1);
146
+ O[g] = { isSelected: N, userText: B }, u(O);
147
+ };
148
+ return e("form", { className: L(t, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: b, children: e(z, { properties: n, children: [e(W, { children: [n.isDropdown ? e(Xe, { disabledOptions: r.filter((g) => _(g.id)), dropdownFooter: v ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [w(l), "/", n.minSelect] }) : void 0, isMultiSelect: !y, multiselectText: n.dropdownMultiselectedText ?? "choices selected", onChange: (g) => {
149
+ const N = { ...l };
150
+ for (const B of r) g.includes(B) ? N[B.id].isSelected = !0 : N[B.id].isSelected = !1;
151
+ u(N);
152
+ }, options: r, placeholderText: n.dropdownPlaceholderText ?? (y ? "Select choice" : "Select choice(s)"), value: r.filter((g) => l[g.id].isSelected) }) : e("div", { className: L(j("ul-card__choices", m)), role: y ? "radiogroup" : "group", children: [r.map(({ id: g, label: N, value: B, optionProperties: H }) => {
153
+ var G, ne;
154
+ const O = `${g}`, { allowsTextEntry: Q, noneOfTheAbove: ee } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...H };
155
+ return e(xe, { allowTextEntry: Q, border: c, disabled: _(O), error: (Z = l, C(Z)), id: O, isRadio: y, isSelected: !!((G = l[O]) != null && G.isSelected), label: N, noneOfTheAbove: ee, onUserInputChanged: D, promptText: "Please specify", text: (ne = l[g]) == null ? void 0 : ne.userText, useMobileStyling: m, value: B }, O);
156
+ var Z;
157
+ }), !!v && e("div", { className: "ul-card__min-select-counter", children: [w(l), "/", n.minSelect] })] }), q && e(We, { handleSubmit: b, isSubmitDisabled: T(l) })] }), e(re, { children: e(se, { isDisabled: T(l), onClick: b, children: J(n) }) })] }) }, a);
158
+ }, mt = (t) => {
159
+ const { questionId: s, type: r, next: n, options: a } = t;
160
+ return e(Me, { ...t, onSubmit: (i, o) => {
161
+ const d = Object.entries(i).find(([, u]) => u.isSelected) || [void 0, void 0], [c, m] = d, h = a.find((u) => `${u.id}` === c), l = m != null && m.userText ? { [c]: { userText: m.userText } } : null;
162
+ n({ value: h && c ? { [c]: h.value } : {}, secondaryValue: l, questionId: s, type: r }, o);
163
+ } });
164
+ }, ht = (t) => {
165
+ const { questionId: s, type: r, next: n } = t;
166
+ return e(Me, { ...t, onSubmit: (a, i) => {
167
+ const o = Object.entries(a).reduce((c, [m, h]) => (c[m] = h.isSelected, c), {}), d = Object.entries(a).reduce((c, [m, h]) => {
168
+ if (!h.userText) return c;
169
+ const l = c || {};
170
+ return l[m] = { userText: h.userText }, l;
171
+ }, null);
172
+ n({ value: o, secondaryValue: d, questionId: s, type: r }, i);
173
+ } });
174
+ }, vt = ({ className: t, labels: s, properties: r, next: n, questionId: a, type: i }) => {
175
+ const [o, d] = $(null), { border: c, useMobileStyling: m, viewDocument: h } = A((y) => ({ border: y.border, useMobileStyling: y.useMobileStyling, viewDocument: y.viewDocument })), l = s && s.left, u = s && s.right;
176
+ return e("form", { className: L(t, "ul-card--nps", "fade-in-transition"), children: e(z, { properties: r, children: [e(W, { children: [e("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((y, f) => e("button", { className: L(j("nps-number", m), j(`nps-number-${f}`, m)), id: `option-${f}`, onClick: (p) => {
177
+ p.preventDefault(), p.stopPropagation(), d(f);
178
+ }, onKeyDown: (p) => {
179
+ var w, v;
180
+ const C = h.querySelectorAll("button.nps-number");
181
+ p.key === "ArrowRight" ? (w = C[f + 1]) == null || w.focus() : p.key === "ArrowLeft" ? (v = C[f - 1]) == null || v.focus() : p.key !== "Enter" && p.key !== " " || (p.preventDefault(), p.stopPropagation(), d(f));
182
+ }, onPointerDown: (p) => {
183
+ p.currentTarget.style.zIndex = "2", p.currentTarget.style.borderColor = c;
184
+ }, onPointerLeave: (p) => {
185
+ p.currentTarget.style.zIndex = "auto", p.currentTarget.style.borderColor = Te;
186
+ }, style: o === f ? { backgroundColor: c, color: "#fff" } : void 0, tabIndex: 0, children: f }, f)) }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: l }), e("span", { children: u })] })] }), e(re, { children: e(se, { isDisabled: o === null && r.required, onClick: () => n({ value: o, questionId: a, type: i }, !0), children: J(r) }) })] }) }, a);
187
+ }, gt = ({ className: t, next: s, properties: r, questionId: n, type: a, onSubmitButtonClick: i }) => {
188
+ const { border: o, useMobileStyling: d, update: c } = A((C) => ({ border: C.border, useMobileStyling: C.useMobileStyling, update: C.update })), [m, h] = $(""), l = K(null), u = m.trim(), y = r.required === !0 && !u, f = Je(l, () => c()), p = r && r.openTextPlaceholder ? r.openTextPlaceholder : "";
189
+ return e("form", { className: L(t, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(z, { properties: r, children: e("div", { className: "ul-card-text", children: [e(W, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": p, className: L(j("ul-card-text__input", d)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (C) => {
190
+ C.currentTarget.style.borderColor = Te;
191
+ }, onChange: (C) => {
192
+ const { value: w } = C.currentTarget;
193
+ f(), C.preventDefault(), C.stopPropagation(), h(w);
194
+ }, onFocus: (C) => {
195
+ C.currentTarget.style.borderColor = o;
196
+ }, placeholder: p, ref: l, role: "textbox", tabIndex: 0 }) }), r.footerHtml && e(ce, { className: "footer", html: r.footerHtml })] }), e(re, { children: e(se, { isDisabled: y, onClick: (C) => {
197
+ C.preventDefault(), C.stopPropagation();
198
+ const w = r.required !== !0 || u.length > 0;
199
+ s({ value: m, questionId: n, type: a }, w), i && i();
200
+ }, children: J(r) }) })] }) }) }, n);
201
+ }, bt = ({ className: t, labels: s, next: r, properties: n, questionId: a, type: i, onSubmitButtonClick: o, options: d }) => {
202
+ const c = K(null), m = K(0), h = K(0), l = K(null), u = K(!1), y = K([]), [f, p] = $(() => (n == null ? void 0 : n.required) === !0), [C, w] = $(() => d.map((x) => ({ ...x, rank: null }))), v = oe(() => Array.from({ length: d.length }, (x, P) => P + 1), [d.length]), { useMobileStyling: T, isPreview: k, headers: q } = A((x) => ({ useMobileStyling: x.useMobileStyling, isPreview: x.isPreview, headers: x.headers })), D = (q == null ? void 0 : q["userleap-platform"]) === "android", _ = T && !k && !D, b = !_ && !D, S = (x, P) => {
203
+ w((R) => {
204
+ const I = parseInt(P), U = R.map((M) => ({ ...M }));
205
+ U.some((M) => M.rank == null) && U.forEach((M, ae) => M.rank = ae + 1);
206
+ const F = U.findIndex((M) => M.id === x);
207
+ if (F === -1) return R;
208
+ const E = U[F].rank;
209
+ return I < E ? U.forEach((M) => {
210
+ M.id !== x && M.rank >= I && M.rank < E && (M.rank = M.rank + 1);
211
+ }) : I > E && U.forEach((M) => {
212
+ M.id !== x && M.rank > E && M.rank <= I && (M.rank = M.rank - 1);
213
+ }), U[F].rank = I, U.sort((M, ae) => M.rank - ae.rank), ee(), U;
214
+ });
215
+ }, g = (x, P) => {
216
+ for (let R = 0; R < y.current.length; R++) {
217
+ const I = y.current[R];
218
+ if (!I || I === l.current) continue;
219
+ const U = I.getBoundingClientRect();
220
+ if (x >= U.left && x <= U.right && P >= U.top && P <= U.bottom) return { element: I, index: R };
221
+ }
222
+ return null;
223
+ }, N = (x) => (P) => {
224
+ if (!_) return;
225
+ P.preventDefault(), P.stopPropagation(), u.current = !0, c.current = x;
226
+ const R = P.touches[0];
227
+ m.current = R.clientY, h.current = R.clientY;
228
+ const I = P.currentTarget.closest(".ul-card-rank__option");
229
+ I && (l.current = I, I.classList.add("is-dragging"));
230
+ }, B = (x) => {
231
+ if (!_ || !u.current || c.current === null) return;
232
+ x.preventDefault(), x.stopPropagation();
233
+ const P = x.touches[0];
234
+ h.current = P.clientY;
235
+ const R = h.current - m.current;
236
+ l.current && (l.current.style.transform = `translateY(${R}px)`, l.current.style.zIndex = "1000"), y.current.forEach((U) => {
237
+ U && U !== l.current && U.classList.remove("is-drop-target");
238
+ });
239
+ const I = g(P.clientX, P.clientY);
240
+ I && I.element.classList.add("is-drop-target");
241
+ }, H = (x) => {
242
+ if (!_ || !u.current || c.current === null) return;
243
+ x.preventDefault(), x.stopPropagation();
244
+ const P = x.changedTouches[0], R = g(P.clientX, P.clientY);
245
+ l.current && (l.current.style.transform = "", l.current.style.zIndex = "", l.current.classList.remove("is-dragging")), y.current.forEach((I) => {
246
+ I && I.classList.remove("is-drop-target");
247
+ }), R && R.index !== c.current && O(c.current, R.index), c.current = null, l.current = null, u.current = !1;
248
+ }, O = (x, P) => {
249
+ w((R) => {
250
+ const I = R.map((F) => ({ ...F })), [U] = I.splice(x, 1);
251
+ return I.splice(P, 0, U), I.forEach((F, E) => {
252
+ F.rank = E + 1;
253
+ }), ee(), I;
254
+ });
255
+ }, Q = (x) => {
256
+ const P = {};
257
+ x.reduce((R, I) => (R[I.id] = I.rank, R), P), r({ value: P, questionId: a, type: i }, !0);
258
+ }, ee = () => {
259
+ p(!1);
260
+ }, { left: Z, right: G } = s, ne = d.length, de = (x) => {
261
+ x.preventDefault(), x.currentTarget.classList.add("is-drop-target");
262
+ }, Ge = (x) => {
263
+ x.currentTarget.classList.remove("is-drop-target");
264
+ }, je = (x) => {
265
+ c.current = null, x.currentTarget.classList.remove("is-dragging");
266
+ };
267
+ return e("form", { className: L(t, "ul-card-rank", "fade-in-transition"), onSubmit: (x) => {
268
+ x.preventDefault(), Q(C), o && o();
269
+ }, children: e(z, { properties: n, children: D ? e(W, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", Z] }) }), e("ol", { className: "ul-card-rank__list", children: C.map(({ id: x, label: P, rank: R }) => e("li", { className: "ul-card-rank__option", children: [e("select", { "aria-label": `Rank for ${P}`, className: L("ul-card-rank__select", R == null && "ul-card-rank__select--placeholder"), name: `rank[${x}]`, onChange: (I) => S(x, I.currentTarget.value), value: R ?? "", children: [R == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), v.map((I) => e("option", { className: "ul-card-rank__select-option", value: I, children: I }, `${I}-${a}`))] }), e("span", { children: P })] }, x)) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", G] }) })] }) }) : e(ke, { children: [e(W, { children: e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", Z] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: D ? void 0 : (x) => {
270
+ x.preventDefault(), x.dataTransfer && (x.dataTransfer.dropEffect = "move");
271
+ }, children: C.map(({ id: x, label: P, rank: R }, I) => {
272
+ return e("li", { className: "ul-card-rank__option", draggable: !!b || void 0, onDragEnd: b ? je : void 0, onDragEnter: b ? de : void 0, onDragLeave: b ? Ge : void 0, onDragStart: b ? (F = I, (E) => {
273
+ c.current = F, E.dataTransfer && (E.dataTransfer.effectAllowed = "move", E.dataTransfer.setData("text/plain", String(F)), E.currentTarget.classList.add("is-dragging"));
274
+ }) : void 0, onDrop: b ? (U = I, (E) => {
275
+ var ae, Ie;
276
+ E.preventDefault(), E.currentTarget.classList.remove("is-drop-target");
277
+ const M = c.current;
278
+ c.current = null, (Ie = (ae = E.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : ae.querySelector(".is-dragging")) == null || Ie.classList.remove("is-dragging"), M != null && M !== U && O(M, U);
279
+ }) : void 0, ref: (E) => y.current[I] = E, children: [e("select", { "aria-label": `Rank for ${P}`, className: L("ul-card-rank__select", R == null && "ul-card-rank__select--placeholder"), name: `rank[${x}]`, onChange: (E) => S(x, E.currentTarget.value), value: R ?? "", children: [R == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), v.map((E) => e("option", { className: "ul-card-rank__select-option", value: E, children: E }, E))] }), e("span", { children: P }), !D && e("button", { "aria-label": `Drag ${P} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: _ ? H : void 0, onTouchMove: _ ? B : void 0, onTouchStart: _ ? N(I) : void 0, title: "Drag to reorder", type: "button", children: e("svg", { fill: "none", height: "17", viewBox: "0 0 16 17", width: "16", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z", fill: "currentColor" }) }) })] }, x);
280
+ var U, F;
281
+ }) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [ne, " - ", G] }) })] }) }), e(re, { children: e("div", { className: "ul-card__button-wrapper", children: e(X, { disabled: f, children: J(n) }) }) })] }) }) }, a);
282
+ }, ge = 1, Ue = 2, Ee = 3, pe = (t) => t.type === "av_permission", De = (t) => t.type === "screen_permission", Ae = (t, s) => t === void 0 ? ge : t ? ((r, n) => !(pe(n) ? n.permissionDescriptors : []).includes("camera") || r.getVideoTracks().length > 0)(t, s) ? Ee : ge : Ue, we = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
283
+ }, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, Y = Fe((t) => ({ ...we, reset: () => {
284
+ t(we);
285
+ }, updatePage: (s) => {
286
+ t(s);
287
+ } }));
288
+ function be({ currentPage: t, pages: s }) {
289
+ const { avStream: r, recordingMediaTypes: n, updatePage: a } = Y.getState(), { recorderEventEmitter: i } = A.getState();
290
+ i.emit("av.permission", { "permission.descriptors": t.permissionDescriptors, "stream.ready": (o, d) => {
291
+ if (r === o) return;
292
+ let c = t;
293
+ if (o && !t.permissionDescriptors.includes("camera")) {
294
+ const m = s.indexOf(t), h = d != null && d.active ? m + 2 : m + 1;
295
+ d != null && d.active && n && i.emit("begin.recording", { "recording.media.types": n, "start.recording.callback": (l) => a({ mediaRecordingUids: l }) }), c = s[h];
296
+ }
297
+ a({ currentPage: c, avStream: o });
298
+ } });
299
+ }
300
+ function ye({ status: t }) {
301
+ const { nextQuestion: s, passthroughData: r, mediaRecordingUids: n, reset: a } = Y.getState(), { recorderEventEmitter: i, handleUploadUpdate: o, index: d } = A.getState(), c = { value: { taskStatus: t }, type: "recordedtask", questionId: (r == null ? void 0 : r.questionId) || 1 };
302
+ r && i.emit("finish.task", { "begin.callback": (m) => {
303
+ o({ mediaRecordingUid: m, isSubmitted: !0, progressPct: 0, isComplete: !1 });
304
+ }, "progress.callback": (m, h) => {
305
+ o({ mediaRecordingUid: m, progressPct: h.detail, isSubmitted: !1, isComplete: !1 });
306
+ }, "upload.callback": (m) => {
307
+ m && o({ mediaRecordingUid: m, isComplete: !0, isSubmitted: !0, progressPct: 100 });
308
+ }, "passthrough.data": r, "current.index": d, "task.response": c, "task.complete.callback": (m) => {
309
+ c.value.taskDurationMillisecond = m, n && (c.value.mediaRecordingUids = n), a(), s(c);
310
+ } });
311
+ }
312
+ function Se({ pages: t, setIsRequestingPermission: s }) {
313
+ const { recorderEventEmitter: r, eventEmitFn: n } = A.getState(), { updatePage: a, currentPage: i, recordingMediaTypes: o, screenPermissionRequested: d } = Y.getState();
314
+ if (!i) return;
315
+ const c = t.indexOf(i);
316
+ switch (i.type) {
317
+ case "av_permission": {
318
+ const m = d ? c + 2 : c + 1;
319
+ return d && o && r.emit("begin.recording", { "recording.media.types": o, "start.recording.callback": (h) => {
320
+ a({ mediaRecordingUids: h });
321
+ } }), void a({ currentPage: t[m] });
322
+ }
323
+ case "screen_permission":
324
+ return void r.emit("screen.permission", { "screen.permission.requested": s, "stream.ready.callback": (m, h) => {
325
+ const l = h ? t[c + 1] : i;
326
+ h && o && r.emit("begin.recording", { "recording.media.types": o, "start.recording.callback": (u) => {
327
+ a({ captureStream: h, mediaRecordingUids: u });
328
+ } }), a({ currentPage: l, screenPermissionRequested: !0, captureStream: h });
329
+ } });
330
+ case "start_task":
331
+ return n("recorded.task.start"), r.emit("recorded.task.start"), r.emit("start.task"), void a({ currentPage: t[c + 1], screenPermissionRequested: !0 });
332
+ case "complete_task":
333
+ return;
334
+ }
335
+ }
336
+ const $e = "ul-permission-graphics-container", Be = "ul-permission-body", Oe = L($e, "ul_recorded-task-inset-spacing"), me = L("ul-horizontal-button-container", "ul-horizontal-button-container-left"), He = ({ richTextBody: t }) => e(ce, { className: "ul-rich-text-body", html: t, id: "ul-task-detail-container" }), he = ({ required: t, skipButtonText: s, bottom: r = !1 }) => t ? null : e(X, { className: L(r && "ul-skip-button-below", "ul-button-inactive"), onClick: ye.bind(null, { status: "abandoned" }), children: s || "Skip" }), Ne = (t) => {
337
+ const { avStream: s, captureStream: r, recordingMediaTypes: n, updatePage: a } = Y.getState(), i = (n == null ? void 0 : n.includes("audio")) || (n == null ? void 0 : n.includes("video"));
338
+ te(() => {
339
+ const o = setInterval(() => {
340
+ i && s && !s.active ? a({ avStream: null, currentPage: t[0] }) : r && r.active || a({ captureStream: void 0, currentPage: t[i ? 1 : 0] });
341
+ }, 1e3);
342
+ return () => clearInterval(o);
343
+ }, [s, r, i, t, n, a]);
344
+ }, yt = ({ content: t, pages: s, required: r }) => {
345
+ const { buttonText: n, skipButtonText: a, taskDetail: i } = t;
346
+ return Ne(s), e("div", { className: "ul-task-page", children: [i && e(He, { richTextBody: i }), e("div", { className: me, children: [e(X, { onClick: Se.bind(null, { pages: s }), children: n }), e(he, { required: r, skipButtonText: a })] })] }, "start-task");
347
+ }, ft = ({ content: t, pages: s, properties: r }) => {
348
+ const { buttonText: n, skipButtonText: a } = t;
349
+ return Ne(s), e("div", { className: "ul-task-page", children: [t.taskDetail && e(He, { richTextBody: t.taskDetail }), e(z, { properties: r, children: e("div", { className: me, children: [e(X, { className: "ul-complete-task-button", onClick: ye.bind(null, { status: "completed" }), children: n }), e(X, { className: L("ul-button-inactive"), onClick: ye.bind(null, { status: "given.up" }), children: a })] }) })] }, "complete-task");
350
+ }, kt = ({ content: t, pages: s, required: r }) => {
351
+ const { buttonText: n, skipButtonText: a } = t, [i] = A((c) => [c.tabTitle]), [o, d] = $(!1);
352
+ return e("div", { children: [e("div", { className: Oe, children: [e("p", { style: { marginTop: "auto" }, children: t.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: Be, children: i }) })] }), e("div", { className: r ? "" : me, children: [e(X, { disabled: o, onClick: Se.bind(null, { pages: s, setIsRequestingPermission: d }), children: n }), e(he, { required: r, skipButtonText: a })] })] });
353
+ }, xt = ({ content: t }) => e(ce, { className: L($e, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), html: t.svg }, "ul-permission-request-graphic"), Ct = ({ content: t, pages: s, required: r }) => {
354
+ const { permissionDeniedHeadline: n, permissionDeniedBody: a, skipButtonText: i, tryAgainButtonText: o } = t, d = pe(s[0]) ? s[0] : null;
355
+ return te(() => {
356
+ const c = setInterval(() => {
357
+ d !== null && be({ currentPage: d, pages: s });
358
+ }, 1e3);
359
+ return () => clearInterval(c);
360
+ }, [d, s]), d ? e("div", { children: [e("div", { className: Oe, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: n }), e("span", { className: Be, children: a })] }) }), e("div", { className: me, children: [e(X, { onClick: be.bind(null, { currentPage: d, pages: s }), children: o }), e(he, { required: r, skipButtonText: i })] })] }) : null;
361
+ }, Tt = ({ stream: t }) => e("video", { autoPlay: !0, className: L("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (s) => {
362
+ s && (s.srcObject = t || null);
363
+ } }), _t = ({ content: t, pages: s, required: r }) => {
364
+ const { skipButtonText: n } = t, { avStream: a } = Y.getState();
365
+ return Ne(s), e("div", { children: [e(Tt, { stream: a }), e("div", { className: "ul-vertical-button-container-center", children: [e(X, { onClick: Se.bind(null, { pages: s }), children: t.buttonText }), e(he, { bottom: !0, required: r, skipButtonText: n })] })] });
366
+ }, St = ({ properties: t }) => {
367
+ const { pages: s, required: r } = t, { avStream: n, currentPage: a } = Y.getState();
368
+ if (a === void 0) return null;
369
+ switch (a == null ? void 0 : a.type) {
370
+ case "av_permission": {
371
+ const i = Ae(n, a);
372
+ return i === ge ? e(xt, { content: a }) : e(i === Ue ? Ct : _t, { content: a, pages: s, required: r });
373
+ }
374
+ case "screen_permission":
375
+ return e(kt, { content: a, pages: s, required: r });
376
+ case "start_task":
377
+ return e(yt, { content: a, pages: s, required: r });
378
+ case "complete_task":
379
+ return e(ft, { content: a, pages: s, properties: t });
380
+ default:
381
+ return null;
382
+ }
383
+ }, Nt = ({ className: t, properties: s, next: r, questionId: n }) => {
384
+ const a = A(), { surveyId: i, responseGroupUid: o, userId: d } = a, c = Y(), { screenPermissionRequested: m } = c, h = Y((p) => p.avStream);
385
+ let l = Y((p) => p.currentPage);
386
+ l || (l = function({ pages: p, userId: C, responseGroupUid: w, surveyId: v, questionId: T, next: k }) {
387
+ const { updatePage: q } = Y.getState(), { eventEmitFn: D, recorderEventEmitter: _ } = A.getState(), b = { questionId: T, surveyId: v, visitorId: C, responseGroupUid: w };
388
+ let S = 0;
389
+ _.emit("recorded.task.permission.screen"), D("recorded.task.permission.screen"), _.emit("permission.status", { "permission.status.callback": (N, B, H, O) => {
390
+ const Q = p[S], { type: ee } = Q, Z = ["screen"];
391
+ if (pe(Q)) {
392
+ const { permissionDescriptors: G } = Q, ne = G == null ? void 0 : G.includes("microphone"), de = G == null ? void 0 : G.includes("camera");
393
+ ne && Z.push("audio"), de && Z.push("video"), (N != null && N.active && !de || N != null && N.active && B) && S++;
394
+ }
395
+ De(p[S]) && H && (S++, _.emit("begin.recording", { "recording.media.types": Z, "start.recording.callback": (G) => q({ mediaRecordingUids: G }) })), q({ currentPage: p[S], avStream: N, screenPermissionRequested: H, nextQuestion: k, type: ee, passthroughData: b, recordingMediaTypes: Z, captureStream: O });
396
+ } });
397
+ const g = p[S];
398
+ return g.type === "av_permission" && be({ currentPage: g, pages: p }), g;
399
+ }({ questionId: n, surveyId: i, next: (p) => {
400
+ r(p, !0);
401
+ }, pages: s.pages, responseGroupUid: o, userId: d }));
402
+ let u = l.headline, y = l.captionText;
403
+ const f = Ae(h, l);
404
+ return De(l) && m && (u = l.permissionDeniedHeadline, y = l.permissionDeniedCaptionText), pe(l) && f === Ee && (u = l.permissionGrantedHeadline, y = l.permissionGrantedCaptionText), e("div", { className: L(t, "ul-center-horizontally", "fade-in-transition"), children: [e(Ce, { isRequired: s == null ? void 0 : s.required, message: u, properties: { captionText: y } }), e(W, { children: e(St, { properties: s }) })] });
405
+ }, It = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
406
+ const { visitorAttributes: i, isLongFormSurvey: o } = A((h) => ({ visitorAttributes: h.visitorAttributes, isLongFormSurvey: Le(h.studyType) })), d = (h, l = !1) => {
407
+ s({ value: l ? { skipped: !0 } : void 0, questionId: n, type: a }, !0);
408
+ }, c = et(r && r.buttonUrl, i), m = o && r.promptActionType === tt.NO_BUTTON;
409
+ return e("div", { className: L(t, "ul-card__text-url-prompt", "fade-in-transition"), children: e(z, { properties: r, children: !m && e("div", { children: e("div", { className: "ul-card-button-group", children: [e("a", { className: "ul-card-text__button ul-card__text-url-prompt-button", href: c, id: "ul-card-text__button", onClick: d, onKeyPress: (h) => {
410
+ h.key !== "Enter" && h.key !== " " || s({ value: void 0, questionId: n, type: a }, !0);
411
+ }, rel: "noreferrer", role: c ? "link" : "button", tabIndex: 0, target: "_blank", children: J(r) }), r.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (h) => d(0, !0), children: fe(r) })] }) }) }) }, n);
412
+ }, Dt = ({ className: t, questionId: s }) => {
413
+ const { border: r, destroy: n, endCard: a, forceBrandedLogo: i } = A((c) => ({ border: c.border, destroy: c.destroy, endCard: c.endCard, forceBrandedLogo: c.forceBrandedLogo }));
414
+ te(() => {
415
+ setTimeout(() => {
416
+ n(_e);
417
+ }, i ? 4e3 : 2e3);
418
+ }, [n, i]);
419
+ const o = a && a.subheader ? e("p", { className: "ul-caption", children: a.subheader }) : null, d = a && a.headline ? a.headline : "";
420
+ return e("div", { className: L(t, "ul-card--thanks", "fade-in-transition"), children: e("div", { children: e("div", { className: "ul-card--thanks-content", children: [e("div", { className: "ul-thanks-check", children: e("svg", { "aria-labelledby": "title", fill: "none", height: "99", viewBox: "0 0 81 99", width: "81", xmlns: "http://www.w3.org/2000/svg", children: [e("path", { clipRule: "evenodd", d: "M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z", fill: r, fillRule: "evenodd" }), e("path", { clipRule: "evenodd", d: "M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z", fill: r, fillRule: "evenodd" }), e("path", { d: "M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z", fill: "black", fillOpacity: "0.2" })] }) }), e(Ce, { message: d }), o] }) }) }, s);
421
+ }, wt = () => e("div", { className: "thinking-dots-container", children: e("div", { className: "thinking-dot" }) }), qt = ({ className: t }) => {
422
+ const { uploadProgress: s } = A((i) => ({ uploadProgress: i.uploadProgress }));
423
+ let r, n;
424
+ Object.values(s).filter((i) => i.isSubmitted).length > 1 ? (r = "Your responses are processing", n = "Please keep this tab open until your responses are fully processed.") : (r = "Your response is processing", n = "Please keep this tab open until your response is fully processed.");
425
+ const a = Math.round(Math.min(99, ...Object.values(s).filter((i) => i.isSubmitted).map((i) => i.progressPct || 0)));
426
+ return e("div", { className: L(t, "ul-card--uploading", "fade-in-transition"), children: [e("div", { "aria-busy": "true", "aria-label": "Processing...", "aria-live": "polite", className: "ul-loading-spinner-container", role: "progressbar", children: e("div", { className: "ul-loading-spinner", children: [e("div", { className: "first" }), e("div", { className: "second" }), e("div", { className: "third" }), e("div", { className: "fourth" })] }) }), e(Ce, { message: `${r} (${a}% complete)` }), e("p", { className: "ul-caption", children: n })] });
427
+ }, qe = 0, Pe = 1, Pt = ({ className: t, next: s, properties: r, questionId: n, type: a }) => {
428
+ const i = `ul-card-video__player_recorder-q${n}`, { apiURL: o, envId: d, handleUploadUpdate: c, headers: m, responseGroupUid: h, surveyId: l, viewDocument: u, visitorId: y } = A((b) => ({ apiURL: b.apiURL, envId: b.envId, handleUploadUpdate: b.handleUploadUpdate, headers: b.headers, responseGroupUid: b.responseGroupUid, surveyId: b.surveyId, viewDocument: b.viewDocument, visitorId: b.userId })), [f, p] = $(!1), [C, w] = $(null), [v, T] = $(null), [k, q] = $(qe), D = (b, S) => {
429
+ b === V.UPLOAD_STARTED ? (w(S[V.UPLOAD_ID]), T(S[V.MEDIA_RECORDING_UID]), p(!0)) : b === V.DELETE ? (w(null), T(null), p(!1)) : b === V.UPLOAD_PROGRESS ? isNaN(S[V.UPLOAD_PROGRESS_PCT]) ? c({ mediaRecordingUid: S[V.MEDIA_RECORDING_UID], isComplete: !0 }) : c({ mediaRecordingUid: S[V.MEDIA_RECORDING_UID], progressPct: S[V.UPLOAD_PROGRESS_PCT] }) : b === V.UPLOAD_FINISHED && c({ mediaRecordingUid: S[V.MEDIA_RECORDING_UID], isComplete: !0 });
430
+ }, _ = (b) => {
431
+ b.preventDefault(), b.stopPropagation(), document.getElementById(i) && st(i), C && v ? (c({ mediaRecordingUid: v, isSubmitted: !0 }), s({ value: { mediaRecordingUid: v }, questionId: n, type: a }, !0)) : s({ value: null, questionId: n, type: a }, !0);
432
+ };
433
+ return e("form", { className: L(t, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(W, { children: [e("div", { id: "ul-question-player-container", style: { display: k === qe ? "" : "none" }, children: e(z, { properties: r, children: e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (b) => {
434
+ b.preventDefault(), b.stopPropagation(), document.getElementById(i) && rt(i), q(Pe);
435
+ } }) }) }), e("div", { style: { display: k === Pe ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (b) => {
436
+ if (b && b.children.length === 0) {
437
+ const S = nt(i, { surveyId: l, responseGroupUid: h, questionId: n, visitorId: y, envId: d }, o, D, void 0, { ...m, "x-ul-video-recorder-origin": "sdk" }, r.mediaType === V.MEDIA_TYPE_AUDIO, u);
438
+ b.appendChild(S);
439
+ }
440
+ } }) })] }), e(re, { children: [e(se, { isDisabled: !!r.required && !f, onClick: _, children: J(r) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: _, style: { ...r.required ? { display: "none" } : {}, ...f ? { display: "none" } : {} }, children: fe(r) })] })] });
441
+ }, Qe = (t) => t.type === "thanks" || t.type === "uploading", Rt = ({ card: t, avatars: s, isThinking: r, isCurrentQuestion: n, currentQuestionBubbleRef: a }) => {
442
+ const i = ((o) => "properties" in o.props && o.props.properties && "questionHtml" in o.props.properties && o.props.properties.questionHtml ? { content: o.props.properties.questionHtml, isHtml: !0 } : "message" in o.props ? { content: o.props.message, isHtml: !1 } : { content: "Question", isHtml: !1 })(t);
443
+ return e(ie, { avatars: s, isLeft: !0, message: { id: `question-${t.name}`, type: "question", content: i.content }, ref: n ? a : null, children: r ? e(wt, {}) : e(ke, { children: [i.isHtml ? e(ce, { className: "chat-message-text", html: i.content }) : e("div", { className: "chat-message-text", children: i.content }), t.type === "videovoice" && e(it, { properties: t.props, questionId: t.name, surveyVideoUrl: t.props.properties.videoUrl })] }) });
444
+ }, Lt = ({ card: t, avatars: s }) => {
445
+ const r = ((n) => {
446
+ if (!("properties" in n.props) || !n.props.properties || typeof n.props.properties != "object") return null;
447
+ const a = n.props.properties, i = [{ key: "captionHtml", isHtml: !0 }, { key: "captionText", isHtml: !1 }, { key: "richTextBody", isHtml: !0 }, { key: "body", isHtml: !1 }];
448
+ for (const { key: o, isHtml: d } of i) {
449
+ const c = a[o];
450
+ if (typeof c != "string") continue;
451
+ const m = c.trim();
452
+ if (m) {
453
+ if (d && !m.replaceAll(/<[^>]*>/g, "").trim()) continue;
454
+ return { content: m, isHtml: d };
455
+ }
456
+ }
457
+ return null;
458
+ })(t);
459
+ return r ? e(ie, { avatars: s, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: r.content }, children: r.isHtml ? e(ce, { className: "chat-message-text", html: r.content }) : e("div", { className: "chat-message-text", children: r.content }) }) : null;
460
+ }, Mt = ({ card: t, userResponse: s, avatars: r }) => {
461
+ const n = ((a, i) => {
462
+ if (a.type === "open" && i && typeof i == "object" && "value" in i) return i.value;
463
+ })(t, s);
464
+ return e("div", { className: "chat-bubble-container chat-right", children: [e("div", { className: "chat-bubble chat-bubble-right chat-bubble-text-only", children: e("div", { className: "chat-message-text", children: n || e("div", { className: "chat-message-no-response", children: "No response" }) }) }), e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x` })] });
465
+ }, Ut = ({ card: t, avatars: s, isCurrentQuestion: r, currentQuestionBubbleRef: n }) => {
466
+ const { endCard: a } = A((i) => ({ endCard: i.endCard }));
467
+ return e(ke, { children: [e(ie, { avatars: s, isLeft: !0, message: { id: `thanks-${t.name}`, type: "question", content: (a == null ? void 0 : a.headline) ?? "Great! Thank you for your participation." }, ref: r ? n : null }), (a == null ? void 0 : a.subheader) && e(ie, { avatars: s, hideAvatar: !0, isLeft: !0, message: { id: `caption-${t.name}`, type: "question", content: a.subheader } }), e(ot, {})] });
468
+ }, Et = ({ card: t, cardIndex: s, index: r, avatars: n, cardResponses: a, questionThinkingStates: i, startingQuestionIdx: o, currentQuestionBubbleRef: d, handleCardResponse: c }) => {
469
+ const m = s === r, h = s < r, l = Qe(t);
470
+ if (l) return e(Ut, { avatars: n, card: t, currentQuestionBubbleRef: d, isCurrentQuestion: m });
471
+ const u = `${t.name}`, y = a.get(u), f = t.type === "open", p = i.get(u), C = s > (o ?? 0) && t.type !== "thanks" && t.type !== "uploading" && (p === !0 || p === void 0);
472
+ return e(Re.Fragment, { children: [e(Rt, { avatars: n, card: t, currentQuestionBubbleRef: d, isCurrentQuestion: m, isThinking: C }), !C && e(Lt, { avatars: n, card: t }), h && f ? e(Mt, { avatars: n, card: t, userResponse: y }) : (!h || !f) && !C && e(ie, { avatars: n, isLeft: !1, message: { id: `card-${t.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e($t, { card: t, className: l ? "chat-thanks-card" : "chat-card", isAnswered: h, next: m ? c : () => {
473
+ } }) }) })] }, `question-card-${t.name}`);
474
+ }, ie = Re.forwardRef(({ message: t, isLeft: s = !1, children: r, avatars: n, hideAvatar: a = !1 }, i) => {
475
+ const o = s ? "chat-bubble-left" : "chat-bubble-right";
476
+ return e("div", { className: `chat-bubble-container ${s ? "chat-left" : "chat-right"}${s && a ? " chat-no-avatar" : ""}`, ref: i, children: [s && !a && e("img", { alt: "AI Avatar", className: "chat-avatar chat-avatar-left", srcSet: `${n.agentAvatar["1x"]} 1x, ${n.agentAvatar["2x"]} 2x` }), e("div", { className: `chat-bubble ${o}`, children: r || e("div", { className: "chat-message-text", children: t.content }) }), !s && !a && e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${n.respondentAvatar["1x"]} 1x, ${n.respondentAvatar["2x"]} 2x` })] });
477
+ });
478
+ ie.displayName = "ChatBubble";
479
+ const At = () => {
480
+ const t = A((r) => r.close), s = oe(() => () => t(_e), [t]);
481
+ return e("div", { "aria-label": "Close button", className: "conversational-close-btn", onClick: s, onKeyPress: (r) => {
482
+ r.key === "Enter" && s();
483
+ }, role: "button", tabIndex: 0, children: e("svg", { fill: "none", height: "16px", viewBox: "0 0 13 13", width: "16px", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z", fill: "#262136" }) }) });
484
+ }, $t = ({ card: t, next: s, className: r = "", isAnswered: n = !1 }) => {
485
+ const a = { className: n ? `${r} answered-card` : r, next: n ? () => {
486
+ } : s, questionId: t.name, type: t.type, isAnswered: n };
487
+ switch (t.type) {
488
+ case "consentlegal":
489
+ return e(lt, { ...a, ...t.props });
490
+ case "likert":
491
+ return e(dt, { ...a, ...t.props });
492
+ case "matrix":
493
+ return e(pt, { ...a, ...t.props });
494
+ case "multiplechoice":
495
+ return e(mt, { ...a, ...t.props });
496
+ case "multipleselect":
497
+ return e(ht, { ...a, ...t.props });
498
+ case "nps":
499
+ return e(vt, { ...a, ...t.props });
500
+ case "open":
501
+ return e(gt, { ...a, ...t.props });
502
+ case "rankorder":
503
+ return e(bt, { ...a, ...t.props });
504
+ case "recordedtask":
505
+ return e(Nt, { ...a, ...t.props });
506
+ case "texturlprompt":
507
+ return e(It, { ...a, ...t.props });
508
+ case "thanks":
509
+ return e(Dt, { ...a, ...t.props });
510
+ case "uploading":
511
+ return e(qt, { ...a, ...t.props });
512
+ case "videovoice":
513
+ return e(Pt, { ...a, ...t.props });
514
+ default:
515
+ return null;
516
+ }
517
+ }, Gt = ({ cards: t, next: s, previousResponses: r }) => {
518
+ const { cardResponses: n, setCardResponse: a } = (() => {
519
+ const [v, T] = $(/* @__PURE__ */ new Map());
520
+ return { cardResponses: v, setCardResponse: le((k, q) => {
521
+ T((D) => new Map(D).set(k, q));
522
+ }, []) };
523
+ })(), { index: i, isLongFormSurvey: o, avatars: d, startingQuestionIdx: c, viewDocument: m } = A((v) => ({ index: v.index, isLongFormSurvey: Le(v.studyType), avatars: v.avatars, startingQuestionIdx: v.startingQuestionIdx, viewDocument: v.viewDocument })), { currentQuestionBubbleRef: h, scrollToCurrentQuestion: l } = (({ viewDocument: v }) => {
524
+ const T = K(null), k = le(() => {
525
+ const q = v.querySelector(".ul-card-main-content");
526
+ if (T.current && q && q instanceof HTMLElement) {
527
+ const D = T.current.offsetTop - q.offsetTop - 16;
528
+ q.scrollTo({ top: Math.max(0, D), behavior: "smooth" });
529
+ }
530
+ }, []);
531
+ return { currentQuestionBubbleRef: T, scrollToCurrentQuestion: k };
532
+ })({ viewDocument: m }), u = ((v, T, k) => {
533
+ const [q, D] = $(/* @__PURE__ */ new Map());
534
+ return te(() => {
535
+ if (v.length > 0 && T < v.length) {
536
+ const _ = v[T], b = `${_.name}`;
537
+ if (T <= (k ?? 0) || Qe(_)) return void D((g) => new Map(g).set(b, !1));
538
+ D((g) => new Map(g).set(b, !0));
539
+ const S = setTimeout(() => {
540
+ D((g) => new Map(g).set(b, !1));
541
+ }, 1e3);
542
+ return () => clearTimeout(S);
543
+ }
544
+ }, [T, v, k]), q;
545
+ })(t, i, c), y = ((v, T) => {
546
+ const [k, q] = $(/* @__PURE__ */ new Set([0]));
547
+ return te(() => {
548
+ q((D) => new Set(D).add(v));
549
+ }, [v]), te(() => {
550
+ const D = T ?? 0;
551
+ D > 0 && q((_) => {
552
+ const b = new Set(_);
553
+ for (let S = 0; S <= D; S++) b.add(S);
554
+ return b;
555
+ });
556
+ }, [T]), k;
557
+ })(i, c), f = oe(() => ({ ...r, ...Ze(t.map((v, T) => {
558
+ var k, q;
559
+ return { ...v, value: T < i ? ((k = n.get(`${v.name}`)) == null ? void 0 : k.value) ?? null : null, secondaryValue: T < i ? ((q = n.get(`${v.name}`)) == null ? void 0 : q.secondaryValue) ?? null : null };
560
+ })) }), [r, n, t, i]), p = Ye(t, f);
561
+ te(() => {
562
+ requestAnimationFrame(() => {
563
+ l();
564
+ });
565
+ }, [i, l, u]);
566
+ const C = le((v, T) => {
567
+ if (!T) return;
568
+ const k = p[i];
569
+ if (!k) return;
570
+ const q = `${k.name}`;
571
+ a(q, v);
572
+ const D = { ...v, questionText: ze(k) };
573
+ s([D]);
574
+ }, [p, i, s, a]), w = p.map((v, T) => ({ card: v, cardIndex: T })).filter(({ cardIndex: v }) => y.has(v));
575
+ return e("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!o && e(At, {}), e("div", { className: "chat-container", children: e("div", { className: "chat-messages", children: w.map(({ card: v, cardIndex: T }) => e(Et, { avatars: d, card: v, cardIndex: T, cardResponses: n, currentQuestionBubbleRef: h, handleCardResponse: C, index: i, questionThinkingStates: u, startingQuestionIdx: c }, `question-card-${v.name}`)) }) })] });
576
+ };
577
+ export {
578
+ Gt as default
579
+ };