@sprig-technologies/sprig-bundled 2.37.1 → 2.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1513 @@
1
+ import { u as $, a as e, h as V, c as B, g as J, b as de, d as ze, p as re, F as Se, e as ce, _ as X, T as we, A as In, f as Tn, i as _n, j as Sn, w as ln } from "./view-YQ2Evaey.js";
2
+ import { v as Dn, E as Be, h as Ge, A as Ze, i as De, j as Ln } from "./index-BwHToX-D.js";
3
+ import { B as le, M as ie, O as Le, Q as pe, a as ve, b as je, S as Rn, L as dn, u as Pn, H as Qe, g as Mn, P as Nn } from "./getAttributedUrl-CpFKy4tr.js";
4
+ const he = "https://cdn.sprig.com", _ = { document: void 0, videojs: void 0 }, We = (n) => n + "-loading-spiner", W = "hidden", Je = ".m3u8", qe = "questionId", Ue = "ul-video-recorder-camera-off-button", Oe = "ul-recording-in-session", Bn = [{ 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` }], cn = [{ 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
+ ` }], un = "-video-player", Xe = "-secondary-video-player", en = "-video-recorder";
662
+ let te, nn;
663
+ const ue = async ({ event: n, apiBase: o, headers: t, visitorId: r, envId: i, metadata: s }) => {
664
+ const l = _.document.documentElement;
665
+ if (!r || !i) return;
666
+ const v = { event: `SDK - ${n}`, 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(v) })).ok || console.warn("[Sprig] (ERR-444) Failed to track analytics", n);
668
+ }, ae = async (n, o, t, r, i, s) => {
669
+ ue({ event: `Video Error ${o}`, apiBase: t, headers: r, visitorId: i, envId: s, metadata: { errorMessage: n.message } });
670
+ const l = _.document.documentElement, v = { 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: n.message, stack: n.stack }, meta: v, 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", n);
672
+ }, pn = (n, o) => {
673
+ if (n.length === 0) return o && o();
674
+ Promise.all(n.reduce((t, r) => (t.push(((i, { type: s, content: l }) => new Promise(function(v, a) {
675
+ let c;
676
+ s === "script" ? (c = _.document.createElement("script"), c.src = l) : s === "link" ? (c = _.document.createElement("link"), c.rel = "stylesheet", c.href = l, c.type = "text/css") : (c = _.document.createElement("style"), c.innerHTML = l), c.onload = function() {
677
+ v(l);
678
+ }, c.onerror = function() {
679
+ a(l);
680
+ }, c.async = !1, c.id = btoa(l), i.appendChild(c);
681
+ }))(_.document.head, r)), t), [])).then(() => {
682
+ _.videojs = _.document.defaultView.videojs, o && o();
683
+ }).catch(function(t) {
684
+ console.log(t + " failed to load");
685
+ });
686
+ }, tn = (n, o, t) => {
687
+ if (o === "start" && (n.style.visibility = "visible"), o === "none") n.style.visibility = W;
688
+ else if (o === "success") n.style.visibility = W, n.innerHTML = "Upload succeeded!";
689
+ else {
690
+ const r = Math.round(parseFloat(t));
691
+ n.innerHTML = `Uploading <span class="ul-upload-progress-label__time">${r}%</span>`, n.style.background = `linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`;
692
+ }
693
+ }, Ae = (n, o) => {
694
+ const t = _.videojs(n.id());
695
+ return t == null ? void 0 : t.payload[o];
696
+ }, vn = (n, o) => {
697
+ const t = new (_.videojs.getComponent("Component"))(n);
698
+ return t.addClass("ul-buttons-panel"), o.map((r) => {
699
+ t.addChild(r);
700
+ }), qn(t), t;
701
+ }, qn = (n) => {
702
+ n.children().forEach((o) => {
703
+ if (ee[o.name_]) {
704
+ const t = Ie(ee[o.name_], `ul-${ee[o.name_]}`);
705
+ o.el_.appendChild(t);
706
+ }
707
+ });
708
+ }, Ie = (n, o = "") => {
709
+ const t = _.document.createElement("span");
710
+ return t.className = "ul-button-text", t.innerHTML = n, t.id = o, t;
711
+ }, mn = (n, o, t, r, i = !1, s) => {
712
+ n.addClass("ul-video-player");
713
+ const l = new (_.videojs.getComponent("Component"))(n);
714
+ l.addClass("ul-control-panel"), n.progressBar = l.addChild("ProgressControl"), t && n.src(t), n.audioPlayerPlaceholder = new (_.videojs.getComponent("Component"))(n), n.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");
715
+ const v = t && t.src ? Hn(t.src) : null;
716
+ !t || !i && v ? (n.audioPlayerPlaceholder.hide(), _.document.getElementById(`${n.id()}_html5_api`).style.height = "100%", v && n.poster(v)) : (n.children()[0].classList.add("vjs-hidden"), _.document.getElementById(`${n.id()}_html5_api`).style.height = "0px"), n.on("play", () => {
717
+ i || !t || v || On(n), s == null || s.play();
718
+ }), n.on("pause", () => {
719
+ s == null || s.pause();
720
+ }), n.on("seeked", () => {
721
+ s == null || s.currentTime(n.currentTime());
722
+ }), n.on("ratechange", () => {
723
+ s == null || s.playbackRate(n.playbackRate());
724
+ }), n.addChild(n.audioPlayerPlaceholder, {}, 1), l.addChild(o), n.addChild(l), r && r(n);
725
+ }, Un = (n, o, t, r, i, s, l, v = !1) => {
726
+ nn = Date.now();
727
+ const a = Te(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: c, questionId: b, responseGroupUid: d, visitorId: f, envId: w } = t;
731
+ let m;
732
+ const u = (p) => {
733
+ const g = Ue, C = Ue + "-audio-only";
734
+ tn(a.uploadProgressLabel, "none"), te && te.startTime >= nn && te.abort();
735
+ const R = _.document.getElementById("ul-camera-button");
736
+ p ? (a.children()[0].classList.add("vjs-hidden"), x.removeClass(g), x.addClass(C), R.innerHTML = ee.TurnOnCamera, a.audioPlayerPlaceholder.removeClass("vjs-hidden"), m == null || m.getTracks().forEach((D) => {
737
+ D.stop();
738
+ }), window.navigator.mediaDevices.getUserMedia({ video: !0, audio: !0 }).then((D) => {
739
+ m = D, D.getVideoTracks().forEach((M) => {
740
+ M.enabled = !1;
741
+ }), a.record().onDeviceReady(D);
742
+ }).catch(a.record().onDeviceError.bind(a.record()))) : (m == null || m.getVideoTracks().forEach((D) => {
743
+ D.enabled = !0;
744
+ }), a.children()[0].classList.remove("vjs-hidden"), a.record().getDevice(), x.removeClass(C), x.addClass(g), R.innerHTML = ee.TurnOffCamera, a.audioPlayerPlaceholder.addClass("vjs-hidden"));
745
+ }, h = new (_.videojs.getComponent("Button"))(a, { clickHandler: () => {
746
+ h.hasClass(W) || (ue({ event: "Video Delete Button Clicked", apiBase: r, headers: l, visitorId: f, envId: w, metadata: { questionId: b, responseGroupUid: d, surveyId: c } }), u(a.cameraOff), i(P.DELETE, {}), x.removeClass(W), h.addClass(W));
747
+ } });
748
+ h.addClass("ul-video-recorder-delete-button"), h.el_.appendChild(Ie(ee.DeleteButton, "ul-delete-button"));
749
+ const k = _.document.getElementById(o), y = () => {
750
+ k.classList.contains("vjs-fullscreen") && a.cameraOff ? k.style.display = "table" : k.style.display = "flex";
751
+ };
752
+ y();
753
+ const x = new (_.videojs.getComponent("Button"))(a, { clickHandler: () => {
754
+ a.record().isRecording() || (a.cameraOff = !a.cameraOff, ue({ event: "Video Camera Button Clicked", apiBase: r, headers: l, visitorId: t.visitorId, envId: t.envId, metadata: { questionId: b, responseGroupUid: d, surveyId: c, cameraOff: a.cameraOff } }), u(a.cameraOff), !h.hasClass(W) && h.addClass(W), i(P.DELETE, {}), y());
755
+ } });
756
+ x.addClass(Ue), x.el_.appendChild(Ie(ee.TurnOffCamera, "ul-camera-button"));
757
+ const j = new (_.videojs.getComponent("Button"))(a, { clickHandler: () => {
758
+ const p = _.document.getElementById("ul-recorder-toggle");
759
+ if (a.record().isRecording()) a.record().stop(), p && (p.innerHTML = ee.RecordButton), j.removeClass(Oe), h.removeClass(W);
760
+ else {
761
+ const g = _.document.getElementById("ul-recording-countdown-screen");
762
+ if (g) g.remove(), p && (p.innerHTML = ee.RecordButton), u(a.cameraOff), i(P.DELETE, {}), x.removeClass(W), h.addClass(W), j.removeClass(Oe), S.show();
763
+ else {
764
+ j.addClass(Oe), S.hide(), x.addClass(W), h.addClass(W), p && (p.innerHTML = ee.StopButton);
765
+ const C = _.document.createElement("div");
766
+ C.id = "ul-recording-countdown-screen", k.insertBefore(C, k.children[1]), C.style.height = `${k.offsetHeight}px`, gn(a, 3);
767
+ }
768
+ }
769
+ } });
770
+ j.addClass("ul-video-recorder-toggle-button"), j.el_.appendChild(Ie(ee.RecordButton, "ul-recorder-toggle"));
771
+ const E = _.document.createElement("p");
772
+ E.style.visibility = "hidden", E.className = "ul-upload-progress-label", n.appendChild(E), a.uploadProgressLabel = E;
773
+ const N = vn(a, [h, x, "PlayToggle", j, "FullscreenToggle"]), S = N.children().find((p) => p.name_ === "FullscreenToggle");
774
+ S.hasClass("vjs-disabled") && S.hide();
775
+ const T = N.children().find((p) => p.name_ === "PlayToggle");
776
+ T.hide(), h.addClass(W), mn(a, N, s, !1, v), a.on("stopRecord", () => {
777
+ j.hide(), T.show(), S.show(), h.removeClass(W);
778
+ }), a.on("deviceReady", () => {
779
+ j.show(), T.hide(), h.addClass(W);
780
+ }), ((p, g, C, R, D) => {
781
+ const { surveyId: M, responseGroupUid: H, visitorId: q, envId: A } = p.payload;
782
+ p.on("deviceError", function() {
783
+ console.warn("device error: ", p.deviceErrorCode), p.deviceErrorCode.message === "Permission denied" ? (p.deviceButton.addClass("permission-denied"), C && C(P.ERROR, { type: P.PERMISSION_DENIED }), ue({ event: "Video Permission Denied", apiBase: g, headers: D, visitorId: q, envId: A, metadata: { questionId: Ae(p, qe), responseGroupUid: H, surveyId: M } })) : (C && C(P.ERROR, { type: P.OTHER }), ae(new Error(p.deviceErrorCode.message), "recorderDeviceError", g, D, q, A));
784
+ }), p.on("error", function(Q, F) {
785
+ ae(F || p.error(), "recorderError", g, D, q, A);
786
+ }), p.on("startRecord", function(Q, F) {
787
+ R(p.uploadProgressLabel, "none"), ue({ event: "Video Record Start", apiBase: g, headers: D, visitorId: q, envId: A, metadata: { questionId: Ae(p, qe), responseGroupUid: H, surveyId: M } });
788
+ }), p.on("finishRecord", async function() {
789
+ R(p.uploadProgressLabel, "start", 0);
790
+ const Q = Ae(p, qe);
791
+ if (!M) {
792
+ const I = "internal error: missing fields in payload";
793
+ return C && C(P.ERROR, { type: P.OTHER }), ae(new Error(I), "finishRecord", g, D, q, A), null;
794
+ }
795
+ p.record().stopDevice();
796
+ const F = p.cameraOff ? P.MEDIA_TYPE_AUDIO : P.MEDIA_TYPE_VIDEO, Y = Dn();
797
+ ue({ event: "Video Record Finish", apiBase: g, headers: D, visitorId: q, envId: A, metadata: { mediaRecordingUid: Y, questionId: Q, responseGroupUid: H, surveyId: M, mediaType: F } });
798
+ const ne = { surveyId: M, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), mediaType: F, mediaRecordingUid: Y };
799
+ Q && (ne.questionId = Q), H && (ne.responseGroupUid = H), q && (ne.visitorId = q);
800
+ const fe = await (async () => {
801
+ const I = await fetch(`${g}/2/environments/integrations/upload`, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(ne) });
802
+ if (I.ok) {
803
+ const U = await I.json();
804
+ return C && C(P.UPLOAD_STARTED, { [P.UPLOAD_ID]: U.upload.id, [P.MEDIA_TYPE]: F, [P.MEDIA_RECORDING_UID]: Y }), U.upload.url;
805
+ }
806
+ return C && C(P.ERROR, { type: P.OTHER, response: I }), ae(new Error("failed to get upload response with url"), "finishRecord", g, D, q, A), null;
807
+ })();
808
+ fe && (te = _.document.defaultView.UpChunk.createUpload({ endpoint: fe, file: new _.document.defaultView.File([p.recordedData], `recording ${F} ${Date.now()}`), chunkSize: 5120 }), te.startTime = Date.now(), ue({ event: "Video Upload Start", apiBase: g, headers: D, visitorId: q, envId: A, metadata: { mediaRecordingUid: Y, questionId: Q, responseGroupUid: H, surveyId: M, mediaType: F, url: fe } }), te.on("error", (I) => {
809
+ R(p.uploadProgressLabel, "none"), C && C(P.UPLOAD_FINISHED, { [P.MEDIA_RECORDING_UID]: Y }), ae(I, "finishRecord", g, D, q, A);
810
+ }), te.on("progress", (I) => {
811
+ C && C(P.UPLOAD_PROGRESS, { [P.MEDIA_RECORDING_UID]: Y, [P.UPLOAD_PROGRESS_PCT]: I.detail }), R(p.uploadProgressLabel, "progress", I.detail);
812
+ }), te.on("success", () => {
813
+ R(p.uploadProgressLabel, "success"), C && C(P.UPLOAD_FINISHED, { [P.MEDIA_RECORDING_UID]: Y }), ue({ event: "Video Upload Success", apiBase: g, headers: D, visitorId: q, envId: A, metadata: { mediaRecordingUid: Y, questionId: Q, responseGroupUid: H, surveyId: M, mediaType: F, url: fe, elapsedMs: te.startTime && Date.now() - te.startTime } });
814
+ }));
815
+ });
816
+ })(a, r, i, tn, l);
817
+ const L = [{ name: "microphone" }];
818
+ !a.cameraOff && L.push({ name: "camera" }), Promise.all(L.map((p) => {
819
+ var g;
820
+ return (g = navigator == null ? void 0 : navigator.permissions) == null ? void 0 : g.query(p);
821
+ })).then((p) => {
822
+ p.reduce((g, C) => g & C.state === "granted", !0) && a && (a.deviceButton && a.deviceButton.hide(), a.record().getDevice());
823
+ }).catch((p) => {
824
+ });
825
+ }, gn = (n, o = 3) => {
826
+ const t = _.document.getElementById("ul-recording-countdown-screen");
827
+ t && o === 0 ? (t.remove(), n.record().start()) : t && (t.innerHTML = `<span class='ul-countdown-text'>Recording in... ${o}</span>`, setTimeout(() => {
828
+ gn(n, o - 1);
829
+ }, 1e3));
830
+ }, hn = (n) => {
831
+ const o = _.document.createElement("div");
832
+ return o.className = "ul-video-container", o.appendChild(((t) => {
833
+ const r = _.document.createElement("div");
834
+ return r.className = "ul-video-player-loading", r.id = We(t), ["first", "second", "third", "fourth"].map((i) => {
835
+ const s = _.document.createElement("div");
836
+ s.className = i, r.appendChild(s);
837
+ }), r;
838
+ })(n)), o;
839
+ }, He = (n, o) => {
840
+ const t = _.document.createElement("video");
841
+ t.id = n, t.className = "video-js vjs-default-skin ul-video-player-video";
842
+ const r = _.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 = _.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
+ }, On = (n, o) => {
847
+ n.children()[0].classList.remove("vjs-hidden"), n.audioPlayerPlaceholder.hide(), _.document.getElementById(`${n.id()}_html5_api`).style.height = "100%";
848
+ }, Te = (n, o) => _.document.getElementById(n) ? o ? _.videojs(n, o) : _.videojs(n) : (console.error(`Error in finding player element with ID, ${n}`), null), An = (n, o, t, r = !1, i = "https://api.sprig.com", s = document, l = null, v = null) => {
849
+ _.document = s;
850
+ const a = n + un, c = hn(a);
851
+ return _.document.addEventListener("securitypolicyviolation", (b) => {
852
+ ae(new Error(`Voice & Video feature violates ${b.violatedDirective} web page CSP policies for the question player.`), "playerDeviceError", i, {});
853
+ }), pn(cn, () => {
854
+ _.document.getElementById(We(a)).remove(), He(a, c);
855
+ const b = { playsinline: !0, playbackRates: [0.5, 1, 1.5, 2], fill: !0 };
856
+ try {
857
+ const d = n + Xe;
858
+ He(d, c);
859
+ const f = Te(a, b), w = Te(d, { muted: !0, ...b });
860
+ if (!f || !w) return;
861
+ ((h, k, y) => {
862
+ h.addClass(`ul${Xe}`);
863
+ const x = new (_.videojs.getComponent("Component"))(h);
864
+ k && h.src(k), h.addChild(x), y && y(h);
865
+ })(w, l, v), l || w.addClass(W);
866
+ const m = vn(f, ["PlaybackRateMenuButton", "PlayToggle", "FullscreenToggle"]), u = m.children().find((h) => h.name_ === "FullscreenToggle");
867
+ u.hasClass("vjs-disabled") && u.hide(), mn(f, m, o, t, r, w);
868
+ } catch (d) {
869
+ return void ae(new Error(`Error when creating video player object ${d}`), "playerDeviceError", i, {});
870
+ }
871
+ }), c;
872
+ }, Hn = (n) => {
873
+ if (!n) return null;
874
+ const o = n.match(/https:\/\/stream.mux.com\/(.*)/);
875
+ let t = o ? o[1] : null;
876
+ return t.includes(Je) && (t = t.replace(Je, "")), t ? `https://image.mux.com/${t}/thumbnail.jpg?time=0` : null;
877
+ }, P = { 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" }, $n = ({ properties: n, surveyVideoUrl: o, questionId: t }) => {
878
+ const r = `ul-card-video__question_player-q${t}`, { apiURL: i, viewDocument: s } = $((l) => ({ apiURL: l.apiURL, viewDocument: l.viewDocument }));
879
+ return e("div", { id: r, ref: (l) => {
880
+ if (l && l.children.length === 0 && !n.properties.hideRecordedPrompt) {
881
+ const v = An(r, { src: o, type: "application/x-mpegURL" }, void 0, n.properties.mediaType === P.MEDIA_TYPE_AUDIO, i, s);
882
+ l.appendChild(v);
883
+ }
884
+ } });
885
+ }, be = ({ isDisabled: n, onClick: o, children: t }) => e(le, { className: "ul-card__button-checkmark", disabled: n, onClick: o, type: "button", children: [e("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#ffffff", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), t || "Ok"] }), Vn = ({ className: n, next: o, properties: t, questionId: r, type: i }) => {
886
+ const { useMobileStyling: s, border: l } = $((T) => ({ useMobileStyling: T.useMobileStyling, border: T.border })), [v, a] = V(!1), [c, b] = V(""), [d, f] = V(!1), w = t == null ? void 0 : t.collectName, m = (t == null ? void 0 : t.nameLabelText) || "Full Name", u = (t == null ? void 0 : t.consentText) || "I agree to the stated conditions", h = (t == null ? void 0 : t.submitButtonText) || "Submit", k = !!c.trim(), y = v && (!w || k), x = (T, L = !1) => {
887
+ T.preventDefault(), T.stopPropagation();
888
+ let p = null;
889
+ if (!L) {
890
+ if (!y) return void f(!0);
891
+ p = { submitted: !0 }, w && (p.name = c);
892
+ }
893
+ o({ value: p, questionId: r, type: i }, !!L || y);
894
+ }, j = (T) => {
895
+ T.preventDefault(), T.stopPropagation(), b(T.currentTarget.value);
896
+ }, E = (T) => {
897
+ T.currentTarget.style.borderColor = d && !k ? Be : l;
898
+ }, N = (T) => {
899
+ T.currentTarget.style.borderColor = d && !k ? Be : Ge;
900
+ }, S = () => e(pe, { children: [e("div", { className: "sprig-stretch", children: [e(Le, { allowTextEntry: !1, border: l, error: d && !v, id: "consent", isRadio: !1, isSelected: v, label: u, onUserInputChanged: ({ selected: T }) => {
901
+ T !== v && a(!v);
902
+ }, useMobileStyling: s }), w && e("input", { "aria-label": m, "aria-placeholder": m, className: B(J("ul-consent-legal__name-input", s)), "data-gramm": "false", maxLength: 250, name: "name", onBlur: N, onFocus: E, onInput: j, placeholder: m, style: d && !k ? { borderColor: Be } : {}, tabIndex: 0, value: c })] }), e("div", { className: "ul-card__button-wrapper ul-card-vertical__button-wrapper", children: [e(be, { isDisabled: !y, onClick: (T) => x(new SubmitEvent(T.type)), children: de({ buttonText: h }) }), t.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (T) => x(new SubmitEvent(T.type), !0), children: ze(t) })] })] });
903
+ return e("div", { className: B(n, "ul-card__consent-legal", "fade-in-transition"), children: e(ie, { properties: t, defaultBody: S, embeddedType: "pdf" }) }, r);
904
+ }, Fn = () => {
905
+ const { destroy: n, forceBrandedLogo: o } = $((t) => ({ destroy: t.destroy, forceBrandedLogo: t.forceBrandedLogo }));
906
+ return re(() => {
907
+ setTimeout(() => {
908
+ n(Ze);
909
+ }, o ? 4e3 : 2e3);
910
+ }, [n, o]), e("div", { className: "end-of-survey-text", children: "End of survey" });
911
+ }, zn = ({ icon: n, scaleLabelType: o, value: t, selectedValue: r }) => {
912
+ if (o === "smiley" && t === r) {
913
+ let i = 0;
914
+ return n.replace(/black/g, () => ++i == 1 ? "black" : "white");
915
+ }
916
+ return n;
917
+ }, Gn = ({ activeValue: n, border: o, icon: t, isPressed: r, range: i, scaleLabelType: s, selectedValue: l, setSelectedValue: v, setActiveValue: a, setIsPressed: c, useMobileStyling: b, value: d, viewDocument: f }) => {
918
+ const w = `option-${d}`, m = s === "number", u = s === "star", h = s === "smiley", k = m && d === n || d === l, [y, x] = (() => {
919
+ const E = u && l !== null && d <= l;
920
+ return u && d <= n || h && d === n || E || d === n || d === l ? [o, r || E || d === l ? 1 : 0.3] : ["", 1];
921
+ })(), j = Se(() => {
922
+ const E = { borderColor: k ? y : "", fillOpacity: k ? "" : x, zIndex: k ? 3 : "auto", color: l === d ? "#fff" : "" };
923
+ return m ? { ...E, backgroundColor: l === d ? y : "" } : { ...E, color: u || h || l === d ? y : "" };
924
+ }, [k, y, x, l, d, m, u, h]);
925
+ return e("button", { "aria-label": m ? void 0 : String(d), className: (() => {
926
+ switch (s) {
927
+ case "star":
928
+ return B(J("likert-star", b), J(`likert-star-${d}`, b));
929
+ case "smiley":
930
+ return B(J("likert-smiley", b), J(`likert-smiley-${d}`, b));
931
+ default:
932
+ return d === i ? B(J("likert-number", b), J(`likert-number-${d}`, b), J("likert-last-option", b)) : B(J("likert-number", b), J(`likert-number-${d}`, b));
933
+ }
934
+ })(), dangerouslySetInnerHTML: { __html: zn({ icon: t, scaleLabelType: s, value: d, selectedValue: l }) }, id: w, onClick: (E) => {
935
+ E.preventDefault(), E.stopPropagation(), v(d);
936
+ }, onKeyDown: (E) => {
937
+ var T, L;
938
+ const N = f.querySelectorAll(`.likert-${s ?? "number"}`), S = d - 1;
939
+ E.key === "ArrowRight" ? (T = N[S + 1]) == null || T.focus() : E.key === "ArrowLeft" ? (L = N[S - 1]) == null || L.focus() : E.key !== "Enter" && E.key !== " " || (E.preventDefault(), E.stopPropagation(), v(d));
940
+ }, onPointerDown: () => c(!0), onPointerEnter: () => a(d), onPointerLeave: () => {
941
+ a(-1), c(!1);
942
+ }, style: j, tabIndex: 0 });
943
+ }, Zn = ({ className: n, labels: o, next: t, properties: r, questionId: i, type: s }) => {
944
+ const { border: l, useMobileStyling: v, viewDocument: a } = $((T) => ({ border: T.border, useMobileStyling: T.useMobileStyling, viewDocument: T.viewDocument })), [c, b] = V(-1), [d, f] = V(!1), [w, m] = V(null), u = o && o.left, h = o && o.right;
945
+ let k;
946
+ const { range: y, scaleLabelType: x, ratingIcons: j } = r;
947
+ y && (k = Number(y));
948
+ const E = k || 5, N = (T) => {
949
+ var L, p;
950
+ switch (x) {
951
+ case "star":
952
+ return (L = j[0]) == null ? void 0 : L.svg;
953
+ case "smiley":
954
+ return (p = j[T]) == null ? void 0 : p.svg;
955
+ default:
956
+ return String(T + 1);
957
+ }
958
+ }, S = [...Array(E)].map((T, L) => {
959
+ const p = L + 1;
960
+ return e(Gn, { activeValue: c, border: l, icon: N(L), isPressed: d, range: E, scaleLabelType: x, selectedValue: w, setActiveValue: b, setIsPressed: f, setSelectedValue: m, useMobileStyling: v, value: p, viewDocument: a }, L);
961
+ });
962
+ return e("form", { className: B(n, "ul-card--likert", "fade-in-transition"), children: e(ie, { properties: r, defaultBody: () => e(ce, { children: [e(ve, { children: [e("div", { "aria-label": `Rating (1 - ${E})`, className: "ul-card--likert__numbers", role: "radiogroup", children: S }), e("div", { className: "ul-card--likert__labels", children: [e("span", { children: u }), e("span", { children: h })] })] }), e(pe, { children: e(be, { isDisabled: w === null && r.required, onClick: () => t({ value: w, questionId: i, type: s }, !0), children: de(r) }) })] }) }) }, i);
963
+ }, Qn = ({ columns: n, onSelect: o, options: t, selectedOptions: r }) => {
964
+ const i = X([]), { border: s, useMobileStyling: l } = $((f) => ({ border: f.border, useMobileStyling: f.useMobileStyling })), v = t.findIndex((f) => r[f.id] === null), [a, c] = V(v), b = we((f, w) => {
965
+ o(f, w);
966
+ const m = a + 1, u = t[m];
967
+ u && r[u.id] === null && c(m);
968
+ }, [o, t, r, a]), d = we((f, w) => {
969
+ const m = a === f;
970
+ return e(In, { animate: !0, header: w.label, isOpen: m, onClick: () => c(m && !window.UserLeap.isMobileSDK ? -1 : f), ref: (u) => {
971
+ u && (i.current[f] = u);
972
+ }, showHeaderCheck: r[w.id] !== null, children: e("div", { style: { paddingTop: "12px" }, children: n.map((u) => e(Le, { allowTextEntry: !1, ariaLabel: `${w.label}-${u.label}`, border: s, error: !1, id: `${w.id}-${u.value}`, isRadio: !0, isSelected: r[w.id] === u.value, label: u.label, onUserInputChanged: () => b(w.id, u.value), useMobileStyling: l }, u.label)) }) }, w.id);
973
+ }, [s, n, a, b, r, l]);
974
+ return e("div", { children: t.map((f, w) => d(w, f)) });
975
+ }, Wn = ({ columns: n, onSelect: o, options: t, selectedOptions: r }) => {
976
+ const { border: i, useMobileStyling: s, isLongFormSurvey: l } = $((m) => ({ border: m.border, useMobileStyling: m.useMobileStyling, isLongFormSurvey: De(m.studyType) })), v = t.length, a = n.length, c = X(null), [b, d] = V(!1), [f, w] = V(!1);
977
+ return re(() => {
978
+ const m = c.current, u = new ResizeObserver((h) => {
979
+ window.requestAnimationFrame(() => {
980
+ m && (d(Math.round(h[0].contentRect.width) < m.scrollWidth), w(Math.round(h[0].contentRect.width) < m.scrollWidth));
981
+ });
982
+ });
983
+ return m && u.observe(m), () => {
984
+ m && u.unobserve(m);
985
+ };
986
+ }, []), e("div", { className: "ul-card--matrix_question_container", children: [e("div", { className: B("ul-card--matrix_container", b && "ul-matrix-scroll-gradient"), onScroll: () => {
987
+ (() => {
988
+ const m = c.current;
989
+ m && d(m.clientWidth + Math.abs(m.scrollLeft) < m.scrollWidth);
990
+ })();
991
+ }, ref: c, children: e("div", { className: B(l && "ul-card--matrix_grid_longform", "ul-card--matrix_grid"), style: `--numColumns: ${a}; --numRows: ${v + 1};`, children: [e("div", {}), " ", n.map((m) => e("div", { className: "ul-matrix-column-label", children: m.label }, m.label)), t.map((m) => e(ce, { children: [e("div", { "aria-label": m.label, className: "ul-matrix-row-label", children: m.label }, m.label), e("div", { className: "ul-matrix-row-options", role: "radiogroup", children: n.map((u, h) => e("div", { className: B("ul-matrix-option-wrapper", h === a - 1 && "ul-matrix-last-option"), children: e(Le, { allowTextEntry: !1, ariaLabel: `${m.label}-${u.label}`, border: i, choiceStyle: { background: "transparent", border: "none", marginBottom: "0", padding: "0" }, error: !1, id: `${m.id}-${u.value}`, isRadio: !0, isSelected: r[m.id] === u.value, onUserInputChanged: () => o(m.id, u.value), useMobileStyling: s }) }, u.value)) })] }))] }) }), (b || f) && e("button", { className: f && !b ? "ul-matrix-scroll-arrow left" : "ul-matrix-scroll-arrow", onClick: f && !b ? (m) => {
992
+ m.preventDefault();
993
+ const u = c.current;
994
+ if (u) {
995
+ const h = getComputedStyle(u).direction === "rtl";
996
+ u.scrollTo({ left: h ? u.scrollWidth - u.clientWidth : 0, behavior: "smooth" });
997
+ }
998
+ } : (m) => {
999
+ m.preventDefault();
1000
+ const u = c.current;
1001
+ if (u) {
1002
+ const h = getComputedStyle(u).direction === "rtl";
1003
+ u.scrollTo({ left: h ? u.clientWidth - u.scrollWidth : u.scrollWidth, behavior: "smooth" });
1004
+ }
1005
+ }, children: e(f && !b ? Yn : Kn, {}) })] });
1006
+ }, Yn = () => e("svg", { fill: "currentColor", height: "32", transform: "matrix(-1,0,0,1,0,0)", version: "1.1", viewBox: "0 0 256 256", width: "32", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" }) }), Kn = () => e("svg", { fill: "currentColor", height: "32", viewBox: "0 0 256 256", width: "32", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" }) }), Jn = ({ className: n, next: o, options: t, properties: r, questionId: i, type: s, onSubmitButtonClick: l }) => {
1007
+ const { useMobileStyling: v, isLongFormSurvey: a } = $((k) => ({ useMobileStyling: k.useMobileStyling, isLongFormSurvey: De(k.studyType) })), c = r.matrixColumn, b = r.required, d = (k) => {
1008
+ k.preventDefault(), k.stopPropagation(), o({ value: w, questionId: i, type: s }, !0), l && l();
1009
+ }, f = t.reduce((k, y) => (k[y.id] = null, k), {}), [w, m] = V(f), u = (k, y) => {
1010
+ m((x) => ({ ...x, [k]: y }));
1011
+ }, h = r.displayMatrixAsAccordion || v;
1012
+ return e("form", { className: B(n, !a && "ul-card__matrix", "fade-in-transition"), id: "text-form", onSubmit: d, children: e(ie, { properties: r, defaultBody: () => {
1013
+ return e(ce, { children: [e(ve, { children: e(h ? Qn : Wn, { columns: c, onSelect: u, options: t, selectedOptions: w }) }), e(pe, { children: e(be, { isDisabled: (k = w, b && Object.values(k).every((y) => y == null)), onClick: () => d(new SubmitEvent("submit")), children: de(r) }) })] });
1014
+ var k;
1015
+ } }) }, i);
1016
+ }, bn = ({ className: n, onSubmit: o, options: t = [], properties: r, questionId: i, type: s, showIndividualSubmit: l = !1, onSubmitButtonClick: v }) => {
1017
+ const { border: a, useMobileStyling: c } = $((g) => ({ border: g.border, useMobileStyling: g.useMobileStyling })), b = t.reduce((g, C) => (g[C.id] = { isSelected: !1 }, g), {}), [d, f] = V(b), w = s === "multiplechoice", m = r.required, u = t.find((g) => {
1018
+ var C;
1019
+ return (C = g.optionProperties) == null ? void 0 : C.noneOfTheAbove;
1020
+ }), h = (g) => Object.entries(g).some(([C, R]) => {
1021
+ var H;
1022
+ const D = t.find((q) => `${q.id}` === C), M = R.userText === void 0 || R.userText.trim() === "";
1023
+ return ((H = D == null ? void 0 : D.optionProperties) == null ? void 0 : H.allowsTextEntry) && M && R.isSelected;
1024
+ }), k = (g) => Object.values(g).filter((C) => C.isSelected).length, y = r.minSelect && r.minSelect > 0 && r.maxSelectMode === je.Range && k(d) < r.minSelect && (m || k(d) > 0), x = (g) => h(g) || m && !k(g) || !((C) => {
1025
+ const { minSelect: R = 0, maxSelect: D = 1 / 0, maxSelectMode: M } = r, H = k(C);
1026
+ switch (M) {
1027
+ case je.Maximum:
1028
+ return H <= D;
1029
+ case je.Range:
1030
+ return H === 0 || H >= R;
1031
+ default:
1032
+ return !0;
1033
+ }
1034
+ })(g), j = Object.entries(d).some(([g, C]) => {
1035
+ var R, D;
1036
+ return C.isSelected && ((D = (R = t.find((M) => `${M.id}` === g)) == null ? void 0 : R.optionProperties) == null ? void 0 : D.allowsTextEntry);
1037
+ }), E = l && (!w || j), N = (g) => {
1038
+ p(g.id, g.selected, g.userText, g.noneOfTheAbove);
1039
+ }, S = (g) => {
1040
+ var C;
1041
+ return (r == null ? void 0 : r.maxSelectMode) !== je.Unlimited && k(d) === (r == null ? void 0 : r.maxSelect) && !((C = d[g]) != null && C.isSelected);
1042
+ }, T = t.map(({ id: g, label: C, value: R, optionProperties: D }) => {
1043
+ var Q, F;
1044
+ const M = `${g}`, { allowsTextEntry: H, noneOfTheAbove: q } = { allowsTextEntry: !1, noneOfTheAbove: !1, ...D };
1045
+ return e(Le, { allowTextEntry: H, border: a, disabled: S(M), error: (A = d, h(A)), id: M, isRadio: w, isSelected: !!((Q = d[M]) != null && Q.isSelected), label: C, noneOfTheAbove: q, onUserInputChanged: N, promptText: "Please specify", text: (F = d[g]) == null ? void 0 : F.userText, useMobileStyling: c, value: R }, M);
1046
+ var A;
1047
+ }), L = () => {
1048
+ o(d, !0), v && v();
1049
+ }, p = (g, C, R, D) => {
1050
+ const M = Object.assign({}, d);
1051
+ if ((w || D) && C) for (const H of Object.values(M)) H.isSelected = !1, delete H.userText;
1052
+ else u && !D && d[u.id].isSelected && (M[u.id].isSelected = !1);
1053
+ M[g] = { isSelected: C, userText: R }, f(M);
1054
+ };
1055
+ return e("form", { className: B(n, "ul-card--multiple", "fade-in-transition"), id: "text-form", onSubmit: L, children: e(ie, { properties: r, defaultBody: () => e(ce, { children: [e(ve, { children: [r.isDropdown ? e(Rn, { disabledOptions: t.filter((g) => S(g.id)), dropdownFooter: y ? e("div", { className: "ul-card__min-select-counter", style: { marginLeft: "16px" }, children: [k(d), "/", r.minSelect] }) : void 0, isMultiSelect: !w, multiselectText: r.dropdownMultiselectedText ?? "choices selected", onChange: (g) => {
1056
+ const C = { ...d };
1057
+ for (const R of t) g.includes(R) ? C[R.id].isSelected = !0 : C[R.id].isSelected = !1;
1058
+ f(C);
1059
+ }, options: t, placeholderText: r.dropdownPlaceholderText ?? (w ? "Select choice" : "Select choice(s)"), value: t.filter((g) => d[g.id].isSelected) }) : e("div", { className: B(J("ul-card__choices", c)), role: w ? "radiogroup" : "group", children: [T, !!y && e("div", { className: "ul-card__min-select-counter", children: [k(d), "/", r.minSelect] })] }), E && e(dn, { handleSubmit: L, isSubmitDisabled: x(d) })] }), e(pe, { children: e("div", { className: "ul-card__button-wrapper", children: e(be, { isDisabled: x(d), onClick: L, children: de(r) }) }) })] }) }) }, i);
1060
+ }, Xn = (n) => {
1061
+ const { questionId: o, type: t, next: r, options: i } = n;
1062
+ return e(bn, { ...n, onSubmit: (s, l) => {
1063
+ const v = Object.entries(s).find(([, f]) => f.isSelected) || [void 0, void 0], [a, c] = v, b = i.find((f) => `${f.id}` === a), d = c != null && c.userText ? { [a]: { userText: c.userText } } : null;
1064
+ r({ value: b && a ? { [a]: b.value } : {}, secondaryValue: d, questionId: o, type: t }, l);
1065
+ } });
1066
+ }, et = (n) => {
1067
+ const { questionId: o, type: t, next: r } = n;
1068
+ return e(bn, { ...n, onSubmit: (i, s) => {
1069
+ const l = Object.entries(i).reduce((a, [c, b]) => (a[c] = b.isSelected, a), {}), v = Object.entries(i).reduce((a, [c, b]) => {
1070
+ if (!b.userText) return a;
1071
+ const d = a || {};
1072
+ return d[c] = { userText: b.userText }, d;
1073
+ }, null);
1074
+ r({ value: l, secondaryValue: v, questionId: o, type: t }, s);
1075
+ } });
1076
+ }, nt = ({ className: n, labels: o, properties: t, next: r, questionId: i, type: s }) => {
1077
+ const [l, v] = V(null), { border: a, useMobileStyling: c, viewDocument: b } = $((m) => ({ border: m.border, useMobileStyling: m.useMobileStyling, viewDocument: m.viewDocument })), d = o && o.left, f = o && o.right, w = [...Array(11)].map((m, u) => e("button", { className: B(J("nps-number", c), J(`nps-number-${u}`, c)), id: `option-${u}`, onClick: (h) => {
1078
+ h.preventDefault(), h.stopPropagation(), v(u);
1079
+ }, onKeyDown: (h) => {
1080
+ var y, x;
1081
+ const k = b.querySelectorAll("button.nps-number");
1082
+ h.key === "ArrowRight" ? (y = k[u + 1]) == null || y.focus() : h.key === "ArrowLeft" ? (x = k[u - 1]) == null || x.focus() : h.key !== "Enter" && h.key !== " " || (h.preventDefault(), h.stopPropagation(), v(u));
1083
+ }, onPointerDown: (h) => {
1084
+ h.currentTarget.style.zIndex = "2", h.currentTarget.style.borderColor = a;
1085
+ }, onPointerLeave: (h) => {
1086
+ h.currentTarget.style.zIndex = "auto", h.currentTarget.style.borderColor = Ge;
1087
+ }, style: l === u ? { backgroundColor: a, color: "#fff" } : void 0, tabIndex: 0, children: u }, u));
1088
+ return e("form", { className: B(n, "ul-card--nps", "fade-in-transition"), children: e(ie, { properties: t, defaultBody: () => e(ce, { children: [e(ve, { children: [e("div", { className: "ul-card--nps__numbers", children: w }), e("div", { className: "ul-card--nps__labels", children: [e("span", { children: d }), e("span", { children: f })] })] }), e(pe, { children: e(be, { isDisabled: l === null && t.required, onClick: () => r({ value: l, questionId: i, type: s }, !0), children: de(t) }) })] }) }) }, i);
1089
+ }, tt = ({ className: n, next: o, properties: t, questionId: r, type: i, onSubmitButtonClick: s }) => {
1090
+ const { border: l, useMobileStyling: v, update: a } = $((j) => ({ border: j.border, useMobileStyling: j.useMobileStyling, update: j.update })), [c, b] = V(""), d = X(null), f = c.trim(), w = t.required === !0 && !f, m = Pn(d, () => a()), u = (j) => {
1091
+ const { value: E } = j.currentTarget;
1092
+ m(), j.preventDefault(), j.stopPropagation(), b(E);
1093
+ }, h = (j) => {
1094
+ j.preventDefault(), j.stopPropagation();
1095
+ const E = t.required !== !0 || f.length > 0;
1096
+ o({ value: c, questionId: r, type: i }, E), s && s();
1097
+ }, k = t && t.openTextPlaceholder ? t.openTextPlaceholder : "", y = (j) => {
1098
+ j.currentTarget.style.borderColor = l;
1099
+ }, x = (j) => {
1100
+ j.currentTarget.style.borderColor = Ge;
1101
+ };
1102
+ return e("form", { className: B(n, "ul-card-text", "fade-in-transition"), id: "text-form", children: e(ie, { defaultBody: () => e("div", { className: "ul-card-text", children: [e(ve, { children: [e("div", { className: "ul-card-text__container", children: e("textarea", { "aria-describedby": "ul-caption", "aria-labelledby": "ul-question", "aria-multiline": "true", "aria-placeholder": k, className: B(J("ul-card-text__input", v)), "data-gramm": "false", maxLength: 5e3, name: "text", onBlur: x, onChange: u, onFocus: y, placeholder: k, ref: d, role: "textbox", tabIndex: 0 }) }), t.footerHtml && e("div", { className: "footer", dangerouslySetInnerHTML: { __html: t.footerHtml } })] }), e(pe, { children: e(be, { isDisabled: w, onClick: h, children: de(t) }) })] }), properties: t }) }, r);
1103
+ }, rt = ({ className: n, labels: o, next: t, properties: r, questionId: i, type: s, onSubmitButtonClick: l, options: v, showIndividualSubmit: a = !1 }) => {
1104
+ const c = X(null), b = X(0), d = X(0), f = X(null), w = X(!1), m = X([]), [u, h] = V(() => (r == null ? void 0 : r.required) === !0), [k, y] = V(() => v.map((I) => ({ ...I, rank: null }))), x = Se(() => Array.from({ length: v.length }, (I, U) => U + 1), [v.length]), { useMobileStyling: j, isPreview: E, headers: N } = $((I) => ({ useMobileStyling: I.useMobileStyling, isPreview: I.isPreview, headers: I.headers })), S = j && !E, T = Ln(N) && S, L = (I) => {
1105
+ I.preventDefault(), H(k), l && l();
1106
+ }, p = (I, U) => {
1107
+ for (let z = 0; z < m.current.length; z++) {
1108
+ const O = m.current[z];
1109
+ if (!O || O === f.current) continue;
1110
+ const K = O.getBoundingClientRect();
1111
+ if (I >= K.left && I <= K.right && U >= K.top && U <= K.bottom) return { element: O, index: z };
1112
+ }
1113
+ return null;
1114
+ }, g = (I) => (U) => {
1115
+ if (!S) return;
1116
+ U.preventDefault(), U.stopPropagation(), w.current = !0, c.current = I;
1117
+ const z = U.touches[0];
1118
+ b.current = z.clientY, d.current = z.clientY;
1119
+ const O = U.currentTarget.closest(".ul-card-rank__option");
1120
+ O && (f.current = O, O.classList.add("is-dragging"));
1121
+ }, C = (I) => {
1122
+ if (!S || !w.current || c.current === null) return;
1123
+ I.preventDefault(), I.stopPropagation();
1124
+ const U = I.touches[0];
1125
+ d.current = U.clientY;
1126
+ const z = d.current - b.current;
1127
+ f.current && (f.current.style.transform = `translateY(${z}px)`, f.current.style.zIndex = "1000"), m.current.forEach((K) => {
1128
+ K && K !== f.current && K.classList.remove("is-drop-target");
1129
+ });
1130
+ const O = p(U.clientX, U.clientY);
1131
+ O && O.element.classList.add("is-drop-target");
1132
+ }, R = (I) => {
1133
+ if (!S || !w.current || c.current === null) return;
1134
+ I.preventDefault(), I.stopPropagation();
1135
+ const U = I.changedTouches[0], z = p(U.clientX, U.clientY);
1136
+ f.current && (f.current.style.transform = "", f.current.style.zIndex = "", f.current.classList.remove("is-dragging")), m.current.forEach((O) => {
1137
+ O && O.classList.remove("is-drop-target");
1138
+ }), z && z.index !== c.current && D(c.current, z.index), c.current = null, f.current = null, w.current = !1;
1139
+ }, D = (I, U) => {
1140
+ y((z) => {
1141
+ const O = z.map((me) => ({ ...me })), [K] = O.splice(I, 1);
1142
+ return O.splice(U, 0, K), O.forEach((me, Z) => {
1143
+ me.rank = Z + 1;
1144
+ }), q(), O;
1145
+ });
1146
+ }, M = (I) => {
1147
+ I.preventDefault(), I.dataTransfer && (I.dataTransfer.dropEffect = "move");
1148
+ }, H = (I) => {
1149
+ const U = {};
1150
+ I.reduce((z, O) => (z[O.id] = O.rank, z), U), t({ value: U, questionId: i, type: s }, !0);
1151
+ }, q = () => {
1152
+ h(!1);
1153
+ }, { left: A, right: Q } = o, F = v.length, Y = (I) => {
1154
+ I.preventDefault(), I.currentTarget.classList.add("is-drop-target");
1155
+ }, ne = (I) => {
1156
+ I.currentTarget.classList.remove("is-drop-target");
1157
+ }, fe = (I) => {
1158
+ c.current = null, I.currentTarget.classList.remove("is-dragging");
1159
+ };
1160
+ return e("form", { className: B(n, "ul-card-rank", "fade-in-transition"), onSubmit: L, children: e(ie, { properties: r, defaultBody: () => e(ce, { children: [e(ve, { children: [e("div", { className: "ul-card--rank__question-inner-container", children: [e("div", { className: "ul-card-rank__labels", children: e("span", { children: ["1 - ", A] }) }), e("ol", { className: "ul-card-rank__list", onDragOver: M, children: k.map(({ id: I, label: U, rank: z }, O) => {
1161
+ return e("li", { className: "ul-card-rank__option", draggable: !S, onDragEnd: S ? void 0 : fe, onDragEnter: S ? void 0 : Y, onDragLeave: S ? void 0 : ne, onDragStart: S ? void 0 : (me = O, (Z) => {
1162
+ c.current = me, Z.dataTransfer && (Z.dataTransfer.effectAllowed = "move", Z.dataTransfer.setData("text/plain", String(me)), Z.currentTarget.classList.add("is-dragging"));
1163
+ }), onDrop: S ? void 0 : (K = O, (Z) => {
1164
+ var ke, Ce;
1165
+ Z.preventDefault(), Z.currentTarget.classList.remove("is-drop-target");
1166
+ const ge = c.current;
1167
+ c.current = null, (Ce = (ke = Z.currentTarget.closest(".ul-card-rank__list")) == null ? void 0 : ke.querySelector(".is-dragging")) == null || Ce.classList.remove("is-dragging"), ge != null && ge !== K && D(ge, K);
1168
+ }), ref: (Z) => m.current[O] = Z, children: [e("select", { "aria-label": `Rank for ${U}`, className: B("ul-card-rank__select", z == null && "ul-card-rank__select--placeholder"), name: `rank[${I}]`, onChange: (Z) => ((ge, ke) => {
1169
+ y((Ce) => {
1170
+ const xe = parseInt(ke), se = Ce.map((G) => ({ ...G }));
1171
+ se.some((G) => G.rank == null) && se.forEach((G, Ne) => G.rank = Ne + 1);
1172
+ const Me = se.findIndex((G) => G.id === ge);
1173
+ if (Me === -1) return Ce;
1174
+ const Ee = se[Me].rank;
1175
+ return xe < Ee ? se.forEach((G) => {
1176
+ G.id !== ge && G.rank >= xe && G.rank < Ee && (G.rank = G.rank + 1);
1177
+ }) : xe > Ee && se.forEach((G) => {
1178
+ G.id !== ge && G.rank > Ee && G.rank <= xe && (G.rank = G.rank - 1);
1179
+ }), se[Me].rank = xe, se.sort((G, Ne) => G.rank - Ne.rank), q(), se;
1180
+ });
1181
+ })(I, Z.currentTarget.value), value: z ?? "", children: [z == null && e("option", { className: "ul-card-rank__select-option", disabled: !0, value: "", children: "-" }), x.map((Z) => e("option", { className: "ul-card-rank__select-option", value: Z, children: Z }, Z))] }), e("span", { children: U }), T && e("button", { "aria-label": `Drag ${U} to reorder`, className: "ul-card-rank__drag-btn", onTouchEnd: S ? R : void 0, onTouchMove: S ? C : void 0, onTouchStart: S ? g(O) : void 0, title: "Drag to reorder", type: "button", children: e("svg", { fill: "none", height: "17", viewBox: "0 0 16 17", width: "16", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z", fill: "currentColor" }) }) })] }, I);
1182
+ var K, me;
1183
+ }) }), e("div", { className: "ul-card-rank__labels", children: e("span", { children: [F, " - ", Q] }) })] }), a && e(dn, { handleSubmit: L, isSubmitDisabled: u })] }), e(pe, { children: e("div", { className: "ul-card__button-wrapper", children: e(le, { disabled: u, children: de(r) }) }) })] }) }) }, i);
1184
+ }, $e = 1, fn = 2, yn = 3, _e = (n) => n.type === "av_permission", rn = (n) => n.type === "screen_permission", Cn = (n, o) => n === void 0 ? $e : n ? ((t, r) => !(_e(r) ? r.permissionDescriptors : []).includes("camera") || t.getVideoTracks().length > 0)(n, o) ? yn : $e : fn, on = { avStream: null, currentPage: null, mediaRecordingUids: null, nextQuestion: () => {
1185
+ }, passthroughData: void 0, recordingMediaTypes: void 0, screenPermissionRequested: !1, type: void 0 }, oe = Tn((n) => ({ ...on, reset: () => {
1186
+ n(on);
1187
+ }, updatePage: (o) => {
1188
+ n(o);
1189
+ } }));
1190
+ function Ve({ currentPage: n, pages: o }) {
1191
+ const { avStream: t, recordingMediaTypes: r, updatePage: i } = oe.getState(), { recorderEventEmitter: s } = $.getState();
1192
+ s.emit("av.permission", { "permission.descriptors": n.permissionDescriptors, "stream.ready": (l, v) => {
1193
+ if (t === l) return;
1194
+ let a = n;
1195
+ if (l && !n.permissionDescriptors.includes("camera")) {
1196
+ const c = o.indexOf(n), b = v != null && v.active ? c + 2 : c + 1;
1197
+ v != null && v.active && r && s.emit("begin.recording", { "recording.media.types": r, "start.recording.callback": (d) => i({ mediaRecordingUids: d }) }), a = o[b];
1198
+ }
1199
+ i({ currentPage: a, avStream: l });
1200
+ } });
1201
+ }
1202
+ function Fe({ status: n }) {
1203
+ const { nextQuestion: o, passthroughData: t, mediaRecordingUids: r, reset: i } = oe.getState(), { recorderEventEmitter: s, handleUploadUpdate: l, index: v } = $.getState(), a = { value: { taskStatus: n }, type: "recordedtask", questionId: (t == null ? void 0 : t.questionId) || 1 };
1204
+ t && s.emit("finish.task", { "begin.callback": (c) => {
1205
+ l({ mediaRecordingUid: c, isSubmitted: !0, progressPct: 0, isComplete: !1 });
1206
+ }, "progress.callback": (c, b) => {
1207
+ l({ mediaRecordingUid: c, progressPct: b.detail, isSubmitted: !1, isComplete: !1 });
1208
+ }, "upload.callback": (c) => {
1209
+ c && l({ mediaRecordingUid: c, isComplete: !0, isSubmitted: !0, progressPct: 100 });
1210
+ }, "passthrough.data": t, "current.index": v, "task.response": a, "task.complete.callback": (c) => {
1211
+ a.value.taskDurationMillisecond = c, r && (a.value.mediaRecordingUids = r), i(), o(a);
1212
+ } });
1213
+ }
1214
+ function Ye({ pages: n, setIsRequestingPermission: o }) {
1215
+ const { recorderEventEmitter: t, eventEmitFn: r } = $.getState(), { updatePage: i, currentPage: s, recordingMediaTypes: l, screenPermissionRequested: v } = oe.getState();
1216
+ if (!s) return;
1217
+ const a = n.indexOf(s);
1218
+ switch (s.type) {
1219
+ case "av_permission": {
1220
+ const c = v ? a + 2 : a + 1;
1221
+ return v && l && t.emit("begin.recording", { "recording.media.types": l, "start.recording.callback": (b) => {
1222
+ i({ mediaRecordingUids: b });
1223
+ } }), void i({ currentPage: n[c] });
1224
+ }
1225
+ case "screen_permission":
1226
+ return void t.emit("screen.permission", { "screen.permission.requested": o, "stream.ready.callback": (c, b) => {
1227
+ const d = b ? n[a + 1] : s;
1228
+ b && l && t.emit("begin.recording", { "recording.media.types": l, "start.recording.callback": (f) => {
1229
+ i({ captureStream: b, mediaRecordingUids: f });
1230
+ } }), i({ currentPage: d, screenPermissionRequested: !0, captureStream: b });
1231
+ } });
1232
+ case "start_task":
1233
+ return r("recorded.task.start"), t.emit("recorded.task.start"), t.emit("start.task"), void i({ currentPage: n[a + 1], screenPermissionRequested: !0 });
1234
+ case "complete_task":
1235
+ return;
1236
+ }
1237
+ }
1238
+ const xn = "ul-permission-graphics-container", wn = "ul-permission-body", kn = B(xn, "ul_recorded-task-inset-spacing"), Re = B("ul-horizontal-button-container", "ul-horizontal-button-container-left"), En = ({ richTextBody: n }) => e("div", { className: "ul-rich-text-body", dangerouslySetInnerHTML: { __html: n }, id: "ul-task-detail-container" }), Pe = ({ required: n, skipButtonText: o, bottom: t = !1 }) => n ? null : e(le, { className: B(t && "ul-skip-button-below", "ul-button-inactive"), onClick: Fe.bind(null, { status: "abandoned" }), children: o || "Skip" }), Ke = (n) => {
1239
+ const { avStream: o, captureStream: t, recordingMediaTypes: r, updatePage: i } = oe.getState(), s = (r == null ? void 0 : r.includes("audio")) || (r == null ? void 0 : r.includes("video"));
1240
+ re(() => {
1241
+ const l = setInterval(() => {
1242
+ s && o && !o.active ? i({ avStream: null, currentPage: n[0] }) : t && t.active || i({ captureStream: void 0, currentPage: n[s ? 1 : 0] });
1243
+ }, 1e3);
1244
+ return () => clearInterval(l);
1245
+ }, [o, t, s, n, r, i]);
1246
+ }, ot = ({ content: n, pages: o, required: t }) => {
1247
+ const { buttonText: r, skipButtonText: i, taskDetail: s } = n;
1248
+ return Ke(o), e("div", { className: "ul-task-page", children: [s && e(En, { richTextBody: s }), e("div", { className: Re, children: [e(le, { onClick: Ye.bind(null, { pages: o }), children: r }), e(Pe, { required: t, skipButtonText: i })] })] }, "start-task");
1249
+ }, it = ({ content: n, pages: o, properties: t }) => {
1250
+ const { buttonText: r, skipButtonText: i } = n;
1251
+ Ke(o);
1252
+ const s = e(ie, { properties: t, defaultBody: () => e("div", { className: Re, children: [e(le, { className: "ul-complete-task-button", onClick: Fe.bind(null, { status: "completed" }), children: r }), e(le, { className: B("ul-button-inactive"), onClick: Fe.bind(null, { status: "given.up" }), children: i })] }) });
1253
+ return e("div", { className: "ul-task-page", children: [n.taskDetail && e(En, { richTextBody: n.taskDetail }), s] }, "complete-task");
1254
+ }, st = ({ content: n, pages: o, required: t }) => {
1255
+ const { buttonText: r, skipButtonText: i } = n, [s] = $((a) => [a.tabTitle]), [l, v] = V(!1);
1256
+ return e("div", { children: [e("div", { className: kn, children: [e("p", { style: { marginTop: "auto" }, children: n.selectTabText }), e("div", { className: "ul-select-tab-container", children: e("p", { className: wn, children: s }) })] }), e("div", { className: t ? "" : Re, children: [e(le, { disabled: l, onClick: Ye.bind(null, { pages: o, setIsRequestingPermission: v }), children: r }), e(Pe, { required: t, skipButtonText: i })] })] });
1257
+ }, at = ({ content: n }) => e("div", { className: B(xn, "ul_permission_svg_container", "ul_recorded-task-inset-spacing", "ul-center-horizontally"), dangerouslySetInnerHTML: { __html: n.svg } }, "ul-permission-request-graphic"), lt = ({ content: n, pages: o, required: t }) => {
1258
+ const { permissionDeniedHeadline: r, permissionDeniedBody: i, skipButtonText: s, tryAgainButtonText: l } = n, v = _e(o[0]) ? o[0] : null;
1259
+ return re(() => {
1260
+ const a = setInterval(() => {
1261
+ v !== null && Ve({ currentPage: v, pages: o });
1262
+ }, 1e3);
1263
+ return () => clearInterval(a);
1264
+ }, [v, o]), v ? e("div", { children: [e("div", { className: kn, children: e("p", { className: "ul-av-permission-denied-paragraph", children: [e("span", { className: "ul-av-permission-denied-headline", children: r }), e("span", { className: wn, children: i })] }) }), e("div", { className: Re, children: [e(le, { onClick: Ve.bind(null, { currentPage: v, pages: o }), children: l }), e(Pe, { required: t, skipButtonText: s })] })] }) : null;
1265
+ }, dt = ({ stream: n }) => e("video", { autoPlay: !0, className: B("ul_recorded-task-inset-spacing"), id: "ul-record-task-video-preview", muted: !0, ref: (o) => {
1266
+ o && (o.srcObject = n || null);
1267
+ } }), ct = ({ content: n, pages: o, required: t }) => {
1268
+ const { skipButtonText: r } = n, { avStream: i } = oe.getState();
1269
+ return Ke(o), e("div", { children: [e(dt, { stream: i }), e("div", { className: "ul-vertical-button-container-center", children: [e(le, { onClick: Ye.bind(null, { pages: o }), children: n.buttonText }), e(Pe, { bottom: !0, required: t, skipButtonText: r })] })] });
1270
+ }, ut = ({ properties: n }) => {
1271
+ const { pages: o, required: t } = n, { avStream: r, currentPage: i } = oe.getState();
1272
+ if (i === void 0) return null;
1273
+ switch (i == null ? void 0 : i.type) {
1274
+ case "av_permission": {
1275
+ const s = Cn(r, i);
1276
+ return s === $e ? e(at, { content: i }) : e(s === fn ? lt : ct, { content: i, pages: o, required: t });
1277
+ }
1278
+ case "screen_permission":
1279
+ return e(st, { content: i, pages: o, required: t });
1280
+ case "start_task":
1281
+ return e(ot, { content: i, pages: o, required: t });
1282
+ case "complete_task":
1283
+ return e(it, { content: i, pages: o, properties: n });
1284
+ default:
1285
+ return null;
1286
+ }
1287
+ }, pt = ({ className: n, properties: o, next: t, questionId: r }) => {
1288
+ const i = $(), { surveyId: s, responseGroupUid: l, userId: v } = i, a = oe(), { screenPermissionRequested: c } = a, b = oe((u) => u.avStream);
1289
+ let d = oe((u) => u.currentPage);
1290
+ d || (d = function({ pages: u, userId: h, responseGroupUid: k, surveyId: y, questionId: x, next: j }) {
1291
+ const { updatePage: E } = oe.getState(), { eventEmitFn: N, recorderEventEmitter: S } = $.getState(), T = { questionId: x, surveyId: y, visitorId: h, responseGroupUid: k };
1292
+ let L = 0;
1293
+ S.emit("recorded.task.permission.screen"), N("recorded.task.permission.screen"), S.emit("permission.status", { "permission.status.callback": (g, C, R, D) => {
1294
+ const M = u[L], { type: H } = M, q = ["screen"];
1295
+ if (_e(M)) {
1296
+ const { permissionDescriptors: A } = M, Q = A == null ? void 0 : A.includes("microphone"), F = A == null ? void 0 : A.includes("camera");
1297
+ Q && q.push("audio"), F && q.push("video"), (g != null && g.active && !F || g != null && g.active && C) && L++;
1298
+ }
1299
+ rn(u[L]) && R && (L++, S.emit("begin.recording", { "recording.media.types": q, "start.recording.callback": (A) => E({ mediaRecordingUids: A }) })), E({ currentPage: u[L], avStream: g, screenPermissionRequested: R, nextQuestion: j, type: H, passthroughData: T, recordingMediaTypes: q, captureStream: D });
1300
+ } });
1301
+ const p = u[L];
1302
+ return p.type === "av_permission" && Ve({ currentPage: p, pages: u }), p;
1303
+ }({ questionId: r, surveyId: s, next: (u) => {
1304
+ t(u, !0);
1305
+ }, pages: o.pages, responseGroupUid: l, userId: v }));
1306
+ let f = d.headline, w = d.captionText;
1307
+ const m = Cn(b, d);
1308
+ return rn(d) && c && (f = d.permissionDeniedHeadline, w = d.permissionDeniedCaptionText), _e(d) && m === yn && (f = d.permissionGrantedHeadline, w = d.permissionGrantedCaptionText), e("div", { className: B(n, "ul-center-horizontally", "fade-in-transition"), children: [e(Qe, { message: f, properties: { captionText: w } }), e(ve, { children: e(ut, { properties: o }) })] });
1309
+ }, vt = ({ className: n, next: o, properties: t, questionId: r, type: i }) => {
1310
+ const { visitorAttributes: s, isLongFormSurvey: l } = $((d) => ({ visitorAttributes: d.visitorAttributes, isLongFormSurvey: De(d.studyType) })), v = (d, f = !1) => {
1311
+ o({ value: f ? { skipped: !0 } : void 0, questionId: r, type: i }, !0);
1312
+ }, a = (d) => {
1313
+ d.key !== "Enter" && d.key !== " " || o({ value: void 0, questionId: r, type: i }, !0);
1314
+ }, c = Mn(t && t.buttonUrl, s), b = l && t.promptActionType === Nn.NO_BUTTON ? () => e(ce, {}) : () => e("div", { children: e("div", { className: "ul-card-button-group", children: [e("a", { className: "ul-card-text__button ul-card__text-url-prompt-button", href: c, id: "ul-card-text__button", onClick: v, onKeyPress: a, rel: "noreferrer", role: c ? "link" : "button", tabIndex: 0, target: "_blank", children: de(t) }), t.required === !1 && e("button", { className: "ul-card-skip__button", onClick: (d) => v(0, !0), children: ze(t) })] }) });
1315
+ return e("div", { className: B(n, "ul-card__text-url-prompt", "fade-in-transition"), children: e(ie, { defaultBody: b, properties: t }) }, r);
1316
+ }, mt = ({ className: n, questionId: o }) => {
1317
+ const { border: t, destroy: r, endCard: i, forceBrandedLogo: s } = $((a) => ({ border: a.border, destroy: a.destroy, endCard: a.endCard, forceBrandedLogo: a.forceBrandedLogo }));
1318
+ re(() => {
1319
+ setTimeout(() => {
1320
+ r(Ze);
1321
+ }, s ? 4e3 : 2e3);
1322
+ }, [r, s]);
1323
+ const l = i && i.subheader ? e("p", { className: "ul-caption", children: i.subheader }) : null, v = i && i.headline ? i.headline : "";
1324
+ return e("div", { className: B(n, "ul-card--thanks", "fade-in-transition"), children: e("div", { children: e("div", { className: "ul-card--thanks-content", children: [e("div", { className: "ul-thanks-check", children: e("svg", { "aria-labelledby": "title", fill: "none", height: "99", viewBox: "0 0 81 99", width: "81", xmlns: "http://www.w3.org/2000/svg", children: [e("path", { clipRule: "evenodd", d: "M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z", fill: t, fillRule: "evenodd" }), e("path", { clipRule: "evenodd", d: "M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z", fill: t, fillRule: "evenodd" }), e("path", { d: "M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z", fill: "black", fillOpacity: "0.2" })] }) }), e(Qe, { message: v }), l] }) }) }, o);
1325
+ }, gt = () => e("div", { className: "thinking-dots-container", children: e("div", { className: "thinking-dot" }) }), ht = ({ className: n }) => {
1326
+ const { uploadProgress: o } = $((s) => ({ uploadProgress: s.uploadProgress }));
1327
+ let t, r;
1328
+ 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.");
1329
+ const i = Math.round(Math.min(99, ...Object.values(o).filter((s) => s.isSubmitted).map((s) => s.progressPct || 0)));
1330
+ return e("div", { className: B(n, "ul-card--uploading", "fade-in-transition"), children: [e("div", { "aria-busy": "true", "aria-label": "Processing...", "aria-live": "polite", className: "ul-loading-spinner-container", role: "progressbar", children: e("div", { className: "ul-loading-spinner", children: [e("div", { className: "first" }), e("div", { className: "second" }), e("div", { className: "third" }), e("div", { className: "fourth" })] }) }), e(Qe, { message: `${t} (${i}% complete)` }), e("p", { className: "ul-caption", children: r })] });
1331
+ }, sn = 0, an = 1, bt = ({ className: n, next: o, properties: t, questionId: r, type: i }) => {
1332
+ const s = `ul-card-video__player_recorder-q${r}`, { apiURL: l, envId: v, handleUploadUpdate: a, headers: c, responseGroupUid: b, surveyId: d, update: f, viewDocument: w, visitorId: m } = $((p) => ({ apiURL: p.apiURL, envId: p.envId, handleUploadUpdate: p.handleUploadUpdate, headers: p.headers, responseGroupUid: p.responseGroupUid, surveyId: p.surveyId, update: p.update, viewDocument: p.viewDocument, visitorId: p.userId })), [u, h] = V(!1), [k, y] = V(null), [x, j] = V(null), [E, N] = V(sn), S = X(null);
1333
+ re(() => {
1334
+ const p = S.current, g = new ResizeObserver(() => {
1335
+ f();
1336
+ });
1337
+ return p && g.observe(p), () => {
1338
+ p && g.unobserve(p);
1339
+ };
1340
+ }, [f]);
1341
+ const T = (p, g) => {
1342
+ p === P.UPLOAD_STARTED ? (y(g[P.UPLOAD_ID]), j(g[P.MEDIA_RECORDING_UID]), h(!0)) : p === P.DELETE ? (y(null), j(null), h(!1)) : p === P.UPLOAD_PROGRESS ? isNaN(g[P.UPLOAD_PROGRESS_PCT]) ? a({ mediaRecordingUid: g[P.MEDIA_RECORDING_UID], isComplete: !0 }) : a({ mediaRecordingUid: g[P.MEDIA_RECORDING_UID], progressPct: g[P.UPLOAD_PROGRESS_PCT] }) : p === P.UPLOAD_FINISHED && a({ mediaRecordingUid: g[P.MEDIA_RECORDING_UID], isComplete: !0 });
1343
+ }, L = (p) => {
1344
+ p.preventDefault(), p.stopPropagation(), document.getElementById(s) && ((g) => {
1345
+ const C = g + en;
1346
+ if (_.document.getElementById(C) && _.videojs) {
1347
+ try {
1348
+ if (!_.videojs(C).record().stream) return;
1349
+ } catch {
1350
+ return;
1351
+ }
1352
+ _.videojs(C).record().stop(), _.videojs(C).record().stopDevice();
1353
+ }
1354
+ })(s), k && x ? (a({ mediaRecordingUid: x, isSubmitted: !0 }), o({ value: { mediaRecordingUid: x }, questionId: r, type: i }, !0)) : o({ value: null, questionId: r, type: i }, !0);
1355
+ };
1356
+ return e("form", { className: B(n, "ul-card--video", "fade-in-transition"), id: "ul-video-interview-form", children: [e(ve, { children: [e("div", { id: "ul-question-player-container", ref: S, style: { display: E === sn ? "" : "none" }, children: e(ie, { defaultBody: () => e("button", { className: "ul-video-btn ul-record-response-btn", onClick: (p) => {
1357
+ p.preventDefault(), p.stopPropagation(), document.getElementById(s) && ((g) => {
1358
+ const C = Te(g + un);
1359
+ C == null || C.pause();
1360
+ })(s), N(an);
1361
+ } }), properties: t }) }), e("div", { style: { display: E === an ? "block" : "none" }, children: e("div", { id: "ul-recorder-player-container", ref: (p) => {
1362
+ if (p && p.children.length === 0) {
1363
+ const g = ((C, R = {}, D = "https://api.userleap.com", M, H, q, A = !1, Q = document) => {
1364
+ _.document = Q;
1365
+ const F = C + en, Y = hn(F);
1366
+ return _.document.addEventListener("securitypolicyviolation", (ne) => {
1367
+ ae(new Error(`Voice & Video feature violates ${ne.violatedDirective} web page CSP policies for the recorder player.`), "recorderDeviceError", D, q, R.visitorId, R.envId);
1368
+ }), pn(cn.concat(Bn), () => {
1369
+ He(F, Y), _.document.getElementById(We(F)).remove();
1370
+ try {
1371
+ Un(Y, F, R, D, M, H, q, A);
1372
+ } catch (ne) {
1373
+ return void ae(new Error(`Error when creating video recorder player object ${ne}`), "recorderDeviceError", D, q, R.visitorId, R.envId);
1374
+ }
1375
+ }), Y;
1376
+ })(s, { surveyId: d, responseGroupUid: b, questionId: r, visitorId: m, envId: v }, l, T, void 0, { ...c, "x-ul-video-recorder-origin": "sdk" }, t.mediaType === P.MEDIA_TYPE_AUDIO, w);
1377
+ p.appendChild(g);
1378
+ }
1379
+ } }) })] }), e(pe, { children: [e(be, { isDisabled: !!t.required && !u, onClick: L, children: de(t) }), e("button", { className: "ul-card-text__button ul-button-inactive ul-card-skip__button", id: "ul-card-video__skip_button", onClick: L, style: { ...t.required ? { display: "none" } : {}, ...u ? { display: "none" } : {} }, children: ze(t) })] })] });
1380
+ }, jn = (n) => n.type === "thanks" || n.type === "uploading", ft = ({ card: n, avatars: o, isThinking: t, isCurrentQuestion: r, currentQuestionBubbleRef: i }) => {
1381
+ const s = ((l) => "properties" in l.props && l.props.properties && "questionHtml" in l.props.properties && l.props.properties.questionHtml ? { content: l.props.properties.questionHtml, isHtml: !0 } : "message" in l.props ? { content: l.props.message, isHtml: !1 } : { content: "Question", isHtml: !1 })(n);
1382
+ return e(ye, { avatars: o, isLeft: !0, message: { id: `question-${n.name}`, type: "question", content: s.content }, ref: r ? i : null, children: t ? e(gt, {}) : e(ce, { children: [s.isHtml ? e("div", { className: "chat-message-text", dangerouslySetInnerHTML: { __html: s.content } }) : e("div", { className: "chat-message-text", children: s.content }), n.type === "videovoice" && e($n, { properties: n.props, questionId: n.name, surveyVideoUrl: n.props.properties.videoUrl })] }) });
1383
+ }, yt = ({ card: n, avatars: o }) => {
1384
+ const t = ((r) => {
1385
+ if (!("properties" in r.props) || !r.props.properties || typeof r.props.properties != "object") return null;
1386
+ const i = r.props.properties, s = [{ key: "captionHtml", isHtml: !0 }, { key: "captionText", isHtml: !1 }, { key: "richTextBody", isHtml: !0 }, { key: "body", isHtml: !1 }];
1387
+ for (const { key: l, isHtml: v } of s) {
1388
+ const a = i[l];
1389
+ if (typeof a == "string") {
1390
+ const c = a.trim();
1391
+ if (c) return { content: c, isHtml: v };
1392
+ }
1393
+ }
1394
+ return null;
1395
+ })(n);
1396
+ return t ? e(ye, { avatars: o, hideAvatar: !0, isLeft: !0, message: { id: `caption-${n.name}`, type: "question", content: t.content }, children: t.isHtml ? e("div", { className: "chat-message-text", dangerouslySetInnerHTML: { __html: t.content } }) : e("div", { className: "chat-message-text", children: t.content }) }) : null;
1397
+ }, Ct = ({ card: n, userResponse: o, avatars: t }) => {
1398
+ const r = ((i, s) => {
1399
+ if (i.type === "open" && s && typeof s == "object" && "value" in s) return s.value;
1400
+ })(n, o);
1401
+ return e("div", { className: "chat-bubble-container chat-right", children: [e("div", { className: "chat-bubble chat-bubble-right chat-bubble-text-only", children: e("div", { className: "chat-message-text", children: r || e("div", { className: "chat-message-no-response", children: "No response" }) }) }), e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${t.respondentAvatar["1x"]} 1x, ${t.respondentAvatar["2x"]} 2x` })] });
1402
+ }, xt = ({ card: n, avatars: o, isCurrentQuestion: t, currentQuestionBubbleRef: r }) => {
1403
+ const { endCard: i } = $((s) => ({ endCard: s.endCard }));
1404
+ return e(ce, { children: [e(ye, { avatars: o, isLeft: !0, message: { id: `thanks-${n.name}`, type: "question", content: (i == null ? void 0 : i.headline) ?? "Great! Thank you for your participation." }, ref: t ? r : null }), (i == null ? void 0 : i.subheader) && e(ye, { avatars: o, hideAvatar: !0, isLeft: !0, message: { id: `caption-${n.name}`, type: "question", content: i.subheader } }), e(Fn, {})] });
1405
+ }, wt = ({ card: n, cardIndex: o, index: t, avatars: r, cardResponses: i, questionThinkingStates: s, startingQuestionIdx: l, currentQuestionBubbleRef: v, handleCardResponse: a }) => {
1406
+ const c = o === t, b = o < t, d = jn(n);
1407
+ if (d) return e(xt, { avatars: r, card: n, currentQuestionBubbleRef: v, isCurrentQuestion: c });
1408
+ const f = `${n.name}`, w = i.get(f), m = n.type === "open", u = s.get(f), h = o > (l ?? 0) && n.type !== "thanks" && n.type !== "uploading" && (u === !0 || u === void 0);
1409
+ return e(ln.Fragment, { children: [e(ft, { avatars: r, card: n, currentQuestionBubbleRef: v, isCurrentQuestion: c, isThinking: h }), !h && e(yt, { avatars: r, card: n }), b && m ? e(Ct, { avatars: r, card: n, userResponse: w }) : (!b || !m) && !h && e(ye, { avatars: r, isLeft: !1, message: { id: `card-${n.name}`, type: "card", content: "" }, children: e("div", { className: "chat-card-container", children: e(Et, { card: n, className: d ? "chat-thanks-card" : "chat-card", isAnswered: b, next: c ? a : () => {
1410
+ } }) }) })] }, `question-card-${n.name}`);
1411
+ }, ye = ln.forwardRef(({ message: n, isLeft: o = !1, children: t, avatars: r, hideAvatar: i = !1 }, s) => {
1412
+ const l = o ? "chat-bubble-left" : "chat-bubble-right";
1413
+ return e("div", { className: `chat-bubble-container ${o ? "chat-left" : "chat-right"}${o && i ? " chat-no-avatar" : ""}`, ref: s, children: [o && !i && e("img", { alt: "AI Avatar", className: "chat-avatar chat-avatar-left", srcSet: `${r.agentAvatar["1x"]} 1x, ${r.agentAvatar["2x"]} 2x` }), e("div", { className: `chat-bubble ${l}`, children: t || e("div", { className: "chat-message-text", children: n.content }) }), !o && !i && e("img", { alt: "User Avatar", className: "chat-avatar chat-avatar-right", srcSet: `${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x` })] });
1414
+ });
1415
+ ye.displayName = "ChatBubble";
1416
+ const kt = () => {
1417
+ const n = $((t) => t.close), o = Se(() => () => n(Ze), [n]);
1418
+ return e("div", { "aria-label": "Close button", className: "conversational-close-btn", onClick: o, onKeyPress: (t) => {
1419
+ t.key === "Enter" && o();
1420
+ }, role: "button", tabIndex: 0, children: e("svg", { fill: "none", height: "16px", viewBox: "0 0 13 13", width: "16px", xmlns: "http://www.w3.org/2000/svg", children: e("path", { d: "M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z", fill: "#262136" }) }) });
1421
+ }, Et = ({ card: n, next: o, className: t = "", isAnswered: r = !1 }) => {
1422
+ const i = { className: r ? `${t} answered-card` : t, next: r ? () => {
1423
+ } : o, questionId: n.name, type: n.type, isAnswered: r };
1424
+ switch (n.type) {
1425
+ case "consentlegal":
1426
+ return e(Vn, { ...i, ...n.props });
1427
+ case "likert":
1428
+ return e(Zn, { ...i, ...n.props });
1429
+ case "matrix":
1430
+ return e(Jn, { ...i, ...n.props });
1431
+ case "multiplechoice":
1432
+ return e(Xn, { ...i, ...n.props });
1433
+ case "multipleselect":
1434
+ return e(et, { ...i, ...n.props });
1435
+ case "nps":
1436
+ return e(nt, { ...i, ...n.props });
1437
+ case "open":
1438
+ return e(tt, { ...i, ...n.props });
1439
+ case "rankorder":
1440
+ return e(rt, { ...i, ...n.props });
1441
+ case "recordedtask":
1442
+ return e(pt, { ...i, ...n.props });
1443
+ case "texturlprompt":
1444
+ return e(vt, { ...i, ...n.props });
1445
+ case "thanks":
1446
+ return e(mt, { ...i, ...n.props });
1447
+ case "uploading":
1448
+ return e(ht, { ...i, ...n.props });
1449
+ case "videovoice":
1450
+ return e(bt, { ...i, ...n.props });
1451
+ default:
1452
+ return null;
1453
+ }
1454
+ }, _t = ({ cards: n, next: o, previousResponses: t }) => {
1455
+ const { messagesContainerRef: r, currentQuestionBubbleRef: i, scrollToCurrentQuestion: s } = (() => {
1456
+ const y = X(null), x = X(null), j = we(() => {
1457
+ if (x.current && y.current) {
1458
+ const E = y.current, N = x.current.offsetTop - E.offsetTop - 16;
1459
+ E.scrollTo({ top: Math.max(0, N), behavior: "smooth" });
1460
+ }
1461
+ }, []);
1462
+ return { messagesContainerRef: y, currentQuestionBubbleRef: x, scrollToCurrentQuestion: j };
1463
+ })(), { cardResponses: l, setCardResponse: v } = (() => {
1464
+ const [y, x] = V(/* @__PURE__ */ new Map());
1465
+ return { cardResponses: y, setCardResponse: we((j, E) => {
1466
+ x((N) => new Map(N).set(j, E));
1467
+ }, []) };
1468
+ })(), { index: a, isLongFormSurvey: c, avatars: b, startingQuestionIdx: d } = $((y) => ({ index: y.index, isLongFormSurvey: De(y.studyType), avatars: y.avatars, startingQuestionIdx: y.startingQuestionIdx })), f = ((y, x, j) => {
1469
+ const [E, N] = V(/* @__PURE__ */ new Map());
1470
+ return re(() => {
1471
+ if (y.length > 0 && x < y.length) {
1472
+ const S = y[x], T = `${S.name}`;
1473
+ if (x <= (j ?? 0) || jn(S)) return void N((p) => new Map(p).set(T, !1));
1474
+ N((p) => new Map(p).set(T, !0));
1475
+ const L = setTimeout(() => {
1476
+ N((p) => new Map(p).set(T, !1));
1477
+ }, 1e3);
1478
+ return () => clearTimeout(L);
1479
+ }
1480
+ }, [x, y, j]), E;
1481
+ })(n, a, d), w = ((y, x) => {
1482
+ const [j, E] = V(/* @__PURE__ */ new Set([0]));
1483
+ return re(() => {
1484
+ E((N) => new Set(N).add(y));
1485
+ }, [y]), re(() => {
1486
+ const N = x ?? 0;
1487
+ N > 0 && E((S) => {
1488
+ const T = new Set(S);
1489
+ for (let L = 0; L <= N; L++) T.add(L);
1490
+ return T;
1491
+ });
1492
+ }, [x]), j;
1493
+ })(a, d), m = Se(() => ({ ...t, ..._n(n.map((y, x) => {
1494
+ var j, E;
1495
+ return { ...y, value: x < a ? ((j = l.get(`${y.name}`)) == null ? void 0 : j.value) ?? null : null, secondaryValue: x < a ? ((E = l.get(`${y.name}`)) == null ? void 0 : E.secondaryValue) ?? null : null };
1496
+ })) }), [t, l, n, a]), u = Sn(n, m);
1497
+ re(() => {
1498
+ requestAnimationFrame(() => {
1499
+ s();
1500
+ });
1501
+ }, [a, s, f]);
1502
+ const h = we((y, x) => {
1503
+ if (!x) return;
1504
+ const j = u[a];
1505
+ if (!j) return;
1506
+ const E = `${j.name}`;
1507
+ v(E, y), o([y]);
1508
+ }, [u, a, o, v]), k = u.map((y, x) => ({ card: y, cardIndex: x })).filter(({ cardIndex: y }) => w.has(y));
1509
+ return e("div", { className: "conversational-ui ul-conversational-ui", children: [!c && e(kt, {}), e("div", { className: "chat-container", ref: r, children: e("div", { className: "chat-messages", children: k.map(({ card: y, cardIndex: x }) => e(wt, { avatars: b, card: y, cardIndex: x, cardResponses: l, currentQuestionBubbleRef: i, handleCardResponse: h, index: a, questionThinkingStates: f, startingQuestionIdx: d }, `question-card-${y.name}`)) }) })] });
1510
+ };
1511
+ export {
1512
+ _t as default
1513
+ };