@sprig-technologies/sprig-bundled 2.43.0 → 2.44.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./view-s39eJCD9.cjs"),Y=require("./index-B2lKZafM.cjs"),E=require("./getAttributedUrl-CkFVhnm0.cjs"),re="https://cdn.sprig.com",_={document:void 0,videojs:void 0},xe=n=>n+"-loading-spiner",Z="hidden",je=".m3u8",me="questionId",ve="ul-video-recorder-camera-off-button",ge="ul-recording-in-session",Ye=[{type:"link",content:`${re}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${re}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${re}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${re}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${re}/userleap-web-upchunk-v2.2.2.js`}],Le=[{type:"link",content:`${re}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${re}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:`/* progress control styles */
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./view-AjjMeNkz.cjs"),W=require("./index-BmZLh0D5.cjs"),E=require("./getAttributedUrl-hV9sdUhw.cjs"),re="https://cdn.sprig.com",_={document:void 0,videojs:void 0},we=n=>n+"-loading-spiner",Z="hidden",_e=".m3u8",ve="questionId",ge="ul-video-recorder-camera-off-button",he="ul-recording-in-session",Je=[{type:"link",content:`${re}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${re}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${re}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${re}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${re}/userleap-web-upchunk-v2.2.2.js`}],Ne=[{type:"link",content:`${re}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${re}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:`/* progress control styles */
2
2
  .video-js .vjs-control {
3
3
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
4
4
  }
@@ -655,4 +655,4 @@ span.ul-button-text {
655
655
  .vjs-poster {
656
656
  background-size: cover;
657
657
  }
658
- `}],Me="-video-player",Te="-secondary-video-player",_e="-video-recorder";let X,Ie;const te=async({event:n,apiBase:o,headers:t,visitorId:r,envId:i,metadata:s})=>{const d=_.document.documentElement;if(!r||!i)return;const u={event:`SDK - ${n}`,visitorId:r,environmentId:i,metadata:{...s||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:d.clientWidth,clientHeight:d.clientHeight,location:window.location.href,language:navigator.language}};(await fetch(`${o}/sdk/1/visitors/${r}/analytics`,{method:"POST",cache:"no-cache",headers:t,body:JSON.stringify(u)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",n)},ne=async(n,o,t,r,i,s)=>{te({event:`Video Error ${o}`,apiBase:t,headers:r,visitorId:i,envId:s,metadata:{errorMessage:n.message}});const d=_.document.documentElement,u={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:d.clientWidth,clientHeight:d.clientHeight,location:window.location.href,language:navigator.language},a={action:o,err:{message:n.message,stack:n.stack},meta:u,vid:i,envId:s};(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)},Ne=(n,o)=>{if(n.length===0)return o&&o();Promise.all(n.reduce((t,r)=>(t.push(((i,{type:s,content:d})=>new Promise(function(u,a){let m;s==="script"?(m=_.document.createElement("script"),m.src=d):s==="link"?(m=_.document.createElement("link"),m.rel="stylesheet",m.href=d,m.type="text/css"):(m=_.document.createElement("style"),m.innerHTML=d),m.onload=function(){u(d)},m.onerror=function(){a(d)},m.async=!1,m.id=btoa(d),i.appendChild(m)}))(_.document.head,r)),t),[])).then(()=>{_.videojs=_.document.defaultView.videojs,o&&o()}).catch(function(t){console.log(t+" failed to load")})},De=(n,o,t)=>{if(o==="start"&&(n.style.visibility="visible"),o==="none")n.style.visibility=Z;else if(o==="success")n.style.visibility=Z,n.innerHTML="Upload succeeded!";else{const r=Math.round(parseFloat(t));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%)`}},he=(n,o)=>{const t=_.videojs(n.id());return t==null?void 0:t.payload[o]},Oe=(n,o)=>{const t=new(_.videojs.getComponent("Component"))(n);return t.addClass("ul-buttons-panel"),o.map(r=>{t.addChild(r)}),Ke(t),t},Ke=n=>{n.children().forEach(o=>{if(J[o.name_]){const t=le(J[o.name_],`ul-${J[o.name_]}`);o.el_.appendChild(t)}})},le=(n,o="")=>{const t=_.document.createElement("span");return t.className="ul-button-text",t.innerHTML=n,t.id=o,t},qe=(n,o,t,r,i=!1,s)=>{n.addClass("ul-video-player");const d=new(_.videojs.getComponent("Component"))(n);d.addClass("ul-control-panel"),n.progressBar=d.addChild("ProgressControl"),t&&n.src(t),n.audioPlayerPlaceholder=new(_.videojs.getComponent("Component"))(n),n.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const u=t&&t.src?nn(t.src):null;!t||!i&&u?(n.audioPlayerPlaceholder.hide(),_.document.getElementById(`${n.id()}_html5_api`).style.height="100%",u&&n.poster(u)):(n.children()[0].classList.add("vjs-hidden"),_.document.getElementById(`${n.id()}_html5_api`).style.height="0px"),n.on("play",()=>{i||!t||u||Xe(n),s==null||s.play()}),n.on("pause",()=>{s==null||s.pause()}),n.on("seeked",()=>{s==null||s.currentTime(n.currentTime())}),n.on("ratechange",()=>{s==null||s.playbackRate(n.playbackRate())}),n.addChild(n.audioPlayerPlaceholder,{},1),d.addChild(o),n.addChild(d),r&&r(n)},Je=(n,o,t,r,i,s,d,u=!1)=>{Ie=Date.now();const a=de(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}}});if(!a)return;a.payload=t;const{surveyId:m,questionId:y,responseGroupUid:c,visitorId:g,envId:k}=t;let C;const h=l=>{const p=ve,x=ve+"-audio-only";De(a.uploadProgressLabel,"none"),X&&X.startTime>=Ie&&X.abort();const S=_.document.getElementById("ul-camera-button");l?(a.children()[0].classList.add("vjs-hidden"),N.removeClass(p),N.addClass(x),S.innerHTML=J.TurnOnCamera,a.audioPlayerPlaceholder.removeClass("vjs-hidden"),C==null||C.getTracks().forEach(T=>{T.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(T=>{C=T,T.getVideoTracks().forEach(O=>{O.enabled=!1}),a.record().onDeviceReady(T)}).catch(a.record().onDeviceError.bind(a.record()))):(C==null||C.getVideoTracks().forEach(T=>{T.enabled=!0}),a.children()[0].classList.remove("vjs-hidden"),a.record().getDevice(),N.removeClass(x),N.addClass(p),S.innerHTML=J.TurnOffCamera,a.audioPlayerPlaceholder.addClass("vjs-hidden"))},f=new(_.videojs.getComponent("Button"))(a,{clickHandler:()=>{f.hasClass(Z)||(te({event:"Video Delete Button Clicked",apiBase:r,headers:d,visitorId:g,envId:k,metadata:{questionId:y,responseGroupUid:c,surveyId:m}}),h(a.cameraOff),i(M.DELETE,{}),N.removeClass(Z),f.addClass(Z))}});f.addClass("ul-video-recorder-delete-button"),f.el_.appendChild(le(J.DeleteButton,"ul-delete-button"));const D=_.document.getElementById(o),q=()=>{D.classList.contains("vjs-fullscreen")&&a.cameraOff?D.style.display="table":D.style.display="flex"};q();const N=new(_.videojs.getComponent("Button"))(a,{clickHandler:()=>{a.record().isRecording()||(a.cameraOff=!a.cameraOff,te({event:"Video Camera Button Clicked",apiBase:r,headers:d,visitorId:t.visitorId,envId:t.envId,metadata:{questionId:y,responseGroupUid:c,surveyId:m,cameraOff:a.cameraOff}}),h(a.cameraOff),!f.hasClass(Z)&&f.addClass(Z),i(M.DELETE,{}),q())}});N.addClass(ve),N.el_.appendChild(le(J.TurnOffCamera,"ul-camera-button"));const I=new(_.videojs.getComponent("Button"))(a,{clickHandler:()=>{const l=_.document.getElementById("ul-recorder-toggle");if(a.record().isRecording())a.record().stop(),l&&(l.innerHTML=J.RecordButton),I.removeClass(ge),f.removeClass(Z);else{const p=_.document.getElementById("ul-recording-countdown-screen");if(p)p.remove(),l&&(l.innerHTML=J.RecordButton),h(a.cameraOff),i(M.DELETE,{}),N.removeClass(Z),f.addClass(Z),I.removeClass(ge),v.show();else{I.addClass(ge),v.hide(),N.addClass(Z),f.addClass(Z),l&&(l.innerHTML=J.StopButton);const x=_.document.createElement("div");x.id="ul-recording-countdown-screen",D.insertBefore(x,D.children[1]),x.style.height=`${D.offsetHeight}px`,Ue(a,3)}}}});I.addClass("ul-video-recorder-toggle-button"),I.el_.appendChild(le(J.RecordButton,"ul-recorder-toggle"));const H=_.document.createElement("p");H.style.visibility="hidden",H.className="ul-upload-progress-label",n.appendChild(H),a.uploadProgressLabel=H;const A=Oe(a,[f,N,"PlayToggle",I,"FullscreenToggle"]),v=A.children().find(l=>l.name_==="FullscreenToggle");v.hasClass("vjs-disabled")&&v.hide();const b=A.children().find(l=>l.name_==="PlayToggle");b.hide(),f.addClass(Z),qe(a,A,s,!1,u),a.on("stopRecord",()=>{I.hide(),b.show(),v.show(),f.removeClass(Z)}),a.on("deviceReady",()=>{I.show(),b.hide(),f.addClass(Z)}),((l,p,x,S,T)=>{const{surveyId:O,responseGroupUid:G,visitorId:B,envId:L}=l.payload;l.on("deviceError",function(){console.warn("device error: ",l.deviceErrorCode),l.deviceErrorCode.message==="Permission denied"?(l.deviceButton.addClass("permission-denied"),x&&x(M.ERROR,{type:M.PERMISSION_DENIED}),te({event:"Video Permission Denied",apiBase:p,headers:T,visitorId:B,envId:L,metadata:{questionId:he(l,me),responseGroupUid:G,surveyId:O}})):(x&&x(M.ERROR,{type:M.OTHER}),ne(new Error(l.deviceErrorCode.message),"recorderDeviceError",p,T,B,L))}),l.on("error",function(F,Q){ne(Q||l.error(),"recorderError",p,T,B,L)}),l.on("startRecord",function(F,Q){S(l.uploadProgressLabel,"none"),te({event:"Video Record Start",apiBase:p,headers:T,visitorId:B,envId:L,metadata:{questionId:he(l,me),responseGroupUid:G,surveyId:O}})}),l.on("finishRecord",async function(){S(l.uploadProgressLabel,"start",0);const F=he(l,me);if(!O){const R="internal error: missing fields in payload";return x&&x(M.ERROR,{type:M.OTHER}),ne(new Error(R),"finishRecord",p,T,B,L),null}l.record().stopDevice();const Q=l.cameraOff?M.MEDIA_TYPE_AUDIO:M.MEDIA_TYPE_VIDEO,W=Y.v4();te({event:"Video Record Finish",apiBase:p,headers:T,visitorId:B,envId:L,metadata:{mediaRecordingUid:W,questionId:F,responseGroupUid:G,surveyId:O,mediaType:Q}});const ie={surveyId:O,updatedAt:new Date().toISOString(),mediaType:Q,mediaRecordingUid:W};F&&(ie.questionId=F),G&&(ie.responseGroupUid=G),B&&(ie.visitorId=B);const j=await(async()=>{const R=await fetch(`${p}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)});if(R.ok){const U=await R.json();return x&&x(M.UPLOAD_STARTED,{[M.UPLOAD_ID]:U.upload.id,[M.MEDIA_TYPE]:Q,[M.MEDIA_RECORDING_UID]:W}),U.upload.url}return x&&x(M.ERROR,{type:M.OTHER,response:R}),ne(new Error("failed to get upload response with url"),"finishRecord",p,T,B,L),null})();j&&(X=_.document.defaultView.UpChunk.createUpload({endpoint:j,file:new _.document.defaultView.File([l.recordedData],`recording ${Q} ${Date.now()}`),chunkSize:5120}),X.startTime=Date.now(),te({event:"Video Upload Start",apiBase:p,headers:T,visitorId:B,envId:L,metadata:{mediaRecordingUid:W,questionId:F,responseGroupUid:G,surveyId:O,mediaType:Q,url:j}}),X.on("error",R=>{S(l.uploadProgressLabel,"none"),x&&x(M.UPLOAD_FINISHED,{[M.MEDIA_RECORDING_UID]:W}),ne(R,"finishRecord",p,T,B,L)}),X.on("progress",R=>{x&&x(M.UPLOAD_PROGRESS,{[M.MEDIA_RECORDING_UID]:W,[M.UPLOAD_PROGRESS_PCT]:R.detail}),S(l.uploadProgressLabel,"progress",R.detail)}),X.on("success",()=>{S(l.uploadProgressLabel,"success"),x&&x(M.UPLOAD_FINISHED,{[M.MEDIA_RECORDING_UID]:W}),te({event:"Video Upload Success",apiBase:p,headers:T,visitorId:B,envId:L,metadata:{mediaRecordingUid:W,questionId:F,responseGroupUid:G,surveyId:O,mediaType:Q,url:j,elapsedMs:X.startTime&&Date.now()-X.startTime}})}))})})(a,r,i,De,d);const w=[{name:"microphone"}];!a.cameraOff&&w.push({name:"camera"}),Promise.all(w.map(l=>{var p;return(p=navigator==null?void 0:navigator.permissions)==null?void 0:p.query(l)})).then(l=>{l.reduce((p,x)=>p&x.state==="granted",!0)&&a&&(a.deviceButton&&a.deviceButton.hide(),a.record().getDevice())}).catch(l=>{})},Ue=(n,o=3)=>{const t=_.document.getElementById("ul-recording-countdown-screen");t&&o===0?(t.remove(),n.record().start()):t&&(t.innerHTML=`<span class='ul-countdown-text'>Recording in... ${o}</span>`,setTimeout(()=>{Ue(n,o-1)},1e3))},Ae=n=>{const o=_.document.createElement("div");return o.className="ul-video-container",o.appendChild((t=>{const r=_.document.createElement("div");return r.className="ul-video-player-loading",r.id=xe(t),["first","second","third","fourth"].map(i=>{const s=_.document.createElement("div");s.className=i,r.appendChild(s)}),r})(n)),o},be=(n,o)=>{const t=_.document.createElement("video");t.id=n,t.className="video-js vjs-default-skin ul-video-player-video";const r=_.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const i=_.document.createElement("a");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},Xe=(n,o)=>{n.children()[0].classList.remove("vjs-hidden"),n.audioPlayerPlaceholder.hide(),_.document.getElementById(`${n.id()}_html5_api`).style.height="100%"},de=(n,o)=>_.document.getElementById(n)?o?_.videojs(n,o):_.videojs(n):(console.error(`Error in finding player element with ID, ${n}`),null),en=(n,o,t,r=!1,i="https://api.sprig.com",s=document,d=null,u=null)=>{_.document=s;const a=n+Me,m=Ae(a);return _.document.addEventListener("securitypolicyviolation",y=>{ne(new Error(`Voice & Video feature violates ${y.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),Ne(Le,()=>{_.document.getElementById(xe(a)).remove(),be(a,m);const y={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const c=n+Te;be(c,m);const g=de(a,y),k=de(c,{muted:!0,...y});if(!g||!k)return;((f,D,q)=>{f.addClass(`ul${Te}`);const N=new(_.videojs.getComponent("Component"))(f);D&&f.src(D),f.addChild(N),q&&q(f)})(k,d,u),d||k.addClass(Z);const C=Oe(g,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),h=C.children().find(f=>f.name_==="FullscreenToggle");h.hasClass("vjs-disabled")&&h.hide(),qe(g,C,o,t,r,k)}catch(c){return void ne(new Error(`Error when creating video player object ${c}`),"playerDeviceError",i,{})}}),m},nn=n=>{if(!n)return null;const o=n.match(/https:\/\/stream.mux.com\/(.*)/);let t=o?o[1]:null;return t.includes(je)&&(t=t.replace(je,"")),t?`https://image.mux.com/${t}/thumbnail.jpg?time=0`:null},M={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"},J={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},tn=({properties:n,surveyVideoUrl:o,questionId:t})=>{const r=`ul-card-video__question_player-q${t}`,{apiURL:i,viewDocument:s}=e.useConfig(d=>({apiURL:d.apiURL,viewDocument:d.viewDocument}));return e.u("div",{id:r,ref:d=>{if(d&&d.children.length===0&&!n.properties.hideRecordedPrompt){const u=en(r,{src:o,type:"application/x-mpegURL"},void 0,n.properties.mediaType===M.MEDIA_TYPE_AUDIO,i,s);d.appendChild(u)}}})},oe=({isDisabled:n,onClick:o,children:t})=>e.u(E.Button,{className:"ul-card__button-checkmark",disabled:n,onClick:o,type:"button",children:[e.u("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#ffffff",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),t||"Ok"]}),rn=({className:n,next:o,properties:t,questionId:r,type:i})=>{const{useMobileStyling:s,border:d}=e.useConfig(I=>({useMobileStyling:I.useMobileStyling,border:I.border})),[u,a]=e.h(!1),[m,y]=e.h(""),[c,g]=e.h(!1),k=t==null?void 0:t.collectName,C=(t==null?void 0:t.nameLabelText)||"Full Name",h=(t==null?void 0:t.consentText)||"I agree to the stated conditions",f=(t==null?void 0:t.submitButtonText)||"Submit",D=!!m.trim(),q=u&&(!k||D),N=(I,H=!1)=>{I.preventDefault(),I.stopPropagation();let A=null;if(!H){if(!q)return void g(!0);A={submitted:!0},k&&(A.name=m)}o({value:A,questionId:r,type:i},!!H||q)};return e.u("div",{className:e.cc(n,"ul-card__consent-legal","fade-in-transition"),children:e.u(E.MobileEmbedView,{embeddedType:"pdf",properties:t,children:e.u(E.QuestionBodyFooterContainer,{children:[e.u("div",{className:"sprig-stretch",children:[e.u(E.Option,{allowTextEntry:!1,border:d,error:c&&!u,id:"consent",isRadio:!1,isSelected:u,label:h,onUserInputChanged:({selected:I})=>{I!==u&&a(!u)},useMobileStyling:s}),k&&e.u("input",{"aria-label":C,"aria-placeholder":C,className:e.cc(e.getClasses("ul-consent-legal__name-input",s)),"data-gramm":"false",maxLength:250,name:"name",onBlur:I=>{I.currentTarget.style.borderColor=c&&!D?Y.ERROR_BORDER_COLOR:Y.DEFAULT_BORDER_COLOR},onFocus:I=>{I.currentTarget.style.borderColor=c&&!D?Y.ERROR_BORDER_COLOR:d},onInput:I=>{I.preventDefault(),I.stopPropagation(),y(I.currentTarget.value)},placeholder:C,style:c&&!D?{borderColor:Y.ERROR_BORDER_COLOR}:{},tabIndex:0,value:m})]}),e.u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[e.u(oe,{isDisabled:!q,onClick:I=>N(new SubmitEvent(I.type)),children:e.getButtonText({buttonText:f})}),t.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:I=>N(new SubmitEvent(I.type),!0),children:e.getSkipButtonText(t)})]})]})})},r)},on=()=>{const{destroy:n,forceBrandedLogo:o}=e.useConfig(t=>({destroy:t.destroy,forceBrandedLogo:t.forceBrandedLogo}));return e.p(()=>{setTimeout(()=>{n(Y.APP_ID)},o?4e3:2e3)},[n,o]),e.u("div",{className:"end-of-survey-text",children:"End of survey"})},sn=({activeValue:n,border:o,icon:t,enableCspTrustedTypes:r,isPressed:i,range:s,scaleLabelType:d,selectedValue:u,setSelectedValue:a,setActiveValue:m,setIsPressed:y,useMobileStyling:c,value:g,viewDocument:k})=>{const C=`option-${g}`,h=d==="number",f=d==="star",D=d==="smiley",q=h&&g===n||g===u,[N,I]=(()=>{const v=f&&u!==null&&g<=u;return f&&g<=n||D&&g===n||v||g===n||g===u?[o,i||v||g===u?1:.3]:["",1]})(),H=e.F(()=>{const v={borderColor:q?N:"",fillOpacity:q?"":I,zIndex:q?3:"auto",color:u===g?"#fff":""};return h?{...v,backgroundColor:u===g?N:""}:{...v,color:f||D||u===g?N:""}},[q,N,I,u,g,h,f,D]),A=e.F(()=>Y.getHtml((({icon:v,scaleLabelType:b,value:w,selectedValue:l})=>{if(b==="smiley"&&w===l){let p=0;return v.replace(/black/g,()=>++p==1?"black":"white")}return v})({icon:t,scaleLabelType:d,value:g,selectedValue:u}),r),[r,t,d,u,g]);return e.u("button",{"aria-label":h?void 0:String(g),className:(()=>{switch(d){case"star":return e.cc(e.getClasses("likert-star",c),e.getClasses(`likert-star-${g}`,c));case"smiley":return e.cc(e.getClasses("likert-smiley",c),e.getClasses(`likert-smiley-${g}`,c));default:return g===s?e.cc(e.getClasses("likert-number",c),e.getClasses(`likert-number-${g}`,c),e.getClasses("likert-last-option",c)):e.cc(e.getClasses("likert-number",c),e.getClasses(`likert-number-${g}`,c))}})(),dangerouslySetInnerHTML:{__html:A},id:C,onClick:v=>{v.preventDefault(),v.stopPropagation(),a(g)},onKeyDown:v=>{var l,p;const b=k.querySelectorAll(`.likert-${d??"number"}`),w=g-1;v.key==="ArrowRight"?(l=b[w+1])==null||l.focus():v.key==="ArrowLeft"?(p=b[w-1])==null||p.focus():v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),v.stopPropagation(),a(g))},onPointerDown:()=>y(!0),onPointerEnter:()=>m(g),onPointerLeave:()=>{m(-1),y(!1)},style:H,tabIndex:0})},an=({className:n,labels:o,next:t,properties:r,questionId:i,type:s})=>{const{border:d,useMobileStyling:u,viewDocument:a,enableCspTrustedTypes:m}=e.useConfig(b=>({border:b.border,useMobileStyling:b.useMobileStyling,viewDocument:b.viewDocument,enableCspTrustedTypes:b.enableCspTrustedTypes})),[y,c]=e.h(-1),[g,k]=e.h(!1),[C,h]=e.h(null),f=o&&o.left,D=o&&o.right;let q;const{range:N,scaleLabelType:I,ratingIcons:H}=r;N&&(q=Number(N));const A=q||5,v=b=>{var w,l;switch(I){case"star":return(w=H[0])==null?void 0:w.svg;case"smiley":return(l=H[b])==null?void 0:l.svg;default:return String(b+1)}};return e.u("form",{className:e.cc(n,"ul-card--likert","fade-in-transition"),children:e.u(E.MobileEmbedView,{properties:r,children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{"aria-label":`Rating (1 - ${A})`,className:"ul-card--likert__numbers",role:"radiogroup",children:[...Array(A)].map((b,w)=>{const l=w+1;return e.u(sn,{activeValue:y,border:d,enableCspTrustedTypes:m,icon:v(w),isPressed:g,range:A,scaleLabelType:I,selectedValue:C,setActiveValue:c,setIsPressed:k,setSelectedValue:h,useMobileStyling:u,value:l,viewDocument:a},w)})}),e.u("div",{className:"ul-card--likert__labels",children:[e.u("span",{children:f}),e.u("span",{children:D})]})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:C===null&&r.required,onClick:()=>t({value:C,questionId:i,type:s},!0),children:e.getButtonText(r)})})]})},i)},ln=({columns:n,onSelect:o,options:t,selectedOptions:r})=>{const i=e._([]),{border:s,useMobileStyling:d}=e.useConfig(g=>({border:g.border,useMobileStyling:g.useMobileStyling})),u=t.findIndex(g=>r[g.id]===null),[a,m]=e.h(u),y=e.T((g,k)=>{o(g,k);const C=a+1,h=t[C];h&&r[h.id]===null&&m(C)},[o,t,r,a]),c=e.T((g,k)=>{const C=a===g;return e.u(e.Accordion,{animate:!0,header:k.label,isOpen:C,onClick:()=>{var h;return m(C&&!((h=window.UserLeap)!=null&&h.isMobileSDK)?-1:g)},ref:h=>{h&&(i.current[g]=h)},showHeaderCheck:r[k.id]!==null,children:e.u("div",{style:{paddingTop:"12px"},children:n.map(h=>e.u(E.Option,{allowTextEntry:!1,ariaLabel:`${k.label}-${h.label}`,border:s,error:!1,id:`${k.id}-${h.value}`,isRadio:!0,isSelected:r[k.id]===h.value,label:h.label,onUserInputChanged:()=>y(k.id,h.value),useMobileStyling:d},h.label))})},k.id)},[s,n,a,y,r,d]);return e.u("div",{children:t.map((g,k)=>c(k,g))})},dn=({className:n,next:o,options:t,properties:r,questionId:i,type:s,onSubmitButtonClick:d})=>{const u=r.matrixColumn,a=r.required,m=C=>{C.preventDefault(),C.stopPropagation(),o({value:c,questionId:i,type:s},!0),d&&d()},y=t.reduce((C,h)=>(C[h.id]=null,C),{}),[c,g]=e.h(y);return e.u("form",{className:e.cc(n,"ul-card__matrix","fade-in-transition"),id:"text-form",onSubmit:m,children:e.u(E.MobileEmbedView,{properties:r,children:[e.u(E.QuestionBodyWrapper,{children:e.u(ln,{columns:u,onSelect:(C,h)=>{g(f=>({...f,[C]:h}))},options:t,selectedOptions:c})}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:(k=c,a&&Object.values(k).every(C=>C==null)),onClick:()=>m(new SubmitEvent("submit")),children:e.getButtonText(r)})})]})},i);var k},He=({className:n,onSubmit:o,options:t=[],properties:r,questionId:i,type:s,showIndividualSubmit:d=!1,onSubmitButtonClick:u})=>{const{border:a,useMobileStyling:m}=e.useConfig(l=>({border:l.border,useMobileStyling:l.useMobileStyling})),y=t.reduce((l,p)=>(l[p.id]={isSelected:!1},l),{}),[c,g]=e.h(y),k=s==="multiplechoice",C=r.required,h=t.find(l=>{var p;return(p=l.optionProperties)==null?void 0:p.noneOfTheAbove}),f=l=>Object.entries(l).some(([p,x])=>{var O;const S=t.find(G=>`${G.id}`===p),T=x.userText===void 0||x.userText.trim()==="";return((O=S==null?void 0:S.optionProperties)==null?void 0:O.allowsTextEntry)&&T&&x.isSelected}),D=l=>Object.values(l).filter(p=>p.isSelected).length,q=r.minSelect&&r.minSelect>0&&r.maxSelectMode===E.MaxSelectModes.Range&&D(c)<r.minSelect&&(C||D(c)>0),N=l=>f(l)||C&&!D(l)||!(p=>{const{minSelect:x=0,maxSelect:S=1/0,maxSelectMode:T}=r,O=D(p);switch(T){case E.MaxSelectModes.Maximum:return O<=S;case E.MaxSelectModes.Range:return O===0||O>=x;default:return!0}})(l),I=Object.entries(c).some(([l,p])=>{var x,S;return p.isSelected&&((S=(x=t.find(T=>`${T.id}`===l))==null?void 0:x.optionProperties)==null?void 0:S.allowsTextEntry)}),H=d&&(!k||I),A=l=>{w(l.id,l.selected,l.userText,l.noneOfTheAbove)},v=l=>{var p;return(r==null?void 0:r.maxSelectMode)!==E.MaxSelectModes.Unlimited&&D(c)===(r==null?void 0:r.maxSelect)&&!((p=c[l])!=null&&p.isSelected)},b=()=>{o(c,!0),u&&u()},w=(l,p,x,S)=>{const T=Object.assign({},c);if((k||S)&&p)for(const O of Object.values(T))O.isSelected=!1,delete O.userText;else h&&!S&&c[h.id].isSelected&&(T[h.id].isSelected=!1);T[l]={isSelected:p,userText:x},g(T)};return e.u("form",{className:e.cc(n,"ul-card--multiple","fade-in-transition"),id:"text-form",onSubmit:b,children:e.u(E.MobileEmbedView,{properties:r,children:[e.u(E.QuestionBodyWrapper,{children:[r.isDropdown?e.u(E.Select,{disabledOptions:t.filter(l=>v(l.id)),dropdownFooter:q?e.u("div",{className:"ul-card__min-select-counter",style:{marginLeft:"16px"},children:[D(c),"/",r.minSelect]}):void 0,isMultiSelect:!k,multiselectText:r.dropdownMultiselectedText??"choices selected",onChange:l=>{const p={...c};for(const x of t)l.includes(x)?p[x.id].isSelected=!0:p[x.id].isSelected=!1;g(p)},options:t,placeholderText:r.dropdownPlaceholderText??(k?"Select choice":"Select choice(s)"),value:t.filter(l=>c[l.id].isSelected)}):e.u("div",{className:e.cc(e.getClasses("ul-card__choices",m)),role:k?"radiogroup":"group",children:[t.map(({id:l,label:p,value:x,optionProperties:S})=>{var L,F;const T=`${l}`,{allowsTextEntry:O,noneOfTheAbove:G}={allowsTextEntry:!1,noneOfTheAbove:!1,...S};return e.u(E.Option,{allowTextEntry:O,border:a,disabled:v(T),error:(B=c,f(B)),id:T,isRadio:k,isSelected:!!((L=c[T])!=null&&L.isSelected),label:p,noneOfTheAbove:G,onUserInputChanged:A,promptText:(S==null?void 0:S.otherOptionPlaceholder)||"Please specify",text:(F=c[l])==null?void 0:F.userText,useMobileStyling:m,value:x},T);var B}),!!q&&e.u("div",{className:"ul-card__min-select-counter",children:[D(c),"/",r.minSelect]})]}),H&&e.u(E.LongformSubmitButton,{handleSubmit:b,isSubmitDisabled:N(c)})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:N(c),onClick:b,children:e.getButtonText(r)})})]})},i)},cn=n=>{const{questionId:o,type:t,next:r,options:i}=n;return e.u(He,{...n,onSubmit:(s,d)=>{const u=Object.entries(s).find(([,g])=>g.isSelected)||[void 0,void 0],[a,m]=u,y=i.find(g=>`${g.id}`===a),c=m!=null&&m.userText?{[a]:{userText:m.userText}}:null;r({value:y&&a?{[a]:y.value}:{},secondaryValue:c,questionId:o,type:t},d)}})},un=n=>{const{questionId:o,type:t,next:r}=n;return e.u(He,{...n,onSubmit:(i,s)=>{const d=Object.entries(i).reduce((a,[m,y])=>(a[m]=y.isSelected,a),{}),u=Object.entries(i).reduce((a,[m,y])=>{if(!y.userText)return a;const c=a||{};return c[m]={userText:y.userText},c},null);r({value:d,secondaryValue:u,questionId:o,type:t},s)}})},pn=({className:n,labels:o,properties:t,next:r,questionId:i,type:s})=>{const[d,u]=e.h(null),{border:a,useMobileStyling:m,viewDocument:y}=e.useConfig(k=>({border:k.border,useMobileStyling:k.useMobileStyling,viewDocument:k.viewDocument})),c=o&&o.left,g=o&&o.right;return e.u("form",{className:e.cc(n,"ul-card--nps","fade-in-transition"),children:e.u(E.MobileEmbedView,{properties:t,children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--nps__numbers",children:[...Array(11)].map((k,C)=>e.u("button",{className:e.cc(e.getClasses("nps-number",m),e.getClasses(`nps-number-${C}`,m)),id:`option-${C}`,onClick:h=>{h.preventDefault(),h.stopPropagation(),u(C)},onKeyDown:h=>{var D,q;const f=y.querySelectorAll("button.nps-number");h.key==="ArrowRight"?(D=f[C+1])==null||D.focus():h.key==="ArrowLeft"?(q=f[C-1])==null||q.focus():h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),h.stopPropagation(),u(C))},onPointerDown:h=>{h.currentTarget.style.zIndex="2",h.currentTarget.style.borderColor=a},onPointerLeave:h=>{h.currentTarget.style.zIndex="auto",h.currentTarget.style.borderColor=Y.DEFAULT_BORDER_COLOR},style:d===C?{backgroundColor:a,color:"#fff"}:void 0,tabIndex:0,children:C},C))}),e.u("div",{className:"ul-card--nps__labels",children:[e.u("span",{children:c}),e.u("span",{children:g})]})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:d===null&&t.required,onClick:()=>r({value:d,questionId:i,type:s},!0),children:e.getButtonText(t)})})]})},i)},mn=({className:n,next:o,properties:t,questionId:r,type:i,onSubmitButtonClick:s})=>{const{border:d,useMobileStyling:u,update:a}=e.useConfig(f=>({border:f.border,useMobileStyling:f.useMobileStyling,update:f.update})),[m,y]=e.h(""),c=e._(null),g=m.trim(),k=t.required===!0&&!g,C=E.useAutoSize(c,()=>a()),h=t&&t.openTextPlaceholder?t.openTextPlaceholder:"";return e.u("form",{className:e.cc(n,"ul-card-text","fade-in-transition"),id:"text-form",children:e.u(E.MobileEmbedView,{properties:t,children:e.u("div",{className:"ul-card-text",children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card-text__container",children:e.u("textarea",{"aria-describedby":"ul-caption","aria-labelledby":"ul-question","aria-multiline":"true","aria-placeholder":h,className:e.cc(e.getClasses("ul-card-text__input",u)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:f=>{f.currentTarget.style.borderColor=Y.DEFAULT_BORDER_COLOR},onChange:f=>{const{value:D}=f.currentTarget;C(),f.preventDefault(),f.stopPropagation(),y(D)},onFocus:f=>{f.currentTarget.style.borderColor=d},placeholder:h,ref:c,role:"textbox",tabIndex:0})}),t.footerHtml&&e.u(E.Html,{className:"footer",html:t.footerHtml})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:k,onClick:f=>{f.preventDefault(),f.stopPropagation();const D=t.required!==!0||g.length>0;o({value:m,questionId:r,type:i},D),s&&s()},children:e.getButtonText(t)})})]})})},r)},vn=({className:n,labels:o,next:t,properties:r,questionId:i,type:s,onSubmitButtonClick:d,options:u})=>{const a=e._(null),m=e._(0),y=e._(0),c=e._(null),g=e._(!1),k=e._([]),[C,h]=e.h(()=>(r==null?void 0:r.required)===!0),[f,D]=e.h(()=>u.map(j=>({...j,rank:null}))),q=e.F(()=>Array.from({length:u.length},(j,R)=>R+1),[u.length]),{useMobileStyling:N,isPreview:I,headers:H}=e.useConfig(j=>({useMobileStyling:j.useMobileStyling,isPreview:j.isPreview,headers:j.headers})),A=(H==null?void 0:H["userleap-platform"])==="android",v=N&&!I&&!A,b=!v&&!A,w=(j,R)=>{D(U=>{const P=parseInt(R),V=U.map($=>({...$}));V.some($=>$.rank==null)&&V.forEach(($,se)=>$.rank=se+1);const K=V.findIndex($=>$.id===j);if(K===-1)return U;const z=V[K].rank;return P<z?V.forEach($=>{$.id!==j&&$.rank>=P&&$.rank<z&&($.rank=$.rank+1)}):P>z&&V.forEach($=>{$.id!==j&&$.rank>z&&$.rank<=P&&($.rank=$.rank-1)}),V[K].rank=P,V.sort(($,se)=>$.rank-se.rank),G(),V})},l=(j,R)=>{for(let U=0;U<k.current.length;U++){const P=k.current[U];if(!P||P===c.current)continue;const V=P.getBoundingClientRect();if(j>=V.left&&j<=V.right&&R>=V.top&&R<=V.bottom)return{element:P,index:U}}return null},p=j=>R=>{if(!v)return;R.preventDefault(),R.stopPropagation(),g.current=!0,a.current=j;const U=R.touches[0];m.current=U.clientY,y.current=U.clientY;const P=R.currentTarget.closest(".ul-card-rank__option");P&&(c.current=P,P.classList.add("is-dragging"))},x=j=>{if(!v||!g.current||a.current===null)return;j.preventDefault(),j.stopPropagation();const R=j.touches[0];y.current=R.clientY;const U=y.current-m.current;c.current&&(c.current.style.transform=`translateY(${U}px)`,c.current.style.zIndex="1000"),k.current.forEach(V=>{V&&V!==c.current&&V.classList.remove("is-drop-target")});const P=l(R.clientX,R.clientY);P&&P.element.classList.add("is-drop-target")},S=j=>{if(!v||!g.current||a.current===null)return;j.preventDefault(),j.stopPropagation();const R=j.changedTouches[0],U=l(R.clientX,R.clientY);c.current&&(c.current.style.transform="",c.current.style.zIndex="",c.current.classList.remove("is-dragging")),k.current.forEach(P=>{P&&P.classList.remove("is-drop-target")}),U&&U.index!==a.current&&T(a.current,U.index),a.current=null,c.current=null,g.current=!1},T=(j,R)=>{D(U=>{const P=U.map(K=>({...K})),[V]=P.splice(j,1);return P.splice(R,0,V),P.forEach((K,z)=>{K.rank=z+1}),G(),P})},O=j=>{const R={};j.reduce((U,P)=>(U[P.id]=P.rank,U),R),t({value:R,questionId:i,type:s},!0)},G=()=>{h(!1)},{left:B,right:L}=o,F=u.length,Q=j=>{j.preventDefault(),j.currentTarget.classList.add("is-drop-target")},W=j=>{j.currentTarget.classList.remove("is-drop-target")},ie=j=>{a.current=null,j.currentTarget.classList.remove("is-dragging")};return e.u("form",{className:e.cc(n,"ul-card-rank","fade-in-transition"),onSubmit:j=>{j.preventDefault(),O(f),d&&d()},children:e.u(E.MobileEmbedView,{properties:r,children:A?e.u(e.g,{children:[e.u(E.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",B]})}),e.u("ol",{className:"ul-card-rank__list",children:f.map(({id:j,label:R,rank:U})=>e.u("li",{className:"ul-card-rank__option",children:[e.u("select",{"aria-label":`Rank for ${R}`,className:e.cc("ul-card-rank__select",U==null&&"ul-card-rank__select--placeholder"),name:`rank[${j}]`,onChange:P=>w(j,P.currentTarget.value),value:U??"",children:[U==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),q.map(P=>e.u("option",{className:"ul-card-rank__select-option",value:P,children:P},`${P}-${i}`))]}),e.u("span",{children:R})]},j))}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[F," - ",L]})})]})}),e.u(E.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(E.Button,{disabled:C,children:e.getButtonText(r)})})})]}):e.u(e.g,{children:[e.u(E.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",B]})}),e.u("ol",{className:"ul-card-rank__list",onDragOver:A?void 0:j=>{j.preventDefault(),j.dataTransfer&&(j.dataTransfer.dropEffect="move")},children:f.map(({id:j,label:R,rank:U},P)=>{return e.u("li",{className:"ul-card-rank__option",draggable:!!b||void 0,onDragEnd:b?ie:void 0,onDragEnter:b?Q:void 0,onDragLeave:b?W:void 0,onDragStart:b?(K=P,z=>{a.current=K,z.dataTransfer&&(z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("text/plain",String(K)),z.currentTarget.classList.add("is-dragging"))}):void 0,onDrop:b?(V=P,z=>{var se,Ee;z.preventDefault(),z.currentTarget.classList.remove("is-drop-target");const $=a.current;a.current=null,(Ee=(se=z.currentTarget.closest(".ul-card-rank__list"))==null?void 0:se.querySelector(".is-dragging"))==null||Ee.classList.remove("is-dragging"),$!=null&&$!==V&&T($,V)}):void 0,ref:z=>k.current[P]=z,children:[e.u("select",{"aria-label":`Rank for ${R}`,className:e.cc("ul-card-rank__select",U==null&&"ul-card-rank__select--placeholder"),name:`rank[${j}]`,onChange:z=>w(j,z.currentTarget.value),value:U??"",children:[U==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),q.map(z=>e.u("option",{className:"ul-card-rank__select-option",value:z,children:z},z))]}),e.u("span",{children:R}),!A&&e.u("button",{"aria-label":`Drag ${R} to reorder`,className:"ul-card-rank__drag-btn",onTouchEnd:v?S:void 0,onTouchMove:v?x:void 0,onTouchStart:v?p(P):void 0,title:"Drag to reorder",type:"button",children:e.u("svg",{fill:"none",height:"17",viewBox:"0 0 16 17",width:"16",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z",fill:"currentColor"})})})]},j);var V,K})}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[F," - ",L]})})]})}),e.u(E.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(E.Button,{disabled:C,children:e.getButtonText(r)})})})]})})},i)},fe=1,$e=2,Ve=3,ce=n=>n.type==="av_permission",Se=n=>n.type==="screen_permission",Fe=(n,o)=>n===void 0?fe:n?((t,r)=>!(ce(r)?r.permissionDescriptors:[]).includes("camera")||t.getVideoTracks().length>0)(n,o)?Ve:fe:$e,Re={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},ee=e.create(n=>({...Re,reset:()=>{n(Re)},updatePage:o=>{n(o)}}));function ye({currentPage:n,pages:o}){const{avStream:t,recordingMediaTypes:r,updatePage:i}=ee.getState(),{recorderEventEmitter:s}=e.useConfig.getState();s.emit("av.permission",{"permission.descriptors":n.permissionDescriptors,"stream.ready":(d,u)=>{if(t===d)return;let a=n;if(d&&!n.permissionDescriptors.includes("camera")){const m=o.indexOf(n),y=u!=null&&u.active?m+2:m+1;u!=null&&u.active&&r&&s.emit("begin.recording",{"recording.media.types":r,"start.recording.callback":c=>i({mediaRecordingUids:c})}),a=o[y]}i({currentPage:a,avStream:d})}})}function Ce({status:n}){const{nextQuestion:o,passthroughData:t,mediaRecordingUids:r,reset:i}=ee.getState(),{recorderEventEmitter:s,handleUploadUpdate:d,index:u}=e.useConfig.getState(),a={value:{taskStatus:n},type:"recordedtask",questionId:(t==null?void 0:t.questionId)||1};t&&s.emit("finish.task",{"begin.callback":m=>{d({mediaRecordingUid:m,isSubmitted:!0,progressPct:0,isComplete:!1})},"progress.callback":(m,y)=>{d({mediaRecordingUid:m,progressPct:y.detail,isSubmitted:!1,isComplete:!1})},"upload.callback":m=>{m&&d({mediaRecordingUid:m,isComplete:!0,isSubmitted:!0,progressPct:100})},"passthrough.data":t,"current.index":u,"task.response":a,"task.complete.callback":m=>{a.value.taskDurationMillisecond=m,r&&(a.value.mediaRecordingUids=r),i(),o(a)}})}function ke({pages:n,setIsRequestingPermission:o}){const{recorderEventEmitter:t,eventEmitFn:r}=e.useConfig.getState(),{updatePage:i,currentPage:s,recordingMediaTypes:d,screenPermissionRequested:u}=ee.getState();if(!s)return;const a=n.indexOf(s);switch(s.type){case"av_permission":{const m=u?a+2:a+1;return u&&d&&t.emit("begin.recording",{"recording.media.types":d,"start.recording.callback":y=>{i({mediaRecordingUids:y})}}),void i({currentPage:n[m]})}case"screen_permission":return void t.emit("screen.permission",{"screen.permission.requested":o,"stream.ready.callback":(m,y)=>{const c=y?n[a+1]:s;y&&d&&t.emit("begin.recording",{"recording.media.types":d,"start.recording.callback":g=>{i({captureStream:y,mediaRecordingUids:g})}}),i({currentPage:c,screenPermissionRequested:!0,captureStream:y})}});case"start_task":return r("recorded.task.start"),t.emit("recorded.task.start"),t.emit("start.task"),void i({currentPage:n[a+1],screenPermissionRequested:!0});case"complete_task":return}}const ze="ul-permission-graphics-container",Qe="ul-permission-body",Ge=e.cc(ze,"ul_recorded-task-inset-spacing"),ue=e.cc("ul-horizontal-button-container","ul-horizontal-button-container-left"),Ze=({richTextBody:n})=>e.u(E.Html,{className:"ul-rich-text-body",html:n,id:"ul-task-detail-container"}),pe=({required:n,skipButtonText:o,bottom:t=!1})=>n?null:e.u(E.Button,{className:e.cc(t&&"ul-skip-button-below","ul-button-inactive"),onClick:Ce.bind(null,{status:"abandoned"}),children:o||"Skip"}),we=n=>{const{avStream:o,captureStream:t,recordingMediaTypes:r,updatePage:i}=ee.getState(),s=(r==null?void 0:r.includes("audio"))||(r==null?void 0:r.includes("video"));e.p(()=>{const d=setInterval(()=>{s&&o&&!o.active?i({avStream:null,currentPage:n[0]}):t&&t.active||i({captureStream:void 0,currentPage:n[s?1:0]})},1e3);return()=>clearInterval(d)},[o,t,s,n,r,i])},gn=({content:n,pages:o,required:t})=>{const{buttonText:r,skipButtonText:i,taskDetail:s}=n;return we(o),e.u("div",{className:"ul-task-page",children:[s&&e.u(Ze,{richTextBody:s}),e.u("div",{className:ue,children:[e.u(E.Button,{onClick:ke.bind(null,{pages:o}),children:r}),e.u(pe,{required:t,skipButtonText:i})]})]},"start-task")},hn=({content:n,pages:o,properties:t})=>{const{buttonText:r,skipButtonText:i}=n;return we(o),e.u("div",{className:"ul-task-page",children:[n.taskDetail&&e.u(Ze,{richTextBody:n.taskDetail}),e.u(E.MobileEmbedView,{properties:t,children:e.u("div",{className:ue,children:[e.u(E.Button,{className:"ul-complete-task-button",onClick:Ce.bind(null,{status:"completed"}),children:r}),e.u(E.Button,{className:e.cc("ul-button-inactive"),onClick:Ce.bind(null,{status:"given.up"}),children:i})]})})]},"complete-task")},bn=({content:n,pages:o,required:t})=>{const{buttonText:r,skipButtonText:i}=n,[s]=e.useConfig(a=>[a.tabTitle]),[d,u]=e.h(!1);return e.u("div",{children:[e.u("div",{className:Ge,children:[e.u("p",{style:{marginTop:"auto"},children:n.selectTabText}),e.u("div",{className:"ul-select-tab-container",children:e.u("p",{className:Qe,children:s})})]}),e.u("div",{className:t?"":ue,children:[e.u(E.Button,{disabled:d,onClick:ke.bind(null,{pages:o,setIsRequestingPermission:u}),children:r}),e.u(pe,{required:t,skipButtonText:i})]})]})},fn=({content:n})=>e.u(E.Html,{className:e.cc(ze,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"),html:n.svg},"ul-permission-request-graphic"),yn=({content:n,pages:o,required:t})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:i,skipButtonText:s,tryAgainButtonText:d}=n,u=ce(o[0])?o[0]:null;return e.p(()=>{const a=setInterval(()=>{u!==null&&ye({currentPage:u,pages:o})},1e3);return()=>clearInterval(a)},[u,o]),u?e.u("div",{children:[e.u("div",{className:Ge,children:e.u("p",{className:"ul-av-permission-denied-paragraph",children:[e.u("span",{className:"ul-av-permission-denied-headline",children:r}),e.u("span",{className:Qe,children:i})]})}),e.u("div",{className:ue,children:[e.u(E.Button,{onClick:ye.bind(null,{currentPage:u,pages:o}),children:d}),e.u(pe,{required:t,skipButtonText:s})]})]}):null},Cn=({stream:n})=>e.u("video",{autoPlay:!0,className:e.cc("ul_recorded-task-inset-spacing"),id:"ul-record-task-video-preview",muted:!0,ref:o=>{o&&(o.srcObject=n||null)}}),xn=({content:n,pages:o,required:t})=>{const{skipButtonText:r}=n,{avStream:i}=ee.getState();return we(o),e.u("div",{children:[e.u(Cn,{stream:i}),e.u("div",{className:"ul-vertical-button-container-center",children:[e.u(E.Button,{onClick:ke.bind(null,{pages:o}),children:n.buttonText}),e.u(pe,{bottom:!0,required:t,skipButtonText:r})]})]})},kn=({properties:n})=>{const{pages:o,required:t}=n,{avStream:r,currentPage:i}=ee.getState();if(i===void 0)return null;switch(i==null?void 0:i.type){case"av_permission":{const s=Fe(r,i);return s===fe?e.u(fn,{content:i}):s===$e?e.u(yn,{content:i,pages:o,required:t}):e.u(xn,{content:i,pages:o,required:t})}case"screen_permission":return e.u(bn,{content:i,pages:o,required:t});case"start_task":return e.u(gn,{content:i,pages:o,required:t});case"complete_task":return e.u(hn,{content:i,pages:o,properties:n});default:return null}},wn=({className:n,properties:o,next:t,questionId:r})=>{const i=e.useConfig(),{surveyId:s,responseGroupUid:d,userId:u}=i,a=ee(),{screenPermissionRequested:m}=a,y=ee(h=>h.avStream);let c=ee(h=>h.currentPage);c||(c=function({pages:h,userId:f,responseGroupUid:D,surveyId:q,questionId:N,next:I}){const{updatePage:H}=ee.getState(),{eventEmitFn:A,recorderEventEmitter:v}=e.useConfig.getState(),b={questionId:N,surveyId:q,visitorId:f,responseGroupUid:D};let w=0;v.emit("recorded.task.permission.screen"),A("recorded.task.permission.screen"),v.emit("permission.status",{"permission.status.callback":(p,x,S,T)=>{const O=h[w],{type:G}=O,B=["screen"];if(ce(O)){const{permissionDescriptors:L}=O,F=L==null?void 0:L.includes("microphone"),Q=L==null?void 0:L.includes("camera");F&&B.push("audio"),Q&&B.push("video"),(p!=null&&p.active&&!Q||p!=null&&p.active&&x)&&w++}Se(h[w])&&S&&(w++,v.emit("begin.recording",{"recording.media.types":B,"start.recording.callback":L=>H({mediaRecordingUids:L})})),H({currentPage:h[w],avStream:p,screenPermissionRequested:S,nextQuestion:I,type:G,passthroughData:b,recordingMediaTypes:B,captureStream:T})}});const l=h[w];return l.type==="av_permission"&&ye({currentPage:l,pages:h}),l}({questionId:r,surveyId:s,next:h=>{t(h,!0)},pages:o.pages,responseGroupUid:d,userId:u}));let g=c.headline,k=c.captionText;const C=Fe(y,c);return Se(c)&&m&&(g=c.permissionDeniedHeadline,k=c.permissionDeniedCaptionText),ce(c)&&C===Ve&&(g=c.permissionGrantedHeadline,k=c.permissionGrantedCaptionText),e.u("div",{className:e.cc(n,"ul-center-horizontally","fade-in-transition"),children:[e.u(E.Header,{isRequired:o==null?void 0:o.required,message:g,properties:{captionText:k}}),e.u(E.QuestionBodyWrapper,{children:e.u(kn,{properties:o})})]})},En=({className:n,next:o,properties:t,questionId:r,type:i})=>{const{visitorAttributes:s,isLongFormSurvey:d}=e.useConfig(y=>({visitorAttributes:y.visitorAttributes,isLongFormSurvey:Y.isLongFormSurvey(y.studyType)})),u=(y,c=!1)=>{o({value:c?{skipped:!0}:void 0,questionId:r,type:i},!0)},a=E.getAttributedUrl(t&&t.buttonUrl,s),m=d&&t.promptActionType===E.PromptActionTypeEnum.NO_BUTTON;return e.u("div",{className:e.cc(n,"ul-card__text-url-prompt","fade-in-transition"),children:e.u(E.MobileEmbedView,{properties:t,children:!m&&e.u("div",{children:e.u("div",{className:"ul-card-button-group",children:[e.u("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:a,id:"ul-card-text__button",onClick:u,onKeyPress:y=>{y.key!=="Enter"&&y.key!==" "||o({value:void 0,questionId:r,type:i},!0)},rel:"noreferrer",role:a?"link":"button",tabIndex:0,target:"_blank",children:e.getButtonText(t)}),t.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:y=>u(0,!0),children:e.getSkipButtonText(t)})]})})})},r)},jn=({className:n,questionId:o})=>{const{border:t,destroy:r,endCard:i,forceBrandedLogo:s}=e.useConfig(a=>({border:a.border,destroy:a.destroy,endCard:a.endCard,forceBrandedLogo:a.forceBrandedLogo}));e.p(()=>{setTimeout(()=>{r(Y.APP_ID)},s?4e3:2e3)},[r,s]);const d=i&&i.subheader?e.u("p",{className:"ul-caption",children:i.subheader}):null,u=i&&i.headline?i.headline:"";return e.u("div",{className:e.cc(n,"ul-card--thanks","fade-in-transition"),children:e.u("div",{children:e.u("div",{className:"ul-card--thanks-content",children:[e.u("div",{className:"ul-thanks-check",children:e.u("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[e.u("path",{clipRule:"evenodd",d:"M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z",fill:t,fillRule:"evenodd"}),e.u("path",{clipRule:"evenodd",d:"M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z",fill:t,fillRule:"evenodd"}),e.u("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),e.u(E.Header,{message:u}),d]})})},o)},Tn=()=>e.u("div",{className:"thinking-dots-container",children:e.u("div",{className:"thinking-dot"})}),_n=({className:n})=>{const{uploadProgress:o}=e.useConfig(s=>({uploadProgress:s.uploadProgress}));let t,r;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.");const i=Math.round(Math.min(99,...Object.values(o).filter(s=>s.isSubmitted).map(s=>s.progressPct||0)));return e.u("div",{className:e.cc(n,"ul-card--uploading","fade-in-transition"),children:[e.u("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:"ul-loading-spinner-container",role:"progressbar",children:e.u("div",{className:"ul-loading-spinner",children:[e.u("div",{className:"first"}),e.u("div",{className:"second"}),e.u("div",{className:"third"}),e.u("div",{className:"fourth"})]})}),e.u(E.Header,{message:`${t} (${i}% complete)`}),e.u("p",{className:"ul-caption",children:r})]})},Pe=0,Be=1,In=({className:n,next:o,properties:t,questionId:r,type:i})=>{const s=`ul-card-video__player_recorder-q${r}`,{apiURL:d,envId:u,handleUploadUpdate:a,headers:m,responseGroupUid:y,surveyId:c,viewDocument:g,visitorId:k}=e.useConfig(b=>({apiURL:b.apiURL,envId:b.envId,handleUploadUpdate:b.handleUploadUpdate,headers:b.headers,responseGroupUid:b.responseGroupUid,surveyId:b.surveyId,viewDocument:b.viewDocument,visitorId:b.userId})),[C,h]=e.h(!1),[f,D]=e.h(null),[q,N]=e.h(null),[I,H]=e.h(Pe),A=(b,w)=>{b===M.UPLOAD_STARTED?(D(w[M.UPLOAD_ID]),N(w[M.MEDIA_RECORDING_UID]),h(!0)):b===M.DELETE?(D(null),N(null),h(!1)):b===M.UPLOAD_PROGRESS?isNaN(w[M.UPLOAD_PROGRESS_PCT])?a({mediaRecordingUid:w[M.MEDIA_RECORDING_UID],isComplete:!0}):a({mediaRecordingUid:w[M.MEDIA_RECORDING_UID],progressPct:w[M.UPLOAD_PROGRESS_PCT]}):b===M.UPLOAD_FINISHED&&a({mediaRecordingUid:w[M.MEDIA_RECORDING_UID],isComplete:!0})},v=b=>{b.preventDefault(),b.stopPropagation(),document.getElementById(s)&&(w=>{const l=w+_e;if(_.document.getElementById(l)&&_.videojs){try{if(!_.videojs(l).record().stream)return}catch{return}_.videojs(l).record().stop(),_.videojs(l).record().stopDevice()}})(s),f&&q?(a({mediaRecordingUid:q,isSubmitted:!0}),o({value:{mediaRecordingUid:q},questionId:r,type:i},!0)):o({value:null,questionId:r,type:i},!0)};return e.u("form",{className:e.cc(n,"ul-card--video","fade-in-transition"),id:"ul-video-interview-form",children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{id:"ul-question-player-container",style:{display:I===Pe?"":"none"},children:e.u(E.MobileEmbedView,{properties:t,children:e.u("button",{className:"ul-video-btn ul-record-response-btn",onClick:b=>{b.preventDefault(),b.stopPropagation(),document.getElementById(s)&&(w=>{const l=de(w+Me);l==null||l.pause()})(s),H(Be)}})})}),e.u("div",{style:{display:I===Be?"block":"none"},children:e.u("div",{id:"ul-recorder-player-container",ref:b=>{if(b&&b.children.length===0){const w=((l,p={},x="https://api.userleap.com",S,T,O,G=!1,B=document)=>{_.document=B;const L=l+_e,F=Ae(L);return _.document.addEventListener("securitypolicyviolation",Q=>{ne(new Error(`Voice & Video feature violates ${Q.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",x,O,p.visitorId,p.envId)}),Ne(Le.concat(Ye),()=>{be(L,F),_.document.getElementById(xe(L)).remove();try{Je(F,L,p,x,S,T,O,G)}catch(Q){return void ne(new Error(`Error when creating video recorder player object ${Q}`),"recorderDeviceError",x,O,p.visitorId,p.envId)}}),F})(s,{surveyId:c,responseGroupUid:y,questionId:r,visitorId:k,envId:u},d,A,void 0,{...m,"x-ul-video-recorder-origin":"sdk"},t.mediaType===M.MEDIA_TYPE_AUDIO,g);b.appendChild(w)}}})})]}),e.u(E.QuestionBodyFooterContainer,{children:[e.u(oe,{isDisabled:!!t.required&&!C,onClick:v,children:e.getButtonText(t)}),e.u("button",{className:"ul-card-text__button ul-button-inactive ul-card-skip__button",id:"ul-card-video__skip_button",onClick:v,style:{...t.required?{display:"none"}:{},...C?{display:"none"}:{}},children:e.getSkipButtonText(t)})]})]})},We=n=>n.type==="thanks"||n.type==="uploading",Dn=({card:n,avatars:o,isThinking:t,isCurrentQuestion:r,currentQuestionBubbleRef:i})=>{const s=(d=>"properties"in d.props&&d.props.properties&&"questionHtml"in d.props.properties&&d.props.properties.questionHtml?{content:d.props.properties.questionHtml,isHtml:!0}:"message"in d.props?{content:d.props.message,isHtml:!1}:{content:"Question",isHtml:!1})(n);return e.u(ae,{avatars:o,isLeft:!0,message:{id:`question-${n.name}`,type:"question",content:s.content},ref:r?i:null,children:t?e.u(Tn,{}):e.u(e.g,{children:[s.isHtml?e.u(E.Html,{className:"chat-message-text",html:s.content}):e.u("div",{className:"chat-message-text",children:s.content}),n.type==="videovoice"&&e.u(tn,{properties:n.props,questionId:n.name,surveyVideoUrl:n.props.properties.videoUrl})]})})},Sn=({card:n,avatars:o})=>{const t=(r=>{if(!("properties"in r.props)||!r.props.properties||typeof r.props.properties!="object")return null;const i=r.props.properties,s=[{key:"captionHtml",isHtml:!0},{key:"captionText",isHtml:!1},{key:"richTextBody",isHtml:!0},{key:"body",isHtml:!1}];for(const{key:d,isHtml:u}of s){const a=i[d];if(typeof a!="string")continue;const m=a.trim();if(m){if(u&&!m.replaceAll(/<[^>]*>/g,"").trim())continue;return{content:m,isHtml:u}}}return null})(n);return t?e.u(ae,{avatars:o,hideAvatar:!0,isLeft:!0,message:{id:`caption-${n.name}`,type:"question",content:t.content},children:t.isHtml?e.u(E.Html,{className:"chat-message-text",html:t.content}):e.u("div",{className:"chat-message-text",children:t.content})}):null},Rn=({card:n,userResponse:o,avatars:t})=>{const r=((i,s)=>{if(i.type==="open"&&s&&typeof s=="object"&&"value"in s)return s.value})(n,o);return e.u("div",{className:"chat-bubble-container chat-right",children:[e.u("div",{className:"chat-bubble chat-bubble-right chat-bubble-text-only",children:e.u("div",{className:"chat-message-text",children:r||e.u("div",{className:"chat-message-no-response",children:"No response"})})}),e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${t.respondentAvatar["1x"]} 1x, ${t.respondentAvatar["2x"]} 2x`})]})},Pn=({card:n,avatars:o,isCurrentQuestion:t,currentQuestionBubbleRef:r})=>{const{endCard:i}=e.useConfig(s=>({endCard:s.endCard}));return e.u(e.g,{children:[e.u(ae,{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.u(ae,{avatars:o,hideAvatar:!0,isLeft:!0,message:{id:`caption-${n.name}`,type:"question",content:i.subheader}}),e.u(on,{})]})},Bn=({card:n,cardIndex:o,index:t,avatars:r,cardResponses:i,questionThinkingStates:s,startingQuestionIdx:d,currentQuestionBubbleRef:u,handleCardResponse:a})=>{const m=o===t,y=o<t,c=We(n);if(c)return e.u(Pn,{avatars:r,card:n,currentQuestionBubbleRef:u,isCurrentQuestion:m});const g=`${n.name}`,k=i.get(g),C=n.type==="open",h=s.get(g);if(n.type==="aidynamicfollowup"&&(n.props.loading===null||n.props.loading===void 0))return e.u(e.g,{});const f=o>(d??0)&&n.type!=="thanks"&&n.type!=="uploading"&&(h===!0||h===void 0);return e.u(e.wn.Fragment,{children:[e.u(Dn,{avatars:r,card:n,currentQuestionBubbleRef:u,isCurrentQuestion:m,isThinking:f}),!f&&e.u(Sn,{avatars:r,card:n}),y&&C?e.u(Rn,{avatars:r,card:n,userResponse:k}):(!y||!C)&&!f&&e.u(ae,{avatars:r,isLeft:!1,message:{id:`card-${n.name}`,type:"card",content:""},children:e.u("div",{className:"chat-card-container",children:e.u(Mn,{card:n,className:c?"chat-thanks-card":"chat-card",isAnswered:y,next:m?a:()=>{}})})})]},`question-card-${n.name}`)},ae=e.wn.forwardRef(({message:n,isLeft:o=!1,children:t,avatars:r,hideAvatar:i=!1},s)=>{const d=o?"chat-bubble-left":"chat-bubble-right";return e.u("div",{className:`chat-bubble-container ${o?"chat-left":"chat-right"}${o&&i?" chat-no-avatar":""}`,ref:s,children:[o&&!i&&e.u("img",{alt:"AI Avatar",className:"chat-avatar chat-avatar-left",srcSet:`${r.agentAvatar["1x"]} 1x, ${r.agentAvatar["2x"]} 2x`}),e.u("div",{className:`chat-bubble ${d}`,children:t||e.u("div",{className:"chat-message-text",children:n.content})}),!o&&!i&&e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x`})]})});ae.displayName="ChatBubble";const Ln=()=>{const n=e.useConfig(t=>t.close),o=e.F(()=>()=>n(Y.APP_ID),[n]);return e.u("div",{"aria-label":"Close button",className:"conversational-close-btn",onClick:o,onKeyPress:t=>{t.key==="Enter"&&o()},role:"button",tabIndex:0,children:e.u("svg",{fill:"none",height:"16px",viewBox:"0 0 13 13",width:"16px",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})},Mn=({card:n,next:o,className:t="",isAnswered:r=!1})=>{const i={className:r?`${t} answered-card`:t,next:r?()=>{}:o,questionId:n.name,type:n.type,isAnswered:r};switch(n.type){case"consentlegal":return e.u(rn,{...i,...n.props});case"likert":return e.u(an,{...i,...n.props});case"matrix":return e.u(dn,{...i,...n.props});case"multiplechoice":return e.u(cn,{...i,...n.props});case"multipleselect":return e.u(un,{...i,...n.props});case"nps":return e.u(pn,{...i,...n.props});case"aidynamicfollowup":case"open":return e.u(mn,{...i,type:n.type,...n.props});case"rankorder":return e.u(vn,{...i,...n.props});case"recordedtask":return e.u(wn,{...i,...n.props});case"texturlprompt":return e.u(En,{...i,...n.props});case"thanks":return e.u(jn,{...i,...n.props});case"uploading":return e.u(_n,{...i,...n.props});case"videovoice":return e.u(In,{...i,...n.props});default:return null}};exports.default=({cards:n,next:o,previousResponses:t})=>{const{cardResponses:r,setCardResponse:i}=(()=>{const[v,b]=e.h(new Map);return{cardResponses:v,setCardResponse:e.T((w,l)=>{b(p=>new Map(p).set(w,l))},[])}})(),{index:s,isLongFormSurvey:d,avatars:u,showSurveyBrand:a,forceBrandedLogo:m,marketingUrlLink:y,startingQuestionIdx:c,viewDocument:g,createDynamicQuestion:k,update:C}=e.useConfig(v=>({index:v.index,isLongFormSurvey:Y.isLongFormSurvey(v.studyType),avatars:v.avatars,forceBrandedLogo:v.forceBrandedLogo,startingQuestionIdx:v.startingQuestionIdx,showSurveyBrand:v.showSurveyBrand,marketingUrlLink:e.buildMarketingUrl({marketingUrl:v.marketingUrl,slugName:v.slugName,surveyId:v.surveyId,forceBrandedLogo:v.forceBrandedLogo}),viewDocument:v.viewDocument,createDynamicQuestion:v.createDynamicQuestion,update:v.update})),{currentQuestionBubbleRef:h,scrollToCurrentQuestion:f}=(({viewDocument:v})=>{const b=e._(null),w=e.T(()=>{const l=v.querySelector(".ul-card-main-content");if(b.current&&l&&l instanceof HTMLElement){const p=b.current.offsetTop-l.offsetTop-16;l.scrollTo({top:Math.max(0,p),behavior:"smooth"})}},[]);return{currentQuestionBubbleRef:b,scrollToCurrentQuestion:w}})({viewDocument:g}),D=((v,b,w)=>{const[l,p]=e.h(new Map);return e.p(()=>{if(v.length>0&&b<v.length){const x=v[b],S=`${x.name}`,T=B=>B.type==="aidynamicfollowup",O=B=>{var L;if(b>0){const F=v[b-1];if(T(F)){const Q=`${F.name}`,W=!!((L=F.props)!=null&&L.loading);if(B.get(Q)!==W)return new Map(B).set(Q,W)}}return B};if(b<=(w??0)||We(x))return p(B=>O(new Map(B).set(S,!1)));p(B=>{const L=!T(x)||!!x.props.loading;return O(new Map(B).set(S,L))});const G=setTimeout(()=>{p(B=>{const L=!!T(x)&&!!x.props.loading;return O(new Map(B).set(S,L))})},1e3);return()=>clearTimeout(G)}},[b,v,w]),l})(n,s,c),q=((v,b)=>{const[w,l]=e.h(()=>new Set([v]));return e.p(()=>{l(p=>new Set(p).add(v))},[v]),e.p(()=>{const p=b??0;p>0&&l(x=>{const S=new Set(x);for(let T=0;T<=p;T++)S.add(T);return S})},[b]),w})(s,c),N=e.F(()=>({...t,...e.buildReadableResponseMap(n.map((v,b)=>{var w,l;return{...v,value:b<s?((w=r.get(`${v.name}`))==null?void 0:w.value)??null:null,secondaryValue:b<s?((l=r.get(`${v.name}`))==null?void 0:l.secondaryValue)??null:null}}))}),[t,r,n,s]);e.useSetAllResponsesRaw(N);const I=e.pipeReadableResponsesIntoCards(n,N);e.p(()=>{requestAnimationFrame(()=>{f()}),C()},[s,f,D,C]);const H=e.T((v,b)=>{if(!b)return;const w=I[s];if(!w)return;const l=`${w.name}`;i(l,v);const p={...v,questionText:e.getProcessedQuestionText(w)};if(w.childId&&(p==null?void 0:p.value)!=null){const x=e.buildReadableResponseMap([w].map(S=>({...S,value:(p==null?void 0:p.value)??null,secondaryValue:(p==null?void 0:p.secondaryValue)??null})));k({parentQuestionId:w.name,parentResponseConfig:x})}o([p])},[I,s,o,i]),A=I.map((v,b)=>({card:v,cardIndex:b})).filter(({cardIndex:v})=>q.has(v));return e.u("div",{className:"conversational-ui ul-conversational-ui","data-testid":"ui-container",children:[!d&&e.u(Ln,{}),e.u("div",{className:"chat-container",children:e.u("div",{className:"chat-messages",children:A.map(({card:v,cardIndex:b})=>e.u(Bn,{avatars:u,card:v,cardIndex:b,cardResponses:r,currentQuestionBubbleRef:h,handleCardResponse:H,index:s,questionThinkingStates:D,startingQuestionIdx:c},`question-card-${v.name}`))})}),d&&e.u("div",{className:"long-form-question-footer-container-logo",children:a&&e.u(e.SprigBrandLogo,{forceBrandedLogo:m,marketingUrlLink:y})})]})};
658
+ `}],Oe="-video-player",Ie="-secondary-video-player",De="-video-recorder";let X,Se;const te=async({event:n,apiBase:o,headers:t,visitorId:r,envId:i,metadata:s})=>{const d=_.document.documentElement;if(!r||!i)return;const p={event:`SDK - ${n}`,visitorId:r,environmentId:i,metadata:{...s||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:d.clientWidth,clientHeight:d.clientHeight,location:window.location.href,language:navigator.language}};(await fetch(`${o}/sdk/1/visitors/${r}/analytics`,{method:"POST",cache:"no-cache",headers:t,body:JSON.stringify(p)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",n)},ne=async(n,o,t,r,i,s)=>{te({event:`Video Error ${o}`,apiBase:t,headers:r,visitorId:i,envId:s,metadata:{errorMessage:n.message}});const d=_.document.documentElement,p={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:d.clientWidth,clientHeight:d.clientHeight,location:window.location.href,language:navigator.language},a={action:o,err:{message:n.message,stack:n.stack},meta:p,vid:i,envId:s};(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)},qe=(n,o)=>{if(n.length===0)return o&&o();Promise.all(n.reduce((t,r)=>(t.push(((i,{type:s,content:d})=>new Promise(function(p,a){let v;s==="script"?(v=_.document.createElement("script"),v.src=d):s==="link"?(v=_.document.createElement("link"),v.rel="stylesheet",v.href=d,v.type="text/css"):(v=_.document.createElement("style"),v.innerHTML=d),v.onload=function(){p(d)},v.onerror=function(){a(d)},v.async=!1,v.id=btoa(d),i.appendChild(v)}))(_.document.head,r)),t),[])).then(()=>{_.videojs=_.document.defaultView.videojs,o&&o()}).catch(function(t){console.log(t+" failed to load")})},Re=(n,o,t)=>{if(o==="start"&&(n.style.visibility="visible"),o==="none")n.style.visibility=Z;else if(o==="success")n.style.visibility=Z,n.innerHTML="Upload succeeded!";else{const r=Math.round(parseFloat(t));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%)`}},be=(n,o)=>{const t=_.videojs(n.id());return t==null?void 0:t.payload[o]},Ue=(n,o)=>{const t=new(_.videojs.getComponent("Component"))(n);return t.addClass("ul-buttons-panel"),o.map(r=>{t.addChild(r)}),Xe(t),t},Xe=n=>{n.children().forEach(o=>{if(K[o.name_]){const t=de(K[o.name_],`ul-${K[o.name_]}`);o.el_.appendChild(t)}})},de=(n,o="")=>{const t=_.document.createElement("span");return t.className="ul-button-text",t.innerHTML=n,t.id=o,t},Ae=(n,o,t,r,i=!1,s)=>{n.addClass("ul-video-player");const d=new(_.videojs.getComponent("Component"))(n);d.addClass("ul-control-panel"),n.progressBar=d.addChild("ProgressControl"),t&&n.src(t),n.audioPlayerPlaceholder=new(_.videojs.getComponent("Component"))(n),n.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const p=t&&t.src?rn(t.src):null;!t||!i&&p?(n.audioPlayerPlaceholder.hide(),_.document.getElementById(`${n.id()}_html5_api`).style.height="100%",p&&n.poster(p)):(n.children()[0].classList.add("vjs-hidden"),_.document.getElementById(`${n.id()}_html5_api`).style.height="0px"),n.on("play",()=>{i||!t||p||nn(n),s==null||s.play()}),n.on("pause",()=>{s==null||s.pause()}),n.on("seeked",()=>{s==null||s.currentTime(n.currentTime())}),n.on("ratechange",()=>{s==null||s.playbackRate(n.playbackRate())}),n.addChild(n.audioPlayerPlaceholder,{},1),d.addChild(o),n.addChild(d),r&&r(n)},en=(n,o,t,r,i,s,d,p=!1)=>{Se=Date.now();const a=ce(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}}});if(!a)return;a.payload=t;const{surveyId:v,questionId:y,responseGroupUid:c,visitorId:h,envId:w}=t;let x;const b=l=>{const u=ge,C=ge+"-audio-only";Re(a.uploadProgressLabel,"none"),X&&X.startTime>=Se&&X.abort();const S=_.document.getElementById("ul-camera-button");l?(a.children()[0].classList.add("vjs-hidden"),B.removeClass(u),B.addClass(C),S.innerHTML=K.TurnOnCamera,a.audioPlayerPlaceholder.removeClass("vjs-hidden"),x==null||x.getTracks().forEach(T=>{T.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(T=>{x=T,T.getVideoTracks().forEach(N=>{N.enabled=!1}),a.record().onDeviceReady(T)}).catch(a.record().onDeviceError.bind(a.record()))):(x==null||x.getVideoTracks().forEach(T=>{T.enabled=!0}),a.children()[0].classList.remove("vjs-hidden"),a.record().getDevice(),B.removeClass(C),B.addClass(u),S.innerHTML=K.TurnOffCamera,a.audioPlayerPlaceholder.addClass("vjs-hidden"))},f=new(_.videojs.getComponent("Button"))(a,{clickHandler:()=>{f.hasClass(Z)||(te({event:"Video Delete Button Clicked",apiBase:r,headers:d,visitorId:h,envId:w,metadata:{questionId:y,responseGroupUid:c,surveyId:v}}),b(a.cameraOff),i(P.DELETE,{}),B.removeClass(Z),f.addClass(Z))}});f.addClass("ul-video-recorder-delete-button"),f.el_.appendChild(de(K.DeleteButton,"ul-delete-button"));const D=_.document.getElementById(o),M=()=>{D.classList.contains("vjs-fullscreen")&&a.cameraOff?D.style.display="table":D.style.display="flex"};M();const B=new(_.videojs.getComponent("Button"))(a,{clickHandler:()=>{a.record().isRecording()||(a.cameraOff=!a.cameraOff,te({event:"Video Camera Button Clicked",apiBase:r,headers:d,visitorId:t.visitorId,envId:t.envId,metadata:{questionId:y,responseGroupUid:c,surveyId:v,cameraOff:a.cameraOff}}),b(a.cameraOff),!f.hasClass(Z)&&f.addClass(Z),i(P.DELETE,{}),M())}});B.addClass(ge),B.el_.appendChild(de(K.TurnOffCamera,"ul-camera-button"));const I=new(_.videojs.getComponent("Button"))(a,{clickHandler:()=>{const l=_.document.getElementById("ul-recorder-toggle");if(a.record().isRecording())a.record().stop(),l&&(l.innerHTML=K.RecordButton),I.removeClass(he),f.removeClass(Z);else{const u=_.document.getElementById("ul-recording-countdown-screen");if(u)u.remove(),l&&(l.innerHTML=K.RecordButton),b(a.cameraOff),i(P.DELETE,{}),B.removeClass(Z),f.addClass(Z),I.removeClass(he),m.show();else{I.addClass(he),m.hide(),B.addClass(Z),f.addClass(Z),l&&(l.innerHTML=K.StopButton);const C=_.document.createElement("div");C.id="ul-recording-countdown-screen",D.insertBefore(C,D.children[1]),C.style.height=`${D.offsetHeight}px`,He(a,3)}}}});I.addClass("ul-video-recorder-toggle-button"),I.el_.appendChild(de(K.RecordButton,"ul-recorder-toggle"));const $=_.document.createElement("p");$.style.visibility="hidden",$.className="ul-upload-progress-label",n.appendChild($),a.uploadProgressLabel=$;const H=Ue(a,[f,B,"PlayToggle",I,"FullscreenToggle"]),m=H.children().find(l=>l.name_==="FullscreenToggle");m.hasClass("vjs-disabled")&&m.hide();const g=H.children().find(l=>l.name_==="PlayToggle");g.hide(),f.addClass(Z),Ae(a,H,s,!1,p),a.on("stopRecord",()=>{I.hide(),g.show(),m.show(),f.removeClass(Z)}),a.on("deviceReady",()=>{I.show(),g.hide(),f.addClass(Z)}),((l,u,C,S,T)=>{const{surveyId:N,responseGroupUid:A,visitorId:O,envId:q}=l.payload;l.on("deviceError",function(){console.warn("device error: ",l.deviceErrorCode),l.deviceErrorCode.message==="Permission denied"?(l.deviceButton.addClass("permission-denied"),C&&C(P.ERROR,{type:P.PERMISSION_DENIED}),te({event:"Video Permission Denied",apiBase:u,headers:T,visitorId:O,envId:q,metadata:{questionId:be(l,ve),responseGroupUid:A,surveyId:N}})):(C&&C(P.ERROR,{type:P.OTHER}),ne(new Error(l.deviceErrorCode.message),"recorderDeviceError",u,T,O,q))}),l.on("error",function(Q,G){ne(G||l.error(),"recorderError",u,T,O,q)}),l.on("startRecord",function(Q,G){S(l.uploadProgressLabel,"none"),te({event:"Video Record Start",apiBase:u,headers:T,visitorId:O,envId:q,metadata:{questionId:be(l,ve),responseGroupUid:A,surveyId:N}})}),l.on("finishRecord",async function(){S(l.uploadProgressLabel,"start",0);const Q=be(l,ve);if(!N){const R="internal error: missing fields in payload";return C&&C(P.ERROR,{type:P.OTHER}),ne(new Error(R),"finishRecord",u,T,O,q),null}l.record().stopDevice();const G=l.cameraOff?P.MEDIA_TYPE_AUDIO:P.MEDIA_TYPE_VIDEO,J=W.v4();te({event:"Video Record Finish",apiBase:u,headers:T,visitorId:O,envId:q,metadata:{mediaRecordingUid:J,questionId:Q,responseGroupUid:A,surveyId:N,mediaType:G}});const ie={surveyId:N,updatedAt:new Date().toISOString(),mediaType:G,mediaRecordingUid:J};Q&&(ie.questionId=Q),A&&(ie.responseGroupUid=A),O&&(ie.visitorId=O);const j=await(async()=>{const R=await fetch(`${u}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)});if(R.ok){const U=await R.json();return C&&C(P.UPLOAD_STARTED,{[P.UPLOAD_ID]:U.upload.id,[P.MEDIA_TYPE]:G,[P.MEDIA_RECORDING_UID]:J}),U.upload.url}return C&&C(P.ERROR,{type:P.OTHER,response:R}),ne(new Error("failed to get upload response with url"),"finishRecord",u,T,O,q),null})();j&&(X=_.document.defaultView.UpChunk.createUpload({endpoint:j,file:new _.document.defaultView.File([l.recordedData],`recording ${G} ${Date.now()}`),chunkSize:5120}),X.startTime=Date.now(),te({event:"Video Upload Start",apiBase:u,headers:T,visitorId:O,envId:q,metadata:{mediaRecordingUid:J,questionId:Q,responseGroupUid:A,surveyId:N,mediaType:G,url:j}}),X.on("error",R=>{S(l.uploadProgressLabel,"none"),C&&C(P.UPLOAD_FINISHED,{[P.MEDIA_RECORDING_UID]:J}),ne(R,"finishRecord",u,T,O,q)}),X.on("progress",R=>{C&&C(P.UPLOAD_PROGRESS,{[P.MEDIA_RECORDING_UID]:J,[P.UPLOAD_PROGRESS_PCT]:R.detail}),S(l.uploadProgressLabel,"progress",R.detail)}),X.on("success",()=>{S(l.uploadProgressLabel,"success"),C&&C(P.UPLOAD_FINISHED,{[P.MEDIA_RECORDING_UID]:J}),te({event:"Video Upload Success",apiBase:u,headers:T,visitorId:O,envId:q,metadata:{mediaRecordingUid:J,questionId:Q,responseGroupUid:A,surveyId:N,mediaType:G,url:j,elapsedMs:X.startTime&&Date.now()-X.startTime}})}))})})(a,r,i,Re,d);const k=[{name:"microphone"}];!a.cameraOff&&k.push({name:"camera"}),Promise.all(k.map(l=>{var u;return(u=navigator==null?void 0:navigator.permissions)==null?void 0:u.query(l)})).then(l=>{l.reduce((u,C)=>u&C.state==="granted",!0)&&a&&(a.deviceButton&&a.deviceButton.hide(),a.record().getDevice())}).catch(l=>{})},He=(n,o=3)=>{const t=_.document.getElementById("ul-recording-countdown-screen");t&&o===0?(t.remove(),n.record().start()):t&&(t.innerHTML=`<span class='ul-countdown-text'>Recording in... ${o}</span>`,setTimeout(()=>{He(n,o-1)},1e3))},$e=n=>{const o=_.document.createElement("div");return o.className="ul-video-container",o.appendChild((t=>{const r=_.document.createElement("div");return r.className="ul-video-player-loading",r.id=we(t),["first","second","third","fourth"].map(i=>{const s=_.document.createElement("div");s.className=i,r.appendChild(s)}),r})(n)),o},ye=(n,o)=>{const t=_.document.createElement("video");t.id=n,t.className="video-js vjs-default-skin ul-video-player-video";const r=_.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const i=_.document.createElement("a");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},nn=(n,o)=>{n.children()[0].classList.remove("vjs-hidden"),n.audioPlayerPlaceholder.hide(),_.document.getElementById(`${n.id()}_html5_api`).style.height="100%"},ce=(n,o)=>_.document.getElementById(n)?o?_.videojs(n,o):_.videojs(n):(console.error(`Error in finding player element with ID, ${n}`),null),tn=(n,o,t,r=!1,i="https://api.sprig.com",s=document,d=null,p=null)=>{_.document=s;const a=n+Oe,v=$e(a);return _.document.addEventListener("securitypolicyviolation",y=>{ne(new Error(`Voice & Video feature violates ${y.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),qe(Ne,()=>{_.document.getElementById(we(a)).remove(),ye(a,v);const y={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const c=n+Ie;ye(c,v);const h=ce(a,y),w=ce(c,{muted:!0,...y});if(!h||!w)return;((f,D,M)=>{f.addClass(`ul${Ie}`);const B=new(_.videojs.getComponent("Component"))(f);D&&f.src(D),f.addChild(B),M&&M(f)})(w,d,p),d||w.addClass(Z);const x=Ue(h,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),b=x.children().find(f=>f.name_==="FullscreenToggle");b.hasClass("vjs-disabled")&&b.hide(),Ae(h,x,o,t,r,w)}catch(c){return void ne(new Error(`Error when creating video player object ${c}`),"playerDeviceError",i,{})}}),v},rn=n=>{if(!n)return null;const o=n.match(/https:\/\/stream.mux.com\/(.*)/);let t=o?o[1]:null;return t.includes(_e)&&(t=t.replace(_e,"")),t?`https://image.mux.com/${t}/thumbnail.jpg?time=0`:null},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"},K={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},on=({properties:n,surveyVideoUrl:o,questionId:t})=>{const r=`ul-card-video__question_player-q${t}`,{apiURL:i,viewDocument:s}=e.useConfig(d=>({apiURL:d.apiURL,viewDocument:d.viewDocument}));return e.u("div",{id:r,ref:d=>{if(d&&d.children.length===0&&!n.properties.hideRecordedPrompt){const p=tn(r,{src:o,type:"application/x-mpegURL"},void 0,n.properties.mediaType===P.MEDIA_TYPE_AUDIO,i,s);d.appendChild(p)}}})},oe=({isDisabled:n,onClick:o,children:t})=>e.u(E.Button,{className:"ul-card__button-checkmark",disabled:n,onClick:o,type:"button",children:[e.u("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#ffffff",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),t||"Ok"]}),sn=({className:n,next:o,properties:t,questionId:r,type:i})=>{const{useMobileStyling:s,border:d}=e.useConfig(I=>({useMobileStyling:I.useMobileStyling,border:I.border})),[p,a]=e.h(!1),[v,y]=e.h(""),[c,h]=e.h(!1),w=t==null?void 0:t.collectName,x=(t==null?void 0:t.nameLabelText)||"Full Name",b=(t==null?void 0:t.consentText)||"I agree to the stated conditions",f=(t==null?void 0:t.submitButtonText)||"Submit",D=!!v.trim(),M=p&&(!w||D),B=(I,$=!1)=>{I.preventDefault(),I.stopPropagation();let H=null;if(!$){if(!M)return void h(!0);H={submitted:!0},w&&(H.name=v)}o({value:H,questionId:r,type:i},!!$||M)};return e.u("div",{className:e.cc(n,"ul-card__consent-legal","fade-in-transition"),children:e.u(E.MobileEmbedView,{embeddedType:"pdf",properties:t,children:e.u(E.QuestionBodyFooterContainer,{children:[e.u("div",{className:"sprig-stretch",children:[e.u(E.Option,{allowTextEntry:!1,border:d,error:c&&!p,id:"consent",isRadio:!1,isSelected:p,label:b,onUserInputChanged:({selected:I})=>{I!==p&&a(!p)},useMobileStyling:s}),w&&e.u("input",{"aria-label":x,"aria-placeholder":x,className:e.cc(e.getClasses("ul-consent-legal__name-input",s)),"data-gramm":"false",maxLength:250,name:"name",onBlur:I=>{I.currentTarget.style.borderColor=c&&!D?W.ERROR_BORDER_COLOR:W.DEFAULT_BORDER_COLOR},onFocus:I=>{I.currentTarget.style.borderColor=c&&!D?W.ERROR_BORDER_COLOR:d},onInput:I=>{I.preventDefault(),I.stopPropagation(),y(I.currentTarget.value)},placeholder:x,style:c&&!D?{borderColor:W.ERROR_BORDER_COLOR}:{},tabIndex:0,value:v})]}),e.u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[e.u(oe,{isDisabled:!M,onClick:I=>B(new SubmitEvent(I.type)),children:e.getButtonText({buttonText:f})}),t.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:I=>B(new SubmitEvent(I.type),!0),children:e.getSkipButtonText(t)})]})]})})},r)},an=()=>{const{destroy:n,forceBrandedLogo:o}=e.useConfig(t=>({destroy:t.destroy,forceBrandedLogo:t.forceBrandedLogo}));return e.p(()=>{setTimeout(()=>{n(W.APP_ID)},o?4e3:2e3)},[n,o]),e.u("div",{className:"end-of-survey-text",children:"End of survey"})},ln=({activeValue:n,border:o,icon:t,enableCspTrustedTypes:r,isPressed:i,range:s,scaleLabelType:d,selectedValue:p,setSelectedValue:a,setActiveValue:v,setIsPressed:y,useMobileStyling:c,value:h,viewDocument:w})=>{const x=`option-${h}`,b=d==="number",f=d==="star",D=d==="smiley",M=b&&h===n||h===p,[B,I]=(()=>{const m=f&&p!==null&&h<=p;return f&&h<=n||D&&h===n||m||h===n||h===p?[o,i||m||h===p?1:.3]:["",1]})(),$=e.F(()=>{const m={borderColor:M?B:"",fillOpacity:M?"":I,zIndex:M?3:"auto",color:p===h?"#fff":""};return b?{...m,backgroundColor:p===h?B:""}:{...m,color:f||D||p===h?B:""}},[M,B,I,p,h,b,f,D]),H=e.F(()=>W.getHtml((({icon:m,scaleLabelType:g,value:k,selectedValue:l})=>{if(g==="smiley"&&k===l){let u=0;return m.replace(/black/g,()=>++u==1?"black":"white")}return m})({icon:t,scaleLabelType:d,value:h,selectedValue:p}),r),[r,t,d,p,h]);return e.u("button",{"aria-label":b?void 0:String(h),className:(()=>{switch(d){case"star":return e.cc(e.getClasses("likert-star",c),e.getClasses(`likert-star-${h}`,c));case"smiley":return e.cc(e.getClasses("likert-smiley",c),e.getClasses(`likert-smiley-${h}`,c));default:return h===s?e.cc(e.getClasses("likert-number",c),e.getClasses(`likert-number-${h}`,c),e.getClasses("likert-last-option",c)):e.cc(e.getClasses("likert-number",c),e.getClasses(`likert-number-${h}`,c))}})(),dangerouslySetInnerHTML:{__html:H},id:x,onClick:m=>{m.preventDefault(),m.stopPropagation(),a(h)},onKeyDown:m=>{var l,u;const g=w.querySelectorAll(`.likert-${d??"number"}`),k=h-1;m.key==="ArrowRight"?(l=g[k+1])==null||l.focus():m.key==="ArrowLeft"?(u=g[k-1])==null||u.focus():m.key!=="Enter"&&m.key!==" "||(m.preventDefault(),m.stopPropagation(),a(h))},onPointerDown:()=>y(!0),onPointerEnter:()=>v(h),onPointerLeave:()=>{v(-1),y(!1)},style:$,tabIndex:0})},dn=({className:n,labels:o,next:t,properties:r,questionId:i,type:s})=>{const{border:d,useMobileStyling:p,viewDocument:a,enableCspTrustedTypes:v}=e.useConfig(g=>({border:g.border,useMobileStyling:g.useMobileStyling,viewDocument:g.viewDocument,enableCspTrustedTypes:g.enableCspTrustedTypes})),[y,c]=e.h(-1),[h,w]=e.h(!1),[x,b]=e.h(null),f=o&&o.left,D=o&&o.right;let M;const{range:B,scaleLabelType:I,ratingIcons:$}=r;B&&(M=Number(B));const H=M||5,m=g=>{var k,l;switch(I){case"star":return(k=$[0])==null?void 0:k.svg;case"smiley":return(l=$[g])==null?void 0:l.svg;default:return String(g+1)}};return e.u("form",{className:e.cc(n,"ul-card--likert","fade-in-transition"),children:e.u(E.MobileEmbedView,{properties:r,children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{"aria-label":`Rating (1 - ${H})`,className:"ul-card--likert__numbers",role:"radiogroup",children:[...Array(H)].map((g,k)=>{const l=k+1;return e.u(ln,{activeValue:y,border:d,enableCspTrustedTypes:v,icon:m(k),isPressed:h,range:H,scaleLabelType:I,selectedValue:x,setActiveValue:c,setIsPressed:w,setSelectedValue:b,useMobileStyling:p,value:l,viewDocument:a},k)})}),e.u("div",{className:"ul-card--likert__labels",children:[e.u("span",{children:f}),e.u("span",{children:D})]})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:x===null&&r.required,onClick:()=>t({value:x,questionId:i,type:s},!0),children:e.getButtonText(r)})})]})},i)},cn=({columns:n,onSelect:o,options:t,selectedOptions:r})=>{const i=e._([]),{border:s,useMobileStyling:d}=e.useConfig(h=>({border:h.border,useMobileStyling:h.useMobileStyling})),p=t.findIndex(h=>r[h.id]===null),[a,v]=e.h(p),y=e.T((h,w)=>{o(h,w);const x=a+1,b=t[x];b&&r[b.id]===null&&v(x)},[o,t,r,a]),c=e.T((h,w)=>{const x=a===h;return e.u(e.Accordion,{animate:!0,header:w.label,isOpen:x,onClick:()=>{var b;return v(x&&!((b=window.UserLeap)!=null&&b.isMobileSDK)?-1:h)},ref:b=>{b&&(i.current[h]=b)},showHeaderCheck:r[w.id]!==null,children:e.u("div",{style:{paddingTop:"12px"},children:n.map(b=>e.u(E.Option,{allowTextEntry:!1,ariaLabel:`${w.label}-${b.label}`,border:s,error:!1,id:`${w.id}-${b.value}`,isRadio:!0,isSelected:r[w.id]===b.value,label:b.label,onUserInputChanged:()=>y(w.id,b.value),useMobileStyling:d},b.label))})},w.id)},[s,n,a,y,r,d]);return e.u("div",{children:t.map((h,w)=>c(w,h))})},un=({className:n,next:o,options:t,properties:r,questionId:i,type:s,onSubmitButtonClick:d})=>{const p=r.matrixColumn,a=r.required,v=x=>{x.preventDefault(),x.stopPropagation(),o({value:c,questionId:i,type:s},!0),d&&d()},y=t.reduce((x,b)=>(x[b.id]=null,x),{}),[c,h]=e.h(y);return e.u("form",{className:e.cc(n,"ul-card__matrix","fade-in-transition"),id:"text-form",onSubmit:v,children:e.u(E.MobileEmbedView,{properties:r,children:[e.u(E.QuestionBodyWrapper,{children:e.u(cn,{columns:p,onSelect:(x,b)=>{h(f=>({...f,[x]:b}))},options:t,selectedOptions:c})}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:(w=c,a&&Object.values(w).every(x=>x==null)),onClick:()=>v(new SubmitEvent("submit")),children:e.getButtonText(r)})})]})},i);var w},Ve=({className:n,onSubmit:o,options:t=[],properties:r,questionId:i,type:s,showIndividualSubmit:d=!1,onSubmitButtonClick:p})=>{const{border:a,useMobileStyling:v}=e.useConfig(l=>({border:l.border,useMobileStyling:l.useMobileStyling})),y=t.reduce((l,u)=>(l[u.id]={isSelected:!1},l),{}),[c,h]=e.h(y),w=s==="multiplechoice",x=r.required,b=t.find(l=>{var u;return(u=l.optionProperties)==null?void 0:u.noneOfTheAbove}),f=l=>Object.entries(l).some(([u,C])=>{var N;const S=t.find(A=>`${A.id}`===u),T=C.userText===void 0||C.userText.trim()==="";return((N=S==null?void 0:S.optionProperties)==null?void 0:N.allowsTextEntry)&&T&&C.isSelected}),D=l=>Object.values(l).filter(u=>u.isSelected).length,M=r.minSelect&&r.minSelect>0&&r.maxSelectMode===e.MaxSelectModes.Range&&D(c)<r.minSelect&&(x||D(c)>0),B=l=>f(l)||x&&!D(l)||!(u=>{const{minSelect:C=0,maxSelect:S=1/0,maxSelectMode:T}=r,N=D(u);switch(T){case e.MaxSelectModes.Maximum:return N<=S;case e.MaxSelectModes.Range:return N===0||N>=C;default:return!0}})(l),I=Object.entries(c).some(([l,u])=>{var C,S;return u.isSelected&&((S=(C=t.find(T=>`${T.id}`===l))==null?void 0:C.optionProperties)==null?void 0:S.allowsTextEntry)}),$=d&&(!w||I),H=l=>{k(l.id,l.selected,l.userText,l.noneOfTheAbove)},m=l=>{var u;return(r==null?void 0:r.maxSelectMode)!==e.MaxSelectModes.Unlimited&&D(c)===(r==null?void 0:r.maxSelect)&&!((u=c[l])!=null&&u.isSelected)},g=()=>{o(c,!0),p&&p()},k=(l,u,C,S)=>{const T=Object.assign({},c);if((w||S)&&u)for(const N of Object.values(T))N.isSelected=!1,delete N.userText;else b&&!S&&c[b.id].isSelected&&(T[b.id].isSelected=!1);T[l]={isSelected:u,userText:C},h(T)};return e.u("form",{className:e.cc(n,"ul-card--multiple","fade-in-transition"),id:"text-form",onSubmit:g,children:e.u(E.MobileEmbedView,{properties:r,children:[e.u(E.QuestionBodyWrapper,{children:[r.isDropdown?e.u(E.Select,{disabledOptions:t.filter(l=>m(l.id)),dropdownFooter:M?e.u("div",{className:"ul-card__min-select-counter",style:{marginLeft:"16px"},children:[D(c),"/",r.minSelect]}):void 0,isMultiSelect:!w,multiselectText:r.dropdownMultiselectedText??"choices selected",onChange:l=>{const u={...c};for(const C of t)l.includes(C)?u[C.id].isSelected=!0:u[C.id].isSelected=!1;h(u)},options:t,placeholderText:r.dropdownPlaceholderText??(w?"Select choice":"Select choice(s)"),value:t.filter(l=>c[l.id].isSelected)}):e.u("div",{className:e.cc(e.getClasses("ul-card__choices",v)),role:w?"radiogroup":"group",children:[t.map(({id:l,label:u,value:C,optionProperties:S})=>{var q,Q;const T=`${l}`,{allowsTextEntry:N,noneOfTheAbove:A}={allowsTextEntry:!1,noneOfTheAbove:!1,...S};return e.u(E.Option,{allowTextEntry:N,border:a,disabled:m(T),error:(O=c,f(O)),id:T,isRadio:w,isSelected:!!((q=c[T])!=null&&q.isSelected),label:u,noneOfTheAbove:A,onUserInputChanged:H,promptText:(S==null?void 0:S.otherOptionPlaceholder)||"Please specify",text:(Q=c[l])==null?void 0:Q.userText,useMobileStyling:v,value:C},T);var O}),!!M&&e.u("div",{className:"ul-card__min-select-counter",children:[D(c),"/",r.minSelect]})]}),$&&e.u(E.LongformSubmitButton,{handleSubmit:g,isSubmitDisabled:B(c)})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:B(c),onClick:g,children:e.getButtonText(r)})})]})},i)},pn=n=>{const{questionId:o,type:t,next:r,options:i}=n;return e.u(Ve,{...n,onSubmit:(s,d)=>{const p=Object.entries(s).find(([,h])=>h.isSelected)||[void 0,void 0],[a,v]=p,y=i.find(h=>`${h.id}`===a),c=v!=null&&v.userText?{[a]:{userText:v.userText}}:null;r({value:y&&a?{[a]:y.value}:{},secondaryValue:c,questionId:o,type:t},d)}})},mn=n=>{const{questionId:o,type:t,next:r}=n;return e.u(Ve,{...n,onSubmit:(i,s)=>{const d=Object.entries(i).reduce((a,[v,y])=>(a[v]=y.isSelected,a),{}),p=Object.entries(i).reduce((a,[v,y])=>{if(!y.userText)return a;const c=a||{};return c[v]={userText:y.userText},c},null);r({value:d,secondaryValue:p,questionId:o,type:t},s)}})},vn=({className:n,labels:o,properties:t,next:r,questionId:i,type:s})=>{const[d,p]=e.h(null),{border:a,useMobileStyling:v,viewDocument:y}=e.useConfig(w=>({border:w.border,useMobileStyling:w.useMobileStyling,viewDocument:w.viewDocument})),c=o&&o.left,h=o&&o.right;return e.u("form",{className:e.cc(n,"ul-card--nps","fade-in-transition"),children:e.u(E.MobileEmbedView,{properties:t,children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--nps__numbers",children:[...Array(11)].map((w,x)=>e.u("button",{className:e.cc(e.getClasses("nps-number",v),e.getClasses(`nps-number-${x}`,v)),id:`option-${x}`,onClick:b=>{b.preventDefault(),b.stopPropagation(),p(x)},onKeyDown:b=>{var D,M;const f=y.querySelectorAll("button.nps-number");b.key==="ArrowRight"?(D=f[x+1])==null||D.focus():b.key==="ArrowLeft"?(M=f[x-1])==null||M.focus():b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),b.stopPropagation(),p(x))},onPointerDown:b=>{b.currentTarget.style.zIndex="2",b.currentTarget.style.borderColor=a},onPointerLeave:b=>{b.currentTarget.style.zIndex="auto",b.currentTarget.style.borderColor=W.DEFAULT_BORDER_COLOR},style:d===x?{backgroundColor:a,color:"#fff"}:void 0,tabIndex:0,children:x},x))}),e.u("div",{className:"ul-card--nps__labels",children:[e.u("span",{children:c}),e.u("span",{children:h})]})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:d===null&&t.required,onClick:()=>r({value:d,questionId:i,type:s},!0),children:e.getButtonText(t)})})]})},i)},gn=({className:n,next:o,properties:t,questionId:r,type:i,onSubmitButtonClick:s})=>{const{border:d,useMobileStyling:p,update:a}=e.useConfig(f=>({border:f.border,useMobileStyling:f.useMobileStyling,update:f.update})),[v,y]=e.h(""),c=e._(null),h=v.trim(),w=t.required===!0&&!h,x=E.useAutoSize(c,()=>a()),b=t&&t.openTextPlaceholder?t.openTextPlaceholder:"";return e.u("form",{className:e.cc(n,"ul-card-text","fade-in-transition"),id:"text-form",children:e.u(E.MobileEmbedView,{properties:t,children:e.u("div",{className:"ul-card-text",children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card-text__container",children:e.u("textarea",{"aria-describedby":"ul-caption","aria-labelledby":"ul-question","aria-multiline":"true","aria-placeholder":b,className:e.cc(e.getClasses("ul-card-text__input",p)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:f=>{f.currentTarget.style.borderColor=W.DEFAULT_BORDER_COLOR},onChange:f=>{const{value:D}=f.currentTarget;x(),f.preventDefault(),f.stopPropagation(),y(D)},onFocus:f=>{f.currentTarget.style.borderColor=d},placeholder:b,ref:c,role:"textbox",tabIndex:0})}),t.footerHtml&&e.u(E.Html,{className:"footer",html:t.footerHtml})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:w,onClick:f=>{f.preventDefault(),f.stopPropagation();const D=t.required!==!0||h.length>0;o({value:v,questionId:r,type:i},D),s&&s()},children:e.getButtonText(t)})})]})})},r)},hn=({className:n,labels:o,next:t,properties:r,questionId:i,type:s,onSubmitButtonClick:d,options:p})=>{const a=e._(null),v=e._(0),y=e._(0),c=e._(null),h=e._(!1),w=e._([]),[x,b]=e.h(()=>(r==null?void 0:r.required)===!0),[f,D]=e.h(()=>p.map(j=>({...j,rank:null}))),M=e.F(()=>Array.from({length:p.length},(j,R)=>R+1),[p.length]),{useMobileStyling:B,isPreview:I,headers:$}=e.useConfig(j=>({useMobileStyling:j.useMobileStyling,isPreview:j.isPreview,headers:j.headers})),H=($==null?void 0:$["userleap-platform"])==="android",m=B&&!I&&!H,g=!m&&!H,k=(j,R)=>{D(U=>{const L=parseInt(R),F=U.map(V=>({...V}));F.some(V=>V.rank==null)&&F.forEach((V,se)=>V.rank=se+1);const Y=F.findIndex(V=>V.id===j);if(Y===-1)return U;const z=F[Y].rank;return L<z?F.forEach(V=>{V.id!==j&&V.rank>=L&&V.rank<z&&(V.rank=V.rank+1)}):L>z&&F.forEach(V=>{V.id!==j&&V.rank>z&&V.rank<=L&&(V.rank=V.rank-1)}),F[Y].rank=L,F.sort((V,se)=>V.rank-se.rank),A(),F})},l=(j,R)=>{for(let U=0;U<w.current.length;U++){const L=w.current[U];if(!L||L===c.current)continue;const F=L.getBoundingClientRect();if(j>=F.left&&j<=F.right&&R>=F.top&&R<=F.bottom)return{element:L,index:U}}return null},u=j=>R=>{if(!m)return;R.preventDefault(),R.stopPropagation(),h.current=!0,a.current=j;const U=R.touches[0];v.current=U.clientY,y.current=U.clientY;const L=R.currentTarget.closest(".ul-card-rank__option");L&&(c.current=L,L.classList.add("is-dragging"))},C=j=>{if(!m||!h.current||a.current===null)return;j.preventDefault(),j.stopPropagation();const R=j.touches[0];y.current=R.clientY;const U=y.current-v.current;c.current&&(c.current.style.transform=`translateY(${U}px)`,c.current.style.zIndex="1000"),w.current.forEach(F=>{F&&F!==c.current&&F.classList.remove("is-drop-target")});const L=l(R.clientX,R.clientY);L&&L.element.classList.add("is-drop-target")},S=j=>{if(!m||!h.current||a.current===null)return;j.preventDefault(),j.stopPropagation();const R=j.changedTouches[0],U=l(R.clientX,R.clientY);c.current&&(c.current.style.transform="",c.current.style.zIndex="",c.current.classList.remove("is-dragging")),w.current.forEach(L=>{L&&L.classList.remove("is-drop-target")}),U&&U.index!==a.current&&T(a.current,U.index),a.current=null,c.current=null,h.current=!1},T=(j,R)=>{D(U=>{const L=U.map(Y=>({...Y})),[F]=L.splice(j,1);return L.splice(R,0,F),L.forEach((Y,z)=>{Y.rank=z+1}),A(),L})},N=j=>{const R={};j.reduce((U,L)=>(U[L.id]=L.rank,U),R),t({value:R,questionId:i,type:s},!0)},A=()=>{b(!1)},{left:O,right:q}=o,Q=p.length,G=j=>{j.preventDefault(),j.currentTarget.classList.add("is-drop-target")},J=j=>{j.currentTarget.classList.remove("is-drop-target")},ie=j=>{a.current=null,j.currentTarget.classList.remove("is-dragging")};return e.u("form",{className:e.cc(n,"ul-card-rank","fade-in-transition"),onSubmit:j=>{j.preventDefault(),N(f),d&&d()},children:e.u(E.MobileEmbedView,{properties:r,children:H?e.u(e.g,{children:[e.u(E.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",O]})}),e.u("ol",{className:"ul-card-rank__list",children:f.map(({id:j,label:R,rank:U})=>e.u("li",{className:"ul-card-rank__option",children:[e.u("select",{"aria-label":`Rank for ${R}`,className:e.cc("ul-card-rank__select",U==null&&"ul-card-rank__select--placeholder"),name:`rank[${j}]`,onChange:L=>k(j,L.currentTarget.value),value:U??"",children:[U==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),M.map(L=>e.u("option",{className:"ul-card-rank__select-option",value:L,children:L},`${L}-${i}`))]}),e.u("span",{children:R})]},j))}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[Q," - ",q]})})]})}),e.u(E.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(E.Button,{disabled:x,children:e.getButtonText(r)})})})]}):e.u(e.g,{children:[e.u(E.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",O]})}),e.u("ol",{className:"ul-card-rank__list",onDragOver:H?void 0:j=>{j.preventDefault(),j.dataTransfer&&(j.dataTransfer.dropEffect="move")},children:f.map(({id:j,label:R,rank:U},L)=>{return e.u("li",{className:"ul-card-rank__option",draggable:!!g||void 0,onDragEnd:g?ie:void 0,onDragEnter:g?G:void 0,onDragLeave:g?J:void 0,onDragStart:g?(Y=L,z=>{a.current=Y,z.dataTransfer&&(z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("text/plain",String(Y)),z.currentTarget.classList.add("is-dragging"))}):void 0,onDrop:g?(F=L,z=>{var se,Te;z.preventDefault(),z.currentTarget.classList.remove("is-drop-target");const V=a.current;a.current=null,(Te=(se=z.currentTarget.closest(".ul-card-rank__list"))==null?void 0:se.querySelector(".is-dragging"))==null||Te.classList.remove("is-dragging"),V!=null&&V!==F&&T(V,F)}):void 0,ref:z=>w.current[L]=z,children:[e.u("select",{"aria-label":`Rank for ${R}`,className:e.cc("ul-card-rank__select",U==null&&"ul-card-rank__select--placeholder"),name:`rank[${j}]`,onChange:z=>k(j,z.currentTarget.value),value:U??"",children:[U==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),M.map(z=>e.u("option",{className:"ul-card-rank__select-option",value:z,children:z},z))]}),e.u("span",{children:R}),!H&&e.u("button",{"aria-label":`Drag ${R} to reorder`,className:"ul-card-rank__drag-btn",onTouchEnd:m?S:void 0,onTouchMove:m?C:void 0,onTouchStart:m?u(L):void 0,title:"Drag to reorder",type:"button",children:e.u("svg",{fill:"none",height:"17",viewBox:"0 0 16 17",width:"16",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z",fill:"currentColor"})})})]},j);var F,Y})}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[Q," - ",q]})})]})}),e.u(E.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(E.Button,{disabled:x,children:e.getButtonText(r)})})})]})})},i)},Ce=1,Fe=2,ze=3,ue=n=>n.type==="av_permission",Le=n=>n.type==="screen_permission",Qe=(n,o)=>n===void 0?Ce:n?((t,r)=>!(ue(r)?r.permissionDescriptors:[]).includes("camera")||t.getVideoTracks().length>0)(n,o)?ze:Ce:Fe,Pe={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},ee=e.create(n=>({...Pe,reset:()=>{n(Pe)},updatePage:o=>{n(o)}}));function xe({currentPage:n,pages:o}){const{avStream:t,recordingMediaTypes:r,updatePage:i}=ee.getState(),{recorderEventEmitter:s}=e.useConfig.getState();s.emit("av.permission",{"permission.descriptors":n.permissionDescriptors,"stream.ready":(d,p)=>{if(t===d)return;let a=n;if(d&&!n.permissionDescriptors.includes("camera")){const v=o.indexOf(n),y=p!=null&&p.active?v+2:v+1;p!=null&&p.active&&r&&s.emit("begin.recording",{"recording.media.types":r,"start.recording.callback":c=>i({mediaRecordingUids:c})}),a=o[y]}i({currentPage:a,avStream:d})}})}function ke({status:n}){const{nextQuestion:o,passthroughData:t,mediaRecordingUids:r,reset:i}=ee.getState(),{recorderEventEmitter:s,handleUploadUpdate:d,index:p}=e.useConfig.getState(),a={value:{taskStatus:n},type:"recordedtask",questionId:(t==null?void 0:t.questionId)||1};t&&s.emit("finish.task",{"begin.callback":v=>{d({mediaRecordingUid:v,isSubmitted:!0,progressPct:0,isComplete:!1})},"progress.callback":(v,y)=>{d({mediaRecordingUid:v,progressPct:y.detail,isSubmitted:!1,isComplete:!1})},"upload.callback":v=>{v&&d({mediaRecordingUid:v,isComplete:!0,isSubmitted:!0,progressPct:100})},"passthrough.data":t,"current.index":p,"task.response":a,"task.complete.callback":v=>{a.value.taskDurationMillisecond=v,r&&(a.value.mediaRecordingUids=r),i(),o(a)}})}function Ee({pages:n,setIsRequestingPermission:o}){const{recorderEventEmitter:t,eventEmitFn:r}=e.useConfig.getState(),{updatePage:i,currentPage:s,recordingMediaTypes:d,screenPermissionRequested:p}=ee.getState();if(!s)return;const a=n.indexOf(s);switch(s.type){case"av_permission":{const v=p?a+2:a+1;return p&&d&&t.emit("begin.recording",{"recording.media.types":d,"start.recording.callback":y=>{i({mediaRecordingUids:y})}}),void i({currentPage:n[v]})}case"screen_permission":return void t.emit("screen.permission",{"screen.permission.requested":o,"stream.ready.callback":(v,y)=>{const c=y?n[a+1]:s;y&&d&&t.emit("begin.recording",{"recording.media.types":d,"start.recording.callback":h=>{i({captureStream:y,mediaRecordingUids:h})}}),i({currentPage:c,screenPermissionRequested:!0,captureStream:y})}});case"start_task":return r("recorded.task.start"),t.emit("recorded.task.start"),t.emit("start.task"),void i({currentPage:n[a+1],screenPermissionRequested:!0});case"complete_task":return}}const Ge="ul-permission-graphics-container",Ze="ul-permission-body",We=e.cc(Ge,"ul_recorded-task-inset-spacing"),pe=e.cc("ul-horizontal-button-container","ul-horizontal-button-container-left"),Ye=({richTextBody:n})=>e.u(E.Html,{className:"ul-rich-text-body",html:n,id:"ul-task-detail-container"}),me=({required:n,skipButtonText:o,bottom:t=!1})=>n?null:e.u(E.Button,{className:e.cc(t&&"ul-skip-button-below","ul-button-inactive"),onClick:ke.bind(null,{status:"abandoned"}),children:o||"Skip"}),je=n=>{const{avStream:o,captureStream:t,recordingMediaTypes:r,updatePage:i}=ee.getState(),s=(r==null?void 0:r.includes("audio"))||(r==null?void 0:r.includes("video"));e.p(()=>{const d=setInterval(()=>{s&&o&&!o.active?i({avStream:null,currentPage:n[0]}):t&&t.active||i({captureStream:void 0,currentPage:n[s?1:0]})},1e3);return()=>clearInterval(d)},[o,t,s,n,r,i])},bn=({content:n,pages:o,required:t})=>{const{buttonText:r,skipButtonText:i,taskDetail:s}=n;return je(o),e.u("div",{className:"ul-task-page",children:[s&&e.u(Ye,{richTextBody:s}),e.u("div",{className:pe,children:[e.u(E.Button,{onClick:Ee.bind(null,{pages:o}),children:r}),e.u(me,{required:t,skipButtonText:i})]})]},"start-task")},fn=({content:n,pages:o,properties:t})=>{const{buttonText:r,skipButtonText:i}=n;return je(o),e.u("div",{className:"ul-task-page",children:[n.taskDetail&&e.u(Ye,{richTextBody:n.taskDetail}),e.u(E.MobileEmbedView,{properties:t,children:e.u("div",{className:pe,children:[e.u(E.Button,{className:"ul-complete-task-button",onClick:ke.bind(null,{status:"completed"}),children:r}),e.u(E.Button,{className:e.cc("ul-button-inactive"),onClick:ke.bind(null,{status:"given.up"}),children:i})]})})]},"complete-task")},yn=({content:n,pages:o,required:t})=>{const{buttonText:r,skipButtonText:i}=n,[s]=e.useConfig(a=>[a.tabTitle]),[d,p]=e.h(!1);return e.u("div",{children:[e.u("div",{className:We,children:[e.u("p",{style:{marginTop:"auto"},children:n.selectTabText}),e.u("div",{className:"ul-select-tab-container",children:e.u("p",{className:Ze,children:s})})]}),e.u("div",{className:t?"":pe,children:[e.u(E.Button,{disabled:d,onClick:Ee.bind(null,{pages:o,setIsRequestingPermission:p}),children:r}),e.u(me,{required:t,skipButtonText:i})]})]})},Cn=({content:n})=>e.u(E.Html,{className:e.cc(Ge,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"),html:n.svg},"ul-permission-request-graphic"),xn=({content:n,pages:o,required:t})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:i,skipButtonText:s,tryAgainButtonText:d}=n,p=ue(o[0])?o[0]:null;return e.p(()=>{const a=setInterval(()=>{p!==null&&xe({currentPage:p,pages:o})},1e3);return()=>clearInterval(a)},[p,o]),p?e.u("div",{children:[e.u("div",{className:We,children:e.u("p",{className:"ul-av-permission-denied-paragraph",children:[e.u("span",{className:"ul-av-permission-denied-headline",children:r}),e.u("span",{className:Ze,children:i})]})}),e.u("div",{className:pe,children:[e.u(E.Button,{onClick:xe.bind(null,{currentPage:p,pages:o}),children:d}),e.u(me,{required:t,skipButtonText:s})]})]}):null},kn=({stream:n})=>e.u("video",{autoPlay:!0,className:e.cc("ul_recorded-task-inset-spacing"),id:"ul-record-task-video-preview",muted:!0,ref:o=>{o&&(o.srcObject=n||null)}}),wn=({content:n,pages:o,required:t})=>{const{skipButtonText:r}=n,{avStream:i}=ee.getState();return je(o),e.u("div",{children:[e.u(kn,{stream:i}),e.u("div",{className:"ul-vertical-button-container-center",children:[e.u(E.Button,{onClick:Ee.bind(null,{pages:o}),children:n.buttonText}),e.u(me,{bottom:!0,required:t,skipButtonText:r})]})]})},En=({properties:n})=>{const{pages:o,required:t}=n,{avStream:r,currentPage:i}=ee.getState();if(i===void 0)return null;switch(i==null?void 0:i.type){case"av_permission":{const s=Qe(r,i);return s===Ce?e.u(Cn,{content:i}):s===Fe?e.u(xn,{content:i,pages:o,required:t}):e.u(wn,{content:i,pages:o,required:t})}case"screen_permission":return e.u(yn,{content:i,pages:o,required:t});case"start_task":return e.u(bn,{content:i,pages:o,required:t});case"complete_task":return e.u(fn,{content:i,pages:o,properties:n});default:return null}},jn=({className:n,properties:o,next:t,questionId:r})=>{const i=e.useConfig(),{surveyId:s,responseGroupUid:d,userId:p}=i,a=ee(),{screenPermissionRequested:v}=a,y=ee(b=>b.avStream);let c=ee(b=>b.currentPage);c||(c=function({pages:b,userId:f,responseGroupUid:D,surveyId:M,questionId:B,next:I}){const{updatePage:$}=ee.getState(),{eventEmitFn:H,recorderEventEmitter:m}=e.useConfig.getState(),g={questionId:B,surveyId:M,visitorId:f,responseGroupUid:D};let k=0;m.emit("recorded.task.permission.screen"),H("recorded.task.permission.screen"),m.emit("permission.status",{"permission.status.callback":(u,C,S,T)=>{const N=b[k],{type:A}=N,O=["screen"];if(ue(N)){const{permissionDescriptors:q}=N,Q=q==null?void 0:q.includes("microphone"),G=q==null?void 0:q.includes("camera");Q&&O.push("audio"),G&&O.push("video"),(u!=null&&u.active&&!G||u!=null&&u.active&&C)&&k++}Le(b[k])&&S&&(k++,m.emit("begin.recording",{"recording.media.types":O,"start.recording.callback":q=>$({mediaRecordingUids:q})})),$({currentPage:b[k],avStream:u,screenPermissionRequested:S,nextQuestion:I,type:A,passthroughData:g,recordingMediaTypes:O,captureStream:T})}});const l=b[k];return l.type==="av_permission"&&xe({currentPage:l,pages:b}),l}({questionId:r,surveyId:s,next:b=>{t(b,!0)},pages:o.pages,responseGroupUid:d,userId:p}));let h=c.headline,w=c.captionText;const x=Qe(y,c);return Le(c)&&v&&(h=c.permissionDeniedHeadline,w=c.permissionDeniedCaptionText),ue(c)&&x===ze&&(h=c.permissionGrantedHeadline,w=c.permissionGrantedCaptionText),e.u("div",{className:e.cc(n,"ul-center-horizontally","fade-in-transition"),children:[e.u(E.Header,{isRequired:o==null?void 0:o.required,message:h,properties:{captionText:w}}),e.u(E.QuestionBodyWrapper,{children:e.u(En,{properties:o})})]})},Tn=({className:n,next:o,properties:t,questionId:r,type:i})=>{const{visitorAttributes:s,isLongFormSurvey:d}=e.useConfig(y=>({visitorAttributes:y.visitorAttributes,isLongFormSurvey:W.isLongFormSurvey(y.studyType)})),p=(y,c=!1)=>{o({value:c?{skipped:!0}:void 0,questionId:r,type:i},!0)},a=E.getAttributedUrl(t&&t.buttonUrl,s),v=d&&t.promptActionType===e.PromptActionTypeEnum.NO_BUTTON;return e.u("div",{className:e.cc(n,"ul-card__text-url-prompt","fade-in-transition"),children:e.u(E.MobileEmbedView,{properties:t,children:!v&&e.u("div",{children:e.u("div",{className:"ul-card-button-group",children:[e.u("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:a,id:"ul-card-text__button",onClick:p,onKeyPress:y=>{y.key!=="Enter"&&y.key!==" "||o({value:void 0,questionId:r,type:i},!0)},rel:"noreferrer",role:a?"link":"button",tabIndex:0,target:"_blank",children:e.getButtonText(t)}),t.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:y=>p(0,!0),children:e.getSkipButtonText(t)})]})})})},r)},_n=({className:n,questionId:o})=>{const{border:t,destroy:r,endCard:i,forceBrandedLogo:s}=e.useConfig(a=>({border:a.border,destroy:a.destroy,endCard:a.endCard,forceBrandedLogo:a.forceBrandedLogo}));e.p(()=>{setTimeout(()=>{r(W.APP_ID)},s?4e3:2e3)},[r,s]);const d=i&&i.subheader?e.u("p",{className:"ul-caption",children:i.subheader}):null,p=i&&i.headline?i.headline:"";return e.u("div",{className:e.cc(n,"ul-card--thanks","fade-in-transition"),children:e.u("div",{children:e.u("div",{className:"ul-card--thanks-content",children:[e.u("div",{className:"ul-thanks-check",children:e.u("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[e.u("path",{clipRule:"evenodd",d:"M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z",fill:t,fillRule:"evenodd"}),e.u("path",{clipRule:"evenodd",d:"M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z",fill:t,fillRule:"evenodd"}),e.u("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),e.u(E.Header,{message:p}),d]})})},o)},In=()=>e.u("div",{className:"thinking-dots-container",children:e.u("div",{className:"thinking-dot"})}),Dn=({className:n})=>{const{uploadProgress:o}=e.useConfig(s=>({uploadProgress:s.uploadProgress}));let t,r;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.");const i=Math.round(Math.min(99,...Object.values(o).filter(s=>s.isSubmitted).map(s=>s.progressPct||0)));return e.u("div",{className:e.cc(n,"ul-card--uploading","fade-in-transition"),children:[e.u("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:"ul-loading-spinner-container",role:"progressbar",children:e.u("div",{className:"ul-loading-spinner",children:[e.u("div",{className:"first"}),e.u("div",{className:"second"}),e.u("div",{className:"third"}),e.u("div",{className:"fourth"})]})}),e.u(E.Header,{message:`${t} (${i}% complete)`}),e.u("p",{className:"ul-caption",children:r})]})},Be=0,Me=1,Sn=({className:n,next:o,properties:t,questionId:r,type:i})=>{const s=`ul-card-video__player_recorder-q${r}`,{apiURL:d,envId:p,handleUploadUpdate:a,headers:v,responseGroupUid:y,surveyId:c,viewDocument:h,visitorId:w}=e.useConfig(g=>({apiURL:g.apiURL,envId:g.envId,handleUploadUpdate:g.handleUploadUpdate,headers:g.headers,responseGroupUid:g.responseGroupUid,surveyId:g.surveyId,viewDocument:g.viewDocument,visitorId:g.userId})),[x,b]=e.h(!1),[f,D]=e.h(null),[M,B]=e.h(null),[I,$]=e.h(Be),H=(g,k)=>{g===P.UPLOAD_STARTED?(D(k[P.UPLOAD_ID]),B(k[P.MEDIA_RECORDING_UID]),b(!0)):g===P.DELETE?(D(null),B(null),b(!1)):g===P.UPLOAD_PROGRESS?isNaN(k[P.UPLOAD_PROGRESS_PCT])?a({mediaRecordingUid:k[P.MEDIA_RECORDING_UID],isComplete:!0}):a({mediaRecordingUid:k[P.MEDIA_RECORDING_UID],progressPct:k[P.UPLOAD_PROGRESS_PCT]}):g===P.UPLOAD_FINISHED&&a({mediaRecordingUid:k[P.MEDIA_RECORDING_UID],isComplete:!0})},m=g=>{g.preventDefault(),g.stopPropagation(),document.getElementById(s)&&(k=>{const l=k+De;if(_.document.getElementById(l)&&_.videojs){try{if(!_.videojs(l).record().stream)return}catch{return}_.videojs(l).record().stop(),_.videojs(l).record().stopDevice()}})(s),f&&M?(a({mediaRecordingUid:M,isSubmitted:!0}),o({value:{mediaRecordingUid:M},questionId:r,type:i},!0)):o({value:null,questionId:r,type:i},!0)};return e.u("form",{className:e.cc(n,"ul-card--video","fade-in-transition"),id:"ul-video-interview-form",children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{id:"ul-question-player-container",style:{display:I===Be?"":"none"},children:e.u(E.MobileEmbedView,{properties:t,children:e.u("button",{className:"ul-video-btn ul-record-response-btn",onClick:g=>{g.preventDefault(),g.stopPropagation(),document.getElementById(s)&&(k=>{const l=ce(k+Oe);l==null||l.pause()})(s),$(Me)}})})}),e.u("div",{style:{display:I===Me?"block":"none"},children:e.u("div",{id:"ul-recorder-player-container",ref:g=>{if(g&&g.children.length===0){const k=((l,u={},C="https://api.userleap.com",S,T,N,A=!1,O=document)=>{_.document=O;const q=l+De,Q=$e(q);return _.document.addEventListener("securitypolicyviolation",G=>{ne(new Error(`Voice & Video feature violates ${G.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",C,N,u.visitorId,u.envId)}),qe(Ne.concat(Je),()=>{ye(q,Q),_.document.getElementById(we(q)).remove();try{en(Q,q,u,C,S,T,N,A)}catch(G){return void ne(new Error(`Error when creating video recorder player object ${G}`),"recorderDeviceError",C,N,u.visitorId,u.envId)}}),Q})(s,{surveyId:c,responseGroupUid:y,questionId:r,visitorId:w,envId:p},d,H,void 0,{...v,"x-ul-video-recorder-origin":"sdk"},t.mediaType===P.MEDIA_TYPE_AUDIO,h);g.appendChild(k)}}})})]}),e.u(E.QuestionBodyFooterContainer,{children:[e.u(oe,{isDisabled:!!t.required&&!x,onClick:m,children:e.getButtonText(t)}),e.u("button",{className:"ul-card-text__button ul-button-inactive ul-card-skip__button",id:"ul-card-video__skip_button",onClick:m,style:{...t.required?{display:"none"}:{},...x?{display:"none"}:{}},children:e.getSkipButtonText(t)})]})]})},le=n=>n.type==="aidynamicfollowup"||n.type==="aidynamicstandalone",fe=n=>{var o;return le(n)&&((o=n.props)==null?void 0:o.loading)===e.DynamicQuestionLoadingStates.inFlight},Ke=n=>n.type==="thanks"||n.type==="uploading",Rn=({card:n,avatars:o,isThinking:t,isCurrentQuestion:r,currentQuestionBubbleRef:i})=>{const s=(d=>"properties"in d.props&&d.props.properties&&"questionHtml"in d.props.properties&&d.props.properties.questionHtml?{content:d.props.properties.questionHtml,isHtml:!0}:"message"in d.props?{content:d.props.message,isHtml:!1}:{content:"Question",isHtml:!1})(n);return e.u(ae,{avatars:o,isLeft:!0,message:{id:`question-${n.name}`,type:"question",content:s.content},ref:r?i:null,children:t?e.u(In,{}):e.u(e.g,{children:[s.isHtml?e.u(E.Html,{className:"chat-message-text",html:s.content}):e.u("div",{className:"chat-message-text",children:s.content}),n.type==="videovoice"&&e.u(on,{properties:n.props,questionId:n.name,surveyVideoUrl:n.props.properties.videoUrl})]})})},Ln=({card:n,avatars:o})=>{const t=(r=>{if(!("properties"in r.props)||!r.props.properties||typeof r.props.properties!="object")return null;const i=r.props.properties,s=[{key:"captionHtml",isHtml:!0},{key:"captionText",isHtml:!1},{key:"richTextBody",isHtml:!0},{key:"body",isHtml:!1}];for(const{key:d,isHtml:p}of s){const a=i[d];if(typeof a!="string")continue;const v=a.trim();if(v){if(p&&!v.replaceAll(/<[^>]*>/g,"").trim())continue;return{content:v,isHtml:p}}}return null})(n);return t?e.u(ae,{avatars:o,hideAvatar:!0,isLeft:!0,message:{id:`caption-${n.name}`,type:"question",content:t.content},children:t.isHtml?e.u(E.Html,{className:"chat-message-text",html:t.content}):e.u("div",{className:"chat-message-text",children:t.content})}):null},Pn=({card:n,userResponse:o,avatars:t})=>{const r=((i,s)=>{if(i.type==="open"&&s&&typeof s=="object"&&"value"in s)return s.value})(n,o);return e.u("div",{className:"chat-bubble-container chat-right",children:[e.u("div",{className:"chat-bubble chat-bubble-right chat-bubble-text-only",children:e.u("div",{className:"chat-message-text",children:r||e.u("div",{className:"chat-message-no-response",children:"No response"})})}),e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${t.respondentAvatar["1x"]} 1x, ${t.respondentAvatar["2x"]} 2x`})]})},Bn=({card:n,avatars:o,isCurrentQuestion:t,currentQuestionBubbleRef:r})=>{const{endCard:i}=e.useConfig(s=>({endCard:s.endCard}));return e.u(e.g,{children:[e.u(ae,{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.u(ae,{avatars:o,hideAvatar:!0,isLeft:!0,message:{id:`caption-${n.name}`,type:"question",content:i.subheader}}),e.u(an,{})]})},Mn=({card:n,cardIndex:o,index:t,avatars:r,cardResponses:i,questionThinkingStates:s,startingQuestionIdx:d,currentQuestionBubbleRef:p,handleCardResponse:a})=>{const v=o===t,y=o<t,c=Ke(n);if(c)return e.u(Bn,{avatars:r,card:n,currentQuestionBubbleRef:p,isCurrentQuestion:v});const h=`${n.name}`,w=i.get(h),x=n.type==="open"||n.type==="aidynamicfollowup"||n.type==="aidynamicstandalone",b=s.get(h);if(n.type==="aidynamicfollowup"&&(n.props.loading===e.DynamicQuestionLoadingStates.failure||n.props.loading===void 0)||n.type==="aidynamicstandalone"&&n.props.loading===e.DynamicQuestionLoadingStates.failure)return e.u(e.g,{});const f=(o>(d??0)||le(n))&&n.type!=="thanks"&&n.type!=="uploading"&&(b===!0||b===void 0);return e.u(e.wn.Fragment,{children:[e.u(Rn,{avatars:r,card:n,currentQuestionBubbleRef:p,isCurrentQuestion:v,isThinking:f}),!f&&e.u(Ln,{avatars:r,card:n}),y&&x?e.u(Pn,{avatars:r,card:n,userResponse:w}):(!y||!x)&&!f&&e.u(ae,{avatars:r,isLeft:!1,message:{id:`card-${n.name}`,type:"card",content:""},children:e.u("div",{className:"chat-card-container",children:e.u(On,{card:n,className:c?"chat-thanks-card":"chat-card",isAnswered:y,next:v?a:()=>{}})})})]},`question-card-${n.name}`)},ae=e.wn.forwardRef(({message:n,isLeft:o=!1,children:t,avatars:r,hideAvatar:i=!1},s)=>{const d=o?"chat-bubble-left":"chat-bubble-right";return e.u("div",{className:`chat-bubble-container ${o?"chat-left":"chat-right"}${o&&i?" chat-no-avatar":""}`,ref:s,children:[o&&!i&&e.u("img",{alt:"AI Avatar",className:"chat-avatar chat-avatar-left",srcSet:`${r.agentAvatar["1x"]} 1x, ${r.agentAvatar["2x"]} 2x`}),e.u("div",{className:`chat-bubble ${d}`,children:t||e.u("div",{className:"chat-message-text",children:n.content})}),!o&&!i&&e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x`})]})});ae.displayName="ChatBubble";const Nn=()=>{const n=e.useConfig(t=>t.close),o=e.F(()=>()=>n(W.APP_ID),[n]);return e.u("div",{"aria-label":"Close button",className:"conversational-close-btn",onClick:o,onKeyPress:t=>{t.key==="Enter"&&o()},role:"button",tabIndex:0,children:e.u("svg",{fill:"none",height:"16px",viewBox:"0 0 13 13",width:"16px",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})},On=({card:n,next:o,className:t="",isAnswered:r=!1})=>{const i={className:r?`${t} answered-card`:t,next:r?()=>{}:o,questionId:n.name,type:n.type,isAnswered:r};switch(n.type){case"consentlegal":return e.u(sn,{...i,...n.props});case"likert":return e.u(dn,{...i,...n.props});case"matrix":return e.u(un,{...i,...n.props});case"multiplechoice":return e.u(pn,{...i,...n.props});case"multipleselect":return e.u(mn,{...i,...n.props});case"nps":return e.u(vn,{...i,...n.props});case"aidynamicstandalone":case"aidynamicfollowup":case"open":return e.u(gn,{...i,type:n.type,...n.props});case"rankorder":return e.u(hn,{...i,...n.props});case"recordedtask":return e.u(jn,{...i,...n.props});case"texturlprompt":return e.u(Tn,{...i,...n.props});case"thanks":return e.u(_n,{...i,...n.props});case"uploading":return e.u(Dn,{...i,...n.props});case"videovoice":return e.u(Sn,{...i,...n.props});default:return null}};exports.default=({cards:n,next:o,previousResponses:t})=>{const{cardResponses:r,setCardResponse:i}=(()=>{const[m,g]=e.h(new Map);return{cardResponses:m,setCardResponse:e.T((k,l)=>{g(u=>new Map(u).set(k,l))},[])}})(),{index:s,isLongFormSurvey:d,avatars:p,showSurveyBrand:a,forceBrandedLogo:v,marketingUrlLink:y,startingQuestionIdx:c,viewDocument:h,createDynamicFollowupQuestion:w,update:x}=e.useConfig(m=>({index:m.index,isLongFormSurvey:W.isLongFormSurvey(m.studyType),avatars:m.avatars,forceBrandedLogo:m.forceBrandedLogo,startingQuestionIdx:m.startingQuestionIdx,showSurveyBrand:m.showSurveyBrand,marketingUrlLink:e.buildMarketingUrl({marketingUrl:m.marketingUrl,slugName:m.slugName,surveyId:m.surveyId,forceBrandedLogo:m.forceBrandedLogo}),viewDocument:m.viewDocument,createDynamicFollowupQuestion:m.createDynamicFollowupQuestion,update:m.update})),{currentQuestionBubbleRef:b,scrollToCurrentQuestion:f}=(({viewDocument:m})=>{const g=e._(null),k=e.T(()=>{const l=m.querySelector(".ul-card-main-content");if(g.current&&l&&l instanceof HTMLElement){const u=g.current.offsetTop-l.offsetTop-16;l.scrollTo({top:Math.max(0,u),behavior:"smooth"})}},[]);return{currentQuestionBubbleRef:g,scrollToCurrentQuestion:k}})({viewDocument:h}),D=((m,g,k)=>{const[l,u]=e.h(new Map);return e.p(()=>{if(m.length>0&&g<m.length){const C=m[g],S=`${C.name}`,T=A=>{if(g>0){const O=m[g-1];if(le(O)){const q=`${O.name}`,Q=fe(O);if(A.get(q)!==Q)return new Map(A).set(q,Q)}}return A};if((g<=(k??0)||Ke(C))&&(C==null?void 0:C.type)!=="aidynamicstandalone")return u(A=>T(new Map(A).set(S,!1)));u(A=>{const O=!le(C)||fe(C);return T(new Map(A).set(S,O))});const N=setTimeout(()=>{u(A=>{const O=!!le(C)&&fe(C);return T(new Map(A).set(S,O))})},1e3);return()=>clearTimeout(N)}},[g,m,k]),l})(n,s,c);((m,g)=>{const{createDynamicStandaloneQuestion:k}=e.useConfig(C=>({createDynamicStandaloneQuestion:C.createDynamicStandaloneQuestion})),l=m[g],u=(l==null?void 0:l.type)==="aidynamicstandalone"&&l.props.loading===void 0?l.name:null;e.p(()=>{u!==null&&k({questionId:u})},[u,k])})(n,s);const M=((m,g)=>{const[k,l]=e.h(()=>new Set([m]));return e.p(()=>{l(u=>new Set(u).add(m))},[m]),e.p(()=>{const u=g??0;u>0&&l(C=>{const S=new Set(C);for(let T=0;T<=u;T++)S.add(T);return S})},[g]),k})(s,c),B=e.F(()=>({...t,...e.buildReadableResponseMap(n.map((m,g)=>{var k,l;return{...m,value:g<s?((k=r.get(`${m.name}`))==null?void 0:k.value)??null:null,secondaryValue:g<s?((l=r.get(`${m.name}`))==null?void 0:l.secondaryValue)??null:null}}))}),[t,r,n,s]);E.useSetAllResponsesRaw(B);const I=e.pipeReadableResponsesIntoCards(n,B);e.p(()=>{requestAnimationFrame(()=>{f()}),x()},[s,f,D,x]);const $=e.T((m,g)=>{if(!g)return;const k=I[s];if(!k)return;const l=`${k.name}`;i(l,m);const u={...m,questionText:e.getProcessedQuestionText(k)};if(k.childId&&(u==null?void 0:u.value)!=null){const C=e.buildReadableResponseMap([k].map(S=>({...S,value:(u==null?void 0:u.value)??null,secondaryValue:(u==null?void 0:u.secondaryValue)??null})));w({parentQuestionId:k.name,parentResponseConfig:C})}o([u])},[I,s,o,i]),H=I.map((m,g)=>({card:m,cardIndex:g})).filter(({cardIndex:m})=>M.has(m));return e.u("div",{className:"conversational-ui ul-conversational-ui","data-testid":"ui-container",children:[!d&&e.u(Nn,{}),e.u("div",{className:"chat-container",children:e.u("div",{className:"chat-messages",children:H.map(({card:m,cardIndex:g})=>e.u(Mn,{avatars:p,card:m,cardIndex:g,cardResponses:r,currentQuestionBubbleRef:b,handleCardResponse:$,index:s,questionThinkingStates:D,startingQuestionIdx:c},`question-card-${m.name}`))})}),d&&e.u("div",{className:"long-form-question-footer-container-logo",children:a&&e.u(e.SprigBrandLogo,{forceBrandedLogo:v,marketingUrlLink:y})})]})};
@@ -0,0 +1,4 @@
1
+ const t = 'html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}ol,ul{padding-inline-start:1em}.ul-card-text__button{background-color:var(--theme);border-radius:8px;padding:11px 16px;gap:5px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button:disabled>svg path,.ul-card-text__button.sprig-button-disabled>svg path{stroke:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff;color:#5d696f}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:15px;justify-content:center}.sprig-question-footer-container{padding:0;align-items:center}.ul-card__button-checkmark{display:flex;align-items:center;font-size:15px;gap:5px;padding:11px 16px;border-radius:8px;background-color:var(--theme);color:#fff}.ul-card__button-checkmark:disabled{background-color:var(--theme);opacity:.5;color:#fff}.ul-card__button-checkmark:disabled>svg path{stroke:#fff}.ul-conversational-ui{width:100%;height:100%;display:flex;flex-direction:column;min-height:500px;font-size:15px;position:relative}.ul-card__button-wrapper{margin-top:4px;display:flex;gap:16px;justify-content:right;align-self:stretch}.conversational-close-btn{position:fixed;top:20px;right:16px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:50%;cursor:pointer;z-index:1000}.conversational-close-btn:hover{background:#ffffff80}.chat-container{flex:1;display:flex;flex-direction:column;align-items:center}.chat-messages{flex:1;display:flex;flex-direction:column;max-width:600px;width:100%;padding:36px 16px 44px;gap:8px;box-sizing:border-box}.chat-message-no-response{font-style:italic;color:#666}.chat-card .choice{margin-bottom:0;background-color:unset;padding:0;line-height:2;border:none;min-height:28px}.chat-card .choice.ul-select-active-dynamic-style{border:none}.chat-bubble-container{display:flex;flex-direction:row;align-items:flex-start;width:100%;animation:fadeInUp .3s ease-out}.chat-bubble-container img{display:none}.chat-left{align-self:flex-start;width:auto;justify-content:flex-start}.chat-container .chat-bubble-container.chat-left.chat-no-avatar .chat-bubble{margin-left:0}.chat-right{align-self:flex-end;width:100%;justify-content:flex-end;margin-top:8px}.sprig-question-body{word-wrap:break-word;position:relative;border-radius:8px;box-sizing:border-box;max-width:448px;gap:8px;padding:0;overflow:unset}.chat-bubble-text-only{width:auto;max-width:286px}.chat-bubble.chat-bubble-right .chat-message-text{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#e8e7e6}.chat-bubble-left{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#f7f6f5}.chat-bubble.chat-bubble-right:has(.answered-card) .sprig-question-body{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#e8e7e6}.chat-bubble.chat-bubble-right:not(:has(.chat-bubble-text-only)) .sprig-question-body{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#e8e7e6}.chat-message-text{line-height:1.4;margin:0;text-align:left;color:#141312;font-size:14px;font-weight:400;word-wrap:break-word}.chat-card-container{padding:0;background:transparent}@media (max-width: 600px){.conversational-ui .long-form-question-footer-container-logo{position:unset}}.chat-card-container .chat-card{display:flex;flex-direction:column;gap:8px}.chat-thanks-card{background:transparent;box-shadow:none;text-align:center}.end-of-survey-text{text-align:center;color:#999;font-size:14px;margin-top:8px;font-weight:400}.answered-card{pointer-events:none;opacity:.7;position:relative}.footer{width:100%;margin-top:12px;font-size:12px;font-weight:400;line-height:12px;color:#000000b3}.answered-card:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:#ffffff4d;pointer-events:none;border-radius:inherit}.answered-card button,.answered-card input,.answered-card textarea,.answered-card select{pointer-events:none}.answered-card:not(.ul-card__consent-legal):not(.ul-card__text-url-prompt) .ul-card-button-group *{display:none}.sprig-question-footer-container{padding:0;align-items:end}.chat-card.ul-card--video .sprig-question-footer-container{flex-direction:row;justify-content:flex-end;align-items:center}.ul-card-text__button{font-size:13px}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.chat-bubble-container.chat-left.chat-no-avatar .chat-bubble{margin-left:42px}.ul-card-vertical__button-wrapper{align-items:end}.ul-card-skip__button{padding:0 16px}.sprig-stretch{padding:16px;display:flex;flex-direction:column;gap:8px;border-radius:8px;background:#e8e7e6}.sprig-stretch input{background-color:#fff}.ul-card--likert__numbers{background-color:#fff;display:flex;width:100%;box-sizing:border-box;flex-wrap:nowrap;justify-content:space-between;align-items:center}.ul-card--likert__numbers:has(.likert-star,.likert-smiley){background-color:transparent;justify-content:space-evenly}.likert-smiley>svg{scale:1.176}.ul-card--likert__numbers .likert-star,.ul-card--likert__numbers .likert-smiley{min-width:24px;min-height:24px;max-width:38px;max-height:38px;flex:0 1 auto;transition:height .2s,width .2s}.ul-card--likert__labels{font-weight:400;color:#2f2e2c;text-align:center;word-break:break-word;font-size:.95rem}.likert-number,.likert-smiley,.likert-star{aspect-ratio:1 / 1;min-height:34px;max-height:54px;box-sizing:border-box;flex:1 1 auto;display:flex;align-items:center;justify-content:center;transition:height .2s,width .2s,font-size .2s}.sprig-question-body:has(.likert-number,.likert-smiley,.likert-star){max-width:100%;padding:0 .5rem;display:flex;flex-direction:column}.chat-bubble.chat-bubble-right:has(.likert-number,.likert-smiley,.likert-star){width:100%}.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:700px}@media (min-width: 1200px){.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:900px}}@media (max-width: 768px){.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:100%;width:100%;padding:0 4px}}.chat-card-container .ul-card--matrix_container{max-width:100%;overflow-x:auto}.chat-card-container .ul-card--matrix_grid{min-width:100%}.chat-card-container .ul-card__matrix{width:100%}.chat-card-container .choice-label-container{gap:8px}@media (max-width: 768px){.sprig-header-label-container,.sprig-header-label,.choice{font-size:14px}.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:100%;width:100%}.chat-card-container .ul-card--matrix_container{overflow-x:auto;-webkit-overflow-scrolling:touch}}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}.ul-conversational-ui .chat-card-container .chat-card.ul-card--nps{width:100%;min-width:262px;max-width:500px;box-sizing:border-box}.ul-conversational-ui .ul-card--nps__numbers{background-color:#fff}.ul-conversational-ui .nps-number{color:#2f2e2c}@media (max-width: 768px){.ul-conversational-ui .nps-number{font-size:16px;height:35px}.ul-conversational-ui .ul-card--nps__labels{font-size:12px;font-weight:400;color:#2f2e2c}}@media (min-width: 769px){.ul-conversational-ui .nps-number{font-size:20px;height:40px}.ul-conversational-ui .ul-card--nps__labels{font-size:14px;font-weight:400;color:#2f2e2c}}.ul-card-rank__option{text-align:left;background:#0000000d;margin-bottom:8px}.ul-card-rank__option.is-dragging{background-color:#0000000d;border:none}.ul-card-rank__labels{font-weight:400;color:#2f2e2c}@media (min-width: 1200px){.ul-card--rank__question-inner-container{max-width:900px}}@media (max-width: 768px){.ul-card--rank__question-inner-container{min-width:0;max-width:100%;width:100%;font-size:14px}.ul-card-rank__labels{font-size:14px}.ul-card-rank__option>span{font-size:14px}.ul-card-rank__option>select{font-size:14px}}.select-button{align-items:center;background-color:#fff;border-radius:8px;border:1px solid #E8E7E6;cursor:pointer;display:flex;font-size:15px;justify-content:space-between;margin-bottom:8px;padding:4px 8px 4px 16px;width:100%}.select-button:hover{background-color:#f3f3f3}.select-button:active{background-color:#eee}.select-button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select-button.select-button-placeholder{color:#b0b5b7}.select-button svg{flex-shrink:0}.select-list{position:relative;height:fit-content;padding:4px 0;z-index:100;background-color:#fff;border:1px solid #E2E3E1;box-shadow:0 16px 24px #0b23300d,0 4px 12px #0b233008;border-radius:8px;overflow-y:scroll;width:100%}.select-option{align-items:center;cursor:pointer;display:flex;font-size:15px;gap:8px;line-height:20px;padding:8px 16px}.select-option:hover{background-color:#f3f3f3}.chat-card .select-checkbox{border:1px solid #323232;background-color:#fff}.chat-card .select-radio{box-shadow:unset;border:1px solid #323232;background-color:#f3f3f3}.chat-card .select-radio.ul-select-active-dynamic-style{border:1px solid #323232;background-color:#000;box-shadow:inset 0 0 1px 3px #fff}.ul-card-text{margin-top:2px;margin-bottom:3px;gap:8px;display:flex;flex-direction:column;justify-content:center;padding:0;width:100%}.ul-card-text__container{align-items:center;box-sizing:border-box;display:flex;justify-content:center;margin-bottom:12px;flex:1 1 auto;flex-direction:row;border-radius:8px;gap:0;width:auto;min-width:180px;max-width:100%}@media (max-width: 768px){.ul-card-text__container{max-width:100%;width:100%;margin-bottom:8px}}.ul-card-text__container textarea{border-radius:8px;width:60vw;box-sizing:border-box}.ul-card-text__container textarea:focus{border:1px solid #0B2330}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:#fff;box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:8px;resize:none;width:100%;border-radius:3px;line-height:20px;overflow-wrap:break-word;min-width:180px;max-width:100%}@media (max-width: 768px){.ul-card-text__input{min-width:0;max-width:100%;width:100%;font-size:14px}}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:#fff}.ul-card-text__input--desktop:hover:not(:focus){background-color:#fff}@media (max-width: 768px){.ul-card-text__input{font-size:14px}}.ul-card__text-url-prompt .sprig-question-body{padding:0}.ul-card__text-url-prompt .ul-card-button-group{padding:10px}.chat-card.ul-card__text-url-prompt .ul-card-button-group{align-items:flex-end;padding:0}@keyframes flashingDot{0%{background-color:#262136}50%,to{background-color:#f8f9fa}}.thinking-dots-container{display:flex;justify-content:center;align-items:flex-end;position:relative;width:18px;margin-top:.5em}.thinking-dot{position:relative;width:3px;height:3px;border-radius:5px;background-color:#262136;color:#262136;animation:flashingDot 1s infinite linear alternate;animation-delay:.5s}.thinking-dot:before,.thinking-dot:after{content:"";display:inline-block;position:absolute;top:0;width:3px;height:3px;border-radius:5px;background-color:#262136;color:#262136;animation:flashingDot 1s infinite alternate}.thinking-dot:before{left:-5px;animation-delay:0s}.thinking-dot:after{left:5px;animation-delay:1s}[id^=ul-card-video__player_recorder],[id^=ul-card-video__question_player]{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.answered-card [id^=ul-card-video__player_recorder] .ul-control-panel{display:none!important}';
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.default='html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}ol,ul{padding-inline-start:1em}.ul-card-text__button{background-color:var(--theme);border-radius:8px;padding:11px 16px;gap:5px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button:disabled>svg path,.ul-card-text__button.sprig-button-disabled>svg path{stroke:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff;color:#5d696f}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:15px;justify-content:center}.sprig-question-footer-container{padding:0;align-items:center}.ul-card__button-checkmark{display:flex;align-items:center;font-size:15px;gap:5px;padding:11px 16px;border-radius:8px;background-color:var(--theme);color:#fff}.ul-card__button-checkmark:disabled{background-color:var(--theme);opacity:.5;color:#fff}.ul-card__button-checkmark:disabled>svg path{stroke:#fff}.ul-conversational-ui{width:100%;height:100%;display:flex;flex-direction:column;min-height:500px;font-size:15px;position:relative}.ul-card__button-wrapper{margin-top:4px;display:flex;gap:16px;justify-content:right;align-self:stretch}.conversational-close-btn{position:fixed;top:20px;right:16px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:50%;cursor:pointer;z-index:1000}.conversational-close-btn:hover{background:#ffffff80}.chat-container{flex:1;display:flex;flex-direction:column;align-items:center}.chat-messages{flex:1;display:flex;flex-direction:column;max-width:600px;width:100%;padding:36px 16px 44px;gap:8px;box-sizing:border-box}.chat-message-no-response{font-style:italic;color:#666}.chat-card .choice{margin-bottom:0;background-color:unset;padding:0;line-height:2;border:none;min-height:28px}.chat-card .choice.ul-select-active-dynamic-style{border:none}.chat-bubble-container{display:flex;flex-direction:row;align-items:flex-start;width:100%;animation:fadeInUp .3s ease-out}.chat-bubble-container img{display:none}.chat-left{align-self:flex-start;width:auto;justify-content:flex-start}.chat-container .chat-bubble-container.chat-left.chat-no-avatar .chat-bubble{margin-left:0}.chat-right{align-self:flex-end;width:100%;justify-content:flex-end;margin-top:8px}.sprig-question-body{word-wrap:break-word;position:relative;border-radius:8px;box-sizing:border-box;max-width:448px;gap:8px;padding:0;overflow:unset}.chat-bubble-text-only{width:auto;max-width:286px}.chat-bubble.chat-bubble-right .chat-message-text{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#e8e7e6}.chat-bubble-left{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#f7f6f5}.chat-bubble.chat-bubble-right:has(.answered-card) .sprig-question-body{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#e8e7e6}.chat-bubble.chat-bubble-right:not(:has(.chat-bubble-text-only)) .sprig-question-body{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#e8e7e6}.chat-message-text{line-height:1.4;margin:0;text-align:left;color:#141312;font-size:14px;font-weight:400;word-wrap:break-word}.chat-card-container{padding:0;background:transparent}@media (max-width: 600px){.conversational-ui .long-form-question-footer-container-logo{position:unset}}.chat-card-container .chat-card{display:flex;flex-direction:column;gap:8px}.chat-thanks-card{background:transparent;box-shadow:none;text-align:center}.end-of-survey-text{text-align:center;color:#999;font-size:14px;margin-top:8px;font-weight:400}.answered-card{pointer-events:none;opacity:.7;position:relative}.footer{width:100%;margin-top:12px;font-size:12px;font-weight:400;line-height:12px;color:#000000b3}.answered-card:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:#ffffff4d;pointer-events:none;border-radius:inherit}.answered-card button,.answered-card input,.answered-card textarea,.answered-card select{pointer-events:none}.answered-card:not(.ul-card__consent-legal):not(.ul-card__text-url-prompt) .ul-card-button-group *{display:none}.sprig-question-footer-container{padding:0;align-items:end}.chat-card.ul-card--video .sprig-question-footer-container{flex-direction:row;justify-content:flex-end;align-items:center}.ul-card-text__button{font-size:13px}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.chat-bubble-container.chat-left.chat-no-avatar .chat-bubble{margin-left:42px}.ul-card-vertical__button-wrapper{align-items:end}.ul-card-skip__button{padding:0 16px}.sprig-stretch{padding:16px;display:flex;flex-direction:column;gap:8px;border-radius:8px;background:#e8e7e6}.sprig-stretch input{background-color:#fff}.ul-card--likert__numbers{background-color:#fff;display:flex;width:100%;box-sizing:border-box;flex-wrap:nowrap;justify-content:space-between;align-items:center}.ul-card--likert__numbers:has(.likert-star,.likert-smiley){background-color:transparent;justify-content:space-evenly}.likert-smiley>svg{scale:1.176}.ul-card--likert__numbers .likert-star,.ul-card--likert__numbers .likert-smiley{min-width:24px;min-height:24px;max-width:38px;max-height:38px;flex:0 1 auto;transition:height .2s,width .2s}.ul-card--likert__labels{font-weight:400;color:#2f2e2c;text-align:center;word-break:break-word;font-size:.95rem}.likert-number,.likert-smiley,.likert-star{aspect-ratio:1 / 1;min-height:34px;max-height:54px;box-sizing:border-box;flex:1 1 auto;display:flex;align-items:center;justify-content:center;transition:height .2s,width .2s,font-size .2s}.sprig-question-body:has(.likert-number,.likert-smiley,.likert-star){max-width:100%;padding:0 .5rem;display:flex;flex-direction:column}.chat-bubble.chat-bubble-right:has(.likert-number,.likert-smiley,.likert-star){width:100%}.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:700px}@media (min-width: 1200px){.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:900px}}@media (max-width: 768px){.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:100%;width:100%;padding:0 4px}}.chat-card-container .ul-card--matrix_container{max-width:100%;overflow-x:auto}.chat-card-container .ul-card--matrix_grid{min-width:100%}.chat-card-container .ul-card__matrix{width:100%}.chat-card-container .choice-label-container{gap:8px}@media (max-width: 768px){.sprig-header-label-container,.sprig-header-label,.choice{font-size:14px}.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:100%;width:100%}.chat-card-container .ul-card--matrix_container{overflow-x:auto;-webkit-overflow-scrolling:touch}}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}.ul-conversational-ui .chat-card-container .chat-card.ul-card--nps{width:100%;min-width:262px;max-width:500px;box-sizing:border-box}.ul-conversational-ui .ul-card--nps__numbers{background-color:#fff}.ul-conversational-ui .nps-number{color:#2f2e2c}@media (max-width: 768px){.ul-conversational-ui .nps-number{font-size:16px;height:35px}.ul-conversational-ui .ul-card--nps__labels{font-size:12px;font-weight:400;color:#2f2e2c}}@media (min-width: 769px){.ul-conversational-ui .nps-number{font-size:20px;height:40px}.ul-conversational-ui .ul-card--nps__labels{font-size:14px;font-weight:400;color:#2f2e2c}}.ul-card-rank__option{text-align:left;background:#0000000d;margin-bottom:8px}.ul-card-rank__option.is-dragging{background-color:#0000000d;border:none}.ul-card-rank__labels{font-weight:400;color:#2f2e2c}@media (min-width: 1200px){.ul-card--rank__question-inner-container{max-width:900px}}@media (max-width: 768px){.ul-card--rank__question-inner-container{min-width:0;max-width:100%;width:100%;font-size:14px}.ul-card-rank__labels{font-size:14px}.ul-card-rank__option>span{font-size:14px}.ul-card-rank__option>select{font-size:14px}}.select-button{align-items:center;background-color:#fff;border-radius:8px;border:1px solid #E8E7E6;cursor:pointer;display:flex;font-size:15px;justify-content:space-between;margin-bottom:8px;padding:4px 8px 4px 16px;width:100%}.select-button:hover{background-color:#f3f3f3}.select-button:active{background-color:#eee}.select-button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select-button.select-button-placeholder{color:#b0b5b7}.select-button svg{flex-shrink:0}.select-list{position:relative;height:fit-content;padding:4px 0;z-index:100;background-color:#fff;border:1px solid #E2E3E1;box-shadow:0 16px 24px #0b23300d,0 4px 12px #0b233008;border-radius:8px;overflow-y:scroll;width:100%}.select-option{align-items:center;cursor:pointer;display:flex;font-size:15px;gap:8px;line-height:20px;padding:8px 16px}.select-option:hover{background-color:#f3f3f3}.chat-card .select-checkbox{border:1px solid #323232;background-color:#fff}.chat-card .select-radio{box-shadow:unset;border:1px solid #323232;background-color:#f3f3f3}.chat-card .select-radio.ul-select-active-dynamic-style{border:1px solid #323232;background-color:#000;box-shadow:inset 0 0 1px 3px #fff}.ul-card-text{margin-top:2px;margin-bottom:3px;gap:8px;display:flex;flex-direction:column;justify-content:center;padding:0;width:100%}.ul-card-text__container{align-items:center;box-sizing:border-box;display:flex;justify-content:center;margin-bottom:12px;flex:1 1 auto;flex-direction:row;border-radius:8px;gap:0;width:auto;min-width:180px;max-width:100%}@media (max-width: 768px){.ul-card-text__container{max-width:100%;width:100%;margin-bottom:8px}}.ul-card-text__container textarea{border-radius:8px;width:60vw;box-sizing:border-box}.ul-card-text__container textarea:focus{border:1px solid #0B2330}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:#fff;box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:8px;resize:none;width:100%;border-radius:3px;line-height:20px;overflow-wrap:break-word;min-width:180px;max-width:100%}@media (max-width: 768px){.ul-card-text__input{min-width:0;max-width:100%;width:100%;font-size:14px}}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:#fff}.ul-card-text__input--desktop:hover:not(:focus){background-color:#fff}@media (max-width: 768px){.ul-card-text__input{font-size:14px}}.ul-card__text-url-prompt .sprig-question-body{padding:0}.ul-card__text-url-prompt .ul-card-button-group{padding:10px}.chat-card.ul-card__text-url-prompt .ul-card-button-group{align-items:flex-end;padding:0}@keyframes flashingDot{0%{background-color:#262136}50%,to{background-color:#f8f9fa}}.thinking-dots-container{display:flex;justify-content:center;align-items:flex-end;position:relative;width:18px;margin-top:.5em}.thinking-dot{position:relative;width:3px;height:3px;border-radius:5px;background-color:#262136;color:#262136;animation:flashingDot 1s infinite linear alternate;animation-delay:.5s}.thinking-dot:before,.thinking-dot:after{content:"";display:inline-block;position:absolute;top:0;width:3px;height:3px;border-radius:5px;background-color:#262136;color:#262136;animation:flashingDot 1s infinite alternate}.thinking-dot:before{left:-5px;animation-delay:0s}.thinking-dot:after{left:5px;animation-delay:1s}[id^=ul-card-video__player_recorder],[id^=ul-card-video__question_player]{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.answered-card [id^=ul-card-video__player_recorder] .ul-control-panel{display:none!important}';
@@ -0,0 +1,193 @@
1
+ import { a as s, c as C, u as k, F as Z, h as R, p as E, _ as S, d as H, x as Q, b as q, y as _, z as G } from "./view-Bu60Bbor.js";
2
+ import { j as J, k as X, l as Y, m as ee, E as j } from "./index-Rlf7G5CR.js";
3
+ const te = (e) => s("button", { ...e, className: C("ul-card-text__button", e.className), id: "ul-card-text__button" }), oe = ({ html: e, ...o }) => {
4
+ const { enableCspTrustedTypes: i } = k((n) => ({ enableCspTrustedTypes: n.enableCspTrustedTypes })), t = Z(() => J(e, i), [i, e]);
5
+ return s("div", { ...o, dangerouslySetInnerHTML: { __html: t } });
6
+ }, M = () => {
7
+ const { viewDocument: e } = k((t) => ({ viewDocument: t.viewDocument })), [o, i] = R(!1);
8
+ return E(() => {
9
+ const t = e.querySelector(".sprig-question-body"), n = new ResizeObserver(() => {
10
+ window.requestAnimationFrame(() => {
11
+ i(!!(t && X(t) && t.scrollHeight > t.offsetHeight));
12
+ });
13
+ });
14
+ return t && n.observe(t), () => {
15
+ t && n.disconnect();
16
+ };
17
+ }, [e]), o;
18
+ }, A = ({ plainText: e, richText: o, id: i, className: t, isHeader: n, showAsterisk: r }) => o ? s(oe, { className: t, html: o, id: i }) : e ? n ? s("h1", { className: t, id: i, children: [e, r && "*"] }) : s("p", { className: t, id: i, children: e }) : null, ue = ({ message: e, properties: o, isRequired: i }) => {
19
+ const t = S(null), n = o == null ? void 0 : o.captionText, r = M();
20
+ return s("div", { className: C("question-header-container", "sprig-header-container", r ? "sprig-border-bottom" : null), ref: t, children: [s("div", { className: "question-header-button-container", children: s(A, { className: "ul-question", id: "ul-question", isHeader: !0, plainText: e, richText: o == null ? void 0 : o.questionHtml, showAsterisk: i }) }), s(A, { className: "ul-caption", id: "ul-caption", plainText: n, richText: o == null ? void 0 : o.captionHtml })] });
21
+ }, ne = () => s("svg", { fill: "none", height: "10", viewBox: "0 0 13 10", width: "13", xmlns: "http://www.w3.org/2000/svg", children: s("path", { d: "M11.5 1.5L4.5 8.5L1 5", stroke: "#FFFFFF", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) }), pe = ({ isSubmitDisabled: e, handleSubmit: o }) => s("div", { className: "ul-card-longform__submit-button-container", children: s(te, { className: "ul-card-longform__submit-button", disabled: e, onClick: o, children: ["OK ", s(ne, {})] }) }), he = (e, o) => {
22
+ const i = S(0);
23
+ return () => {
24
+ if (e.current) {
25
+ const t = e.current;
26
+ t.style.height = "1px";
27
+ const n = t.scrollHeight + (t.offsetHeight - t.clientHeight), r = parseInt(window.getComputedStyle(t).getPropertyValue("max-height")), a = n <= r ? n : r;
28
+ i.current !== a && requestAnimationFrame(() => {
29
+ o();
30
+ }), i.current = a, t.style.height = `${a}px`;
31
+ }
32
+ };
33
+ }, be = (e) => {
34
+ const o = S(), { setAllResponsesRaw: i } = k((t) => ({ setAllResponsesRaw: t.setAllResponsesRaw }));
35
+ E(() => {
36
+ const t = o.current;
37
+ (!t || Object.keys(e).length !== Object.keys(t).length || Object.keys(e).some((n) => e[n] !== t[n])) && (i(e), o.current = e);
38
+ }, [e, i]);
39
+ }, F = ({ buttonText: e = "View Prototype", handleClick: o }) => s("button", { className: "prototype-button", onClick: o, children: e }, "prototype-btn"), me = ({ embeddedType: e = "prototype", properties: o, children: i }) => {
40
+ var y;
41
+ const { handleClickEmbedButton: t, hasViewedEmbed: n, headers: r, useDesktopPrototype: a } = k((u) => ({ handleClickEmbedButton: u.handleClickEmbedButton, hasViewedEmbed: u.hasViewedEmbed, headers: u.headers, useDesktopPrototype: u.useDesktopPrototype })), h = (o == null ? void 0 : o.conceptUrl) || ((y = o == null ? void 0 : o.consentDocument) == null ? void 0 : y.url), l = window.innerWidth < ee, p = r["userleap-platform"], d = (u, f) => {
42
+ u.preventDefault(), t(f);
43
+ };
44
+ if ((() => {
45
+ const { update: u, index: f, isConversationalUI: v, viewDocument: T } = k(({ update: m, index: b, isConversationalUI: w, viewDocument: g }) => ({ update: m, index: b, isConversationalUI: w, viewDocument: g })), c = Y(u, 100);
46
+ E(() => {
47
+ if (v) return;
48
+ const m = new ResizeObserver(c), b = T.querySelector(".ul-card__container");
49
+ return b && m.observe(b, { box: "border-box" }), () => {
50
+ m.disconnect();
51
+ };
52
+ }, [c, u, f, v, T]);
53
+ })(), !a && l && !n && h && ["email", "link"].includes(p)) {
54
+ if (e === "prototype") return s(F, { handleClick: (u) => {
55
+ d(u, "question.prototype.click");
56
+ } });
57
+ if (e === "pdf") return s(F, { buttonText: (o == null ? void 0 : o.viewDocumentText) || "View Document", handleClick: (u) => {
58
+ d(u, "question.agreement.click");
59
+ } });
60
+ }
61
+ return s(H, { children: i });
62
+ }, V = ({ isSelected: e, id: o, divId: i, themeColor: t, disabled: n = !1 }) => s("div", { "aria-checked": e, "aria-disabled": n, "aria-labelledby": `label-${o}`, className: "select-checkbox", id: i, role: "checkbox", style: { ...e ? { backgroundColor: t, borderColor: t, boxShadow: "none" } : {}, ...n ? { opacity: 0.5 } : {} }, tabIndex: n ? -1 : 0, children: e && s(Q, {}) }), ve = ({ ariaLabel: e, border: o, choiceStyle: i = {}, label: t, isSelected: n, value: r, text: a, id: h, isRadio: l, useMobileStyling: p, error: d, allowTextEntry: y, noneOfTheAbove: u, promptText: f, disabled: v = !1, onUserInputChanged: T }) => {
63
+ const { styleNonce: c, viewDocument: m } = k((x) => ({ styleNonce: x.styleNonce, viewDocument: x.viewDocument })), [b, w] = R(!1);
64
+ ie(m, o, c);
65
+ const g = ({ isSelected: x, userText: I }) => {
66
+ T && T({ id: h, selected: x, value: r, userText: I, noneOfTheAbove: u });
67
+ }, D = (x) => {
68
+ v || (x.stopPropagation(), g({ isSelected: l || !n, userText: a }), w(!1));
69
+ }, z = () => {
70
+ b || w(!0);
71
+ }, O = () => {
72
+ b && w(!1);
73
+ }, N = { onClick: (x) => D(x), onKeyPress: (x) => ((I) => {
74
+ v || I.key !== "Enter" && I.key !== " " || D(I);
75
+ })(x) };
76
+ "ontouchstart" in m.documentElement ? (N.onTouchStart = O, N.onTouchCancel = O, N.onTouchEnd = O) : (N.onMouseDown = z, N.onMouseLeave = O);
77
+ const L = l ? `radio-${h}` : `checkbox-${h}`, P = n || b ? [$] : [], K = [...d ? [B] : [], ...P, ...v ? ["ul-choice-disabled"] : []], W = t ? { "aria-labelledby": `label-${h}` } : { "aria-label": e };
78
+ return s("div", { className: C(q("choice", p), ...K), id: `choice-div-${h}`, style: { ...i, ...d ? { borderColor: j } : {}, ...v ? { opacity: 0.5, cursor: "not-allowed" } : {} }, ...v ? {} : N, "aria-disabled": v, children: [s("div", { className: C("choice-label-container"), children: [l ? s("div", { ...W, className: C("select-radio", ...P), id: L, role: "radio", tabIndex: 0 }) : s(V, { disabled: v, divId: L, id: h, isSelected: n, themeColor: o }), t && s("label", { className: C(q("select-label", p)), htmlFor: L, id: `label-${h}`, children: t })] }), y && n && s("div", { className: C("choice-text-entry-container", ...P), children: s(se, { onTextChange: (x) => g({ isSelected: n, userText: x }), promptText: f || "Please specify", textValue: a, useMobileStyling: p }) })] });
79
+ }, se = ({ promptText: e, textValue: o, onTextChange: i, useMobileStyling: t }) => {
80
+ const n = S(null);
81
+ return E(() => {
82
+ n.current && n.current.focus();
83
+ }, []), s("textarea", { "aria-label": e, "aria-multiline": "true", "aria-placeholder": e, className: C(q("choice-text-input", t)), "data-gramm": "false", maxLength: 5e3, name: "text", onChange: (r) => {
84
+ r.stopPropagation(), i(r.currentTarget.value);
85
+ }, onClick: (r) => {
86
+ r.stopPropagation();
87
+ }, onKeyPress: (r) => {
88
+ r.stopPropagation();
89
+ }, placeholder: e, ref: n, role: "textbox", rows: 1, value: o });
90
+ }, U = "ul-select-style-element", $ = "ul-select-active-dynamic-style", B = "ul-select-error-dynamic-style", ie = (e, o, i) => {
91
+ let t = e.getElementById(U), n = !1;
92
+ t || (t = e.createElement("style"), n = !0), t.tagName.toLowerCase() === "style" && (t.id = U, i && (t.nonce = i), t.textContent = re(o), n && e.head.appendChild(t));
93
+ }, re = (e) => `
94
+ .${$} {
95
+ border-color: ${e};
96
+ }
97
+ .${$} .select-radio, .${$}.select-radio {
98
+ border: 6px solid ${e};
99
+ box-shadow: none;
100
+ }
101
+ .${B} {
102
+ border-color: ${j};
103
+ }
104
+ `, we = ({ children: e }) => s("div", { className: "sprig-question-body", children: e }), xe = ({ children: e }) => {
105
+ const o = M(), { isConversationalUI: i } = k((t) => ({ isConversationalUI: t.isConversationalUI }));
106
+ return s("div", { className: C("sprig-question-footer-container", o && !i ? "sprig-border-top" : null), children: e });
107
+ }, le = ({ options: e, selectItem: o, selectedOptions: i, showCheckbox: t, disabledOptions: n, dropdownFooter: r, panelRef: a }) => {
108
+ const { themeColor: h } = k((l) => ({ doc: l.viewDocument, themeColor: l.border }));
109
+ return s("div", { className: "select-list", ref: a, children: [e.map((l) => {
110
+ return s("div", { "aria-disabled": n == null ? void 0 : n.includes(l), className: C("select-option", n != null && n.includes(l) ? "ul-choice-disabled" : ""), onClick: (d) => {
111
+ n != null && n.includes(l) || (o(l), d.stopPropagation());
112
+ }, role: "option", style: { ...n != null && n.includes(l) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [t && s(V, { divId: (p = l.id, `checkbox-div-${p}`), id: l.id, isSelected: i.includes(l), themeColor: h }), l.label] }, l.id);
113
+ var p;
114
+ }), r] });
115
+ }, ye = ({ isMultiSelect: e = !1, multiselectText: o = "choices selected", onChange: i, options: t, placeholderText: n, value: r, disabledOptions: a = [], dropdownFooter: h }) => {
116
+ const [l, p] = R(!1), d = S(null), { viewDocument: y, update: u, isConversationalUI: f } = k((c) => ({ viewDocument: c.viewDocument, update: c.update, isConversationalUI: c.isConversationalUI })), v = () => {
117
+ p(!l);
118
+ };
119
+ _(() => {
120
+ f || u();
121
+ }, [l, f, u]), _(() => {
122
+ l && d.current && d.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
123
+ }, [l]), E(() => {
124
+ var m;
125
+ const c = (b) => {
126
+ const w = b.target;
127
+ (w == null ? void 0 : w.closest(".select-option.ul-choice-disabled")) || p(!1);
128
+ };
129
+ y.addEventListener("click", c);
130
+ try {
131
+ (m = window.parent) == null || m.addEventListener("click", c);
132
+ } catch {
133
+ window.addEventListener("click", c);
134
+ }
135
+ return () => {
136
+ var b;
137
+ y.removeEventListener("click", c);
138
+ try {
139
+ (b = window.parent) == null || b.removeEventListener("click", c);
140
+ } catch {
141
+ window.removeEventListener("click", c);
142
+ }
143
+ };
144
+ }, [y]);
145
+ const T = r.length === 0 ? ["select-button-placeholder"] : [];
146
+ return s(H, { children: [s("button", { "aria-label": "choice dropdown button", className: C("select-button", ...T), onClick: (c) => {
147
+ c.stopPropagation(), v();
148
+ }, type: "button", children: [s("span", { children: r.length === 0 ? n : r.length === 1 ? r[0].label : `${r.length} ${o}` }), s(G, {})] }), l && s(le, { disabledOptions: a, dropdownFooter: h, options: t, panelRef: d, selectedOptions: r, selectItem: (c) => {
149
+ var w;
150
+ const m = r.some((g) => g.id === c.id), b = r.some((g) => {
151
+ var D;
152
+ return (D = g.optionProperties) == null ? void 0 : D.noneOfTheAbove;
153
+ });
154
+ (w = c.optionProperties) != null && w.noneOfTheAbove && !m ? i([c]) : e ? i(m ? r.filter((g) => g.id !== c.id) : b ? [c] : [...r, c]) : m || i([c]), e || v();
155
+ }, showCheckbox: e })] });
156
+ }, ae = { "{{user_id}}": "externalUserId", "{{email}}": "email" }, ge = (e = void 0, o = {}) => {
157
+ if (!e) return e;
158
+ const i = ["http:", "https:", "itms-apps:", "market:"], t = ((a) => /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(a) ? a : `http://${a}`)(e);
159
+ if (!t) return;
160
+ try {
161
+ const a = new URL(t);
162
+ if (!a.protocol || !i.includes(a.protocol)) return;
163
+ } catch {
164
+ return;
165
+ }
166
+ const n = [], r = ((a, h, l) => {
167
+ let p = a;
168
+ for (const [d, y] of Object.entries(ae)) if (p.toLowerCase().includes(d)) if (h[y]) {
169
+ const u = new RegExp(d, "gi");
170
+ p = p.replace(u, h[y]);
171
+ } else l.push(d);
172
+ return p;
173
+ })(t, o, n);
174
+ return n.length === 0 ? r : ((a, h) => {
175
+ if (!a.includes("?")) return a;
176
+ const l = a.slice(0, a.indexOf("?")), p = a.slice(a.indexOf("?") + 1).split("&").map((d) => d.split("=")).filter((d) => !h.includes(d[1]));
177
+ return p.length === 0 ? l : `${l}?${p.map((d) => d.join("=")).join("&")}`;
178
+ })(r, n);
179
+ };
180
+ export {
181
+ te as B,
182
+ ue as H,
183
+ pe as L,
184
+ me as M,
185
+ ve as O,
186
+ we as Q,
187
+ ye as S,
188
+ oe as a,
189
+ xe as b,
190
+ be as c,
191
+ ge as g,
192
+ he as u
193
+ };