@sprig-technologies/sprig-bundled 2.39.4 → 2.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,192 @@
1
+ import { a as i, c as v, u as C, p as E, F as _, h as U, _ as P, e as H, r as W, g as D, y as X, s as Q } from "./view-BjWfEnbU.js";
2
+ import { j as G, k as J, A as Y, l as ee, E as B } from "./index-gY11yXiE.js";
3
+ const te = (e) => i("button", { ...e, className: v("ul-card-text__button", e.className), id: "ul-card-text__button" }), oe = ({ html: e, ...o }) => {
4
+ const { enableCspTrustedTypes: l, update: t } = C((a) => ({ enableCspTrustedTypes: a.enableCspTrustedTypes, update: a.update }));
5
+ E(() => {
6
+ t();
7
+ }, [t]);
8
+ const n = _(() => G(e, l), [l, e]);
9
+ return i("div", { ...o, dangerouslySetInnerHTML: { __html: n } });
10
+ }, R = () => {
11
+ const { viewDocument: e } = C((t) => ({ viewDocument: t.viewDocument })), [o, l] = U(!1);
12
+ return E(() => {
13
+ const t = e.querySelector(".sprig-question-body"), n = new ResizeObserver(() => {
14
+ window.requestAnimationFrame(() => {
15
+ l(!!(t && J(t) && t.scrollHeight > t.offsetHeight));
16
+ });
17
+ });
18
+ return t && n.observe(t), () => {
19
+ t && n.disconnect();
20
+ };
21
+ }, [e]), o;
22
+ }, A = ({ plainText: e, richText: o, id: l, className: t, isHeader: n, showAsterisk: a }) => o ? i(oe, { className: t, html: o, id: l }) : e ? n ? i("h1", { className: t, id: l, children: [e, a && "*"] }) : i("p", { className: t, id: l, children: e }) : null, ne = () => {
23
+ const { cards: e, close: o, endCard: l, headers: t, index: n } = C((s) => ({ cards: s.cards, close: s.close, endCard: s.endCard, headers: s.headers, index: s.index, useMobileStyling: s.useMobileStyling })), a = e.length, r = _(() => () => o(Y), [o]);
24
+ return ["email", "link"].includes(t["userleap-platform"]) || l && n + 1 === a ? null : i("div", { "aria-label": "Close button", className: "close-btn", onClick: r, onKeyPress: (s) => {
25
+ s.key === "Enter" && r();
26
+ }, role: "button", tabIndex: 0, children: i("svg", { fill: "none", height: "16px", viewBox: "0 0 13 13", width: "16px", xmlns: "http://www.w3.org/2000/svg", children: i("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" }) }) });
27
+ }, be = ({ message: e, properties: o, isRequired: l }) => {
28
+ const t = P(null), n = o == null ? void 0 : o.captionText, a = R();
29
+ return i("div", { className: v("question-header-container", "sprig-header-container", a ? "sprig-border-bottom" : null), ref: t, children: [i("div", { className: "question-header-button-container", children: [i(A, { className: "ul-question", id: "ul-question", isHeader: !0, plainText: e, richText: o == null ? void 0 : o.questionHtml, showAsterisk: l }), i(ne, {})] }), i(A, { className: "ul-caption", id: "ul-caption", plainText: n, richText: o == null ? void 0 : o.captionHtml })] });
30
+ }, se = () => i("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: i("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#FFFFFF", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), ve = ({ isSubmitDisabled: e, handleSubmit: o }) => i("div", { className: "ul-card-longform__submit-button-container", children: i(te, { className: "ul-card-longform__submit-button", disabled: e, onClick: o, children: ["OK ", i(se, {})] }) }), F = ({ buttonText: e = "View Prototype", handleClick: o }) => i("button", { className: "prototype-button", onClick: o, children: e }, "prototype-btn"), xe = ({ embeddedType: e = "prototype", properties: o, children: l }) => {
31
+ var k;
32
+ const { handleClickEmbedButton: t, hasViewedEmbed: n, headers: a, useDesktopPrototype: r, update: s, isConversationalUI: u } = C((d) => ({ handleClickEmbedButton: d.handleClickEmbedButton, hasViewedEmbed: d.hasViewedEmbed, headers: d.headers, useDesktopPrototype: d.useDesktopPrototype, update: d.update, isConversationalUI: d.isConversationalUI })), p = (o == null ? void 0 : o.conceptUrl) || ((k = o == null ? void 0 : o.consentDocument) == null ? void 0 : k.url), h = window.innerWidth < ee, w = a["userleap-platform"], y = (d, c) => {
33
+ d.preventDefault(), t(c);
34
+ };
35
+ if (E(() => {
36
+ u || requestAnimationFrame(() => {
37
+ s();
38
+ });
39
+ }, [s, u]), !r && h && !n && p && ["email", "link"].includes(w)) {
40
+ if (e === "prototype") return i(F, { handleClick: (d) => {
41
+ y(d, "question.prototype.click");
42
+ } });
43
+ if (e === "pdf") return i(F, { buttonText: (o == null ? void 0 : o.viewDocumentText) || "View Document", handleClick: (d) => {
44
+ y(d, "question.agreement.click");
45
+ } });
46
+ }
47
+ return i(H, { children: l });
48
+ }, V = ({ isSelected: e, id: o, divId: l, themeColor: t, disabled: n = !1 }) => i("div", { "aria-checked": e, "aria-disabled": n, "aria-labelledby": `label-${o}`, className: "select-checkbox", id: l, role: "checkbox", style: { ...e ? { backgroundColor: t, borderColor: t, boxShadow: "none" } : {}, ...n ? { opacity: 0.5 } : {} }, tabIndex: n ? -1 : 0, children: e && i(W, {}) }), ie = (e, o) => {
49
+ const l = P(0);
50
+ return () => {
51
+ if (e.current) {
52
+ const t = e.current;
53
+ t.style.height = "1px";
54
+ const n = t.scrollHeight + (t.offsetHeight - t.clientHeight), a = parseInt(window.getComputedStyle(t).getPropertyValue("max-height")), r = n <= a ? n : a;
55
+ l.current !== r && requestAnimationFrame(() => {
56
+ o();
57
+ }), l.current = r, t.style.height = `${r}px`;
58
+ }
59
+ };
60
+ }, ge = ({ ariaLabel: e, border: o, choiceStyle: l = {}, label: t, isSelected: n, value: a, text: r, id: s, isRadio: u, useMobileStyling: p, error: h, allowTextEntry: w, noneOfTheAbove: y, promptText: k, disabled: d = !1, onUserInputChanged: c }) => {
61
+ const { styleNonce: T, viewDocument: x } = C((m) => ({ styleNonce: m.styleNonce, viewDocument: m.viewDocument })), [b, g] = U(!1);
62
+ ae(x, o, T);
63
+ const N = ({ isSelected: m, userText: L }) => {
64
+ c && c({ id: s, selected: m, value: a, userText: L, noneOfTheAbove: y });
65
+ }, q = (m) => {
66
+ d || (m.stopPropagation(), N({ isSelected: u || !n, userText: r }), g(!1));
67
+ }, K = () => {
68
+ b || g(!0);
69
+ }, I = () => {
70
+ b && g(!1);
71
+ }, f = { onClick: (m) => q(m), onKeyPress: (m) => ((L) => {
72
+ d || L.key !== "Enter" && L.key !== " " || q(L);
73
+ })(m) };
74
+ "ontouchstart" in x.documentElement ? (f.onTouchStart = I, f.onTouchCancel = I, f.onTouchEnd = I) : (f.onMouseDown = K, f.onMouseLeave = I);
75
+ const O = u ? `radio-${s}` : `checkbox-${s}`, $ = n || b ? [S] : [], z = [...h ? [j] : [], ...$, ...d ? ["ul-choice-disabled"] : []], Z = t ? { "aria-labelledby": `label-${s}` } : { "aria-label": e };
76
+ return i("div", { className: v(D("choice", p), ...z), id: `choice-div-${s}`, style: { ...l, ...h ? { borderColor: B } : {}, ...d ? { opacity: 0.5, cursor: "not-allowed" } : {} }, ...d ? {} : f, "aria-disabled": d, children: [i("div", { className: v("choice-label-container"), children: [u ? i("div", { ...Z, className: v("select-radio", ...$), id: O, role: "radio", tabIndex: 0 }) : i(V, { disabled: d, divId: O, id: s, isSelected: n, themeColor: o }), t && i("label", { className: v(D("select-label", p)), htmlFor: O, id: `label-${s}`, children: t })] }), w && n && i("div", { className: v("choice-text-entry-container", ...$), children: i(le, { onTextChange: (m) => N({ isSelected: n, userText: m }), promptText: k || "Please specify", textValue: r, useMobileStyling: p }) })] });
77
+ }, le = ({ promptText: e, textValue: o, onTextChange: l, useMobileStyling: t }) => {
78
+ const n = P(null), { update: a } = C((s) => ({ update: s.update })), r = ie(n, () => a());
79
+ return E(() => (r(), n.current && n.current.focus(), () => {
80
+ a();
81
+ }), []), i("textarea", { "aria-label": e, "aria-multiline": "true", "aria-placeholder": e, className: v(D("choice-text-input", t)), "data-gramm": "false", maxLength: 5e3, name: "text", onChange: (s) => {
82
+ r(), s.stopPropagation(), l(s.currentTarget.value);
83
+ }, onClick: (s) => {
84
+ s.stopPropagation();
85
+ }, onKeyPress: (s) => {
86
+ s.stopPropagation();
87
+ }, placeholder: e, ref: n, role: "textbox", rows: 1, value: o });
88
+ }, M = "ul-select-style-element", S = "ul-select-active-dynamic-style", j = "ul-select-error-dynamic-style", ae = (e, o, l) => {
89
+ let t = e.getElementById(M), n = !1;
90
+ t || (t = e.createElement("style"), n = !0), t.tagName.toLowerCase() === "style" && (t.id = M, l && (t.nonce = l), t.textContent = re(o), n && e.head.appendChild(t));
91
+ }, re = (e) => `
92
+ .${S} {
93
+ border-color: ${e};
94
+ }
95
+ .${S} .select-radio, .${S}.select-radio {
96
+ border: 6px solid ${e};
97
+ box-shadow: none;
98
+ }
99
+ .${j} {
100
+ border-color: ${B};
101
+ }
102
+ `, we = ({ children: e }) => i("div", { className: "sprig-question-body", children: e }), ye = ({ children: e }) => {
103
+ const o = R(), { isConversationalUI: l } = C((t) => ({ isConversationalUI: t.isConversationalUI }));
104
+ return i("div", { className: v("sprig-question-footer-container", o && !l ? "sprig-border-top" : null), children: e });
105
+ };
106
+ var ce = ((e) => (e.CONTINUE = "CONTINUE", e.EXTERNAL = "EXTERNAL", e.NO_BUTTON = "NO_BUTTON", e))(ce || {}), de = ((e) => (e.Unlimited = "Unlimited", e.Maximum = "Maximum", e.Range = "Range", e))(de || {});
107
+ const ue = ({ options: e, selectItem: o, selectedOptions: l, showCheckbox: t, disabledOptions: n, dropdownFooter: a }) => {
108
+ const { themeColor: r } = C((s) => ({ doc: s.viewDocument, themeColor: s.border }));
109
+ return i("div", { className: "select-list", children: [e.map((s) => {
110
+ return i("div", { "aria-disabled": n == null ? void 0 : n.includes(s), className: v("select-option", n != null && n.includes(s) ? "ul-choice-disabled" : ""), onClick: (p) => {
111
+ n != null && n.includes(s) || (o(s), p.stopPropagation());
112
+ }, role: "option", style: { ...n != null && n.includes(s) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [t && i(V, { divId: (u = s.id, `checkbox-div-${u}`), id: s.id, isSelected: l.includes(s), themeColor: r }), s.label] }, s.id);
113
+ var u;
114
+ }), a] });
115
+ }, Ce = ({ isMultiSelect: e = !1, multiselectText: o = "choices selected", onChange: l, options: t, placeholderText: n, value: a, disabledOptions: r = [], dropdownFooter: s }) => {
116
+ const [u, p] = U(!1), { viewDocument: h, update: w, isConversationalUI: y } = C((c) => ({ viewDocument: c.viewDocument, update: c.update, isConversationalUI: c.isConversationalUI })), k = () => {
117
+ p(!u);
118
+ };
119
+ X(() => {
120
+ y || w();
121
+ }, [u, y, w]), E(() => {
122
+ var T;
123
+ const c = (x) => {
124
+ const b = x.target;
125
+ (b == null ? void 0 : b.closest(".select-option.ul-choice-disabled")) || p(!1);
126
+ };
127
+ h.addEventListener("click", c);
128
+ try {
129
+ (T = window.parent) == null || T.addEventListener("click", c);
130
+ } catch {
131
+ window.addEventListener("click", c);
132
+ }
133
+ return () => {
134
+ var x;
135
+ h.removeEventListener("click", c);
136
+ try {
137
+ (x = window.parent) == null || x.removeEventListener("click", c);
138
+ } catch {
139
+ window.removeEventListener("click", c);
140
+ }
141
+ };
142
+ }, [h]);
143
+ const d = a.length === 0 ? ["select-button-placeholder"] : [];
144
+ return i(H, { children: [i("button", { "aria-label": "choice dropdown button", className: v("select-button", ...d), onClick: (c) => {
145
+ c.stopPropagation(), k();
146
+ }, type: "button", children: [i("span", { children: a.length === 0 ? n : a.length === 1 ? a[0].label : `${a.length} ${o}` }), i(Q, {})] }), u && i(ue, { disabledOptions: r, dropdownFooter: s, options: t, selectedOptions: a, selectItem: (c) => {
147
+ var b;
148
+ const T = a.some((g) => g.id === c.id), x = a.some((g) => {
149
+ var N;
150
+ return (N = g.optionProperties) == null ? void 0 : N.noneOfTheAbove;
151
+ });
152
+ (b = c.optionProperties) != null && b.noneOfTheAbove && !T ? l([c]) : e ? l(T ? a.filter((g) => g.id !== c.id) : x ? [c] : [...a, c]) : T || l([c]), e || k();
153
+ }, showCheckbox: e })] });
154
+ }, pe = { "{{user_id}}": "externalUserId", "{{email}}": "email" }, Te = (e = void 0, o = {}) => {
155
+ if (!e) return e;
156
+ const l = ["http:", "https:", "itms-apps:", "market:"], t = ((r) => /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(r) ? r : `http://${r}`)(e);
157
+ if (!t) return;
158
+ try {
159
+ const r = new URL(t);
160
+ if (!r.protocol || !l.includes(r.protocol)) return;
161
+ } catch {
162
+ return;
163
+ }
164
+ const n = [], a = ((r, s, u) => {
165
+ let p = r;
166
+ for (const [h, w] of Object.entries(pe)) if (p.toLowerCase().includes(h)) if (s[w]) {
167
+ const y = new RegExp(h, "gi");
168
+ p = p.replace(y, s[w]);
169
+ } else u.push(h);
170
+ return p;
171
+ })(t, o, n);
172
+ return n.length === 0 ? a : ((r, s) => {
173
+ if (!r.includes("?")) return r;
174
+ const u = r.slice(0, r.indexOf("?")), p = r.slice(r.indexOf("?") + 1).split("&").map((h) => h.split("=")).filter((h) => !s.includes(h[1]));
175
+ return p.length === 0 ? u : `${u}?${p.map((h) => h.join("=")).join("&")}`;
176
+ })(a, n);
177
+ };
178
+ export {
179
+ te as B,
180
+ oe as H,
181
+ ve as L,
182
+ xe as M,
183
+ ge as O,
184
+ ce as P,
185
+ ye as Q,
186
+ Ce as S,
187
+ we as a,
188
+ de as b,
189
+ be as c,
190
+ Te as g,
191
+ ie as u
192
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";const e=require("./view-D-Rk2_yd.cjs"),f=require("./index-C4jT0KTM.cjs"),D=t=>e.u("button",{...t,className:e.cc("ul-card-text__button",t.className),id:"ul-card-text__button"}),U=({html:t,...n})=>{const{enableCspTrustedTypes:r,update:o}=e.useConfig(s=>({enableCspTrustedTypes:s.enableCspTrustedTypes,update:s.update}));e.p(()=>{o()},[o]);const i=e.F(()=>f.getHtml(t,r),[r,t]);return e.u("div",{...n,dangerouslySetInnerHTML:{__html:i}})},_=()=>{const{viewDocument:t}=e.useConfig(o=>({viewDocument:o.viewDocument})),[n,r]=e.h(!1);return e.p(()=>{const o=t.querySelector(".sprig-question-body"),i=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{r(!!(o&&f.isHTMLElement(o)&&o.scrollHeight>o.offsetHeight))})});return o&&i.observe(o),()=>{o&&i.disconnect()}},[t]),n},R=({plainText:t,richText:n,id:r,className:o,isHeader:i,showAsterisk:s})=>n?e.u(U,{className:o,html:n,id:r}):t?i?e.u("h1",{className:o,id:r,children:[t,s&&"*"]}):e.u("p",{className:o,id:r,children:t}):null,z=()=>{const{cards:t,close:n,endCard:r,headers:o,index:i}=e.useConfig(l=>({cards:l.cards,close:l.close,endCard:l.endCard,headers:l.headers,index:l.index,useMobileStyling:l.useMobileStyling})),s=t.length,a=e.F(()=>()=>n(f.APP_ID),[n]);return["email","link"].includes(o["userleap-platform"])||r&&i+1===s?null:e.u("div",{"aria-label":"Close button",className:"close-btn",onClick:a,onKeyPress:l=>{l.key==="Enter"&&a()},role:"button",tabIndex:0,children:e.u("svg",{fill:"none",height:"16px",viewBox:"0 0 13 13",width:"16px",xmlns:"http://www.w3.org/2000/svg",children:e.u("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"})})})},K=()=>e.u("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#FFFFFF",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),M=({buttonText:t="View Prototype",handleClick:n})=>e.u("button",{className:"prototype-button",onClick:n,children:t},"prototype-btn"),$=({isSelected:t,id:n,divId:r,themeColor:o,disabled:i=!1})=>e.u("div",{"aria-checked":t,"aria-disabled":i,"aria-labelledby":`label-${n}`,className:"select-checkbox",id:r,role:"checkbox",style:{...t?{backgroundColor:o,borderColor:o,boxShadow:"none"}:{},...i?{opacity:.5}:{}},tabIndex:i?-1:0,children:t&&e.u(e.SvgCheckmark,{})}),A=(t,n)=>{const r=e._(0);return()=>{if(t.current){const o=t.current;o.style.height="1px";const i=o.scrollHeight+(o.offsetHeight-o.clientHeight),s=parseInt(window.getComputedStyle(o).getPropertyValue("max-height")),a=i<=s?i:s;r.current!==a&&requestAnimationFrame(()=>{n()}),r.current=a,o.style.height=`${a}px`}}},W=({promptText:t,textValue:n,onTextChange:r,useMobileStyling:o})=>{const i=e._(null),{update:s}=e.useConfig(l=>({update:l.update})),a=A(i,()=>s());return e.p(()=>(a(),i.current&&i.current.focus(),()=>{s()}),[]),e.u("textarea",{"aria-label":t,"aria-multiline":"true","aria-placeholder":t,className:e.cc(e.getClasses("choice-text-input",o)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:l=>{a(),l.stopPropagation(),r(l.currentTarget.value)},onClick:l=>{l.stopPropagation()},onKeyPress:l=>{l.stopPropagation()},placeholder:t,ref:i,role:"textbox",rows:1,value:n})},P="ul-select-style-element",L="ul-select-active-dynamic-style",q="ul-select-error-dynamic-style",X=(t,n,r)=>{let o=t.getElementById(P),i=!1;o||(o=t.createElement("style"),i=!0),o.tagName.toLowerCase()==="style"&&(o.id=P,r&&(o.nonce=r),o.textContent=Z(n),i&&t.head.appendChild(o))},Z=t=>`
2
+ .${L} {
3
+ border-color: ${t};
4
+ }
5
+ .${L} .select-radio, .${L}.select-radio {
6
+ border: 6px solid ${t};
7
+ box-shadow: none;
8
+ }
9
+ .${q} {
10
+ border-color: ${f.ERROR_BORDER_COLOR};
11
+ }
12
+ `;var B=(t=>(t.CONTINUE="CONTINUE",t.EXTERNAL="EXTERNAL",t.NO_BUTTON="NO_BUTTON",t))(B||{}),F=(t=>(t.Unlimited="Unlimited",t.Maximum="Maximum",t.Range="Range",t))(F||{});const Q=({options:t,selectItem:n,selectedOptions:r,showCheckbox:o,disabledOptions:i,dropdownFooter:s})=>{const{themeColor:a}=e.useConfig(l=>({doc:l.viewDocument,themeColor:l.border}));return e.u("div",{className:"select-list",children:[t.map(l=>{return e.u("div",{"aria-disabled":i==null?void 0:i.includes(l),className:e.cc("select-option",i!=null&&i.includes(l)?"ul-choice-disabled":""),onClick:p=>{i!=null&&i.includes(l)||(n(l),p.stopPropagation())},role:"option",style:{...i!=null&&i.includes(l)?{opacity:.5,cursor:"not-allowed"}:{}},children:[o&&e.u($,{divId:(u=l.id,`checkbox-div-${u}`),id:l.id,isSelected:r.includes(l),themeColor:a}),l.label]},l.id);var u}),s]})},G={"{{user_id}}":"externalUserId","{{email}}":"email"};exports.Button=D,exports.Header=({message:t,properties:n,isRequired:r})=>{const o=e._(null),i=n==null?void 0:n.captionText,s=_();return e.u("div",{className:e.cc("question-header-container","sprig-header-container",s?"sprig-border-bottom":null),ref:o,children:[e.u("div",{className:"question-header-button-container",children:[e.u(R,{className:"ul-question",id:"ul-question",isHeader:!0,plainText:t,richText:n==null?void 0:n.questionHtml,showAsterisk:r}),e.u(z,{})]}),e.u(R,{className:"ul-caption",id:"ul-caption",plainText:i,richText:n==null?void 0:n.captionHtml})]})},exports.Html=U,exports.LongformSubmitButton=({isSubmitDisabled:t,handleSubmit:n})=>e.u("div",{className:"ul-card-longform__submit-button-container",children:e.u(D,{className:"ul-card-longform__submit-button",disabled:t,onClick:n,children:["OK ",e.u(K,{})]})}),exports.MaxSelectModes=F,exports.MobileEmbedView=({embeddedType:t="prototype",properties:n,children:r})=>{var y;const{handleClickEmbedButton:o,hasViewedEmbed:i,headers:s,useDesktopPrototype:a,update:l,isConversationalUI:u}=e.useConfig(d=>({handleClickEmbedButton:d.handleClickEmbedButton,hasViewedEmbed:d.hasViewedEmbed,headers:d.headers,useDesktopPrototype:d.useDesktopPrototype,update:d.update,isConversationalUI:d.isConversationalUI})),p=(n==null?void 0:n.conceptUrl)||((y=n==null?void 0:n.consentDocument)==null?void 0:y.url),h=window.innerWidth<f.EMBED_MOBILE_MAX_WIDTH,C=s["userleap-platform"],x=(d,c)=>{d.preventDefault(),o(c)};if(e.p(()=>{u||requestAnimationFrame(()=>{l()})},[l,u]),!a&&h&&!i&&p&&["email","link"].includes(C)){if(t==="prototype")return e.u(M,{handleClick:d=>{x(d,"question.prototype.click")}});if(t==="pdf")return e.u(M,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:d=>{x(d,"question.agreement.click")}})}return e.u(e.g,{children:r})},exports.Option=({ariaLabel:t,border:n,choiceStyle:r={},label:o,isSelected:i,value:s,text:a,id:l,isRadio:u,useMobileStyling:p,error:h,allowTextEntry:C,noneOfTheAbove:x,promptText:y,disabled:d=!1,onUserInputChanged:c})=>{const{styleNonce:w,viewDocument:g}=e.useConfig(m=>({styleNonce:m.styleNonce,viewDocument:m.viewDocument})),[b,v]=e.h(!1);X(g,n,w);const k=({isSelected:m,userText:N})=>{c&&c({id:l,selected:m,value:s,userText:N,noneOfTheAbove:x})},S=m=>{d||(m.stopPropagation(),k({isSelected:u||!i,userText:a}),v(!1))},H=()=>{b||v(!0)},E=()=>{b&&v(!1)},T={onClick:m=>S(m),onKeyPress:m=>(N=>{d||N.key!=="Enter"&&N.key!==" "||S(N)})(m)};"ontouchstart"in g.documentElement?(T.onTouchStart=E,T.onTouchCancel=E,T.onTouchEnd=E):(T.onMouseDown=H,T.onMouseLeave=E);const O=u?`radio-${l}`:`checkbox-${l}`,I=i||b?[L]:[],V=[...h?[q]:[],...I,...d?["ul-choice-disabled"]:[]],j=o?{"aria-labelledby":`label-${l}`}:{"aria-label":t};return e.u("div",{className:e.cc(e.getClasses("choice",p),...V),id:`choice-div-${l}`,style:{...r,...h?{borderColor:f.ERROR_BORDER_COLOR}:{},...d?{opacity:.5,cursor:"not-allowed"}:{}},...d?{}:T,"aria-disabled":d,children:[e.u("div",{className:e.cc("choice-label-container"),children:[u?e.u("div",{...j,className:e.cc("select-radio",...I),id:O,role:"radio",tabIndex:0}):e.u($,{disabled:d,divId:O,id:l,isSelected:i,themeColor:n}),o&&e.u("label",{className:e.cc(e.getClasses("select-label",p)),htmlFor:O,id:`label-${l}`,children:o})]}),C&&i&&e.u("div",{className:e.cc("choice-text-entry-container",...I),children:e.u(W,{onTextChange:m=>k({isSelected:i,userText:m}),promptText:y||"Please specify",textValue:a,useMobileStyling:p})})]})},exports.PromptActionTypeEnum=B,exports.QuestionBodyFooterContainer=({children:t})=>{const n=_(),{isConversationalUI:r}=e.useConfig(o=>({isConversationalUI:o.isConversationalUI}));return e.u("div",{className:e.cc("sprig-question-footer-container",n&&!r?"sprig-border-top":null),children:t})},exports.QuestionBodyWrapper=({children:t})=>e.u("div",{className:"sprig-question-body",children:t}),exports.Select=({isMultiSelect:t=!1,multiselectText:n="choices selected",onChange:r,options:o,placeholderText:i,value:s,disabledOptions:a=[],dropdownFooter:l})=>{const[u,p]=e.h(!1),{viewDocument:h,update:C,isConversationalUI:x}=e.useConfig(c=>({viewDocument:c.viewDocument,update:c.update,isConversationalUI:c.isConversationalUI})),y=()=>{p(!u)};e.y(()=>{x||C()},[u,x,C]),e.p(()=>{var w;const c=g=>{const b=g.target;(b==null?void 0:b.closest(".select-option.ul-choice-disabled"))||p(!1)};h.addEventListener("click",c);try{(w=window.parent)==null||w.addEventListener("click",c)}catch{window.addEventListener("click",c)}return()=>{var g;h.removeEventListener("click",c);try{(g=window.parent)==null||g.removeEventListener("click",c)}catch{window.removeEventListener("click",c)}}},[h]);const d=s.length===0?["select-button-placeholder"]:[];return e.u(e.g,{children:[e.u("button",{"aria-label":"choice dropdown button",className:e.cc("select-button",...d),onClick:c=>{c.stopPropagation(),y()},type:"button",children:[e.u("span",{children:s.length===0?i:s.length===1?s[0].label:`${s.length} ${n}`}),e.u(e.SvgCaret,{})]}),u&&e.u(Q,{disabledOptions:a,dropdownFooter:l,options:o,selectedOptions:s,selectItem:c=>{var b;const w=s.some(v=>v.id===c.id),g=s.some(v=>{var k;return(k=v.optionProperties)==null?void 0:k.noneOfTheAbove});(b=c.optionProperties)!=null&&b.noneOfTheAbove&&!w?r([c]):t?r(w?s.filter(v=>v.id!==c.id):g?[c]:[...s,c]):w||r([c]),t||y()},showCheckbox:t})]})},exports.getAttributedUrl=(t=void 0,n={})=>{if(!t)return t;const r=["http:","https:","itms-apps:","market:"],o=(a=>/^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(a)?a:`http://${a}`)(t);if(!o)return;try{const a=new URL(o);if(!a.protocol||!r.includes(a.protocol))return}catch{return}const i=[],s=((a,l,u)=>{let p=a;for(const[h,C]of Object.entries(G))if(p.toLowerCase().includes(h))if(l[C]){const x=new RegExp(h,"gi");p=p.replace(x,l[C])}else u.push(h);return p})(o,n,i);return i.length===0?s:((a,l)=>{if(!a.includes("?"))return a;const u=a.slice(0,a.indexOf("?")),p=a.slice(a.indexOf("?")+1).split("&").map(h=>h.split("=")).filter(h=>!l.includes(h[1]));return p.length===0?u:`${u}?${p.map(h=>h.join("=")).join("&")}`})(s,i)},exports.useAutoSize=A;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./view-D-Rk2_yd.cjs"),j=require("./index-C4jT0KTM.cjs"),b=require("./getAttributedUrl-SO6zrj5v.cjs"),Le=({className:n,message:i,next:l,properties:t,questionId:r,type:a})=>{const{useMobileStyling:v,border:y,isLongFormSurvey:u,focusedQuestionId:f}=e.useConfig(d=>({useMobileStyling:d.useMobileStyling,border:d.border,isLongFormSurvey:j.isLongFormSurvey(d.studyType),focusedQuestionId:d.focusedQuestionId})),[s,m]=e.h(!1),[o,C]=e.h(""),[p,h]=e.h(!1),w=u&&f===r,k=t==null?void 0:t.collectName,L=(t==null?void 0:t.nameLabelText)||"Full Name",_=(t==null?void 0:t.consentText)||"I agree to the stated conditions",q=(t==null?void 0:t.submitButtonText)||"Submit",B=!!o.trim(),Q=s&&(!k||B),D=(d,x=!1)=>{d.preventDefault(),d.stopPropagation();let P=null;if(!x){if(!Q)return void h(!0);P={submitted:!0},k&&(P.name=o)}l({value:P,questionId:r,type:a},Q)};return e.u("div",{className:e.cc(n,u&&!w&&"ul-card--unfocused","ul-card__consent-legal","fade-in-transition"),children:[e.u(b.Header,{isRequired:u&&(t==null?void 0:t.required),message:i,properties:{questionHtml:t.questionHtml}}),t!=null&&t.richTextBody?e.u(b.QuestionBodyWrapper,{children:e.u(b.Html,{className:"ul-rich-text-body",html:t.richTextBody,id:"ul-card__consent-legal-body-container"})}):null,e.u(b.MobileEmbedView,{embeddedType:"pdf",properties:t,children:e.u(b.QuestionBodyFooterContainer,{children:[e.u("div",{className:"sprig-stretch",children:[e.u(b.Option,{allowTextEntry:!1,border:y,error:p&&!s,id:"consent",isRadio:!1,isSelected:s,label:_,onUserInputChanged:({selected:d})=>{d!==s&&m(!s)},useMobileStyling:v}),k&&e.u("input",{"aria-label":L,"aria-placeholder":L,className:e.cc(e.getClasses("ul-consent-legal__name-input",v)),"data-gramm":"false",maxLength:250,name:"name",onBlur:d=>{d.currentTarget.style.borderColor=p&&!B?j.ERROR_BORDER_COLOR:j.DEFAULT_BORDER_COLOR},onFocus:d=>{d.currentTarget.style.borderColor=p&&!B?j.ERROR_BORDER_COLOR:y},onInput:d=>{d.preventDefault(),d.stopPropagation(),C(d.currentTarget.value)},placeholder:L,style:p&&!B?{borderColor:j.ERROR_BORDER_COLOR}:{},tabIndex:0,value:o})]}),e.u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[e.u(b.Button,{className:Q?"":"sprig-button-disabled",onClick:D,children:q}),t.required===!1&&!u&&e.u("button",{className:"ul-card-skip__button",onClick:d=>D(d,!0),children:e.getSkipButtonText(t)})]})]})})]},r)},qe=({activeValue:n,border:i,icon:l,isPressed:t,onSubmit:r,range:a,scaleLabelType:v,selectedValue:y,setSelectedValue:u,setActiveValue:f,setIsPressed:s,useMobileStyling:m,value:o,viewDocument:C})=>{const{isLongFormSurvey:p,enableCspTrustedTypes:h}=e.useConfig(x=>({isLongFormSurvey:j.isLongFormSurvey(x.studyType),enableCspTrustedTypes:x.enableCspTrustedTypes})),w=`option-${o}`,k=v==="number",L=v==="star",_=v==="smiley",q=k&&o===n||o===y,[B,Q]=(()=>{const x=L&&y!==null&&o<=y;return L&&o<=n||_&&o===n||x||o===n||o===y?[i,t||x||o===y?1:.3]:["",1]})(),D=e.F(()=>{const x={borderColor:q?B:"",fillOpacity:q?"":Q,zIndex:q?3:"auto",color:y===o?"#fff":""};return k?{...x,backgroundColor:y===o?B:""}:{...x,color:L||_||y===o?B:""}},[q,B,Q,y,o,k,L,_]),d=e.F(()=>j.getHtml((({icon:x,scaleLabelType:P,value:E,selectedValue:c})=>{if(P==="smiley"&&E===c){let S=0;return x.replace(/black/g,()=>++S==1?"black":"white")}return x})({icon:l,scaleLabelType:v,value:o,selectedValue:y}),h),[h,l,v,y,o]);return e.u("button",{"aria-label":k?void 0:String(o),className:(()=>{switch(v){case"star":return e.cc(e.getClasses("likert-star",m),e.getClasses(`likert-star-${o}`,m));case"smiley":return e.cc(e.getClasses("likert-smiley",m),e.getClasses(`likert-smiley-${o}`,m));default:return o===a?e.cc(e.getClasses("likert-number",m),e.getClasses(`likert-number-${o}`,m),e.getClasses("likert-last-option",m)):e.cc(e.getClasses("likert-number",m),e.getClasses(`likert-number-${o}`,m))}})(),dangerouslySetInnerHTML:{__html:d},id:w,onClick:x=>{p&&(x.preventDefault(),x.stopPropagation(),u(o)),r()},onKeyDown:x=>{var c,S;const P=C.querySelectorAll(`.likert-${v??"number"}`),E=o-1;x.key==="ArrowRight"?(c=P[E+1])==null||c.focus():x.key==="ArrowLeft"?(S=P[E-1])==null||S.focus():x.key!=="Enter"&&x.key!==" "||(p&&(x.preventDefault(),x.stopPropagation(),u(o)),r())},onPointerDown:()=>s(!0),onPointerEnter:()=>f(o),onPointerLeave:()=>{f(-1),s(!1)},style:D,tabIndex:0})},Be=({className:n,labels:i,message:l,next:t,properties:r,questionId:a,type:v})=>{const{border:y,useMobileStyling:u,viewDocument:f,isLongFormSurvey:s,focusedQuestionId:m,update:o}=e.useConfig(c=>({border:c.border,useMobileStyling:c.useMobileStyling,viewDocument:c.viewDocument,isLongFormSurvey:j.isLongFormSurvey(c.studyType),focusedQuestionId:c.focusedQuestionId,update:c.update})),[C,p]=e.h(-1),[h,w]=e.h(!1),[k,L]=e.h(null),_=s&&m===a,q=i&&i.left,B=i&&i.right;let Q;const{range:D,scaleLabelType:d,ratingIcons:x}=r;D&&(Q=Number(D));const P=Q||5,E=c=>{var S,T;switch(d){case"star":return(S=x[0])==null?void 0:S.svg;case"smiley":return(T=x[c])==null?void 0:T.svg;default:return String(c+1)}};return e.p(()=>{o()},[o]),e.u("form",{className:e.cc(n,"ul-card--likert","fade-in-transition",s&&!_&&"ul-card--unfocused"),children:[e.u(b.Header,{isRequired:s&&(r==null?void 0:r.required),message:l,properties:r}),e.u(b.MobileEmbedView,{properties:r,children:e.u(e.g,{children:[e.u(b.QuestionBodyWrapper,{children:[e.u("div",{"aria-label":`Rating (1 - ${P})`,className:"ul-card--likert__numbers",role:"radiogroup",children:[...Array(P)].map((c,S)=>{const T=S+1;return e.u(qe,{activeValue:C,border:y,icon:E(S),isPressed:h,onSubmit:()=>t({value:T,questionId:a,type:v},!0),range:P,scaleLabelType:d,selectedValue:k,setActiveValue:p,setIsPressed:w,setSelectedValue:L,useMobileStyling:u,value:T,viewDocument:f},S)})}),e.u("div",{className:"ul-card--likert__labels",children:[e.u("span",{children:q}),e.u("span",{children:B})]})]}),!r.required&&!s&&e.u(b.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-vertical-centered-container",children:e.u(b.Button,{onClick:c=>{c.preventDefault(),c.stopPropagation(),t({value:null,questionId:a,type:v},!0)},children:e.getButtonText(r)})})})]})})]},a)},be=n=>n&&(n.scrollHeight>n.offsetHeight?n:be(n.parentElement)),Me=n=>{if(!n||!(l=>l instanceof HTMLElement)(n))return 0;const i=getComputedStyle(n);return parseFloat(i.marginTop)+parseFloat(i.marginBottom)+(parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth))},Re=({columns:n,onSelect:i,options:l,selectedOptions:t})=>{const r=e._([]),{border:a,useMobileStyling:v}=e.useConfig(o=>({border:o.border,useMobileStyling:o.useMobileStyling})),y=l.findIndex(o=>t[o.id]===null),[u,f]=e.h(y),s=e.T((o,C)=>{i(o,C);const p=u+1,h=l[p];if(h&&t[h.id]===null){f(p);const w=r.current[u];if(w!=null&&w.firstElementChild){const k=be(w),L=w.firstElementChild,_=Me(w)+L.clientHeight;k==null||k.scrollTo(0,w.offsetTop+_)}}},[i,l,t,u]),m=e.T((o,C)=>{const p=u===o;return e.u(e.Accordion,{animate:!0,header:C.label,isOpen:p,onClick:()=>{var h;return f(p&&!((h=window.UserLeap)!=null&&h.isMobileSDK)?-1:o)},ref:h=>{h&&(r.current[o]=h)},showHeaderCheck:t[C.id]!==null,children:e.u("div",{style:{paddingTop:"12px"},children:n.map(h=>e.u(b.Option,{allowTextEntry:!1,ariaLabel:`${C.label}-${h.label}`,border:a,error:!1,id:`${C.id}-${h.value}`,isRadio:!0,isSelected:t[C.id]===h.value,label:h.label,onUserInputChanged:()=>s(C.id,h.value),useMobileStyling:v},h.label))})},C.id)},[a,n,u,s,t,v]);return e.u("div",{children:l.map((o,C)=>m(C,o))})},Pe=({columns:n,onSelect:i,options:l,selectedOptions:t})=>{const{border:r,useMobileStyling:a,isLongFormSurvey:v}=e.useConfig(p=>({border:p.border,useMobileStyling:p.useMobileStyling,isLongFormSurvey:j.isLongFormSurvey(p.studyType)})),y=l.length,u=n.length,f=e._(null),[s,m]=e.h(!1),[o,C]=e.h(!1);return e.p(()=>{const p=f.current,h=new ResizeObserver(w=>{window.requestAnimationFrame(()=>{p&&(m(Math.round(w[0].contentRect.width)<p.scrollWidth),C(Math.round(w[0].contentRect.width)<p.scrollWidth))})});return p&&h.observe(p),()=>{p&&h.unobserve(p)}},[]),e.u("div",{className:"ul-card--matrix_question_container",children:[e.u("div",{className:e.cc("ul-card--matrix_container",s&&"ul-matrix-scroll-gradient"),onScroll:()=>{(()=>{const p=f.current;p&&m(p.clientWidth+Math.abs(p.scrollLeft)<p.scrollWidth)})()},ref:f,children:e.u("div",{className:e.cc(v&&"ul-card--matrix_grid_longform","ul-card--matrix_grid"),style:`--numColumns: ${u}; --numRows: ${y+1};`,children:[e.u("div",{})," ",n.map(p=>e.u("div",{className:"ul-matrix-column-label",children:p.label},p.label)),l.map(p=>e.u(e.g,{children:[e.u("div",{"aria-label":p.label,className:"ul-matrix-row-label",children:p.label},p.label),e.u("div",{className:"ul-matrix-row-options",role:"radiogroup",children:n.map((h,w)=>{const k=w===u-1;return e.u("div",{className:e.cc("ul-matrix-option-wrapper",k&&"ul-matrix-last-option"),children:e.u(b.Option,{allowTextEntry:!1,ariaLabel:`${p.label}-${h.label}`,border:r,choiceStyle:{background:"transparent",border:"none",marginBottom:"0",padding:"0"},error:!1,id:`${p.id}-${h.value}`,isRadio:!0,isSelected:t[p.id]===h.value,onUserInputChanged:()=>i(p.id,h.value),useMobileStyling:a})},h.value)})})]}))]})}),(s||o)&&e.u("button",{className:o&&!s?"ul-matrix-scroll-arrow left":"ul-matrix-scroll-arrow",onClick:o&&!s?p=>{p.preventDefault();const h=f.current;if(h){const w=getComputedStyle(h).direction==="rtl";h.scrollTo({left:w?h.scrollWidth-h.clientWidth:0,behavior:"smooth"})}}:p=>{p.preventDefault();const h=f.current;if(h){const w=getComputedStyle(h).direction==="rtl";h.scrollTo({left:w?h.clientWidth-h.scrollWidth:h.scrollWidth,behavior:"smooth"})}},children:o&&!s?e.u(Fe,{}):e.u(De,{})})]})},Fe=()=>e.u("svg",{fill:"currentColor",height:"32",transform:"matrix(-1,0,0,1,0,0)",version:"1.1",viewBox:"0 0 256 256",width:"32",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"})}),De=()=>e.u("svg",{fill:"currentColor",height:"32",viewBox:"0 0 256 256",width:"32",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"})}),Qe=({className:n,message:i,next:l,options:t,properties:r,questionId:a,type:v,showIndividualSubmit:y=!1,onSubmitButtonClick:u})=>{const{useMobileStyling:f,isLongFormSurvey:s,focusedQuestionId:m,setFocusedQuestionId:o,update:C}=e.useConfig(d=>({useMobileStyling:d.useMobileStyling,isLongFormSurvey:j.isLongFormSurvey(d.studyType),focusedQuestionId:d.focusedQuestionId,setFocusedQuestionId:d.setFocusedQuestionId,update:d.update})),p=r.matrixColumn,h=r.required,w=s&&m===a,k=d=>{d.preventDefault(),d.stopPropagation(),l({value:_,questionId:a,type:v},!0),u&&u()},L=t.reduce((d,x)=>(d[x.id]=null,d),{}),[_,q]=e.h(L),B=d=>h&&Object.values(d).every(x=>x==null),Q=(d,x)=>{s&&l({value:{..._,[d]:x},questionId:a,type:v},!B({..._,[d]:x})),q(P=>({...P,[d]:x}))},D=r.displayMatrixAsAccordion||f;return e.p(()=>{C()},[C]),e.u("form",{className:e.cc(n,!s&&"ul-card__matrix","fade-in-transition",s&&!w&&"ul-card--unfocused"),id:"text-form",onClick:()=>{w&&o(a)},onSubmit:k,children:[e.u(b.Header,{isRequired:s&&(r==null?void 0:r.required),message:i,properties:r}),e.u(b.MobileEmbedView,{properties:r,children:[e.u(b.QuestionBodyWrapper,{children:[D?e.u(Re,{columns:p,onSelect:Q,options:t,selectedOptions:_}):e.u(Pe,{columns:p,onSelect:Q,options:t,selectedOptions:_}),y&&e.u(b.LongformSubmitButton,{handleSubmit:k,isSubmitDisabled:B(_)})]}),!s&&e.u(b.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(b.Button,{disabled:B(_),children:e.getButtonText(r)})})})]})]},a)},ve=({className:n,message:i,onSubmit:l,options:t=[],properties:r,questionId:a,type:v,showIndividualSubmit:y=!1,onSubmitButtonClick:u})=>{const{border:f,useMobileStyling:s,isLongFormSurvey:m,focusedQuestionId:o,setFocusedQuestionId:C,update:p}=e.useConfig(g=>({border:g.border,useMobileStyling:g.useMobileStyling,isLongFormSurvey:j.isLongFormSurvey(g.studyType),focusedQuestionId:g.focusedQuestionId,setFocusedQuestionId:g.setFocusedQuestionId,update:g.update})),h=m&&o===a,w=t.reduce((g,N)=>(g[N.id]={isSelected:!1},g),{}),[k,L]=e.h(w),_=v==="multiplechoice",q=r.required,B=t.find(g=>{var N;return(N=g.optionProperties)==null?void 0:N.noneOfTheAbove}),Q=g=>Object.entries(g).some(([N,M])=>{var z;const W=t.find(G=>`${G.id}`===N),H=M.userText===void 0||M.userText.trim()==="";return((z=W==null?void 0:W.optionProperties)==null?void 0:z.allowsTextEntry)&&H&&M.isSelected}),D=g=>Object.values(g).filter(N=>N.isSelected).length,d=r.minSelect&&r.minSelect>0&&r.maxSelectMode===b.MaxSelectModes.Range&&D(k)<r.minSelect&&(q||D(k)>0),x=g=>Q(g)||q&&!D(g)||!(N=>{const{minSelect:M=0,maxSelect:W=1/0,maxSelectMode:H}=r,z=D(N);switch(H){case b.MaxSelectModes.Maximum:return z<=W;case b.MaxSelectModes.Range:return z===0||z>=M;default:return!0}})(g),P=Object.entries(k).some(([g,N])=>{var M,W;return N.isSelected&&((W=(M=t.find(H=>`${H.id}`===g))==null?void 0:M.optionProperties)==null?void 0:W.allowsTextEntry)}),E=y&&(!_||P),c=g=>{F(g.id,g.selected,g.userText,g.noneOfTheAbove),g.selected&&m&&!_&&!h&&C(a)},S=g=>{var N;return(r==null?void 0:r.maxSelectMode)!==b.MaxSelectModes.Unlimited&&D(k)===(r==null?void 0:r.maxSelect)&&!((N=k[g])!=null&&N.isSelected)},T=g=>{g.preventDefault(),g.stopPropagation(),l(k,!0),u&&u()},F=(g,N,M,W)=>{const H=Object.assign({},k);if((_||W)&&N)for(const Z of Object.values(H))Z.isSelected=!1,delete Z.userText;else B&&!W&&k[B.id].isSelected&&(H[B.id].isSelected=!1);H[g]={isSelected:N,userText:M};const z=_&&Object.entries(H).some(([Z,K])=>{var Y,ee;return K.isSelected&&((ee=(Y=t.find(re=>`${re.id}`===Z))==null?void 0:Y.optionProperties)==null?void 0:ee.allowsTextEntry)}),G=!x(H);m&&(l(H,G),_&&!z&&G&&u&&u()),L(H)};return e.p(()=>{p()},[]),e.u("form",{className:e.cc(n,"ul-card--multiple","fade-in-transition",m&&!h&&"ul-card--unfocused"),id:"text-form",onClick:v==="multipleselect"?()=>{m&&o!==a&&v==="multipleselect"&&C(a)}:void 0,onSubmit:T,children:[e.u(b.Header,{isRequired:m&&(r==null?void 0:r.required),message:i,properties:r}),e.u(b.MobileEmbedView,{properties:r,children:e.u(e.g,{children:[e.u(b.QuestionBodyWrapper,{children:[r.isDropdown?e.u(b.Select,{disabledOptions:t.filter(g=>S(g.id)),dropdownFooter:d?e.u("div",{className:"ul-card__min-select-counter",style:{marginLeft:"16px"},children:[D(k),"/",r.minSelect]}):void 0,isMultiSelect:!_,multiselectText:r.dropdownMultiselectedText??"choices selected",onChange:g=>{const N={...k};for(const M of t)g.includes(M)?N[M.id].isSelected=!0:N[M.id].isSelected=!1;m&&l(N,!x(N)),L(N)},options:t,placeholderText:r.dropdownPlaceholderText??(_?"Select choice":"Select choice(s)"),value:t.filter(g=>k[g.id].isSelected)}):e.u("div",{className:e.cc(e.getClasses("ul-card__choices",s)),role:_?"radiogroup":"group",children:[t.map(({id:g,label:N,value:M,optionProperties:W})=>{var K,Y;const H=`${g}`,{allowsTextEntry:z,noneOfTheAbove:G}={allowsTextEntry:!1,noneOfTheAbove:!1,...W};return e.u(b.Option,{allowTextEntry:z,border:f,disabled:S(H),error:(Z=k,Q(Z)),id:H,isRadio:_,isSelected:!!((K=k[H])!=null&&K.isSelected),label:N,noneOfTheAbove:G,onUserInputChanged:c,promptText:"Please specify",text:(Y=k[g])==null?void 0:Y.userText,useMobileStyling:s,value:M},H);var Z}),!!d&&e.u("div",{className:"ul-card__min-select-counter",children:[D(k),"/",r.minSelect]})]}),E&&e.u(b.LongformSubmitButton,{handleSubmit:T,isSubmitDisabled:x(k)})]}),!m&&e.u(b.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(b.Button,{disabled:x(k),onClick:T,children:e.getButtonText(r)})})})]})})]},a)},Ee=n=>{const{questionId:i,type:l,next:t,options:r}=n,{setFocusedQuestionId:a}=e.useConfig(v=>({setFocusedQuestionId:v.setFocusedQuestionId}));return e.u(ve,{...n,onSubmit:(v,y)=>{var C;const u=Object.entries(v).find(([,p])=>p.isSelected)||[void 0,void 0],[f,s]=u,m=r.find(p=>`${p.id}`===f);!((C=m==null?void 0:m.optionProperties)!=null&&C.allowsTextEntry)||s!=null&&s.userText&&s.userText.trim()!==""||a(i);const o=s!=null&&s.userText?{[f]:{userText:s.userText}}:null;t({value:m&&f?{[f]:m.value}:{},secondaryValue:o,questionId:i,type:l},y)}})},Oe=n=>{const{questionId:i,type:l,next:t}=n;return e.u(ve,{...n,onSubmit:(r,a)=>{const v=Object.entries(r).reduce((u,[f,s])=>(u[f]=s.isSelected,u),{}),y=Object.entries(r).reduce((u,[f,s])=>{if(!s.userText)return u;const m=u||{};return m[f]={userText:s.userText},m},null);t({value:v,secondaryValue:y,questionId:i,type:l},a)}})},He=({className:n,labels:i,message:l,properties:t,next:r,questionId:a,type:v})=>{const[y,u]=e.h(null),{border:f,useMobileStyling:s,viewDocument:m,isLongFormSurvey:o,focusedQuestionId:C,update:p}=e.useConfig(L=>({border:L.border,useMobileStyling:L.useMobileStyling,viewDocument:L.viewDocument,isLongFormSurvey:j.isLongFormSurvey(L.studyType),focusedQuestionId:L.focusedQuestionId,update:L.update})),h=o&&C===a,w=i&&i.left,k=i&&i.right;return e.p(()=>{p()},[p]),e.u("form",{className:e.cc(n,"ul-card--nps","fade-in-transition",o&&!h&&"ul-card--unfocused"),children:[e.u(b.Header,{isRequired:o&&(t==null?void 0:t.required),message:l,properties:t}),e.u(b.MobileEmbedView,{properties:t,children:[e.u(b.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--nps__numbers",children:[...Array(11)].map((L,_)=>e.u("button",{className:e.cc(e.getClasses("nps-number",s),e.getClasses(`nps-number-${_}`,s)),id:`option-${_}`,onClick:q=>{o&&(q.preventDefault(),q.stopPropagation(),u(_)),r({value:_,questionId:a,type:v},!0)},onKeyDown:q=>{var Q,D;const B=m.querySelectorAll("button.nps-number");q.key==="ArrowRight"?(Q=B[_+1])==null||Q.focus():q.key==="ArrowLeft"?(D=B[_-1])==null||D.focus():q.key!=="Enter"&&q.key!==" "||(o&&(q.preventDefault(),q.stopPropagation(),u(_)),r({value:_,questionId:a,type:v},!0))},onPointerDown:q=>{q.currentTarget.style.zIndex="2",q.currentTarget.style.borderColor=f},onPointerLeave:q=>{q.currentTarget.style.zIndex="auto",q.currentTarget.style.borderColor=j.DEFAULT_BORDER_COLOR},style:y===_?{backgroundColor:f,color:"#fff"}:void 0,tabIndex:0,children:_},_))}),e.u("div",{className:"ul-card--nps__labels",children:[e.u("span",{children:w}),e.u("span",{children:k})]})]}),!t.required&&!o&&e.u(b.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-vertical-centered-container",children:e.u(b.Button,{onClick:L=>{L.preventDefault(),L.stopPropagation(),r({value:null,questionId:a,type:v},!0)},children:e.getButtonText(t)})})})]})]},a)},$e=({className:n,message:i,next:l,properties:t,questionId:r,type:a,showIndividualSubmit:v=!1,onSubmitButtonClick:y})=>{const{border:u,useMobileStyling:f,update:s,isLongFormSurvey:m,focusedQuestionId:o,setFocusedQuestionId:C,isPreview:p}=e.useConfig(d=>({border:d.border,useMobileStyling:d.useMobileStyling,update:d.update,isLongFormSurvey:j.isLongFormSurvey(d.studyType),focusedQuestionId:d.focusedQuestionId,setFocusedQuestionId:d.setFocusedQuestionId,isPreview:d.isPreview})),[h,w]=e.h(""),k=e._(null),L=m&&o===r;e.p(()=>{var d,x;m&&!p&&(L?(d=k.current)==null||d.focus():(x=k.current)==null||x.blur())},[m,L,p]);const _=h.trim(),q=t.required===!0&&!_,B=b.useAutoSize(k,()=>s()),Q=d=>{d.preventDefault(),d.stopPropagation(),l({value:h,questionId:r,type:a},!t.required||_.length>0),y&&y()},D=t&&t.openTextPlaceholder?t.openTextPlaceholder:"";return e.u("form",{className:e.cc(n,"ul-card-text","fade-in-transition",m&&!L&&"ul-card--unfocused"),id:"text-form",onClick:()=>{m&&o!==r&&C(r)},children:[e.u(b.Header,{isRequired:m&&(t==null?void 0:t.required),message:i,properties:t}),e.u(b.MobileEmbedView,{properties:t,children:e.u("div",{className:"ul-card-text",children:e.u(b.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card-text__container",children:e.u("textarea",{"aria-describedby":"ul-caption","aria-labelledby":"ul-question","aria-multiline":"true","aria-placeholder":D,className:e.cc(e.getClasses("ul-card-text__input",f)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:d=>{d.currentTarget.style.borderColor=j.DEFAULT_BORDER_COLOR},onChange:d=>{const{value:x}=d.currentTarget;if(B(),d.preventDefault(),d.stopPropagation(),w(x),m){const P=x.trim().length>0;l({value:x,questionId:r,type:a},P)}},onFocus:d=>{d.currentTarget.style.borderColor=u,C(r)},placeholder:D,ref:k,role:"textbox",tabIndex:0})}),t.footerHtml&&e.u(b.Html,{className:"footer",html:t.footerHtml}),v&&e.u(b.LongformSubmitButton,{handleSubmit:Q,isSubmitDisabled:q}),e.u(b.QuestionBodyFooterContainer,{children:!m&&e.u(b.Button,{disabled:q,onClick:Q,children:e.getButtonText(t)})})]})})})]},r)},oe=1,fe=2,ye=3,ne=n=>n.type==="av_permission",pe=n=>n.type==="screen_permission",xe=(n,i)=>n===void 0?oe:n?((l,t)=>!(ne(t)?t.permissionDescriptors:[]).includes("camera")||l.getVideoTracks().length>0)(n,i)?ye:oe:fe,me={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},J=e.create(n=>({...me,reset:()=>{n(me)},updatePage:i=>{n(i)}}));function le({currentPage:n,pages:i}){const{avStream:l,recordingMediaTypes:t,updatePage:r}=J.getState(),{recorderEventEmitter:a}=e.useConfig.getState();a.emit("av.permission",{"permission.descriptors":n.permissionDescriptors,"stream.ready":(v,y)=>{if(l===v)return;let u=n;if(v&&!n.permissionDescriptors.includes("camera")){const f=i.indexOf(n),s=y!=null&&y.active?f+2:f+1;y!=null&&y.active&&t&&a.emit("begin.recording",{"recording.media.types":t,"start.recording.callback":m=>r({mediaRecordingUids:m})}),u=i[s]}r({currentPage:u,avStream:v})}})}function ae({status:n}){const{nextQuestion:i,passthroughData:l,mediaRecordingUids:t,reset:r}=J.getState(),{recorderEventEmitter:a,handleUploadUpdate:v,index:y}=e.useConfig.getState(),u={value:{taskStatus:n},type:"recordedtask",questionId:(l==null?void 0:l.questionId)||1};l&&a.emit("finish.task",{"begin.callback":f=>{v({mediaRecordingUid:f,isSubmitted:!0,progressPct:0,isComplete:!1})},"progress.callback":(f,s)=>{v({mediaRecordingUid:f,progressPct:s.detail,isSubmitted:!1,isComplete:!1})},"upload.callback":f=>{f&&v({mediaRecordingUid:f,isComplete:!0,isSubmitted:!0,progressPct:100})},"passthrough.data":l,"current.index":y,"task.response":u,"task.complete.callback":f=>{u.value.taskDurationMillisecond=f,t&&(u.value.mediaRecordingUids=t),r(),i(u)}})}function ue({pages:n,setIsRequestingPermission:i}){const{recorderEventEmitter:l,eventEmitFn:t}=e.useConfig.getState(),{updatePage:r,currentPage:a,recordingMediaTypes:v,screenPermissionRequested:y}=J.getState();if(!a)return;const u=n.indexOf(a);switch(a.type){case"av_permission":{const f=y?u+2:u+1;return y&&v&&l.emit("begin.recording",{"recording.media.types":v,"start.recording.callback":s=>{r({mediaRecordingUids:s})}}),void r({currentPage:n[f]})}case"screen_permission":return void l.emit("screen.permission",{"screen.permission.requested":i,"stream.ready.callback":(f,s)=>{const m=s?n[u+1]:a;s&&v&&l.emit("begin.recording",{"recording.media.types":v,"start.recording.callback":o=>{r({captureStream:s,mediaRecordingUids:o})}}),r({currentPage:m,screenPermissionRequested:!0,captureStream:s})}});case"start_task":return t("recorded.task.start"),l.emit("recorded.task.start"),l.emit("start.task"),void r({currentPage:n[u+1],screenPermissionRequested:!0});case"complete_task":return}}const Se="ul-permission-graphics-container",Ce="ul-permission-body",Te=e.cc(Se,"ul_recorded-task-inset-spacing"),ie=e.cc("ul-horizontal-button-container","ul-horizontal-button-container-left"),ke=({richTextBody:n})=>e.u(b.Html,{className:"ul-rich-text-body",html:n,id:"ul-task-detail-container"}),se=({required:n,skipButtonText:i,bottom:l=!1})=>n?null:e.u(b.Button,{className:e.cc(l&&"ul-skip-button-below","ul-button-inactive"),onClick:ae.bind(null,{status:"abandoned"}),children:i||"Skip"}),de=n=>{const{avStream:i,captureStream:l,recordingMediaTypes:t,updatePage:r}=J.getState(),a=(t==null?void 0:t.includes("audio"))||(t==null?void 0:t.includes("video"));e.p(()=>{const v=setInterval(()=>{a&&i&&!i.active?r({avStream:null,currentPage:n[0]}):l&&l.active||r({captureStream:void 0,currentPage:n[a?1:0]})},1e3);return()=>clearInterval(v)},[i,l,a,n,t,r])},Ae=({content:n,pages:i,required:l})=>{const{buttonText:t,skipButtonText:r,taskDetail:a}=n;return de(i),e.u("div",{className:"ul-task-page",children:[a&&e.u(ke,{richTextBody:a}),e.u("div",{className:ie,children:[e.u(b.Button,{onClick:ue.bind(null,{pages:i}),children:t}),e.u(se,{required:l,skipButtonText:r})]})]},"start-task")},Ue=({content:n,pages:i,properties:l})=>{const{buttonText:t,skipButtonText:r}=n;return de(i),e.u("div",{className:"ul-task-page",children:[n.taskDetail&&e.u(ke,{richTextBody:n.taskDetail}),e.u(b.MobileEmbedView,{properties:l,children:e.u("div",{className:ie,children:[e.u(b.Button,{className:"ul-complete-task-button",onClick:ae.bind(null,{status:"completed"}),children:t}),e.u(b.Button,{className:e.cc("ul-button-inactive"),onClick:ae.bind(null,{status:"given.up"}),children:r})]})})]},"complete-task")},Ve=({content:n,pages:i,required:l})=>{const{buttonText:t,skipButtonText:r}=n,[a]=e.useConfig(u=>[u.tabTitle]),[v,y]=e.h(!1);return e.u("div",{children:[e.u("div",{className:Te,children:[e.u("p",{style:{marginTop:"auto"},children:n.selectTabText}),e.u("div",{className:"ul-select-tab-container",children:e.u("p",{className:Ce,children:a})})]}),e.u("div",{className:l?"":ie,children:[e.u(b.Button,{disabled:v,onClick:ue.bind(null,{pages:i,setIsRequestingPermission:y}),children:t}),e.u(se,{required:l,skipButtonText:r})]})]})},We=({content:n})=>e.u(b.Html,{className:e.cc(Se,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"),html:n.svg},"ul-permission-request-graphic"),je=({content:n,pages:i,required:l})=>{const{permissionDeniedHeadline:t,permissionDeniedBody:r,skipButtonText:a,tryAgainButtonText:v}=n,y=ne(i[0])?i[0]:null;return e.p(()=>{const u=setInterval(()=>{y!==null&&le({currentPage:y,pages:i})},1e3);return()=>clearInterval(u)},[y,i]),y?e.u("div",{children:[e.u("div",{className:Te,children:e.u("p",{className:"ul-av-permission-denied-paragraph",children:[e.u("span",{className:"ul-av-permission-denied-headline",children:t}),e.u("span",{className:Ce,children:r})]})}),e.u("div",{className:ie,children:[e.u(b.Button,{onClick:le.bind(null,{currentPage:y,pages:i}),children:v}),e.u(se,{required:l,skipButtonText:a})]})]}):null},Ze=({stream:n})=>e.u("video",{autoPlay:!0,className:e.cc("ul_recorded-task-inset-spacing"),id:"ul-record-task-video-preview",muted:!0,ref:i=>{i&&(i.srcObject=n||null)}}),ze=({content:n,pages:i,required:l})=>{const{skipButtonText:t}=n,{avStream:r}=J.getState();return de(i),e.u("div",{children:[e.u(Ze,{stream:r}),e.u("div",{className:"ul-vertical-button-container-center",children:[e.u(b.Button,{onClick:ue.bind(null,{pages:i}),children:n.buttonText}),e.u(se,{bottom:!0,required:l,skipButtonText:t})]})]})},Ge=({properties:n})=>{const{pages:i,required:l}=n,{avStream:t,currentPage:r}=J.getState();if(r===void 0)return null;switch(r==null?void 0:r.type){case"av_permission":{const a=xe(t,r);return a===oe?e.u(We,{content:r}):a===fe?e.u(je,{content:r,pages:i,required:l}):e.u(ze,{content:r,pages:i,required:l})}case"screen_permission":return e.u(Ve,{content:r,pages:i,required:l});case"start_task":return e.u(Ae,{content:r,pages:i,required:l});case"complete_task":return e.u(Ue,{content:r,pages:i,properties:n});default:return null}},Ye=({className:n,properties:i,next:l,questionId:t})=>{const r=e.useConfig(),{surveyId:a,responseGroupUid:v,userId:y}=r,u=J(),{screenPermissionRequested:f}=u,s=J(h=>h.avStream);let m=J(h=>h.currentPage);m||(m=function({pages:h,userId:w,responseGroupUid:k,surveyId:L,questionId:_,next:q}){const{updatePage:B}=J.getState(),{eventEmitFn:Q,recorderEventEmitter:D}=e.useConfig.getState(),d={questionId:_,surveyId:L,visitorId:w,responseGroupUid:k};let x=0;D.emit("recorded.task.permission.screen"),Q("recorded.task.permission.screen"),D.emit("permission.status",{"permission.status.callback":(E,c,S,T)=>{const F=h[x],{type:g}=F,N=["screen"];if(ne(F)){const{permissionDescriptors:M}=F,W=M==null?void 0:M.includes("microphone"),H=M==null?void 0:M.includes("camera");W&&N.push("audio"),H&&N.push("video"),(E!=null&&E.active&&!H||E!=null&&E.active&&c)&&x++}pe(h[x])&&S&&(x++,D.emit("begin.recording",{"recording.media.types":N,"start.recording.callback":M=>B({mediaRecordingUids:M})})),B({currentPage:h[x],avStream:E,screenPermissionRequested:S,nextQuestion:q,type:g,passthroughData:d,recordingMediaTypes:N,captureStream:T})}});const P=h[x];return P.type==="av_permission"&&le({currentPage:P,pages:h}),P}({questionId:t,surveyId:a,next:h=>{l(h,!0)},pages:i.pages,responseGroupUid:v,userId:y}));let o=m.headline,C=m.captionText;const p=xe(s,m);return pe(m)&&f&&(o=m.permissionDeniedHeadline,C=m.permissionDeniedCaptionText),ne(m)&&p===ye&&(o=m.permissionGrantedHeadline,C=m.permissionGrantedCaptionText),e.u("div",{className:e.cc(n,"ul-center-horizontally","fade-in-transition"),children:[e.u(b.Header,{isRequired:i==null?void 0:i.required,message:o,properties:{captionText:C}}),e.u(b.QuestionBodyWrapper,{children:e.u(Ge,{properties:i})})]})},Ke=({richTextBody:n,plaintextBody:i,update:l})=>(e.p(()=>{l()},[l]),n?e.u(b.Html,{className:"ul-rich-text-body",html:n,id:"ul-card__text-url-body-container"}):i?e.u("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(i?i.split(/\n\s*\n/g):[]).map((t,r)=>e.u("p",{children:t},r))}):null),Xe=({className:n,message:i,next:l,properties:t,questionId:r,type:a})=>{const{visitorAttributes:v,isLongFormSurvey:y,update:u}=e.useConfig(o=>({visitorAttributes:o.visitorAttributes,isLongFormSurvey:j.isLongFormSurvey(o.studyType),update:o.update})),f=(o,C=!1)=>{l({value:C?{skipped:!0}:void 0,questionId:r,type:a},!0)},s=b.getAttributedUrl(t&&t.buttonUrl,v),m=y&&t.promptActionType===b.PromptActionTypeEnum.NO_BUTTON;return e.u("div",{className:e.cc(n,"ul-card__text-url-prompt","fade-in-transition"),children:[e.u(b.Header,{isRequired:y&&(t==null?void 0:t.required),message:i,properties:{questionHtml:t.questionHtml}}),e.u(b.QuestionBodyWrapper,{children:e.u(Ke,{plaintextBody:t==null?void 0:t.body,richTextBody:t==null?void 0:t.richTextBody,update:u})}),e.u(b.MobileEmbedView,{properties:t,children:!m&&e.u(b.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card-button-group",children:[e.u("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:s,id:"ul-card-text__button",onClick:f,onKeyPress:o=>{o.key!=="Enter"&&o.key!==" "||l({value:void 0,questionId:r,type:a},!0)},rel:"noreferrer",role:s?"link":"button",tabIndex:0,target:"_blank",children:e.getButtonText(t)}),t.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:o=>f(0,!0),children:e.getSkipButtonText(t)})]})})})]},r)},Je=({className:n,questionId:i})=>{const{border:l,destroy:t,endCard:r,forceBrandedLogo:a}=e.useConfig(u=>({border:u.border,destroy:u.destroy,endCard:u.endCard,forceBrandedLogo:u.forceBrandedLogo}));e.p(()=>{setTimeout(()=>{t(j.APP_ID)},a?4e3:2e3)},[t,a]);const v=r&&r.subheader?e.u("p",{className:"ul-caption",children:r.subheader}):null,y=r&&r.headline?r.headline:"";return e.u("div",{className:e.cc(n,"ul-card--thanks","fade-in-transition"),children:e.u("div",{children:e.u("div",{className:"ul-card--thanks-content",children:[e.u("div",{className:"ul-thanks-check",children:e.u("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[e.u("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:l,fillRule:"evenodd"}),e.u("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:l,fillRule:"evenodd"}),e.u("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.u(b.Header,{message:y}),v]})})},i)},et=({className:n})=>{const{uploadProgress:i}=e.useConfig(a=>({uploadProgress:a.uploadProgress}));let l,t;Object.values(i).filter(a=>a.isSubmitted).length>1?(l="Your responses are processing",t="Please keep this tab open until your responses are fully processed."):(l="Your response is processing",t="Please keep this tab open until your response is fully processed.");const r=Math.round(Math.min(99,...Object.values(i).filter(a=>a.isSubmitted).map(a=>a.progressPct||0)));return e.u("div",{className:e.cc(n,"ul-card--uploading","fade-in-transition"),children:[e.u("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:"ul-loading-spinner-container",role:"progressbar",children:e.u("div",{className:"ul-loading-spinner",children:[e.u("div",{className:"first"}),e.u("div",{className:"second"}),e.u("div",{className:"third"}),e.u("div",{className:"fourth"})]})}),e.u(b.Header,{message:`${l} (${r}% complete)`}),e.u("p",{className:"ul-caption",children:t})]})},_e=e.F$1(void 0),tt=({value:n,children:i})=>e.u(_e.Provider,{value:n,children:i}),rt=({isRightLabel:n,isLeftLabel:i})=>n?e.MaxDiffChoice.RIGHT:i?e.MaxDiffChoice.LEFT:null,nt="Best",it="Worst",st=({className:n,labels:i,message:l,properties:t,options:r,questionId:a,type:v,next:y})=>{var q,B,Q,D;const[u,f]=e.h(r.map((d,x)=>({...d,label:d.label===""?`Item ${x+1}`:d.label,isRightLabel:!1,isLeftLabel:!1}))),s=(()=>{const d=e.q(_e);if(d===void 0)throw new Error("usePreviousResponses must be used within a PreviousResponsesProvider");return d})(),m={padding:"24px",display:"flex",cursor:"pointer",width:"auto"},[o,C]=e.h(!1);e.p(()=>{const d=u.findIndex(g=>g.isRightLabel),x=u.findIndex(g=>g.isLeftLabel),P=d!==-1&&x!==-1;C(P);const E=!t.required||t.required&&P,c=u.map(g=>({id:g.id,option:g.label,selected:rt(g)})),S=Math.floor(a),T=Object.keys(s).filter(g=>g.startsWith(S.toString())).map(Number).sort((g,N)=>g-N).at(-1),F=[];if(typeof T=="number"){const g=s[T],N=JSON.parse(g);F.push(...N)}F.push(c),setTimeout(()=>{y({value:F,questionId:a,type:v},E,P),C(!1)},P?500:0)},[u]);const{border:p,useMobileStyling:h,enableCspTrustedTypes:w}=e.useConfig(d=>({border:d.border,useMobileStyling:d.useMobileStyling,enableCspTrustedTypes:d.enableCspTrustedTypes})),k=(d,x)=>()=>{o||f(P=>((E,c,S)=>E.map(T=>T.id===c?{...T,isRightLabel:S===e.MaxDiffChoice.RIGHT,isLeftLabel:S===e.MaxDiffChoice.LEFT}:S===e.MaxDiffChoice.RIGHT&&T.isRightLabel||S===e.MaxDiffChoice.LEFT&&T.isLeftLabel?{...T,isRightLabel:!1,isLeftLabel:!1}:T))(P,d,x))},L=(q=t.ratingIcons)==null?void 0:q[0].svg,_=(B=t.ratingIcons)==null?void 0:B[1].svg;return e.u("form",{className:e.cc(n,"ul-card-maxdiff","fade-in-transition"),children:[e.u(b.Header,{isRequired:t==null?void 0:t.required,message:l,properties:t}),e.u(b.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--maxdiff__question-inner-container",children:[e.u("div",{className:"ul-card-maxdiff__label",children:(i==null?void 0:i.left)||((Q=t==null?void 0:t.labels)==null?void 0:Q.left)||nt}),e.u("div",{children:" "}),e.u("div",{className:"ul-card-maxdiff__label",children:(i==null?void 0:i.right)||((D=t==null?void 0:t.labels)==null?void 0:D.right)||it}),u.map(({id:d,label:x,isLeftLabel:P,isRightLabel:E})=>e.u(e.g,{children:[e.u("div",{className:"ul-card-maxdiff__option-control "+(_?"smiley":""),children:_?e.u(ge,{ariaPressed:P,className:P?"ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected good":"ul-card-maxdiff__option-btn",enableCspTrustedTypes:w,html:_,id:`smiley-good-${d}`,onClick:k(d,e.MaxDiffChoice.LEFT)}):e.u(b.Option,{allowTextEntry:!1,ariaLabel:`bestLabel-${x}`,border:p,choiceStyle:m,error:!1,id:`${d}`,isRadio:!0,isSelected:P,onUserInputChanged:k(d,e.MaxDiffChoice.LEFT),useMobileStyling:h})}),e.u("div",{className:"ul-card-maxdiff__option-label",children:x}),e.u("div",{className:"ul-card-maxdiff__option-control "+(L?"smiley":""),children:L?e.u(ge,{ariaPressed:E,className:E?"ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected bad":"ul-card-maxdiff__option-btn",enableCspTrustedTypes:w,html:L,id:`smiley-bad-${d}`,onClick:k(d,e.MaxDiffChoice.RIGHT)}):e.u(b.Option,{allowTextEntry:!1,ariaLabel:`worstLabel-${x}`,border:p,choiceStyle:m,error:!1,id:`${d}`,isRadio:!0,isSelected:E,onUserInputChanged:k(d,e.MaxDiffChoice.RIGHT),useMobileStyling:h})})]}))]})})]},a)},ge=({enableCspTrustedTypes:n,ariaPressed:i,className:l,html:t,id:r,onClick:a})=>{const v=e.F(()=>j.getHtml(t,n),[n,t]);return e.u("span",{"aria-pressed":i,className:l,dangerouslySetInnerHTML:{__html:v},id:r,onClick:a,tabIndex:0,type:"button"})},ot=({className:n,labels:i,message:l,next:t,properties:r,questionId:a,type:v,onSubmitButtonClick:y,options:u,showIndividualSubmit:f=!1})=>{const s=e._(null),m=e._(0),o=e._(0),C=e._(null),p=e._(!1),h=e._([]),[w,k]=e.h(()=>(r==null?void 0:r.required)===!0),[L,_]=e.h(()=>u.map(I=>({...I,rank:null}))),q=e.F(()=>Array.from({length:u.length},(I,O)=>O+1),[u.length]),{isLongFormSurvey:B,focusedQuestionId:Q,setFocusedQuestionId:D,useMobileStyling:d,isPreview:x,headers:P,update:E}=e.useConfig(I=>({useMobileStyling:I.useMobileStyling,isLongFormSurvey:j.isLongFormSurvey(I.studyType),focusedQuestionId:I.focusedQuestionId,setFocusedQuestionId:I.setFocusedQuestionId,isPreview:I.isPreview,headers:I.headers,update:I.update})),c=(P==null?void 0:P["userleap-platform"])==="android",S=d&&!x&&!c,T=!S&&!c,F=B&&Q===a,g=I=>{I.preventDefault(),Z(L),y&&y()},N=(I,O)=>{_($=>{const R=parseInt(O),A=$.map(U=>({...U}));A.some(U=>U.rank==null)&&A.forEach((U,te)=>U.rank=te+1);const X=A.findIndex(U=>U.id===I);if(X===-1)return $;const V=A[X].rank;return R<V?A.forEach(U=>{U.id!==I&&U.rank>=R&&U.rank<V&&(U.rank=U.rank+1)}):R>V&&A.forEach(U=>{U.id!==I&&U.rank>V&&U.rank<=R&&(U.rank=U.rank-1)}),A[X].rank=R,A.sort((U,te)=>U.rank-te.rank),K(A),A})},M=(I,O)=>{for(let $=0;$<h.current.length;$++){const R=h.current[$];if(!R||R===C.current)continue;const A=R.getBoundingClientRect();if(I>=A.left&&I<=A.right&&O>=A.top&&O<=A.bottom)return{element:R,index:$}}return null},W=I=>O=>{if(!S)return;O.preventDefault(),O.stopPropagation(),p.current=!0,s.current=I;const $=O.touches[0];m.current=$.clientY,o.current=$.clientY;const R=O.currentTarget.closest(".ul-card-rank__option");R&&(C.current=R,R.classList.add("is-dragging"))},H=I=>{if(!S||!p.current||s.current===null)return;I.preventDefault(),I.stopPropagation();const O=I.touches[0];o.current=O.clientY;const $=o.current-m.current;C.current&&(C.current.style.transform=`translateY(${$}px)`,C.current.style.zIndex="1000"),h.current.forEach(A=>{A&&A!==C.current&&A.classList.remove("is-drop-target")});const R=M(O.clientX,O.clientY);R&&R.element.classList.add("is-drop-target")},z=I=>{if(!S||!p.current||s.current===null)return;I.preventDefault(),I.stopPropagation();const O=I.changedTouches[0],$=M(O.clientX,O.clientY);C.current&&(C.current.style.transform="",C.current.style.zIndex="",C.current.classList.remove("is-dragging")),h.current.forEach(R=>{R&&R.classList.remove("is-drop-target")}),$&&$.index!==s.current&&G(s.current,$.index),s.current=null,C.current=null,p.current=!1},G=(I,O)=>{_($=>{const R=$.map(X=>({...X})),[A]=R.splice(I,1);return R.splice(O,0,A),R.forEach((X,V)=>{X.rank=V+1}),K(R),R})},Z=I=>{const O={};I.reduce(($,R)=>($[R.id]=R.rank,$),O),t({value:O,questionId:a,type:v},!0)},K=I=>{k(!1),B&&Z(I)},{left:Y,right:ee}=i,re=u.length,Ie=I=>{I.preventDefault(),I.currentTarget.classList.add("is-drop-target")},Ne=I=>{I.currentTarget.classList.remove("is-drop-target")},we=I=>{s.current=null,I.currentTarget.classList.remove("is-dragging")};return e.p(()=>{E()},[E]),e.u("form",{className:e.cc(n,"ul-card-rank","fade-in-transition",B&&!F&&"ul-card--unfocused"),onClick:B?()=>{B&&Q!==a&&D(a)}:void 0,onSubmit:g,children:[e.u(b.Header,{isRequired:r==null?void 0:r.required,message:l,properties:r}),e.u(b.MobileEmbedView,{properties:r,children:c?e.u(e.g,{children:[e.u(b.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",Y]})}),e.u("ol",{className:"ul-card-rank__list",children:L.map(({id:I,label:O,rank:$})=>e.u("li",{className:"ul-card-rank__option",children:[e.u("select",{"aria-label":`Rank for ${O}`,className:e.cc("ul-card-rank__select",$==null&&"ul-card-rank__select--placeholder"),name:`rank[${I}]`,onChange:R=>N(I,R.currentTarget.value),value:$??"",children:[$==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),q.map(R=>e.u("option",{className:"ul-card-rank__select-option",value:R,children:R},`${R}-${a}`))]}),e.u("span",{children:O})]},I))}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[re," - ",ee]})})]}),f&&e.u(b.LongformSubmitButton,{handleSubmit:g,isSubmitDisabled:w})]}),!B&&e.u(b.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(b.Button,{disabled:w,children:e.getButtonText(r)})})})]}):e.u(e.g,{children:[e.u(b.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",Y]})}),e.u("ol",{className:"ul-card-rank__list",onDragOver:c?void 0:I=>{I.preventDefault(),I.dataTransfer&&(I.dataTransfer.dropEffect="move")},children:L.map(({id:I,label:O,rank:$},R)=>{return e.u("li",{className:"ul-card-rank__option",draggable:!!T||void 0,onDragEnd:T?we:void 0,onDragEnter:T?Ie:void 0,onDragLeave:T?Ne:void 0,onDragStart:T?(X=R,V=>{s.current=X,V.dataTransfer&&(V.dataTransfer.effectAllowed="move",V.dataTransfer.setData("text/plain",String(X)),V.currentTarget.classList.add("is-dragging"))}):void 0,onDrop:T?(A=R,V=>{var te,ce;V.preventDefault(),V.currentTarget.classList.remove("is-drop-target");const U=s.current;s.current=null,(ce=(te=V.currentTarget.closest(".ul-card-rank__list"))==null?void 0:te.querySelector(".is-dragging"))==null||ce.classList.remove("is-dragging"),U!=null&&U!==A&&G(U,A)}):void 0,ref:V=>h.current[R]=V,children:[e.u("select",{"aria-label":`Rank for ${O}`,className:e.cc("ul-card-rank__select",$==null&&"ul-card-rank__select--placeholder"),name:`rank[${I}]`,onChange:V=>N(I,V.currentTarget.value),value:$??"",children:[$==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),q.map(V=>e.u("option",{className:"ul-card-rank__select-option",value:V,children:V},`${V}-${a}`))]}),e.u("span",{children:O}),!c&&e.u("button",{"aria-label":`Drag ${O} to reorder`,className:"ul-card-rank__drag-btn",onTouchEnd:S?z:void 0,onTouchMove:S?H:void 0,onTouchStart:S?W(R):void 0,title:"Drag to reorder",type:"button",children:e.u("svg",{fill:"none",height:"17",viewBox:"0 0 16 17",width:"16",xmlns:"http://www.w3.org/2000/svg",children:e.u("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"})})})]},I);var A,X})}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[re," - ",ee]})})]}),f&&e.u(b.LongformSubmitButton,{handleSubmit:g,isSubmitDisabled:w})]}),!B&&e.u(b.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(b.Button,{disabled:w,children:e.getButtonText(r)})})})]})})]},a)},lt=new Set(["open","matrix","multipleselect","multiplechoice","rankorder"]),he=({cardInstance:n,moveToNextQuestion:i,showIndividualSubmit:l,submitQuestion:t,updateCardValues:r})=>{const{isLongFormSurvey:a}=e.useConfig(o=>({isLongFormSurvey:j.isLongFormSurvey(o.studyType)}));if(!n)return null;const{name:v,type:y,props:u}=n,f=l&&lt.has(y),s={className:"ul-card",next:(o,C,p=!0)=>t(o,C&&p),questionId:v,type:y,showIndividualSubmit:l,...f?{next:(o,C)=>{r(o.questionId,o,C??!0)},onSubmitButtonClick:()=>i(v)}:{}},m=(()=>{switch(y){case"consentlegal":return e.u(Le,{...s,...u});case"likert":return e.u(Be,{...s,...u});case"matrix":return e.u(Qe,{...s,...u});case"maxdiff":return e.u(st,{...s,...u});case"multiplechoice":return e.u(Ee,{...s,...u});case"multipleselect":return e.u(Oe,{...s,...u});case"nps":return e.u(He,{...s,...u});case"open":return e.u($e,{...s,...u});case"rankorder":return e.u(ot,{...s,...u});case"recordedtask":return e.u(Ye,{...s,...u});case"texturlprompt":return e.u(Xe,{...s,...u});case"thanks":return e.u(Je,{...s,...u});case"uploading":return e.u(et,{...s,...u});default:return null}})();return m?a?e.u("div",{className:"ul-card-scroll-wrapper",children:m},v):m:null},at=({isSubmitDisabled:n=!1,onSubmit:i,buttonText:l})=>{var C;const{cards:t,forceBrandedLogo:r,index:a,marketingUrl:v,showSurveyBrand:y,slugName:u,surveyId:f,useMobileStyling:s}=e.useConfig(p=>({cards:p.cards,forceBrandedLogo:p.forceBrandedLogo,index:p.index,marketingUrl:p.marketingUrl,showSurveyBrand:p.showSurveyBrand,slugName:p.slugName,surveyId:p.surveyId,useMobileStyling:p.useMobileStyling})),m=((C=t[a])==null?void 0:C.type)==="thanks",o=e.buildMarketingUrl({marketingUrl:v,slugName:u,surveyId:f,forceBrandedLogo:r});return e.u("footer",{className:e.cc("long-form-question-footer-container",s&&"long-form-question-footer-container--mobile",m&&"long-form-question-footer-container-center"),children:[m&&r?e.u(e.ThankYouLink,{marketingUrlLink:o}):e.u("div",{className:"long-form-question-footer-container-logo",children:y?e.u(e.SprigBrandLogo,{forceBrandedLogo:r,marketingUrlLink:o}):null}),!m&&e.u("div",{className:e.cc("ul-card__button-wrapper","ul-card-vertical__button-wrapper","long-form-question-footer-container-actions"),children:e.u(b.Button,{className:e.cc("long-form-button",n&&"sprig-button-disabled"),disabled:n,onClick:i,children:e.u("span",{className:"long-form-button-text-container",children:l??e.u(e.Arrow,{stroke:"white"})})})})]})};exports.PageCard=({cards:n,next:i,previousResponses:l})=>{var E;const[t,r]=e.h({}),[a,v]=e.h({}),y=e.F(()=>({...l,...e.buildReadableResponseMap(n.map(c=>{var S,T;return{...c,value:((S=t[c.name])==null?void 0:S.value)??null,secondaryValue:((T=t[c.name])==null?void 0:T.secondaryValue)??null}}))}),[l,t,n]),u=e.pipeReadableResponsesIntoCards(n,y),{isLongFormSurvey:f,focusedQuestionId:s,setFocusedQuestionId:m,update:o,index:C}=e.useConfig(c=>({index:c.index,isLongFormSurvey:j.isLongFormSurvey(c.studyType),focusedQuestionId:c.focusedQuestionId,setFocusedQuestionId:c.setFocusedQuestionId,update:c.update})),p=e._(null),h=e._(!1),w=e._(null);e.y(()=>{o()},[o,C]);const k=e.T(c=>{var g,N;h.current=!0;const S=n.findIndex(M=>M.name===c);if(!f||c===null||S===-1)return void(h.current=!1);const T=(g=p.current)==null?void 0:g.querySelectorAll(".ul-card-scroll-wrapper")[S],F=(N=p.current)==null?void 0:N.closest(".ul-card__container");if(T&&F){if(T&&F){const M=T.getBoundingClientRect(),W=F.getBoundingClientRect(),H=M.top-W.top+F.scrollTop,z=H+M.height/2,G=window.innerHeight-157;let Z;M.height>=G?Z=H:Z=z-F.clientHeight/2;const K=F.clientHeight,Y=F.scrollHeight-K,ee=Math.max(0,Math.min(Z,Y));F.scrollTo({top:ee,behavior:"smooth"}),setTimeout(()=>{h.current=!1},500)}}else h.current=!1},[f,n]);function L(c,S){return c.map(T=>{const F=S[T.name],g=u.find(N=>N.name===T.name);return{...F,questionText:g?e.getProcessedQuestionText(g):void 0}})}e.p(()=>{s!==null&&n.findIndex(c=>c.name===s)!==-1||m(n[0].name)},[n,s,m]);const _=c=>{if(!f)return;const S=n.findIndex(T=>T.name===c)+1;if(S<n.length){const T=n[S].name;m(T)}else m(c)};e.p(()=>{f&&s!==null&&(w.current!==s?k(s):w.current=null)},[s,f,k]);const q=e.T(()=>{var W,H;if(h.current)return;const c=(W=p.current)==null?void 0:W.closest(".ul-card__container");if(!c)return;const S=(H=p.current)==null?void 0:H.querySelectorAll(".ul-card-scroll-wrapper");if(!S||S.length===0)return;const T=c.getBoundingClientRect(),F=T.top+T.height/2;let g=0,N=1/0;S.forEach((z,G)=>{const Z=z.getBoundingClientRect(),K=Z.top+Z.height/2,Y=Math.abs(F-K);Y<N&&(N=Y,g=G)});const M=n[g];w.current=M.name,m(M.name)},[n,m]);e.p(()=>{var S;if(!f)return;const c=((S=p.current)==null?void 0:S.closest(".ul-card__container"))||null;return c&&c.addEventListener("scroll",q,{passive:!0}),()=>{c&&c.removeEventListener("scroll",q)}},[q,f]);const B=e.F(()=>Object.values(a).every((c,S)=>{var F;const T=n[S];return!(!(T!=null&&T.props)||!("properties"in T.props)||((F=T.props.properties)==null?void 0:F.required)!==!1)||c}),[a,n]),Q=async(c,S,T)=>{return v(g=>({...g,[c]:T})),await(F=g=>({...g,[c]:S}),new Promise(g=>{r(N=>{const M=F(N);return g(M),M})}));var F};e.p(()=>{if(!f)return;const c={};n.forEach(S=>{var F,g;const T=S;(g=(F=T.props)==null?void 0:F.properties)!=null&&g.required||(c[T.name]={value:null,questionId:T.name,type:T.type})}),r(c),v({})},[n,f]);const D=async(c,S)=>{if(f){const T=await Q(c.questionId,c,S),F=d(c.type),g=x(c.type);if(F&&_(c.questionId),g&&S){const N=L(n,T);i(N)}}else{const T=u.find(g=>g.name===c.questionId),F={...c,questionText:T?e.getProcessedQuestionText(T):void 0};i([F])}},d=c=>new Set(["nps","likert","multiplechoice"]).has(c),x=c=>new Set(["videovoice","consentlegal","texturlprompt","maxdiff"]).has(c),P=((E=n[0])==null?void 0:E.type)==="thanks";return f?e.u("div",{className:"ul-card-list-container--longform","data-testid":"ui-container",ref:p,children:[e.u(tt,{value:l,children:u.map((c,S)=>e.u(he,{cardInstance:c,moveToNextQuestion:_,showIndividualSubmit:f&&n.length>1&&S<n.length-1,submitQuestion:D,updateCardValues:Q},(c==null?void 0:c.name)||S))}),!P&&e.u(at,{isSubmitDisabled:Object.keys(t).length<n.length||!B,onSubmit:function(){const c=L(n,t);i(c)}})]}):e.u(e.g,{children:[e.u("div",{"data-testid":"ui-container",style:{display:"none"}}),u.map((c,S)=>e.u(he,{cardInstance:c,moveToNextQuestion:_,showIndividualSubmit:f&&n.length>1&&S<n.length-1,submitQuestion:D,updateCardValues:Q},(c==null?void 0:c.name)||S))]})};