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