@sprig-technologies/sprig-bundled 2.46.1 → 2.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/conversational-styles-BO6t2-y4.js +4 -0
  2. package/dist/conversational-styles-CWaKMg_f.cjs +1 -0
  3. package/dist/conversational-ui-CoOUaxMV.js +1516 -0
  4. package/dist/conversational-ui-D4JFc07q.cjs +658 -0
  5. package/dist/conversational-v2-styles-BCsmmSE3.cjs +1 -0
  6. package/dist/conversational-v2-styles-BK9YvF7Q.js +4 -0
  7. package/dist/getAttributedUrl-Cy6ZmssZ.js +197 -0
  8. package/dist/getAttributedUrl-GFl2RKI_.cjs +12 -0
  9. package/dist/index-Cg785YpL.js +4 -0
  10. package/dist/index-DDZBH-vP.js +768 -0
  11. package/dist/index-DYrVxSAM.cjs +1 -0
  12. package/dist/index-D_IOfB4u.cjs +1 -0
  13. package/dist/index-Dm2nk1lh.js +4 -0
  14. package/dist/{index-D2UpkOdR.js → index-Q_m-uWR7.js} +993 -993
  15. package/dist/index-pfR5IQvc.cjs +66 -0
  16. package/dist/index-rJoqOgIc.cjs +1 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.ts +43 -0
  19. package/dist/index.js +1 -1
  20. package/dist/view-bHnS65wz.js +1834 -0
  21. package/dist/view-umqtk1IA.cjs +1 -0
  22. package/package.json +1 -1
  23. package/dist/conversational-styles-B-bImmUK.js +0 -4
  24. package/dist/conversational-styles-vDq05r1U.cjs +0 -1
  25. package/dist/conversational-ui-BZDC1buu.js +0 -1511
  26. package/dist/conversational-ui-DqQZMJkq.cjs +0 -658
  27. package/dist/conversational-v2-styles-DeqT460S.js +0 -4
  28. package/dist/conversational-v2-styles-DkN3ff79.cjs +0 -1
  29. package/dist/getAttributedUrl-BuO50-dW.cjs +0 -12
  30. package/dist/getAttributedUrl-BvS4nPJR.js +0 -193
  31. package/dist/index-BCIAxJWJ.cjs +0 -66
  32. package/dist/index-DiPr4x-u.cjs +0 -1
  33. package/dist/index-fcbxeQg3.js +0 -734
  34. package/dist/view-5-qQQKtl.js +0 -1789
  35. package/dist/view-D8rc4Fhu.cjs +0 -1
@@ -0,0 +1,1516 @@
1
+ import { u as F, a as n, h as Q, e as ne, z as fe, c as H, b as J, d as ge, g as He, p as de, F as ke, _ as le, T as Ce, A as wn, M as Ee, i as En, P as jn, o as In, r as Tn, t as _n, S as Dn, D as Me, B as rn, y as Sn, x as Pn } from "./view-bHnS65wz.js";
2
+ import { v as Ln, E as De, j as on, A as $e, k as Nn, f as sn } from "./index-Q_m-uWR7.js";
3
+ import { B as se, M as ae, b as ue, O as Fe, Q as pe, S as Rn, L as Mn, u as Bn, a as we, H as Ve, g as qn, c as Un, D as An } from "./getAttributedUrl-Cy6ZmssZ.js";
4
+ const he = "https://cdn.sprig.com", S = { document: void 0, videojs: void 0 }, ze = (e) => e + "-loading-spiner", W = "hidden", Ye = ".m3u8", Se = "questionId", Pe = "ul-video-recorder-camera-off-button", Le = "ul-recording-in-session", On = [{ type: "link", content: `${he}/dependencies/videojs-record-4.5.0.min.css` }, { type: "script", content: `${he}/dependencies/RecordRTC-5.6.2.js` }, { type: "script", content: `${he}/dependencies/adapter.8.0.0.min.js` }, { type: "script", content: `${he}/dependencies/videojs-record-4.5.0.min.js` }, { type: "script", content: `${he}/userleap-web-upchunk-v2.2.2.js` }], an = [{ type: "link", content: `${he}/dependencies/video-js-7.18.0.min.css` }, { type: "script", content: `${he}/dependencies/video-js-7.18.0.min.js` }, { type: "style", content: `/* progress control styles */
5
+ .video-js .vjs-control {
6
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
7
+ }
8
+
9
+ .video-js .vjs-progress-control .vjs-progress-holder {
10
+ margin: 0 0px;
11
+ }
12
+
13
+ .video-js .vjs-progress-control {
14
+ position: absolute;
15
+ height: 3px;
16
+ width: 100%;
17
+ }
18
+ /* position and align the buttons and button texts */
19
+ .ul-control-panel {
20
+ bottom: 0;
21
+ width: 100%;
22
+ flex-direction: column;
23
+ background-color: white;
24
+ height: fit-content;
25
+ z-index: 2;
26
+ }
27
+
28
+ .ul-buttons-panel {
29
+ color: black;
30
+ display: flex;
31
+ gap: 20px;
32
+ height: 50px;
33
+ justify-content: center;
34
+ margin: 10px;
35
+ padding: 2px 14px 0;
36
+ }
37
+
38
+ .video-js .vjs-volume-panel {
39
+ height: 30px;
40
+ width: 40px;
41
+ }
42
+
43
+ .ul-inactive {
44
+ opacity: 0.3;
45
+ cursor: default;
46
+ pointer-events: none;
47
+ }
48
+
49
+ /* buttons */
50
+ .ul-buttons-panel > .vjs-button {
51
+ background-color: rgba(0, 0, 0, 0.05);
52
+ border-radius: 50%;
53
+ display: flex;
54
+ height: 3em;
55
+ justify-content: center;
56
+ width: 3em;
57
+ }
58
+
59
+ .vjs-button>.vjs-icon-placeholder:before {
60
+ align-items: center;
61
+ display: flex;
62
+ font-size: unset;
63
+ line-height: 0.5;
64
+ justify-content: center;
65
+ }
66
+
67
+ span.ul-button-text {
68
+ align-self: flex-end;
69
+ position: relative;
70
+ top: 14px;
71
+ }
72
+
73
+ #ul-camera-button {
74
+ white-space: nowrap;
75
+ }
76
+
77
+ .video-js .vjs-volume-control.vjs-volume-horizontal {
78
+ background-color: #fff;
79
+ z-index: 1;
80
+ }
81
+
82
+ .vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level {
83
+ background-color: black;
84
+ }
85
+
86
+ .video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,
87
+ .video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,
88
+ .video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active {
89
+ width: 40px;
90
+ }
91
+
92
+ .video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active,
93
+ .video-js .vjs-volume-panel .vjs-volume-control:active,
94
+ .video-js .vjs-volume-panel.vjs-hover .vjs-mute-control ~ .vjs-volume-control,
95
+ .video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,
96
+ .video-js .vjs-volume-panel:active .vjs-volume-control,
97
+ .video-js .vjs-volume-panel:focus .vjs-volume-control {
98
+ visibility: visible;
99
+ left: 40px;
100
+ position: absolute;
101
+ transition: visibility 0.1s, opacity 0.1s, height 0.1s, width 0.1s, left 0s, top 0s;
102
+ }
103
+
104
+ /* play button customization */
105
+ .video-js .vjs-play-control {
106
+ color: black;
107
+ }
108
+
109
+ .video-js .vjs-play-control .vjs-icon-placeholder:before {
110
+ content: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5363 6.40226L1.93958 10.7006C1.64037 10.8502 1.28833 10.6326 1.28833 10.2981V1.7014C1.28833 1.36688 1.64037 1.14931 1.93958 1.29891L10.5363 5.59727C10.868 5.76311 10.868 6.23642 10.5363 6.40226Z' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
111
+ }
112
+
113
+ /* position and style the current timer */
114
+ .ul-time-panel {
115
+ position: absolute;
116
+ bottom: 80px;
117
+ left: 10px;
118
+ height: 22px;
119
+ color: black;
120
+ border: 1px solid #e0e0eb;
121
+ border-radius: 23px;
122
+ background-color: white;
123
+ width: fit-content;
124
+ }
125
+
126
+ .video-js .vjs-current-time,
127
+ .vjs-no-flex .vjs-current-time {
128
+ display: flex;
129
+ align-items: center;
130
+ text-align: center;
131
+ }
132
+
133
+ /* remove the dot progress indicator */
134
+ .video-js .vjs-play-progress:before,
135
+ .video-js .vjs-volume-level:before,
136
+ .vjs-icon-circle:before,
137
+ .vjs-seek-to-live-control .vjs-icon-placeholder:before {
138
+ content: none;
139
+ }
140
+
141
+ .video-js .vjs-mute-control .vjs-icon-placeholder:before {
142
+ content: url("data:image/svg+xml,%3Csvg width='19' height='14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M8.825.324A.75.75 0 019.25 1v11.667a.75.75 0 01-1.219.585l-3.96-3.169H1a.75.75 0 01-.75-.75v-5a.75.75 0 01.75-.75h3.07L8.031.414a.75.75 0 01.794-.09zM7.75 2.56L4.802 4.92a.75.75 0 01-.469.164H1.75v3.5h2.583a.75.75 0 01.469.165l2.948 2.358V2.56zM14.911.47a.75.75 0 011.061 0 9.084 9.084 0 010 12.844.75.75 0 01-1.06-1.06 7.584 7.584 0 000-10.724.75.75 0 010-1.06zM11.97 3.41a.75.75 0 011.06 0 4.917 4.917 0 010 6.953.75.75 0 11-1.06-1.06 3.417 3.417 0 000-4.832.75.75 0 010-1.06z' fill='%23262136'/%3E%3C/svg%3E");
143
+ }
144
+
145
+ .video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before {
146
+ content: url("data:image/svg+xml,%3Csvg width='19' height='14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.5 1.167L4.333 4.5H1v5h3.333L8.5 12.833V1.167zM17.17 4.5l-5 5M12.17 4.5l5 5' stroke='%23262136' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
147
+ }
148
+
149
+ .video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before {
150
+ content: url("data:image/svg+xml,%3Csvg width='19' height='14' viewBox='0 0 19 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M8.82489 0.32403C9.08474 0.44892 9.25 0.711703 9.25 1.00001V12.6667C9.25 12.955 9.08474 13.2178 8.82489 13.3427C8.56504 13.4675 8.25661 13.4324 8.03148 13.2523L4.07025 10.0833H1C0.585786 10.0833 0.25 9.74755 0.25 9.33334V4.33334C0.25 3.91913 0.585786 3.58334 1 3.58334H4.07025L8.03148 0.414355C8.25661 0.234253 8.56504 0.19914 8.82489 0.32403ZM7.75 2.56048L4.80185 4.91899C4.66887 5.02538 4.50364 5.08334 4.33333 5.08334H1.75V8.58334H4.33333C4.50364 8.58334 4.66887 8.6413 4.80185 8.74769L7.75 11.1062V2.56048Z' fill='%23262136'/%3E%3C/svg%3E%0A");
151
+ }
152
+
153
+ .video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before {
154
+ content: url("data:image/svg+xml,%3Csvg width='19' height='14' viewBox='0 0 19 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M8.82489 0.32403C9.08474 0.44892 9.25 0.711703 9.25 1.00001V12.6667C9.25 12.955 9.08474 13.2178 8.82489 13.3427C8.56504 13.4675 8.25661 13.4324 8.03148 13.2523L4.07025 10.0833H1C0.585786 10.0833 0.25 9.74755 0.25 9.33334V4.33334C0.25 3.91913 0.585786 3.58334 1 3.58334H4.07025L8.03148 0.414355C8.25661 0.234253 8.56504 0.19914 8.82489 0.32403ZM7.75 2.56048L4.80185 4.91899C4.66887 5.02538 4.50364 5.08334 4.33333 5.08334H1.75V8.58334H4.33333C4.50364 8.58334 4.66887 8.6413 4.80185 8.74769L7.75 11.1062V2.56048Z' fill='%23262136'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.9698 3.41124C12.2627 3.11839 12.7376 3.11846 13.0304 3.4114C13.9521 4.33341 14.4699 5.58376 14.4699 6.88748C14.4699 8.19121 13.9521 9.44156 13.0304 10.3636C12.7376 10.6565 12.2627 10.6566 11.9698 10.3637C11.6768 10.0709 11.6767 9.596 11.9696 9.30307C12.6101 8.66235 12.9699 7.79346 12.9699 6.88748C12.9699 5.98151 12.6101 5.11262 11.9696 4.4719C11.6767 4.17896 11.6768 3.70409 11.9698 3.41124Z' fill='%23262136'/%3E%3C/svg%3E%0A");
155
+ }
156
+
157
+ .video-js .vjs-volume-control:hover .vjs-mouse-display {
158
+ display: none !important;
159
+ }
160
+
161
+ .video-js .vjs-play-progress {
162
+ background-color: black;
163
+ }
164
+
165
+ /* position video player inside the container */
166
+ .video-js .vjs-tech {
167
+ position: static;
168
+ }
169
+
170
+ .video-js .vjs-time-tooltip {
171
+ padding: 0.25em 0.75em;
172
+ align-items: center;
173
+ color: #333;
174
+ background: #FCFCFD;
175
+ border-radius: 99px;
176
+ text-align: center;
177
+ border: 1px solid #E0E0EB;
178
+ display: flex;
179
+ align-items: center;
180
+ justify-content: center;
181
+ top: -25px;
182
+ font-size: 12px !important;
183
+ width: 50px !important;
184
+ }
185
+
186
+ .video-js .vjs-play-progress.vjs-slider-bar .vjs-time-tooltip {
187
+ visibility: hidden !important;
188
+ }
189
+
190
+ .video-js .vjs-progress-control .vjs-mouse-display {
191
+ z-index: 2;
192
+ }
193
+
194
+ .ul-video-player {
195
+ width: 100%;
196
+ display: flex;
197
+ flex-direction: column;
198
+ height: auto;
199
+ border: 1px solid #E6E6E6;
200
+ background-color: white;
201
+ box-sizing: border-box;
202
+ border-radius: 4px;
203
+ background-clip: border-box;
204
+ overflow: hidden;
205
+ }
206
+
207
+ .video-js.vjs-fullscreen:not(.vjs-ios-native-fs) {
208
+ border: none;
209
+ }
210
+
211
+ #video-response-player-secondary-video-player {
212
+ max-width: 200px;
213
+ margin-right: 20px;
214
+ background-color: transparent;
215
+ }
216
+
217
+ #ul-card-video__player_recorder-video-recorder.vjs-fullscreen {
218
+ display: table;
219
+ }
220
+
221
+ .video-js div.vjs-progress-control {
222
+ margin-top: -3px;
223
+ }
224
+
225
+ .video-js .vjs-progress-control .vjs-slider {
226
+ background-color: #B2BBBD;
227
+ }
228
+
229
+ .vjs-record.video-js .vjs-control.vjs-button.vjs-fullscreen-control {
230
+ position:relative;
231
+ }
232
+
233
+ .video-js .vjs-fullscreen-control .vjs-icon-placeholder:before {
234
+ content: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.82143 2.54004L12.2614 2.54004C12.9242 2.54004 13.4614 3.0773 13.4614 3.74004L13.4614 6.18004' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M6.17955 13.46L3.73955 13.46C3.07681 13.46 2.53955 12.9227 2.53955 12.26L2.53955 9.81996' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M12.7772 3.22266L9.36475 6.63516' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M6.29434 9.70605L2.88184 13.1186' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
235
+ }
236
+
237
+ .video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before {
238
+ content: url("data:image/svg+xml,%3Csvg width='16' height='16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.583 9.813H5.25a1 1 0 011 1v3.666M5.375 10.688L1 15.061M14.917 5.813H11.25a1 1 0 01-1-1V1.146M15.063 1l-4.376 4.375' stroke='%23262136' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
239
+ }
240
+
241
+ .video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before, .video-js .vjs-icon-replay:before {
242
+ content: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5363 6.40226L1.93958 10.7006C1.64037 10.8502 1.28833 10.6326 1.28833 10.2981V1.7014C1.28833 1.36688 1.64037 1.14931 1.93958 1.29891L10.5363 5.59727C10.868 5.76311 10.868 6.23642 10.5363 6.40226Z' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
243
+ }
244
+
245
+ .video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before, .vjs-icon-pause:before {
246
+ content: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='3.61885' y='2.06074' width='3.16185' height='11.88' rx='0.9' fill='black' stroke='%23EDEDED' stroke-width='0.6' stroke-linecap='round'/%3E%3Crect x='9.21797' y='2.06074' width='3.16185' height='11.88' rx='0.9' fill='black' stroke='%23EDEDED' stroke-width='0.6' stroke-linecap='round'/%3E%3C/svg%3E%0A");
247
+ padding: 2px;
248
+ }
249
+
250
+ .vjs-error-display {
251
+ display: none;
252
+ }
253
+
254
+ .ul-video-player-video {
255
+ position: relative;
256
+ top: 0;
257
+ left: 0;
258
+ width: 100%;
259
+ }
260
+
261
+ .ul-video-container {
262
+ width: 100%;
263
+ height: auto;
264
+ left: 0px;
265
+ top: 0px;
266
+
267
+ background-color: transparent;
268
+ border-radius: 4px;
269
+
270
+ align-items: start;
271
+ display: flex;
272
+ flex-direction: column;
273
+
274
+ /* Inside Auto Layout */
275
+
276
+ flex: none;
277
+ order: 0;
278
+ flex-grow: 0;
279
+ margin: 10px 0px;
280
+ position: relative;
281
+ }
282
+
283
+ .vjs-record button.vjs-device-button.vjs-control {
284
+ background: rgba(255, 255, 255, 96);
285
+ width: 100%;
286
+ height: 100%;
287
+ left: 0;
288
+ top: 0;
289
+ margin: 0;
290
+ border-radius: 0;
291
+ line-height: 0.6;
292
+ padding: 10px;
293
+ display: flex;
294
+ align-items: center;
295
+ flex-direction: column;
296
+ justify-content: center;
297
+ z-index: 3;
298
+ }
299
+
300
+ .vjs-record .vjs-device-button.vjs-control:before {
301
+ font-size: 14px !important;
302
+ color: #333;
303
+ content: "Your browser needs to access your camera and microphone for video recording";
304
+ line-height: 135%;
305
+ }
306
+
307
+ .vjs-record .vjs-device-button.vjs-control.permission-denied:before {
308
+ font-size: 16px !important;
309
+ color: #262136;
310
+ content: "Unable to access your camera and microphone";
311
+ }
312
+
313
+ .vjs-record .vjs-device-button.vjs-control:after {
314
+ display: inline-block;
315
+ background: #F0F0F5;
316
+ font-size: 13px;
317
+ border-radius: 4px;
318
+ content: "Request Permissions";
319
+ padding: 1em 2em;
320
+ color: #333;
321
+ margin-top: 20px;
322
+ }
323
+
324
+ .vjs-record .vjs-device-button.vjs-control.permission-denied:after {
325
+ display: inline-block;
326
+ background: white;
327
+ font-size: 13px;
328
+ content: "Please go to your browser settings and update permissions to enable recording";
329
+ padding: 1em;
330
+ color: #4B575D;
331
+ margin: 5px;
332
+ line-height: 135%;
333
+ text-align: center;
334
+ }
335
+
336
+ .vjs-control.vjs-button.ul-video-recorder-delete-button, .vjs-control.vjs-button.ul-video-recorder-toggle-button, .vjs-control.vjs-button.ul-video-recorder-camera-off-button-audio-only, .vjs-control.vjs-button.ul-video-recorder-camera-off-button {
337
+ cursor: pointer;
338
+ }
339
+
340
+ .ul-video-recorder-delete-button .vjs-icon-placeholder:before {
341
+ content: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.21234 7.37549V11.1193M2.53931 4.25595H13.4593H2.53931ZM5.57234 4.25595V3.00833C5.57222 2.84433 5.60354 2.68192 5.6645 2.53038C5.72546 2.37884 5.81488 2.24115 5.92762 2.12519C6.04037 2.00922 6.17424 1.91726 6.32158 1.85456C6.46892 1.79185 6.62683 1.75964 6.78628 1.75977H9.21234C9.37179 1.75964 9.5297 1.79185 9.67703 1.85456C9.82437 1.91726 9.95824 2.00922 10.071 2.12519C10.1837 2.24115 10.2732 2.37884 10.3341 2.53038C10.3951 2.68192 10.4264 2.84433 10.4263 3.00833V4.25595H5.57234ZM12.2463 4.25595V12.9912C12.2463 13.3223 12.1184 13.6399 11.8907 13.8741C11.6631 14.1082 11.3543 14.2398 11.0323 14.2398H4.96628C4.64432 14.2398 4.33555 14.1082 4.10789 13.8741C3.88023 13.6399 3.75234 13.3223 3.75234 12.9912V4.25595H12.2463ZM6.78628 7.37549V11.1193V7.37549Z' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A");
342
+ }
343
+
344
+ .ul-video-recorder-toggle-button .vjs-icon-placeholder:before {
345
+ content: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0Z' fill='%23D15153'/%3E%3C/svg%3E");
346
+ }
347
+
348
+ .ul-video-recorder-toggle-button.ul-recording-in-session .vjs-icon-placeholder:before {
349
+ content: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 10L12 2C12 0.89543 11.1046 -4.85396e-07 10 -4.37114e-07L2 -8.74228e-08C0.89543 -3.91405e-08 -4.85396e-07 0.895431 -4.37114e-07 2L-8.74228e-08 10C-3.91405e-08 11.1046 0.895431 12 2 12L10 12C11.1046 12 12 11.1046 12 10Z' fill='%23D15153'/%3E%3C/svg%3E%0A");
350
+ }
351
+
352
+ .ul-video-recorder-camera-off-button .vjs-icon-placeholder:before {
353
+ content: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0_2645_4654)'%3E%3Cpath d='M15.1491 4.75L10.5991 8L15.1491 11.25V4.75Z' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M9.29912 3.4502H2.14912C1.43115 3.4502 0.849121 4.03223 0.849121 4.7502V11.2502C0.849121 11.9682 1.43115 12.5502 2.14912 12.5502H9.29912C10.0171 12.5502 10.5991 11.9682 10.5991 11.2502V4.7502C10.5991 4.03223 10.0171 3.4502 9.29912 3.4502Z' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_2645_4654'%3E%3Crect width='15.6' height='15.6' fill='white' transform='translate(0.199951 0.200195)'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
354
+ }
355
+
356
+ .ul-video-recorder-camera-off-button-audio-only .vjs-icon-placeholder:before {
357
+ content: url("data:image/svg+xml,%3Csvg width='22' height='15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M.75 3A2.75 2.75 0 013.5.25h9.081A2.75 2.75 0 0115.331 3v9a2.75 2.75 0 01-2.75 2.75H3.5A2.75 2.75 0 01.75 12V3zM3.5 1.75c-.69 0-1.25.56-1.25 1.25v9c0 .69.56 1.25 1.25 1.25h9.081c.69 0 1.25-.56 1.25-1.25V3c0-.69-.56-1.25-1.25-1.25H3.5z' fill='%23262136'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M14.53 2.03l-12 12-1.06-1.06 12-12 1.06 1.06zM20.87 1.525a.75.75 0 01.38.652v10.588a.75.75 0 01-1.134.644l-5.92-3.53a.75.75 0 01-.365-.643v-3.53a.75.75 0 01.366-.644l5.919-3.53a.75.75 0 01.754-.007zm-5.539 4.607V8.81l4.419 2.635V3.497l-4.419 2.635z' fill='%23262136'/%3E%3C/svg%3E");
358
+ transform: scale(0.75);
359
+ }
360
+
361
+ .ul-upload-progress-label {
362
+ padding: 0.15em 0.75em;
363
+ align-items: center;
364
+ font-size: 12px;
365
+ color: #333;
366
+ background: #FCFCFD;
367
+ border-radius: 99px;
368
+ text-align: center;
369
+ border: 1px solid #E0E0EB;
370
+ display: flex;
371
+ align-items: center;
372
+ justify-content: center;
373
+ position: absolute;
374
+ bottom: 75px;
375
+ left: calc(50% - 65px);
376
+ width: 130px;
377
+ z-index: 5;
378
+ }
379
+
380
+ .ul-upload-progress-label__time {
381
+ display: inline-flex;
382
+ margin-left: 0.8em;
383
+ align-items: center;
384
+ }
385
+
386
+ .ul-upload-progress-label__time:before {
387
+ content: "";
388
+ display: inline-flex;
389
+ width: 1px;
390
+ height: 12px;
391
+ background-color: #E0E0EB;
392
+ margin-right: 0.8em;
393
+ }
394
+
395
+ @keyframes grow {
396
+ 0% {
397
+ transform: scale(1);
398
+ background-color: #EEECFC;
399
+ }
400
+ 50% {
401
+ transform: scale(1.2);
402
+ background-color: #E1DFF4;
403
+ }
404
+ 100% {
405
+ transform: scale(1);
406
+ background-color: #EEECFC;
407
+ }
408
+ }
409
+
410
+ .ul-audio-recorder-placeholder:before {
411
+ width: 80px;
412
+ height: 80px;
413
+ border-radius: 120px;
414
+ background-color: #EEECFC;
415
+ content: "";
416
+ position: absolute;
417
+ left: calc(50% - 40px);
418
+ top: calc(50% - 40px);
419
+ animation: 6s infinite grow;
420
+ transform-origin: 50% 60%;
421
+ }
422
+
423
+ .ul-audio-recorder-placeholder:after {
424
+ content: url("data:image/svg+xml,%3Csvg width='98' height='98' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='a' maskUnits='userSpaceOnUse' x='0' y='0' width='98' height='98'%3E%3Ccircle cx='49' cy='49' r='49' fill='%23EDECF8'/%3E%3C/mask%3E%3Cg mask='url(%23a)'%3E%3Ccircle cx='49' cy='49' r='50' fill='%23645CC2'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.422 81.812c5.405-15.547 20.187-26.706 37.576-26.706 17.39 0 32.172 11.159 37.577 26.707-9.164 10.43-22.601 17.013-37.576 17.013-14.976 0-28.414-6.583-37.577-17.014z' fill='%23fff' fill-opacity='.6'/%3E%3Ccircle cx='49' cy='29' r='17' fill='%23fff' fill-opacity='.7'/%3E%3C/g%3E%3C/svg%3E");
425
+ position: absolute;
426
+ left: 50%;
427
+ top: 50%;
428
+ transform: translate(-50%, -50%);
429
+ transform: translate(-50%, -50%) scale(0.6);
430
+ }
431
+
432
+ .ul-audio-recorder-placeholder {
433
+ min-height: 150px;
434
+ width: 100%;
435
+ background-color: #fcfcfd;
436
+ display: block;
437
+ position: relative;
438
+ }
439
+
440
+ .vjs-fullscreen .ul-audio-recorder-placeholder {
441
+ vertical-align: middle;
442
+ display: table-cell;
443
+ }
444
+
445
+ .vjs-fullscreen .ul-control-panel {
446
+ height: 80px;
447
+ position: absolute;
448
+ bottom: 0;
449
+ left: 0;
450
+ width: 100%;
451
+ max-width: 100%;
452
+ background-color: #F8F8F8;
453
+ }
454
+
455
+ .vjs-playback-rate .vjs-playback-rate-value {
456
+ align-items: center;
457
+ display: flex;
458
+ font-size: 12px;
459
+ justify-content: center;
460
+ }
461
+
462
+ .vjs-playback-rate .vjs-menu {
463
+ left: -5px;
464
+ bottom: 3px;
465
+ }
466
+
467
+ .vjs-menu-button-popup .vjs-menu .vjs-menu-content {
468
+ background-color: white;
469
+ border: 1px solid rgba(0, 0, 0, 0.1);
470
+ box-sizing: border-box;
471
+ border-radius: 4px;
472
+ }
473
+
474
+ .vjs-menu li {
475
+ font-size: 12px;
476
+ padding: 5px 0;
477
+ }
478
+
479
+ .vjs-menu li.vjs-selected {
480
+ color: lightgray;
481
+ }
482
+
483
+ .vjs-menu li.vjs-menu-item:hover {
484
+ background-color: rgba(0, 0, 0, 0.05);
485
+ }
486
+
487
+ .vjs-fullscreen .ul-buttons-panel {
488
+ top: calc(50% - 30px);
489
+ position: relative;
490
+ }
491
+
492
+ .vjs-fullscreen .vjs-record-indicator.vjs-control {
493
+ bottom: 90px !important;
494
+ }
495
+
496
+ .vjs-record.video-js div.vjs-control.vjs-record-indicator {
497
+ padding: 0.3em 0.75em 0.15em 15px;
498
+ align-items: center;
499
+ font-size: 12px;
500
+ color: #333;
501
+ background: #FCFCFD;
502
+ border-radius: 99px;
503
+ text-align: center;
504
+ border: 1px solid #E0E0EB;
505
+ display: flex;
506
+ justify-content: center;
507
+ align-items: center;
508
+ position: absolute;
509
+ bottom: 75px;
510
+ top: auto;
511
+ left: calc(50% - 21px);
512
+ width: 43px;
513
+ height: 16px;
514
+ z-index: 4;
515
+ }
516
+
517
+ .vjs-record.video-js div.vjs-control.vjs-record-indicator:after {
518
+ content: "";
519
+ background-color: #EB5757;
520
+ width: 6px;
521
+ height: 6px;
522
+ border-radius: 8px;
523
+ animation: none;
524
+ top: 4px;
525
+ left: 5px;
526
+ }
527
+
528
+ .vjs-record.video-js div.vjs-control.vjs-record-indicator:before {
529
+ position: relative;
530
+ font-size: 9px;
531
+ animation: none;
532
+ opacity: 1;
533
+ color: #333;
534
+ top: auto;
535
+ left: auto;
536
+ }
537
+
538
+ .ul-video-player-loading {
539
+ display: inline-block;
540
+ position: relative;
541
+ width: 6rem;
542
+ height: 6rem;
543
+
544
+ }
545
+ .ul-video-player-loading div {
546
+ box-sizing: border-box;
547
+ position: absolute;
548
+ display: block;
549
+ width: 80%;
550
+ height: 80%;
551
+ margin: 5px;
552
+ border: 5px solid #666;
553
+ border-radius: 50%;
554
+ animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
555
+ border-color: #666 transparent transparent transparent;
556
+ }
557
+
558
+ .first {
559
+ animation-delay: -0.45s;
560
+ }
561
+ .second {
562
+ animation-delay: -0.3s;
563
+ }
564
+ .third {
565
+ animation-delay: -0.15s;
566
+ }
567
+
568
+ @keyframes lds-ring {
569
+ 0% {
570
+ transform: rotate(0deg);
571
+ }
572
+ 100% {
573
+ transform: rotate(360deg);
574
+ }
575
+ }
576
+
577
+ .ul-video-btn {
578
+ width: 100%;
579
+ border: 1px solid #E6E6E6;
580
+ border-radius: 4px;
581
+ background-color: rgba(0, 0, 0, 0.02);
582
+ padding: 8px;
583
+ font-weight: 500;
584
+ font-size: 15px;
585
+ }
586
+
587
+ .ul-record-response-btn:before, .ul-record-response-btn:after, .ul-back-question-btn:before, .ul-back-question-btn:after {
588
+ margin: 0 5px;
589
+ vertical-align: middle;
590
+ }
591
+
592
+ .ul-record-response-btn:before {
593
+ content: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0_2645_4654)'%3E%3Cpath d='M15.1491 4.75L10.5991 8L15.1491 11.25V4.75Z' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M9.29912 3.4502H2.14912C1.43115 3.4502 0.849121 4.03223 0.849121 4.7502V11.2502C0.849121 11.9682 1.43115 12.5502 2.14912 12.5502H9.29912C10.0171 12.5502 10.5991 11.9682 10.5991 11.2502V4.7502C10.5991 4.03223 10.0171 3.4502 9.29912 3.4502Z' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_2645_4654'%3E%3Crect width='15.6' height='15.6' fill='white' transform='translate(0.199951 0.200195)'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
594
+ display: inline-block;
595
+ transform: translate(0px, 2px);
596
+ }
597
+
598
+ .ul-record-response-btn:after {
599
+ content: 'Record your Response';
600
+ }
601
+
602
+ .ul-back-question-btn:before {
603
+ content: url("data:image/svg+xml,%3Csvg width='15' height='16' viewBox='0 0 15 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13.8757 8.22361L1.1118 14.6056C0.945578 14.6887 0.75 14.5678 0.75 14.382V1.61803C0.75 1.43219 0.945579 1.31131 1.1118 1.39443L13.8757 7.77639C14.06 7.86852 14.06 8.13148 13.8757 8.22361Z' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
604
+ display: inline-block;
605
+ transform: scale(0.85) translate(0, 1px);
606
+ -moz-transform: scale(0.85) translate(0, 2px);
607
+ }
608
+
609
+ .ul-back-question-btn:after {
610
+ content: 'Back to Question';
611
+ }
612
+
613
+ .hidden {
614
+ display: none !important;
615
+ opacity: 0;
616
+ visibility: hidden;
617
+ }
618
+
619
+ .visible {
620
+ visibility: visible;
621
+ opacity: 1;
622
+ animation: fade 0.3s;
623
+ }
624
+
625
+ @keyframes fade {
626
+ 0% {
627
+ opacity: 0;
628
+ }
629
+
630
+ 100% {
631
+ opacity: 1;
632
+ }
633
+ }
634
+
635
+ #ul-recording-countdown-screen {
636
+ width: 100%;
637
+ height: 100%;
638
+ color: black;
639
+ background-color: rgba(255, 255, 255, 0.8);
640
+ position: absolute;
641
+ text-align: center;
642
+ font-size: 15px;
643
+ z-index: 1;
644
+ display: table;
645
+ }
646
+
647
+ .ul-countdown-text {
648
+ vertical-align: middle;
649
+ display: table-cell;
650
+ transform: translate(0, -25px);
651
+ }
652
+
653
+ .vjs-fullscreen > #ul-recording-countdown-screen {
654
+ font-size: 25px;
655
+ transform: unset;
656
+ }
657
+
658
+ .vjs-poster {
659
+ background-size: cover;
660
+ }
661
+ ` }], We = "-secondary-video-player", ln = "-video-recorder";
662
+ let oe, Ke;
663
+ const ve = async ({ event: e, apiBase: o, headers: t, visitorId: r, envId: i, metadata: s }) => {
664
+ const l = S.document.documentElement;
665
+ if (!r || !i) return;
666
+ const c = { event: `SDK - ${e}`, visitorId: r, environmentId: i, metadata: { ...s || {}, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: l.clientWidth, clientHeight: l.clientHeight, location: window.location.href, language: navigator.language } };
667
+ (await fetch(`${o}/sdk/1/visitors/${r}/analytics`, { method: "POST", cache: "no-cache", headers: t, body: JSON.stringify(c) })).ok || console.warn("[Sprig] (ERR-444) Failed to track analytics", e);
668
+ }, ce = async (e, o, t, r, i, s) => {
669
+ ve({ event: `Video Error ${o}`, apiBase: t, headers: r, visitorId: i, envId: s, metadata: { errorMessage: e.message } });
670
+ const l = S.document.documentElement, c = { screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: l.clientWidth, clientHeight: l.clientHeight, location: window.location.href, language: navigator.language }, a = { action: o, err: { message: e.message, stack: e.stack }, meta: c, vid: i, envId: s };
671
+ (await fetch(`${t}/sdk/1/errors`, { method: "POST", cache: "no-cache", headers: { ...r, "userleap-platform": "video_recorder", "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(a) })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", e);
672
+ }, dn = (e, o) => {
673
+ if (e.length === 0) return o && o();
674
+ Promise.all(e.reduce((t, r) => (t.push(((i, { type: s, content: l }) => new Promise(function(c, a) {
675
+ let p;
676
+ s === "script" ? (p = S.document.createElement("script"), p.src = l) : s === "link" ? (p = S.document.createElement("link"), p.rel = "stylesheet", p.href = l, p.type = "text/css") : (p = S.document.createElement("style"), p.innerHTML = l), p.onload = function() {
677
+ c(l);
678
+ }, p.onerror = function() {
679
+ a(l);
680
+ }, p.async = !1, p.id = btoa(l), i.appendChild(p);
681
+ }))(S.document.head, r)), t), [])).then(() => {
682
+ S.videojs = S.document.defaultView.videojs, o && o();
683
+ }).catch(function(t) {
684
+ console.log(t + " failed to load");
685
+ });
686
+ }, Je = (e, o, t) => {
687
+ if (o === "start" && (e.style.visibility = "visible"), o === "none") e.style.visibility = W;
688
+ else if (o === "success") e.style.visibility = W, e.innerHTML = "Upload succeeded!";
689
+ else {
690
+ const r = Math.round(parseFloat(t));
691
+ e.innerHTML = `Uploading <span class="ul-upload-progress-label__time">${r}%</span>`, e.style.background = `linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`;
692
+ }
693
+ }, Ne = (e, o) => {
694
+ const t = S.videojs(e.id());
695
+ return t == null ? void 0 : t.payload[o];
696
+ }, cn = (e, o) => {
697
+ const t = new (S.videojs.getComponent("Component"))(e);
698
+ return t.addClass("ul-buttons-panel"), o.map((r) => {
699
+ t.addChild(r);
700
+ }), Hn(t), t;
701
+ }, Hn = (e) => {
702
+ e.children().forEach((o) => {
703
+ if (ee[o.name_]) {
704
+ const t = je(ee[o.name_], `ul-${ee[o.name_]}`);
705
+ o.el_.appendChild(t);
706
+ }
707
+ });
708
+ }, je = (e, o = "") => {
709
+ const t = S.document.createElement("span");
710
+ return t.className = "ul-button-text", t.innerHTML = e, t.id = o, t;
711
+ }, un = (e, o, t, r, i = !1, s) => {
712
+ e.addClass("ul-video-player");
713
+ const l = new (S.videojs.getComponent("Component"))(e);
714
+ l.addClass("ul-control-panel"), e.progressBar = l.addChild("ProgressControl"), t && e.src(t), e.audioPlayerPlaceholder = new (S.videojs.getComponent("Component"))(e), e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");
715
+ const c = t && t.src ? zn(t.src) : null;
716
+ !t || !i && c ? (e.audioPlayerPlaceholder.hide(), S.document.getElementById(`${e.id()}_html5_api`).style.height = "100%", c && e.poster(c)) : (e.children()[0].classList.add("vjs-hidden"), S.document.getElementById(`${e.id()}_html5_api`).style.height = "0px"), e.on("play", () => {
717
+ i || !t || c || Fn(e), s == null || s.play();
718
+ }), e.on("pause", () => {
719
+ s == null || s.pause();
720
+ }), e.on("seeked", () => {
721
+ s == null || s.currentTime(e.currentTime());
722
+ }), e.on("ratechange", () => {
723
+ s == null || s.playbackRate(e.playbackRate());
724
+ }), e.addChild(e.audioPlayerPlaceholder, {}, 1), l.addChild(o), e.addChild(l), r && r(e);
725
+ }, $n = (e, o, t, r, i, s, l, c = !1) => {
726
+ Ke = Date.now();
727
+ const a = qe(o, { controls: !1, bigPlayButton: !1, fluid: !1, width: 1280, height: 720, playsinline: !0, plugins: { record: { audio: !0, video: { mandatory: { minWidth: 1280, minHeight: 720 } }, frameWidth: 1280, frameHeight: 720, maxLength: 600, autoMuteDevice: !0 } } });
728
+ if (!a) return;
729
+ a.payload = t;
730
+ const { surveyId: p, questionId: y, responseGroupUid: g, visitorId: m, envId: f } = t;
731
+ let P;
732
+ const b = (h) => {
733
+ const v = Pe, u = Pe + "-audio-only";
734
+ Je(a.uploadProgressLabel, "none"), oe && oe.startTime >= Ke && oe.abort();
735
+ const I = S.document.getElementById("ul-camera-button");
736
+ h ? (a.children()[0].classList.add("vjs-hidden"), T.removeClass(v), T.addClass(u), I.innerHTML = ee.TurnOnCamera, a.audioPlayerPlaceholder.removeClass("vjs-hidden"), P == null || P.getTracks().forEach((w) => {
737
+ w.stop();
738
+ }), window.navigator.mediaDevices.getUserMedia({ video: !0, audio: !0 }).then((w) => {
739
+ P = w, w.getVideoTracks().forEach((R) => {
740
+ R.enabled = !1;
741
+ }), a.record().onDeviceReady(w);
742
+ }).catch(a.record().onDeviceError.bind(a.record()))) : (P == null || P.getVideoTracks().forEach((w) => {
743
+ w.enabled = !0;
744
+ }), a.children()[0].classList.remove("vjs-hidden"), a.record().getDevice(), T.removeClass(u), T.addClass(v), I.innerHTML = ee.TurnOffCamera, a.audioPlayerPlaceholder.addClass("vjs-hidden"));
745
+ }, C = new (S.videojs.getComponent("Button"))(a, { clickHandler: () => {
746
+ C.hasClass(W) || (ve({ event: "Video Delete Button Clicked", apiBase: r, headers: l, visitorId: m, envId: f, metadata: { questionId: y, responseGroupUid: g, surveyId: p } }), b(a.cameraOff), i(B.DELETE, {}), T.removeClass(W), C.addClass(W));
747
+ } });
748
+ C.addClass("ul-video-recorder-delete-button"), C.el_.appendChild(je(ee.DeleteButton, "ul-delete-button"));
749
+ const D = S.document.getElementById(o), E = () => {
750
+ D.classList.contains("vjs-fullscreen") && a.cameraOff ? D.style.display = "table" : D.style.display = "flex";
751
+ };
752
+ E();
753
+ const T = new (S.videojs.getComponent("Button"))(a, { clickHandler: () => {
754
+ a.record().isRecording() || (a.cameraOff = !a.cameraOff, ve({ event: "Video Camera Button Clicked", apiBase: r, headers: l, visitorId: t.visitorId, envId: t.envId, metadata: { questionId: y, responseGroupUid: g, surveyId: p, cameraOff: a.cameraOff } }), b(a.cameraOff), !C.hasClass(W) && C.addClass(W), i(B.DELETE, {}), E());
755
+ } });
756
+ T.addClass(Pe), T.el_.appendChild(je(ee.TurnOffCamera, "ul-camera-button"));
757
+ const j = new (S.videojs.getComponent("Button"))(a, { clickHandler: () => {
758
+ const h = S.document.getElementById("ul-recorder-toggle");
759
+ if (a.record().isRecording()) a.record().stop(), h && (h.innerHTML = ee.RecordButton), j.removeClass(Le), C.removeClass(W);
760
+ else {
761
+ const v = S.document.getElementById("ul-recording-countdown-screen");
762
+ if (v) v.remove(), h && (h.innerHTML = ee.RecordButton), b(a.cameraOff), i(B.DELETE, {}), T.removeClass(W), C.addClass(W), j.removeClass(Le), d.show();
763
+ else {
764
+ j.addClass(Le), d.hide(), T.addClass(W), C.addClass(W), h && (h.innerHTML = ee.StopButton);
765
+ const u = S.document.createElement("div");
766
+ u.id = "ul-recording-countdown-screen", D.insertBefore(u, D.children[1]), u.style.height = `${D.offsetHeight}px`, pn(a, 3);
767
+ }
768
+ }
769
+ } });
770
+ j.addClass("ul-video-recorder-toggle-button"), j.el_.appendChild(je(ee.RecordButton, "ul-recorder-toggle"));
771
+ const q = S.document.createElement("p");
772
+ q.style.visibility = "hidden", q.className = "ul-upload-progress-label", e.appendChild(q), a.uploadProgressLabel = q;
773
+ const V = cn(a, [C, T, "PlayToggle", j, "FullscreenToggle"]), d = V.children().find((h) => h.name_ === "FullscreenToggle");
774
+ d.hasClass("vjs-disabled") && d.hide();
775
+ const k = V.children().find((h) => h.name_ === "PlayToggle");
776
+ k.hide(), C.addClass(W), un(a, V, s, !1, c), a.on("stopRecord", () => {
777
+ j.hide(), k.show(), d.show(), C.removeClass(W);
778
+ }), a.on("deviceReady", () => {
779
+ j.show(), k.hide(), C.addClass(W);
780
+ }), ((h, v, u, I, w) => {
781
+ const { surveyId: R, responseGroupUid: N, visitorId: L, envId: U } = h.payload;
782
+ h.on("deviceError", function() {
783
+ console.warn("device error: ", h.deviceErrorCode), h.deviceErrorCode.message === "Permission denied" ? (h.deviceButton.addClass("permission-denied"), u && u(B.ERROR, { type: B.PERMISSION_DENIED }), ve({ event: "Video Permission Denied", apiBase: v, headers: w, visitorId: L, envId: U, metadata: { questionId: Ne(h, Se), responseGroupUid: N, surveyId: R } })) : (u && u(B.ERROR, { type: B.OTHER }), ce(new Error(h.deviceErrorCode.message), "recorderDeviceError", v, w, L, U));
784
+ }), h.on("error", function(Z, Y) {
785
+ ce(Y || h.error(), "recorderError", v, w, L, U);
786
+ }), h.on("startRecord", function(Z, Y) {
787
+ I(h.uploadProgressLabel, "none"), ve({ event: "Video Record Start", apiBase: v, headers: w, visitorId: L, envId: U, metadata: { questionId: Ne(h, Se), responseGroupUid: N, surveyId: R } });
788
+ }), h.on("finishRecord", async function() {
789
+ I(h.uploadProgressLabel, "start", 0);
790
+ const Z = Ne(h, Se);
791
+ if (!R) {
792
+ const x = "internal error: missing fields in payload";
793
+ return u && u(B.ERROR, { type: B.OTHER }), ce(new Error(x), "finishRecord", v, w, L, U), null;
794
+ }
795
+ h.record().stopDevice();
796
+ const Y = h.cameraOff ? B.MEDIA_TYPE_AUDIO : B.MEDIA_TYPE_VIDEO, K = Ln();
797
+ ve({ event: "Video Record Finish", apiBase: v, headers: w, visitorId: L, envId: U, metadata: { mediaRecordingUid: K, questionId: Z, responseGroupUid: N, surveyId: R, mediaType: Y } });
798
+ const te = { surveyId: R, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), mediaType: Y, mediaRecordingUid: K };
799
+ Z && (te.questionId = Z), N && (te.responseGroupUid = N), L && (te.visitorId = L);
800
+ const re = await (async () => {
801
+ const x = await fetch(`${v}/2/environments/integrations/upload`, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(te) });
802
+ if (x.ok) {
803
+ const A = await x.json();
804
+ return u && u(B.UPLOAD_STARTED, { [B.UPLOAD_ID]: A.upload.id, [B.MEDIA_TYPE]: Y, [B.MEDIA_RECORDING_UID]: K }), A.upload.url;
805
+ }
806
+ return u && u(B.ERROR, { type: B.OTHER, response: x }), ce(new Error("failed to get upload response with url"), "finishRecord", v, w, L, U), null;
807
+ })();
808
+ re && (oe = S.document.defaultView.UpChunk.createUpload({ endpoint: re, file: new S.document.defaultView.File([h.recordedData], `recording ${Y} ${Date.now()}`), chunkSize: 5120 }), oe.startTime = Date.now(), ve({ event: "Video Upload Start", apiBase: v, headers: w, visitorId: L, envId: U, metadata: { mediaRecordingUid: K, questionId: Z, responseGroupUid: N, surveyId: R, mediaType: Y, url: re } }), oe.on("error", (x) => {
809
+ I(h.uploadProgressLabel, "none"), u && u(B.UPLOAD_FINISHED, { [B.MEDIA_RECORDING_UID]: K }), ce(x, "finishRecord", v, w, L, U);
810
+ }), oe.on("progress", (x) => {
811
+ u && u(B.UPLOAD_PROGRESS, { [B.MEDIA_RECORDING_UID]: K, [B.UPLOAD_PROGRESS_PCT]: x.detail }), I(h.uploadProgressLabel, "progress", x.detail);
812
+ }), oe.on("success", () => {
813
+ I(h.uploadProgressLabel, "success"), u && u(B.UPLOAD_FINISHED, { [B.MEDIA_RECORDING_UID]: K }), ve({ event: "Video Upload Success", apiBase: v, headers: w, visitorId: L, envId: U, metadata: { mediaRecordingUid: K, questionId: Z, responseGroupUid: N, surveyId: R, mediaType: Y, url: re, elapsedMs: oe.startTime && Date.now() - oe.startTime } });
814
+ }));
815
+ });
816
+ })(a, r, i, Je, l);
817
+ const _ = [{ name: "microphone" }];
818
+ !a.cameraOff && _.push({ name: "camera" }), Promise.all(_.map((h) => {
819
+ var v;
820
+ return (v = navigator == null ? void 0 : navigator.permissions) == null ? void 0 : v.query(h);
821
+ })).then((h) => {
822
+ h.reduce((v, u) => v & u.state === "granted", !0) && a && (a.deviceButton && a.deviceButton.hide(), a.record().getDevice());
823
+ }).catch((h) => {
824
+ });
825
+ }, pn = (e, o = 3) => {
826
+ const t = S.document.getElementById("ul-recording-countdown-screen");
827
+ t && o === 0 ? (t.remove(), e.record().start()) : t && (t.innerHTML = `<span class='ul-countdown-text'>Recording in... ${o}</span>`, setTimeout(() => {
828
+ pn(e, o - 1);
829
+ }, 1e3));
830
+ }, mn = (e) => {
831
+ const o = S.document.createElement("div");
832
+ return o.className = "ul-video-container", o.appendChild(((t) => {
833
+ const r = S.document.createElement("div");
834
+ return r.className = "ul-video-player-loading", r.id = ze(t), ["first", "second", "third", "fourth"].map((i) => {
835
+ const s = S.document.createElement("div");
836
+ s.className = i, r.appendChild(s);
837
+ }), r;
838
+ })(e)), o;
839
+ }, Be = (e, o) => {
840
+ const t = S.document.createElement("video");
841
+ t.id = e, t.className = "video-js vjs-default-skin ul-video-player-video";
842
+ const r = S.document.createElement("p");
843
+ r.className = "vjs-no-js", r.innerHTML = "To view this video please enable JavaScript, and consider upgrading to a web browser that";
844
+ const i = S.document.createElement("a");
845
+ return i.href = "https://videojs.com/html5-video-support/", i.target = "_blank", i.innerHTML = "supports HTML5 video", r.appendChild(i), t.appendChild(r), o.appendChild(t), o;
846
+ }, Fn = (e, o) => {
847
+ e.children()[0].classList.remove("vjs-hidden"), e.audioPlayerPlaceholder.hide(), S.document.getElementById(`${e.id()}_html5_api`).style.height = "100%";
848
+ }, qe = (e, o) => S.document.getElementById(e) ? o ? S.videojs(e, o) : S.videojs(e) : (console.error(`Error in finding player element with ID, ${e}`), null), Vn = (e, o, t, r = !1, i = "https://api.sprig.com", s = document, l = null, c = null) => {
849
+ S.document = s;
850
+ const a = e + "-video-player", p = mn(a);
851
+ return S.document.addEventListener("securitypolicyviolation", (y) => {
852
+ ce(new Error(`Voice & Video feature violates ${y.violatedDirective} web page CSP policies for the question player.`), "playerDeviceError", i, {});
853
+ }), dn(an, () => {
854
+ S.document.getElementById(ze(a)).remove(), Be(a, p);
855
+ const y = { playsinline: !0, playbackRates: [0.5, 1, 1.5, 2], fill: !0 };
856
+ try {
857
+ const g = e + We;
858
+ Be(g, p);
859
+ const m = qe(a, y), f = qe(g, { muted: !0, ...y });
860
+ if (!m || !f) return;
861
+ ((C, D, E) => {
862
+ C.addClass(`ul${We}`);
863
+ const T = new (S.videojs.getComponent("Component"))(C);
864
+ D && C.src(D), C.addChild(T), E && E(C);
865
+ })(f, l, c), l || f.addClass(W);
866
+ const P = cn(m, ["PlaybackRateMenuButton", "PlayToggle", "FullscreenToggle"]), b = P.children().find((C) => C.name_ === "FullscreenToggle");
867
+ b.hasClass("vjs-disabled") && b.hide(), un(m, P, o, t, r, f);
868
+ } catch (g) {
869
+ return void ce(new Error(`Error when creating video player object ${g}`), "playerDeviceError", i, {});
870
+ }
871
+ }), p;
872
+ }, Xe = (e) => {
873
+ const o = e + ln;
874
+ if (S.document.getElementById(o) && S.videojs) {
875
+ try {
876
+ if (!S.videojs(o).record().stream) return;
877
+ } catch {
878
+ return;
879
+ }
880
+ S.videojs(o).record().stop(), S.videojs(o).record().stopDevice();
881
+ }
882
+ }, zn = (e) => {
883
+ if (!e) return null;
884
+ const o = e.match(/https:\/\/stream.mux.com\/(.*)/);
885
+ let t = o ? o[1] : null;
886
+ return t.includes(Ye) && (t = t.replace(Ye, "")), t ? `https://image.mux.com/${t}/thumbnail.jpg?time=0` : null;
887
+ }, B = { UPLOAD_STARTED: "upload.started", UPLOAD_PROGRESS: "upload.progress", UPLOAD_FINISHED: "upload.finished", DELETE: "delete", ERROR: "error", MEDIA_TYPE: "media.type", PERMISSION_DENIED: "permission_denied", OTHER: "other", UPLOAD_ID: "upload.id", UPLOAD_PROGRESS_PCT: "upload.progress.pct", MEDIA_RECORDING_UID: "media.recording.uid", MEDIA_TYPE_VIDEO: "video", MEDIA_TYPE_AUDIO: "audio" }, ee = { PlaybackRateMenuButton: "Speed", PlayToggle: "Play", FullscreenToggle: "Expand", TurnOnCamera: "Turn on", TurnOffCamera: "Turn off", DeleteButton: "Delete", RecordButton: "Record", StopButton: "Stop", PauseButton: "Pause" }, Gn = ({ properties: e, surveyVideoUrl: o, questionId: t }) => {
888
+ const r = `ul-card-video__question_player-q${t}`, { apiURL: i, viewDocument: s } = F((l) => ({ apiURL: l.apiURL, viewDocument: l.viewDocument }));
889
+ return n("div", { id: r, ref: (l) => {
890
+ if ((l == null ? void 0 : l.children.length) === 0 && !e.properties.hideRecordedPrompt) {
891
+ const c = Vn(r, { src: o, type: "application/x-mpegURL" }, void 0, e.properties.mediaType === B.MEDIA_TYPE_AUDIO, i, s);
892
+ l.appendChild(c);
893
+ }
894
+ } });
895
+ }, Qn = () => n("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: n("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#FFFFFF", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), me = ({ isDisabled: e, onClick: o, children: t, style: r, showCheckmark: i }) => {
896
+ const s = i ?? (typeof t == "string" && t.toLowerCase() === "finish");
897
+ return n(se, { disabled: !!e, onClick: o, style: r, type: "button", children: [s && n("span", { style: { paddingRight: "4px" }, children: n(Qn, {}) }), t] });
898
+ }, Zn = ({ className: e, next: o, properties: t, questionId: r, type: i, isAnswered: s }) => {
899
+ const { useMobileStyling: l, border: c, cards: a } = F((d) => ({ useMobileStyling: d.useMobileStyling, border: d.border, cards: d.cards })), [p, y] = Q(!1), [g, m] = Q(""), [f, P] = Q(!1), b = t == null ? void 0 : t.collectName, C = (t == null ? void 0 : t.nameLabelText) || "Full Name", D = (t == null ? void 0 : t.consentText) || "I agree to the stated conditions", E = ne({ buttonText: (t == null ? void 0 : t.submitButtonText) || "Submit" }), T = fe(r, a), j = !!g.trim(), q = p && (!b || j), V = (d, k = !1) => {
900
+ d.preventDefault(), d.stopPropagation();
901
+ let _ = null;
902
+ if (!k) {
903
+ if (!q) return void P(!0);
904
+ _ = { submitted: !0 }, b && (_.name = g);
905
+ }
906
+ o({ value: _, questionId: r, type: i }, !!k || q);
907
+ };
908
+ return n("div", { className: H(e, "ul-card__consent-legal", "fade-in-transition"), children: n(ae, { embeddedType: "pdf", properties: t, children: n(ue, { children: [n("div", { className: "sprig-stretch", children: [n(Fe, { allowTextEntry: !1, border: c, error: f && !p, id: "consent", isRadio: !1, isSelected: p, label: D, onUserInputChanged: ({ selected: d }) => {
909
+ d !== p && y(!p);
910
+ }, useMobileStyling: l }), b && n("input", { "aria-label": C, "aria-placeholder": C, className: H(J("ul-consent-legal__name-input", l)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: (d) => {
911
+ d.currentTarget.style.borderColor = f && !j ? De : on;
912
+ }, onFocus: (d) => {
913
+ d.currentTarget.style.borderColor = f && !j ? De : c;
914
+ }, onInput: (d) => {
915
+ d.preventDefault(), d.stopPropagation(), m(d.currentTarget.value);
916
+ }, placeholder: C, style: f && !j ? { borderColor: De } : {}, tabIndex: 0, value: g })] }), n("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: !s && (t.required ? n(me, { isDisabled: !q, onClick: (d) => V(new SubmitEvent(d.type)), showCheckmark: T, children: E }) : n(ge, { children: [n(me, { isDisabled: !q, onClick: (d) => V(new SubmitEvent(d.type)), showCheckmark: T, children: E }), n("button", { className: "ul-card-skip__button", onClick: (d) => V(new SubmitEvent(d.type), !0), children: He(t) })] })) })] }) }) }, r);
917
+ }, Yn = () => {
918
+ const { destroy: e, forceBrandedLogo: o } = F((t) => ({ destroy: t.destroy, forceBrandedLogo: t.forceBrandedLogo }));
919
+ return de(() => {
920
+ setTimeout(() => {
921
+ e($e);
922
+ }, o ? 4e3 : 2e3);
923
+ }, [e, o]), n("div", { className: "end-of-survey-text", children: "End of survey" });
924
+ }, Wn = ({ activeValue: e, border: o, icon: t, enableCspTrustedTypes: r, isPressed: i, range: s, scaleLabelType: l, selectedValue: c, setSelectedValue: a, setActiveValue: p, setIsPressed: y, useMobileStyling: g, value: m, viewDocument: f }) => {
925
+ const P = `option-${m}`, b = l === "number", C = l === "star", D = l === "smiley", E = b && m === e || m === c, [T, j] = (() => {
926
+ const d = C && c !== null && m <= c;
927
+ return C && m <= e || D && m === e || d || m === e || m === c ? [o, i || d || m === c ? 1 : 0.3] : ["", 1];
928
+ })(), q = ke(() => {
929
+ const d = { borderColor: E ? T : "", fillOpacity: E ? "" : j, zIndex: E ? 3 : "auto", color: c === m ? "#fff" : "" };
930
+ return b ? { ...d, backgroundColor: c === m ? T : "" } : { ...d, color: C || D || c === m ? T : "" };
931
+ }, [E, T, j, c, m, b, C, D]), V = ke(() => Nn((({ icon: d, scaleLabelType: k, value: _, selectedValue: h }) => {
932
+ if (k === "smiley" && _ === h) {
933
+ let v = 0;
934
+ return d.replace(/black/g, () => ++v == 1 ? "black" : "white");
935
+ }
936
+ return d;
937
+ })({ icon: t, scaleLabelType: l, value: m, selectedValue: c }), r), [r, t, l, c, m]);
938
+ return n("button", { "aria-label": b ? void 0 : String(m), className: (() => {
939
+ switch (l) {
940
+ case "star":
941
+ return H(J("likert-star", g), J(`likert-star-${m}`, g));
942
+ case "smiley":
943
+ return H(J("likert-smiley", g), J(`likert-smiley-${m}`, g));
944
+ default:
945
+ return m === s ? H(J("likert-number", g), J(`likert-number-${m}`, g), J("likert-last-option", g)) : H(J("likert-number", g), J(`likert-number-${m}`, g));
946
+ }
947
+ })(), dangerouslySetInnerHTML: { __html: V }, id: P, onClick: (d) => {
948
+ d.preventDefault(), d.stopPropagation(), a(m);
949
+ }, onKeyDown: (d) => {
950
+ var h, v;
951
+ const k = f.querySelectorAll(`.likert-${l ?? "number"}`), _ = m - 1;
952
+ d.key === "ArrowRight" ? (h = k[_ + 1]) == null || h.focus() : d.key === "ArrowLeft" ? (v = k[_ - 1]) == null || v.focus() : d.key !== "Enter" && d.key !== " " || (d.preventDefault(), d.stopPropagation(), a(m));
953
+ }, onPointerDown: () => y(!0), onPointerEnter: () => p(m), onPointerLeave: () => {
954
+ p(-1), y(!1);
955
+ }, style: q, tabIndex: 0 });
956
+ }, Kn = ({ className: e, labels: o, next: t, properties: r, questionId: i, type: s, isAnswered: l }) => {
957
+ const { border: c, useMobileStyling: a, viewDocument: p, enableCspTrustedTypes: y, cards: g } = F((u) => ({ border: u.border, useMobileStyling: u.useMobileStyling, viewDocument: u.viewDocument, enableCspTrustedTypes: u.enableCspTrustedTypes, cards: u.cards })), [m, f] = Q(-1), [P, b] = Q(!1), [C, D] = Q(null), E = o && o.left, T = o && o.right;
958
+ let j;
959
+ const { range: q, scaleLabelType: V, ratingIcons: d } = r;
960
+ q && (j = Number(q));
961
+ const k = j || 5, _ = (u) => {
962
+ var I, w;
963
+ switch (V) {
964
+ case "star":
965
+ return (I = d[0]) == null ? void 0 : I.svg;
966
+ case "smiley":
967
+ return (w = d[u]) == null ? void 0 : w.svg;
968
+ default:
969
+ return String(u + 1);
970
+ }
971
+ }, h = ne(r), v = fe(i, g);
972
+ return n("form", { className: H(e, "ul-card--likert", "fade-in-transition"), children: n(ae, { properties: r, children: [n(pe, { children: [n("div", { "aria-label": `Rating (1 - ${k})`, className: "ul-card--likert__numbers", role: "radiogroup", children: [...Array(k)].map((u, I) => {
973
+ const w = I + 1;
974
+ return n(Wn, { activeValue: m, border: c, enableCspTrustedTypes: y, icon: _(I), isPressed: P, range: k, scaleLabelType: V, selectedValue: C, setActiveValue: f, setIsPressed: b, setSelectedValue: D, useMobileStyling: a, value: w, viewDocument: p }, I);
975
+ }) }), (E || T) && n("div", { className: "ul-card--likert__labels", children: [n("span", { children: E }), n("span", { children: T })] })] }), n(ue, { children: !l && n(me, { isDisabled: C === null && r.required, onClick: () => {
976
+ t({ value: C, questionId: i, type: s }, !0);
977
+ }, showCheckmark: v, children: h }) })] }) }, i);
978
+ }, Jn = ({ columns: e, onSelect: o, options: t, selectedOptions: r }) => {
979
+ const i = le([]), { border: s, useMobileStyling: l } = F((m) => ({ border: m.border, useMobileStyling: m.useMobileStyling })), c = t.findIndex((m) => r[m.id] === null), [a, p] = Q(c), y = Ce((m, f) => {
980
+ o(m, f);
981
+ const P = a + 1, b = t[P];
982
+ b && r[b.id] === null && p(P);
983
+ }, [o, t, r, a]), g = Ce((m, f) => {
984
+ const P = a === m;
985
+ return n(wn, { animate: !0, header: f.label, isOpen: P, onClick: () => {
986
+ var b;
987
+ return p(P && !((b = window.UserLeap) != null && b.isMobileSDK) ? -1 : m);
988
+ }, ref: (b) => {
989
+ b && (i.current[m] = b);
990
+ }, showHeaderCheck: r[f.id] !== null, children: n("div", { style: { paddingTop: "12px" }, children: e.map((b) => n(Fe, { allowTextEntry: !1, ariaLabel: `${f.label}-${b.label}`, border: s, error: !1, id: `${f.id}-${b.value}`, isRadio: !0, isSelected: r[f.id] === b.value, label: b.label, onUserInputChanged: () => y(f.id, b.value), useMobileStyling: l }, b.label)) }) }, f.id);
991
+ }, [s, e, a, y, r, l]);
992
+ return n("div", { children: t.map((m, f) => g(f, m)) });
993
+ }, Xn = ({ className: e, next: o, options: t, properties: r, questionId: i, type: s, onSubmitButtonClick: l, isAnswered: c }) => {
994
+ const { cards: a } = F((E) => ({ cards: E.cards })), p = r.matrixColumn, y = r.required, g = (E) => {
995
+ E.preventDefault(), E.stopPropagation(), o({ value: f, questionId: i, type: s }, !0), l && l();
996
+ }, m = t.reduce((E, T) => (E[T.id] = null, E), {}), [f, P] = Q(m), b = ne(r), C = fe(i, a);
997
+ return n("form", { className: H(e, "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: g, children: n(ae, { properties: r, children: [n(pe, { children: n(Jn, { columns: p, onSelect: (E, T) => {
998
+ P((j) => ({ ...j, [E]: T }));
999
+ }, options: t, selectedOptions: f }) }), n(ue, { children: !c && n(me, { isDisabled: (D = f, y && Object.values(D).every((E) => E == null)), onClick: () => g(new SubmitEvent("submit")), showCheckmark: C, children: b }) })] }) }, i);
1000
+ var D;
1001
+ }, vn = ({ className: e, onSubmit: o, options: t = [], properties: r, questionId: i, type: s, showIndividualSubmit: l = !1, onSubmitButtonClick: c, isAnswered: a }) => {
1002
+ const { border: p, useMobileStyling: y, cards: g } = F((u) => ({ border: u.border, useMobileStyling: u.useMobileStyling, cards: u.cards })), m = t.reduce((u, I) => (u[I.id] = { isSelected: !1 }, u), {}), [f, P] = Q(m), b = s === "multiplechoice", C = r.required, D = t.find((u) => {
1003
+ var I;
1004
+ return (I = u.optionProperties) == null ? void 0 : I.noneOfTheAbove;
1005
+ }), E = (u) => Object.entries(u).some(([I, w]) => {
1006
+ var L;
1007
+ const R = t.find((U) => `${U.id}` === I), N = w.userText === void 0 || w.userText.trim() === "";
1008
+ return ((L = R == null ? void 0 : R.optionProperties) == null ? void 0 : L.allowsTextEntry) && N && w.isSelected;
1009
+ }), T = (u) => Object.values(u).filter((I) => I.isSelected).length, j = r.minSelect && r.minSelect > 0 && r.maxSelectMode === Ee.Range && T(f) < r.minSelect && (C || T(f) > 0), q = (u) => E(u) || C && !T(u) || !((I) => {
1010
+ const { minSelect: w = 0, maxSelect: R = 1 / 0, maxSelectMode: N } = r, L = T(I);
1011
+ switch (N) {
1012
+ case Ee.Maximum:
1013
+ return L <= R;
1014
+ case Ee.Range:
1015
+ return L === 0 || L >= w;
1016
+ default:
1017
+ return !0;
1018
+ }
1019
+ })(u), V = Object.entries(f).some(([u, I]) => {
1020
+ var w, R;
1021
+ return I.isSelected && ((R = (w = t.find((N) => `${N.id}` === u)) == null ? void 0 : w.optionProperties) == null ? void 0 : R.allowsTextEntry);
1022
+ }), d = l && (!b || V), k = (u) => {
1023
+ v(u.id, u.selected, u.userText, u.noneOfTheAbove);
1024
+ }, _ = (u) => {
1025
+ var I;
1026
+ return (r == null ? void 0 : r.maxSelectMode) !== Ee.Unlimited && T(f) === (r == null ? void 0 : r.maxSelect) && !((I = f[u]) != null && I.isSelected);
1027
+ }, h = () => {
1028
+ o(f, !0), c && c();
1029
+ }, v = (u, I, w, R) => {
1030
+ const N = Object.assign({}, f);
1031
+ if ((b || R) && I) for (const L of Object.values(N)) L.isSelected = !1, delete L.userText;
1032
+ else D && !R && f[D.id].isSelected && (N[D.id].isSelected = !1);
1033
+ N[u] = { isSelected: I, userText: w }, P(N);
1034
+ };
1035
+ return n("form", { className: H(e, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: h, children: n(ae, { properties: r, children: [n(pe, { children: [r.isDropdown ? n(Rn, { disabledOptions: t.filter((u) => _(u.id)), dropdownFooter: j ? n("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [T(f), "/", r.minSelect] }) : void 0, isMultiSelect: !b, multiselectText: r.dropdownMultiselectedText ?? "choices selected", onChange: (u) => {
1036
+ const I = { ...f };
1037
+ for (const w of t) u.includes(w) ? I[w.id].isSelected = !0 : I[w.id].isSelected = !1;
1038
+ P(I);
1039
+ }, options: t, placeholderText: r.dropdownPlaceholderText ?? (b ? "Select choice" : "Select choice(s)"), value: t.filter((u) => f[u.id].isSelected) }) : n("div", { className: H(J("ul-card__choices", y)), role: b ? "radiogroup" : "group", children: [t.map(({ id: u, label: I, value: w, optionProperties: R }) => {
1040
+ var Z, Y;
1041
+ const N = `${u}`, { allowsTextEntry: L, noneOfTheAbove: U } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...R };
1042
+ return n(Fe, { allowTextEntry: L, border: p, disabled: _(N), error: E({ [N]: f[N] }), id: N, isRadio: b, isSelected: !!((Z = f[N]) != null && Z.isSelected), label: I, noneOfTheAbove: U, onUserInputChanged: k, promptText: (R == null ? void 0 : R.otherOptionPlaceholder) || "Please specify", text: (Y = f[u]) == null ? void 0 : Y.userText, useMobileStyling: y, value: w }, N);
1043
+ }), !!j && n("div", { className: "ul-card__min-select-counter", children: [T(f), "/", r.minSelect] })] }), d && n(Mn, { handleSubmit: h, isSubmitDisabled: q(f) })] }), !a && n(ue, { children: n(me, { isDisabled: q(f), onClick: h, showCheckmark: fe(i, g), children: ne(r) }) })] }) }, i);
1044
+ }, et = (e) => {
1045
+ const { questionId: o, type: t, next: r, options: i } = e;
1046
+ return n(vn, { ...e, onSubmit: (s, l) => {
1047
+ const c = Object.entries(s).find(([, m]) => m.isSelected) || [void 0, void 0], [a, p] = c, y = i.find((m) => `${m.id}` === a), g = p != null && p.userText ? { [a]: { userText: p.userText } } : null;
1048
+ r({ value: y && a ? { [a]: y.value } : {}, secondaryValue: g, questionId: o, type: t }, l);
1049
+ } });
1050
+ }, nt = (e) => {
1051
+ const { questionId: o, type: t, next: r } = e;
1052
+ return n(vn, { ...e, onSubmit: (i, s) => {
1053
+ const l = Object.entries(i).reduce((a, [p, y]) => (a[p] = y.isSelected, a), {}), c = Object.entries(i).reduce((a, [p, y]) => {
1054
+ if (!y.userText) return a;
1055
+ const g = a || {};
1056
+ return g[p] = { userText: y.userText }, g;
1057
+ }, null);
1058
+ r({ value: l, secondaryValue: c, questionId: o, type: t }, s);
1059
+ } });
1060
+ }, tt = ({ className: e, labels: o, properties: t, next: r, questionId: i, type: s, isAnswered: l }) => {
1061
+ const [c, a] = Q(null), { border: p, useMobileStyling: y, viewDocument: g, cards: m } = F((C) => ({ border: C.border, useMobileStyling: C.useMobileStyling, viewDocument: C.viewDocument, cards: C.cards })), f = o && o.left, P = o && o.right, b = fe(i, m);
1062
+ return n("form", { className: H(e, "ul-card--nps", "fade-in-transition"), children: n(ae, { properties: t, children: [n(pe, { children: [n("div", { className: "ul-card--nps__numbers", children: [...Array(11)].map((C, D) => n("button", { className: H(J("nps-number", y), J(`nps-number-${D}`, y)), id: `option-${D}`, onClick: (E) => {
1063
+ E.preventDefault(), E.stopPropagation(), a(D);
1064
+ }, onKeyDown: (E) => {
1065
+ var j, q;
1066
+ const T = g.querySelectorAll("button.nps-number");
1067
+ E.key === "ArrowRight" ? (j = T[D + 1]) == null || j.focus() : E.key === "ArrowLeft" ? (q = T[D - 1]) == null || q.focus() : E.key !== "Enter" && E.key !== " " || (E.preventDefault(), E.stopPropagation(), a(D));
1068
+ }, onPointerDown: (E) => {
1069
+ E.currentTarget.style.zIndex = "2";
1070
+ }, onPointerLeave: (E) => {
1071
+ E.currentTarget.style.zIndex = "auto";
1072
+ }, style: c === D ? { backgroundColor: p, color: "#fff" } : void 0, tabIndex: 0, children: D }, D)) }), n("div", { className: "ul-card--nps__labels", children: [n("span", { children: f }), n("span", { children: P })] })] }), n(ue, { children: !l && n(me, { isDisabled: c === null && t.required, onClick: () => {
1073
+ r({ value: c, questionId: i, type: s }, !0);
1074
+ }, showCheckmark: b, children: ne(t) }) })] }) }, i);
1075
+ }, rt = ({ className: e, next: o, properties: t, questionId: r, type: i, onSubmitButtonClick: s, isAnswered: l }) => {
1076
+ const { border: c, useMobileStyling: a, update: p, cards: y } = F((j) => ({ border: j.border, useMobileStyling: j.useMobileStyling, update: j.update, cards: j.cards })), [g, m] = Q(""), f = le(null), P = g.trim(), b = t.required === !0 && !P, C = Bn(f, () => p()), D = t && t.openTextPlaceholder ? t.openTextPlaceholder : "", E = ne(t), T = fe(r, y);
1077
+ return n("form", { className: H(e, "ul-card-text", "fade-in-transition"), id: "text-form", children: n(ae, { properties: t, children: n("div", { className: "ul-card-text", children: [n(pe, { children: [n("div", { className: "ul-card-text__container", children: n("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": D, className: H(J("ul-card-text__input", a)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: (j) => {
1078
+ j.currentTarget.style.borderColor = on;
1079
+ }, onChange: (j) => {
1080
+ const { value: q } = j.currentTarget;
1081
+ C(), j.preventDefault(), j.stopPropagation(), m(q);
1082
+ }, onFocus: (j) => {
1083
+ j.currentTarget.style.borderColor = c;
1084
+ }, placeholder: D, ref: f, role: "textbox", tabIndex: 0 }) }), t.footerHtml && n(we, { className: "footer", html: t.footerHtml })] }), n(ue, { children: !l && n(me, { isDisabled: b, onClick: (j) => {
1085
+ j.preventDefault(), j.stopPropagation();
1086
+ const q = t.required !== !0 || P.length > 0;
1087
+ o({ value: g, questionId: r, type: i }, q), s && s();
1088
+ }, showCheckmark: T, children: E }) })] }) }) }, r);
1089
+ }, ot = ({ className: e, labels: o, next: t, properties: r, questionId: i, type: s, onSubmitButtonClick: l, options: c, isAnswered: a }) => {
1090
+ const p = le(null), y = le(0), g = le(0), m = le(null), f = le(!1), P = le([]), [b, C] = Q(() => (r == null ? void 0 : r.required) === !0), [D, E] = Q(() => c.map((x) => ({ ...x, rank: null }))), T = ke(() => Array.from({ length: c.length }, (x, A) => A + 1), [c.length]), { useMobileStyling: j, isPreview: q, headers: V } = F((x) => ({ useMobileStyling: x.useMobileStyling, isPreview: x.isPreview, headers: x.headers })), d = (V == null ? void 0 : V["userleap-platform"]) === "android", k = j && !q && !d, _ = !k && !d, h = (x, A) => {
1091
+ E((O) => {
1092
+ const M = parseInt(A), z = O.map(($) => ({ ...$ }));
1093
+ z.some(($) => $.rank == null) && z.forEach(($, ye) => $.rank = ye + 1);
1094
+ const X = z.findIndex(($) => $.id === x);
1095
+ if (X === -1) return O;
1096
+ const G = z[X].rank;
1097
+ return M < G ? z.forEach(($) => {
1098
+ $.id !== x && $.rank >= M && $.rank < G && ($.rank = $.rank + 1);
1099
+ }) : M > G && z.forEach(($) => {
1100
+ $.id !== x && $.rank > G && $.rank <= M && ($.rank = $.rank - 1);
1101
+ }), z[X].rank = M, z.sort(($, ye) => $.rank - ye.rank), L(), z;
1102
+ });
1103
+ }, v = (x, A) => {
1104
+ for (let O = 0; O < P.current.length; O++) {
1105
+ const M = P.current[O];
1106
+ if (!M || M === m.current) continue;
1107
+ const z = M.getBoundingClientRect();
1108
+ if (x >= z.left && x <= z.right && A >= z.top && A <= z.bottom) return { element: M, index: O };
1109
+ }
1110
+ return null;
1111
+ }, u = (x) => (A) => {
1112
+ if (!k) return;
1113
+ A.preventDefault(), A.stopPropagation(), f.current = !0, p.current = x;
1114
+ const O = A.touches[0];
1115
+ y.current = O.clientY, g.current = O.clientY;
1116
+ const M = A.currentTarget.closest(".ul-card-rank__option");
1117
+ M && (m.current = M, M.classList.add("is-dragging"));
1118
+ }, I = (x) => {
1119
+ if (!k || !f.current || p.current === null) return;
1120
+ x.preventDefault(), x.stopPropagation();
1121
+ const A = x.touches[0];
1122
+ g.current = A.clientY;
1123
+ const O = g.current - y.current;
1124
+ m.current && (m.current.style.transform = `translateY(${O}px)`, m.current.style.zIndex = "1000"), P.current.forEach((z) => {
1125
+ z && z !== m.current && z.classList.remove("is-drop-target");
1126
+ });
1127
+ const M = v(A.clientX, A.clientY);
1128
+ M && M.element.classList.add("is-drop-target");
1129
+ }, w = (x) => {
1130
+ if (!k || !f.current || p.current === null) return;
1131
+ x.preventDefault(), x.stopPropagation();
1132
+ const A = x.changedTouches[0], O = v(A.clientX, A.clientY);
1133
+ m.current && (m.current.style.transform = "", m.current.style.zIndex = "", m.current.classList.remove("is-dragging")), P.current.forEach((M) => {
1134
+ M && M.classList.remove("is-drop-target");
1135
+ }), O && O.index !== p.current && R(p.current, O.index), p.current = null, m.current = null, f.current = !1;
1136
+ }, R = (x, A) => {
1137
+ E((O) => {
1138
+ const M = O.map((X) => ({ ...X })), [z] = M.splice(x, 1);
1139
+ return M.splice(A, 0, z), M.forEach((X, G) => {
1140
+ X.rank = G + 1;
1141
+ }), L(), M;
1142
+ });
1143
+ }, N = (x) => {
1144
+ const A = {};
1145
+ x.reduce((O, M) => (O[M.id] = M.rank, O), A), t({ value: A, questionId: i, type: s }, !0);
1146
+ }, L = () => {
1147
+ C(!1);
1148
+ }, { left: U, right: Z } = o, Y = c.length, K = (x) => {
1149
+ x.preventDefault(), x.currentTarget.classList.add("is-drop-target");
1150
+ }, te = (x) => {
1151
+ x.currentTarget.classList.remove("is-drop-target");
1152
+ }, re = (x) => {
1153
+ p.current = null, x.currentTarget.classList.remove("is-dragging");
1154
+ };
1155
+ return n("form", { className: H(e, "ul-card-rank", "fade-in-transition"), onSubmit: (x) => {
1156
+ x.preventDefault(), N(D), l && l();
1157
+ }, children: n(ae, { properties: r, children: n(ge, d ? { children: [n(pe, { children: n("div", { className: "ul-card--rank__question-inner-container", children: [n("div", { className: "ul-card-rank__labels", children: n("span", { children: ["1 - ", U] }) }), n("ol", { className: "ul-card-rank__list", children: D.map(({ id: x, label: A, rank: O }) => n("li", { className: "ul-card-rank__option", children: [n("select", { "aria-label": `Rank for ${A}`, className: H("ul-card-rank__select", O == null && "ul-card-rank__select--placeholder"), name: `rank[${x}]`, onChange: (M) => h(x, M.currentTarget.value), value: O ?? "", children: [O == null && n("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), T.map((M) => n("option", { className: "ul-card-rank__select-option", value: M, children: M }, `${M}-${i}`))] }), n("span", { children: A })] }, x)) }), n("div", { className: "ul-card-rank__labels", children: n("span", { children: [Y, " - ", Z] }) })] }) }), n(ue, { children: !a && n("div", { className: "ul-card__button-wrapper", children: n(se, { disabled: b, children: ne(r) }) }) })] } : { children: [n(pe, { children: n("div", { className: "ul-card--rank__question-inner-container", children: [n("div", { className: "ul-card-rank__labels", children: n("span", { children: ["1 - ", U] }) }), n("ol", { className: "ul-card-rank__list", onDragOver: d ? void 0 : (x) => {
1158
+ x.preventDefault(), x.dataTransfer && (x.dataTransfer.dropEffect = "move");
1159
+ }, children: D.map(({ id: x, label: A, rank: O }, M) => {
1160
+ return n("li", { className: "ul-card-rank__option", draggable: !!_ || void 0, onDragEnd: _ ? re : void 0, onDragEnter: _ ? K : void 0, onDragLeave: _ ? te : void 0, onDragStart: _ ? (X = M, (G) => {
1161
+ p.current = X, G.dataTransfer && (G.dataTransfer.effectAllowed = "move", G.dataTransfer.setData("text/plain", String(X)), G.currentTarget.classList.add("is-dragging"));
1162
+ }) : void 0, onDrop: _ ? (z = M, (G) => {
1163
+ var ye, Ze;
1164
+ G.preventDefault(), G.currentTarget.classList.remove("is-drop-target");
1165
+ const $ = p.current;
1166
+ p.current = null, (Ze = (ye = G.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : ye.querySelector(".is-dragging")) == null || Ze.classList.remove("is-dragging"), $ != null && $ !== z && R($, z);
1167
+ }) : void 0, ref: (G) => P.current[M] = G, children: [n("select", { "aria-label": `Rank for ${A}`, className: H("ul-card-rank__select", O == null && "ul-card-rank__select--placeholder"), name: `rank[${x}]`, onChange: (G) => h(x, G.currentTarget.value), value: O ?? "", children: [O == null && n("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), T.map((G) => n("option", { className: "ul-card-rank__select-option", value: G, children: G }, G))] }), n("span", { children: A }), !d && n("button", { "aria-label": `Drag ${A} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: k ? w : void 0, onTouchMove: k ? I : void 0, onTouchStart: k ? u(M) : void 0, title: "Drag to reorder", type: "button", children: n("svg", { fill: "none", height: "17", viewBox: "0 0 16 17", width: "16", xmlns: "http://www.w3.org/2000/svg", children: n("path", { d: "M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z", fill: "currentColor" }) }) })] }, x);
1168
+ var z, X;
1169
+ }) }), n("div", { className: "ul-card-rank__labels", children: n("span", { children: [Y, " - ", Z] }) })] }) }), n(ue, { children: !a && n("div", { className: "ul-card__button-wrapper", children: n(se, { disabled: b, children: ne(r) }) }) })] }) }) }, i);
1170
+ }, Ue = 1, hn = 2, gn = 3, Ie = (e) => e.type === "av_permission", en = (e) => e.type === "screen_permission", bn = (e, o) => e === void 0 ? Ue : e ? ((t, r) => !(Ie(r) ? r.permissionDescriptors : []).includes("camera") || t.getVideoTracks().length > 0)(e, o) ? gn : Ue : hn, nn = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
1171
+ }, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, ie = En((e) => ({ ...nn, reset: () => {
1172
+ e(nn);
1173
+ }, updatePage: (o) => {
1174
+ e(o);
1175
+ } }));
1176
+ function Ae({ currentPage: e, pages: o }) {
1177
+ const { avStream: t, recordingMediaTypes: r, updatePage: i } = ie.getState(), { recorderEventEmitter: s } = F.getState();
1178
+ s.emit("av.permission", { "permission.descriptors": e.permissionDescriptors, "stream.ready": (l, c) => {
1179
+ if (t === l) return;
1180
+ let a = e;
1181
+ if (l && !e.permissionDescriptors.includes("camera")) {
1182
+ const p = o.indexOf(e), y = c != null && c.active ? p + 2 : p + 1;
1183
+ c != null && c.active && r && s.emit("begin.recording", { "recording.media.types": r, "start.recording.callback": (g) => i({ mediaRecordingUids: g }) }), a = o[y];
1184
+ }
1185
+ i({ currentPage: a, avStream: l });
1186
+ } });
1187
+ }
1188
+ function Oe({ status: e }) {
1189
+ const { nextQuestion: o, passthroughData: t, mediaRecordingUids: r, reset: i } = ie.getState(), { recorderEventEmitter: s, handleUploadUpdate: l, index: c } = F.getState(), a = { value: { taskStatus: e }, type: "recordedtask", questionId: (t == null ? void 0 : t.questionId) || 1 };
1190
+ t && s.emit("finish.task", { "begin.callback": (p) => {
1191
+ l({ mediaRecordingUid: p, isSubmitted: !0, progressPct: 0, isComplete: !1 });
1192
+ }, "progress.callback": (p, y) => {
1193
+ l({ mediaRecordingUid: p, progressPct: y.detail, isSubmitted: !1, isComplete: !1 });
1194
+ }, "upload.callback": (p) => {
1195
+ p && l({ mediaRecordingUid: p, isComplete: !0, isSubmitted: !0, progressPct: 100 });
1196
+ }, "passthrough.data": t, "current.index": c, "task.response": a, "task.complete.callback": (p) => {
1197
+ a.value.taskDurationMillisecond = p, r && (a.value.mediaRecordingUids = r), i(), o(a);
1198
+ } });
1199
+ }
1200
+ function Ge({ pages: e, setIsRequestingPermission: o }) {
1201
+ const { recorderEventEmitter: t, eventEmitFn: r } = F.getState(), { updatePage: i, currentPage: s, recordingMediaTypes: l, screenPermissionRequested: c } = ie.getState();
1202
+ if (!s) return;
1203
+ const a = e.indexOf(s);
1204
+ switch (s.type) {
1205
+ case "av_permission": {
1206
+ const p = c ? a + 2 : a + 1;
1207
+ return c && l && t.emit("begin.recording", { "recording.media.types": l, "start.recording.callback": (y) => {
1208
+ i({ mediaRecordingUids: y });
1209
+ } }), void i({ currentPage: e[p] });
1210
+ }
1211
+ case "screen_permission":
1212
+ return void t.emit("screen.permission", { "screen.permission.requested": o, "stream.ready.callback": (p, y) => {
1213
+ const g = y ? e[a + 1] : s;
1214
+ y && l && t.emit("begin.recording", { "recording.media.types": l, "start.recording.callback": (m) => {
1215
+ i({ captureStream: y, mediaRecordingUids: m });
1216
+ } }), i({ currentPage: g, screenPermissionRequested: !0, captureStream: y });
1217
+ } });
1218
+ case "start_task":
1219
+ return r("recorded.task.start"), t.emit("recorded.task.start"), t.emit("start.task"), void i({ currentPage: e[a + 1], screenPermissionRequested: !0 });
1220
+ case "complete_task":
1221
+ return;
1222
+ }
1223
+ }
1224
+ const fn = "ul-permission-graphics-container", yn = "ul-permission-body", Cn = H(fn, "ul_recorded-task-inset-spacing"), Te = H("ul-horizontal-button-container", "ul-horizontal-button-container-left"), xn = ({ richTextBody: e }) => n(we, { className: "ul-rich-text-body", html: e, id: "ul-task-detail-container" }), _e = ({ required: e, skipButtonText: o, bottom: t = !1 }) => e ? null : n(se, { className: H(t && "ul-skip-button-below", "ul-button-inactive"), onClick: Oe.bind(null, { status: "abandoned" }), children: o || "Skip" }), Qe = (e) => {
1225
+ const { avStream: o, captureStream: t, recordingMediaTypes: r, updatePage: i } = ie.getState(), s = (r == null ? void 0 : r.includes("audio")) || (r == null ? void 0 : r.includes("video"));
1226
+ de(() => {
1227
+ const l = setInterval(() => {
1228
+ s && o && !o.active ? i({ avStream: null, currentPage: e[0] }) : t && t.active || i({ captureStream: void 0, currentPage: e[s ? 1 : 0] });
1229
+ }, 1e3);
1230
+ return () => clearInterval(l);
1231
+ }, [o, t, s, e, r, i]);
1232
+ }, it = ({ content: e, pages: o, required: t }) => {
1233
+ const { buttonText: r, skipButtonText: i, taskDetail: s } = e;
1234
+ return Qe(o), n("div", { className: "ul-task-page", children: [s && n(xn, { richTextBody: s }), n("div", { className: Te, children: [n(se, { onClick: Ge.bind(null, { pages: o }), children: r }), n(_e, { required: t, skipButtonText: i })] })] }, "start-task");
1235
+ }, st = ({ content: e, pages: o, properties: t }) => {
1236
+ const { buttonText: r, skipButtonText: i } = e;
1237
+ return Qe(o), n("div", { className: "ul-task-page", children: [e.taskDetail && n(xn, { richTextBody: e.taskDetail }), n(ae, { properties: t, children: n("div", { className: Te, children: [n(se, { className: "ul-complete-task-button", onClick: Oe.bind(null, { status: "completed" }), children: r }), n(se, { className: H("ul-button-inactive"), onClick: Oe.bind(null, { status: "given.up" }), children: i })] }) })] }, "complete-task");
1238
+ }, at = ({ content: e, pages: o, required: t }) => {
1239
+ const { buttonText: r, skipButtonText: i } = e, [s] = F((a) => [a.tabTitle]), [l, c] = Q(!1);
1240
+ return n("div", { children: [n("div", { className: Cn, children: [n("p", { style: { marginTop: "auto" }, children: e.selectTabText }), n("div", { className: "ul-select-tab-container", children: n("p", { className: yn, children: s }) })] }), n("div", { className: t ? "" : Te, children: [n(se, { disabled: l, onClick: Ge.bind(null, { pages: o, setIsRequestingPermission: c }), children: r }), n(_e, { required: t, skipButtonText: i })] })] });
1241
+ }, lt = ({ content: e }) => n(we, { className: H(fn, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), html: e.svg }, "ul-permission-request-graphic"), dt = ({ content: e, pages: o, required: t }) => {
1242
+ const { permissionDeniedHeadline: r, permissionDeniedBody: i, skipButtonText: s, tryAgainButtonText: l } = e, c = Ie(o[0]) ? o[0] : null;
1243
+ return de(() => {
1244
+ const a = setInterval(() => {
1245
+ c !== null && Ae({ currentPage: c, pages: o });
1246
+ }, 1e3);
1247
+ return () => clearInterval(a);
1248
+ }, [c, o]), c ? n("div", { children: [n("div", { className: Cn, children: n("p", { className: "ul-av-permission-denied-paragraph", children: [n("span", { className: "ul-av-permission-denied-headline", children: r }), n("span", { className: yn, children: i })] }) }), n("div", { className: Te, children: [n(se, { onClick: Ae.bind(null, { currentPage: c, pages: o }), children: l }), n(_e, { required: t, skipButtonText: s })] })] }) : null;
1249
+ }, ct = ({ stream: e }) => n("video", { autoPlay: !0, className: H("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (o) => {
1250
+ o && (o.srcObject = e || null);
1251
+ } }), ut = ({ content: e, pages: o, required: t }) => {
1252
+ const { skipButtonText: r } = e, { avStream: i } = ie.getState();
1253
+ return Qe(o), n("div", { children: [n(ct, { stream: i }), n("div", { className: "ul-vertical-button-container-center", children: [n(se, { onClick: Ge.bind(null, { pages: o }), children: e.buttonText }), n(_e, { bottom: !0, required: t, skipButtonText: r })] })] });
1254
+ }, pt = ({ properties: e }) => {
1255
+ const { pages: o, required: t } = e, { avStream: r, currentPage: i } = ie.getState();
1256
+ if (i === void 0) return null;
1257
+ switch (i == null ? void 0 : i.type) {
1258
+ case "av_permission": {
1259
+ const s = bn(r, i);
1260
+ return s === Ue ? n(lt, { content: i }) : n(s === hn ? dt : ut, { content: i, pages: o, required: t });
1261
+ }
1262
+ case "screen_permission":
1263
+ return n(at, { content: i, pages: o, required: t });
1264
+ case "start_task":
1265
+ return n(it, { content: i, pages: o, required: t });
1266
+ case "complete_task":
1267
+ return n(st, { content: i, pages: o, properties: e });
1268
+ default:
1269
+ return null;
1270
+ }
1271
+ }, mt = ({ className: e, properties: o, next: t, questionId: r }) => {
1272
+ const i = F(), { surveyId: s, responseGroupUid: l, userId: c } = i, a = ie(), { screenPermissionRequested: p } = a, y = ie((b) => b.avStream);
1273
+ let g = ie((b) => b.currentPage);
1274
+ g || (g = function({ pages: b, userId: C, responseGroupUid: D, surveyId: E, questionId: T, next: j }) {
1275
+ const { updatePage: q } = ie.getState(), { eventEmitFn: V, recorderEventEmitter: d } = F.getState(), k = { questionId: T, surveyId: E, visitorId: C, responseGroupUid: D };
1276
+ let _ = 0;
1277
+ d.emit("recorded.task.permission.screen"), V("recorded.task.permission.screen"), d.emit("permission.status", { "permission.status.callback": (v, u, I, w) => {
1278
+ const R = b[_], { type: N } = R, L = ["screen"];
1279
+ if (Ie(R)) {
1280
+ const { permissionDescriptors: U } = R, Z = U == null ? void 0 : U.includes("microphone"), Y = U == null ? void 0 : U.includes("camera");
1281
+ Z && L.push("audio"), Y && L.push("video"), (v != null && v.active && !Y || v != null && v.active && u) && _++;
1282
+ }
1283
+ en(b[_]) && I && (_++, d.emit("begin.recording", { "recording.media.types": L, "start.recording.callback": (U) => q({ mediaRecordingUids: U }) })), q({ currentPage: b[_], avStream: v, screenPermissionRequested: I, nextQuestion: j, type: N, passthroughData: k, recordingMediaTypes: L, captureStream: w });
1284
+ } });
1285
+ const h = b[_];
1286
+ return h.type === "av_permission" && Ae({ currentPage: h, pages: b }), h;
1287
+ }({ questionId: r, surveyId: s, next: (b) => {
1288
+ t(b, !0);
1289
+ }, pages: o.pages, responseGroupUid: l, userId: c }));
1290
+ let m = g.headline, f = g.captionText;
1291
+ const P = bn(y, g);
1292
+ return en(g) && p && (m = g.permissionDeniedHeadline, f = g.permissionDeniedCaptionText), Ie(g) && P === gn && (m = g.permissionGrantedHeadline, f = g.permissionGrantedCaptionText), n("div", { className: H(e, "ul-center-horizontally", "fade-in-transition"), children: [n(Ve, { isRequired: o == null ? void 0 : o.required, message: m, properties: { captionText: f } }), n(pe, { children: n(pt, { properties: o }) })] });
1293
+ }, vt = ({ className: e, next: o, properties: t, questionId: r, type: i, isAnswered: s }) => {
1294
+ const { visitorAttributes: l, isLongFormSurvey: c } = F((g) => ({ visitorAttributes: g.visitorAttributes, isLongFormSurvey: sn(g.studyType) })), a = (g, m = !1) => {
1295
+ o({ value: m ? { skipped: !0 } : void 0, questionId: r, type: i }, !0);
1296
+ }, p = qn(t && t.buttonUrl, l), y = c && t.promptActionType === jn.NO_BUTTON;
1297
+ return n("div", { className: H(e, "ul-card__text-url-prompt", "fade-in-transition"), children: n(ae, { properties: t, children: !s && !y && n("div", { children: n("div", { className: "ul-card-button-group", children: [n("a", { className: "ul-card-text__button ul-card__text-url-prompt-button", href: p, id: "ul-card-text__button", onClick: a, onKeyPress: (g) => {
1298
+ g.key !== "Enter" && g.key !== " " || o({ value: void 0, questionId: r, type: i }, !0);
1299
+ }, rel: "noreferrer", role: p ? "link" : "button", tabIndex: 0, target: "_blank", children: ne(t) }), t.required === !1 && n("button", { className: "ul-card-skip__button", onClick: (g) => a(0, !0), children: He(t) })] }) }) }) }, r);
1300
+ }, ht = ({ className: e, questionId: o }) => {
1301
+ const { border: t, destroy: r, endCard: i, forceBrandedLogo: s, quotaEndcardText: l } = F((y) => ({ border: y.border, destroy: y.destroy, endCard: y.endCard, forceBrandedLogo: y.forceBrandedLogo, quotaEndcardText: y.quotaEndcardText }));
1302
+ de(() => {
1303
+ setTimeout(() => {
1304
+ r($e);
1305
+ }, s ? 4e3 : 2e3);
1306
+ }, [r, s]);
1307
+ const c = (l == null ? void 0 : l.subheader) ?? (i == null ? void 0 : i.subheader), a = c ? n("p", { className: "ul-caption", children: c }) : null, p = (l == null ? void 0 : l.headline) ?? (i == null ? void 0 : i.headline) ?? "";
1308
+ return n("div", { className: H(e, "ul-card--thanks", "fade-in-transition"), children: n("div", { children: n("div", { className: "ul-card--thanks-content", children: [n("div", { className: "ul-thanks-check", children: n("svg", { "aria-labelledby": "title", fill: "none", height: "99", viewBox: "0 0 81 99", width: "81", xmlns: "http://www.w3.org/2000/svg", children: [n("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: t, fillRule: "evenodd" }), n("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: t, fillRule: "evenodd" }), n("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" })] }) }), n(Ve, { message: p }), a] }) }) }, o);
1309
+ }, gt = () => n("div", { className: "thinking-dots-container", children: n("div", { className: "thinking-dot" }) }), bt = ({ className: e }) => {
1310
+ const { uploadProgress: o } = F((s) => ({ uploadProgress: s.uploadProgress }));
1311
+ let t, r;
1312
+ Object.values(o).filter((s) => s.isSubmitted).length > 1 ? (t = "Your responses are processing", r = "Please keep this tab open until your responses are fully processed.") : (t = "Your response is processing", r = "Please keep this tab open until your response is fully processed.");
1313
+ const i = Math.round(Math.min(99, ...Object.values(o).filter((s) => s.isSubmitted).map((s) => s.progressPct || 0)));
1314
+ return n("div", { className: H(e, "ul-card--uploading", "fade-in-transition"), children: [n("div", { "aria-busy": "true", "aria-label": "Processing...", "aria-live": "polite", className: "ul-loading-spinner-container", role: "progressbar", children: n("div", { className: "ul-loading-spinner", children: [n("div", { className: "first" }), n("div", { className: "second" }), n("div", { className: "third" }), n("div", { className: "fourth" })] }) }), n(Ve, { message: `${t} (${i}% complete)` }), n("p", { className: "ul-caption", children: r })] });
1315
+ }, tn = 0, ft = 1, yt = ({ className: e, next: o, properties: t, questionId: r, type: i, isAnswered: s }) => {
1316
+ const { apiURL: l, envId: c, handleUploadUpdate: a, headers: p, responseGroupUid: y, surveyId: g, viewDocument: m, visitorId: f, cards: P } = F((v) => ({ apiURL: v.apiURL, envId: v.envId, handleUploadUpdate: v.handleUploadUpdate, headers: v.headers, responseGroupUid: v.responseGroupUid, surveyId: v.surveyId, viewDocument: v.viewDocument, visitorId: v.userId, cards: v.cards })), [b, C] = Q(!1), [D, E] = Q(null), [T, j] = Q(null), [q] = Q(tn), V = ne(t), d = fe(r, P);
1317
+ if (s) return null;
1318
+ const k = `ul-card-video__player_recorder-q${r}`, _ = (v, u) => {
1319
+ v === B.UPLOAD_STARTED ? (E(u[B.UPLOAD_ID]), j(u[B.MEDIA_RECORDING_UID]), C(!0)) : v === B.DELETE ? (E(null), j(null), C(!1)) : v === B.UPLOAD_PROGRESS ? isNaN(u[B.UPLOAD_PROGRESS_PCT]) ? a({ mediaRecordingUid: u[B.MEDIA_RECORDING_UID], isComplete: !0 }) : a({ mediaRecordingUid: u[B.MEDIA_RECORDING_UID], progressPct: u[B.UPLOAD_PROGRESS_PCT] }) : v === B.UPLOAD_FINISHED && a({ mediaRecordingUid: u[B.MEDIA_RECORDING_UID], isComplete: !0 });
1320
+ }, h = (v) => {
1321
+ v.preventDefault(), v.stopPropagation(), document.getElementById(k) && Xe(k), D && T ? (a({ mediaRecordingUid: T, isSubmitted: !0 }), o({ value: { mediaRecordingUid: T }, questionId: r, type: i }, !0)) : o({ value: null, questionId: r, type: i }, !0);
1322
+ };
1323
+ return n("form", { className: H(e, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [n(pe, { children: !s && n("div", { id: "ul-question-player-container", style: { display: q === tn ? "" : "none" }, children: n(ae, { properties: t, children: [n(me, { isDisabled: !b, onClick: () => {
1324
+ Xe(), o({ value: { uploadId: D, mediaRecordingUid: T }, questionId: r, type: i }, !0);
1325
+ }, showCheckmark: d, children: V }), n("div", { style: { display: q === ft ? "block" : "none" }, children: n("div", { id: "ul-recorder-player-container", ref: (v) => {
1326
+ if (v && v.children.length === 0) {
1327
+ const u = ((I, w = {}, R = "https://api.userleap.com", N, L, U, Z = !1, Y = document) => {
1328
+ S.document = Y;
1329
+ const K = I + ln, te = mn(K);
1330
+ return S.document.addEventListener("securitypolicyviolation", (re) => {
1331
+ ce(new Error(`Voice & Video feature violates ${re.violatedDirective} web page CSP policies for the recorder player.`), "recorderDeviceError", R, U, w.visitorId, w.envId);
1332
+ }), dn(an.concat(On), () => {
1333
+ Be(K, te), S.document.getElementById(ze(K)).remove();
1334
+ try {
1335
+ $n(te, K, w, R, N, L, U, Z);
1336
+ } catch (re) {
1337
+ return void ce(new Error(`Error when creating video recorder player object ${re}`), "recorderDeviceError", R, U, w.visitorId, w.envId);
1338
+ }
1339
+ }), te;
1340
+ })(k, { surveyId: g, responseGroupUid: y, questionId: r, visitorId: f, envId: c }, l, _, void 0, { ...p, "x-ul-video-recorder-origin": "sdk" }, t.mediaType === B.MEDIA_TYPE_AUDIO, m);
1341
+ v.appendChild(u);
1342
+ }
1343
+ } }) })] }) }) }), !s && n(ue, { children: [n(me, { isDisabled: !!t.required && !b, onClick: h, showCheckmark: d, children: ne(t) }), n("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: h, style: { ...t.required ? { display: "none" } : {}, ...b ? { display: "none" } : {} }, children: He(t) })] })] });
1344
+ }, xe = (e) => e.type === "aidynamicfollowup" || e.type === "aidynamicstandalone", Re = (e) => {
1345
+ var o;
1346
+ return xe(e) && ((o = e.props) == null ? void 0 : o.loading) === Me.inFlight;
1347
+ }, kn = (e) => e.type === "thanks" || e.type === "uploading", Ct = ({ card: e, avatars: o, isThinking: t, isCurrentQuestion: r, currentQuestionBubbleRef: i }) => {
1348
+ const s = ((c) => "properties" in c.props && c.props.properties && "questionHtml" in c.props.properties && c.props.properties.questionHtml ? { content: c.props.properties.questionHtml, image: c.props.properties.image, isHtml: !0 } : "message" in c.props ? "image" in c.props.properties && c.props.properties.image ? { content: c.props.message, image: c.props.properties.image, isHtml: !1 } : { content: c.props.message, isHtml: !1 } : { content: "Question", isHtml: !1 })(e), l = r && !(s != null && s.image) ? i : null;
1349
+ return n(ge, { children: [(s == null ? void 0 : s.image) && n(be, { avatars: o, isLeft: !0, ref: r ? i : null, children: !t && n(An, { image: s.image }) }), n(be, { avatars: o, isLeft: !0, message: { id: `question-${e.name}`, type: "question", content: s.content }, ref: l, children: t ? n(gt, {}) : n(ge, { children: [s.isHtml ? n(we, { className: "chat-message-text", html: s.content }) : n("div", { className: "chat-message-text", children: s.content }), e.type === "videovoice" && n(Gn, { properties: e.props, questionId: e.name, surveyVideoUrl: e.props.properties.videoUrl })] }) })] });
1350
+ }, xt = ({ card: e, avatars: o }) => {
1351
+ const t = ((r) => {
1352
+ if (!("properties" in r.props) || !r.props.properties || typeof r.props.properties != "object") return null;
1353
+ const i = r.props.properties, s = [{ key: "captionHtml", isHtml: !0 }, { key: "captionText", isHtml: !1 }, { key: "richTextBody", isHtml: !0 }, { key: "body", isHtml: !1 }];
1354
+ for (const { key: l, isHtml: c } of s) {
1355
+ const a = i[l];
1356
+ if (typeof a != "string") continue;
1357
+ const p = a.trim();
1358
+ if (p) {
1359
+ if (c && !p.replaceAll(/<[^>]*>/g, "").trim()) continue;
1360
+ return { content: p, isHtml: c };
1361
+ }
1362
+ }
1363
+ return null;
1364
+ })(e);
1365
+ return t ? n(be, { avatars: o, hideAvatar: !0, isLeft: !0, message: { id: `caption-${e.name}`, type: "question", content: t.content }, children: t.isHtml ? n(we, { className: "chat-message-text", html: t.content }) : n("div", { className: "chat-message-text", children: t.content }) }) : null;
1366
+ }, kt = () => {
1367
+ const { providerPersona: e, showProviderPersona: o, experimentFlags: t } = F((i) => ({ providerPersona: i.providerPersona, showProviderPersona: i.showProviderPersona, experimentFlags: i.experimentFlags }));
1368
+ return (t == null ? void 0 : t["sdk-new-convo-ui"]) && o && e ? n("div", { className: "chat-persona-label", children: e }) : null;
1369
+ }, wt = ({ card: e, userResponse: o, avatars: t }) => {
1370
+ const r = ((i, s) => {
1371
+ if ((i.type === "open" || i.type === "aidynamicfollowup" || i.type === "aidynamicstandalone") && s && typeof s == "object" && "value" in s) return s.value;
1372
+ })(e, o);
1373
+ return n("div", { className: "chat-bubble-container chat-right", children: [n("div", { className: "chat-bubble chat-bubble-right chat-bubble-text-only", children: n("div", { className: "chat-message-text", children: r || n("div", { className: "chat-message-no-response", children: "No response" }) }) }), n("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${t.respondentAvatar["1x"]} 1x, ${t.respondentAvatar["2x"]} 2x` })] });
1374
+ }, Et = ({ card: e, avatars: o, isCurrentQuestion: t, currentQuestionBubbleRef: r }) => {
1375
+ const { endCard: i, quotaEndcardText: s } = F((a) => ({ endCard: a.endCard, quotaEndcardText: a.quotaEndcardText })), l = (s == null ? void 0 : s.headline) ?? (i == null ? void 0 : i.headline) ?? "Great! Thank you for your participation.", c = (s == null ? void 0 : s.subheader) ?? (i == null ? void 0 : i.subheader);
1376
+ return n(ge, { children: [n(be, { avatars: o, isLeft: !0, message: { id: `thanks-${e.name}`, type: "question", content: l }, ref: t ? r : null }), c && n(be, { avatars: o, hideAvatar: !0, isLeft: !0, message: { id: `caption-${e.name}`, type: "question", content: c } }), n(Yn, {})] });
1377
+ }, jt = ({ card: e, cardIndex: o, index: t, avatars: r, cardResponses: i, questionThinkingStates: s, startingQuestionIdx: l, currentQuestionBubbleRef: c, handleCardResponse: a }) => {
1378
+ const p = o === t, y = o < t, g = kn(e);
1379
+ if (g) return n(Et, { avatars: r, card: e, currentQuestionBubbleRef: c, isCurrentQuestion: p });
1380
+ const m = `${e.name}`, f = i.get(m), P = e.type === "open" || e.type === "aidynamicfollowup" || e.type === "aidynamicstandalone", b = s.get(m);
1381
+ if (e.type === "aidynamicfollowup" && (e.props.loading === Me.failure || e.props.loading === void 0) || e.type === "aidynamicstandalone" && e.props.loading === Me.failure) return n(ge, {});
1382
+ const C = (o > (l ?? 0) || xe(e)) && e.type !== "thanks" && e.type !== "uploading" && (b === !0 || b === void 0);
1383
+ return n(rn.Fragment, { children: [n(Ct, { avatars: r, card: e, currentQuestionBubbleRef: c, isCurrentQuestion: p, isThinking: C }), !C && n(ge, { children: [n(xt, { avatars: r, card: e }), n(kt, {})] }), y && P ? n(wt, { avatars: r, card: e, userResponse: f }) : (!y || !P) && !C && n(be, { avatars: r, isLeft: !1, message: { id: `card-${e.name}`, type: "card", content: "" }, children: n("div", { className: "chat-card-container", children: n(Tt, { card: e, className: g ? "chat-thanks-card" : "chat-card", isAnswered: y, next: p ? a : () => {
1384
+ } }) }) })] }, `question-card-${e.name}`);
1385
+ }, be = rn.forwardRef(({ message: e, isLeft: o = !1, children: t, avatars: r, hideAvatar: i = !1 }, s) => {
1386
+ const l = o ? "chat-bubble-left" : "chat-bubble-right";
1387
+ return n("div", { className: `chat-bubble-container ${o ? "chat-left" : "chat-right"}${o && i ? " chat-no-avatar" : ""}`, ref: s, children: [o && !i && n("img", { alt: "AI Avatar", className: "chat-avatar chat-avatar-left", srcSet: `${r.agentAvatar["1x"]} 1x, ${r.agentAvatar["2x"]} 2x` }), n("div", { className: `chat-bubble ${l}`, children: t || n("div", { className: "chat-message-text", children: e == null ? void 0 : e.content }) }), !o && !i && n("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x` })] });
1388
+ });
1389
+ be.displayName = "ChatBubble";
1390
+ const It = () => {
1391
+ const e = F((t) => t.close), o = ke(() => () => e($e), [e]);
1392
+ return n("div", { "aria-label": "Close button", className: "conversational-close-btn", onClick: o, onKeyPress: (t) => {
1393
+ t.key === "Enter" && o();
1394
+ }, role: "button", tabIndex: 0, children: n("svg", { fill: "none", height: "16px", viewBox: "0 0 13 13", width: "16px", xmlns: "http://www.w3.org/2000/svg", children: n("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" }) }) });
1395
+ }, Tt = ({ card: e, next: o, className: t = "", isAnswered: r = !1 }) => {
1396
+ const i = { className: r ? `${t} answered-card` : t, next: r ? () => {
1397
+ } : o, questionId: e.name, type: e.type, isAnswered: r };
1398
+ switch (e.type) {
1399
+ case "consentlegal":
1400
+ return n(Zn, { ...i, ...e.props });
1401
+ case "likert":
1402
+ return n(Kn, { ...i, ...e.props });
1403
+ case "matrix":
1404
+ return n(Xn, { ...i, ...e.props });
1405
+ case "multiplechoice":
1406
+ return n(et, { ...i, ...e.props });
1407
+ case "multipleselect":
1408
+ return n(nt, { ...i, ...e.props });
1409
+ case "nps":
1410
+ return n(tt, { ...i, ...e.props });
1411
+ case "aidynamicstandalone":
1412
+ case "aidynamicfollowup":
1413
+ case "open":
1414
+ return n(rt, { ...i, type: e.type, ...e.props });
1415
+ case "rankorder":
1416
+ return n(ot, { ...i, ...e.props });
1417
+ case "recordedtask":
1418
+ return n(mt, { ...i, ...e.props });
1419
+ case "texturlprompt":
1420
+ return n(vt, { ...i, ...e.props });
1421
+ case "thanks":
1422
+ return n(ht, { ...i, ...e.props });
1423
+ case "uploading":
1424
+ return n(bt, { ...i, ...e.props });
1425
+ case "videovoice":
1426
+ return n(yt, { ...i, ...e.props });
1427
+ default:
1428
+ return null;
1429
+ }
1430
+ }, Pt = ({ cards: e, next: o, previousResponses: t }) => {
1431
+ const { cardResponses: r, setCardResponse: i } = (() => {
1432
+ const [d, k] = Q(/* @__PURE__ */ new Map());
1433
+ return { cardResponses: d, setCardResponse: Ce((_, h) => {
1434
+ k((v) => new Map(v).set(_, h));
1435
+ }, []) };
1436
+ })(), { index: s, isLongFormSurvey: l, avatars: c, showSurveyBrand: a, forceBrandedLogo: p, marketingUrlLink: y, startingQuestionIdx: g, viewDocument: m, createDynamicFollowupQuestion: f, update: P } = F((d) => ({ index: d.index, isLongFormSurvey: sn(d.studyType), avatars: d.avatars, forceBrandedLogo: d.forceBrandedLogo, startingQuestionIdx: d.startingQuestionIdx, showSurveyBrand: d.showSurveyBrand, marketingUrlLink: In({ marketingUrl: d.marketingUrl, slugName: d.slugName, surveyId: d.surveyId, forceBrandedLogo: d.forceBrandedLogo }), viewDocument: d.viewDocument, createDynamicFollowupQuestion: d.createDynamicFollowupQuestion, update: d.update })), { currentQuestionBubbleRef: b, scrollToCurrentQuestion: C } = (({ viewDocument: d }) => {
1437
+ const k = le(null), _ = Ce(() => {
1438
+ const h = d.querySelector(".ul-card-main-content");
1439
+ if (k.current && h && h instanceof HTMLElement) {
1440
+ const v = k.current.offsetTop - h.offsetTop - 16;
1441
+ h.scrollTo({ top: Math.max(0, v), behavior: "smooth" });
1442
+ }
1443
+ }, []);
1444
+ return { currentQuestionBubbleRef: k, scrollToCurrentQuestion: _ };
1445
+ })({ viewDocument: m }), D = ((d, k, _) => {
1446
+ const [h, v] = Q(/* @__PURE__ */ new Map());
1447
+ return de(() => {
1448
+ if (d.length > 0 && k < d.length) {
1449
+ const u = d[k], I = `${u.name}`, w = (N) => {
1450
+ if (k > 0) {
1451
+ const L = d[k - 1];
1452
+ if (xe(L)) {
1453
+ const U = `${L.name}`, Z = Re(L);
1454
+ if (N.get(U) !== Z) return new Map(N).set(U, Z);
1455
+ }
1456
+ }
1457
+ return N;
1458
+ };
1459
+ if ((k <= (_ ?? 0) || kn(u)) && (u == null ? void 0 : u.type) !== "aidynamicstandalone") return v((N) => w(new Map(N).set(I, !1)));
1460
+ v((N) => {
1461
+ const L = !xe(u) || Re(u);
1462
+ return w(new Map(N).set(I, L));
1463
+ });
1464
+ const R = setTimeout(() => {
1465
+ v((N) => {
1466
+ const L = !!xe(u) && Re(u);
1467
+ return w(new Map(N).set(I, L));
1468
+ });
1469
+ }, 1e3);
1470
+ return () => clearTimeout(R);
1471
+ }
1472
+ }, [k, d, _]), h;
1473
+ })(e, s, g);
1474
+ ((d, k) => {
1475
+ const { createDynamicStandaloneQuestion: _ } = F((u) => ({ createDynamicStandaloneQuestion: u.createDynamicStandaloneQuestion })), h = d[k], v = (h == null ? void 0 : h.type) === "aidynamicstandalone" && h.props.loading === void 0 ? h.name : null;
1476
+ de(() => {
1477
+ v !== null && _({ questionId: v });
1478
+ }, [v, _]);
1479
+ })(e, s);
1480
+ const E = ((d, k) => {
1481
+ const [_, h] = Q(() => /* @__PURE__ */ new Set([d]));
1482
+ return de(() => {
1483
+ h((v) => new Set(v).add(d));
1484
+ }, [d]), de(() => {
1485
+ const v = k ?? 0;
1486
+ v > 0 && h((u) => {
1487
+ const I = new Set(u);
1488
+ for (let w = 0; w <= v; w++) I.add(w);
1489
+ return I;
1490
+ });
1491
+ }, [k]), _;
1492
+ })(s, g), T = ke(() => ({ ...t, ...Tn(e.map((d, k) => {
1493
+ var _, h;
1494
+ return { ...d, value: k < s ? ((_ = r.get(`${d.name}`)) == null ? void 0 : _.value) ?? null : null, secondaryValue: k < s ? ((h = r.get(`${d.name}`)) == null ? void 0 : h.secondaryValue) ?? null : null };
1495
+ })) }), [t, r, e, s]);
1496
+ Un(T);
1497
+ const j = _n(e, T);
1498
+ de(() => {
1499
+ requestAnimationFrame(() => {
1500
+ C();
1501
+ }), P();
1502
+ }, [s, C, D, P]);
1503
+ const q = Ce((d, k) => {
1504
+ if (!k) return;
1505
+ const _ = j[s];
1506
+ if (!_) return;
1507
+ const h = `${_.name}`;
1508
+ i(h, d);
1509
+ const v = { ...d, questionText: Sn(_) };
1510
+ _.childId && (v == null ? void 0 : v.value) != null && Pn({ displayCard: _, response: v, createDynamicFollowupQuestion: f }), o([v]);
1511
+ }, [j, s, o, i]), V = j.map((d, k) => ({ card: d, cardIndex: k })).filter(({ cardIndex: d }) => E.has(d));
1512
+ return n("div", { className: "conversational-ui ul-conversational-ui", "data-testid": "ui-container", children: [!l && n(It, {}), n("div", { className: "chat-container", children: n("div", { className: "chat-messages", children: V.map(({ card: d, cardIndex: k }) => n(jt, { avatars: c, card: d, cardIndex: k, cardResponses: r, currentQuestionBubbleRef: b, handleCardResponse: q, index: s, questionThinkingStates: D, startingQuestionIdx: g }, `question-card-${d.name}`)) }) }), l && n("div", { className: "long-form-question-footer-container-logo", children: a && n(Dn, { forceBrandedLogo: p, marketingUrlLink: y }) })] });
1513
+ };
1514
+ export {
1515
+ Pt as default
1516
+ };